/* =========================================
   1. 基礎架構 (Base Layout)
   ========================================= */
html, body {
    height: 100%;
    margin: 0;
}

body {
    background-image:
        linear-gradient(rgba(253, 251, 245, 0.85), rgba(253, 251, 245, 0.85)),
        url('../images/bg.png');
    background-repeat: repeat;
    background-size: 250px auto;
    background-attachment: fixed;
    background-color: #fdfbf5;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    width: 100%;
    height: 10vh;
    background: transparent;
    display: block;
    margin: 0;
    padding: 0;
}

main {
    max-width: none;
    width: 100%;
    display: block;
    margin: 0;
    padding: 0;
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    color: #5C4033;
    border-top: 1px solid rgba(210, 193, 165, 0.3);
    margin-top: auto;
}

/* =========================================
   2. 導覽選單 (Menu)
   ========================================= */
.menu-container {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

.menu-btn {
    font-family: "Arial Black", "Verdana", "Microsoft JhengHei", sans-serif;
    background: transparent;
    border: none;
    color: #5C4033;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 3px;
    cursor: pointer;
    padding: 10px 15px;
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.2),
        -1px -1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease-in-out;
    outline: none;
}

.menu-btn:hover {
    letter-spacing: 4px;
    box-shadow: 0 6px 20px rgba(180, 140, 0, 0.15);
    text-shadow:
        2px 2px 4px rgba(180, 140, 0, 0.3),
        -2px -2px 4px rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.side-menu {
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-top: 12px;
    border-radius: 2px;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    overflow: hidden;
    animation: fadeInSlide 0.4s ease-out;
}

.side-menu a {
    padding: 18px 25px;
    text-decoration: none;
    color: #5C4033;
    font-size: 1rem;
    border-bottom: 1px solid rgba(210, 193, 165, 0.3);
    transition: 0.3s;
}

.side-menu a:last-child {
    border-bottom: none;
}

.side-menu a:hover {
    background: rgba(180, 140, 0, 0.1);
    color: #B48C00;
    padding-left: 35px;
}

.side-menu a.active {
    border-left: 5px solid #B48C00;
    background-color: #E8DCC4;
}

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

/* =========================================
   3. 音樂播放器 (Music Player)
   ========================================= */
.music-player {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 6000 !important;
    width: 55px !important;
    height: 55px !important;
    overflow: visible !important;
}

.music-fab {
    width: 90% !important;
    height: 90% !important;
    border-radius: 50% !important;
    background-color: #F5F1E6 !important;
    border: 1px solid #D2C1A5 !important;
    color: #5C4033;
    font-size: 1.8rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-image: none !important;
    overflow: hidden !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    -webkit-appearance: none;
    appearance: none;
    position: relative !important; 
}

.music-fab .icon {
    position: relative; 
    display: inline-block;
    font-style: normal;
    font-size: 1.5rem;
    line-height: 1;
}

.music-fab:not(.playing)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%; 
    width: 105%; 
    
    height: 1.5px; 
    background-color: #8b0000cb; 
    transform: translate(-50%, -50%) rotate(-45deg); 
    transition: all 0.3s ease;
    pointer-events: none; 
    z-index: 2; 
    border-radius: 2px; 
}

/* =========================================
   4. 通用區塊樣式 (Section Blocks)
   ========================================= */
section {
    background: radial-gradient(circle, #F5F1E6 0%, #f4eee1 100%);
    border: 1px solid #D2C1A5;
    margin-bottom: 30px;
    padding: 15px 30px 30px 30px;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
    color: #3E322B;
}

section h2 {
    color: #5C4033;
    margin-top: 0;
    border-bottom: 2px solid #D2C1A5;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* =========================================
   5. 響應式設計 - 手機板 (Mobile)
   ========================================= */
@media (max-width: 768px) {
    header {
        min-height: 70px !important;
        padding: 0 5px !important;
        justify-content: center;
        overflow: visible !important; /* 確保全局 Header 允許下拉選單 */
    }

    .side-menu {
        min-width: 180px !important; /* 手機版選單寬度稍微收斂 */
    }

    .side-menu a {
        padding: 15px 20px !important; /* 縮小內距，節省垂直空間 */
        font-size: 0.95rem !important; /* 適合手指點擊的大小 */
    }

    .menu-btn {
        font-size: 2rem;
        padding: 5px 7.5px;
        transform: translateY(-12px) !important;
        position: relative;
        z-index: 2000;
    }

    main {
        max-width: 100%;
        margin: 10px auto;
        padding: 0 15px;
        box-sizing: border-box;
    }

    .music-player {
        bottom: 20px !important;
        right: 20px !important;
    }

    .music-fab {
        width: 45px !important;
        height: 45px !important;
        font-size: 1.2rem !important;
    }

    section {
        padding: 15px 15px 20px 15px !important;
        margin-bottom: 20px;
    }

    section h2 {
        font-size: 1.2rem !important;
    }
}

/* =========================================
   6. 響應式設計 - 超寬螢幕 (Ultra-Wide / 2K+)
   ========================================= */
@media (min-width: 1921px) {
    body {
        background-size: 350px auto; 
    }

    .menu-btn {
        font-size: 4rem !important; 
        padding: 15px 25px !important; 
    }
    
    .side-menu {
        min-width: 250px;
        margin-top: 20px;
    }

    .side-menu a {
        padding: 22px 35px; 
        font-size: 1.25rem; 
    }
    
    section {
        padding: 30px 50px 50px 50px;
        border-radius: 8px;
    }
    
    section h2 {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
}

/* =========================================
   7. 響應式設計 - 4K 超高解析度 (2561px+)
   ========================================= */
@media (min-width: 2561px) {
    body {
        background-size: 450px auto; 
    }

    .menu-btn {
        font-size: 5rem !important; 
        padding: 20px 35px !important; 
    }
    
    .side-menu {
        min-width: 320px;
        margin-top: 30px;
    }

    .side-menu a {
        padding: 30px 45px; 
        font-size: 1.6rem; 
    }
    
    section {
        padding: 40px 70px 70px 70px;
        border-radius: 12px;
    }
    
    section h2 {
        font-size: 2.3rem;
        margin-bottom: 40px;
    }
}