/* 声如磬 · 版式与展柜 */
:root {
	--ink: #0b0a08; --ink2: #13110e; --ink3: #1b1814; --paper: #f2ebde; --mute: rgba(242, 235, 222, .62); --dim: rgba(242, 235, 222, .4);
	--ver: #e2462b; --gold: #d9b36c; --line: rgba(242, 235, 222, .12); --line2: rgba(217, 179, 108, .34);
	--serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
	--sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
	--sh: clamp(270px, 52vh, 500px);
	color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--paper); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nojs { padding: 24px; text-align: center; }

/* ---------- 窄屏（默认）：展柜吸顶，下面切换「展品／展线／序」 ---------- */
.app { position: relative; }
.top { position: absolute; z-index: 6; top: 0; left: 50%; transform: translateX(-50%); width: min(60vw, 420px); height: 46px;
	display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ttl { margin: 0; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; font-weight: 400; }
.ttl .t { font: 700 20px/1 var(--serif); letter-spacing: .14em; }
.ttl .st { font: 12px/1 var(--sans); color: var(--mute); letter-spacing: .08em; }
.stage { position: sticky; top: 0; z-index: 4; height: var(--sh); overflow: hidden; user-select: none; -webkit-user-select: none;
	background: radial-gradient(120% 90% at 50% 32%, #211c16 0%, #12100d 52%, #0b0a08 100%); border-bottom: 1px solid var(--line); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.stage canvas:active { cursor: grabbing; }
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
	background: radial-gradient(130% 100% at 50% 40%, transparent 58%, rgba(0, 0, 0, .45) 100%); }
.tabs { position: sticky; top: var(--sh); z-index: 3; display: flex; background: rgba(11, 10, 8, .94); border-bottom: 1px solid var(--line);
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tabs button { flex: 1; height: 42px; border: 0; background: none; font: 15px/1 var(--serif); letter-spacing: .2em; color: var(--mute); cursor: pointer; position: relative; }
.tabs button[aria-selected="true"] { color: var(--paper); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: -1px; height: 2px; background: var(--ver); }
.app[data-tab="line"] .panel { display: none; }
.app:not([data-tab="line"]) .line { display: none; }
.solo .panel, .solo .line { padding-bottom: 72px; }

/* ---------- 宽屏：标题 / 展柜＋说明 / 展线 ---------- */
@media (min-width: 900px) and (min-height: 560px) {
	body { overflow: hidden; }
	.app { display: grid; height: 100vh; height: 100dvh; grid-template-columns: minmax(0, 1fr) clamp(330px, 29vw, 410px);
		grid-template-rows: 54px minmax(0, 1fr) auto; grid-template-areas: "top top" "stage panel" "line line"; }
	.top { grid-area: top; position: relative; left: auto; transform: none; width: auto; height: 54px; border-bottom: 1px solid var(--line); }
	.ttl .t { font-size: 22px; }
	.ttl .st { font-size: 13px; }
	.stage { grid-area: stage; position: relative; height: auto; border-bottom: 0; }
	.tabs { display: none; }
	.panel { grid-area: panel; overflow-y: auto; border-left: 1px solid var(--line); }
	.app[data-tab] .panel, .app[data-tab] .line { display: block; }
	.line { grid-area: line; border-top: 1px solid var(--line); }
	.solo .panel { padding-bottom: 0; }
	.solo .line { padding-bottom: 0; padding-right: 200px; }
}

/* ---------- 矮屏（横放手机、矮的嵌入框）：左展柜，右侧切换 ---------- */
@media (min-width: 560px) and (max-height: 559px) {
	body { overflow: hidden; }
	.app { display: grid; height: 100vh; height: 100dvh; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
		grid-template-rows: 42px minmax(0, 1fr); grid-template-areas: "stage tabs" "stage panel"; }
	.top { left: 0; right: auto; transform: none; width: 62%; max-width: none; }
	.stage { grid-area: stage; position: relative; height: auto; border-bottom: 0; border-right: 1px solid var(--line); }
	.tabs { grid-area: tabs; position: relative; top: 0; }
	.panel, .line { grid-area: panel; overflow-y: auto; }
	.solo .panel, .solo .line { padding-bottom: 60px; }
}

/* ---------- 展柜 HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cn { position: absolute; width: 16px; height: 16px; border: 0 solid var(--gold); opacity: .55; }
.cn.tl { top: 12px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.cn.tr { top: 12px; right: 12px; border-top-width: 1px; border-right-width: 1px; }
.cn.bl { bottom: 12px; left: 12px; border-bottom-width: 1px; border-left-width: 1px; }
.cn.br { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }
.tag { position: absolute; left: 22px; top: 54px; display: flex; align-items: center; gap: 8px; font: 11px/1 var(--mono); letter-spacing: .06em; color: var(--mute); }
.tag b { font-weight: 500; color: var(--gold); font-size: 12px; }
.tag span::before { content: "·"; margin-right: 8px; color: var(--dim); }
.tag em { font-style: normal; font-family: var(--sans); color: var(--paper); border: 1px solid var(--line2); padding: 3px 6px 2px; letter-spacing: .1em; font-size: 11px; }
.read { position: absolute; left: 22px; top: 76px; font: 10.5px/1.5 var(--mono); color: var(--dim); letter-spacing: .04em; white-space: pre; }
.ruler { position: absolute; right: 24px; bottom: 76px; display: flex; align-items: flex-end; gap: 6px; flex-direction: row-reverse; }
.ruler .bar { display: block; width: 7px; height: 100px; border-right: 1px solid var(--gold); opacity: .7;
	background: repeating-linear-gradient(to bottom, var(--gold) 0 1px, transparent 1px 10%); background-size: 4px 100%; background-repeat: no-repeat; background-position: right top; }
.ruler .lab { font: 10px/1 var(--mono); color: var(--mute); writing-mode: vertical-rl; letter-spacing: .1em; }
.hint { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); white-space: nowrap; text-align: center; font: 12px/1 var(--sans); color: var(--dim); letter-spacing: .18em; transition: opacity .8s; }
.hint.off { opacity: 0; }
.nogl-msg { display: none; position: absolute; inset: 0; margin: 0; padding: 30% 12% 0; text-align: center; color: var(--mute); font-size: 14px; }
.nogl .nogl-msg { display: block; }
.nogl .stage canvas, .nogl .acts .act:not(.snd) { display: none; }
@media (min-width: 900px) and (min-height: 560px) {
	.tag { top: 22px; }
	.read { top: 44px; }
}

/* ---------- 操作按钮 ---------- */
.acts { position: absolute; z-index: 3; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 10px; border: 1px solid var(--line2); border-radius: 2px;
	background: rgba(11, 10, 8, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font: 15px/1 var(--serif); letter-spacing: .12em; cursor: pointer; white-space: nowrap;
	transition: background .2s, border-color .2s, color .2s, opacity .2s; }
.act .k { font: 10px/1 var(--mono); color: var(--dim); border: 1px solid var(--line); padding: 2px 3px; letter-spacing: 0; }
.act:hover { border-color: var(--gold); background: rgba(217, 179, 108, .1); }
.act.hot { border-color: rgba(226, 70, 43, .7); color: #ffd9cf; }
.act.hot:hover { background: rgba(226, 70, 43, .18); border-color: var(--ver); }
.act:disabled { opacity: .32; cursor: default; }
.act[hidden] { display: none; }
.act:disabled:hover { background: rgba(11, 10, 8, .62); border-color: var(--line2); }
.act.lt[aria-pressed="true"] { background: rgba(255, 196, 120, .2); border-color: #f0c47a; color: #ffe4bd; }
.act.snd { width: 38px; padding: 0; justify-content: center; }
.act.snd svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.act.snd svg path:first-child { fill: currentColor; stroke: none; }
.act.snd .x { display: none; }
.act.snd[aria-pressed="true"] .x { display: inline; }
.act.snd[aria-pressed="true"] .w { display: none; }
.act.snd[aria-pressed="true"] { color: var(--dim); }
.nav { position: absolute; z-index: 3; top: 50%; width: 38px; height: 38px; margin-top: -19px; border: 1px solid var(--line); border-radius: 50%;
	background: rgba(11, 10, 8, .5); cursor: pointer; display: grid; place-items: center; transition: border-color .2s, background .2s; }
.nav:hover { border-color: var(--gold); background: rgba(217, 179, 108, .1); }
.nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav.prev { left: 12px; }
.nav.next { right: 12px; }
@media (max-width: 520px) {
	.act { padding: 0 10px 0 8px; font-size: 14px; letter-spacing: .06em; gap: 4px; height: 36px; }
	.act .k { display: none; }
	.act.snd { width: 36px; }
	.acts { gap: 5px; bottom: 10px; }
	.hint { bottom: 56px; font-size: 11px; letter-spacing: .1em; }
	.nav { width: 34px; height: 34px; margin-top: -17px; }
	.nav.prev { left: 6px; }
	.nav.next { right: 6px; }
	.ruler { right: 12px; bottom: 60px; }
	.ruler .lab { font-size: 9px; }
	.read { display: none; }
	.ttl .st { font-size: 11px; }
}
/* 窄屏整页滚动：窗口左下角是「一步步看」（单开时右下角还有站点小标签），说明和展线末尾多留一段，能滚到按钮上面 */
@media (max-width: 559px), (max-width: 899px) and (min-height: 560px) {
	.app .panel, .app .line { padding-bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
