:root {
  /* 5-Level Type Scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 22px;
  --text-xl: 32px;

  /* Typography Families */
  --font-serif: "Newsreader", "Noto Serif TC", Georgia, serif;
  --font-body: "Noto Serif TC", "DM Sans", serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "DM Mono", monospace;

  /* Color Palette */
  --paper: #f4f0e8;
  --sheet: #fffdf8;
  --ink: #242923;
  --muted: #77796f;
  --line: #ded9ce;
  --soft: #eae5da;
  --accent: #bd452b;
  --accent-wash: #f7e6df;
  --green: #536e58;
  --code: #eeece5;
  --side: #e9e4d9;
  --shadow: 0 18px 60px #25251b0b;
}
[data-theme="dark"] {
  --paper: #20221f;
  --sheet: #292c28;
  --ink: #eee9dd;
  --muted: #a9a99e;
  --line: #454841;
  --soft: #343731;
  --accent: #ef8a6b;
  --accent-wash: #472e28;
  --green: #a9c2a7;
  --code: #20221f;
  --side: #252823;
  --shadow: 0 18px 60px #0003;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 65px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: var(--text-base); line-height: 1.75; transition: background .25s, color .25s; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; z-index: 100; top: -4rem; left: 1rem; padding: .7rem 1rem; background: var(--ink); color: var(--sheet); }
.skip-link:focus { top: 1rem; }
.topbar { height: 76px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--sheet); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--font-serif); font-size: var(--text-lg); letter-spacing: -.04em; line-height: 1; }
.brand i { color: var(--accent); font-weight: 400; }
.brand small { display: block; margin-top: 6px; color: var(--muted); font: var(--text-xs)/1.2 var(--font-mono); letter-spacing: .15em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--accent); color: #fff8ea; font-size: var(--text-lg); font-family: Georgia, serif; transform: rotate(-12deg); }
.top-actions { display: flex; align-items: center; gap: 13px; }
.view-switch { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.view-switch button { border: 0; border-radius: 3px; padding: 6px 10px; background: transparent; color: var(--muted); font-size: var(--text-xs); }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.icon-button { border: 1px solid var(--line); background: transparent; border-radius: 50%; width: 34px; height: 34px; font-size: var(--text-base); }
.shell { display: grid; grid-template-columns: 288px minmax(0, 1fr); max-width: 1600px; margin: 0 auto; min-height: 100vh; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); padding: 35px 0 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar-top { padding: 0 23px; flex-shrink: 0; }
.eyebrow, .section-kicker, .overline { font: var(--text-xs)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }
.side-intro { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.35; margin: 11px 0 28px; letter-spacing: -.02em; }
.search-label, .filter-label { display: block; font: var(--text-xs) var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 7px; }
.search-wrap { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 0 9px; background: var(--sheet); height: 39px; }
.search-wrap span { font-size: var(--text-base); color: var(--muted); }
.search-wrap input { border: 0; background: transparent; outline: 0; min-width: 0; flex: 1; font-size: var(--text-sm); }
.search-wrap kbd { color: var(--muted); font: var(--text-xs) var(--font-mono); border: 1px solid var(--line); padding: 1px 4px; }
.filter-label { margin-top: 18px; }
#progress-filter, #difficulty-filter { width: 100%; border: 1px solid var(--line); background: var(--sheet); height: 37px; padding: 0 8px; font-size: var(--text-sm); }
.filter-count { display: flex; align-items: center; gap: 10px; color: var(--muted); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .12em; margin: 18px 0 12px; padding: 0 23px; white-space: nowrap; flex-shrink: 0; }
.filter-count:empty { display: none; }
.filter-count::after { content: ""; height: 1px; background: var(--line); flex: 1; min-width: 20px; }
.filter-count:not(:empty) + .proposal-nav { margin-top: 0; }
.proposal-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 23px 28px; display: grid; gap: 6px; align-content: start; }
.progress-summary { display: none; }
.nav-item { display: block; text-decoration: none; padding: 12px 12px 11px; border-left: 2px solid transparent; overflow-wrap: anywhere; word-break: break-word; }
.nav-item:hover, .nav-item.active { background: color-mix(in srgb, var(--sheet) 63%, transparent); border-left-color: var(--accent); }
.nav-id { display: inline-flex; align-items: center; gap: 6px; font: var(--text-xs) var(--font-mono); letter-spacing: .08em; color: var(--accent); overflow-wrap: anywhere; word-break: break-word; }
.progress-badge { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-family: system-ui, -apple-system, sans-serif; font-weight: 700; line-height: 1; flex-shrink: 0; }
.progress-badge.learned { background: var(--green); color: #fff; }
[data-theme="dark"] .progress-badge.learned { color: var(--paper); }
.progress-badge.skipped { background: color-mix(in srgb, var(--muted) 25%, transparent); color: var(--muted); font-weight: 800; }
.nav-title { display: block; margin: 3px 0 5px; font-family: var(--font-serif); font-size: var(--text-base); line-height: 1.35; overflow-wrap: anywhere; word-break: break-word; }
.nav-meta { color: var(--muted); font-size: var(--text-xs); }
.sidebar-bottom { margin-top: auto; padding-top: 22px; }
.coverage { border-top: 1px solid var(--line); padding: 15px 0 7px; display: flex; align-items: center; gap: 7px; font-size: var(--text-xs); color: var(--muted); }
.coverage strong { margin-left: auto; color: var(--ink); font: var(--text-xs) var(--font-mono); }
.coverage-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.sidebar-bottom p { color: var(--muted); font-size: var(--text-xs); line-height: 1.5; margin: 5px 0 14px; }
.sidebar-bottom a { font-size: var(--text-xs); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.progress-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 15px; }
.progress-actions button, .modal-actions button { border: 1px solid var(--line); background: var(--sheet); padding: 8px 9px; font-size: var(--text-sm); text-align: left; }
.progress-actions button:hover, .modal-actions button:hover { border-color: var(--accent); color: var(--accent); }
.progress-summary { margin-top: 10px; padding: 11px 12px; border: 1px solid var(--line); background: var(--sheet); font-size: var(--text-xs); color: var(--muted); }
.progress-summary strong { color: var(--ink); }
.progress-summary-track { height: 4px; margin-top: 8px; background: var(--line); }
.progress-summary-track span { display: block; height: 100%; background: var(--green); }

.proposal-heading-state { display: inline-flex; align-items: center; gap: 9px; margin-top: 12px; }
.proposal-heading-state button { border: 1px solid var(--line); background: var(--sheet); padding: 6px 9px; font-size: var(--text-xs); }
.app-modal { width: min(590px, calc(100vw - 28px)); max-height: min(86vh, 820px); overflow: auto; padding: 22px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); box-shadow: 0 24px 90px #0005; }
.app-modal::backdrop { background: #10120fb0; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 4px 0 0; font: 500 var(--text-lg)/1.3 var(--font-serif); }
.modal-kicker { color: var(--muted); font: var(--text-xs) var(--font-mono); letter-spacing: .13em; }
.progress-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.progress-stat { padding: 10px; background: var(--paper); color: var(--muted); font-size: var(--text-xs); }
.progress-stat strong { display: block; color: var(--ink); font: var(--text-lg) var(--font-mono); }
.modal-section { margin-top: 18px; }
.modal-section h3 { margin: 0 0 8px; font-size: var(--text-sm); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.modal-actions .danger-action { color: var(--accent); }
.compact-actions { grid-template-columns: max-content max-content; }
.modal-message { min-height: 1.5em; color: var(--muted); font-size: var(--text-xs); }
.quiz-challenge-card { margin: 36px 0 12px; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.quiz-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.quiz-badge { color: var(--accent); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .1em; }
.quiz-header h3 { margin: 0; font: 500 var(--text-lg)/1.35 var(--font-serif); }
.quiz-question { margin: 15px 0 10px; font-weight: 500; font-size: var(--text-base); }
.quiz-challenge-card code, .exploration-modal code { font: .88em var(--font-mono); background: var(--code); padding: .15em .35em; border-radius: 3px; }
.quiz-options { display: grid; gap: 7px; }
.quiz-option { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); background: var(--sheet); cursor: pointer; font-size: var(--text-sm); }
.quiz-option:has(input:checked) { border-color: var(--accent); }
.quiz-option input { margin-top: 4px; accent-color: var(--accent); }
.quiz-option.is-correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 13%, var(--sheet)); }
.quiz-option.is-wrong { border-color: var(--accent); background: var(--accent-wash); }
.quiz-feedback { margin-top: 12px; padding: 11px 13px; border-left: 3px solid var(--green); background: color-mix(in srgb, var(--green) 12%, var(--sheet)); font-size: var(--text-sm); }
.quiz-feedback.wrong { border-left-color: var(--accent); background: var(--accent-wash); }
.quiz-feedback p { margin: 5px 0 0; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quiz-actions button, .quiz-actions a { border: 1px solid var(--line); background: var(--sheet); padding: 8px 11px; font-size: var(--text-sm); text-decoration: none; }
.quiz-actions .btn-primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.exploration-modal { width: min(700px, calc(100vw - 28px)); }
.exploration-meta { margin: 15px 0 8px; color: var(--muted); font: var(--text-xs) var(--font-mono); }
.exploration-result { margin-top: 13px; padding: 12px; border: 1px solid var(--line); background: var(--paper); font-size: var(--text-sm); }
.exploration-result a { display: inline-block; margin-top: 8px; }
main { min-width: 0; }
#view { max-width: 1120px; margin: 0 auto; padding: 35px clamp(28px, 5vw, 78px) 110px; }
#view.reader-view { width: calc(66.666667vw + 34px); max-width: 100%; margin: 0; padding-inline: 10px 24px; }
#view.reader-view > .back-link { margin-left: 0; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0,1fr) 225px; gap: 42px; padding: 37px 42px 39px; background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.hero::after { content: ""; width: 280px; height: 280px; position: absolute; right: -119px; top: -135px; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 0 0 24px var(--sheet), 0 0 0 25px var(--line), 0 0 0 58px var(--sheet), 0 0 0 59px var(--line); opacity: .55; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font: 500 var(--text-xl)/1.2 var(--font-serif); letter-spacing: -.03em; margin: 23px 0 17px; max-width: 650px; }
.hero h1 span { color: var(--accent); }
.hero-deck { font-family: var(--font-serif); font-size: var(--text-base); color: var(--muted); max-width: 620px; line-height: 1.8; }
.hero-aside { position: relative; z-index: 1; align-self: end; padding-bottom: 5px; }
.hero-aside .number { font: var(--text-xl)/1 var(--font-serif); font-size: 56px; color: var(--accent); letter-spacing: -.05em; }
.hero-aside p { color: var(--muted); font-size: var(--text-xs); max-width: 130px; margin: 15px 0 0; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; margin: 55px 0 15px; border-bottom: 1px solid var(--ink); padding-bottom: 12px; }
.catalog-head h2 { margin: 0; font: 500 var(--text-lg) var(--font-serif); letter-spacing: -.02em; }
.catalog-head span { color: var(--muted); font: var(--text-xs) var(--font-mono); }
.proposal-grid { display: grid; gap: 11px; }
.proposal-card { display: grid; grid-template-columns: 106px minmax(0,1fr) auto; gap: 16px; align-items: center; text-decoration: none; padding: 16px 20px; background: var(--sheet); border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.proposal-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-id { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font: var(--text-xs) var(--font-mono); }
.card-title { font: 500 var(--text-lg)/1.25 var(--font-serif); letter-spacing: -.02em; margin: 0 0 4px; }
.card-zh { font: var(--text-sm) var(--font-serif); color: var(--muted); margin: 0; }
.card-status { justify-self: end; text-align: right; }
.status-pill { display: inline-flex; gap: 6px; align-items: center; padding: 5px 8px; color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); text-transform: uppercase; letter-spacing: .08em; font: var(--text-xs) var(--font-mono); }
.catalog-foot { display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); margin-top: 16px; padding-top: 11px; font-size: var(--text-xs); }
.reader { display: block; }
.article { min-width: 0; padding: 32px; background: var(--sheet); border: 1px solid var(--line); border-radius: 4px; }
.floating-toc { position: fixed; bottom: 144px; right: 24px; z-index: 1000; display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); box-shadow: var(--shadow); font-size: var(--text-sm); }
.floating-toc:hover { color: var(--accent); border-color: var(--accent); }
.floating-toc svg { width: 18px; height: 18px; }
html.toc-open { overflow: hidden; }
.reader-aside { position: fixed; inset: 0; margin: 0 0 0 auto; width: 360px; max-width: calc(100% - 24px); height: 100vh; height: 100dvh; max-height: none; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--sheet); color: var(--ink); box-shadow: -16px 0 60px #0002; transform: translateX(100%); transition: transform .25s ease, display .25s allow-discrete, overlay .25s allow-discrete; }
.reader-aside[open] { display: flex; flex-direction: column; transform: translateX(0); }
.reader-aside::backdrop { background: #0005; opacity: 0; transition: opacity .25s ease, display .25s allow-discrete, overlay .25s allow-discrete; }
.reader-aside[open]::backdrop { opacity: 1; }
@starting-style {
  .reader-aside[open] { transform: translateX(100%); }
  .reader-aside[open]::backdrop { opacity: 0; }
}
.toc-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); }
.toc-header .toc-title { margin: 0; color: var(--ink); }
.toc-close { flex-shrink: 0; font-size: var(--text-lg); line-height: 1; }
.reader-aside .toc-list { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px 32px; }
.toc-list a { overflow-wrap: anywhere; }
.back-link { text-decoration: none; display: inline-flex; gap: 8px; align-items: center; font-size: var(--text-xs); color: var(--muted); margin-bottom: 25px; }
.back-link:hover { color: var(--accent); }
.proposal-heading { padding: 0 0 28px; }
.proposal-heading .proposal-id { font: var(--text-xs) var(--font-mono); color: var(--accent); letter-spacing: .09em; }
.proposal-heading h1 { margin: 14px 0 10px; font: 600 var(--text-xl)/1.25 var(--font-serif); letter-spacing: -.02em; }
.proposal-heading .zh-title { margin: 0; font: var(--text-lg)/1.4 var(--font-serif); color: var(--muted); }
.proposal-heading h1 { order: 0; }

/* Minimalist Proposal Header Prototype */
.proposal-heading--minimal { padding: 0 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.proposal-heading--minimal .proposal-heading-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.proposal-heading--minimal .proposal-id { font: var(--text-xs) var(--font-mono); color: var(--accent); letter-spacing: .09em; }
.proposal-heading--minimal .proposal-heading-state { margin-top: 0; display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--muted); }
.proposal-heading--minimal .progress-state-text { font-family: var(--font-sans); }
.proposal-heading--minimal .progress-state-text strong { color: var(--ink); }
.proposal-heading--minimal .progress-cycle-btn { border: 1px solid var(--line); background: var(--sheet); padding: 4px 10px; border-radius: 4px; font: 500 var(--text-xs) var(--font-sans); cursor: pointer; color: var(--ink); transition: border-color .15s, color .15s; }
.proposal-heading--minimal .progress-cycle-btn:hover { border-color: var(--accent); color: var(--accent); }
.proposal-heading--minimal .proposal-heading-titles { margin-bottom: 14px; }
.proposal-heading--minimal h1 { margin: 0 0 6px; font: 600 var(--text-xl)/1.25 var(--font-serif); letter-spacing: -.02em; }
.proposal-heading--minimal .zh-title { margin: 0; font: 400 var(--text-base)/1.4 var(--font-serif); color: var(--muted); }
.proposal-heading--minimal .summary { margin: 14px 0 18px; font: var(--text-base)/1.8 var(--font-serif); color: var(--ink); opacity: .92; max-width: 820px; }
.proposal-heading--minimal .meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.proposal-heading--minimal .meta-chip { padding: 3px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; font: var(--text-xs)/1.4 var(--font-mono); color: var(--muted); }
.proposal-heading--minimal .meta-chip + .meta-chip::before { content: none; }
.proposal-heading--minimal .meta-links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; font-size: var(--text-xs); color: var(--muted); }
.proposal-heading--minimal .meta-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.proposal-heading--minimal .meta-links a:hover { color: var(--accent); }

/* Tutorial Integrated Prerequisites */
.tutorial-prerequisites { margin: 0 0 24px; padding: 14px 18px; background: var(--paper); border-left: 3px solid var(--accent); border-radius: 4px; font: var(--text-sm)/1.75 var(--font-serif); }
.tutorial-prerequisites > strong { display: block; font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.tutorial-prerequisites ul { margin: 0; padding-left: 1.25rem; }
.reader-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.reader-tabs { display: flex; gap: 22px; }
.reader-tabs [role="tab"] { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 14px 0; color: var(--muted); text-align: left; font: 500 var(--text-sm)/1.5 var(--font-sans); }
.reader-tabs [role="tab"] span { font-size: var(--text-xs); font-weight: 400; margin-left: 7px; }
.reader-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.reader-toolbar .view-switch { border: 0; background: var(--paper); margin-block: 7px; }
.status-callout { margin-top: 16px; padding: 11px 13px; background: var(--accent-wash); border-left: 3px solid var(--accent); font: var(--text-sm)/1.75 var(--font-serif); }
.prerequisites { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); font: var(--text-sm)/1.75 var(--font-serif); }
.prerequisites > strong { font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.prerequisites ul { margin: 7px 0 0; padding-left: 1.2rem; }
.full-source .section-divider { margin-top: 20px; }
.summary { margin: 20px 0; font: var(--text-base)/1.85 var(--font-serif); max-width: 780px; color: var(--muted); }
.summary p { margin: 0; }
.meta-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 19px; }
.meta-chip { padding: 3px 0; color: var(--muted); font: var(--text-xs)/1.5 var(--font-mono); }
.meta-chip + .meta-chip::before { content: "·"; margin-right: 7px; color: var(--line); }
.meta-links { display: flex; flex-wrap: wrap; gap: 17px; margin-top: 17px; font-size: var(--text-xs); }
.meta-links a { text-underline-offset: 3px; }
.meta-links a:hover { color: var(--accent); }
.source-note { color: var(--muted); font-size: var(--text-xs); line-height: 1.7; margin: 14px 0 22px; overflow-wrap: anywhere; }
.source-note a { color: var(--ink); text-underline-offset: 2px; }
.official-label { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--muted); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .13em; }
.official-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.markdown { font: var(--text-base)/1.85 var(--font-body); }
.markdown h2, .markdown h3, .markdown h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
.markdown h2 { font-size: var(--text-xl); }
.markdown h3 { font-size: var(--text-lg); }
.markdown h4 { font-size: var(--text-lg); }
.markdown p { margin: 0 0 1.2em; }
.markdown ul, .markdown ol { padding-left: 1.5em; margin: .4em 0 1em; }
.markdown li + li { margin-top: .35em; }
.markdown li > p { margin-bottom: .4em; }
.markdown li > ul, .markdown li > ol { margin-bottom: .4em; }
.markdown blockquote { margin: 0 0 1.2em; padding: 4px 0 4px 20px; border-left: 3px solid var(--line); color: var(--muted); font-family: var(--font-serif); font-style: italic; }
.markdown blockquote > :last-child { margin-bottom: 0; }
.markdown code, .prerequisites code { font: .88em var(--font-mono); background: var(--code); padding: .15em .35em; border-radius: 3px; }
.markdown pre { margin: 1.2em 0; padding: 18px 20px; overflow: auto; background: var(--code); border-radius: 5px; font: var(--text-sm)/1.7 var(--font-mono); }
.markdown pre code { background: none; padding: 0; font: inherit; }
.markdown a { text-underline-offset: 3px; text-decoration-color: color-mix(in srgb,var(--accent) 55%,transparent); }
.markdown a:hover { color: var(--accent); }
.markdown table { display: block; width: 100%; overflow: auto; border-collapse: collapse; margin: 0 0 1.2em; font-size: var(--text-sm); }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.markdown th { background: var(--soft); font-weight: 600; }
.markdown img { max-width: 100%; height: auto; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.proposal-block { scroll-margin-top: 100px; margin: 0 0 1.15em; }
.proposal-block.kind-heading { margin-top: 2.3em; margin-bottom: .9em; }
.proposal-block.kind-heading h2, .proposal-block.kind-heading h3, .proposal-block.kind-heading h4 { margin: 0; }
.proposal-block.kind-heading:has(h2) { padding-bottom: .5em; border-bottom: 1px solid var(--line); }
.proposal-block.kind-list { margin-bottom: .3em; }
.kind-list ul, .kind-list ol { margin: 0; }
.kind-list li > :last-child { margin-bottom: 0; }
.kind-list + .proposal-block:not(.kind-list, .kind-heading) { margin-top: 1.3em; }
.pair { display: block; }
.pair-cell { min-width: 0; overflow-wrap: anywhere; }
.pair-cell + .pair-cell { margin-top: 12px; }
.pair-cell > :last-child { margin-bottom: 0; }
.code-panel { border: 1px solid var(--line); background: var(--code); margin: 1.2em 0; border-radius: 5px; overflow: hidden; }
.code-head { min-height: 36px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 4px 13px; }
.code-head span { color: var(--muted); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .09em; }
.code-tools { display: flex; gap: 6px; }
.code-tools button { background: transparent; border: 1px solid var(--line); padding: 3px 7px; font: var(--text-xs) var(--font-mono); }
.code-tools button:hover, .code-tools button[aria-pressed="true"] { background: var(--sheet); border-color: var(--accent); color: var(--accent); }
.code-panel pre { margin: 0; border-radius: 0; font: var(--text-sm)/1.7 var(--font-mono); tab-size: 2; }
.code-explanation { border-top: 1px solid var(--line); padding: 12px 15px; font: var(--text-sm)/1.75 var(--font-serif); background: var(--sheet); }
.code-explanation strong { font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.reference-block { padding: 9px 12px; border: 1px dashed var(--line); font-size: var(--text-sm); }
.toc-title { font: var(--text-xs) var(--font-mono); letter-spacing: .13em; color: var(--muted); text-transform: uppercase; margin: 0 0 12px; }
.toc-list { display: grid; gap: 2px; }
.toc-list a { text-decoration: none; color: var(--muted); font-size: var(--text-sm); line-height: 1.45; padding: 5px 7px; border-left: 1px solid transparent; }
.toc-list a[data-depth="3"] { padding-left: 15px; }
.toc-list a[data-depth="4"] { padding-left: 22px; }
.toc-list a:hover, .toc-list a.active { color: var(--accent); border-left-color: var(--accent); }
.tutorial, .extension { margin: 36px 0; scroll-margin-top: 100px; }
.lesson-intro > .tutorial:first-child { margin-top: 14px; }
.full-source > .proposal-block:first-child.kind-heading { margin-top: 14px; }
.editorial-head { margin-bottom: 16px; }
.editorial-head .kind-label { color: var(--accent); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .1em; }
.tutorial .kind-label { display: none; }
.editorial-head h2 { margin: 8px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.editorial-body { overflow-wrap: anywhere; }
.editorial-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 15px; font-size: var(--text-sm); }
.section-divider { margin: 38px 0 15px; display: flex; align-items: center; gap: 13px; color: var(--muted); font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .14em; }
.section-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
/* About page & Learner FAQ styles */
.about-page { min-width: 0; padding: 32px; background: var(--sheet); border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-body); color: var(--ink); }
.about-nav-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.about-nav-bar .nav-left, .about-nav-bar .nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.about-nav-btn { display: inline-flex; align-items: center; padding: 7px 14px; background: transparent; border: 1px solid var(--line); border-radius: 6px; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; color: var(--ink); text-decoration: none; transition: all .2s; }
.about-nav-btn:hover { background: var(--paper); border-color: var(--accent); color: var(--accent); }
.about-action-pill { display: inline-flex; align-items: center; padding: 7px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; color: var(--ink); text-decoration: none; transition: all .2s; }
.about-action-pill:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }

.about-hero { margin-bottom: 40px; }
.about-hero .overline { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.about-hero h1 { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 600; line-height: 1.25; margin: 0 0 16px; color: var(--ink); letter-spacing: -.02em; }
.about-hero h1 span { color: var(--accent); }
.about-hero .hero-deck { font-family: var(--font-body); font-size: var(--text-base); line-height: 1.85; color: var(--ink); max-width: 720px; margin: 0; }

.about-jump-toc { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 22px; margin-bottom: 44px; }
.jump-toc-head { margin-bottom: 16px; }
.jump-toc-kicker { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.jump-toc-head h2 { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; margin: 4px 0 0; color: var(--ink); }
.faq-jump-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.faq-jump-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); text-decoration: none; transition: all .2s; }
.faq-jump-card:hover { border-color: var(--accent); background: var(--accent-wash); transform: translateY(-2px); }
.jump-badge { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); font-weight: 500; }
.jump-title { font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.45; color: var(--ink); }

.faq-list { display: flex; flex-direction: column; gap: 28px; }
.faq-card { background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: 26px 28px; scroll-margin-top: 80px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); transition: border-color .2s; }
.faq-card:hover { border-color: var(--accent); }
.faq-card-header { margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.faq-badge { display: inline-block; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); background: var(--accent-wash); padding: 3px 8px; border-radius: 4px; margin-bottom: 8px; font-weight: 500; }
.faq-card-header h3 { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; line-height: 1.35; margin: 0; color: var(--ink); }
.faq-body { font-family: var(--font-body); font-size: var(--text-base); line-height: 1.85; color: var(--ink); }
.faq-body p { margin: 0 0 14px; }
.faq-body p:last-child { margin-bottom: 0; }
.faq-body ul, .faq-body ol { margin: 12px 0 16px 20px; padding: 0; }
.faq-body li { margin-bottom: 8px; line-height: 1.75; }
.faq-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.faq-body a:hover { opacity: .85; }
.faq-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--code); padding: 2px 6px; border-radius: 4px; color: var(--ink); }

.about-contribution-box { margin-top: 48px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 28px 24px; }
.about-contribution-box .footer-kicker { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.about-contribution-box h3 { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; margin: 0 0 10px; color: var(--ink); }
.about-contribution-box p { font-family: var(--font-body); font-size: var(--text-sm); line-height: 1.75; color: var(--muted); margin: 0 0 18px; }
.contribution-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.github-pr-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; background: var(--ink); color: var(--sheet); border-radius: 6px; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; text-decoration: none; transition: all .2s; }
.github-pr-btn:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.secondary-gh-link { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--muted); text-decoration: none; font-weight: 500; }
.secondary-gh-link:hover { color: var(--accent); text-decoration: underline; }

/* Proposal Bottom Editorial Footer */
.proposal-editorial-footer { margin-top: 48px; padding: 32px 28px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.02); }
.proposal-editorial-footer .footer-kicker { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.proposal-editorial-footer .footer-title { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; margin: 0 0 10px; color: var(--ink); }
.proposal-editorial-footer .footer-desc { font-family: var(--font-body); font-size: var(--text-sm); line-height: 1.7; color: var(--muted); margin: 0 0 18px; max-width: 680px; }
.proposal-editorial-footer .footer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.proposal-editorial-footer .footer-btn { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 6px; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; text-decoration: none; transition: all .2s; }
.proposal-editorial-footer .primary-btn { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.proposal-editorial-footer .primary-btn:hover { opacity: .9; transform: translateY(-1px); }
.proposal-editorial-footer .secondary-btn { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.proposal-editorial-footer .secondary-btn:hover { background: var(--paper); border-color: var(--accent); color: var(--accent); }
.proposal-editorial-footer .footer-faq-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; font-size: var(--text-xs); font-family: var(--font-sans); }
.proposal-editorial-footer .faq-pills-label { color: var(--muted); font-weight: 500; }
.proposal-editorial-footer .faq-pill { display: inline-block; padding: 4px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; transition: all .2s; }
.proposal-editorial-footer .faq-pill:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
.proposal-editorial-footer .footer-meta-note { font-family: var(--font-sans); font-size: var(--text-xs); color: var(--muted); border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 6px; line-height: 1.6; }
.proposal-editorial-footer .footer-meta-note a { color: var(--accent); text-decoration: none; }
.proposal-editorial-footer .footer-meta-note a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .about-page { padding: 20px 16px; }
  .about-hero h1 { font-size: 26px; }
  .faq-card, .proposal-editorial-footer, .about-jump-toc, .about-contribution-box { padding: 20px 16px; }
  .faq-jump-grid { grid-template-columns: 1fr; }
}
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--sheet); padding: 9px 14px; font-size: var(--text-xs); transition: .2s; z-index: 60; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.empty { padding: 30px 20px; border: 1px dashed var(--line); color: var(--muted); text-align: center; font-family: var(--font-serif); }
.loading { padding: 40px 0; color: var(--muted); }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 245px minmax(0, 1fr); }
  .sidebar { padding-inline: 0; }
  .sidebar-top, .filter-count, .proposal-nav { padding-inline: 17px; }
}
@media (max-width: 790px) {
  .topbar { height: 65px; padding: 0 17px; }
  .brand { font-size: var(--text-lg); }
  .shell { display: block; min-height: 100vh; }
  .sidebar { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 17px 10px; }
  .sidebar-top { display: grid; grid-template-columns: minmax(0, 1fr) 180px; column-gap: 12px; align-items: center; padding: 0; }
  .eyebrow, .side-intro, .sidebar-bottom { display: none; }
  .search-label, .filter-label { display: none; }
  .search-wrap { grid-column: 1; grid-row: 1; }
  #difficulty-filter { grid-column: 2; grid-row: 1; height: 39px; }
  .filter-count { margin: 12px 0 0; padding: 0; }
  .filter-count:not(:empty) + .proposal-nav { margin-top: 8px; }
  .proposal-nav { display: flex; overflow: auto; margin: 12px -17px 0; padding: 0 17px 8px; gap: 7px; flex: none; }
  .nav-item { min-width: 172px; padding: 8px 10px; border-left: 0; border-bottom: 2px solid transparent; }
  .nav-item:hover, .nav-item.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  #view { padding: 25px 17px 70px; }
  #view.reader-view { width: 100%; padding-inline: 17px; }
  #view.reader-view > .back-link { margin-left: 0; }
  .hero { grid-template-columns: 1fr; padding: 29px 24px; gap: 13px; }
  .hero-aside { display: flex; align-items: end; gap: 15px; }
  .hero-aside .number { font-size: 44px; }
  .hero-aside p { margin: 0; max-width: 180px; }
  .hero::after { right: -195px; }
  .proposal-card { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 18px; }
  .card-id { grid-column: 1; grid-row: 1; }
  .card-content { grid-column: 1 / -1; grid-row: 2; }
  .card-status { grid-column: 2; grid-row: 1; }
  .article { padding: 24px; }
}
@media (max-width: 640px) {
  :root {
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-lg: 20px;
    --text-xl: 26px;
  }
}
@media (max-width: 520px) { .progress-stats { grid-template-columns: repeat(2, 1fr); } .modal-actions { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .view-switch button { padding: 6px 7px; font-size: var(--text-xs); }
  .top-actions { gap: 7px; }
  .icon-button { width: 31px; height: 31px; }
  .sidebar-top { grid-template-columns: minmax(0,1fr) 117px; }
  .search-wrap { gap: 5px; }
  .search-wrap input { font-size: var(--text-xs); }
  .search-wrap kbd { display: none; }
  .hero { padding: 24px 19px; }
  .proposal-card { padding: 15px; }
  .article { padding: 20px 18px; }
  .reader-tabs { gap: 18px; }
  .reader-tabs [role="tab"] span { display: none; }
  .code-head { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .code-tools { flex-wrap: wrap; }
  .meta-links { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Floating Challenge Button */
.floating-challenge {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 1000;
  background-color: var(--sheet);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  box-shadow: 0 4px 12px var(--shadow);
  font-size: 19px;
  font-weight: 700;
  font-family: var(--font-tc, "Noto Serif TC", serif);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.floating-challenge:hover {
  background-color: var(--soft);
  transform: scale(1.06);
}

/* Floating Theme Button */
.floating-theme {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  background-color: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  box-shadow: 0 4px 12px var(--shadow);
  font-size: 20px;
}
.floating-theme:hover {
  background-color: var(--soft);
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
  margin-top: 6px;
  margin-bottom: 24px;
  font-family: var(--font-ui);
}
.dropdown-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--text-sm);
  color: var(--ink);
  cursor: pointer;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 100;
  box-shadow: 0 4px 8px var(--shadow);
}
.custom-dropdown[aria-expanded="true"] .dropdown-menu {
  display: block;
}
.custom-dropdown[aria-expanded="true"] .dropdown-toggle {
  border-radius: 4px 4px 0 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--ink);
}
.dropdown-item:hover {
  background: var(--soft);
}
.dropdown-item input[type="checkbox"] {
  margin-right: 8px;
}
.section-divider {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reader-tabs [role="tab"] {
  cursor: pointer;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--sheet);
  display: flex;
  flex-direction: column;
}

.dropdown-actions {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.dropdown-actions button {
  background: transparent;
  border: none;
  font-size: var(--text-xs);
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}
.dropdown-actions button:hover {
  text-decoration: underline;
}

.mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5em 0;
  padding: 20px;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   Full-Screen Immersive Challenge Stage (iPlayground Style)
   ========================================================================== */

/* ── Visible Theme Scrollbars ── */
html {
  overflow-y: scroll;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(200, 241, 53, 0.65);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #c8f135;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 241, 53, 0.65) rgba(255, 255, 255, 0.08);
}

.challenge-stage-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 14% 72%, rgba(180, 230, 30, 0.18) 0%, transparent 46%),
    radial-gradient(ellipse at 72% 22%, rgba(200, 241, 53, 0.10) 0%, transparent 46%),
    radial-gradient(ellipse at 88% 78%, rgba(60, 60, 60, 0.35) 0%, transparent 36%),
    radial-gradient(ellipse at 40% 10%, rgba(150, 200, 20, 0.08) 0%, transparent 32%),
    #111111;
  color: #f0f0f0;
  font-family: var(--font-ui, "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif);
  color-scheme: dark;
}

body.challenge-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 14% 72%, rgba(180, 230, 30, 0.18) 0%, transparent 46%),
    radial-gradient(ellipse at 72% 22%, rgba(200, 241, 53, 0.10) 0%, transparent 46%),
    radial-gradient(ellipse at 88% 78%, rgba(60, 60, 60, 0.35) 0%, transparent 36%),
    radial-gradient(ellipse at 40% 10%, rgba(150, 200, 20, 0.08) 0%, transparent 32%),
    #111111;
  color: #f0f0f0;
  font-family: var(--font-ui, "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif);
  color-scheme: dark;
}

.challenge-stage-overlay[hidden] {
  display: none !important;
}

.challenge-stage-overlay::before,
.challenge-page::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, rgba(200, 241, 53, 0.35) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(180, 220, 30, 0.15) 0 1px, transparent 1.4px);
  background-position: 0 0, 36px 58px;
  background-size: 96px 96px, 132px 132px;
  opacity: 0.22;
}

.challenge-top-bar {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 2100;
  display: flex;
  align-items: center;
  gap: 12px;
}

.challenge-nav-bar {
  position: fixed;
  top: 18px;
  left: 20px;
  right: 20px;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.challenge-nav-bar > * {
  pointer-events: auto;
}

.challenge-home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.challenge-home-link:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #c8f135;
  color: #c8f135;
  transform: translateY(-1px);
}

.challenge-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.challenge-close-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, background 0.18s ease;
}

.challenge-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.music-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #c8f135;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.music-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.16);
}

.music-btn svg {
  width: 22px;
  height: 22px;
}

.music-btn .icon-off {
  display: none;
}

.music-btn.is-muted {
  color: #888888;
}

.music-btn.is-muted .icon-on {
  display: none;
}

.music-btn.is-muted .icon-off {
  display: block;
}

.challenge-app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: clamp(80px, 9vh, 96px) clamp(16px, 2.4vw, 32px) clamp(48px, 6vh, 64px);
}

.challenge-stage-overlay .stage,
.challenge-page .stage {
  width: min(1180px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.6vw, 22px);
}

.challenge-stage-overlay .quiz-stage,
.challenge-page .quiz-stage {
  min-height: auto;
  justify-content: flex-start;
}

/* ── Glass card shared ── */
.start-card,
.timer-card,
.progress-pill,
.question-card,
.result-card,
.challenge-scope-card {
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
}

.start-card {
  position: relative;
  width: min(860px, 100%);
  margin: auto;
  padding: clamp(36px, 6vw, 64px) clamp(24px, 4vw, 48px);
  border-radius: 32px;
  text-align: center;
}

.start-title {
  position: relative;
  margin: 0 0 16px;
  color: #ffffff;
  font-size: clamp(32px, 4.6vw, 60px);
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 18px 42px rgba(200, 241, 53, 0.18);
  animation: titleGlowGreen 0.9s ease-out 1400ms forwards;
}

@keyframes titleGlowGreen {
  from { text-shadow: 0 18px 42px rgba(200, 241, 53, 0.18); }
  to {
    text-shadow:
      0 0 8px rgba(200, 241, 53, 0.8),
      0 0 24px rgba(200, 241, 53, 0.6),
      0 0 60px rgba(200, 241, 53, 0.35),
      0 18px 42px rgba(200, 241, 53, 0.2);
  }
}

.start-copy {
  max-width: 680px;
  margin: 0 auto 30px;
  color: #aaaaaa;
  font-size: clamp(16px, 1.8vw, 22px);
  line-height: 1.55;
}

/* ── Scope Selection Card ── */
.challenge-scope-card {
  max-width: 660px;
  margin: 0 auto;
  padding: 24px 28px;
  border-radius: 24px;
  text-align: left;
  display: grid;
  gap: 18px;
}

.scope-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 14px;
}

.scope-label {
  font-size: 13px;
  font-weight: 700;
  color: #c8f135;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scope-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scope-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #dddddd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scope-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.scope-chip.active {
  background: #c8f135;
  border-color: #c8f135;
  color: #111111;
  font-weight: 750;
  box-shadow: 0 0 16px rgba(200, 241, 53, 0.4);
}

.scope-row-versions {
  grid-template-columns: 110px 1fr;
  align-items: flex-start;
}

.scope-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scope-actions {
  display: flex;
  gap: 4px;
}

.scope-action-btn {
  background: transparent;
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #aaaaaa;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scope-action-btn:hover {
  border-color: #c8f135;
  color: #c8f135;
}

.scope-summary {
  padding-top: 10px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: #888888;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.scope-summary strong {
  color: #c8f135;
  font-size: 16px;
}

/* ── Sparkle Button ── */
.sparkle-button {
  position: relative;
  display: inline-flex;
}

.nav-btn {
  --cut: 0.1em;
  --active: 0;
  --btn-bg:
    radial-gradient(
      40% 50% at center 100%,
      hsl(78 calc(var(--active) * 98%) 75% / var(--active)),
      transparent
    ),
    radial-gradient(
      80% 100% at center 120%,
      hsl(78 calc(var(--active) * 98%) 70% / var(--active)),
      transparent
    ),
    hsl(78 0% 16%);
  border: 0;
  cursor: pointer;
  padding: 0.85em 1.7em;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  position: relative;
  isolation: isolate;
  background: var(--btn-bg);
  box-shadow: 0 0 calc(var(--active) * 3em) -1em hsl(78 98% 65% / 0.8);
  transition: box-shadow 0.25s, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.nav-btn:hover:not(:disabled) {
  --active: 1;
  transform: translateY(-2px);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.primary-start-btn {
  font-size: 19px;
  padding: 0.9em 2.2em;
  --btn-bg: #c8f135;
  box-shadow: 0 0 28px rgba(200, 241, 53, 0.45);
}

.primary-start-btn .nav-text {
  color: #111111 !important;
  font-weight: 900;
}

.nav-spark {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  rotate: 0deg;
  overflow: hidden;
  -webkit-mask: linear-gradient(white, transparent 50%);
  mask: linear-gradient(white, transparent 50%);
  animation: nav-spark-rotate 2s linear infinite;
}

.nav-spark:after {
  content: "";
  position: absolute;
  inset: var(--cut);
  border-radius: 999px;
}

@keyframes nav-spark-rotate {
  to { rotate: 360deg; }
}

.nav-backdrop {
  position: absolute;
  inset: var(--cut);
  background: var(--btn-bg);
  border-radius: 999px;
  transition: background 0.25s;
}

.nav-text {
  letter-spacing: 0.02em;
  color: #ffffff;
  position: relative;
  z-index: 1;
}

.nav-particle-pen {
  position: absolute;
  width: 200%;
  aspect-ratio: 1;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  -webkit-mask: radial-gradient(white, transparent 65%);
  mask: radial-gradient(white, transparent 65%);
  z-index: -1;
  opacity: var(--active, 0);
  transition: opacity 0.25s;
  pointer-events: none;
}

.nav-particle {
  width: calc(var(--size, 0.25) * 1rem);
  aspect-ratio: 1;
  position: absolute;
  top: calc(var(--y) * 1%);
  left: calc(var(--x) * 1%);
  opacity: var(--alpha, 1);
  animation: nav-particle-float calc(var(--duration, 1) * 1s) calc(var(--delay) * -1s) infinite linear;
  transform-origin: var(--origin-x, 1000%) var(--origin-y, 1000%);
  z-index: -1;
}

.nav-particle path {
  fill: #c8f135;
}

@keyframes nav-particle-float {
  to { rotate: 360deg; }
}

/* ── Quiz Header ── */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.timer-card {
  --timer-progress: 0;
  --timer-progress-angle: 0deg;
  --timer-ring: rgba(200, 241, 53, 0.95);
  --timer-ring-fade: rgba(200, 241, 53, 0.45);
  --timer-ring-soft: rgba(200, 241, 53, 0.12);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 190px;
  padding: 12px 18px 14px;
  border-radius: 20px;
}

.timer-card::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  content: "";
  pointer-events: none;
  z-index: 0;
  padding: 2px;
  background:
    conic-gradient(
      from -90deg,
      var(--timer-ring) 0 calc(var(--timer-progress-angle) - 10deg),
      var(--timer-ring-fade) calc(var(--timer-progress-angle) - 3deg),
      var(--timer-ring-soft) calc(var(--timer-progress-angle) + 9deg) 1turn
    );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.timer-card > * {
  position: relative;
  z-index: 1;
}

.timer-label {
  color: #888888;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timer-value {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  font-family: var(--font-mono, monospace);
}

.flip-digit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: clamp(26px, 3.2vw, 42px);
  height: clamp(40px, 4.8vw, 56px);
  font-size: clamp(34px, 4vw, 50px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #f0f0f0;
  line-height: 1;
}

.flip-colon {
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 900;
  color: #f0f0f0;
  line-height: 1;
  margin-bottom: 2px;
}

.numeric-digit-current,
.numeric-digit-old,
.numeric-digit-new {
  display: block;
  font: inherit;
}

.numeric-digit-old,
.numeric-digit-new {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.numeric-digit-old {
  animation: numeric-text-old 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.numeric-digit-new {
  animation: numeric-text-new 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes numeric-text-old {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(50%); }
}

@keyframes numeric-text-new {
  0% { opacity: 0; transform: translateY(-50%); }
  100% { opacity: 1; transform: translateY(0); }
}

.timer-value.is-hot {
  color: #ff5f8d;
}

.timer-value.is-hot .flip-digit,
.timer-value.is-hot .flip-colon {
  color: #ff5f8d;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.nav-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 850;
  color: #ffffff;
}

.progress-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c8f135;
  box-shadow: 0 0 14px #c8f135;
}

/* ── Question Card ── */
.question-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: grid;
  gap: 14px;
  padding: clamp(20px, 2.6vw, 32px);
  border-radius: 26px;
  text-align: left;
}

.eyebrow {
  width: fit-content;
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  border: 0.5px solid rgba(200, 241, 53, 0.4);
  background: rgba(200, 241, 53, 0.12);
  color: #c8f135;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.eyebrow-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.18s ease;
}

.eyebrow-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.question-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.question-title code,
.result-question code {
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 0.88em;
  font-weight: 700;
  color: #c8f135;
  background: rgba(200, 241, 53, 0.12);
  border: 0.5px solid rgba(200, 241, 53, 0.4);
  border-radius: 6px;
  padding: 2px 7px;
  margin: 0 3px;
  display: inline-block;
  vertical-align: baseline;
  line-height: 1.3;
}

.question-title strong,
.result-question strong {
  color: #c8f135;
  font-weight: 850;
}

.code-block {
  width: 100%;
  margin: 0;
  padding: 14px 18px;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(10, 8, 16, 0.92);
  color: #ffffff;
  font-family: var(--font-mono, monospace);
  font-size: clamp(14px, 1.35vw, 18px);
  font-weight: 500;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overflow-x: auto;
}

.code-keyword { color: #c8f135; font-weight: 750; }
.code-string  { color: #ff8fa3; }
.code-type    { color: #79c0ff; }
.code-muted   { color: #888899; }

/* ── Choices Grid ── */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choice-tile {
  position: relative;
  overflow: hidden;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: #ffffff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.choice-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(200, 241, 53, 0.6);
  background: rgba(255, 255, 255, 0.09);
}

.choice-label {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
}

.choice-tile.choice-a .choice-label { background: linear-gradient(135deg, #2766d8, #2454bd); }
.choice-tile.choice-b .choice-label { background: linear-gradient(135deg, #389657, #2d7a46); }
.choice-tile.choice-c .choice-label { background: linear-gradient(135deg, #e09d21, #b57a12); }
.choice-tile.choice-d .choice-label { background: linear-gradient(135deg, #de416c, #ba2650); }

.choice-text {
  overflow-wrap: anywhere;
  font-size: clamp(15px, 1.45vw, 20px);
  font-weight: 700;
  line-height: 1.35;
}

.choice-state {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.choice-tile.correct {
  background: #c8f135 !important;
  border-color: #c8f135 !important;
  color: #111111 !important;
  box-shadow: 0 0 24px rgba(200, 241, 53, 0.5) !important;
}

.choice-tile.correct .choice-text {
  color: #111111;
}

.choice-tile.correct .choice-label {
  background: #111111;
  color: #ffffff;
}

.choice-tile.wrong {
  background: rgba(180, 40, 70, 0.35) !important;
  border-color: #ff5f8d !important;
}

/* ── Results Screen ── */
.result-shell {
  width: min(1000px, 100%);
  margin: 0 auto;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.result-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 900;
  letter-spacing: -0.02em;
}

.result-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(200, 241, 53, 0.15);
  border: 1px solid #c8f135;
  color: #c8f135;
  font-size: 20px;
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 18px;
}

.result-card {
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 22px;
  text-align: left;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: #aaaaaa;
  font-size: 14px;
  font-weight: 800;
}

.result-meta span:first-child {
  color: #c8f135;
}

.result-question {
  margin: 0 0 14px;
  color: #ffffff;
  font-size: clamp(16px, 1.7vw, 22px);
  font-weight: 800;
  line-height: 1.45;
}

.result-user-answer {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.result-user-answer.is-correct {
  color: #58ba70;
}

.result-user-answer.is-wrong {
  color: #ff5f8d;
}

.result-answer {
  margin: 0 0 10px;
  color: #c8f135;
  font-size: clamp(16px, 1.7vw, 21px);
  font-weight: 900;
}

.result-user-answer code,
.result-answer code,
.result-reason code {
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 0.88em;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 7px;
  margin: 0 3px;
  display: inline-block;
  vertical-align: baseline;
  line-height: 1.3;
}

.result-answer code {
  color: #c8f135;
  background: rgba(200, 241, 53, 0.14);
  border: 0.5px solid rgba(200, 241, 53, 0.45);
}

.result-user-answer.is-wrong code {
  color: #ff5f8d;
  background: rgba(255, 95, 141, 0.14);
  border: 0.5px solid rgba(255, 95, 141, 0.45);
}

.result-user-answer.is-correct code {
  color: #58ba70;
  background: rgba(88, 186, 112, 0.14);
  border: 0.5px solid rgba(88, 186, 112, 0.45);
}

.result-reason code {
  color: #c8f135;
  background: rgba(200, 241, 53, 0.12);
  border: 0.5px solid rgba(200, 241, 53, 0.4);
}

/* ── Result Reason & Quiz Reason: Card-style List ── */
.result-reason,
.quiz-reason {
  margin: 0 0 16px;
  color: #d0d0d0;
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.7;
}

.result-reason p,
.quiz-reason p {
  margin: 0 0 10px;
}

.result-reason p:last-child,
.quiz-reason p:last-child {
  margin-bottom: 0;
}

/* 清單外層容器重置 */
.result-reason ol,
.result-reason ul,
.quiz-reason ol,
.quiz-reason ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 條列項目：清單式排版 */
.result-reason li,
.quiz-reason li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 0;
  line-height: 1.65;
  color: #e0e0e0;
}

/* 有序清單：自訂計數器與青檸綠序號徽章 */
.result-reason ol,
.quiz-reason ol {
  counter-reset: reason-counter;
}

.result-reason ol > li,
.quiz-reason ol > li {
  counter-increment: reason-counter;
}

.result-reason ol > li::before,
.quiz-reason ol > li::before {
  content: counter(reason-counter);
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 6px;
  background: rgba(200, 241, 53, 0.18);
  border: 0.5px solid rgba(200, 241, 53, 0.5);
  color: #c8f135;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

/* 無序清單：青檸綠引導圓點 */
.result-reason ul > li::before,
.quiz-reason ul > li::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: 9px;
  border-radius: 50%;
  background: #c8f135;
  box-shadow: 0 0 8px rgba(200, 241, 53, 0.6);
}

/* 清單內部 code 與 strong */
.result-reason li code,
.quiz-reason li code {
  color: #c8f135;
  background: rgba(200, 241, 53, 0.12);
  border: 0.5px solid rgba(200, 241, 53, 0.4);
  border-radius: 6px;
  padding: 1px 6px;
  margin: 0 2px;
  font-family: var(--font-mono, monospace);
  font-size: 0.88em;
}

.result-reason li strong,
.quiz-reason li strong {
  color: #ffffff;
  font-weight: 750;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  border: 0.5px solid rgba(200, 241, 53, 0.4);
  background: rgba(200, 241, 53, 0.1);
  color: #ffffff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: all 0.15s ease;
}

.result-link:hover {
  background: rgba(200, 241, 53, 0.22);
  border-color: #c8f135;
  color: #c8f135;
  transform: translateY(-1px);
}

.result-meta-link,
.result-meta-title-link {
  color: #c8f135;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.result-meta-link:hover,
.result-meta-title-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ── Toast in Stage ── */
.challenge-stage-overlay .toast {
  position: fixed;
  z-index: 2200;
  left: 50%;
  bottom: 30px;
  max-width: min(800px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  padding: 14px 28px;
  border: 0.5px solid rgba(200, 241, 53, 0.35);
  border-radius: 999px;
  background: rgba(18, 20, 14, 0.94);
  color: #ffffff;
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.challenge-stage-overlay .toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Letter pull up animation ── */
.title-star {
  display: inline-block;
  margin-left: 0.25em;
  color: #ffd000;
  vertical-align: middle;
  opacity: 0;
  animation: letterPullUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) 1000ms forwards;
}

.title-star svg {
  height: 0.65em;
  width: auto;
}

.spark-1 { transform-origin: 24px 26px; animation: starTwinkle 2.8s ease-in-out 1.8s infinite; }
.spark-2 { transform-origin: 40px 54px; animation: starTwinkle 2.8s ease-in-out 2.9s infinite; }
.spark-3 { transform-origin: 72px 40px; animation: starTwinkle 2.8s ease-in-out 1.2s infinite; }

@keyframes starTwinkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  30% { transform: scale(0.3); opacity: 0.1; }
  55% { transform: scale(1.25); opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 210, 0, 0.9)); }
  72% { transform: scale(0.95); opacity: 0.95; }
  84% { transform: scale(1.06); opacity: 1; }
}

.letter-up {
  display: inline-block;
  opacity: 0;
  animation: letterPullUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes letterPullUp {
  from { transform: translateY(50%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Responsive adjustments ── */
@media (max-width: 780px) {
  .choices-grid {
    grid-template-columns: 1fr;
  }
  .quiz-header {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-buttons {
    justify-content: center;
  }
  .scope-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .scope-label-wrap {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}



/* ─────────────────────────────────────────────────────────────
   Learning Plan & Onboarding Styles
   ───────────────────────────────────────────────────────────── */

/* Floating Plan Button */
.floating-plan {
  position: fixed;
  bottom: 204px;
  right: 24px;
  z-index: 1000;
  background-color: var(--sheet);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  box-shadow: 0 4px 14px var(--shadow);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background-color 0.2s;
}
.floating-plan:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.06);
}

/* Sidebar Links */
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.sidebar-plan-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 10px;
  background: var(--accent-wash);
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: filter 0.15s;
}
.sidebar-plan-link:hover {
  filter: brightness(0.95);
}

/* ─── Onboarding Page ─── */
.onboarding-page {
  max-width: 860px;
  margin: 32px auto 80px;
  padding: 0 16px;
}
.onboarding-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 40px;
  box-shadow: var(--shadow);
}
.onboarding-header {
  margin-bottom: 32px;
}
.onboarding-kicker {
  font: var(--text-xs) var(--font-mono);
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}
.onboarding-header h1 {
  font: 600 var(--text-xl)/1.25 var(--font-serif);
  margin: 0 0 12px;
}
.onboarding-deck {
  color: var(--muted);
  font-size: var(--text-base);
  margin: 0;
  max-width: 680px;
}
.preset-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.preset-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  display: flex;
  flex-direction: column;
}
.preset-card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
}
.preset-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}
.preset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.preset-title {
  margin: 0;
  font: 600 var(--text-base) var(--font-sans);
  color: var(--ink);
}
.preset-tag {
  font: var(--text-xs) var(--font-mono);
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--soft);
  color: var(--muted);
}
.preset-tag-recommended {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.preset-desc {
  font-size: var(--text-sm);
  color: var(--ink);
  margin: 0 0 14px;
  line-height: 1.5;
  flex-grow: 1;
}
.preset-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.preset-detail-item {
  font-size: var(--text-xs);
  color: var(--muted);
}
.preset-card.is-selected .preset-detail-item {
  color: var(--ink);
}
.onboarding-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.onboarding-submit {
  padding: 12px 24px;
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: 6px;
}
.onboarding-skip-link {
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.onboarding-skip-link:hover {
  color: var(--ink);
}

/* ─── Plan Page ─── */
.plan-page {
  max-width: 960px;
  margin: 24px auto 120px;
  padding: 0 16px;
}
.plan-header {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.plan-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.plan-kicker {
  font: var(--text-xs) var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.plan-header h1 {
  font: 600 var(--text-xl)/1.2 var(--font-serif);
  margin: 0;
}
.plan-rechoose-preset {
  font-size: var(--text-xs);
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  white-space: nowrap;
}
.plan-rechoose-preset:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.plan-deck {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 0 0 20px;
}
.plan-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--paper);
  border-radius: 6px;
  border: 1px solid var(--line);
}
.plan-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.plan-metric .metric-num {
  font: 700 var(--text-xl) var(--font-mono);
  color: var(--ink);
  line-height: 1;
}
.plan-metric .metric-label {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 6px;
}
.plan-metric.metric-unread .metric-num { color: var(--accent); }
.plan-metric.metric-skipped .metric-num { color: var(--muted); }
.plan-metric.metric-learned .metric-num { color: var(--green); }

.plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plan-search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}
.plan-search-wrap span {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}
.plan-search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--text-sm);
  color: var(--ink);
}
.plan-search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}
.plan-view-controls {
  display: flex;
  gap: 6px;
}
.btn-plan-tool {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-size: var(--text-xs);
  border-radius: 4px;
  color: var(--muted);
}
.btn-plan-tool:hover {
  color: var(--ink);
  border-color: var(--muted);
}

/* ─── Plan Accordion Groups ─── */
.plan-groups-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.plan-group {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px #0001;
}
.plan-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px;
  user-select: none;
}
.plan-group.is-collapsed .plan-group-header {
  border-bottom: 0;
}
.plan-group-title-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  flex: 1;
}
.group-arrow {
  font-size: var(--text-xs);
  color: var(--muted);
  width: 16px;
}
.group-title-text {
  font: 600 var(--text-base) var(--font-sans);
}
.group-total-count {
  font-size: var(--text-xs);
  color: var(--muted);
}
.group-counts {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}
.count-badge {
  font: var(--text-xs) var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.count-unread { background: var(--sheet); color: var(--accent); }
.count-skipped { background: var(--soft); color: var(--muted); }
.count-learned { background: var(--sheet); color: var(--green); }

.plan-group-actions {
  display: flex;
  gap: 6px;
}
.btn-group-action {
  font-size: var(--text-xs);
  padding: 4px 8px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
}
.btn-group-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.plan-group-body {
  padding: 4px 0;
}
.plan-empty-filter {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ─── Plan Item Row ─── */
.plan-item {
  display: grid;
  grid-template-columns: 24px 72px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  transition: background 0.15s ease;
}
.plan-item:last-child {
  border-bottom: none;
}
.plan-item:hover {
  background: color-mix(in srgb, var(--paper) 60%, var(--sheet));
}
.plan-item.status-is-skipped {
  opacity: 0.65;
}
.plan-item-checkbox-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.plan-item-checkbox-wrap input {
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.plan-item-id {
  font: 500 var(--text-xs) var(--font-mono);
  color: var(--muted);
}
.plan-item-main {
  min-width: 0;
}
.plan-item-title {
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-item-title:hover {
  color: var(--accent);
  text-decoration: underline;
}
.plan-version-badge {
  font: var(--text-xs) var(--font-mono);
  color: var(--muted);
  background: var(--soft);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ─── Plan Status Pill Button ─── */
.plan-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 4px;
  font: var(--text-xs) var(--font-mono);
  border: 1px solid var(--line);
  background: var(--sheet);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.plan-status-pill .pill-mark {
  font-weight: 700;
}
.plan-status-pill.status-unread {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--sheet);
}
.plan-status-pill.status-unread:hover {
  background: var(--accent-wash);
}
.plan-status-pill.status-skipped {
  color: var(--muted);
  border-color: var(--line);
  background: var(--soft);
}
.plan-status-pill.status-skipped:hover {
  filter: brightness(0.95);
}
.plan-status-pill.status-learned {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  background: var(--sheet);
}
.plan-status-pill.status-learned:hover {
  background: color-mix(in srgb, var(--green) 15%, var(--sheet));
}

/* ─── Floating Batch Action Bar ─── */
.plan-batch-bar {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sheet);
  border: 1px solid var(--accent);
  border-radius: 30px;
  box-shadow: 0 12px 36px #0004;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1001;
  animation: batchSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes batchSlideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.batch-bar-count {
  font-size: var(--text-sm);
  color: var(--ink);
}
.batch-bar-count strong {
  color: var(--accent);
}
.batch-bar-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-batch {
  padding: 6px 12px;
  font-size: var(--text-xs);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-weight: 500;
}
.btn-batch:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-batch-clear {
  padding: 6px 12px;
  font-size: var(--text-xs);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}
.btn-batch-clear:hover {
  color: var(--ink);
}

/* ─── Sticky Footer Confirmation Bar ─── */
.plan-sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sheet);
  border-top: 1px solid var(--line);
  padding: 12px 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 990;
  box-shadow: 0 -4px 16px #0001;
}
.plan-footer-info {
  font-size: var(--text-sm);
  color: var(--ink);
}
.plan-footer-info strong {
  color: var(--accent);
}
.btn-plan-confirm {
  padding: 10px 22px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: 6px;
}

/* Responsive adjustments for Plan & Onboarding */
@media (max-width: 780px) {
  .preset-cards {
    grid-template-columns: 1fr;
  }
  .plan-summary-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .plan-item {
    grid-template-columns: 20px 60px 1fr auto;
  }
  .plan-version-badge {
    display: none;
  }
  .plan-batch-bar {
    flex-direction: column;
    width: calc(100% - 32px);
    border-radius: 12px;
    gap: 8px;
    bottom: 96px;
  }
  .floating-plan {
    bottom: 204px;
  }
}
