/* 水运仪象台 */
:root {
	--ink: #241f1b;
	--paper: #f3ead9;
	--muted: rgba(243, 234, 217, .7);
	--faint: rgba(243, 234, 217, .44);
	--line: rgba(243, 234, 217, .15);
	--glass: rgba(10, 13, 24, .66);
	--verm: #d4532f;
	--water: #46c8e9;
	--gold: #e3bd6b;
	--serif: "Noto Serif SC", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
	--sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
	--side: 404px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: #0e1630; color: var(--paper);
	font: 15px/1.7 var(--sans);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nojs { position: fixed; inset: auto 16px 16px; z-index: 9; margin: 0; padding: 12px 16px; background: #a8432d; color: #fff; border-radius: 8px; }

/* ── 舞台 ── */
.stage { position: fixed; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tower { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.tower.is-drag { cursor: grabbing; }
.tower [data-part] { cursor: pointer; }
.tower text { font-family: var(--serif); }

.stage__note {
	position: absolute; right: calc(var(--side) + 18px); bottom: 14px; margin: 0;
	font: 12px/1 var(--serif); letter-spacing: .14em; color: var(--sky-ink, rgba(36, 31, 27, .55));
	pointer-events: none;
}
.stage__time { display: none; }
.stage__step { display: none; }

.cams {
	position: absolute; left: 18px; bottom: 12px; display: flex; gap: 4px; padding: 4px;
	background: rgba(10, 13, 24, .55); border: 1px solid var(--line); border-radius: 999px;
	-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.cams button {
	border: 0; background: none; padding: 6px 12px; border-radius: 999px;
	font: 500 13px/1.2 var(--serif); letter-spacing: .08em; color: var(--muted);
}
.cams button:hover { color: var(--paper); }
.cams button[aria-pressed="true"] { background: var(--paper); color: #1a1714; }

.toast {
	position: absolute; left: calc((100% - var(--side)) / 2); top: 18px; transform: translate(-50%, -8px);
	padding: 8px 16px 8px 14px; border-radius: 999px; white-space: nowrap;
	background: rgba(10, 13, 24, .78); border: 1px solid var(--line);
	font: 500 14px/1.3 var(--serif); letter-spacing: .06em;
	opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; background: var(--c, var(--gold)); box-shadow: 0 0 10px var(--c, var(--gold)); }

/* 部件说明 */
.info {
	position: absolute; left: 18px; bottom: 62px; width: min(372px, calc(100% - var(--side) - 36px));
	max-height: calc(100% - 140px); overflow-y: auto;
	padding: 18px 20px 16px; border-radius: 14px;
	background: rgba(246, 239, 226, .96); color: var(--ink);
	box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .55), 0 0 0 1px rgba(36, 31, 27, .08);
	user-select: text; -webkit-user-select: text; touch-action: pan-y;
}
.info[hidden] { display: none; }
.info.is-right { left: auto; right: calc(var(--side) + 18px); }
.info__x {
	position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%;
	background: none; font-size: 22px; line-height: 1; color: rgba(36, 31, 27, .6);
}
.info__x:hover { background: rgba(36, 31, 27, .08); color: var(--ink); }
.info__k { margin: 0; font: 500 12px/1.4 var(--serif); letter-spacing: .16em; color: #a8432d; }
.info__t { margin: 4px 32px 8px 0; font: 900 24px/1.3 var(--serif); letter-spacing: .06em; outline: none; }
.info__b p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.8; }
.info__q {
	margin: 10px 0 12px; padding: 10px 12px; border-left: 3px solid #a8432d; background: rgba(168, 67, 45, .07);
	font: 14px/1.85 var(--serif); color: #3a302a;
}
.info__q cite { display: block; margin-top: 4px; font: 12px/1.4 var(--sans); font-style: normal; color: rgba(58, 48, 42, .7); }
.info__go {
	margin-top: 4px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(36, 31, 27, .3);
	background: none; font: 500 13px/1.3 var(--serif); letter-spacing: .08em; color: var(--ink);
}
.info__go:hover { background: var(--ink); color: var(--paper); }

/* ── 侧栏 ── */
.side {
	position: fixed; top: 0; right: 0; bottom: 0; width: var(--side); z-index: 3;
	overflow-y: auto; overscroll-behavior: contain;
	padding: 26px 24px 24px;
	background: var(--glass); border-left: 1px solid var(--line);
	-webkit-backdrop-filter: blur(18px) saturate(125%); backdrop-filter: blur(18px) saturate(125%);
	scrollbar-width: thin; scrollbar-color: rgba(243, 234, 217, .2) transparent;
}
.head__k { margin: 0; font: 500 12px/1.5 var(--serif); letter-spacing: .14em; color: var(--gold); }
.head__t {
	margin: 6px 0 8px; font: 900 40px/1.15 var(--serif); letter-spacing: .1em;
	background: linear-gradient(180deg, #fbf4e6 30%, #c9e9f2 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.head__lede { margin: 0; font-size: 14.5px; line-height: 1.85; color: var(--muted); }

/* 时钟 */
.clock { display: flex; align-items: center; gap: 16px; margin: 20px 0 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.clock__dial { flex: none; width: 122px; height: 122px; border-radius: 50%; touch-action: none; cursor: grab; }
.clock__dial svg { display: block; width: 100%; height: 100%; overflow: visible; }
.clock__dial text { font-family: var(--serif); }
.clock__txt { min-width: 0; }
.clock__main { margin: 0; display: flex; align-items: baseline; gap: 10px; font-family: var(--serif); }
.clock__main b { font-size: 30px; font-weight: 900; letter-spacing: .08em; }
.clock__main span { font-size: 18px; font-weight: 700; color: var(--water); letter-spacing: .06em; }
.clock__sub { margin: 2px 0 0; font: 500 14px/1.5 var(--serif); color: var(--gold); letter-spacing: .1em; }
.clock__mod { margin: 4px 0 0; font-size: 12px; color: var(--faint); }
.clock__mod span { font-family: var(--mono); color: var(--muted); }
.clock__hint { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--faint); }

/* 操作 */
.ctrl { display: grid; grid-template-columns: 1.45fr 1fr; grid-template-areas: "water step" "speed speed"; gap: 8px; }
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; padding: 8px 16px; border-radius: 12px;
	border: 1px solid var(--line); background: rgba(243, 234, 217, .06);
	font: 700 16px/1.2 var(--serif); letter-spacing: .12em;
}
.btn:hover { background: rgba(243, 234, 217, .12); }
.btn--water {
	grid-area: water; min-height: 54px; font-size: 18px;
	background: linear-gradient(135deg, #1f8fb5, #46c8e9); border-color: transparent; color: #04212c;
	box-shadow: 0 12px 30px -14px rgba(70, 200, 233, .9);
}
.btn--water:hover { background: linear-gradient(135deg, #2a9cc2, #5ad3f0); }
.btn--water[aria-pressed="true"] { background: rgba(70, 200, 233, .12); border-color: rgba(70, 200, 233, .55); color: var(--water); box-shadow: none; }
.drop { width: 12px; height: 16px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: currentColor; transform: rotate(0); position: relative; }
.drop::before { content: ""; position: absolute; left: 50%; top: -5px; width: 7px; height: 7px; margin-left: -3.5px; background: currentColor; transform: rotate(45deg); }
.btn--water[aria-pressed="true"] .drop { animation: drip 1.2s ease-in infinite; }
@keyframes drip { 0% { transform: translateY(-3px); opacity: .4; } 60% { transform: translateY(2px); opacity: 1; } 100% { transform: translateY(4px); opacity: 0; } }
.speed { grid-area: speed; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; border-radius: 12px; background: rgba(243, 234, 217, .06); border: 1px solid var(--line); }
.speed button { border: 0; background: none; padding: 7px 0; border-radius: 9px; font: 500 13px/1.2 var(--mono); color: var(--muted); }
.speed button:first-child { font-family: var(--serif); letter-spacing: .06em; }
.speed button:hover { color: var(--paper); }
.speed button[aria-checked="true"] { background: var(--paper); color: #16130f; font-weight: 700; }
.btn--step { grid-area: step; flex-direction: column; gap: 1px; min-height: 54px; font-size: 16px; letter-spacing: .1em; line-height: 1.15; }
.btn--step small { display: block; font: 500 11px/1.2 var(--sans); letter-spacing: 0; color: var(--muted); }
.btn--step.is-on small { color: var(--gold); }
.btn--step.is-on { border-color: var(--gold); color: var(--gold); }
.ctrl2 { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.chip {
	padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: none;
	font: 500 13px/1.4 var(--serif); letter-spacing: .06em; color: var(--muted);
}
.chip:hover { color: var(--paper); border-color: rgba(243, 234, 217, .35); }
.chip[aria-pressed="true"], .chip[aria-expanded="true"] { color: var(--paper); border-color: rgba(243, 234, 217, .55); background: rgba(243, 234, 217, .1); }

/* 天衡放大 */
.esc { margin: 0 0 18px; }
.esc__h { margin: 0 0 10px; font: 700 16px/1.4 var(--serif); letter-spacing: .08em; }
.esc__fig { position: relative; border-radius: 14px; overflow: hidden; background: #efe5d1; box-shadow: inset 0 0 0 1px rgba(36, 31, 27, .12); }
.esc__fig svg { display: block; width: 100%; height: auto; }
.esc__fig svg text { font-family: var(--serif); }
.esc__fast {
	position: absolute; inset: 0; margin: 0; display: grid; place-content: center; text-align: center;
	background: rgba(239, 229, 209, .82); color: var(--ink); font: 500 14px/1.8 var(--serif); letter-spacing: .04em;
}
.esc__fast[hidden] { display: none; }
.esc__steps { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: st; }
.esc__steps li {
	counter-increment: st; position: relative; padding: 5px 0 5px 34px; color: var(--faint);
	font-size: 13px; line-height: 1.6; transition: color .25s;
}
.esc__steps li::before {
	content: counter(st); position: absolute; left: 0; top: 5px; width: 22px; height: 22px; border-radius: 50%;
	display: grid; place-items: center; font: 700 12px/1 var(--mono); border: 1px solid var(--line); color: var(--faint);
}
.esc__steps b { display: block; font: 700 14px/1.5 var(--serif); letter-spacing: .06em; color: var(--muted); }
.esc__steps li span { display: none; }
.esc__steps li.is-on { color: var(--muted); }
.esc__steps li.is-on b { color: var(--paper); }
.esc__steps li.is-on span { display: block; }
.esc__steps li.is-on::before { background: var(--water); border-color: var(--water); color: #04212c; }
.esc__steps li.is-done::before { border-color: rgba(70, 200, 233, .55); color: var(--water); }

/* 原文 */
.quotes { margin: 0 0 18px; padding: 16px 16px 6px; border-radius: 14px; background: rgba(243, 234, 217, .06); border: 1px solid var(--line); }
.quotes[hidden] { display: none; }
.quotes__h { margin: 0; font: 700 15px/1.4 var(--serif); letter-spacing: .06em; }
.quotes__n { margin: 2px 0 10px; font-size: 12px; color: var(--faint); }
.quotes dt { font: 700 13px/1.4 var(--serif); color: var(--gold); letter-spacing: .1em; }
.quotes dd { margin: 2px 0 12px; font: 14px/1.85 var(--serif); color: var(--muted); }

/* 页脚 */
.foot { padding-top: 14px; border-top: 1px solid var(--line); }
.foot__pick { display: flex; align-items: center; gap: 10px; font: 500 13px/1.4 var(--serif); color: var(--muted); letter-spacing: .06em; }
.foot__pick select {
	flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line);
	background: rgba(243, 234, 217, .06); font: 14px/1.4 var(--serif);
}
.foot__pick option { color: #16130f; background: #f3ead9; }
.foot__note { margin: 12px 0 0; font-size: 12px; line-height: 1.75; color: var(--faint); }

/* ── 塔上的动画元素 ── */
.tower .lbl { pointer-events: auto; }
.tower .lbl text { font-size: 21px; font-weight: 700; letter-spacing: .06em; paint-order: stroke; stroke-linejoin: round; }
.tower.no-labels .lbls { display: none; }
.tower .hl, .esc__fig .hl { animation: hl 1.3s ease-in-out infinite; }
@keyframes hl { 50% { opacity: .35; } }
.tower .wave { fill: none; stroke-linecap: round; }

/* ── 窄屏 ── */
@media (max-width: 860px) {
	body { overflow-y: auto; overflow-x: hidden; }
	.stage { position: sticky; top: 0; height: 56vh; height: 56svh; z-index: 2; }
	.side { position: relative; width: auto; inset: auto; z-index: 1; overflow: visible; padding: 18px 16px calc(150px + env(safe-area-inset-bottom)); background: #0d1222; border-left: 0; border-top: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
	.stage__note { right: 12px; bottom: 10px; font-size: 11px; letter-spacing: .08em; }
	.stage__note { display: none; }
	.stage__time {
		display: block; position: absolute; right: 10px; top: 10px; margin: 0; padding: 6px 12px; border-radius: 999px;
		background: rgba(10, 13, 24, .66); border: 1px solid var(--line); font: 500 14px/1.3 var(--serif); letter-spacing: .06em;
		-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	}
	.stage__time span { color: var(--water); }
	.cams { left: 8px; right: 8px; bottom: 8px; justify-content: space-between; }
	.stage__step:not([hidden]) {
		display: block; position: absolute; left: 8px; right: 8px; bottom: 54px; margin: 0; padding: 8px 12px 9px;
		border-radius: 12px; background: rgba(10, 13, 24, .84); border: 1px solid rgba(227, 189, 107, .35);
		font-size: 13px; line-height: 1.6; color: var(--muted);
		-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	}
	.stage__step b { display: block; font: 700 14px/1.4 var(--serif); color: var(--gold); letter-spacing: .06em; }
	.esc__fig { scroll-margin-top: calc(56svh + 6px); }
	.cams button { flex: 1; padding: 7px 0; font-size: 13px; }
	.toast { left: 50%; top: 52px; font-size: 13px; }
	.info, .info.is-right { left: 8px; right: 8px; bottom: 54px; width: auto; max-height: calc(100% - 64px); padding: 14px 16px 12px; }
	.info__t { font-size: 20px; }
	.head__t { font-size: 34px; }
	.ctrl {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
		grid-template-columns: 1.1fr 2fr 0.9fr; grid-template-areas: "water speed step"; gap: 6px; align-items: stretch;
		padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
		background: rgba(8, 11, 21, .94); border-top: 1px solid var(--line);
		-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
	}
	.btn { min-height: 46px; padding: 6px 8px; border-radius: 12px; font-size: 15px; letter-spacing: .06em; }
	.btn--water { font-size: 16px; min-height: 46px; }
	.speed { padding: 2px; border-radius: 12px; }
	.speed button { padding: 0; font-size: 11.5px; letter-spacing: 0; }
	.speed button:first-child { font-size: 12px; }
	.btn--step { font-size: 15px; min-height: 46px; }
	.btn--step small { display: none; }
	.ctrl2 { margin-top: 0; }
	.clock { margin-top: 14px; }
	.clock__dial { width: 112px; height: 112px; }
	.clock__main b { font-size: 26px; }
	.esc { scroll-margin-top: calc(56svh + 8px); }
	.quotes { scroll-margin-top: calc(56svh + 8px); }
}
@media (max-width: 380px) {
	.speed button { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
	.toast, .esc__steps li { transition: none; }
	.btn--water[aria-pressed="true"] .drop { animation: none; }
	.tower .hl, .esc__fig .hl { animation: none; }
}
/* 只看剖面（网址带 #ui=0） */
.bare .side, .bare .cams, .bare .stage__note, .bare .stage__time, .bare .toast, .bare .wk-pill, .bare .stage__step, .bare .info, .bare .ctrl { display: none !important; }
@media print {
	.ctrl, .ctrl2, .cams, .toast { display: none; }
}
