:root {
  --font-scale: 1;
  --bg: #0e1820;
  --surface: #162632;
  --surface-2: #1d303d;
  --text: #f3ead6;
  --muted: #b8b3a6;
  --line: #40505a;
  --gold: #c9a869;
  --red: #a3433f;
  --red-bright: #cf6259;
  --blue: #173a56;
  --paper: #eadfca;
  --ink: #18232a;
  --shadow: 0 22px 55px rgba(0,0,0,.22);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ece3d1; --surface: #f8f1e4; --surface-2: #fffaf0; --text: #202b31;
  --muted: #645f55; --line: #c8b999; --gold: #886d37; --red: #8d332f;
  --red-bright: #9c3f38; --blue: #d7e0df; --paper: #f8f1e4; --ink: #17242b;
  --shadow: 0 22px 55px rgba(70,50,25,.13); color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: calc(16px * var(--font-scale)); }
body { margin: 0; min-width: 0; overflow-x: hidden; background:
  radial-gradient(circle at 12% 0%, rgba(201,168,105,.1), transparent 28rem),
  linear-gradient(120deg, transparent 0 49.6%, rgba(201,168,105,.035) 50%, transparent 50.4%) 0 0/32px 32px,
  var(--bg); color: var(--text); font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.7; }
a { color: inherit; }
button, input, select { font: inherit; }
.site-header { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; gap: 28px; padding: 10px max(24px, calc((100vw - 1180px)/2)); background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(15px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand > span:last-child { display: grid; line-height: 1.2; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; }
.seal { width: 40px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--red-bright); color: var(--paper); background: var(--red); font-family: serif; font-size: 1.35rem; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--red) 70%, black); }
.main-nav { display: flex; gap: 22px; margin-left: auto; }
.main-nav a { text-decoration: none; color: var(--muted); font-size: .9rem; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--gold); }
.display-controls { display: flex; gap: 5px; }
.display-controls button, .nav-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 5px; min-width: 38px; min-height: 38px; cursor: pointer; }
.nav-toggle { display: none; margin-left: auto; }
main { width: min(1180px, calc(100% - 40px)); margin: auto; }
.hero { min-height: 650px; display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(40px, 7vw, 100px); align-items: center; padding: 72px 0 54px; }
.eyebrow, .kicker { color: var(--gold); font-weight: 700; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: "Noto Serif TC", "PMingLiU", serif; }
.hero h1 { margin: 12px 0 24px; font-size: clamp(3rem, 7vw, 6.4rem); line-height: .98; letter-spacing: -.04em; }
.hero h1 span { color: var(--gold); font-size: .68em; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 660px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 8px 18px; border: 1px solid var(--gold); border-radius: 4px; color: var(--gold); background: transparent; text-decoration: none; cursor: pointer; }
.button:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.button.primary { color: #fff8e8; background: var(--red); border-color: var(--red-bright); }
.button.small { min-height: 38px; padding: 6px 12px; font-size: .86rem; }
.placeholder { border: 1px solid var(--gold); background:
  linear-gradient(45deg, transparent 48%, color-mix(in srgb, var(--gold) 25%, transparent) 49% 51%, transparent 52%),
  linear-gradient(-45deg, transparent 48%, color-mix(in srgb, var(--gold) 25%, transparent) 49% 51%, transparent 52%),
  var(--surface); background-size: 30px 30px; color: var(--gold); }
.hero-art { min-height: 440px; display: grid; align-content: center; justify-items: center; text-align: center; box-shadow: 18px 18px 0 color-mix(in srgb, var(--red) 35%, transparent); }
.hero-art strong { font-family: serif; font-size: 2rem; margin: 12px; }
.hero-art small { color: var(--muted); }
.route-map-art { margin: 0; min-width: 0; padding: 12px; border: 1px solid var(--gold); background: var(--surface); }
.route-map-art img { width: 100%; height: auto; display: block; min-width: 0; }
.route-map-art figcaption { padding: 10px 8px 2px; color: var(--muted); font-size: .78rem; letter-spacing: .05em; }
.search-panel { margin: 20px 0 50px; padding: clamp(24px, 5vw, 50px); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.search-panel > label { display: block; margin-bottom: 12px; color: var(--gold); font-family: serif; font-size: 1.4rem; font-weight: 700; }
.search-box { display: flex; gap: 10px; }
.search-box input { min-width: 0; flex: 1; min-height: 52px; padding: 10px 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.search-results:not(:empty) { margin-top: 28px; }
.search-result { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 20px 0; border-top: 1px solid var(--line); }
.search-result h3, .search-result p { margin: 4px 0; }
mark { background: var(--gold); color: var(--ink); padding: 0 .12em; }
.latest-videos { margin: 0 0 50px; }
.latest-update { margin: 0 0 50px; padding: clamp(22px, 4vw, 34px); background: linear-gradient(120deg, color-mix(in srgb, var(--surface) 92%, var(--blue)), var(--surface)); border: 1px solid var(--line); }
.update-version { color: var(--gold); border-color: var(--gold); font-size: .9rem; }
.update-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.update-grid article { min-width: 0; padding: 18px; border-left: 3px solid var(--red-bright); background: color-mix(in srgb, var(--bg) 45%, transparent); }
.update-grid strong, .update-grid span { display: block; overflow-wrap: anywhere; }
.update-grid strong { color: var(--gold); font-family: serif; font-size: clamp(1.15rem, 2.2vw, 1.65rem); }
.update-grid span { color: var(--muted); font-size: .8rem; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 18px; }
.section-heading h2 { margin: 3px 0 0; font-size: 2rem; }
.video-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.video-card { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.video-thumbnail { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.video-thumbnail img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .2s ease; }
.video-thumbnail:hover img { transform: scale(1.02); }
.video-duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 3px; color: #fff; background: rgba(0,0,0,.82); font-size: .78rem; font-weight: 700; }
.video-card-body { display: grid; align-content: start; gap: 14px; padding: 20px; }
.video-card-body h3 { margin: 0; font-family: inherit; font-size: 1rem; line-height: 1.55; }
.video-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: .78rem; }
.tag.episode { color: var(--gold); border-color: var(--gold); }
.video-summary p { margin: 0; color: var(--muted); font-size: .9rem; }
.video-summary p + p { margin-top: 8px; }
.video-stage-links { display: flex; flex-wrap: wrap; gap: 6px; }
.video-stage-links a { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--gold); font-size: .75rem; text-decoration: none; }
.video-card-body > .button { justify-self: start; }
.video-grid-full .video-card-body { min-height: 100%; }
.tag { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; }
.tag.branch { color: #fff; border-color: var(--red-bright); background: var(--red); margin-left: 6px; }
.tag.pending { margin-top: 10px; }
.dashboard-grid { display: grid; grid-template-columns: .8fr 1.4fr .8fr; gap: 18px; margin-bottom: 90px; }
.panel, .prose-card { padding: 28px; background: var(--surface); border: 1px solid var(--line); }
.compact-list { margin: 0; padding-left: 1.4rem; }
.compact-list li + li { margin-top: 8px; }
.progress-panel { text-align: center; }
.progress-ring { --progress: 0deg; width: 130px; margin: 22px auto; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--red-bright) var(--progress), var(--line) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.progress-ring span { z-index: 1; font-size: 1.6rem; font-weight: 800; }
.text-link { color: var(--gold); text-underline-offset: 4px; }
.signature { margin-top: 28px; color: var(--gold); font-family: serif; font-size: 1.2rem; }
.page-shell { padding: 64px 0 100px; }
.page-shell.narrow { max-width: 820px; }
.page-heading { padding-bottom: 35px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.page-heading h1 { margin: 5px 0; font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1.1; }
.page-heading p:last-child { color: var(--muted); }
.filter-bar, .anchor-nav { position: sticky; top: 72px; z-index: 10; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 15px 18px; margin-bottom: 24px; background: var(--surface); border: 1px solid var(--line); }
.filter-bar label { cursor: pointer; }
.text-button { margin-left: auto; border: 0; background: none; color: var(--gold); cursor: pointer; text-decoration: underline; }
.chapter-list { display: grid; gap: 18px; }
.chapter-block { background: var(--surface); border: 1px solid var(--line); }
.chapter-block > summary { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px; cursor: pointer; color: var(--gold); font-family: serif; font-size: 1.5rem; }
.chapter-block > summary small { font: .75rem sans-serif; color: var(--muted); }
.act-block { padding: 0 26px 30px; }
.act-block h3 { margin: 20px 0 12px; padding-left: 12px; border-left: 3px solid var(--red-bright); }
.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stage-card { min-width: 0; padding: 20px; background: var(--surface-2); border: 1px solid var(--line); }
.stage-card h4 { margin: 10px 0 5px; font-size: 1.05rem; }
.stage-card p { color: var(--muted); margin: 0; font-size: .85rem; }
.stage-no { color: var(--gold); font-size: .75rem; }
.stage-card-actions { display: grid; gap: 16px; margin-top: 20px; }
.status-control { display: grid; gap: 5px; color: var(--muted); font-size: .75rem; }
.status-control select { min-width: 0; padding: 6px 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); margin-bottom: 25px; font-size: .85rem; }
.stage-hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; padding: 34px 0; border-block: 1px solid var(--line); }
.stage-number { margin: 0; color: var(--gold); }
.stage-hero h1 { margin: 5px 0 0; font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 1; }
.stage-meta { min-width: 190px; padding: 20px; background: var(--surface); border-left: 3px solid var(--red); display: grid; gap: 5px; }
.stage-meta > span { color: var(--muted); font-size: .75rem; }
.stage-meta > strong { margin-bottom: 10px; font-size: 1.1rem; }
.warning { margin: 24px 0; padding: 22px; border: 1px solid #d6a840; background: color-mix(in srgb, #d6a840 12%, var(--surface)); color: var(--text); }
.warning strong { color: #e7bb50; }
.stage-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; margin-top: 28px; }
.content-block { margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); }
.content-block > summary { padding: 17px 20px; cursor: pointer; color: var(--gold); font-weight: 700; }
.content-block dl { margin: 0; padding: 0 20px 20px; }
.related-video-list { padding: 0 20px 20px; }
.related-video-list article { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.related-video-list img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.related-video-list h3 { margin: 8px 0 0; font-size: 1.05rem; }
.related-video-list p { margin: 2px 0 12px; color: var(--muted); font-size: .85rem; }
.info-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.info-row dt { color: var(--muted); font-size: .82rem; }
.info-row dd { margin: 0; }
.info-row p { margin: 0 0 5px; }
.portrait { min-height: 240px; display: grid; place-content: center; text-align: center; }
.portrait small { color: var(--muted); }
.source-note { margin-top: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); font-size: .82rem; }
.source-note summary { color: var(--gold); cursor: pointer; }
.source-note pre { max-height: 400px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.stage-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; margin-top: 35px; }
.stage-nav > div { display: grid; gap: 8px; justify-items: end; }
.route-map { display: grid; gap: 14px; }
.route-card { display: grid; grid-template-columns: 68px 1fr; gap: 22px; padding: 25px; background: var(--surface); border: 1px solid var(--line); position: relative; }
.route-card:not(:last-child)::after { content: "↓"; position: absolute; bottom: -22px; left: 43px; z-index: 1; color: var(--gold); }
.route-index { display: grid; place-items: center; width: 52px; height: 52px; color: var(--paper); background: var(--red); font-weight: 800; }
.route-card h2 { margin: 0; font-size: 1.25rem; }
.route-card p { margin: 6px 0 0; color: var(--muted); }
.route-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--gold); font-size: .85rem; }
.anchor-nav a { color: var(--gold); }
.appendix-section { padding: 30px 0; scroll-margin-top: 150px; }
.appendix-section > h2 { font-size: 2rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); }
.mini-card h3 { margin-top: 0; color: var(--gold); }
.mini-card p { margin-bottom: 0; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--gold); background: var(--surface-2); }
.ranking-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 35px; }
.ranking-list span { display: flex; gap: 10px; padding: 10px; background: var(--surface); border: 1px solid var(--line); }
.ranking-list b { color: var(--gold); min-width: 2em; }
.prose-card h2 { margin-top: 38px; color: var(--gold); }
.prose-card h2:first-child { margin-top: 0; }
.contact-intro { max-width: 760px; color: var(--muted); }
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.contact-card { display: grid; gap: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--line); }
.contact-card h2 { margin: 0; color: var(--gold); font-size: 1.3rem; }
.contact-card p { margin: 0; color: var(--muted); }
.contact-card .button { justify-self: start; }
.facts { display: grid; grid-template-columns: 120px 1fr; }
.facts dt, .facts dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px max(24px, calc((100vw - 1180px)/2)); color: var(--muted); border-top: 1px solid var(--line); font-size: .8rem; }
#back-to-top { position: fixed; right: 18px; bottom: 18px; width: 44px; height: 44px; border: 1px solid var(--gold); border-radius: 50%; background: var(--surface); color: var(--gold); opacity: 0; pointer-events: none; transition: opacity .2s; }
#back-to-top.visible { opacity: 1; pointer-events: auto; }
.empty-state, .loading, .fatal { padding: 30px; text-align: center; color: var(--muted); }
.search-empty { display: grid; justify-items: center; gap: 6px; border: 1px dashed var(--line); }
.search-empty p { margin: 0; }
@media print {
  .site-header, .site-footer, #back-to-top, .stage-nav, .status-control, .filter-bar { display: none !important; }
  :root { --bg: white; --surface: white; --surface-2: white; --text: black; --muted: #444; --line: #bbb; --gold: #6a4f22; color-scheme: light; }
  body { background: white; } main { width: 100%; } details { break-inside: avoid; } details > * { display: block !important; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; } .hero-art { min-height: 280px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; } .dashboard-grid .panel:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .stage-grid, .card-grid, .video-grid, .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .update-grid { grid-template-columns: repeat(2, 1fr); }
  .stage-layout { grid-template-columns: 1fr; } .stage-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .source-note { margin-top: 0; } .ranking-list { grid-template-columns: repeat(3, 1fr); }
  .main-nav { position: fixed; inset: 72px 0 auto; display: none; padding: 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .nav-open .main-nav { display: grid; } .nav-toggle { display: block; }
}
@media (max-width: 620px) {
  main { width: min(100% - 24px, 1180px); } .site-header { padding-inline: 12px; gap: 8px; }
  .brand small { display: none; } .brand > span:last-child strong { font-size: .85rem; }
  .display-controls button { min-width: 34px; padding: 2px; font-size: .75rem; }
  .hero { padding-top: 44px; } .hero h1 { font-size: clamp(2.6rem, 15vw, 4.5rem); }
  .button-row .button { flex: 1 1 46%; } .search-box { flex-direction: column; }
  .dashboard-grid, .stage-grid, .card-grid, .stage-sidebar, .video-grid, .contact-grid, .update-grid { grid-template-columns: 1fr; }
  .route-map-art { padding: 7px; box-shadow: 10px 10px 0 color-mix(in srgb, var(--red) 28%, transparent); }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .related-video-list article { grid-template-columns: 1fr; }
  .dashboard-grid .panel:nth-child(2) { grid-column: auto; order: initial; }
  .filter-bar { top: 68px; gap: 10px; } .filter-bar label { flex-basis: 100%; }
  .text-button { margin-left: 0; } .chapter-block > summary { padding: 18px; }
  .act-block { padding-inline: 14px; } .stage-hero { grid-template-columns: 1fr; }
  .info-row { grid-template-columns: 1fr; gap: 5px; } .stage-nav { grid-template-columns: 1fr; }
  .stage-nav .button, .stage-nav > div { width: 100%; } .stage-nav > div { justify-items: stretch; }
  .route-card { grid-template-columns: 46px 1fr; padding: 18px 14px; gap: 12px; }
  .route-index { width: 42px; height: 42px; } .route-card:not(:last-child)::after { left: 28px; }
  .ranking-list { grid-template-columns: repeat(2, 1fr); } .search-result { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; } .facts { grid-template-columns: 1fr; } .facts dt { border-bottom: 0; padding-bottom: 0; }
}
