:root {
  /* 默认：宣纸色的明亮主题 */
  --bg: #f6eedc;
  --surface: #fffaf0;
  --surface2: #f2e7cf;
  --ink: #2b1d12;
  --muted: #7a6450;
  --line: #e2d1af;
  --seal: #c0392b;
  --gold: #a8681a;
  --amber: linear-gradient(135deg, #f2c46b, #d9822b);
  --ok: #2e8b57;
  --top-bg: rgba(255, 250, 240, .92);
  --track: rgba(255, 250, 240, .75);
  --card-m: #5e4a38;
  --seal-bg: rgba(255, 255, 255, .7);
  --glow: rgba(217, 130, 43, .25);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --kai: "KaiTi", "STKaiti", "Kaiti SC", "Noto Serif SC", serif;
  --shadow: 0 8px 28px rgba(110, 70, 30, .16);
}
/* 深色：皮影戏台、成语星系始终是深色；整站也可以切到夜间 */
.dark, :root[data-theme="dark"] {
  --bg: #140c07;
  --surface: #1f140c;
  --surface2: #2a1b10;
  --ink: #f6e7cc;
  --muted: #b39a7a;
  --line: #4a3020;
  --seal: #c8352a;
  --gold: #e7b660;
  --ok: #3fa877;
  --top-bg: rgba(26, 15, 8, .9);
  --track: rgba(27, 23, 19, .6);
  --card-m: #cbbfa9;
  --seal-bg: rgba(0, 0, 0, .25);
  --glow: rgba(242, 170, 80, .35);
  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.dark { background: var(--bg); color: var(--ink); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% -20%, var(--glow), transparent 60%), radial-gradient(ellipse at 90% 110%, rgba(200, 53, 42, .08), transparent 50%);
  font-size: 17px;
  color: var(--ink); font-family: var(--serif);
  display: flex; flex-direction: column;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* —— 顶栏 —— */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--top-bg); backdrop-filter: blur(8px);
  position: relative; z-index: 5;
}
/* 顶栏下沿：一排皮影雕花似的镂空圆点 */
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 6px; pointer-events: none;
  background: radial-gradient(circle, #8a5a2a 2px, transparent 2.5px) 0 0 / 22px 6px repeat-x;
  opacity: .7;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; background: var(--seal); color: #fff6ea; border-radius: 6px;
  font-family: var(--kai); font-size: 16px; line-height: 18px; display: grid; place-items: center; text-align: center;
  transform: rotate(-4deg); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25), 0 0 24px rgba(210, 60, 44, .4);
}
h1 { margin: 0; font-family: var(--kai); font-size: 23px; letter-spacing: .14em; }
.sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; background: var(--surface); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 7px 18px; border-radius: 999px; font-size: 16px; color: var(--muted); white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--amber); color: #2a1406; font-weight: 600; box-shadow: 0 0 14px var(--glow); }
.top-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.theme-btn:hover { color: var(--ink); border-color: var(--gold); }

main { flex: 1; position: relative; min-height: 0; }
.tab { display: none; height: 100%; overflow: auto; }
.tab.on { display: block; }
#tab-graph, #tab-theater { overflow: hidden; }

/* —— 皮影戏台 —— */
.theater { display: flex; height: 100%; }
.th-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #120a05; }
.th-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.stamp { animation: stamp .6s cubic-bezier(.2, 1.6, .4, 1) both; display: inline-block; }
@keyframes stamp { from { transform: scale(3) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }

.th-list { width: 250px; flex: none; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); padding: 14px 12px; }
.th-list h3 { margin: 4px 6px 12px; font-size: 13px; letter-spacing: .25em; color: var(--muted); font-weight: 500; }
.th-item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 10px;
  border: 1px solid transparent; background: none; margin-bottom: 6px; transition: background .2s;
}
.th-item:hover { background: var(--surface2); }
.th-item.on { background: var(--surface2); border-color: var(--gold); box-shadow: inset 0 0 18px rgba(242, 170, 80, .12); }
.th-item .t { font-family: var(--kai); font-size: 19px; letter-spacing: .1em; }
.th-item .p { font-size: 12px; color: var(--muted); }

/* —— 字源 —— */
.hz { display: flex; height: 100%; }
.hz-list { width: 260px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 14px 12px 30px; }
.hz-list h3 { margin: 14px 6px 8px; font-size: 13px; letter-spacing: .25em; color: var(--muted); font-weight: 500; }
.hz-list h3:first-child { margin-top: 4px; }
.hz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hz-item { position: relative; border: 1px solid transparent; background: none; border-radius: 10px; padding: 4px 2px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hz-item:hover { background: var(--surface2); }
.hz-item.on { border-color: var(--gold); background: var(--surface2); box-shadow: inset 0 0 14px rgba(242, 170, 80, .14); }
.hz-item .hz-card { width: 46px; height: 46px; padding: 5px; border-radius: 6px; }
.hz-item b { font-family: var(--kai); font-size: 15px; font-weight: 400; line-height: 1; }
.hz-item i { position: absolute; top: 1px; right: 3px; font-style: normal; font-size: 10px; color: var(--gold); }
.hz-main { flex: 1; min-width: 0; overflow-y: auto; padding: 26px 30px 50px; }
.hz-top { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; max-width: 1000px; }
.hz-big { width: min(300px, 72vw); flex: none; }
.hz-big .hz-card { width: 100%; aspect-ratio: 1; padding: 13%; border-radius: 16px; box-shadow: var(--shadow), 0 0 60px -10px rgba(242, 170, 80, .35); }
.hz-big .cap { margin-top: 10px; text-align: center; color: var(--muted); font-size: 14px; }
.hz-big .cap b { color: var(--gold); font-family: var(--kai); font-size: 20px; letter-spacing: .2em; margin-right: 8px; font-weight: 400; }
.hz-info { flex: 1; min-width: 260px; }
.hz-info .ch { font-family: var(--kai); font-size: 64px; line-height: 1; display: flex; align-items: baseline; gap: 14px; }
.hz-info .ch small { font-family: var(--serif); font-size: 20px; color: var(--muted); }
.hz-info .ch .trad { font-size: 22px; color: var(--muted); font-family: var(--serif); }
.hz-info .tags { display: flex; gap: 6px; margin: 12px 0 14px; flex-wrap: wrap; }
.hz-info .tags span { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.hz-info p { font-size: 18px; line-height: 1.9; margin: 0 0 16px; }
.hz-info .row { display: flex; gap: 8px; flex-wrap: wrap; }
.hz-rail { display: flex; gap: 6px; margin: 28px 0 8px; overflow-x: auto; padding: 4px 2px 10px; max-width: 1000px; }
.hz-step { flex: 1 0 104px; border: 0; background: none; padding: 6px 4px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.hz-step:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 38px; color: var(--line); font-size: 16px; }
.hz-step .hz-card { width: 72px; height: 72px; padding: 8px; border-radius: 8px; opacity: .55; transition: opacity .3s, transform .3s; }
.hz-step:hover .hz-card { opacity: .85; }
.hz-step.on .hz-card { opacity: 1; transform: translateY(-3px); box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(242, 170, 80, .45); }
.hz-step.done .hz-card { opacity: .9; }
.hz-step b { font-family: var(--kai); font-size: 16px; font-weight: 400; letter-spacing: .1em; }
.hz-step small { font-size: 11px; color: var(--muted); }
.hz-step.on b { color: var(--gold); }
.hz-sec { margin-top: 26px; max-width: 1000px; }
.hz-sec h4 { margin: 0 0 10px; font-size: 13px; color: var(--gold); letter-spacing: .2em; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hz-sec h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hz-chip { display: inline-flex; align-items: center; gap: 1px; font-size: 19px; padding: 5px 12px; }
.ig { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -.2em; padding: 1px; border-radius: 3px; background: #e7d6ae; color: #5a2e12; }
.hz-chip .badge { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--seal); color: #fff6ea; margin-left: 6px; font-family: var(--serif); }

/* 六种书写载体：龟甲、青铜、印章、竹简、宣纸、田字格 */
.hz-card { display: grid; place-items: center; box-sizing: border-box; position: relative; overflow: hidden; }
.s-jg { color: #5a2e12;
  background: radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, .25), transparent 60%), repeating-linear-gradient(115deg, transparent 0 23px, rgba(120, 80, 40, .13) 23px 24px), radial-gradient(ellipse at 30% 25%, #f1e3bf, #dcc596 70%, #c9ad78); }
.s-jw { background: radial-gradient(ellipse at 35% 30%, #5f8a76, #34574a 65%, #22392f); color: #e4c26e; }
.s-jw .glyph { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .5)); }
.s-zh { background: #b8322a; color: #fbe9d0; box-shadow: inset 0 0 0 3px #b8322a, inset 0 0 0 5px rgba(251, 233, 208, .7); }
.s-ls { background: repeating-linear-gradient(90deg, #dcbc80 0 30%, #b8945a 30% 31.5%, #d4b276 31.5% 64%, #b8945a 64% 65.5%, #dcbc80 65.5% 100%); color: #2a1a0a; }
.s-ks { background: radial-gradient(ellipse at 40% 30%, #fbf4e4, #eadcbe); color: #1a1208; }
.s-jt { color: #1a1208; box-shadow: inset 0 0 0 2px #c8352a;
  background: linear-gradient(90deg, transparent calc(50% - .5px), rgba(200, 53, 42, .45) calc(50% - .5px), rgba(200, 53, 42, .45) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(transparent calc(50% - .5px), rgba(200, 53, 42, .45) calc(50% - .5px), rgba(200, 53, 42, .45) calc(50% + .5px), transparent calc(50% + .5px)), #faf4e6; }
.hz-font { line-height: 1; width: 100%; text-align: center; font-size: var(--fs, 40px); }
.f-ls { font-family: "LiSu", "隶书", "STLiti", "Noto Serif SC", serif; }
.f-ks, .f-jt { font-family: var(--kai); }
.hz-font.draw { animation: hzInk 1s ease both; }
@keyframes hzInk { from { clip-path: inset(0 0 100% 0); opacity: .3; filter: blur(2px); } to { clip-path: inset(0 0 0 0); opacity: 1; filter: none; } }

.glyph { width: 100%; height: 100%; display: block; overflow: visible; }
.glyph path { fill: none; stroke: currentColor; stroke-width: var(--w); stroke-linecap: round; stroke-linejoin: round; }
.glyph.g-jg path { stroke-linecap: square; stroke-linejoin: miter; }
.glyph path.f { fill: currentColor; stroke-width: 1; }
.glyph.draw path:not(.f) { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: hzDraw .42s ease forwards; animation-delay: calc(var(--i) * .15s); }
.glyph.draw path.f { opacity: 0; animation: hzFade .4s ease forwards; animation-delay: calc(var(--i) * .15s); }
@keyframes hzDraw { to { stroke-dashoffset: 0; } }
@keyframes hzFade { to { opacity: 1; } }
.q-glyph { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -.15em; padding: 3px; border-radius: 6px; background: #e7d6ae; color: #5a2e12; margin: 0 .05em; }
.d-hz { display: flex; gap: 8px; flex-wrap: wrap; }
.d-hz button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface2); border-radius: 8px; padding: 4px 10px 4px 4px; font-family: var(--kai); font-size: 18px; }
.d-hz button:hover { border-color: var(--gold); }
.d-hz .hz-card { width: 34px; height: 34px; padding: 4px; border-radius: 5px; }

/* —— 成语星系 —— */
.stage { position: relative; width: 100%; height: 100%; background: #0e0805; }
.stage canvas { display: block; cursor: grab; }
.panel {
  position: absolute; background: rgba(31, 20, 12, .85); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.ctl { top: 16px; left: 16px; width: 290px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 0; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--seal); color: #fff6ea; }
input[type=search], .bar input:not([type=checkbox]) {
  border: 1px solid var(--line); background: var(--surface2); border-radius: 8px; padding: 8px 12px; outline: none;
}
input:focus { border-color: var(--seal); }
input[type=checkbox] { accent-color: var(--seal); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button {
  --cd: color-mix(in srgb, var(--c) 72%, #2a1406);
  border: 1px solid var(--cd); color: var(--cd); background: none; border-radius: 999px; padding: 3px 12px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 5px;
}
.legend button::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); }
.legend button.on { background: var(--c); color: #160f0a; }
.legend button.on::before { background: #160f0a; box-shadow: none; }
.legend.dim button:not(.on) { opacity: .4; }
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.banner {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--line); padding: 8px 10px 8px 16px; border-radius: 999px; font-size: 14px;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow);
}
.banner b { font-family: var(--kai); font-size: 20px; color: var(--gold); }
.banner button { border: 0; background: rgba(255, 255, 255, .1); border-radius: 999px; width: 24px; height: 24px; }
.zoom { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.tip {
  position: absolute; pointer-events: none; max-width: 270px; background: rgba(27, 23, 19, .95); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.6; box-shadow: var(--shadow); z-index: 5;
}
.tip b { font-family: var(--kai); font-size: 18px; letter-spacing: .1em; color: var(--gold); }
.tip small { color: var(--muted); margin-left: 6px; }

/* —— 印章 —— */
.seal {
  --c: var(--seal); --cd: color-mix(in srgb, var(--c) 72%, #2a1406);
  display: inline-grid; grid-template-columns: 1fr 1fr; place-items: center; flex: none;
  width: 46px; height: 46px; padding: 3px; border: 1.5px solid var(--cd); border-radius: 6px; color: var(--cd);
  background: var(--seal-bg); font-family: var(--kai); font-size: 17px; line-height: 1; box-shadow: 0 0 12px -4px var(--c);
}
.seal i { font-style: normal; }
.seal.lg {
  width: 128px; height: 128px; padding: 8px; font-size: 48px; border-radius: 14px; background: var(--c); color: #fff6ea;
  border: 0; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .25), 0 0 40px -6px var(--c); transform: rotate(-3deg);
}
.seal.lg button { border: 0; background: none; color: inherit; font: inherit; padding: 0; width: 100%; height: 100%; border-radius: 6px; }
.seal.lg button:hover { background: rgba(255, 255, 255, .18); }
.seal.fill { background: var(--c); color: #fff6ea; }

/* —— 详情抽屉 —— */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100%; z-index: 20;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 50px rgba(60, 30, 10, .25);
  transform: translateX(105%); transition: transform .3s ease; overflow-y: auto; padding: 28px 26px 40px;
}
#drawer.open { transform: none; }
.x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface2); font-size: 20px; line-height: 1; }
.d-head { display: flex; gap: 20px; align-items: center; margin-bottom: 8px; }
.d-head .py { font-size: 16px; color: var(--muted); letter-spacing: .04em; margin-bottom: 8px; }
.d-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--c); color: #160f0a; }
.speak { border: 1px solid var(--line); background: var(--surface2); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.watch { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 18px; padding: 12px; border-radius: 12px; border: 0; font-size: 16px;
  background: linear-gradient(135deg, var(--seal), #e0703a); color: #fff6ea; box-shadow: 0 6px 24px rgba(210, 60, 44, .35); }
.d-sec { margin-top: 22px; }
.d-sec h4 { margin: 0 0 8px; font-size: 13px; color: var(--gold); letter-spacing: .2em; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.d-sec h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.d-sec p { margin: 0; line-height: 1.9; font-size: 16.5px; }
.d-sec .story { background: var(--surface2); border-left: 3px solid var(--seal); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.d-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface2); border-radius: 8px; padding: 4px 12px; font-family: var(--kai); font-size: 18px; }
.chip:hover { border-color: var(--seal); color: var(--gold); }
.chip em { font-style: normal; color: var(--seal); }
.chip small { font-family: var(--serif); font-size: 11px; color: var(--muted); margin-left: 4px; }
.group { margin-bottom: 10px; }
.group > span { font-family: var(--kai); font-size: 18px; color: var(--seal); margin-right: 6px; }

/* —— 通用版块 —— */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.wrap.narrow { max-width: 680px; }
.head h2 { font-family: var(--kai); font-size: 30px; margin: 0 0 4px; letter-spacing: .1em; }
.head p { margin: 0 0 18px; color: var(--muted); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bar input:not([type=checkbox]) { flex: 1; min-width: 200px; }
.bar button, .btn { border: 1px solid var(--line); background: var(--surface2); border-radius: 8px; padding: 8px 14px; }
.bar button:hover, .btn:hover { border-color: var(--ink); }
.primary, .btn.primary { background: var(--seal) !important; color: #fff6ea; border-color: var(--seal) !important; }
.sw { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }
.msg { min-height: 22px; font-size: 14px; color: var(--seal); margin-bottom: 8px; }
.sec { font-size: 15px; color: var(--muted); font-weight: 500; margin: 28px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 0 18px var(--glow); border-color: var(--gold); }
.card .t { font-family: var(--kai); font-size: 22px; letter-spacing: .08em; }
.card .p { font-size: 13px; color: var(--muted); margin: 1px 0 4px; }
.card .m { font-size: 15px; line-height: 1.6; color: var(--card-m); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .via { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface2); color: var(--muted); margin-left: 6px; font-family: var(--serif); letter-spacing: 0; }
.card .badge { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--seal); color: #fff6ea; margin-left: 6px; font-family: var(--serif); letter-spacing: 0; }
#lcat { margin-bottom: 18px; }

.track { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 4px; padding: 20px; min-height: 100px; border: 1px dashed var(--line); border-radius: 14px; background: var(--track); }
.track .empty { color: var(--muted); font-size: 14px; }
.link { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--muted); padding: 0 2px; }
.link::before { content: "→"; font-size: 18px; color: var(--seal); line-height: 1; }
.link.homo::before { content: "⇢"; }
.track .seal { cursor: pointer; animation: pop .35s ease; }
.track .seal.last { background: var(--c); color: #fff6ea; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

.q-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.q-progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 22px; }
.q-progress i { display: block; height: 100%; background: var(--seal); transition: width .3s; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.q-kind { font-size: 12px; letter-spacing: .2em; color: var(--gold); margin-bottom: 10px; }
.q-prompt { font-size: 20px; line-height: 1.8; margin: 0 0 22px; }
.q-big { font-family: var(--kai); font-size: 44px; letter-spacing: .25em; text-align: center; margin: 4px 0 24px; }
.q-big u { text-decoration: none; display: inline-block; width: 1.1em; border-bottom: 3px solid var(--seal); color: var(--seal); }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-opts button { padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); font-family: var(--kai); font-size: 21px; letter-spacing: .1em; }
.q-opts button:hover:not(:disabled) { border-color: var(--ink); }
.q-opts button.right { background: var(--ok); color: #fff; border-color: var(--ok); }
.q-opts button.wrong { background: var(--seal); color: #fff; border-color: var(--seal); }
.q-opts button:disabled { cursor: default; }
.q-explain { margin-top: 20px; display: flex; gap: 14px; align-items: center; padding-top: 18px; border-top: 1px dashed var(--line); }
.q-explain p { margin: 0; font-size: 14px; line-height: 1.7; flex: 1; }
.q-next { margin-top: 18px; text-align: right; }
.q-end { text-align: center; }
.q-score { font-family: var(--kai); font-size: 72px; color: var(--seal); line-height: 1; margin: 10px 0; }
.q-end .chips { justify-content: center; margin: 14px 0 22px; }

/* —— 小屏 —— */
@media (max-width: 760px) {
  .top { padding: 8px 12px; gap: 8px; }
  h1 { font-size: 19px; }
  .sub { display: none; }
  .tabs { width: 100%; overflow-x: auto; }
  .tabs button { flex: 1; padding: 6px 10px; font-size: 13px; }
  .theater { flex-direction: column; }
  .hz { flex-direction: column; }
  .hz-list { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 34vh; padding: 8px; }
  .hz-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
  .hz-main { padding: 18px 16px 40px; }
  .hz-top { gap: 18px; }
  .hz-info .ch { font-size: 48px; }
  .th-list { width: auto; border-left: 0; border-top: 1px solid var(--line); display: flex; gap: 6px; overflow-x: auto; padding: 8px; flex: none; }
  .th-list h3 { display: none; }
  .th-item { flex: none; width: auto; margin: 0; padding: 6px 10px; }
  .th-item .seal { width: 34px; height: 34px; font-size: 12px; }
  .th-item .p { display: none; }
  .ctl { top: 10px; left: 10px; right: 10px; width: auto; padding: 10px; gap: 8px; }
  .ctl .hint { display: none; }
  .banner { top: auto; bottom: 16px; }
  .zoom { left: auto; right: 12px; bottom: 12px; }
  #drawer { top: auto; left: 0; width: 100%; height: 78vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; transform: translateY(105%); padding: 24px 16px 40px; }
  .seal.lg { width: 96px; height: 96px; font-size: 36px; }
  .wrap { padding: 20px 16px 48px; }
  .q-card { padding: 20px 16px; }
  .q-big { font-size: 34px; }
  .q-opts button { font-size: 18px; padding: 12px 6px; }
}

.dark .seal, .dark .legend button, :root[data-theme="dark"] .seal, :root[data-theme="dark"] .legend button { --cd: var(--c); }

/* —— 页脚备案号 —— */
.foot { flex: none; text-align: center; font-size: 11px; line-height: 1; padding: 4px 0; background: var(--top-bg); border-top: 1px solid var(--line); }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--gold); }

/* —— 机构欢迎页 —— */
.zy-welcome { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(rgba(20, 12, 7, .7), rgba(20, 12, 7, .95)); animation: zy-fade .3s ease-out; }
.zy-welcome.leaving { opacity: 0; transition: opacity .25s; }
.zy-welcome-card { width: min(420px, 100%); text-align: center; padding: 26px 22px 20px; border-radius: 16px; color: #f6e7cc;
  background: #1f140c; border: 1px solid rgba(231, 182, 96, .35); box-shadow: 0 0 60px rgba(242, 170, 80, .25); font-family: var(--kai); }
.zy-welcome-logo { display: block; max-width: 180px; max-height: 64px; margin: 0 auto 12px; object-fit: contain; background: #fff; border-radius: 6px; padding: 4px; }
.zy-welcome-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; color: #e7b660; border: 1px solid rgba(231, 182, 96, .4); border-radius: 99px; padding: 3px 14px; }
.zy-welcome-seal { display: grid; width: 72px; height: 96px; margin: 16px auto 6px; place-items: center; font-size: 30px; line-height: 1;
  background: #c8352a; color: #fff3e0; border-radius: 8px; transform: rotate(-4deg); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25), 0 0 40px rgba(200, 53, 42, .5);
  animation: zy-stamp .6s cubic-bezier(.2, 1.6, .4, 1) .1s both; }
.zy-welcome h2 { font-size: clamp(21px, 5.4vw, 26px); margin: 10px 0 4px; font-weight: 600; }
.zy-welcome h2 span { color: #e7b660; }
.zy-welcome p { color: #cdb89a; margin: 0 0 18px; font-family: var(--serif); font-size: 15px; }
.zy-welcome button { width: 100%; border: 0; border-radius: 99px; padding: 12px; font-size: 18px; letter-spacing: .2em; color: #fff; background: #c8352a; }
.zy-welcome button:focus-visible { outline: 3px solid #e7b660; outline-offset: 3px; }
.zy-welcome-timer { display: block; height: 3px; width: 60%; margin: 14px auto 0; background: rgba(255, 255, 255, .1); border-radius: 99px; overflow: hidden; }
.zy-welcome-timer i { display: block; height: 100%; background: #e7b660; animation: zy-timer 3.5s linear forwards; }
@keyframes zy-fade { from { opacity: 0; } }
@keyframes zy-stamp { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } }
@keyframes zy-timer { from { width: 100%; } to { width: 0; } }
@media (prefers-reduced-motion: reduce) { .zy-welcome, .zy-welcome-seal, .zy-welcome-timer i { animation: none; } }
