/* 瓯绣针法图谱 · 样式：胡桃木绣台 + 竹绷 + 米色绢面 */
:root {
  --wood: #2a1a12;
  --wood-2: #3a261b;
  --gold: #c9a45c;
  --gold-2: #ecd39a;
  --gold-dim: rgba(201, 164, 92, .35);
  --cream: #f3eee3;
  --ink: #2a211b;
  --text: #efe5d0;
  --muted: #b3a081;
  --seal: #a8281e;
  --glass: rgba(34, 24, 18, .72);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --latin: "Cormorant Garamond", "Times New Roman", serif;
  --aside: clamp(340px, 31vw, 500px);
  --D: min(70vh, calc((100vw - var(--aside)) * .64));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--serif);
  color: var(--text);
  background-color: var(--wood);
  background-image:
    radial-gradient(ellipse 70% 60% at 38% 48%, rgba(255, 214, 170, .10), transparent 70%),
    radial-gradient(ellipse 120% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='900' height='900'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.0025 0.09' numOctaves='4' seed='11'/><feColorMatrix values='0 0 0 0 0.06  0 0 0 0 0.035  0 0 0 0 0.02  0 0 0 1.35 -0.42'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, #3b271c, #2c1c14 60%, #251810);
  background-size: auto, auto, 900px 900px, auto;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .35; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- 开场 ---------- */
#intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 55%, #161009, #030201 70%);
  transition: opacity 1.2s ease, visibility 1.2s;
}
#intro.out { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-inner { text-align: center; padding: 0 16px; }
.swirl { width: min(520px, 86vw); margin: 0 auto 8px; overflow: visible; }
.swirl path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.6, .1, .2, 1) forwards; }
.swirl path:nth-child(2) { animation-delay: .5s; }
.swirl path:nth-child(3) { animation-delay: 1s; }
.swirl .spark { animation: spark 2.2s ease-in-out infinite; transform-origin: 30px 100px; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spark { 0%, 100% { opacity: .5; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.4); } }
.intro-title {
  margin: 0; font-weight: 600; font-size: clamp(30px, 4.4vw, 46px); letter-spacing: .5em; padding-left: .5em;
  color: var(--gold-2); text-shadow: 0 0 24px rgba(236, 211, 154, .35);
  opacity: 0; animation: rise 1.4s 1.3s ease forwards;
}
.intro-en { margin: 14px 0 0; font-family: var(--latin); font-size: 13px; letter-spacing: .38em; color: var(--muted); opacity: 0; animation: rise 1.4s 1.7s ease forwards; }
.intro-sub { margin: 26px 0 0; font-size: 15px; letter-spacing: .3em; color: #d9c8a4; opacity: 0; animation: rise 1.4s 2.1s ease forwards; }
#enter {
  margin: 34px auto 0; width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(201, 164, 92, .16), transparent 70%);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 0 6px rgba(201, 164, 92, .06), inset 0 0 18px rgba(201, 164, 92, .15);
  color: var(--gold-2); font-size: 18px; letter-spacing: .3em; padding-left: .3em;
  opacity: 0; animation: rise 1.4s 2.5s ease forwards, breathe 3s 4s ease-in-out infinite;
  transition: transform .3s, box-shadow .3s;
}
#enter:hover { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(201, 164, 92, .1), 0 0 40px rgba(236, 211, 154, .25), inset 0 0 18px rgba(201, 164, 92, .25); }
.intro-hint { margin: 18px 0 0; font-size: 12px; color: #7d6d55; letter-spacing: .2em; opacity: 0; animation: rise 1.4s 2.9s ease forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 6px rgba(201, 164, 92, .06), inset 0 0 18px rgba(201, 164, 92, .15); } 50% { box-shadow: 0 0 0 14px rgba(201, 164, 92, .02), 0 0 30px rgba(236, 211, 154, .18), inset 0 0 22px rgba(201, 164, 92, .25); } }

/* ---------- 布局 ---------- */
#app { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside); height: 100vh; height: 100dvh; }
#stage { position: relative; overflow: hidden; min-height: 0; container: stage / inline-size; }
#scene { position: absolute; inset: 0; transform-origin: 50% var(--cy, 48%); }
#scene.reveal { animation: reveal 2.8s cubic-bezier(.2, .7, .1, 1) both; }
@keyframes reveal { from { transform: scale(1.9); filter: blur(4px); } 40% { filter: blur(0); } to { transform: scale(1); } }

.cloth {
  position: absolute; left: 50%; top: var(--cy, 48%);
  width: calc(var(--D) * 1.17); height: calc(var(--D) * 1.13);
  transform: translate(-50%, -50%) rotate(-5deg);
  border-radius: 48% 52% 47% 53% / 52% 46% 54% 48%;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, .35), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(120, 95, 60, .18), transparent 55%),
    linear-gradient(160deg, #eee6d6, #ddd2bd);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5), 0 6px 14px rgba(0, 0, 0, .3);
}

/* 表盘 */
#dial {
  --rot: 0deg;
  position: absolute; left: 50%; top: var(--cy, 48%);
  width: calc(var(--D) + 84px); height: calc(var(--D) + 84px);
  transform: translate(-50%, -50%) rotate(var(--rot));
  transition: transform 1s cubic-bezier(.45, .05, .2, 1);
  pointer-events: none;
}
.dial-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(201, 164, 92, .28); }
.dial-ticks {
  position: absolute; inset: -9px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(201, 164, 92, .5) 0 .3deg, transparent .3deg 6deg);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 6px), #000 100%, transparent 100%);
  mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 6px), #000 100%, transparent 100%);
}
.dial-label {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; padding: 0; border: 0; background: none;
  transform: rotate(var(--a)) translate(calc(var(--D) / 2 + var(--lr, 66px))) rotate(calc(-1 * var(--a) - var(--rot)));
  transition: transform 1s cubic-bezier(.45, .05, .2, 1);
  pointer-events: auto;
}
.dial-label span {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  white-space: nowrap; font-size: 13px; letter-spacing: .12em; color: rgba(214, 196, 160, .55);
  padding: 4px 6px; border-radius: 4px; transition: color .3s, font-size .3s, text-shadow .3s;
}
.dial-label:hover span { color: var(--gold-2); }
.dial-label.done span::after { content: ""; position: absolute; left: 50%; bottom: -2px; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--gold); }
.dial-label.on span { color: var(--gold-2); font-size: 16px; font-weight: 600; text-shadow: 0 0 14px rgba(236, 211, 154, .5); }
.dial-pointer {
  position: absolute; left: 50%; top: calc(var(--cy, 48%) - var(--D) / 2 - 42px - 6px);
  width: 0; height: 0; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--gold);
  filter: drop-shadow(0 0 4px rgba(236, 211, 154, .6));
}

/* 绣绷 */
#hoop { position: absolute; left: 50%; top: var(--cy, 48%); width: var(--D); height: var(--D); transform: translate(-50%, -50%); }
#fabric {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; isolation: isolate;
  background: radial-gradient(circle at 44% 40%, #f9f6ee, #f1ebdf 55%, #e4d9c5 100%);
  box-shadow: inset 0 0 0 2px rgba(120, 80, 40, .22), inset 0 10px 26px rgba(90, 60, 30, .3);
}
#fabric::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(110, 90, 60, .045) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(110, 90, 60, .035) 0 1px, transparent 1px 3px);
}
#fabric canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; transition: opacity .35s ease; }
#fabric.no-sketch #cv-sketch { opacity: 0; }
#fabric.fade canvas { opacity: 0 !important; }
#ov-diagram, #ov-photo { position: absolute; z-index: 2; opacity: 0; pointer-events: none; transition: opacity .5s ease, transform .6s ease; transform: scale(.97); }
#ov-diagram { inset: 16%; width: 68%; height: 68%; object-fit: contain; mix-blend-mode: multiply; }
#ov-photo { inset: 0; width: 100%; height: 100%; object-fit: cover; }
#fabric[data-view="diagram"] canvas { opacity: .1; }
#fabric[data-view="diagram"] #ov-diagram { opacity: .88; transform: none; }
#fabric[data-view="photo"] canvas { opacity: 0; }
#fabric[data-view="photo"] #ov-photo { opacity: 1; transform: none; }
.sheen {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 246, 222, .7) 50%, transparent 62%);
  background-size: 260% 260%; mix-blend-mode: soft-light;
}
#fabric.done .sheen { animation: sheen 1.9s ease-out; }
@keyframes sheen { 0% { opacity: 0; background-position: 120% 0; } 20% { opacity: 1; } 100% { opacity: 0; background-position: -20% 0; } }

.ring {
  --rw: calc(var(--D) * .045);
  position: absolute; inset: calc(var(--rw) * -1); border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(closest-side, transparent calc(100% - var(--rw) * .52), rgba(70, 38, 14, .55) calc(100% - var(--rw) * .52), rgba(70, 38, 14, .55) calc(100% - var(--rw) * .48), transparent calc(100% - var(--rw) * .48)),
    radial-gradient(circle at 30% 22%, rgba(255, 240, 210, .45), transparent 45%),
    conic-gradient(from 10deg, #d7a66b, #b98049, #e0b47c, #c28b53, #e3b980, #b27a43, #d9a86d, #c08850, #d7a66b);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + 1px));
  mask: radial-gradient(closest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + 1px));
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45));
}
.ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(80, 40, 12, .55), inset 0 -3px 6px rgba(80, 40, 12, .35), inset 0 3px 5px rgba(255, 235, 200, .35);
}
.clasp {
  position: absolute; left: 50%; top: calc(var(--D) * -.078); transform: translateX(-50%);
  width: calc(var(--D) * .075); height: calc(var(--D) * .045); border-radius: 3px;
  background: linear-gradient(180deg, #f1d589, #b98a36 55%, #7d5a1c);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 250, 220, .6);
}
.clasp::before, .clasp::after {
  content: ""; position: absolute; top: 50%; width: 38%; height: 40%; transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #7d5a1c 0 1px, #e8c877 1px 3px); border-radius: 2px;
}
.clasp::before { left: -30%; }
.clasp::after { right: -30%; }

#cv-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* ---------- 绣台上的面板 ---------- */
.glass {
  background: var(--glass);
  border: 1px solid rgba(255, 240, 210, .08);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
#hud { position: absolute; left: 24px; top: 22px; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border-radius: 6px; }
.hud-ring { position: relative; width: 46px; height: 46px; }
.hud-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hud-ring circle { fill: none; stroke-width: 1.6; }
.hud-ring .track { stroke: rgba(201, 164, 92, .22); }
.hud-ring .bar { stroke: var(--gold-2); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .25s ease; filter: drop-shadow(0 0 3px rgba(236, 211, 154, .6)); }
#hud-pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--latin); font-size: 12px; color: var(--text); }
.hud-label { font-size: 11px; color: var(--gold); letter-spacing: .2em; }
.hud-label em { font-style: normal; font-family: var(--latin); letter-spacing: .12em; }
.hud-count b { font-family: var(--latin); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hud-count span { font-family: var(--latin); font-size: 13px; color: var(--muted); margin-left: 4px; }
.hud-step { margin-left: 8px; font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.hud-step b { color: var(--text); font-weight: 600; }

#topbar { position: absolute; right: 22px; top: 22px; z-index: 10; display: flex; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px 0 11px;
  border-radius: 999px; border: 1px solid rgba(201, 164, 92, .3); background: rgba(24, 16, 11, .55);
  font-size: 13px; letter-spacing: .08em; color: var(--muted);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: color .2s, background .2s, border-color .2s, transform .2s;
}
.chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chip:hover { color: var(--gold-2); border-color: rgba(236, 211, 154, .55); transform: translateY(-1px); }
.chip.toggle.on { color: var(--gold-2); background: rgba(201, 164, 92, .16); border-color: rgba(236, 211, 154, .5); }

#namecard { position: absolute; left: 24px; bottom: 24px; z-index: 10; display: flex; gap: 14px; align-items: center; padding: 12px 20px 12px 12px; border-radius: 5px; max-width: min(430px, calc(100% - 270px)); }
#namecard.swap { animation: cardIn .7s cubic-bezier(.2, .8, .2, 1); }
@keyframes cardIn { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.nc-icon { flex: none; width: 64px; height: 64px; border-radius: 3px; background: #f4efe4; display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.nc-icon img { width: 86%; height: 86%; object-fit: contain; mix-blend-mode: multiply; }
.nc-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.nc-head strong { font-size: 26px; font-weight: 900; letter-spacing: .06em; color: #f6eedc; }
.nc-head span { font-family: var(--latin); font-size: 11px; letter-spacing: .16em; color: var(--gold); }
#nc-tag { margin: 6px 0 0; font-size: 13px; color: #d7c9ad; letter-spacing: .08em; }

#spools { position: absolute; right: 26px; bottom: 26px; z-index: 10; display: grid; grid-template-columns: repeat(3, 54px); gap: 14px 10px; justify-items: center; }
.spools-label { grid-column: 1 / -1; justify-self: end; font-size: 11px; letter-spacing: .3em; color: rgba(214, 196, 160, .6); }
.spool { position: relative; width: 50px; height: 26px; padding: 0; border: 0; background: none; display: flex; transform: rotate(var(--r)); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); filter: drop-shadow(0 5px 6px rgba(0, 0, 0, .55)); }
.spool i { display: block; }
.spool .flange { width: 8px; height: 100%; border-radius: 3px; background: linear-gradient(180deg, #ecca94, #b27c45 60%, #7d5226); }
.spool .body {
  flex: 1; margin: 3px 0; border-radius: 1px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, white), var(--c) 45%, color-mix(in srgb, var(--c) 60%, black));
}
.spool:hover { transform: rotate(0deg) translateY(-4px) scale(1.08); }
.spool.on { transform: rotate(0deg) translateY(-6px) scale(1.14); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 70%, white)) drop-shadow(0 6px 6px rgba(0, 0, 0, .5)); }

/* ---------- 卷轴 ---------- */
#scroll {
  position: relative; z-index: 20; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  container: scroll / inline-size;
  background: linear-gradient(90deg, rgba(14, 9, 6, .55), rgba(14, 9, 6, .72));
  border-left: 1px solid rgba(201, 164, 92, .18);
  box-shadow: -20px 0 40px rgba(0, 0, 0, .25);
}
#chips { display: none; }
.scroll-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 28px 26px 18px 30px; scrollbar-width: thin; scrollbar-color: rgba(201, 164, 92, .3) transparent; }
.vt { grid-column: 2; grid-row: 1; position: sticky; top: 0; align-self: start; display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 12px; }
#vt-title { margin: 0; writing-mode: vertical-rl; font-size: 50px; font-weight: 900; letter-spacing: .24em; line-height: 1; color: #f4ead4; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.vt-line { align-self: stretch; width: 1px; min-height: 180px; background: linear-gradient(180deg, transparent, var(--gold-dim) 15%, var(--gold-dim) 85%, transparent); }
#vt-tag { margin: 6px 0 0; writing-mode: vertical-rl; font-size: 12px; letter-spacing: .32em; color: var(--gold); }
#vt-tag i { font-style: normal; padding: .5em 0; color: var(--gold-dim); }
.vt span { display: inline-block; }
.vt.enter #vt-title span, .vt.enter #vt-tag span { animation: charIn .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 130ms + 120ms); }
@keyframes charIn { from { opacity: 0; transform: translateY(-16px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.seal {
  position: absolute; right: 0; top: calc(100% + 18px);
  width: 44px; height: 44px; display: grid; grid-template-columns: 1fr 1fr; place-items: center;
  background: var(--seal); color: #f6e3d6; font-size: 15px; font-weight: 600; line-height: 1; padding: 4px;
  border-radius: 3px; box-shadow: inset 0 0 0 2px rgba(255, 230, 215, .35), 0 2px 6px rgba(0, 0, 0, .4);
  grid-template-rows: 1fr 1fr; transform: rotate(-4deg);
}
.seal span:nth-child(1) { grid-area: 1 / 2; }
.seal span:nth-child(2) { grid-area: 2 / 2; }
.seal span:nth-child(3) { grid-area: 1 / 1; }
.seal span:nth-child(4) { grid-area: 2 / 1; }
.seal.stamp { animation: stamp .7s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes stamp { 0% { transform: scale(1.7) rotate(-14deg); opacity: 0; } 60% { transform: scale(.92) rotate(-3deg); opacity: 1; } 100% { transform: scale(1) rotate(-4deg); } }

#info { grid-column: 1; grid-row: 1; min-width: 0; }
#info.enter > * { animation: rise .7s ease both; }
#info.enter > *:nth-child(2) { animation-delay: .08s; }
#info.enter > *:nth-child(3) { animation-delay: .16s; }
#info.enter > *:nth-child(4) { animation-delay: .24s; }
#info.enter > *:nth-child(5) { animation-delay: .32s; }
#info.enter > *:nth-child(6) { animation-delay: .4s; }
.eyebrow { font-family: var(--latin); font-size: 12px; letter-spacing: .18em; color: var(--gold); padding-bottom: 12px; border-bottom: 1px solid rgba(201, 164, 92, .18); }
#info section { margin-top: 18px; }
#info h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .3em; color: var(--gold-2); }
#info h3::before { content: ""; width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid var(--gold); }
#info p { margin: 0; font-size: 14.5px; line-height: 1.95; color: #e3d8c2; text-align: justify; }
#info p.note { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.7; }
#info .pt { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; margin: 0 2px; border-radius: 50%; font: 700 .72em/1 "Helvetica Neue", Arial, sans-serif; color: #2a1a0c; background: var(--gold); vertical-align: .1em; }
.media { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 104px; height: 104px; padding: 6px; border-radius: 4px; background: #f4efe4; border: 1px solid rgba(201, 164, 92, .35); transition: transform .25s, box-shadow .25s; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.thumb.photo { padding: 0; overflow: hidden; }
.thumb.photo img { object-fit: cover; mix-blend-mode: normal; }
.thumb:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, .45), 0 0 0 1px rgba(236, 211, 154, .6); }
.src { margin-top: 22px !important; font-size: 12px !important; color: #857457 !important; letter-spacing: .06em; }

/* 控制台 */
#deck { flex: none; padding: 14px 22px 18px; border-top: 1px solid rgba(201, 164, 92, .18); background: rgba(10, 6, 4, .45); display: grid; gap: 10px; }
.deck-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deck-row.main { flex-wrap: nowrap; }
.deck-row.main { justify-content: space-between; }
.deck-row.main button {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 10px; border-radius: 999px;
  border: 1px solid transparent; background: none; font-size: 13px; letter-spacing: .06em; color: var(--muted);
  transition: color .2s, background .2s, border-color .2s;
}
.deck-row.main button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.deck-row.main button:hover { color: var(--gold-2); background: rgba(201, 164, 92, .1); border-color: rgba(201, 164, 92, .25); }
.deck-row.main .play {
  width: 58px; height: 58px; padding: 0; justify-content: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6dea0, #c9a45c 60%, #8c6a2c); color: #2a1a0c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 250, 225, .7), 0 0 0 4px rgba(201, 164, 92, .12);
}
.deck-row.main .play:hover { color: #2a1a0c; background: radial-gradient(circle at 35% 30%, #fff0c0, #d7b36a 60%, #9a7633); }
.deck-row.main .play svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.play .i-pause, body.playing .play .i-play { display: none; }
body.playing .play .i-pause { display: block; }
.deck-label { width: 34px; flex: none; font-size: 12px; letter-spacing: .2em; color: #8f7d5f; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 240, 210, .05); border: 1px solid rgba(201, 164, 92, .2); }
.seg button { height: 28px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 999px; background: none; font-size: 12.5px; color: var(--muted); font-family: var(--latin), var(--serif); transition: color .2s, background .2s; }
.seg button:hover:not(:disabled) { color: var(--gold-2); }
.seg button.on { background: rgba(201, 164, 92, .22); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(236, 211, 154, .35); }
.pill { height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid rgba(201, 164, 92, .25); background: none; font-size: 12.5px; color: var(--muted); transition: color .2s, background .2s, border-color .2s; }
.pill:hover { color: var(--gold-2); border-color: rgba(236, 211, 154, .5); }
.pill.toggle.on { color: var(--gold-2); background: rgba(201, 164, 92, .16); border-color: rgba(236, 211, 154, .45); }
.deck-row .pill:first-of-type { margin-left: auto; }

/* ---------- 浮层 ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; opacity: 0; transition: opacity .3s ease; }
.overlay.show { opacity: 1; }
.close { position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold-dim); background: rgba(20, 13, 9, .6); color: var(--gold-2); font-size: 22px; line-height: 1; }
.close:hover { background: rgba(201, 164, 92, .2); }
#atlas { background: rgba(18, 11, 7, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow-y: auto; }
.atlas-inner { max-width: 1180px; margin: 0 auto; padding: 40px 28px 30px; }
.atlas-head h2 { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: .3em; color: #f4ead4; }
.atlas-head p { margin: 8px 0 0; font-size: 13px; letter-spacing: .25em; color: var(--gold); }
#atlas-grid { margin-top: 30px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px 18px; }
.card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 0; border-radius: 8px; background: none; transition: background .25s, transform .25s; }
.card:hover { background: rgba(201, 164, 92, .08); transform: translateY(-4px); }
.card-hoop { width: 168px; height: 168px; border-radius: 50%; overflow: hidden; margin-bottom: 10px; background: radial-gradient(circle at 44% 40%, #f9f6ee, #efe8da 60%, #e0d5c0); box-shadow: 0 0 0 7px #c8965e, 0 0 0 8px rgba(70, 38, 14, .7), 0 14px 28px rgba(0, 0, 0, .55); transition: box-shadow .25s; }
.card:hover .card-hoop, .card.on .card-hoop { box-shadow: 0 0 0 7px #d9a86d, 0 0 0 8px rgba(70, 38, 14, .7), 0 0 0 12px rgba(236, 211, 154, .3), 0 14px 28px rgba(0, 0, 0, .55); }
.card canvas { width: 100%; height: 100%; display: block; }
.card strong { font-size: 18px; letter-spacing: .12em; color: #f4ead4; }
.card em { font-style: normal; font-family: var(--latin); font-size: 11px; letter-spacing: .18em; color: var(--gold); }
.card small { font-size: 11px; color: #8f7d5f; letter-spacing: .15em; }
.card.done small::after { content: " · 已绣"; color: var(--gold); }
#credits { margin-top: 40px; padding-top: 18px; border-top: 1px solid rgba(201, 164, 92, .15); display: grid; gap: 6px; font-size: 12px; color: #857457; line-height: 1.6; }
#lightbox { display: grid; place-items: center; background: rgba(10, 6, 4, .88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#lightbox figure { margin: 0; max-width: min(900px, 90vw); text-align: center; cursor: zoom-out; transform: scale(.96); transition: transform .3s ease; }
#lightbox.show figure { transform: none; }
#lb-img { max-width: 100%; max-height: 78vh; display: block; margin: 0 auto; background: #fbf8f1; padding: 18px; border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
#lb-cap { margin-top: 14px; font-size: 14px; letter-spacing: .2em; color: var(--gold-2); }

:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* ---------- 自适应：矮屏紧凑 ---------- */
#stage.compact { --lr: 56px; }
#stage.compact #hud { padding: 6px 14px 6px 6px; }
#stage.compact .hud-ring { width: 38px; height: 38px; }
#stage.compact .hud-count b { font-size: 20px; }
#stage.compact #namecard { padding: 8px 16px 8px 8px; gap: 12px; }
#stage.compact .nc-icon { width: 48px; height: 48px; }
#stage.compact .nc-head strong { font-size: 21px; }
#stage.compact #nc-tag { margin-top: 3px; font-size: 12px; }
#stage.compact #spools { grid-template-columns: repeat(3, 40px); gap: 8px; }
#stage.compact .spool { width: 40px; height: 20px; }

/* ---------- 自适应：按容器宽度收放 ---------- */
@container stage (max-width: 820px) {
  .chip { font-size: 0; gap: 0; padding: 0 9px; }
  .hud-step { display: none; }
  #spools { grid-template-columns: repeat(3, 40px); gap: 10px 8px; }
  .spool { width: 40px; height: 20px; }
  .dial-label span { font-size: 12px; letter-spacing: .06em; }
  .dial-label.on span { font-size: 14px; }
  #namecard { max-width: min(400px, calc(100% - 200px)); }
  .nc-head strong { font-size: 22px; }
}
@container stage (max-width: 580px) {
  #spools { display: none; }
  #namecard { max-width: calc(100% - 48px); }
}
@container stage (max-width: 400px) {
  .hud-label { display: none; }
  #hud { left: 8px; }
  #topbar { right: 8px; gap: 4px; }
  .chip { width: 30px; padding: 0; justify-content: center; }
}
@container scroll (max-width: 439px) {
  .scroll-body { display: block; padding: 22px 22px 16px; }
  .vt { position: static; flex-direction: row; align-items: center; gap: 12px; margin-bottom: 16px; }
  #vt-title, #vt-tag { writing-mode: horizontal-tb; }
  #vt-title { font-size: 34px; letter-spacing: .14em; }
  .vt-line { min-height: 0; width: 1px; height: 28px; align-self: center; }
  #vt-tag { margin: 0; letter-spacing: .12em; }
  #vt-tag i { padding: 0 .5em; }
  .seal { position: static; margin-left: auto; width: 38px; height: 38px; font-size: 13px; }
}
@container scroll (max-width: 459px) {
  .deck-row.main button span { display: none; }
  .deck-row.main button { padding: 0 12px; }
  #deck { padding: 12px 16px 14px; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  :root { --D: min(80vw, 62vh); }
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: visible; }
  #app { display: block; height: auto; }
  #stage { height: calc(var(--D) * 1.12 + 200px); }
  .cloth, #dial, #hoop { top: calc(72px + var(--D) * .56); }
  #scene { transform-origin: 50% calc(72px + var(--D) * .56); }
  .dial-label, .dial-pointer { display: none; }
  #hud { left: 12px; top: 12px; padding: 6px 12px 6px 6px; gap: 10px; }
  .hud-ring { width: 38px; height: 38px; }
  .hud-count b { font-size: 19px; }
  .hud-step { display: none; }
  #topbar { right: 12px; top: 12px; gap: 6px; }
  .chip { height: 30px; padding: 0 10px; font-size: 0; gap: 0; }
  .chip svg { width: 16px; height: 16px; }
  #namecard { left: 12px; right: 12px; bottom: 12px; max-width: none; padding: 8px 12px 8px 8px; }
  .nc-icon { width: 48px; height: 48px; }
  .nc-head strong { font-size: 20px; }
  #spools { display: none; }
  #scroll { border-left: 0; border-top: 1px solid rgba(201, 164, 92, .18); }
  #chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; }
  #chips::-webkit-scrollbar { display: none; }
  #chips button { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(201, 164, 92, .25); background: none; font-size: 13px; color: var(--muted); }
  #chips button.on { color: #2a1a0c; background: var(--gold); border-color: var(--gold); }
  #chips button.done:not(.on) { color: var(--gold-2); }
  .scroll-body { display: block; overflow: visible; padding: 8px 16px 20px; }
  .vt { position: static; flex-direction: row; align-items: center; gap: 12px; margin-bottom: 14px; }
  #vt-title, #vt-tag { writing-mode: horizontal-tb; }
  #vt-title { font-size: 34px; letter-spacing: .12em; }
  .vt-line { min-height: 0; width: 1px; height: 28px; align-self: center; }
  #vt-tag { margin: 0; letter-spacing: .12em; }
  #vt-tag i { display: inline; padding: 0 6px; }
  .seal { position: static; margin-left: auto; width: 38px; height: 38px; font-size: 13px; }
  #deck { order: -2; gap: 8px; padding: 12px 14px; border-top: 0; border-bottom: 1px solid rgba(201, 164, 92, .18); background: rgba(16, 10, 7, .6); }
  #chips { order: -1; }
  .scroll-body { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .deck-row.main button span { display: none; }
  .deck-row { flex-wrap: wrap; }
  .deck-row.main .play { width: 50px; height: 50px; }
}

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