body {
    /* background: url("https://avatars.githubusercontent.com/u/66865408?v=4") no-repeat center center fixed; */
    background-image: url(assets/background/bg.jpg);
    background-size: cover;
}

.title {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: black;
    z-index: 1000;
    width: 90%;
    max-width: 850px;
}

.title h1 {
    font-size: 5rem;
    margin: 0;
    line-height: 1.1;
}

.title h2 {
    font-size: 3rem;
    margin: 0;
    line-height: 1.2;
}

/* 打字機效果 */
.typewriter {
    overflow: hidden;
    border-right: 3px solid black;
    white-space: nowrap;
    margin: 0;
    width: fit-content;
    max-width: 0;
    animation: 
        typing 2s steps(18, end) forwards,
        blink-caret 0.75s step-end infinite 2s,
        hide-caret 0.1s ease-in-out 5s forwards;
}

.typewriter-delay {
    overflow: hidden;
    border-right: 3px solid black;
    white-space: nowrap;
    margin: 0;
    opacity: 0;
    width: fit-content;
    max-width: 0;
    animation: 
        typing-delay 3s steps(32, end) 3s forwards,
        blink-caret-delay 0.75s step-end infinite 6s,
        hide-caret-delay 0.1s ease-in-out 9s forwards;
}

@keyframes typing {
    from { max-width: 0; }
    to { max-width: 100%; }
}

@keyframes typing-delay {
    from { max-width: 0; opacity: 1; }
    to { max-width: 100%; opacity: 1; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: black; }
}

@keyframes blink-caret-delay {
    from, to { border-color: transparent; }
    50% { border-color: black; }
}

@keyframes hide-caret {
    from { border-right-color: black; }
    to { border-right-color: transparent; }
}

@keyframes hide-caret-delay {
    from { border-right-color: black; }
    to { border-right-color: transparent; }
}

.container {
    width: 100%;
    height: auto;
    min-height: 10vh;
    flex-shrink: 0;
    /* 移除藍色背景和框架 */
    background: none;
    box-shadow: none;
    border-radius: 0;
    position: relative;
    opacity: 1;
    top: 0;
    left: 0;
    transform: none;
    padding-top: 25vh; /* 給標題留空間 */
}

.roboto-mono-100 {
  font-family: "Roboto Mono", monospace;
  font-optical-sizing: auto;
  font-weight: 200;
  font-style: normal;
}

.child {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    top: 0;
    left: 0;
}

/* 為每個分類建立flex容器 */
.section {
    margin: 40px 0;
}

.objects-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.object {
    position: relative;
    align-items: center;
    display: flex;
    flex-direction: column;
    text-align: center;
    flex: 0 0 auto;
    min-width: 200px;
    max-width: 300px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.object.visible {
    opacity: 1;
    transform: translateY(0);
}

.object p {
    color: #333;
    font-weight: 500;
    text-shadow: none;
    margin: 10px 0;
}

.object:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transform: translateY(-5px);
    transition: all 0.3s ease-in-out;
}

/* 為段落標題添加更好的可視性 */
.section > p {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    text-align: center;
    margin: 20px auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 25px;
    display: block;
    width: fit-content;
    position: relative;
    z-index: 1;
}

/* 彈出框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content h3 {
    color: #166cad;
    margin-top: 0;
    font-size: 1.8rem;
    text-align: center;
}

.modal-content p {
    color: #333;
    line-height: 1.6;
    margin: 15px 0;
}

.close {
    color: #999;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
}

.close:hover {
    color: #166cad;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 讓 object 可點擊 */
.object {
    cursor: pointer;
    user-select: none;
}

.object:active {
    transform: translateY(-2px) scale(0.98);
}

@media (max-width: 768px) {
    body {
        background-position: center top;
    }
    .title {
        top: 5%;
        width: 90%;
        padding: 0 10px;
    }
    
    .title h1 {
        font-size: 3.3rem;
        line-height: 1.2;
    }
    
    .title h2 {
        font-size: 2rem;
        line-height: 1.3;
        margin-top: 10px;
    }
    
    .container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        transform: none;
        top: 0;
        left: 0;
        padding-top: 18vh;
    }
    .child {
        width: 100%;
        padding: 0 15px;
        top: 0;
        left: 0;
    }
    
    .object {
        min-width: 150px;
        max-width: 250px;
        padding: 15px;
    }
    
    .objects-container {
        gap: 15px;
    }
    
    .section > p {
        font-size: 1.3rem;
        padding: 8px 16px;
    }
    
    /* 手機版彈出框調整 */
    .modal-content {
        margin: 20% auto;
        padding: 20px;
        width: 95%;
    }
    
    .modal-content h3 {
        font-size: 1.5rem;
    }
}

/* 更小螢幕的額外適配 */
@media (max-width: 480px) {
    .title {
        top: 3%;
        right: 50%;
    }
    
    .title h1 {
        font-size: 2.8rem;
    }
    
    .title h2 {
        font-size: 1.4rem;
    }
    
    .container {
        padding-top: 15vh;
    }
}
