:root {
    color-scheme: dark;   /* 告訴瀏覽器本頁已是深色，避免三星等瀏覽器的「強制暗黑模式」再次改色 */

    /* 主題綠色系（抹茶森林風） */
    --accent-light-green: #4ade80;
    --accent-soft-green: #22c55e;
    --accent-gold: #fde047;
    
    /* 質感深抹茶綠背景與卡片 */
    --bg-dark: #225734;
    --card-bg: #225734;
    --text-main: #f0fdf4;
    --text-muted: #cbd5e1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

html {
    background-color: var(--bg-dark);
}

html, body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Klee One', 'PingFang TC', 'Microsoft JhengHei', cursive, sans-serif;
    color: var(--text-main);
    user-select: none;
    -webkit-user-select: none;
}

/* 背景改成固定在視窗的圖層：手機瀏覽器不支援 background-attachment: fixed */
body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    pointer-events: none;
    background-image: linear-gradient(rgba(11, 29, 18, 0.45), rgba(11, 29, 18, 0.45)), url('bkg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body {
    overflow-x: clip;
}

.handwritten-title {
    font-family: 'Caveat', cursive, sans-serif;
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #86efac;
}

header {
    background-color: rgba(11, 29, 18, 0.85); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--accent-soft-green);
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.15);
}

.nav-container {
    width: 100%;
    max-width: 100%;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 100px;
    vertical-align: middle;
}

.leaf-container {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
    z-index: 99;
    overflow: hidden;
}

.leaf {
    position: absolute;
    top: 0;
    left: var(--x, 0%);
    --s: 1;
    width: calc(28px * var(--s));
    height: calc(28px * var(--s));
    background-repeat: no-repeat;
    background-size: contain;
    animation: leaf-fall var(--dur, 12s) linear var(--delay, 0s) infinite;
    opacity: 0;
    will-change: transform, opacity;
}

/* 樹葉圖案 (SVG) */
.leaf-1 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17,8C8,10 5,16 3,21C8,20 15,18 19,12C20.5,9.5 20,5 20,5C20,5 18.5,6.5 17,8Z' fill='%2322c55e'/%3E%3Cpath d='M3,21C7,17 12,13 19,12' stroke='%2315803d' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
}

.leaf-2 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,2C6,8 4,14 4,20C10,20 16,18 22,12C22,6 18,2 12,2Z' fill='%234ade80'/%3E%3Cpath d='M4,20C9,15 14,10 22,12' stroke='%23166534' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
}

.leaf-3 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21,3C12,3 6,9 5,18C10,17 15,14 19,9C21,6.5 21,3 21,3Z' fill='%2386efac'/%3E%3Cpath d='M5,18C10,13 15,8 21,3' stroke='%2322c55e' stroke-width='1' fill='none'/%3E%3C/svg%3E");
}

/* 水平位置與時間錯開（涵蓋全部 15 片） */
.leaf:nth-child(1) { --x: 4%; --dur: 10s; --delay: 0s; --s: 0.9; }
.leaf:nth-child(2) { --x: 12%; --dur: 14s; --delay: 3s; --s: 1.2; }
.leaf:nth-child(3) { --x: 20%; --dur: 11s; --delay: 6s; --s: 0.8; }
.leaf:nth-child(4) { --x: 28%; --dur: 13s; --delay: 1s; --s: 1.1; }
.leaf:nth-child(5) { --x: 36%; --dur: 12s; --delay: 4s; --s: 1; }
.leaf:nth-child(6) { --x: 44%; --dur: 15s; --delay: 2s; --s: 0.7; }
.leaf:nth-child(7) { --x: 52%; --dur: 10s; --delay: 7s; --s: 1; }
.leaf:nth-child(8) { --x: 60%; --dur: 14s; --delay: 5s; --s: 1.2; }
.leaf:nth-child(9) { --x: 68%; --dur: 11s; --delay: 8s; --s: 0.8; }
.leaf:nth-child(10) { --x: 76%; --dur: 13s; --delay: 2s; --s: 1.1; }
.leaf:nth-child(11) { --x: 84%; --dur: 12s; --delay: 6s; --s: 0.9; }
.leaf:nth-child(12) { --x: 90%; --dur: 15s; --delay: 9s; --s: 0.7; }
.leaf:nth-child(13) { --x: 16%; --dur: 13s; --delay: 10s; --s: 1; }
.leaf:nth-child(14) { --x: 48%; --dur: 11s; --delay: 12s; --s: 0.9; }
.leaf:nth-child(15) { --x: 72%; --dur: 14s; --delay: 11s; --s: 1.1; }

/* 3. 動畫：落葉飄落效果（改用 transform，不再動畫 top） */
@keyframes leaf-fall {
    0%   { transform: translate3d(0, -60px, 0) rotate(0deg); opacity: 0; }
    5%   { opacity: 0.85; }
    95%  { opacity: 0.85; }
    100% { transform: translate3d(80px, 105vh, 0) rotate(360deg); opacity: 0; }
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

section {
    padding: 40px 0;
    border-bottom: 1px dashed #86efac;
}

/* 2. 角色介紹卡片樣式 */
.profile-card {
    background: var(--card-bg);
    border: 1.5px solid var(--accent-soft-green);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    gap: 30px;
    align-items: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.12);
    margin-bottom: 40px;
}

.profile-avatar-box {
    flex: 0 0 260px;
    height: 320px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--accent-light-green);
    background: #f0fdf4;
}

.profile-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
}

.profile-tag {
    background: var(--accent-light-green);
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 10px;
}

.profile-name {
    font-size: 2.2rem;
    color: #53ce82;
    margin-bottom: 15px;
}

.profile-subname {
    font-size: 1.2rem;
    color: var(--text-muted);
    opacity: 0.85;
}

.profile-details p {
    margin-bottom: 8px;
    font-size: 1.05rem;
    color: #f0fdf4;
}

.profile-bio {
    margin-top: 15px;
    line-height: 1.6;
    color: #e2e8f0;
}

.social-links {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.btn {
    padding: 8px 18px;
    font-size: 0.95rem;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

/* 3. 祝福影片播放區 */
.video-section-box { 
    background-color: transparent !important; 
    background: transparent !important;
    border: none !important;                 
    box-shadow: none !important;             
    padding: 0 !important;                  
}

.main-video-wrapper {
    position: relative;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--accent-light-green);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.main-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 華容道遊戲區 */
.game-area {
    width: 100%;
    text-align: center;
}

.klotski-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16 / 9;
    margin: 20px auto;
    background-color: rgba(0, 255, 98, 0.712);
    padding: 6px;
    border-radius: 14px;
    border: 2px solid var(--accent-light-green);
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.game-subtitle {
    font-size: 1rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    font-weight: 500;
    margin-bottom: 15px;
    line-height: 1.6;
}

.klotski-container::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background-color: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    pointer-events: none;
    z-index: 0;
}

.game-piece {
    position: absolute;
    background-color: #dcfce7;
    color: #15803d;
    font-family: 'Caveat', cursive, sans-serif;
    font-weight: 700;
    font-size: 2.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--accent-light-green);
    transition: left 0.2s ease-out, top 0.2s ease-out;
    background-repeat: no-repeat;
    text-shadow: 0 0 4px #5ee036, 0 0 8px #fff;
}

.btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.cheat-btn.hidden {
    display: none !important;
}

.control-btn {
    padding: 10px 24px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.control-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.reset-btn { background-color: #3b82f6; color: white; }
.cheat-btn { background-color: #ef4444; color: white; }

.scroll-hint {
    margin-top: 25px;
    font-size: 1rem;
    color: #86efac;
    font-weight: bold;
    text-align: center;
}

/* 4. 咪飯祝福板 */
.blessing-board {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    border: 1.5px solid var(--accent-soft-green);
    backdrop-filter: blur(6px);
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.1);
}

.card-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.card-slider {
    display: flex;
    gap: 25px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 20px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-light-green) transparent;
}

.card-slider::-webkit-scrollbar {
    height: 8px;
}

.card-slider::-webkit-scrollbar-thumb {
    background-color: var(--accent-light-green);
    border-radius: 10px;
}

.card-item {
    flex: 0 0 380px;
    background: #ffffff;
    border: 1.5px solid var(--accent-soft-green);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 6px 15px rgba(34, 197, 94, 0.12);
    transition: transform 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.card-item:hover {
    transform: translateY(-6px);
    border-color: var(--accent-light-green);
}

.card-img-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    background-color: #258f78;
}

.card-img-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-author {
    margin-top: 12px;
    font-weight: bold;
    color: #15803d;
    font-size: 1.2rem;
}

.slide-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent-light-green);
    border: 1.5px solid var(--accent-light-green);
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    z-index: 10;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.slide-btn:hover {
    background: var(--accent-light-green);
    color: rgb(255, 255, 255);
    transform: scale(1.1);
}

.prev-btn { left: -20px; }
.next-btn { right: -20px; }

/* 5. 感謝名單區塊樣式 */
#credits-section {
    padding-bottom: 60px;
}

.credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.credit-card {
    background: var(--card-bg);
    border: 1.5px solid var(--accent-soft-green);
    border-radius: 14px;
    padding: 20px 24px;
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.credit-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-light-green);
    box-shadow: 0 10px 25px rgba(134, 239, 172, 0.2);
}

.credit-role {
    color: var(--accent-gold);
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.credit-names {
    color: #f0fdf4;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* 防盜遮罩：蓋在圖片上，擋住長按/另存圖片 */
.protection-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    background: transparent;
}

img {
    -webkit-touch-callout: none;
}

button.btn {
    font-family: inherit;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .profile-card {
        flex-direction: column;
        text-align: center;
    }
    .profile-avatar-box {
        flex: 0 0 auto;
        width: 200px;
        height: 240px;
    }
    .social-links {
        justify-content: center;
    }
    .blessing-board {
        padding: 15px 10px;
    }
    .card-slider {
        gap: 15px;
        padding: 10px 5px;
    }
    .card-item {
        flex: 0 0 85%;
        max-width: 320px;
    }
    .prev-btn {
        left: -10px;
    }
    .next-btn {
        right: -10px;
    }
    .klotski-container {
        aspect-ratio: 4 / 3;
    }
    /* 後綴在手機版轉為單獨一行 */
    .profile-subname {
        display: block;
        margin-top: 6px;      /* 與主名字的間距 */
        font-size: 1rem;       /* 可稍微縮小字級，避免排版過擁擠 */
    }

    /* 手機端文字置中（可選，若你整體卡片在手機版有置中） */
    .profile-name {
        text-align: center;
    }
}