/* ==========================================================================
   1. 全域變數與基礎設定 (Root & Global)
   ========================================================================== */
:root {
    --paper: #f6efe3;
    --ink: #1a2229;
    --moss: #2f5d4f;
    --terracotta: #1e1f22;
    --sand: #e8d6b5;
    --mist: #f9f3ea;
    --line: #0e0e0e;
    --shadow: rgba(26, 34, 41, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    color: var(--ink);
    background:
            radial-gradient(circle at 90% 10%, rgba(198, 107, 61, 0.24), transparent 35%),
            radial-gradient(circle at 10% 90%, rgba(47, 93, 79, 0.2), transparent 38%),
            linear-gradient(145deg, var(--paper), var(--mist));
}

a {
    color: inherit;
}

.page-shell {
    width: min(1080px, 92%);
    margin: 0 auto;
    padding: 28px 0 40px;
}


/* ==========================================================================
   2. 導覽列與品牌 (Header & Navigation)
   ========================================================================== */
header.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 22px;
    backdrop-filter: blur(10px);
}

.nav-wrap {
    border: 1px solid var(--line);
    background: rgba(255, 251, 245, 0.82);
    border-radius: 999px;
    box-shadow: 0 10px 24px -18px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--terracotta), #e4a35f);
    box-shadow: 0 0 0 4px rgba(198, 107, 61, 0.18);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-btn {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.nav-btn:hover {
    transform: translateY(-1px);
    border-color: var(--line);
    background: rgba(232, 214, 181, 0.35);
}

.nav-btn.active {
    background: var(--moss);
    color: #f9f6f1;
}


/* ==========================================================================
   3. 標題、文字與通用按鈕 (Typography & Buttons)
   ========================================================================== */
h1, h2, h3 {
    margin: 0;
    font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
}

.page-title {
    margin: 8px 0 6px;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.page-subtitle {
    margin: 0;
    line-height: 1.7;
    max-width: 60ch;
}

.btn {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffaf2;
    color: var(--ink);
    padding: 8px 14px;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn:hover {
    border-color: #b69e71;
}

.btn.warn {
    background: #f8e0d2;
    border-color: #e6b89c;
}


/* ==========================================================================
   4. 通用容器與面板 (Panels & Modules)
   ========================================================================== */
.section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.panel {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    background: rgba(255, 250, 243, 0.82);
    box-shadow: 0 20px 32px -28px var(--shadow);
}

.info-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 250, 243, 0.8);
    box-shadow: 0 14px 24px -22px var(--shadow);
    padding: 18px;
}

.info-card p {
    margin: 10px 0 0;
    line-height: 1.65;
}

.home-module {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    background: rgba(255, 250, 243, 0.82);
    box-shadow: 0 20px 32px -28px var(--shadow);
}

.module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.module-tip {
    margin: 8px 0 12px;
    color: #4f595f;
}

.home-empty {
    margin: 0;
    border: 1px dashed #b6a17d;
    border-radius: 12px;
    padding: 14px;
    background: rgba(255, 245, 232, 0.7);
    color: #5c4d38;
}


/* ==========================================================================
   5. 首頁英雄區 (Hero Section)
   ========================================================================== */
.hero {
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 34px;
    background:
            linear-gradient(120deg, rgba(47, 93, 79, 0.92), rgba(31, 67, 58, 0.94)),
            radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25), transparent 45%);
    color: #fdf8ef;
    box-shadow: 0 20px 40px -30px var(--shadow);
    overflow: hidden;
}

.hero h1 {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    line-height: 1.2;
}

.hero p {
    max-width: 62ch;
    line-height: 1.75;
    margin: 14px 0 0;
}

/* =========================================
   2. 官方健康資訊 (CTA Buttons)
   ========================================= */
/* =========================================
   2. 健康資訊按鈕 (CTA Buttons)
   ========================================= */
.cta-row {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 20px;
}

/* 按鈕顏色統一管理 */
.cta-btn.primary,
.cta-btn.secondary {
    background: #c2693d;
    border: 1px solid #b96439;
    color: #fffaf3;
}

.cta-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.cta-btn:focus,
.cta-btn:active {
    background-color: #802d0b;
    border-color: #802d0b;
    outline: none;
}

/* =========================================
   3. 輪播圖外層結構 (Carousel)
   ========================================= */
.carousel {
    position: relative;
    max-width: 950px; /* 增加寬度以容納並排內容 */
    margin: 40px auto;
    overflow: hidden;
}

.carousel-images {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-images figure {
    flex: 0 0 100%;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================
   4. 圖片與訊息欄並排區塊 (Content Wrapper)
   ========================================= */
.content-wrapper {
    display: flex;
    flex-direction: row; /* 關鍵：左右並排 */
    align-items: stretch; /* 高度一致 */
    justify-content: center;
    gap: 40px;
    width: 100%;
    margin-bottom: 25px;
}

/* 海報圖片修正 */
.content-wrapper img {
    width: 100%;
    max-width: 380px; /* 限制圖片的最大寬度 */
    height: auto; /* 確保圖片比例不變 */
    object-fit: cover; /* 確保圖片填充區域 */
}

/* 訊息欄設計 (原本紅框位置) */
.info-box {
    flex: 0 0 380px; /* 固定訊息欄寬度，防止文字擠壓 */
    background-color: #fdf6ec;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid #eaded2;
    text-align: left;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
}

.info-box h4 {
    margin: 0 0 15px 0;
    font-size: 1.4rem;
    color: #c87a50;
    border-bottom: 2px solid #eaded2;
    padding-bottom: 10px;
}

.info-box p {
    font-size: 1rem;
    line-height: 1.8;
    color: #4a4a4a;
    margin-bottom: 15px;
}

.info-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: circle;
}

.info-list li {
    margin-bottom: 10px;
    color: #555;
}

/* =========================================
   5. 文字說明與分頁點 (Footer & Dots)
   ========================================= */
.figure-with-row figcaption {
    font-size: 1.25rem;
    font-weight: bold;
    color: #333;
    margin-top: 10px;
}

.note {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    background-color: #c87a50;
    transform: scale(1.2);
}
.row-container figcaption {
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif; /* 統一字體 */
    font-size: 1.25rem; /* 統一字體大小 */
    font-weight: bold; /* 統一字重 */
    color: #333; /* 統一字體顏色 */
}

/* =========================================
   6. 響應式手機版調整
   ========================================= */
@media (max-width: 850px) {
    .content-wrapper {
        flex-direction: column; /* 改為上下排列 */
        align-items: center;
        gap: 20px;
    }

    .info-box, .content-wrapper img {
        flex: 0 0 auto;
        width: 100%;
        max-width: 450px;
    }
}
/* ==========================================================================
   6. 畫廊系統 (Gallery)
   ========================================================================== */
.gallery-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.gallery-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    background: #fffdf8;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.gallery-meta {
    margin-top: 8px;
    font-size: 0.86rem;
    color: #4f595f;
}

.empty-state {
    margin-top: 16px;
    border: 1px dashed #b6a17d;
    border-radius: 14px;
    padding: 22px;
    background: rgba(255, 245, 232, 0.7);
    text-align: center;
}


/* ==========================================================================
   7. 繪圖室佈局與工具 (Studio & Canvas)
   ========================================================================== */
.studio-layout {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1.45fr 0.85fr;
    gap: 14px;
}

.canvas-wrap {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fffaf1;
    padding: 12px;
}

#paintCanvas {
    width: 100%;
    height: 500px;
    border: 1px solid #d6be95;
    border-radius: 12px;
    display: block;
    touch-action: none;
    background: #fffdfa;
}

.toolbar {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 252, 246, 0.92);
    padding: 14px;
}

.toolbar h3 {
    margin-bottom: 10px;
}

.control-group {
    margin-bottom: 14px;
}

.control-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tip-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #4f595f;
    line-height: 1.65;
}

.note {
    margin-top: 10px;
    font-size: 0.88rem;
    color: #4f595f;
}


/* ==========================================================================
   8. 跑馬燈與資源清單 (Care Ticker & Resources)
   ========================================================================== */
.care-ticker {
    margin-top: 10px;
    overflow: hidden;
    padding: 4px;
}

.ticker-track {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ticker-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 250, 243, 0.8);
    box-shadow: 0 14px 24px -22px var(--shadow);
    padding: 18px;
    min-height: 116px;
    display: flex;
    align-items: center;
    line-height: 1.65;
    color: var(--moss);
    font-weight: 700;
    margin: 0;
}

#careTickerText {
    margin: 0;
    font-weight: 700;
    color: var(--moss);
    transform: translateX(0);
    white-space: nowrap;
}

.resource-list {
    margin: 12px 0 0;
    padding-left: 20px;
    line-height: 1.7;
    list-style: none; /* 移除項目符號 */
    padding: 0; /* 移除內邊距，讓列表更貼齊 */
}

.resource-list a {
    text-decoration: underline;
    text-underline-offset: 3px;
}



/* ==========================================================================
   9. 雲端佈置板與作品 (Layout Board & Works)
   ========================================================================== */
.layout-board {
    margin-top: 10px;
    position: relative;
    min-height: 350px;
    border: 2px dashed #cdb48a;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.layout-board.is-over {
    border-color: var(--terracotta);
    background: rgba(255, 244, 234, 0.92);
}

.pool-title {
    margin-top: 14px;
    font-size: 1.06rem;
}

.works-pool {
    margin-top: 10px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.work-card,
.placed-work {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf9;
    box-shadow: 0 10px 24px -22px var(--shadow);
    user-select: none;
}

.work-card {
    padding: 8px;
    cursor: grab;
}

.work-card:hover {
    border-color: var(--moss);
    background: #fff;
}

.work-card:active,
.placed-work:active {
    cursor: grabbing;
}

.work-card img,
.placed-work img {
    pointer-events: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    display: block;
    border: 1px solid var(--line);
    object-fit: cover;
    background: #fff;
}

.work-card p,
.placed-work p {
    margin: 6px 2px 2px;
    font-size: 0.82rem;
    color: #4f595f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 讓正在被拖放的作品層級最高 */
.placed-work:active {
    z-index: 999 !important;
}

/* 作品清單中「已選取」的狀態 */
.work-card.is-placed {
    opacity: 0.4;
    filter: grayscale(100%); /* 變灰色 */
    cursor: not-allowed;
    pointer-events: none; /* 防止重複拖放（選配） */
}

/* 確保放置的作品有基礎層級，避免重疊時閃爍 */
.placed-work {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 128px;
    padding: 6px;
}

.board-empty {
    margin: 0;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #76654c;
    text-align: center;
    padding: 20px;
}
/* 移除按鈕樣式 */
.remove-work-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ff6b6b;
    color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 100;
}

.placed-work:hover .remove-work-btn {
    opacity: 1;
}

.remove-work-btn:hover {
    background: #fa5252;
    transform: scale(1.1);
}

/* 拖動中的視覺效果 */
.is-dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* 板子狀態 */
.layout-board {
    transition: background-color 0.3s, border-color 0.3s;
}

/* 修正圖片容器 */
.card-img-wrap {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    border-radius: 8px;
}
/* ==========================================================================
   10. 劇情選擇系統 (Scenario Grid)
   ========================================================================== */
.scenario-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.scenario-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 250, 243, 0.9);
    box-shadow: 0 14px 24px -22px var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scenario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px -18px var(--shadow);
}

.scenario-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.scenario-card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--mist);
}

.scenario-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.scenario-card:hover .scenario-card-img img {
    transform: scale(1.05);
}

.scenario-card-content {
    padding: 16px;
}

.scenario-card-content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: var(--moss);
}

.scenario-card-content p {
    margin: 0;
    line-height: 1.6;
    color: #4f595f;
    font-size: 0.92rem;
}

.scenario-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.scenario-card.locked .scenario-card-img {
    position: relative;
}

.scenario-card.locked .scenario-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(26, 34, 41, 0.45);
    backdrop-filter: blur(2px);
}

.lock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

.scenario-card.locked:hover {
    transform: none;
    box-shadow: 0 14px 24px -22px var(--shadow);
}

.scenario-card.locked .scenario-card-img img {
    filter: grayscale(50%);
}


/* ==========================================================================
   11. 動態效果 (Animations)
   ========================================================================== */
.reveal {
    animation: riseIn 0.62s ease both;
}

.reveal.delay-1 {
    animation-delay: 0.1s;
}

.reveal.delay-2 {
    animation-delay: 0.2s;
}

.reveal.delay-3 {
    animation-delay: 0.3s;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==========================================================================
   12. 響應式設計 (Media Queries)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    #careTickerText {
        transition: none;
        animation: none;
    }
}

@media (max-width: 920px) {
    .section-grid {
        grid-template-columns: 1fr;
    }

    .studio-layout {
        grid-template-columns: 1fr;
    }

    #paintCanvas {
        height: 380px;
    }

    .layout-board {
        min-height: 300px;
    }

    .ticker-track {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .page-shell {
        width: 94%;
        padding-top: 16px;
    }

    .nav-wrap {
        border-radius: 20px;
        align-items: flex-start;
        flex-direction: column;
    }

    .hero {
        padding: 24px;
    }

    .home-module {
        padding: 16px;
    }

    .placed-work {
        width: 98px;
    }

    .ticker-track {
        grid-template-columns: 1fr;
    }
}
/* ---- 畫廊卡片增強 ---- */
.work-name {
    margin: 8px 0 4px;
    font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.4;
}

.shape-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 6px 0;
}

.shape-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(47, 93, 79, 0.08);
    border: 1px solid rgba(47, 93, 79, 0.15);
    font-size: 0.78rem;
    color: var(--moss);
    white-space: nowrap;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #5a6b6a;
    padding: 3px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.stat-row:last-child {
    border-bottom: none;
}

/* ---- 趨勢圖表區塊 ---- */
.trend-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 20px 0 10px;
}

.chart-card {
    background: #fffdf8;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--moss);
}


/* === 資料夾列表 === */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 20px;
}
.folder-card {
    border: 1.5px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(145deg, #fffdf8, #faf3e6);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}
.folder-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -10px var(--shadow);
}

.folder-cover {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--moss), rgba(47, 93, 79, 0.75));
}

.folder-cover-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    width: 100%;
    height: 100%;
}

.folder-cover-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

.folder-cover-single {
    width: 100%;
    height: 100%;
}

.folder-cover-single img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

.folder-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

.folder-icon {
    position: absolute;
    bottom: 10px;
    left: 12px;
    font-size: 1.6rem;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.folder-info {
    padding: 14px 16px;
}

.folder-info h3 {
    font-family: "Noto Serif TC", serif;
    font-size: 1.1rem;
    margin: 0 0 6px;
    color: var(--ink);
}

.folder-info p {
    font-size: 0.85rem;
    color: #5a6b6a;
    margin: 0;
    line-height: 1.45;
}

.progress-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--moss), var(--terracotta));
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* === 詳細頁面（故事內頁） === */
.detail-view {
    display: none;
}

.detail-view.active {
    display: block;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffaf2;
    color: var(--ink);
    padding: 8px 16px;
    font-size: 0.92rem;
    cursor: pointer;
    margin-bottom: 16px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(232, 214, 181, 0.35);
}

.detail-header {
    text-align: center;
    padding: 28px 20px;
    background: linear-gradient(120deg, rgba(47, 93, 79, 0.92), rgba(31, 67, 58, 0.94));
    color: #fdf8ef;
    border-radius: 20px;
    margin-bottom: 20px;
}

.detail-header h2 {
    font-family: "Noto Serif TC", serif;
    font-size: 1.5rem;
    margin: 0 0 6px;
}

.detail-header p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.85;
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chapter-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fffdf8;
    overflow: hidden;
    display: block; /* 單欄顯示，不再在章節卡重複顯示圖片 */
    min-height: 180px;
}

.chapter-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chapter-body h3 {
    font-family: "Noto Serif TC", serif;
    font-size: 1.05rem;
    color: var(--ink);
    margin: 0;
}

.chapter-body .chapter-subtitle {
    font-size: 0.82rem;
    color: #7a8886;
    margin: 0 0 4px;
}

.chapter-download {
    margin-top: auto;
}

@media (max-width: 620px) {
    .chapter-card {
        grid-template-columns: 1fr;
    }

    .chapter-card img {
        height: 150px;
    }
}

.chapter-description {
    font-size: 0.9rem;
    color: #5a6b6a;
    line-height: 1.6;
    background: rgba(47, 93, 79, 0.04); /* 微弱的底色區隔 */
    padding: 10px 14px;
    border-left: 3px solid var(--moss);   /* 左側裝飾線 */
    border-radius: 4px;
    margin: 10px 0;
    font-style: italic;                  /* 斜體表現心理狀態 */
    word-wrap: break-word;               /* 自動斷行 */
}

/* 確保卡片內容垂直排列整齊 */
.chapter-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.edit-btn { background:none; border:none; cursor:pointer; margin-left:8px; font-size:0.95rem }
.editable-input { width:100%; padding:6px 8px; border:1px solid var(--line); border-radius:8px; font-size:1rem; }
.editable-textarea { width:100%; min-height:80px; padding:8px; border:1px solid var(--line); border-radius:8px; font-size:0.95rem; }
.edit-actions { display:flex; gap:8px; margin-top:8px; }
.edit-save { background:var(--moss); color:white; border:none; padding:6px 10px; border-radius:8px; cursor:pointer; }
.edit-cancel { background:#f3f3f3; border:1px solid var(--line); padding:6px 10px; border-radius:8px; cursor:pointer; }

/* 群組分析區 */
.group-analysis { display: grid; grid-template-columns: 1fr; gap:12px; margin-bottom:14px; }
.trend-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:12px; margin-bottom:12px; }
.group-summary { display: grid; grid-template-columns: repeat(2,1fr); gap:8px; }
.group-summary .stat { background:#fff; padding:10px; border-radius:8px; border:1px solid rgba(0,0,0,0.04); display:flex; justify-content:space-between; font-size:0.95rem; }
.thumb-stats { display:grid; grid-template-columns: repeat(4,1fr); gap:8px; }
.thumb-card { background:#fff; padding:8px; border-radius:8px; border:1px solid rgba(0,0,0,0.04); text-align:center; font-size:0.85rem; }
.thumb-card img { width:100%; height:64px; object-fit:cover; border-radius:6px; margin-bottom:6px; }
/* 改為垂直列表：圖片在左、文字在右 */
.thumb-stats { display:flex; flex-direction:column; gap:10px; }
.thumb-card { display:flex; gap:12px; align-items:flex-start; padding:10px; text-align:left; }
.thumb-card img { width:96px; height:96px; object-fit:cover; border-radius:8px; flex-shrink:0; }
.thumb-info { display:flex; flex-direction:column; gap:6px; }
.thumb-info .thumb-title { font-weight:700; color:var(--ink); }
.thumb-info .thumb-sub { font-size:0.85rem; color:#7a8886; }
.thumb-info .thumb-desc { font-size:0.88rem; color:#5a6b6a; }
.thumb-info .thumb-stats { font-size:0.82rem; color:#556; display:flex; gap:8px; flex-wrap:wrap; }
