/* 科目場景：國文書院、數學研究所、英文書店
   清單與單元頁的結構沿用 main.js 產生的 DOM，這裡只換外觀。 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@700;900&family=Playfair+Display:wght@700;900&display=swap');

/* =========================================================
   共用骨架
   ========================================================= */
body.scene {
    background-attachment: fixed;
    padding: 46px 16px 60px !important;
}

body.scene .navbar,
body.scene .sticky-footer,
body.scene .mobile-bottom-nav,
body.scene #breadcrumb-nav,
body.scene .breadcrumb-container,
body.scene #other-modal,
body.scene .english-edition-note,
body.scene .curriculum-note,
body.scene .reference-badge,
body.scene .section-title {
    display: none !important;
}

.scene-top-bar {
    position: fixed;
    top: 12px;
    left: 14px;
    z-index: 20;
}

.scene-back {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.scene-back:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.scene-chinese .scene-back {
    background: rgba(20, 12, 8, 0.72);
    border: 1px solid rgba(227, 181, 82, 0.55);
    color: #f3d58b;
}

.scene-math .scene-back {
    background: rgba(7, 15, 36, 0.75);
    border: 1px solid rgba(94, 234, 212, 0.55);
    color: #5eead4;
}

.scene-english .scene-back {
    background: rgba(36, 17, 58, 0.78);
    border: 1px solid rgba(231, 183, 90, 0.65);
    color: #e7b75a;
}

.scene-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

body.scene #semester1-area,
body.scene #semester2-area,
body.scene .scene-header,
body.scene .scene-status,
body.scene #floating-toggle {
    position: relative;
    z-index: 1;
}

body.menu-hidden .scene-header,
body.menu-hidden .scene-status,
body.scene.menu-hidden #floating-toggle {
    display: none !important;
}

body.scene.menu-hidden .button-container {
    display: none !important;
}

.scene-header {
    margin: 26px auto 0;
    text-align: center;
}

.scene-status {
    margin: -8px 0 10px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
}

/* 課程卡：按鈕本身透明，外觀畫在 .card-body 上 */
body.scene .button-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 34px 22px;
    max-width: 1000px;
    margin: 20px auto 50px !important;
    padding: 0 12px;
}

body.scene .section-button,
body.scene .section-button:hover,
body.scene .section-button.active {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: inherit;
    font-size: 1rem;
    line-height: 1.3;
    text-align: center;
    transform: none;
}

body.scene .section-button {
    transition: transform 0.2s ease;
}

body.scene .section-button:focus-visible {
    outline: 3px solid var(--scene-focus, #f3d58b);
    outline-offset: 4px;
}

.card-body {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.card-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.card-meta {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.75;
}

.card-progress {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.card-progress:empty {
    display: none;
}

.card-state {
    font-size: 0.8rem;
    font-weight: 800;
}

.card-icon {
    display: none;
}

body.scene .section-button.locked,
body.scene .section-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.7) brightness(0.85);
    opacity: 0.8;
}

/* 單元頁：整個單元是一張攤開的面板 */
body.scene.menu-hidden .section-content.active-section {
    display: block !important;
    position: relative;
    z-index: 1;
    max-width: 1000px;
    min-height: 0;
    margin: 16px auto 40px;
    padding: 22px 26px 26px;
}

.scene-sheet-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.sheet-heading {
    min-width: 0;
}

.sheet-title {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.9rem);
    font-weight: 900;
    line-height: 1.25;
}

.sheet-state {
    margin: 4px 0 0;
    font-size: 0.88rem;
    font-weight: 700;
    opacity: 0.75;
}

.sheet-review {
    flex: none;
    align-self: center;
    padding: 7px 16px;
    border-radius: 999px;
    background: #6d28d9;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 3px 0 #4c1d95;
}
button.sheet-review { border: 0; font-family: inherit; cursor: pointer; }
.sheet-review:hover { filter: brightness(1.1); }
.sheet-review-wrap { position: relative; flex: none; align-self: center; }
.sheet-review-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
    padding: 8px;
    border-radius: 14px;
    background: #fff;
    border: 2px solid #6d28d9;
    box-shadow: 0 10px 24px rgba(42, 31, 45, .22);
}
.sheet-review-menu[hidden] { display: none; }
.sheet-review-menu a {
    display: block;
    padding: 8px 14px;
    border-radius: 10px;
    background: #f3e8ff;
    color: #4c1d95;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}
.sheet-review-menu a:hover { background: #6d28d9; color: #fff; }
.sheet-review:active { transform: translateY(2px); box-shadow: 0 1px 0 #4c1d95; }

.sheet-close {
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

body.scene .social-container {
    max-width: none;
}

body.scene .social-container .social-group,
body.scene .social-container .social-group:hover {
    flex: none;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
}

body.scene .social-container .social-group h3 {
    margin: 0 0 12px;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    text-align: left !important;
    font-size: 1.05rem;
}

body.scene .social-container:has(.subsection-selector) .social-group h3 {
    display: none;
}

body.scene .section-content .btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

body.scene .section-content a.btn,
body.scene .section-content a.btn[href*="math/"],
body.scene .section-content a.btn[href*="vocab-player.html"],
body.scene .section-content a.btn[href*="vocab-player.html"]:has(> .btn-score-badge),
body.scene .section-content a.btn[href*="chinese/"] {
    grid-template-columns: 46px minmax(0, 1fr) !important;
    column-gap: 14px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 14px 16px !important;
    border-radius: 10px !important;
    font-size: 1.08rem !important;
    line-height: 1.3;
    transform: none;
}

body.scene .section-content a.btn::before,
body.scene .section-content a.btn[href*="chinese/"]::before {
    width: 46px !important;
    height: 46px !important;
    border-radius: 12px !important;
    font-size: 20px !important;
    box-shadow: none !important;
}

body.scene .section-content a.btn::after {
    margin-top: 2px !important;
    font-size: 0.82rem !important;
}

/* 成績徽章改成排在標題下方，不再絕對定位擠在右側 */
body.scene .section-content a.btn .btn-score-badge,
body.scene .section-content a.btn .btn-score-multi-badge {
    position: static;
    grid-column: 2;
    justify-self: start;
    transform: none;
    margin-top: 6px;
    box-shadow: none;
}

body.scene .section-content a.btn .btn-score-badge {
    padding: 3px 10px;
    font-size: 0.8rem;
}

/* 三個單字成績都是三位數時會超出卡片：縮小間距並允許換行 */
body.scene .section-content a.btn .btn-score-multi-badge {
    max-width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 14px;
}

body.scene .section-content a.btn .multi-chip {
    padding: 2px 6px;
    gap: 3px;
}

/* =========================================================
   進場動畫共用
   ========================================================= */
.scene-gate {
    position: fixed;
    inset: 0;
    z-index: 5000;
    cursor: pointer;
    transition: opacity 0.2s ease 0.35s;
}

.scene-gate.is-open {
    opacity: 0;
    pointer-events: none;
}

/* =========================================================
   國文書院
   ========================================================= */
body.scene-chinese {
    --scene-focus: #f3d58b;
    background:
        radial-gradient(ellipse 70% 50% at 50% 25%, rgba(255, 190, 100, 0.22), transparent 70%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 86px),
        linear-gradient(180deg, #5a3a27 0%, #4a2f20 55%, #3a2418 100%);
    background-attachment: fixed;
}

.scene-chinese .scene-decor::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(10, 5, 2, 0.55) 100%);
}

.decor-beams {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, #1c110b 0 6px, #3a2418 6px 34px, #1c110b 34px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.decor-beams::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 12px;
    height: 16px;
    background: repeating-linear-gradient(90deg, #2f7d6d 0 40px, #e3b552 40px 44px, #a51f1f 44px 84px, #e3b552 84px 88px);
    opacity: 0.55;
}

.decor-lattice {
    position: absolute;
    top: 150px;
    width: 170px;
    height: 300px;
    border: 10px solid #2a1b13;
    background:
        linear-gradient(0deg, #2a1b13 0 4px, transparent 4px) 0 0 / 100% 36px,
        linear-gradient(90deg, #2a1b13 0 4px, transparent 4px) 0 0 / 36px 100%,
        radial-gradient(ellipse at 50% 40%, #fff1cf, #e9c27d 70%, #b98a45);
    box-shadow: 0 0 60px rgba(255, 200, 110, 0.35);
    opacity: 0.8;
}

.decor-lattice--l { left: 2%; }
.decor-lattice--r { right: 2%; }

.decor-couplet {
    position: absolute;
    top: 150px;
    width: 52px;
    padding: 16px 0;
    background: linear-gradient(180deg, #b52626, #6e1212);
    border: 2px solid #e3b552;
    color: #f3d58b;
    font-family: 'Noto Serif TC', serif;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 0.35em;
    text-align: center;
    writing-mode: vertical-rl;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.decor-couplet--l { left: calc(2% + 190px); }
.decor-couplet--r { right: calc(2% + 190px); }

.decor-lantern {
    position: absolute;
    top: 96px;
    width: 2px;
    transform-origin: top center;
    animation: scene-sway 5s ease-in-out infinite;
}

.decor-lantern::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: var(--rope, 34px);
    background: #1c110b;
}

.decor-lantern i {
    position: absolute;
    top: var(--rope, 34px);
    left: -26px;
    width: 54px;
    height: 66px;
    border-radius: 45%;
    background: radial-gradient(circle at 50% 45%, #ffcf6b 0%, #e2452b 40%, #9c1a14 100%);
    box-shadow: 0 0 40px 10px rgba(255, 120, 50, 0.35);
}

.decor-lantern b {
    position: absolute;
    top: calc(var(--rope, 34px) + 66px);
    left: -3px;
    width: 8px;
    height: 22px;
    background: linear-gradient(180deg, #e3b552, transparent);
}

@keyframes scene-sway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.scene-chinese .scene-sign {
    display: inline-block;
    padding: 12px 38px 10px;
    background: linear-gradient(180deg, #1f140e, #120b07);
    border: 4px solid #e3b552;
    outline: 3px solid #6e1212;
    outline-offset: 3px;
    border-radius: 4px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    font-family: 'Noto Serif TC', serif;
}

.scene-chinese .scene-sign small {
    display: block;
    color: #e3b552;
    font-size: 0.8rem;
    letter-spacing: 0.6em;
    text-indent: 0.6em;
}

.scene-chinese .scene-sign h1 {
    margin: 0;
    color: #f3d58b;
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    font-weight: 900;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
    text-shadow: 0 2px 0 #6d4a14, 0 0 18px rgba(243, 213, 139, 0.35);
}

.scene-chinese .scene-status { color: #e4cfa6; font-family: 'Noto Serif TC', serif; }
.scene-chinese .scene-status b { color: #f3d58b; }

/* 學期掛牌 */
body.scene-chinese .semester-segmented-control {
    gap: 18px;
    margin-top: 32px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

body.scene-chinese .semester-segmented-control .segmented-item {
    position: relative;
    padding: 10px 22px;
    border-radius: 4px;
    background: linear-gradient(180deg, #6b4a33, #4a3122);
    border: 2px solid #2a1b13;
    color: #e9d7b4;
    font-family: 'Noto Serif TC', serif;
    font-weight: 700;
    letter-spacing: 0.15em;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

body.scene-chinese .semester-segmented-control .segmented-item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -16px;
    width: 26px;
    height: 16px;
    margin-left: -13px;
    border: 2px solid #1c110b;
    border-bottom: 0;
    border-radius: 13px 13px 0 0;
}

body.scene-chinese .semester-segmented-control .segmented-item.active {
    background: linear-gradient(180deg, #c03030, #6e1212);
    border-color: #e3b552;
    color: #f3d58b;
}

/* 卷軸 */
body.scene-chinese .section-button::before,
body.scene-chinese .section-button::after {
    content: '';
    position: relative;
    z-index: 1;
    height: 12px;
    margin: 0 -8px;
    border-radius: 6px;
    background:
        linear-gradient(90deg, #e3b552 0 9px, transparent 9px calc(100% - 9px), #e3b552 calc(100% - 9px)),
        linear-gradient(180deg, #4a2c1c, #1f120b);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

body.scene-chinese .section-button:hover {
    transform: rotate(-1.5deg) translateY(-3px);
}

body.scene-chinese .card-body {
    min-height: 200px;
    padding: 16px 12px 14px;
    color: #2b211b;
    font-family: 'Noto Serif TC', serif;
    background:
        linear-gradient(90deg, #e3d4b1 0 8px, transparent 8px calc(100% - 8px), #e3d4b1 calc(100% - 8px)),
        radial-gradient(circle at 30% 20%, #fffaf0, #f6eedb 70%);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

body.scene-chinese .card-code {
    padding: 3px 8px;
    border: 2px solid #a51f1f;
    border-radius: 3px;
    color: #a51f1f;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

body.scene-chinese .card-title {
    font-size: 1.3rem;
    line-height: 1.35;
}

body.scene-chinese .card-meta { color: #6b5a4c; }

body.scene-chinese .card-progress i {
    width: 9px;
    height: 11px;
    border-radius: 5px 5px 2px 2px;
    background: #ddd0b4;
}

body.scene-chinese .card-progress i.on {
    background: #ffb547;
    box-shadow: 0 0 6px rgba(255, 181, 71, 0.9);
}

body.scene-chinese .card-state { color: #6b5a4c; }
body.scene-chinese .section-button[data-level="training"] .card-state { color: #b4630a; }
body.scene-chinese .section-button[data-level="master"] .card-state { color: #a51f1f; }
body.scene-chinese .section-button[data-level="master"] .card-progress i { background: #a51f1f; box-shadow: none; }

body.scene-chinese .section-button[data-level="master"] .card-body::after {
    content: '出師';
    position: absolute;
    right: 8px;
    top: 44px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 3px double #a51f1f;
    border-radius: 4px;
    color: #a51f1f;
    font-size: 0.85rem;
    font-weight: 900;
    transform: rotate(-14deg);
    opacity: 0.85;
}

body.scene-chinese .section-button.exam-card .card-body {
    color: #f3d58b;
    background: linear-gradient(180deg, #7a1a1a, #4d0e0e);
    border: 3px solid #e3b552;
}

body.scene-chinese .section-button.exam-card .card-code { border-color: #e3b552; color: #e3b552; }
body.scene-chinese .section-button.exam-card .card-meta,
body.scene-chinese .section-button.exam-card .card-state { color: #e9cfa0; }

/* 攤開的手卷 */
body.scene-chinese.menu-hidden .section-content.active-section {
    color: #2b211b;
    background:
        linear-gradient(180deg, #e3d4b1 0 10px, transparent 10px calc(100% - 10px), #e3d4b1 calc(100% - 10px)),
        radial-gradient(ellipse at 50% 30%, #fffaf0, #f6eedb 75%);
    border-left: 18px solid #3b2418;
    border-right: 18px solid #3b2418;
    border-radius: 9px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    font-family: 'Noto Serif TC', 'Noto Sans TC', serif;
    animation: scene-unroll 0.6s cubic-bezier(0.6, 0, 0.25, 1) both;
}

@keyframes scene-unroll {
    from { clip-path: inset(0 50% 0 50%); }
    to { clip-path: inset(0 0 0 0); }
}

body.scene-chinese .scene-sheet-head { border-bottom: 2px solid rgba(165, 31, 31, 0.25); }
body.scene-chinese .sheet-code { padding: 4px 10px; border: 2px solid #a51f1f; border-radius: 3px; color: #a51f1f; font-weight: 900; }
body.scene-chinese .sheet-close { border: 2px solid #2b211b; color: #2b211b; }
body.scene-chinese .sheet-close:hover { background: #2b211b; color: #f6eedb; }
body.scene-chinese .social-container .social-group h3 { color: #6e1212; }

body.scene-chinese .subsection-selector {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    gap: 8px !important;
    margin-bottom: 16px;
}

body.scene-chinese .subsection-selector .subsection-button,
body.scene-chinese .subsection-selector .subsection-button:hover {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    color: #6b5a4c !important;
    font-family: 'Noto Serif TC', serif;
    font-weight: 900;
    box-shadow: none !important;
}

body.scene-chinese .subsection-selector .subsection-button.is-active {
    background: transparent !important;
    border-bottom-color: #a51f1f !important;
    color: #a51f1f !important;
}

/* 竹簡練習鈕 */
body.scene-chinese .section-content a.btn {
    border: 2px solid #a8904f !important;
    border-left-width: 2px !important;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 7px),
        linear-gradient(180deg, #ecdcae, #d9c38a);
    color: #2b211b;
    box-shadow: 0 4px 0 #a8904f, 0 8px 14px rgba(0, 0, 0, 0.18);
}

body.scene-chinese .section-content a.btn:hover {
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 7px),
        linear-gradient(180deg, #f3e7c2, #e2cf9c);
    border-color: #a8904f !important;
    color: #2b211b;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #a8904f, 0 12px 18px rgba(0, 0, 0, 0.22);
}

body.scene-chinese:not(#_) .section-content a.btn::before,
body.scene-chinese:not(#_) .section-content a.btn:hover::before {
    background: #a51f1f !important;
    color: #f6eedb !important;
    box-shadow: none !important;
}

body.scene-chinese .section-content a.btn::after,
body.scene-chinese .section-content a.btn:hover::after {
    color: #6b5a4c;
}

/* 推門 */
.scene-chinese .scene-gate {
    display: flex;
    perspective: 1200px;
}

.gate-door {
    flex: 1;
    position: relative;
    background:
        radial-gradient(circle, #e3b552 0 4px, transparent 5px) 22px 22px / 44px 44px,
        linear-gradient(180deg, #b32424, #6e1212);
    border: 6px solid #3d0b0b;
    transition: transform 0.45s cubic-bezier(0.6, 0, 0.3, 1) 0.05s;
}

.gate-door--l { transform-origin: left center; }
.gate-door--r { transform-origin: right center; }
.scene-gate.is-open .gate-door--l { transform: rotateY(-100deg); }
.scene-gate.is-open .gate-door--r { transform: rotateY(100deg); }

.gate-ring {
    position: absolute;
    top: 50%;
    width: 54px;
    height: 54px;
    margin-top: -27px;
    border: 6px solid #e3b552;
    border-radius: 50%;
}

.gate-door--l .gate-ring { right: 22px; }
.gate-door--r .gate-ring { left: 22px; }

.gate-plaque {
    position: absolute;
    top: 14%;
    left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    padding: 12px 34px;
    background: #140c08;
    border: 4px solid #e3b552;
    color: #f3d58b;
    font-family: 'Noto Serif TC', serif;
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 900;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.gate-hint {
    position: absolute;
    bottom: 12%;
    left: 0;
    right: 0;
    z-index: 2;
    text-align: center;
    color: rgba(255, 240, 210, 0.75);
    letter-spacing: 0.2em;
}

.scene-gate.is-open .gate-plaque,
.scene-gate.is-open .gate-hint { opacity: 0; }

/* =========================================================
   數學研究所
   ========================================================= */
body.scene-math {
    --scene-focus: #5eead4;
    background:
        radial-gradient(ellipse 60% 45% at 50% 18%, rgba(37, 99, 235, 0.35), transparent 70%),
        radial-gradient(ellipse 40% 30% at 85% 80%, rgba(94, 234, 212, 0.12), transparent 70%),
        linear-gradient(rgba(96, 165, 250, 0.1) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(90deg, rgba(96, 165, 250, 0.1) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(180deg, #0d1b3d, #070f24);
    background-attachment: fixed;
}

.decor-dome {
    position: absolute;
    top: -200px;
    left: 50%;
    width: 900px;
    height: 520px;
    margin-left: -450px;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.2);
    background: repeating-conic-gradient(from 0deg at 50% 100%, rgba(96, 165, 250, 0.06) 0 1deg, transparent 1deg 15deg);
}

.decor-cube {
    position: absolute;
    left: 6%;
    top: 190px;
    width: 90px;
    height: 90px;
    transform-style: preserve-3d;
    animation: scene-spin 14s linear infinite;
}

.decor-cube span {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(94, 234, 212, 0.7);
    background: rgba(94, 234, 212, 0.05);
}

.decor-cube span:nth-child(1) { transform: translateZ(45px); }
.decor-cube span:nth-child(2) { transform: rotateY(180deg) translateZ(45px); }
.decor-cube span:nth-child(3) { transform: rotateY(90deg) translateZ(45px); }
.decor-cube span:nth-child(4) { transform: rotateY(-90deg) translateZ(45px); }
.decor-cube span:nth-child(5) { transform: rotateX(90deg) translateZ(45px); }
.decor-cube span:nth-child(6) { transform: rotateX(-90deg) translateZ(45px); }

@keyframes scene-spin {
    from { transform: perspective(600px) rotateX(-20deg) rotateY(0); }
    to { transform: perspective(600px) rotateX(-20deg) rotateY(360deg); }
}

.decor-pyramid {
    position: absolute;
    right: 7%;
    top: 200px;
    animation: scene-bob 7s ease-in-out infinite;
}

.decor-ring {
    position: absolute;
    right: 12%;
    top: 68%;
    animation: scene-turn 22s linear infinite;
}

@keyframes scene-bob { 50% { transform: translateY(-16px) rotate(6deg); } }
@keyframes scene-turn { to { transform: rotate(360deg); } }

.decor-formula {
    position: absolute;
    color: rgba(147, 197, 253, 0.14);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
}

.scene-math .scene-sign {
    display: inline-block;
    padding: 14px 40px 12px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.28), rgba(37, 99, 235, 0.08));
    border: 1px solid rgba(96, 165, 250, 0.6);
    clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.35) inset;
}

.scene-math .scene-sign small {
    display: block;
    color: #5eead4;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.5em;
}

.scene-math .scene-sign h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    font-weight: 900;
    letter-spacing: 0.25em;
    text-indent: 0.25em;
    text-shadow: 0 0 14px rgba(96, 165, 250, 0.55);
}

.scene-math .scene-status { color: #c7d7f5; }
.scene-math .scene-status b { color: #5eead4; font-family: 'Orbitron', sans-serif; }

body.scene-math .semester-segmented-control {
    background: rgba(7, 15, 36, 0.75);
    border: 1px solid rgba(96, 165, 250, 0.4);
}

body.scene-math .semester-segmented-control .segmented-item {
    color: #a9bde0;
}

body.scene-math .semester-segmented-control .segmented-item.active {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
    box-shadow: 0 0 18px rgba(14, 165, 233, 0.55);
}

/* 實驗卡 */
body.scene-math .button-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

body.scene-math .section-button:hover {
    transform: translateY(-4px);
}

body.scene-math .card-body {
    align-items: stretch;
    min-height: 190px;
    padding: 16px 18px;
    text-align: left;
    color: #0f1f3d;
    background: #f7faff;
    border-top: 6px solid #2563eb;
    border-radius: 4px 4px 14px 14px;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.6), 0 14px 28px rgba(0, 0, 0, 0.45);
    transition: box-shadow 0.2s;
}

body.scene-math .section-button:hover .card-body {
    box-shadow: 0 0 0 3px #5eead4, 0 18px 32px rgba(0, 0, 0, 0.5);
}

body.scene-math .card-code {
    color: #1d4ed8;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
}

body.scene-math .card-icon {
    display: block;
    position: absolute;
    right: 16px;
    top: 18px;
    color: #93c5fd;
    font-size: 1.6rem;
}

body.scene-math .card-title {
    justify-content: flex-start;
    font-size: 1.25rem;
    line-height: 1.35;
    text-align: left;
}

body.scene-math .card-meta {
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    opacity: 1;
}

body.scene-math .card-progress {
    flex-wrap: nowrap;
    gap: 3px;
}

body.scene-math .card-progress i {
    flex: 1;
    height: 10px;
    border-radius: 2px;
    background: #dbe4f3;
}

body.scene-math .card-progress i.on { background: linear-gradient(90deg, #2563eb, #0ea5e9); }
body.scene-math .card-state { color: #475569; text-align: left; }
body.scene-math .section-button[data-level="training"] .card-state { color: #0369a1; }
body.scene-math .section-button[data-level="master"] .card-body { border-top-color: #f59e0b; }
body.scene-math .section-button[data-level="master"] .card-progress i { background: #f59e0b; }
body.scene-math .section-button[data-level="master"] .card-state { color: #b45309; }

body.scene-math .section-button[data-level="master"] .card-body::after {
    content: '認證';
    position: absolute;
    right: 14px;
    top: 56px;
    width: 58px;
    height: 52px;
    display: grid;
    place-items: center;
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #4a2a00;
    font-size: 0.8rem;
    font-weight: 900;
    transform: rotate(-8deg);
}

body.scene-math .section-button.exam-card .card-body { border-top-color: #db2777; }
body.scene-math .section-button.exam-card .card-code { color: #db2777; }

/* 研究面板 */
body.scene-math.menu-hidden .section-content.active-section {
    color: #0f1f3d;
    background: #f7faff;
    border-top: 8px solid #2563eb;
    border-radius: 6px 6px 16px 16px;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.6), 0 0 60px rgba(37, 99, 235, 0.45);
    animation: scene-panel 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@keyframes scene-panel {
    from { transform: scaleY(0.04); opacity: 0.4; }
    to { transform: scaleY(1); opacity: 1; }
}

body.scene-math .scene-sheet-head { border-bottom: 1px solid #dbe4f3; }
body.scene-math .sheet-code { color: #1d4ed8; font-family: 'Orbitron', sans-serif; font-size: 1.9rem; font-weight: 900; }
body.scene-math .sheet-close { border: 2px solid #1d4ed8; color: #1d4ed8; }
body.scene-math .sheet-close:hover { background: #1d4ed8; color: #fff; }

body.scene-math .subsection-selector {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    gap: 8px !important;
    margin-bottom: 16px;
}

body.scene-math .subsection-selector .subsection-button,
body.scene-math .subsection-selector .subsection-button:hover {
    background: #fff !important;
    border: 2px solid #bfdbfe !important;
    border-radius: 8px !important;
    color: #334155 !important;
    box-shadow: none !important;
}

body.scene-math .subsection-selector .subsection-button.is-active {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #fff !important;
}

body.scene-math .level-tab-btn {
    background: #fff !important;
    border: 2px solid #cbd5e1 !important;
    color: #475569 !important;
}

body.scene-math .level-tab-btn.active {
    background: #dbeafe !important;
    border-color: #2563eb !important;
    color: #1d4ed8 !important;
}

body.scene-math .section-content a.btn,
body.scene-math .section-content a.btn[href*="math/"] {
    border: 2px solid #dbe4f3 !important;
    border-left-width: 2px !important;
    background: #fff;
    color: #0f1f3d;
    box-shadow: none;
}

body.scene-math .section-content a.btn:hover,
body.scene-math .section-content a.btn[href*="math/"]:hover {
    border-color: #2563eb !important;
    background: #eff6ff;
    color: #0f1f3d;
    transform: translateY(-2px);
    box-shadow: none;
}

body.scene-math:not(#_) .section-content a.btn::before,
body.scene-math:not(#_) .section-content a.btn:hover::before,
body.scene-math:not(#_) .section-content a.btn[href*="math/"]::before,
body.scene-math:not(#_) .section-content a.btn[href*="math/"]:hover::before {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
}

body.scene-math .section-content a.btn::after,
body.scene-math .section-content a.btn:hover::after,
body.scene-math .section-content a.btn[href*="math/"]::after,
body.scene-math .section-content a.btn[href*="math/"]:hover::after {
    color: #64748b;
}

/* 自帶顏色的特別關卡（複習遊戲、小考）統一成粉紅關卡 */
body.scene-math .section-content a.btn[style] {
    background: #fdf2f8 !important;
    border: 2px solid #f9a8d4 !important;
    color: #0f1f3d !important;
    box-shadow: none !important;
}

body.scene-math .section-content a.btn[style]:hover {
    border-color: #db2777 !important;
}

body.scene-math .section-content a.btn[style]::before {
    background: #fce7f3 !important;
    color: #db2777 !important;
}

/* 氣密門 */
.scene-math .scene-gate { display: flex; }

.gate-hatch {
    flex: 1;
    background:
        repeating-linear-gradient(0deg, rgba(96, 165, 250, 0.1) 0 1px, transparent 1px 40px),
        linear-gradient(180deg, #13244d, #0a1530);
    transition: transform 0.4s cubic-bezier(0.7, 0, 0.3, 1) 0.05s;
}

.gate-hatch--l { box-shadow: inset -3px 0 0 rgba(94, 234, 212, 0.6); }
.gate-hatch--r { box-shadow: inset 3px 0 0 rgba(94, 234, 212, 0.6); }
.scene-gate.is-open .gate-hatch--l { transform: translateX(-100%); }
.scene-gate.is-open .gate-hatch--r { transform: translateX(100%); }

.gate-core {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    color: #e6f0ff;
    text-align: center;
    transition: opacity 0.15s;
}

.scene-gate.is-open .gate-core { opacity: 0; }

.gate-orbit {
    width: 150px;
    height: 150px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border: 3px dashed #5eead4;
    border-radius: 50%;
    animation: scene-turn 4s linear infinite;
}

.gate-title { font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 900; letter-spacing: 0.3em; text-indent: 0.3em; }
.gate-msg { margin-top: 8px; color: #5eead4; font-size: 0.9rem; letter-spacing: 0.2em; }

/* =========================================================
   英文書店
   ========================================================= */
body.scene-english {
    --scene-focus: #ffd27a;
    background:
        linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px) 0 0 / 100% 26px,
        linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px) 0 0 / 60px 52px,
        linear-gradient(180deg, #2d1b4e 0, #7b3f6e 300px, #f19a6a 460px, #7a2e25 461px, #4e1b16 100%);
    background-attachment: fixed;
}

.decor-stars i {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    animation: scene-twinkle 3s ease-in-out infinite;
}

@keyframes scene-twinkle { 50% { opacity: 0.2; } }

.decor-skyline {
    position: absolute;
    left: 0;
    right: 0;
    top: 270px;
    width: 100%;
    height: 190px;
}

.decor-bigben {
    position: absolute;
    right: 5%;
    top: 90px;
    width: 92px;
}

.decor-lamp {
    position: absolute;
    top: 340px;
    width: 10px;
    height: 100%;
    background: linear-gradient(90deg, #1b1220, #3a2a40, #1b1220);
}

.decor-lamp::before {
    content: '';
    position: absolute;
    top: -46px;
    left: -15px;
    width: 40px;
    height: 48px;
    background: radial-gradient(circle at 50% 55%, #fff6d8, #ffd27a 45%, #c98a2a 100%);
    clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
}

.decor-lamp::after {
    content: '';
    position: absolute;
    top: -120px;
    left: -110px;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 210, 122, 0.35), transparent 65%);
}

.decor-lamp--l { left: 2%; }
.decor-lamp--r { right: 2%; }

.scene-english .scene-header {
    max-width: 1000px;
    padding: 0 12px;
}

.scene-english .scene-sign {
    width: min(100%, 640px);
    margin: 0 auto;
    padding: 14px 20px 12px;
    background: linear-gradient(180deg, #3b1f5c, #24113a);
    border: 4px solid #e7b75a;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.scene-english .scene-sign small {
    display: block;
    color: #e7b75a;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
}

.scene-english .scene-sign h1 {
    margin: 0;
    color: #fbf3e2;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.6rem, 6vw, 2.5rem);
    font-weight: 900;
    text-shadow: 0 2px 0 #12061f, 0 0 16px rgba(231, 183, 90, 0.4);
}

.scene-english .scene-sign h1 span {
    display: block;
    color: #e7b75a;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 0.5em;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
}

.scene-awning {
    position: relative;
    height: 50px;
    background: repeating-linear-gradient(90deg, #6d28d9 0 46px, #fbf3e2 46px 92px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.scene-awning::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -16px;
    height: 16px;
    background:
        radial-gradient(circle at 23px 0, #6d28d9 22px, transparent 23px) 0 0 / 92px 16px repeat-x,
        radial-gradient(circle at 69px 0, #fbf3e2 22px, transparent 23px) 0 0 / 92px 16px repeat-x;
}

.scene-english .scene-status { color: #f1d9b0; }
.scene-english .scene-status b { color: #ffd27a; font-family: 'Playfair Display', Georgia, serif; font-size: 1.1rem; }

body.scene-english .semester-segmented-control {
    gap: 10px;
    margin-top: 34px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

body.scene-english .semester-segmented-control .segmented-item {
    position: relative;
    padding: 8px 18px 8px 26px;
    border-radius: 3px;
    background: #fbf3e2;
    color: #2a1f2d;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transform: rotate(-2deg);
}

body.scene-english .semester-segmented-control .segmented-item + .segmented-item { transform: rotate(2deg); }

body.scene-english .semester-segmented-control .segmented-item::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: #2e1b10;
}

body.scene-english .semester-segmented-control .segmented-item.active {
    background: #e7b75a;
    color: #2a1f2d;
    transform: scale(1.06);
}

/* 書架：櫥窗裡的木架 */
body.scene-english .button-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 30px 0;
    padding: 30px 14px 20px;
    background:
        radial-gradient(ellipse 80% 60% at 50% 20%, rgba(255, 220, 150, 0.3), transparent 70%),
        linear-gradient(180deg, #4a2d1c, #2e1b10);
    border: 10px solid #24113a;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6), 0 20px 40px rgba(0, 0, 0, 0.45);
}

body.scene-english .section-button {
    padding: 0 12px 18px;
}

body.scene-english .section-button::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 18px;
    background: linear-gradient(180deg, #6b4226, #3f2514);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.5);
}

body.scene-english .section-button:hover {
    transform: translateY(-6px);
}

body.scene-english .section-button:nth-child(6n+1) { --cover: #5b2a86; }
body.scene-english .section-button:nth-child(6n+2) { --cover: #1e4f7a; }
body.scene-english .section-button:nth-child(6n+3) { --cover: #8a2c3b; }
body.scene-english .section-button:nth-child(6n+4) { --cover: #2f6b4f; }
body.scene-english .section-button:nth-child(6n+5) { --cover: #a0522d; }
body.scene-english .section-button:nth-child(6n+6) { --cover: #3d3b8e; }

body.scene-english .card-body {
    align-items: stretch;
    max-width: 150px;
    width: 100%;
    margin: 0 auto;
    aspect-ratio: 3 / 4.1;
    padding: 14px 12px 12px 18px;
    gap: 6px;
    color: #fbf3e2;
    text-align: left;
    background: var(--cover, #5b2a86);
    border-radius: 3px 8px 8px 3px;
    box-shadow:
        inset 6px 0 0 rgba(0, 0, 0, 0.25),
        inset 8px 0 0 rgba(255, 255, 255, 0.08),
        6px 6px 0 #e9dfc8,
        7px 7px 0 rgba(0, 0, 0, 0.25),
        0 14px 20px rgba(0, 0, 0, 0.45);
}

body.scene-english .card-code {
    color: #ffd27a;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* 段考卡的「段考」字較長，不放那麼大 */
body.scene-english .section-button.exam-card .card-code { font-size: 1.3rem; }

body.scene-english .card-title {
    justify-content: flex-start;
    align-items: flex-start;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    line-height: 1.25;
    text-align: left;
    overflow: hidden;
}

body.scene-english .card-meta {
    padding-top: 6px;
    border-top: 2px solid rgba(231, 183, 90, 0.6);
}

body.scene-english .card-progress { justify-content: flex-start; }

body.scene-english .card-progress i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}

body.scene-english .card-progress i.on { background: #ffd27a; }

body.scene-english .card-progress i.stamp {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-style: normal;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    filter: grayscale(1);
    opacity: 0.55;
}

body.scene-english .card-progress i.stamp.on {
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid #e7b75a;
    filter: none;
    opacity: 1;
}

body.scene-english .card-state { color: rgba(251, 243, 226, 0.85); text-align: left; }

body.scene-english .section-button[data-level="master"] .card-body::after {
    content: '★ TOP READER';
    position: absolute;
    top: -10px;
    right: -12px;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    padding: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff1b8, #e7b75a 60%, #b07d22);
    color: #4a2a00;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.6rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    transform: rotate(12deg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

body.scene-english .section-button.exam-card .card-body {
    background: repeating-linear-gradient(45deg, #1f2937 0 10px, #111827 10px 20px);
    border: 2px solid #e7b75a;
}

/* 翻開的書 */
body.scene-english.menu-hidden .section-content.active-section {
    color: #2a1f2d;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.06), transparent 6%, transparent 94%, rgba(0, 0, 0, 0.06)),
        #fbf3e2;
    border: 10px solid #5b2a86;
    border-radius: 10px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
    animation: scene-open-book 0.55s cubic-bezier(0.3, 0.7, 0.3, 1) both;
    transform-origin: left center;
}

@keyframes scene-open-book {
    from { transform: perspective(1600px) rotateY(-70deg); opacity: 0; }
    to { transform: perspective(1600px) rotateY(0); opacity: 1; }
}

body.scene-english .scene-sheet-head { border-bottom: 2px dashed #cbb99a; }
body.scene-english .sheet-code { color: #6d28d9; font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 1.2rem; }
body.scene-english .sheet-title { font-family: 'Playfair Display', 'Noto Sans TC', Georgia, serif; }
body.scene-english .sheet-close { border: 2px solid #2a1f2d; border-radius: 999px; color: #2a1f2d; }
body.scene-english .sheet-close:hover { background: #2a1f2d; color: #fbf3e2; }

body.scene-english .subsection-selector {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    gap: 8px !important;
    margin-bottom: 18px;
}

body.scene-english .subsection-selector .subsection-button,
body.scene-english .subsection-selector .subsection-button:hover {
    padding: 12px 16px 18px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #6d28d9 !important;
    color: #fff !important;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
    box-shadow: none !important;
    opacity: 0.5;
}

body.scene-english .subsection-selector .subsection-button:nth-child(2) { background: #0f766e !important; }
body.scene-english .subsection-selector .subsection-button:nth-child(3) { background: #b45309 !important; }
body.scene-english .subsection-selector .subsection-button:nth-child(4) { background: #be185d !important; }

body.scene-english .subsection-selector .subsection-button.is-active {
    opacity: 1;
}

body.scene-english .section-content a.btn {
    border: 1.5px solid #e2d5bc !important;
    border-left: 6px solid #6d28d9 !important;
    background: #fff;
    color: #2a1f2d;
    box-shadow: none;
}

body.scene-english .section-content a.btn:hover {
    background: #fff;
    border-color: #e2d5bc !important;
    border-left-color: #6d28d9 !important;
    color: #2a1f2d;
    transform: translateX(4px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

body.scene-english:not(#_) .section-content a.btn::before,
body.scene-english:not(#_) .section-content a.btn:hover::before {
    background: #ede4ff !important;
    color: #6d28d9 !important;
    box-shadow: none !important;
}

body.scene-english .section-content a.btn::after,
body.scene-english .section-content a.btn:hover::after {
    color: #7a6a7d;
}

/* 書店門 */
.scene-english .scene-gate {
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #2d1b4e, #7b3f6e 60%, #f19a6a);
    perspective: 1200px;
}

.gate-doorway {
    position: relative;
    width: min(62vw, 300px);
    aspect-ratio: 3 / 5;
    background: radial-gradient(ellipse at 50% 40%, #fff1c9, #f2b764 60%, #a8642a);
    border: 14px solid #24113a;
    border-bottom: 0;
    box-shadow: 0 0 80px rgba(255, 200, 110, 0.4);
}

.gate-shopdoor {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 14%;
    background: linear-gradient(180deg, #6d28d9, #4c1d95);
    transform-origin: left center;
    transition: transform 0.45s cubic-bezier(0.6, 0, 0.3, 1) 0.05s;
}

.scene-gate.is-open .gate-shopdoor { transform: rotateY(-100deg); }

.gate-glass {
    width: 68%;
    aspect-ratio: 1;
    border: 6px solid #2e1065;
    background:
        linear-gradient(#2e1065, #2e1065) 50% 0 / 5px 100% no-repeat,
        linear-gradient(#2e1065, #2e1065) 0 50% / 100% 5px no-repeat,
        radial-gradient(circle at 40% 30%, #fff6d8, #f5c56b);
}

.gate-sign {
    margin-top: 12%;
    padding: 6px 16px;
    background: #fbf3e2;
    border: 3px solid #e7b75a;
    border-radius: 4px;
    color: #15803d;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    letter-spacing: 0.15em;
    animation: scene-flip 0.3s ease 0.05s both;
}

@keyframes scene-flip { from { transform: rotateX(180deg); color: #9f1239; } }

.gate-knob {
    position: absolute;
    right: 12px;
    top: 56%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e7b75a;
}

.gate-bell {
    position: absolute;
    top: -42px;
    left: 50%;
    margin-left: -16px;
    font-size: 28px;
    transform-origin: top center;
    animation: scene-ring 0.3s ease-in-out 0.05s 1;
}

@keyframes scene-ring {
    25% { transform: rotate(18deg); }
    75% { transform: rotate(-18deg); }
}

.gate-name {
    position: absolute;
    bottom: 12%;
    left: 0;
    right: 0;
    color: #fbf3e2;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 900;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.scene-gate.is-open .gate-name { opacity: 0; transition: opacity 0.3s; }

/* =========================================================
   窄螢幕與減少動態
   ========================================================= */
@media (max-width: 1100px) {
    .decor-couplet { display: none; }
    .decor-lattice { opacity: 0.35; }
}

@media (max-width: 700px) {
    .decor-lattice,
    .decor-lamp,
    .decor-bigben,
    .decor-cube,
    .decor-pyramid,
    .decor-formula { display: none; }

    .decor-dome { width: 360px; height: 300px; margin-left: -180px; top: -120px; }
    .decor-ring { right: 4%; }
}

@media (max-width: 600px) {
    body.scene {
        padding: 44px 12px 48px !important;
    }

    body.scene .button-container,
    body.scene-math .button-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 26px 14px;
    }

    body.scene-english .button-container {
        gap: 26px 0;
        padding: 24px 6px 14px;
        border-width: 6px;
    }

    body.scene-english .section-button { padding: 0 8px 16px; }

    body.scene-chinese .card-body { min-height: 170px; }
    body.scene-chinese .card-title { font-size: 1.1rem; }
    body.scene-math .card-body { min-height: 170px; padding: 14px 12px; }
    body.scene-math .card-title { font-size: 1.05rem; }
    body.scene-math .card-icon { display: none; }

    body.scene-math .section-button[data-level="master"] .card-body::after {
        width: 46px;
        height: 42px;
        top: 12px;
        right: 8px;
        font-size: 0.68rem;
    }

    body.scene.menu-hidden .section-content.active-section {
        margin: 10px 0 30px;
        padding: 16px 14px 18px;
    }

    body.scene-chinese.menu-hidden .section-content.active-section {
        border-left-width: 10px;
        border-right-width: 10px;
    }

    body.scene-english.menu-hidden .section-content.active-section { border-width: 6px; }

    .scene-sheet-head { flex-wrap: wrap; }
    .sheet-close { margin-left: 0; }

    body.scene .section-content .btn-group { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .scene-decor *,
    .scene-gate *,
    body.scene .section-content.active-section {
        animation: none !important;
    }
}
