/* 投壶 · 华文道游乐区 */
:root {
	--ink: #0b0a08;
	--ink2: #14110d;
	--ink3: #1d1813;
	--paper: #f2ebde;
	--verm: #e2462b;
	--verm-d: #a8321f;
	--gold: #d9b36c;
	--gold-l: #f0d79c;
	--txt: #f2ebde;
	--txt2: rgba(242, 235, 222, .66);
	--txt3: rgba(242, 235, 222, .42);
	--line: rgba(242, 235, 222, .13);
	--line2: rgba(242, 235, 222, .26);
	--mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
	--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;
	--sat: env(safe-area-inset-top, 0px);
	--sab: env(safe-area-inset-bottom, 0px);
	--sal: env(safe-area-inset-left, 0px);
	--sar: env(safe-area-inset-right, 0px);
	--side: 20px;
	--top: 12px;
	color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
	background: var(--ink);
	color: var(--txt);
	font: 15px/1.6 var(--sans);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.sr-only {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
kbd {
	display: inline-block; min-width: 1.6em; padding: 0 .35em; margin: 0 .1em;
	font: 500 11px/1.6 var(--mono); text-align: center; color: var(--gold);
	border: 1px solid rgba(217, 179, 108, .4); border-radius: 3px; background: rgba(217, 179, 108, .06);
}

/* ---------- 舞台 ---------- */
.th {
	position: relative; width: 100%; height: 100%; min-height: 320px; overflow: hidden;
	background: var(--ink); user-select: none; -webkit-user-select: none;
}
.th-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.th-frame i {
	position: absolute; z-index: 3; width: 18px; height: 18px; pointer-events: none;
	border: 0 solid rgba(217, 179, 108, .45);
}
.th-frame i:nth-child(1) { top: calc(8px + var(--sat)); left: calc(8px + var(--sal)); border-top-width: 1px; border-left-width: 1px; }
.th-frame i:nth-child(2) { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); border-top-width: 1px; border-right-width: 1px; }
.th-frame i:nth-child(3) { bottom: calc(8px + var(--sab)); left: calc(8px + var(--sal)); border-bottom-width: 1px; border-left-width: 1px; }
.th-frame i:nth-child(4) { bottom: calc(8px + var(--sab)); right: calc(8px + var(--sar)); border-bottom-width: 1px; border-right-width: 1px; }
/* 嵌在展馆页里：左上「导览」、右上「全屏」两枚按钮的位置留空 */
.th-embed { --side: 88px; }
.th-embed .th-frame i:nth-child(1), .th-embed .th-frame i:nth-child(2) { display: none; }

/* ---------- 顶栏 ---------- */
.th-hud {
	position: absolute; z-index: 4; top: calc(var(--top) + var(--sat)); left: 50%; transform: translateX(-50%);
	width: max-content; max-width: calc(100% - 2 * var(--side));
	display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; justify-content: center;
	padding: 8px 16px; pointer-events: none;
	background: linear-gradient(rgba(11, 10, 8, .72), rgba(11, 10, 8, .5));
	border: 1px solid var(--line); border-radius: 2px;
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.th-venue { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.th-venue b { font: 600 18px/1.1 var(--serif); letter-spacing: .14em; color: var(--paper); }
.th-venue span { font-size: 10.5px; color: var(--txt3); }
.th-quiver { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; align-items: flex-end; }
.th-quiver li { width: 3px; height: 15px; background: rgba(242, 235, 222, .16); border-radius: 1px; transition: background .3s, height .3s; }
.th-quiver li.cur { background: var(--paper); height: 18px; }
.th-quiver li.hit { background: var(--gold); }
.th-quiver li.ear { background: var(--gold-l); box-shadow: 0 0 6px rgba(240, 215, 156, .7); }
.th-quiver li.void { background: rgba(217, 179, 108, .42); }
.th-quiver li.miss { background: rgba(242, 235, 222, .1); height: 9px; }
.th-quiver li.foul { background: var(--verm); }
.th-quiver li.opp { opacity: .55; }
.th-scores { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.th-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.th-stat span { font-size: 9.5px; color: var(--txt3); letter-spacing: .14em; }
.th-stat b { font: 500 16px/1.2 var(--mono); color: var(--paper); font-variant-numeric: tabular-nums; }
.th-stat b small { font-size: 10px; color: var(--txt3); }
.th-stat.on span { color: var(--gold); }
.th-stat.on b { color: var(--gold-l); }
.th-stat .ma { font-size: 10px; color: var(--verm); letter-spacing: 0; }
.th-stat b.up { animation: thPop .5s ease-out; }
@keyframes thPop { 35% { transform: scale(1.22); color: var(--gold-l); } }
.th-turn { font: 500 10.5px/1.2 var(--mono); color: var(--txt3); text-align: center; }
.th-turn b { display: block; font: 600 13px/1.3 var(--serif); color: var(--gold); letter-spacing: .1em; }
.th-wind { flex-basis: 100%; margin: 0; text-align: center; font-size: 10.5px; color: var(--txt2); }
.th-wind i { font-style: normal; color: var(--gold); }
.th-wind em { font-style: normal; color: var(--txt3); }

/* ---------- 司射报算 ---------- */
.th-caller {
	position: absolute; z-index: 4; left: 50%; bottom: calc(18px + var(--sab)); transform: translateX(-50%);
	display: flex; align-items: center; gap: 12px; max-width: calc(100% - 2 * 176px);
	margin: 0; padding: 8px 18px 8px 10px; pointer-events: none;
	background: rgba(11, 10, 8, .74); border: 1px solid rgba(217, 179, 108, .3); border-radius: 2px;
	animation: thIn .35s ease-out;
}
.th-caller .who {
	flex: none; display: grid; place-items: center; width: 30px; height: 30px;
	font: 700 12px/1.05 var(--serif); color: var(--paper); background: var(--verm-d); border-radius: 2px;
	writing-mode: vertical-rl; letter-spacing: .05em;
}
.th-caller .say { font: 500 16px/1.4 var(--serif); letter-spacing: .06em; color: var(--paper); }
.th-caller .say small { display: block; font: 500 10.5px/1.4 var(--mono); color: var(--txt3); letter-spacing: .04em; }
.th-caller.host .who { background: #2a3246; }
.th-caller.guest .who { background: #7a2617; }
@keyframes thIn { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- 接箭 ---------- */
.th-catch {
	position: absolute; z-index: 5; left: 50%; top: 38%; transform: translate(-50%, -50%);
	display: grid; place-items: center; gap: 2px; width: 92px; height: 92px; padding: 0;
	font: 700 30px/1 var(--serif); color: var(--paper);
	background: radial-gradient(circle, rgba(226, 70, 43, .9), rgba(168, 50, 31, .85));
	border: 1px solid var(--gold-l); border-radius: 50%;
	box-shadow: 0 0 0 6px rgba(226, 70, 43, .18), 0 0 30px rgba(226, 70, 43, .5);
	animation: thPulse .5s ease-in-out infinite alternate;
}
.th-catch small { font-size: 9px; color: rgba(242, 235, 222, .8); letter-spacing: .02em; }
@keyframes thPulse { to { box-shadow: 0 0 0 14px rgba(226, 70, 43, .06), 0 0 40px rgba(226, 70, 43, .7); } }

/* ---------- 左下角按钮 ---------- */
.th-ctrl {
	position: absolute; z-index: 4; left: calc(18px + var(--sal)); bottom: calc(18px + var(--sab));
	display: flex; align-items: center; gap: 8px;
}
.th-ib {
	display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
	background: rgba(20, 17, 13, .6); border: 1px solid var(--line2); border-radius: 50%;
	color: var(--txt2); transition: color .2s, border-color .2s;
}
.th-ib:hover { color: var(--paper); border-color: rgba(217, 179, 108, .7); }
.th-ib svg { width: 16px; height: 16px; }
.th-ib[aria-pressed="false"] .on, .th-ib[aria-pressed="true"] .off { display: none; }
.th-tip {
	margin: 0 0 0 6px; padding: 4px 10px; font-size: 10.5px; color: var(--txt3); letter-spacing: .05em;
	background: rgba(11, 10, 8, .6); border-radius: 999px; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis;
}
.th-tip b { color: var(--gold); font-weight: 500; }
.th-ib:focus-visible, .th-mode:focus-visible, .th-btn:focus-visible, .th-link:focus-visible, .th-x:focus-visible, .th-catch:focus-visible {
	outline: 2px solid var(--gold); outline-offset: 2px;
}

/* ---------- 浮层 ---------- */
.th-ov {
	position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
	padding: calc(56px + var(--sat)) 16px calc(24px + var(--sab));
	background: radial-gradient(120% 90% at 50% 40%, rgba(11, 10, 8, .55), rgba(11, 10, 8, .88));
	overflow-y: auto; overscroll-behavior: contain;
	animation: thFade .3s ease-out;
}
.th-solo .th-ov { padding-bottom: calc(66px + var(--sab)); }
.th-ov-bg { position: fixed; inset: 0; }
@keyframes thFade { from { opacity: 0; } }
.th-card {
	position: relative; width: 100%; max-width: 560px; margin: auto; padding: 26px 28px 24px;
	background: linear-gradient(180deg, rgba(29, 24, 19, .96), rgba(20, 17, 13, .97));
	border: 1px solid var(--line2); border-radius: 2px;
	box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8);
	--c: rgba(217, 179, 108, .75);
	background-image:
		linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
		linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
		linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
		linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
		linear-gradient(180deg, rgba(29, 24, 19, .96), rgba(20, 17, 13, .97));
	background-size: 14px 1px, 1px 14px, 14px 1px, 1px 14px, 14px 1px, 1px 14px, 14px 1px, 1px 14px, auto;
	background-position: -1px -1px, -1px -1px, calc(100% + 1px) -1px, calc(100% + 1px) -1px,
		-1px calc(100% + 1px), -1px calc(100% + 1px), calc(100% + 1px) calc(100% + 1px), calc(100% + 1px) calc(100% + 1px), 0 0;
	background-repeat: no-repeat;
}
.th-k { margin: 0 0 6px; font-size: 10.5px; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; }
.th-card h1 { margin: 0; font: 600 52px/1.05 var(--serif); letter-spacing: .3em; color: var(--paper); }
.th-card h2 { margin: 0 0 10px; font: 600 26px/1.25 var(--serif); letter-spacing: .1em; }
.th-card h3 {
	display: flex; align-items: center; gap: 10px; margin: 22px 0 8px;
	font: 600 15px/1.4 var(--serif); letter-spacing: .12em; color: var(--gold-l);
}
.th-card h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.th-card p, .th-card li, .th-card dd { color: var(--txt2); font-size: 14px; line-height: 1.75; }
.th-card ul { margin: 0; padding-left: 1.1em; }
.th-card li { margin: 4px 0; }
.th-q {
	margin: 14px 0 10px; padding: 8px 0 8px 14px; border-left: 2px solid var(--verm);
	font: 500 17px/1.6 var(--serif); color: var(--paper); letter-spacing: .04em;
}
.th-q cite { display: block; margin-top: 2px; font: normal 11px/1.5 var(--mono); color: var(--txt3); }
.th-lede { margin: 0 0 18px; }
.th-modes { display: grid; gap: 10px; }
.th-mode {
	position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px;
	padding: 12px 52px 12px 16px; text-align: left;
	background: rgba(242, 235, 222, .03); border: 1px solid var(--line2); border-radius: 2px;
	transition: border-color .2s, background .2s;
}
.th-mode b { grid-row: span 1; font: 600 20px/1.2 var(--serif); letter-spacing: .12em; color: var(--paper); white-space: nowrap; }
.th-mode span { font-size: 12.5px; line-height: 1.5; color: var(--txt2); }
.th-mode kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.th-mode:hover { border-color: rgba(217, 179, 108, .7); background: rgba(217, 179, 108, .06); }
.th-mode--pri { border-color: rgba(226, 70, 43, .7); background: rgba(226, 70, 43, .08); }
.th-mode--pri:hover { border-color: var(--verm); background: rgba(226, 70, 43, .14); }
.th-best { margin: 14px 0 0; font-size: 11px; color: var(--txt3); }
.th-best b { color: var(--gold); font-weight: 500; }
.th-link {
	margin-top: 10px; padding: 0; background: none; border: 0; font-size: 13px; color: var(--gold);
	text-decoration: underline; text-decoration-color: rgba(217, 179, 108, .4); text-underline-offset: 3px;
}
.th-x {
	position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
	background: none; border: 1px solid var(--line2); border-radius: 50%; color: var(--txt2);
}
.th-x svg { width: 12px; height: 12px; }
.th-x:hover { color: var(--paper); border-color: var(--gold); }
.th-card--help { max-width: 640px; }
.th-rules { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.th-rules dt { font: 600 14px/1.75 var(--serif); color: var(--paper); white-space: nowrap; letter-spacing: .04em; }
.th-rules dt b { margin-left: 6px; font: 500 11px/1 var(--mono); color: var(--gold); }
.th-rules dd { margin: 0; }
.th-src { margin-top: 18px !important; font-size: 10.5px !important; color: var(--txt3) !important; line-height: 1.7 !important; }

/* ---------- 小结 ---------- */
.th-rite { margin: 4px 0 12px; display: grid; gap: 4px; }
.th-rite p { margin: 0; display: flex; gap: 10px; align-items: baseline; font: 500 15px/1.6 var(--serif); color: var(--paper); }
.th-rite p span { flex: none; width: 3.2em; font: 500 11px/1.6 var(--mono); color: var(--txt3); text-align: right; }
.th-rite p em { font-style: normal; font: 11px/1.6 var(--mono); color: var(--txt3); }
.th-rite p.big { font-size: 18px; color: var(--gold-l); }
.th-tbl { max-height: 42vh; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.th-tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.th-tbl th { position: sticky; top: 0; padding: 6px 6px; font: 500 10px/1.4 var(--mono); color: var(--txt3); text-align: left; letter-spacing: .1em; background: #1a1611; }
.th-tbl td { padding: 4px 6px; border-top: 1px solid rgba(242, 235, 222, .06); color: var(--txt2); white-space: nowrap; }
.th-tbl td.n { font: 11px/1.6 var(--mono); color: var(--txt3); width: 2.4em; }
.th-tbl td.nm { font-family: var(--serif); color: var(--paper); }
.th-tbl td.pt { font-family: var(--mono); text-align: right; color: var(--gold); width: 3.4em; }
.th-tbl td.miss { color: var(--txt3); }
.th-tbl td.foul { color: var(--verm); }
.th-tbl tfoot td { font-family: var(--mono); color: var(--paper); border-top: 1px solid var(--line2); }
.th-note { margin: 10px 0 0; font-size: 12.5px !important; }
.th-act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.th-btn {
	display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
	font: 600 14px/1.2 var(--sans); letter-spacing: .06em; color: var(--paper);
	background: rgba(242, 235, 222, .04); border: 1px solid var(--line2); border-radius: 2px;
}
.th-btn:hover { border-color: var(--gold); }
.th-btn--pri { background: var(--verm-d); border-color: var(--verm); }
.th-btn--pri:hover { background: var(--verm); }
.th-btn kbd { color: var(--paper); border-color: rgba(242, 235, 222, .35); background: none; }

/* ---------- 小屏 ---------- */
@media (max-width: 760px) {
	.th-hud { gap: 6px 12px; padding: 6px 12px; }
	.th-venue span { display: none; }
	.th-caller { max-width: calc(100% - 28px); bottom: calc(64px + var(--sab)); }
	.th-tip { display: none; }
}
@media (max-width: 600px) {
	.th-embed { --side: 12px; --top: 52px; }
	.th-hud { width: calc(100% - 2 * var(--side)); }
	.th-card { padding: 22px 18px 20px; }
	.th-card h1 { font-size: 42px; }
	.th-rules { grid-template-columns: 1fr; gap: 0; }
	.th-rules dd { margin-bottom: 8px; }
	.th-caller .say { font-size: 14.5px; }
}
@media (max-width: 400px) {
	.th-quiver { gap: 3px; }
	.th-quiver li { width: 2.5px; }
	.th-scores { gap: 10px; }
	.th-venue b { font-size: 16px; }
	.th-mode { padding-right: 16px; grid-template-columns: 1fr; }
	.th-mode kbd { display: none; }
}
@media (max-height: 560px) {
	.th-ov { padding-top: calc(48px + var(--sat)); }
	.th-card h1 { font-size: 38px; }
	.th-q { margin: 8px 0; font-size: 15px; }
	.th-lede { font-size: 13px !important; margin-bottom: 12px; }
}
@media (hover: none) { .th-mode kbd, .th-btn kbd { display: none; } }
@media (prefers-reduced-motion: reduce) {
	.th-caller, .th-ov { animation: none; }
	.th-catch { animation: none; }
	.th-stat b.up { animation: none; }
}
.th-tip:empty { display: none; }

/* ---------- 一步步看 ---------- */
/* 启动钮在右上角，只在开场和「规则与来历」里出现；投壶时收起，不挡顶栏（左下角的 ☰ 回到开场就能找到它） */
html.th-play:not(.hwt-on) .hwt[data-hwt] .hwt-launch { display: none !important; }
/* 走的时候：卡片放到底下正中，舞台往上收，让出卡片的高度 */
html.hwt-on .hwt[data-hwt] { top: auto !important; right: auto !important; left: 50% !important; bottom: max(12px, env(safe-area-inset-bottom)) !important; transform: translateX(-50%) !important; }
html.hwt-on .th { height: calc(100% - var(--hwt-h, 200px)); min-height: 0; }
html.hwt-on .wk-pill { visibility: hidden; }
.th-rules + .th-rules { margin-top: 6px; }
.th-rules { grid-template-columns: 117px 1fr; }   /* 分成几段以后，左边一栏照旧对齐 */
@media (max-width: 600px) { .th-rules + .th-rules { margin-top: 0; } .th-rules { grid-template-columns: 1fr; } }
.th-card--help > p.th-k { margin-right: 44px; }   /* 第一行不伸到右上角的关闭钮下面 */
