/* 華·文·道 · 版面：画布铺满；左上角题名，画面下方一段说明，最底下一排控制。夜（默认）与纸两种纸色。 */
:root {
	--bg: #07080c; --fg: #f3eee4; --dim: rgba(243, 238, 228, .66); --gold: #e3c27a; --gold2: #f2d68e; --zhu: #e8402c;
	--panel: rgba(16, 17, 23, .74); --line: rgba(243, 238, 228, .16); --hover: rgba(243, 238, 228, .1); --on: rgba(227, 194, 122, .16);
	--font: 'HW Huawen', 'Noto Serif SC', 'Noto Serif CJK SC', 'Songti SC', 'STSong', serif;
}
body[data-theme="paper"] {
	--bg: #ece3cf; --fg: #231d16; --dim: rgba(35, 29, 22, .66); --gold: #8a6420; --gold2: #6f4f14; --zhu: #a8321f;
	--panel: rgba(250, 245, 234, .84); --line: rgba(35, 29, 22, .16); --hover: rgba(35, 29, 22, .07); --on: rgba(138, 100, 32, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 400 15px/1.6 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; transition: background .4s, color .4s; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; cursor: crosshair; outline: none; }
#stage:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }

/* 题名 */
.mast { position: fixed; top: max(14px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); z-index: 2; pointer-events: none; }
.brand { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.brand b { font-weight: 600; font-size: 21px; line-height: 1.2; letter-spacing: .22em; color: var(--fg); }
.brand span { font-size: 12px; letter-spacing: .32em; color: var(--gold); }
html[lang="en"] .brand b { letter-spacing: .08em; }
html[lang="en"] .brand span { letter-spacing: .14em; }

/* 说明 */
.cap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px); z-index: 2; width: min(700px, calc(100vw - 32px));
	min-height: 92px; margin: 0; text-align: center; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end; }
.cap p { margin: 0; }
.cap__k { font-size: 12px; letter-spacing: .24em; color: var(--gold); margin-bottom: 4px !important; }
.cap__t { font-size: 17px; line-height: 1.55; letter-spacing: .06em; text-wrap: balance; }
html[lang="en"] .cap__t { letter-spacing: 0; font-size: 16px; }
.cap__o { font-size: 13px; color: var(--dim); letter-spacing: .1em; margin-top: 2px !important; }
.cap__s { font-size: 12.5px; color: var(--dim); margin-top: 3px !important; }
.cap.is-in .cap__k, .cap.is-in .cap__t, .cap.is-in .cap__o, .cap.is-in .cap__s { animation: cap-in .9s ease both; }
.cap.is-in .cap__t { animation-delay: .08s; } .cap.is-in .cap__s { animation-delay: .16s; }
@keyframes cap-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hint { font-size: 12.5px; color: var(--gold2); opacity: 0; transition: opacity .6s; margin-top: 6px !important; min-height: 1.4em; }
.hint.is-on { opacity: .92; }

/* 控制 */
.dock { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 6px; padding: 5px;
	background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.dock button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.dock button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.seg { display: flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); }
.seg button { display: flex; align-items: baseline; gap: 5px; padding: 7px 12px; border-radius: 999px; white-space: nowrap; }
.seg button b { font-size: 18px; font-weight: 600; line-height: 1; }
.seg button small { font-size: 11.5px; color: var(--dim); }
.seg button:hover { background: var(--hover); }
.seg button[aria-checked="true"] { background: var(--on); box-shadow: inset 0 0 0 1px var(--gold); }
.seg button[aria-checked="true"] b { color: var(--gold2); }
.acts { display: flex; gap: 2px; }
.act { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; white-space: nowrap; font-size: 13.5px; }
.act:hover { background: var(--hover); }
.act--icon { width: 36px; padding: 0; justify-content: center; }
.act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.act svg .fill { fill: currentColor; stroke: none; }
#b-music[aria-pressed="true"] { background: var(--on); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold2); }
#b-play .i-play { display: none; }
#b-play[aria-pressed="true"] .i-play { display: block; }
#b-play[aria-pressed="true"] .i-pause { display: none; }

/* 小屏：控制排成两行，说明往上挪 */
@media (max-width: 760px) {
	.dock { flex-direction: column; gap: 4px; border-radius: 18px; padding: 6px; width: calc(100vw - 20px); max-width: 460px; }
	.seg { border-right: 0; padding-right: 0; width: 100%; justify-content: space-between; }
	.seg button { flex: 1; justify-content: center; padding: 7px 4px; gap: 4px; }
	.acts { width: 100%; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 4px; }
	.act { padding: 0 8px; font-size: 13px; }
	.cap { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 112px); min-height: 84px; }
	.cap__t { font-size: 15.5px; }
	.brand b { font-size: 18px; }
}
@media (max-width: 380px) { .seg button small { display: none; } }
/* 窄屏：「配乐」只留图标（读屏器照样读得到字），按钮排放得下 */
@media (max-width: 420px) {
	#b-music { width: 36px; padding: 0; justify-content: center; flex: none; }
	#b-music span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.act { padding: 0 7px; flex: none; }
}
@media (max-width: 345px) {   /* 英文的字更宽：再窄一点，「纸色」也只留图标 */
	html[lang="en"] #b-theme { width: 36px; padding: 0; justify-content: center; }
	html[lang="en"] #b-theme span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-height: 520px) and (min-width: 761px) { .cap { min-height: 0; } .cap__s, .hint { display: none; } }

/* 单独打开、窄屏时，「一步步看」挪到右上，不压题名（嵌在网站作品页里时它是藏起来的） */
@media (max-width: 520px) {
	.hwt:not(.hwt-list):has(> .hwt-launch:not([hidden])) { left: auto !important; right: 60px !important; transform: none !important; }
	html[lang="en"] .brand span { letter-spacing: .05em; }
}
/* 英文的「Step by step」比中文宽：440px 以下挪到题名下面一行，「第一次来」的提示放到按钮下面，不压题名 */
@media (max-width: 440px) {
	html[lang="en"] .hwt:not(.hwt-list):has(> .hwt-launch:not([hidden])) { top: 64px !important; right: 12px !important; }
	html[lang="en"] .hwt .hwt-hint { bottom: auto; top: calc(100% + 8px); }
	html[lang="en"] .hwt .hwt-hint::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ta); }
}

/* 出海报、缩略图用（?bare）：只留画面 */
html.bare .mast, html.bare .cap, html.bare .dock, html.bare .toast, html.bare .wk-pill, html.bare .hwt { display: none !important; }

/* 提示 */
.toast { position: fixed; left: 50%; top: max(18px, env(safe-area-inset-top)); transform: translate(-50%, -8px); z-index: 4; margin: 0; padding: 6px 14px; border-radius: 999px;
	background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.nojs { position: fixed; inset: auto 16px 40% 16px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .cap.is-in p { animation: none !important; } .toast, .hint { transition: none; } }
