/* 千字文 · 一句一幕 */
:root {
	--paper: #f3efe6;
	--paper-2: #ebe5d8;
	--card: #fbf9f4;
	--ink: #1a1714;
	--ink-2: #4f4840;
	--ink-3: #8b8378;
	--ink-4: #b9b1a5;
	--rule: rgba(26, 23, 20, .12);
	--rule-2: rgba(26, 23, 20, .06);
	--zhu: #d13f1c;
	--zhu-2: #e8846a;
	--zhu-wash: rgba(209, 63, 28, .09);
	--c1: #33567f;
	--c2: #2c7566;
	--c3: #b07d22;
	--c4: #7a4c86;
	--c5: #8b8378;
	--serif: 'Noto Serif SC', 'Source Han Serif SC', 'Noto Serif CJK SC', 'Songti SC', serif;
	--ui: 'Space Grotesk', 'Noto Serif SC', 'PingFang SC', system-ui, sans-serif;
	--mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
	--bar: 58px;
	--foot: 62px;
	--cell: clamp(112px, min(13.2vw, 22vh), 188px);
	--ease: cubic-bezier(.2, .7, .2, 1);
	color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--paper);
	color: var(--ink);
	font-family: var(--serif);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow: hidden;
}
button { font: inherit; color: inherit; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--zhu); outline-offset: 2px; }

/* 纸面：极淡的纤维 */
body::before {
	content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .3  0 0 0 0 .24  0 0 0 .06 0'/></filter><rect width='220' height='220' filter='url(%23f)'/></svg>");
}

.app {
	position: relative; z-index: 1;
	height: 100vh; height: 100dvh;
	display: grid;
	grid-template-rows: var(--bar) minmax(0, 1fr) var(--foot);
}

/* ---------------------------------------------------------------- 顶栏 */
.bar {
	display: flex; align-items: center; gap: 18px;
	padding: 0 clamp(14px, 2.4vw, 32px);
	border-bottom: 1px solid var(--rule);
	font-family: var(--ui);
	min-width: 0;
}
.bar__mark {
	all: unset; cursor: pointer;
	font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: .14em;
	padding: 4px 2px; position: relative;
}
.bar__mark::after { content: ''; position: absolute; left: 2px; right: .14em; bottom: 0; height: 3px; background: var(--zhu); transform-origin: left; transform: scaleX(.32); transition: transform .35s var(--ease); }
.bar__mark:hover::after { transform: scaleX(1); }
.bar__where { margin: 0; display: flex; gap: 10px; align-items: baseline; font-family: var(--serif); font-size: 14px; color: var(--ink-2); white-space: nowrap; min-width: 0; overflow: hidden; }
.bar__where b { font-weight: 700; color: var(--ink); }
.bar__where span { color: var(--zhu); }
.bar__n { margin: 0 0 0 auto; font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--ink-3); white-space: nowrap; }
.bar__n b { font-weight: 600; color: var(--ink); font-size: 17px; }
.bar__nav, .bar__tg { display: flex; gap: 6px; }
.bt {
	cursor: pointer; border: 1px solid var(--rule); background: transparent; border-radius: 999px;
	padding: 7px 14px; font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: .06em;
	transition: background .2s, border-color .2s, color .2s;
}
.bt:hover { border-color: var(--ink); }
.bt:active { transform: translateY(1px); }
.tg {
	cursor: pointer; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 8px; font-family: var(--serif); font-size: 13px; color: var(--ink-2); border-radius: 6px;
}
.tg i { width: 22px; height: 12px; border-radius: 6px; background: var(--ink-4); position: relative; transition: background .2s; }
.tg i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--card); transition: transform .2s var(--ease); }
.tg[aria-checked="true"] { color: var(--ink); }
.tg[aria-checked="true"] i { background: var(--zhu); }
.tg[aria-checked="true"] i::after { transform: translateX(10px); }
.tg:hover { background: var(--zhu-wash); }

/* ---------------------------------------------------------------- 阅读区 */
.read {
	display: grid; min-height: 0;
	grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
	grid-template-rows: minmax(min-content, 1.06fr) minmax(0, 1fr);  /* 窗口矮时舞台不缩进下面两栏，免得按钮压住批注 */
	grid-template-areas: "stage stage" "notes fig";
}
.stage {
	grid-area: stage; position: relative; min-height: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 10px 24px 6px;
}
.stage__eyebrow { display: none; margin: 0 0 4px; font-size: 13px; letter-spacing: .3em; color: var(--zhu); min-height: 1.4em; font-weight: 600; }
.stage__row { position: relative; display: flex; align-items: flex-end; gap: calc(var(--cell) * .14); }
.cell { position: relative; width: var(--cell); }
.cell__py {
	display: block; height: 30px; text-align: center; font-family: var(--serif); font-size: clamp(13px, 1.25vw, 17px);
	letter-spacing: .04em; color: var(--zhu); opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .5s var(--ease);
}
.cell.is-py .cell__py { opacity: 1; transform: none; }
.cell__box { position: relative; width: var(--cell); height: var(--cell); cursor: pointer; }
.cell__box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cell__grid line, .cell__grid rect { vector-effect: non-scaling-stroke; }
.cell__grid rect { fill: none; stroke: rgba(209, 63, 28, .32); stroke-width: 1; }
.cell__grid line { stroke: rgba(209, 63, 28, .22); stroke-width: 1; stroke-dasharray: 4 5; }
.cell__ink { fill: var(--ink); }
.cell__ink .rv { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.cell__ghost { fill: rgba(26, 23, 20, .06); }
.cell__box:hover .cell__grid rect { stroke: var(--zhu); }
.cell__font {
	position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cell) * .74); line-height: 1;
	color: rgba(26, 23, 20, .1); font-weight: 400; user-select: none; pointer-events: none;
}
.cell.is-on .cell__font { display: none; }
.stage__row.is-roll .cell__font { color: rgba(26, 23, 20, .38); transition: color .2s; }
.stage__row.is-roll .cell__font.is-stop { color: var(--ink); }
.stage__pause { position: absolute; width: calc(var(--cell) * .2); height: calc(var(--cell) * .2); bottom: 2px; }
.stage__glosses {
	order: 2; display: grid; grid-template-columns: repeat(4, var(--cell)); gap: calc(var(--cell) * .14);
	margin-top: 12px;
}
.gl { font-size: 13.5px; line-height: 1.55; color: var(--zhu); opacity: 0; transform: translateY(-4px); transition: opacity .5s, transform .5s var(--ease); }
.gl.is-on { opacity: 1; transform: none; }
.gl b { font-weight: 700; margin-right: .2em; }
.stage__yi {
	order: 3; margin: 8px 0 0; min-height: 1.6em; font-size: clamp(17px, 1.75vw, 24px); font-weight: 600; letter-spacing: .04em;
	text-align: center; max-width: 36em; opacity: 0; transition: opacity .6s;
}
.stage__yi.is-on { opacity: 1; }
.stage__zhu { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.stage__zhu path { fill: none; stroke: var(--zhu); stroke-width: 1.9; opacity: .92; stroke-linecap: round; stroke-linejoin: round; }
.stage__zhu .dot { fill: var(--zhu); stroke: none; }
.stage__skip {
	position: absolute; right: 22px; top: 12px; cursor: pointer; border: 0; background: transparent; color: var(--ink-3);
	font-size: 13px; letter-spacing: .1em; padding: 6px 8px;
}
.stage__skip:hover { color: var(--zhu); }
.stage__tools { position: absolute; left: 22px; top: 10px; display: flex; gap: 6px; }
.mini {
	cursor: pointer; border: 1px solid var(--rule); background: rgba(251, 249, 244, .7); border-radius: 6px; padding: 5px 10px;
	font-family: var(--serif); font-size: 13px; color: var(--ink-2); letter-spacing: .06em;
}
.mini:hover { border-color: var(--zhu); color: var(--zhu); }
.mini[disabled] { opacity: .4; cursor: default; }
.mini[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* 标题一幕 */
.app.is-title .stage__glosses, .app.is-title .stage__yi, .app.is-title .stage__tools, .app.is-title .stage__eyebrow { display: none; }
.title { order: 5; text-align: center; margin-top: 14px; }
.title__sub { margin: 0; font-size: 14px; letter-spacing: .5em; color: var(--zhu); }
.title__lead { margin: 12px 0 0; font-size: clamp(16px, 1.6vw, 21px); line-height: 1.8; letter-spacing: .06em; }
.title__go { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.go {
	cursor: pointer; border: 1.5px solid var(--ink); background: transparent; padding: 10px 20px; border-radius: 999px;
	font-family: var(--serif); font-size: 15px; font-weight: 700; letter-spacing: .1em; transition: transform .15s, background .2s, color .2s;
}
.go:hover { background: var(--ink); color: var(--paper); }
.go--main { background: var(--zhu); border-color: var(--zhu); color: #fff; }
.go--main:hover { background: #b9330f; border-color: #b9330f; color: #fff; }
.go:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- 批注 */
.notes {
	grid-area: notes; min-height: 0; overflow: auto; overscroll-behavior: contain;
	padding: 18px clamp(18px, 3vw, 44px) 24px; border-top: 1px solid var(--rule);
	scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent;
}
.nt { max-width: 46em; opacity: 0; transform: translateY(8px); transition: opacity .55s, transform .55s var(--ease); }
.nt.is-on { opacity: 1; transform: none; }
.nt__pi { position: relative; margin: 0; font-size: 16px; line-height: 1.95; letter-spacing: .02em; padding-left: 46px; }
.nt__pi::before {
	content: '批'; position: absolute; left: 0; top: .35em; width: 28px; height: 28px; display: grid; place-items: center;
	background: var(--zhu); color: #fff; font-size: 15px; font-weight: 700; border-radius: 3px; line-height: 1;
}
.nt__pi.is-pair::before { content: '合'; background: transparent; color: var(--zhu); box-shadow: inset 0 0 0 1.5px var(--zhu); }
.nt__more { margin: 10px 0 0 46px; }
.nt__more summary { cursor: pointer; color: var(--zhu); font-size: 14px; letter-spacing: .1em; list-style: none; }
.nt__more summary::before { content: '＋ '; }
.nt__more[open] summary::before { content: '－ '; }
.nt__more p { margin: 8px 0 0; font-size: 15px; line-height: 1.9; color: var(--ink-2); }
.nt__yin { list-style: none; padding: 0; margin: 16px 0 0 46px; display: grid; gap: 10px; }
.nt__yin li { position: relative; padding: 10px 14px 10px 16px; background: var(--card); border-left: 3px solid var(--ink); font-size: 15.5px; line-height: 1.8; }
.nt__yin cite { display: block; font-style: normal; font-size: 12.5px; letter-spacing: .12em; color: var(--ink-3); margin-bottom: 2px; }
.nt__sy { margin: 16px 0 0 46px; padding: 10px 14px 10px 16px; border-left: 3px solid var(--zhu); background: var(--zhu-wash); font-size: 15px; line-height: 1.85; color: #4a2418; }
.nt__sy cite { display: block; font-style: normal; font-size: 12.5px; letter-spacing: .12em; color: var(--zhu); margin-bottom: 2px; }
.nt__yw { margin: 12px 0 0 46px; font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }
.nt__yw b { color: var(--zhu); font-weight: 700; margin-right: .4em; }
.nt__link { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0 46px; }
.nt__link a {
	display: inline-flex; gap: 6px; align-items: center; text-decoration: none; color: var(--ink-2); font-size: 13px;
	border: 1px solid var(--rule); padding: 5px 10px; border-radius: 999px;
}
.nt__link a::before { content: '↗'; color: var(--zhu); font-family: var(--ui); }
.nt__link a:hover { border-color: var(--zhu); color: var(--ink); }
.nt__intro h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: .1em; }
.nt__intro p { margin: 0 0 12px; font-size: 15.5px; line-height: 1.95; }

/* ---------------------------------------------------------------- 图示 */
.fig {
	grid-area: fig; position: relative; min-height: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
	display: flex; flex-direction: column; overflow: hidden;
}
.fig__cap {
	margin: 0; padding: 12px 16px 0; display: flex; gap: 10px; align-items: baseline; font-size: 13px; letter-spacing: .14em; color: var(--ink-3);
}
.fig__cap b { color: var(--zhu); font-weight: 700; letter-spacing: .2em; }
.fig__body { position: relative; flex: 1; min-height: 0; }
.fig__body > svg, .fig__body > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fig__hint { position: absolute; left: 16px; bottom: 10px; margin: 0; font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; pointer-events: none; }
.fig__bar { flex: none; display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 6px 14px 10px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.fig__bar input[type="range"] { width: 150px; accent-color: var(--zhu); }
.fig__bar b { color: var(--zhu); }
.fig svg text { font-family: var(--serif); }
.fig .fx-zhu { fill: var(--zhu); }
.fig .fx-ink { fill: var(--ink); }
.fig .fx-mute { fill: var(--ink-3); }
.fig .fx-line { stroke: var(--ink); fill: none; }
.fig__empty { position: absolute; inset: 0; display: grid; place-items: center; }

/* 字卡（没有图示时） */
.card { position: absolute; inset: 0; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-content: center; padding: 18px 22px; }
.card__big { width: 140px; height: 140px; position: relative; }
.card__big svg { width: 100%; height: 100%; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; align-content: center; }
.card dt { color: var(--ink-3); letter-spacing: .1em; }
.card dd { margin: 0; }
.card dd b { color: var(--zhu); }
.card__tabs { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: center; }
.card__tabs button { cursor: pointer; border: 1px solid var(--rule); background: transparent; width: 40px; height: 40px; border-radius: 6px; font-size: 20px; font-family: var(--serif); }
.card__tabs button[aria-pressed="true"] { border-color: var(--zhu); color: var(--zhu); background: var(--zhu-wash); }

/* ---------------------------------------------------------------- 底部条码 */
.code { display: flex; align-items: center; gap: 10px; padding: 0 clamp(10px, 2vw, 26px); border-top: 1px solid var(--rule); background: rgba(243, 239, 230, .9); }
.code__nav {
	cursor: pointer; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: var(--card);
	display: grid; place-items: center; font-size: 26px; line-height: 1; padding-bottom: 3px; font-family: var(--ui);
}
.code__nav:hover { border-color: var(--zhu); color: var(--zhu); }
.code__strip { position: relative; flex: 1; height: 40px; cursor: pointer; touch-action: none; }
.code__strip canvas { width: 100%; height: 100%; display: block; }
.code__tip {
	position: absolute; bottom: 46px; transform: translateX(-50%); margin: 0; white-space: nowrap; pointer-events: none;
	background: var(--ink); color: var(--paper); font-size: 14px; padding: 5px 10px; border-radius: 4px; letter-spacing: .08em;
}
.code__tip i { font-style: normal; font-family: var(--mono); font-size: 12px; opacity: .7; margin-right: 8px; }
/* 左下角是「一步步看」的启动钮，底栏给它留位置；单开时「在展馆中查看」在右下角 */
.code { padding-left: 226px; }
body.is-solo .code { padding-left: 226px; padding-right: 168px; }

/* ---------------------------------------------------------------- 全景 */
.ov { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: grid; grid-template-rows: auto 1fr; }
.ov__head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px clamp(14px, 2.4vw, 32px); border-bottom: 1px solid var(--rule); }
.ov__t { margin: 0; font-size: 20px; letter-spacing: .2em; }
.ov__modes { display: flex; gap: 4px; background: var(--paper-2); padding: 3px; border-radius: 999px; }
.ov__modes button { cursor: pointer; border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-family: var(--serif); font-size: 14px; color: var(--ink-2); }
.ov__modes button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.ov__find input {
	font: inherit; font-size: 15px; border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 7px 14px; width: 170px;
}
.ov__find input:focus { outline: none; border-color: var(--zhu); }
.ov__x, .ji__x { margin-left: auto; cursor: pointer; border: 0; background: transparent; font-size: 30px; line-height: 1; width: 40px; height: 40px; color: var(--ink-2); font-family: var(--ui); }
.ov__x:hover, .ji__x:hover { color: var(--zhu); }
.ov__body { position: relative; overflow: hidden; }
.ov__grid { position: absolute; inset: 0; }
.ov__lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ov__lines path { fill: none; stroke: var(--zhu); stroke-width: 1.6; stroke-linecap: round; }
.ov__lines text { fill: var(--ink-3); font-size: 12px; font-family: var(--serif); letter-spacing: .1em; }
.oc {
	position: absolute; left: 0; top: 0; width: var(--s, 24px); height: var(--s, 24px); display: grid; place-items: center;
	font-size: calc(var(--s, 24px) * .74); line-height: 1; cursor: pointer; border-radius: 2px;
	color: var(--ink); transition: transform .9s var(--ease), opacity .4s, color .3s, background .3s;
	will-change: transform; user-select: none; z-index: 0;
}
.oc::before { content: ''; position: absolute; inset: 1px; border-radius: 2px; background: var(--k, transparent); opacity: .16; transition: opacity .3s; z-index: -1; }
.oc:hover::before { opacity: .5; }
.oc.is-dim { opacity: .14; }
.oc.is-hit { color: #fff; }
.oc.is-hit::before { background: var(--zhu); opacity: 1; }
.oc.is-foot { color: var(--zhu); font-weight: 700; }
.oc.is-sent::before { opacity: .55; }
.ov__legend { position: absolute; left: clamp(14px, 2.4vw, 32px); bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: min(1100px, calc(100% - 40px)); font-size: 12.5px; color: var(--ink-2); pointer-events: none; }
.ov__legend span { display: inline-flex; align-items: center; gap: 6px; }
.ov__legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--k); }
.ov__legend p { margin: 0; width: 100%; color: var(--ink-3); }
.ov__legend { left: 226px; max-width: calc(100% - 250px); }
body.is-solo .ov__legend { left: 226px; max-width: calc(100% - 410px); }
.ov__tip { position: fixed; margin: 0; pointer-events: none; background: var(--ink); color: var(--paper); padding: 6px 10px; border-radius: 4px; font-size: 14px; letter-spacing: .06em; z-index: 30; white-space: nowrap; }
.ov__tip i { font-style: normal; font-family: var(--mono); font-size: 12px; opacity: .7; margin-right: 8px; }
.ov__st { margin: 0; font-size: 13.5px; color: var(--ink-2); min-width: 0; flex: 1 1 200px; }
.ov__st b { color: var(--zhu); font-family: var(--mono); }
.ov__body { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.ov__grid:focus { outline: none; }
.oc.is-cur { outline: 2px solid var(--zhu); outline-offset: 1px; z-index: 2; }
.ov[data-m="rhyme"] .oc.is-foot { color: var(--k); font-weight: 700; }
.ov[data-m="rhyme"] .oc.is-foot::before { opacity: .16; }
.ov[data-m="merge"] .oc.is-pair:not(.is-dim) { color: var(--zhu); font-weight: 700; }
.ov[data-m="merge"] .oc.is-pair::before { background: var(--zhu); opacity: .12; }
.ov__lines .m-n { font-family: var(--mono); font-size: 11px; fill: var(--ink-4); letter-spacing: 0; }
.ov__lines .m-r { fill: var(--zhu); font-weight: 700; letter-spacing: 0; }
.ov__lines .m-c { font-family: var(--mono); fill: var(--ink-3); letter-spacing: 0; }
.ov__lines .m-x { fill: var(--ink-2); font-size: 13px; }
.ov__lines .m-pair rect { fill: var(--card); stroke: var(--zhu); stroke-width: 1; }
.ov__lines .m-pair text { fill: var(--zhu); font-size: 14px; font-weight: 700; letter-spacing: .04em; }

/* ---------------------------------------------------------------- 集字 */
.ji { position: fixed; inset: 0; z-index: 20; background: var(--paper); overflow: auto; }
.ji__in { max-width: 1080px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 40px) 90px; }
.ji__head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.ji__t { margin: 0; font-size: 26px; letter-spacing: .3em; }
.ji__d { margin: 0; color: var(--ink-2); font-size: 15px; flex: 1; min-width: 240px; }
.ji__form { display: flex; gap: 10px; margin-top: 18px; }
.ji__form input {
	flex: 1; min-width: 0; font: inherit; font-size: 24px; letter-spacing: .2em; padding: 10px 18px; border: 1.5px solid var(--ink);
	background: var(--card); border-radius: 10px;
}
.ji__form input:focus { outline: none; border-color: var(--zhu); }
.ji__try { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--ink-3); align-items: center; }
.ji__try button { cursor: pointer; border: 1px solid var(--rule); background: transparent; border-radius: 999px; padding: 4px 12px; font-family: var(--serif); font-size: 14px; }
.ji__try button:hover { border-color: var(--zhu); color: var(--zhu); }
.ji__out { margin-top: 26px; }
.ji__sum { font-size: 17px; margin: 0 0 16px; letter-spacing: .04em; }
.ji__sum b { color: var(--zhu); font-family: var(--mono); }
.ji__note { display: block; margin-top: 4px; font-size: 14.5px; color: var(--zhu); }
.ji__cards { display: flex; flex-wrap: wrap; gap: 14px; }
.jc { width: 150px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 12px; position: relative; }
.jc__box { position: relative; width: 124px; height: 124px; margin: 0 auto; }
.jc__box svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.jc__no { margin: 8px 0 0; text-align: center; font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.jc__no b { color: var(--zhu); font-family: var(--mono); font-size: 15px; }
.jc__src { margin: 2px 0 0; text-align: center; font-size: 13px; color: var(--ink-2); }
.jc__src a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-3); cursor: pointer; }
.jc--miss .jc__box { border: 1.5px dashed var(--ink-4); border-radius: 6px; display: grid; place-items: center; font-size: 64px; color: var(--ink-4); }
.jc--miss .jc__no { color: var(--ink-3); font-weight: 400; }
.jc__alt { margin: 4px 0 0; text-align: center; font-size: 12.5px; color: var(--zhu); }
.ji__map { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.ji__map canvas { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; }
.ji__side { font-size: 14.5px; line-height: 1.85; color: var(--ink-2); }
.ji__side p { margin: 0 0 12px; }
.ji__side .go { margin-right: 8px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- 描红 */
.trace { position: fixed; inset: 0; z-index: 30; background: rgba(26, 23, 20, .45); display: grid; place-items: center; padding: 16px; }
.trace__in { background: var(--card); border-radius: 14px; padding: 20px; width: min(420px, 100%); text-align: center; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5); }
.trace__t { margin: 0 0 12px; font-size: 15px; letter-spacing: .1em; color: var(--ink-2); }
.trace__pad { width: min(320px, 76vw); height: min(320px, 76vw); margin: 0 auto; position: relative; touch-action: none; }
.trace__pad svg.grid { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trace__msg { min-height: 1.6em; margin: 10px 0; font-size: 15px; color: var(--zhu); }
.trace__bt { display: flex; gap: 8px; justify-content: center; }

.nojs { padding: 40px; font-size: 18px; }

/* ---------------------------------------------------------------- 窄屏 */
@media (max-width: 980px) {
	.read { display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; }
	.read > * { flex: none; }
	.stage { padding: 14px 12px 8px; }
	.fig { border-left: 0; height: min(78vw, 420px); }
	.notes { overflow: visible; }
	.bar__where { display: none; }
}
@media (max-width: 680px) {
	:root { --bar: 50px; --foot: 58px; --cell: min(21vw, 104px); }
	.bar { gap: 8px; padding: 0 10px; }
	.bar__mark { font-size: 19px; letter-spacing: .08em; }
	.bar__n { font-size: 12px; }
	.bar__n b { font-size: 15px; }
	.bt { padding: 6px 9px; font-size: 13px; letter-spacing: .02em; }
	.stage__tg { position: absolute; right: 6px; top: 4px; z-index: 2; }
	.stage__tg .bar__tg { gap: 0; }
	.tg { font-size: 12px; padding: 5px 6px; }
	.tg i { width: 18px; height: 10px; }
	.tg i::after { width: 6px; height: 6px; }
	.tg[aria-checked="true"] i::after { transform: translateX(8px); }
	.stage { padding-top: 34px; }
	.stage__eyebrow { display: block; }
	.stage__tools { left: 10px; top: 6px; }
	.stage__skip { top: auto; bottom: 2px; right: 6px; }
	.stage__glosses { grid-template-columns: 1fr; width: 100%; max-width: 420px; gap: 4px; margin-top: 12px; min-height: 0; }
	.gl { font-size: 14px; }
	.cell__py { font-size: 13px; height: 22px; }
	.notes { padding: 16px 14px 28px; }
	.nt__pi { padding-left: 0; padding-top: 34px; font-size: 15.5px; }
	.nt__pi::before { top: 0; }
	.nt__more, .nt__yin, .nt__sy, .nt__yw, .nt__link { margin-left: 0; }
	.title__go { flex-direction: column; align-items: stretch; padding: 0 20px; }
	.code { gap: 6px; padding: 0 8px; }
	.code__nav { width: 38px; height: 38px; }
	.ov__head { gap: 8px; padding: 10px 12px; }
	.ov__t { display: none; }
	.ov__modes { order: 3; width: 100%; justify-content: space-between; }
	.ov__modes button { padding: 6px 10px; }
	.ov__find { order: 1; flex: 1; }
	.ov__find input { width: 100%; }
	.ov__x { order: 2; margin-left: 0; }
	.ov__st { order: 4; flex-basis: 100%; }
	.ov__st:empty { display: none; }
	.ov__legend { display: none; }
	.ji__map { grid-template-columns: 1fr; }
	.jc { width: calc(50% - 7px); }
	.jc__box { width: 110px; height: 110px; }
}
@media (prefers-reduced-motion: reduce) {
	.oc { transition: none; }
}

/* ---------------------------------------------------------------- 一步步看（../assets/tour.js）
   手机上底栏分两行：上面是条码，下面留给启动钮（单开时还有右下角的「在展馆中查看」）。
   走的时候卡片在左下：宽屏把条码挪到卡片右边，窄屏把作品往上收，让出卡片的高度（--hwt-h 由 walk.js 量）；
   全景、集字、描红这几层照旧铺满，里面的东西排在卡片上方。 */
html.hwt-on .wk-pill { visibility: hidden; }
html.hwt-on .ov { padding-bottom: var(--hwt-h, 0px); }
html.hwt-on .ov__legend { bottom: calc(var(--hwt-h, 0px) + 14px); }
html.hwt-on .ji__in { padding-bottom: calc(var(--hwt-h, 0px) + 40px); }
@media (min-width: 981px) and (max-height: 860px) {
	html.hwt-on { --cell: clamp(84px, min(13.2vw, 15vh), 188px); }  /* 窗口矮时字小一点，批注和图示多露出来些 */
}
@media (min-width: 981px) {
	html.hwt-on .code, html.hwt-on body.is-solo .code { padding-left: calc(min(540px, 100vw - 24px) + 30px); padding-right: clamp(10px, 2vw, 26px); }
}
html.hwt-on .trace { padding-bottom: calc(var(--hwt-h, 0px) + 16px); }
html.hwt-on .trace__pad { width: min(320px, 76vw, calc(100dvh - var(--hwt-h, 0px) - 200px)); height: min(320px, 76vw, calc(100dvh - var(--hwt-h, 0px) - 200px)); }
@media (max-width: 980px) {
	html.hwt-on .app { height: calc(100dvh - var(--hwt-h, 0px)); }
	html.hwt-on .code, html.hwt-on body.is-solo .code { padding-left: clamp(10px, 2vw, 26px); padding-right: clamp(10px, 2vw, 26px); }
}
@media (max-width: 680px) {
	:root { --foot: 112px; }
	.code, body.is-solo .code { align-items: flex-start; padding: 9px 8px 0; }
	html.hwt-on { --foot: 58px; }
	html.hwt-on .code, html.hwt-on body.is-solo .code { align-items: center; padding: 0 8px; }
}
