/* 山水引擎 · 界面：宣纸就是界面。墨色文字、发丝线、极少的面板。 */
@property --ink { syntax: '<color>'; inherits: true; initial-value: #221f1a; }
@property --ink-2 { syntax: '<color>'; inherits: true; initial-value: rgba(34, 31, 26, .64); }
@property --ink-3 { syntax: '<color>'; inherits: true; initial-value: rgba(34, 31, 26, .4); }
@property --hair { syntax: '<color>'; inherits: true; initial-value: rgba(34, 31, 26, .2); }
@property --glass { syntax: '<color>'; inherits: true; initial-value: rgba(236, 229, 213, .58); }
@property --glow { syntax: '<color>'; inherits: true; initial-value: rgba(236, 229, 213, .9); }
@property --on-ink { syntax: '<color>'; inherits: true; initial-value: #ece5d5; }

:root {
	--paper: #ece5d5;
	--ink: #221f1a;
	--ink-2: rgba(34, 31, 26, .64);
	--ink-3: rgba(34, 31, 26, .4);
	--hair: rgba(34, 31, 26, .2);
	--glass: rgba(236, 229, 213, .58);
	--glow: rgba(236, 229, 213, .9);
	--on-ink: #ece5d5;
	--seal: #b3372d;
	--serif: "Noto Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", serif;
	--mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	--grot: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
	--ease: cubic-bezier(.2, .75, .2, 1);
	--wk-pill-bg: rgba(236, 229, 213, .74);
	--wk-pill-fg: #221f1a;
	--wk-pill-line: rgba(34, 31, 26, .16);
	--wk-pill-accent: #221f1a;
	--wk-pill-accent-fg: #ece5d5;
}
body[data-tone="dark"] {
	--ink: #eceef2;
	--ink-2: rgba(236, 238, 242, .7);
	--ink-3: rgba(236, 238, 242, .44);
	--hair: rgba(236, 238, 242, .22);
	--glass: rgba(14, 18, 28, .42);
	--glow: rgba(12, 16, 26, .72);
	--on-ink: #141824;
	--wk-pill-bg: rgba(14, 18, 28, .58);
	--wk-pill-fg: #eceef2;
	--wk-pill-line: rgba(236, 238, 242, .18);
	--wk-pill-accent: #eceef2;
	--wk-pill-accent-fg: #141824;
}

* { box-sizing: border-box; }
html, body {
	margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
	background: var(--paper); color: var(--ink);
	font-family: var(--serif); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body { transition: --ink .9s, --ink-2 .9s, --ink-3 .9s, --hair .9s, --glass .9s, --glow .9s, --on-ink .9s; }
body.boot, body.boot *, body.boot *::before, body.boot *::after { transition: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- 画布 ---------- */
#scroll {
	position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block;
	cursor: grab; touch-action: none; outline: none;
}
#scroll.is-drag { cursor: grabbing; }
#scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--ink-3); }
.veil {
	position: fixed; inset: 0; background: var(--paper); pointer-events: none; z-index: 2;
	transition: opacity 1.1s ease;
}
body.is-live .veil { opacity: 0; }

/* ---------- 刊头与 HUD ---------- */
.mast {
	position: fixed; z-index: 5; top: max(20px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left));
	pointer-events: none; transition: opacity .6s ease, transform .6s var(--ease);
}
.brand { margin: 0; display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.brand__zh { font-weight: 700; font-size: 15px; letter-spacing: .32em; color: var(--ink); }
.brand__en { font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; color: var(--ink-2); }
.brand__en i { font-style: normal; color: var(--seal); padding: 0 .2em; }
.hud {
	margin-top: 9px; display: flex; align-items: center; gap: 14px;
	font-family: var(--mono); font-size: 10px; line-height: 1; letter-spacing: .06em; color: var(--ink-2);
	white-space: nowrap; font-variant-numeric: tabular-nums;
}
.hud b { font-weight: 400; color: var(--ink-3); margin-right: 6px; }
.hud em { font-style: normal; color: var(--ink); }
.hud__live { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.hud__live i { width: 6px; height: 6px; border-radius: 50%; background: var(--seal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--seal) 22%, transparent); animation: live 2.4s ease-in-out infinite; }
body.is-paused .hud__live i { background: var(--ink-3); box-shadow: none; animation: none; }
@keyframes live { 50% { opacity: .35; } }
#h-graph { width: 56px; height: 12px; display: block; opacity: .9; }

/* ---------- 题画：右侧竖排 ---------- */
.inscription {
	position: fixed; z-index: 4; top: clamp(70px, 10vh, 104px); right: clamp(20px, 4.4vw, 72px);
	display: flex; flex-direction: row-reverse; align-items: flex-start; gap: clamp(14px, 1.5vw, 24px);
	pointer-events: none; color: var(--ink);
	text-shadow: 0 0 18px var(--glow), 0 0 3px var(--glow);
	transition: opacity .7s ease, transform .7s var(--ease);
}
.poem {
	writing-mode: vertical-rl; font-weight: 500; font-size: clamp(22px, 2.1vw, 32px);
	line-height: 1.8; letter-spacing: .26em; margin: 0;
}
.poem p { margin: 0; }
.poem span { display: inline-block; animation: inkIn 1.1s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
.poem.is-out span { animation: inkOut .45s ease both; animation-delay: calc(var(--i) * 18ms); }
@keyframes inkIn { from { opacity: 0; filter: blur(7px); transform: translateY(-.25em) scale(1.06); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes inkOut { to { opacity: 0; filter: blur(6px); transform: translateY(.2em); } }
.poem__src {
	writing-mode: vertical-rl; margin: 0; padding-top: 3.4em;
	font-size: 12.5px; letter-spacing: .3em; color: var(--ink-2);
	transition: opacity .6s ease;
}
.colophon { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 8px; margin-right: clamp(6px, 1.2vw, 18px); }
.title {
	writing-mode: vertical-rl; margin: 0; font-weight: 700; font-size: clamp(17px, 1.45vw, 22px);
	letter-spacing: .36em; color: var(--ink);
}
.kuan-col { display: flex; flex-direction: column; align-items: center; padding-top: 1.2em; }
.kuan { writing-mode: vertical-rl; margin: 0; font-size: 11.5px; letter-spacing: .28em; color: var(--ink-2); }
.seal { display: block; width: 34px; height: 44px; margin-top: 10px; text-shadow: none; filter: none; }
.seal.is-stamp { animation: stamp .7s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.5) rotate(-8deg); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(1) rotate(-1.5deg); } }
.seal { transform: rotate(-1.5deg); }

/* ---------- 控制坞 ---------- */
.dock {
	position: fixed; z-index: 6; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
	display: flex; align-items: center; gap: 4px; padding: 5px;
	border-radius: 999px; background: var(--glass); border: 1px solid var(--hair);
	-webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
	box-shadow: 0 12px 34px -14px rgba(20, 16, 10, .35);
	color: var(--ink);
}
.seg { position: relative; display: flex; align-items: center; border: 0; margin: 0; padding: 0 4px 0 10px; min-width: 0; }
.seg + .seg { border-left: 1px solid var(--hair); }
.seg__k { font-size: 10.5px; color: var(--ink-3); margin-right: 5px; letter-spacing: .1em; }
.seg label { position: relative; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg label span { font-size: 15px; line-height: 1; color: var(--ink-2); transition: color .35s ease; pointer-events: none; }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { color: var(--on-ink); }
.seg input:focus-visible + span { outline: 1.5px solid var(--ink); outline-offset: 7px; border-radius: 50%; }
.seg__ink {
	position: absolute; z-index: 0; left: 0; top: 50%; width: 30px; height: 30px; margin-top: -15px;
	border-radius: 47% 53% 51% 49% / 55% 46% 54% 45%; background: var(--ink);
	transform: translateX(var(--x, 0px)); transition: transform .5s var(--ease), background-color .9s;
	opacity: 0;
}
.seg.is-ready .seg__ink { opacity: 1; }
.seg.is-hop .seg__ink { animation: hop .5s var(--ease); }
@keyframes hop { 40% { border-radius: 40% 60% 46% 54% / 60% 42% 58% 40%; scale: 1.12 .9; } }
.acts { display: flex; align-items: center; gap: 2px; padding-left: 5px; border-left: 1px solid var(--hair); }
.act {
	all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
	border-radius: 999px; font-family: var(--serif); font-size: 13.5px; letter-spacing: .08em; color: var(--ink);
	cursor: pointer; white-space: nowrap; transition: background-color .25s ease, color .25s ease;
}
.act:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.act:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; }
.act svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.act--new svg circle { fill: var(--seal); stroke: none; }
.act--new:active svg { transform: rotate(-30deg); transition: transform .2s; }
.act[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.act--icon { width: 30px; padding: 0; justify-content: center; }
.act--icon .i-play { display: none; fill: currentColor; stroke: none; }
.act--icon[aria-pressed="true"] .i-play { display: block; }
.act--icon[aria-pressed="true"] .i-pause { display: none; }
.act[aria-busy="true"] { cursor: progress; }
.act--snd .i-on { display: none; }
.act--snd[aria-pressed="true"] .i-on { display: block; }
.act--snd[aria-pressed="true"] .i-off { display: none; }

/* ---------- 提示 ---------- */
.toast {
	position: fixed; z-index: 7; left: 50%; bottom: 74px; margin: 0; transform: translate(-50%, 8px);
	padding: 7px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--hair);
	-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
	font-size: 12.5px; letter-spacing: .1em; color: var(--ink); white-space: nowrap;
	opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 首屏预览：一个虚构网站 ---------- */
.demo { position: fixed; inset: 0; z-index: 3; pointer-events: none; color: var(--ink); }
.demo[hidden] { display: none; }
.demo::before {
	content: ""; position: absolute; inset: 0;
	background: radial-gradient(ellipse 62% 58% at 22% 52%, var(--glow), transparent 72%);
	opacity: .5;
}
.demo > * { animation: rise .9s var(--ease) both; }
.demo__bar {
	position: absolute; top: 0; left: 0; right: 0; height: 74px; display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px);
	padding: 0 clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--hair);
}
.demo__logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .28em; white-space: nowrap; }
.demo__logo i { display: inline-grid; place-items: center; width: 26px; height: 26px; font-style: normal; font-weight: 900; font-size: 14px; letter-spacing: 0; color: #f4ede0; background: var(--seal); border-radius: 3px; }
.demo__logo small { font-family: var(--grot); font-weight: 500; font-size: 10px; letter-spacing: .24em; color: var(--ink-2); }
.demo__tag { padding: 3px 9px; border: 1px solid var(--seal); border-radius: 999px; color: var(--seal); font-size: 11.5px; letter-spacing: .14em; white-space: nowrap; background: color-mix(in srgb, var(--paper) 55%, transparent); }
body[data-tone="dark"] .demo__tag { color: #f08a7f; border-color: #f08a7f; background: rgba(14, 18, 28, .4); }
.demo__links { margin-left: auto; display: flex; gap: clamp(16px, 2.2vw, 30px); font-size: 14px; letter-spacing: .14em; color: var(--ink-2); }
.demo__cta { padding: 9px 18px; border: 1px solid var(--ink); border-radius: 999px; font-size: 13.5px; letter-spacing: .14em; white-space: nowrap; }
.demo__hero { position: absolute; left: clamp(24px, 7.5vw, 128px); top: 50%; transform: translateY(-56%); max-width: min(640px, 64vw); }
.demo__kick { margin: 0; font-family: var(--grot); font-size: 11.5px; letter-spacing: .3em; color: var(--ink-2); }
.demo__kick i { font-style: normal; color: var(--seal); }
.demo__h {
	margin: .32em 0 .28em; font-weight: 900; font-size: clamp(46px, 7.2vw, 112px); line-height: 1.08; letter-spacing: .05em;
	text-shadow: 0 0 30px var(--glow);
}
.demo__sub { margin: 0; max-width: 27em; font-size: clamp(14px, 1.15vw, 16.5px); line-height: 1.95; letter-spacing: .06em; color: var(--ink-2); text-shadow: 0 0 12px var(--glow); }
.demo__btns { margin: 30px 0 0; display: flex; gap: 12px; }
.demo__b { padding: 12px 22px; border: 1px solid var(--ink); border-radius: 999px; font-size: 14.5px; letter-spacing: .16em; white-space: nowrap; }
.demo__b--solid { background: var(--ink); color: var(--on-ink); }
.demo__note {
	position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); margin: 0;
	padding: 6px 13px; border-radius: 999px; background: var(--glass); border: 1px solid var(--hair);
	-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
	font-size: 11.5px; letter-spacing: .08em; color: var(--ink-2); white-space: nowrap;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.demo__hero { animation-name: riseC; }
@keyframes riseC { from { opacity: 0; transform: translateY(calc(-56% + 18px)); } }
body.is-hero .inscription { opacity: 0; transform: translateX(16px); }
body.is-hero .mast { opacity: 0; transform: translateY(-8px); }

.nogl { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; font-size: 15px; letter-spacing: .1em; color: var(--ink-2); z-index: 8; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) {
	.hud__opt { display: none; }
}
@media (max-width: 1040px) {
	/* 中等宽度：动作按钮只留图标，给左下角的浮标让位 */
	.act { width: 32px; padding: 0; justify-content: center; }
	.act span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
	.inscription { top: 86px; }
}
@media (max-width: 860px) {
	/* 再窄一些：控制坞挪到浮标上方 */
	.dock { right: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px); }
	.toast { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 104px); }
}
@media (max-width: 760px) and (min-height: 561px) {
	.mast { top: max(14px, env(safe-area-inset-top)); left: 16px; }
	.brand { gap: 8px; }
	.brand__zh { font-size: 14px; }
	.brand__en { font-size: 8.5px; letter-spacing: .14em; }
	.hud { gap: 10px; margin-top: 7px; font-size: 9.5px; }
	#h-graph { width: 40px; }
	.inscription { top: 76px; right: 14px; gap: 10px; }
	.poem { font-size: clamp(18px, 5.1vw, 23px); letter-spacing: .2em; line-height: 1.7; }
	.poem__src { font-size: 11px; padding-top: 2.6em; }
	.title { font-size: 15px; letter-spacing: .3em; }
	.kuan { font-size: 10.5px; }
	.seal { width: 27px; height: 35px; margin-top: 8px; }
	.dock {
		left: 12px; right: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px);
		flex-wrap: wrap; justify-content: center; gap: 4px 0; border-radius: 20px; padding: 6px 4px;
	}
	.seg { padding: 0 2px 0 8px; }
	.seg label { width: 31px; height: 31px; }
	.seg__ink { width: 31px; height: 31px; margin-top: -15.5px; }
	.acts { width: 100%; justify-content: space-between; border-left: 0; border-top: 1px solid var(--hair); padding: 5px 2px 0; }
	.act { width: auto; padding: 0 9px; font-size: 13px; gap: 5px; }
	.act span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
	.act--icon { width: 30px; padding: 0; }
	.toast { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); }
	.demo__bar { height: 60px; gap: 10px; }
	.demo__logo { font-size: 15px; letter-spacing: .18em; }
	.demo__logo small, .demo__links { display: none; }
	.demo__cta { margin-left: auto; padding: 7px 12px; font-size: 12px; }
	.demo__hero { left: 22px; right: 22px; top: 40%; max-width: none; }
	.demo__h { font-size: clamp(40px, 12.5vw, 60px); }
	.demo__sub { font-size: 13.5px; }
	.demo__btns { margin-top: 22px; }
	.demo__b { padding: 10px 16px; font-size: 13px; }
	.demo__note { bottom: auto; top: 68px; white-space: normal; width: max-content; max-width: calc(100vw - 28px); text-align: center; font-size: 11px; }
}
@media (max-width: 360px) {
	.seg__k { display: none; }
	.act { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
	body { transition: none; }
}
