/* ============================================================================
   NOCTURNE — 深夜游乐场
   1. 令牌 / 2. 重置 / 3. 全局层 / 4. 导航 / 5. 首屏 / 6. 字带
   7. 章节 / 8. 玩具卡 / 9. 六台机器 / 10. 成就 / 11. 结尾 / 12. 光标
   13. 提示气泡 / 14. 无障碍
   ========================================================================== */

/* ============================================================
   1. 设计令牌
   ============================================================ */
:root {
  --bg:         #08090d;
  --bg-soft:    #0e1016;
  --bg-lift:    #14171f;
  --line:       rgba(255, 255, 255, 0.09);
  --line-firm:  rgba(255, 255, 255, 0.17);
  --fg:         #f2f3f5;
  --fg-dim:     #8f95a0;
  --fg-mute:    #5b616c;
  --accent:     #d6ff3f;
  --accent-ink: #0a0c04;

  --font-display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body:    "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);

  --gut: clamp(18px, 5vw, 72px);
  --max: 1360px;
  --radius: 16px;
}

/* ============================================================
   2. 基础重置
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
/* scroll-padding-top 给固定导航让出高度，锚点跳过去时标题不会被压住。
   overflow-x 也必须挂在这里而不是 body：body 一旦成了滚动容器，
   #toys 这类锚点跳转在部分浏览器里就会静默失效。 */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   3. 全局层：噪点 / 撒花 / 进度条
   ============================================================ */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9990;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

.fx {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9000;
}

#progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ============================================================
   4. 导航
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 120;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gut);
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease-out), border-color 0.5s, backdrop-filter 0.5s;
}
.nav.stuck {
  background: rgba(8, 9, 13, 0.76);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand i { color: var(--accent); font-style: normal; }

.nav-links { display: flex; gap: 30px; }
.nav-links a {
  position: relative;
  font-size: 13px;
  color: var(--fg-dim);
  padding-bottom: 2px;
  transition: color 0.35s var(--ease-out);
}
.nav-links a::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav-tools { display: flex; align-items: center; gap: 8px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  border: 1px solid var(--line-firm);
  border-radius: 999px;
  color: var(--fg-dim);
  transition: color 0.35s var(--ease-out), border-color 0.35s, background 0.35s, transform 0.2s;
}
.chip-btn:hover { color: var(--fg); border-color: var(--fg-mute); transform: translateY(-1px); }
.chip-btn:active { transform: translateY(0) scale(0.97); }
.chip-btn[aria-pressed="true"] { color: var(--fg-mute); border-color: var(--line); }
.chip-btn--accent {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}
.chip-btn--accent:hover { color: var(--accent-ink); background: #e2ff72; border-color: #e2ff72; }

@media (max-width: 900px) { .nav-links { display: none; } }
@media (max-width: 620px) { .chip-btn__txt { display: none; } }

/* ============================================================
   5. 首屏
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 140px 0 clamp(40px, 7vh, 84px);
  overflow: hidden;
  isolation: isolate;
}

#net {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

.aurora {
  position: absolute; inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 46% at 22% 18%, rgba(120, 90, 255, 0.24), transparent 62%),
    radial-gradient(38% 40% at 82% 30%, rgba(0, 190, 210, 0.16), transparent 64%),
    radial-gradient(50% 44% at 55% 88%, rgba(214, 255, 63, 0.10), transparent 66%);
  filter: blur(30px);
  animation: drift 22s var(--ease-io) infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%; max-width: var(--max);
  margin: 0 auto;
  padding-inline: var(--gut);
}

.hero-badges {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: clamp(22px, 4vh, 40px);
}

.tag {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(6px);
}
.tag b { color: var(--accent); font-weight: 500; }
.tag--clock { font-variant-numeric: tabular-nums; letter-spacing: 0.14em; }
.tag--clock .greet { color: var(--accent); }
.tag--clock .t { color: var(--fg); font-weight: 500; }
.tag--score { transition: border-color 0.4s, box-shadow 0.4s; }
.tag--score.bump {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(214, 255, 63, 0.12);
  animation: bump 0.5s var(--ease-back);
}
.tag--score i { font-style: normal; color: var(--fg-mute); }
@keyframes bump {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.12); }
}

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

.accent-dot {
  display: inline-block;
  width: 0.42em; height: 0.42em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
  margin-left: 0.12em;
  animation: pulse 2.6s var(--ease-io) infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(0.6); opacity: 0.45; }
}

.reveal-line { overflow: hidden; display: block; }
.reveal-line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 1.1s var(--ease-out);
}
.is-in .reveal-line > span { transform: translateY(0); }

.fade-up {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.is-in .fade-up { opacity: 1; transform: none; }

.hero-title {
  font-size: clamp(40px, 8.4vw, 128px);
  margin-bottom: clamp(24px, 4vh, 42px);
  max-width: 16ch;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
.hero-title em::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0.08em;
  height: 0.09em;
  background: var(--accent);
  opacity: 0.35;
  border-radius: 99px;
}

.hero-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 40px; flex-wrap: wrap;
}
.hero-sub {
  max-width: 42ch;
  color: var(--fg-dim);
  font-size: clamp(14px, 1.4vw, 16px);
}
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 500;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.45s var(--ease-out), background 0.3s;
  will-change: transform;
}
.btn:hover { box-shadow: 0 0 0 6px rgba(214, 255, 63, 0.12); }
.btn span { position: relative; z-index: 2; }
.btn svg { position: relative; z-index: 2; transition: transform 0.4s var(--ease-out); }
.btn:hover svg { transform: translateX(4px); }

.btn.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-firm);
}
.btn.ghost:hover { border-color: var(--fg); box-shadow: none; }

.scroll-hint {
  position: absolute; right: var(--gut); bottom: clamp(48px, 8vh, 90px);
  z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--fg-mute);
  writing-mode: vertical-rl;
}
.scroll-hint::after {
  content: "";
  width: 1px; height: 52px;
  background: linear-gradient(var(--accent), transparent);
  animation: drop 2.2s var(--ease-io) infinite;
  transform-origin: top;
}
@keyframes drop {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- 5.1 摸鱼小怪兽 ---------- */
.mascot {
  position: absolute;
  right: clamp(20px, 7vw, 110px);
  top: clamp(120px, 22vh, 200px);
  z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: float 4.6s var(--ease-io) infinite;
  user-select: none;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

.mascot-body {
  position: relative;
  width: clamp(78px, 9vw, 116px);
  aspect-ratio: 1;
  border-radius: 48% 48% 44% 44%;
  background: radial-gradient(circle at 34% 28%, #f0ffa8, #d6ff3f 46%, #8fb800);
  box-shadow:
    0 18px 40px rgba(120, 160, 0, 0.28),
    inset 0 -8px 18px rgba(0, 0, 0, 0.16);
  display: flex; align-items: center; justify-content: center;
  gap: 14%;
  transition: transform 0.25s var(--ease-back), filter 0.3s;
  cursor: pointer;
}
.mascot-body::before,
.mascot-body::after {
  content: "";
  position: absolute;
  inset: -9% -9% auto auto;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(214, 255, 63, 0.55);
  filter: blur(1px);
}

.eye {
  position: relative;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #0b0f04;
  display: block;
  overflow: hidden;
}
.eye i {
  position: absolute;
  left: 28%; top: 22%;
  width: 34%; height: 34%;
  border-radius: 50%;
  background: #fff;
}
.mouth {
  position: absolute;
  left: 50%; bottom: 26%;
  translate: -50% 0;
  width: 24%; height: 8%;
  border-radius: 0 0 99px 99px;
  background: #0b0f04;
  transition: height 0.18s, width 0.18s;
}

.mascot.is-happy .mascot-body { transform: scale(1.12) rotate(-6deg); }
.mascot.is-happy .mouth { width: 34%; height: 22%; }
.mascot.is-happy .eye { height: 4%; border-radius: 99px; }

.mascot.is-blink .eye { height: 3%; }

.mascot-hint {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-mute);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.4s, transform 0.4s;
}
.mascot:hover .mascot-hint,
.mascot:focus-visible .mascot-hint { opacity: 1; transform: none; }

@media (max-width: 780px) {
  .mascot { top: auto; bottom: 96px; right: 18px; opacity: 0.9; }
  .scroll-hint { display: none; }
}

/* ============================================================
   6. 滚动字带
   ============================================================ */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  overflow: hidden;
  white-space: nowrap;
  background: var(--bg-soft);
}
.marquee-track {
  display: inline-flex;
  gap: 48px;
  animation: slide 30s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.8vw, 32px);
  font-weight: 500;
  color: var(--fg-mute);
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 48px;
  transition: color 0.3s;
  cursor: default;
}
.marquee-track span::after {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.marquee-track span:hover { color: var(--fg); }
@keyframes slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   7. 章节
   ============================================================ */
.section { padding: clamp(80px, 12vh, 150px) 0; position: relative; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--gut); }

.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.sec-head { max-width: 780px; margin-bottom: clamp(40px, 6vh, 72px); }
.sec-head h2 {
  font-size: clamp(28px, 4.4vw, 58px);
  margin: 16px 0 0;
}
.sec-sub {
  margin-top: 16px;
  color: var(--fg-dim);
  font-size: clamp(14px, 1.3vw, 16px);
  max-width: 52ch;
}

/* ============================================================
   8. 玩具卡
   ============================================================ */
.toys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}

.toy {
  position: relative;
  display: flex; flex-direction: column;
  gap: 16px;
  padding: clamp(16px, 1.8vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  overflow: hidden;
  transition: border-color 0.45s var(--ease-out), transform 0.45s var(--ease-out), background 0.45s;
}
.toy::after {
  content: "";
  position: absolute; inset: -40% -40% auto auto;
  width: 70%; aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--toy, #fff) 22%, transparent), transparent 68%);
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.5s;
}
.toy:hover { border-color: var(--line-firm); transform: translateY(-3px); }
.toy:hover::after { opacity: 0.85; }

.toy-head {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  z-index: 1;
}
.toy-ico {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  flex: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--toy, #fff) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--toy, #fff) 26%, transparent);
  font-size: 18px;
  line-height: 1;
}
.toy-title { min-width: 0; }
.toy-title h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.toy-title p {
  font-size: 12px;
  color: var(--fg-mute);
  margin-top: 2px;
}
.toy-stat {
  margin-left: auto;
  text-align: right;
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.1;
}
.toy-stat b {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--toy, var(--accent));
  font-variant-numeric: tabular-nums;
}
.toy-stat i {
  font-style: normal;
  font-size: 10px;
  color: var(--fg-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.toy-stat.pulse b { animation: bump 0.4s var(--ease-back); }

.toy-foot {
  position: relative;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  z-index: 1;
  margin-top: auto;
}
.toy-note { font-size: 11px; color: var(--fg-mute); }
.toy-note b { color: var(--fg-dim); font-variant-numeric: tabular-nums; }

.mini-btn {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-firm);
  color: var(--fg-dim);
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.15s;
}
.mini-btn:hover { color: var(--fg); border-color: var(--fg-mute); }
.mini-btn:active { transform: scale(0.96); }
.mini-btn[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.mini-btn--accent {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}
.mini-btn--accent:hover { background: #e2ff72; color: var(--accent-ink); border-color: #e2ff72; }

.toy-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  touch-action: none;
}

/* ---------- 放大游玩 ---------- */
.toy-expand {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line-firm);
  color: var(--fg-mute);
  font-size: 13px;
  line-height: 1;
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.2s var(--ease-back);
}
.toy-expand:hover {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--toy, #fff) 55%, transparent);
  background: color-mix(in srgb, var(--toy, #fff) 12%, transparent);
  transform: scale(1.08);
}
.toy-expand:active { transform: scale(0.92); }
.toy-expand[aria-pressed="true"] {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--toy, #fff) 65%, transparent);
  background: color-mix(in srgb, var(--toy, #fff) 16%, transparent);
}

.toy-slot {
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  opacity: 0.3;
  pointer-events: none;
}

html.is-zoomed,
body.is-zoomed { overflow: hidden; }

.toy-stage {
  position: fixed; inset: 0;
  z-index: 8900;
  display: flex; align-items: center; justify-content: center;
  /* 上下留白要放得下顶部的收起键与提示，卡片自己在剩余空间里滚动 */
  padding: 54px clamp(10px, 2.5vw, 32px) clamp(10px, 2.5vw, 32px);
  background: rgba(4, 5, 8, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease-out);
}
.toy-stage.open { opacity: 1; pointer-events: auto; }

.stage-tip {
  position: absolute;
  top: 16px;
  right: clamp(12px, 2.5vw, 32px);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out) 0.15s;
}
.toy-stage.open .stage-tip { opacity: 1; }
.stage-tip kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--line-firm);
  color: var(--fg-dim);
}

.stage-close {
  position: absolute;
  top: 10px;
  left: clamp(12px, 2.5vw, 32px);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-firm);
  background: rgba(14, 17, 22, 0.9);
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.4s var(--ease-out) 0.15s, transform 0.4s var(--ease-back) 0.15s,
              color 0.3s, border-color 0.3s, background 0.3s;
}
.toy-stage.open .stage-close { opacity: 1; transform: none; }
.stage-close:hover { color: var(--fg); border-color: var(--line-firm); background: rgba(30, 34, 44, 0.95); }
.stage-close:active { transform: scale(0.92); }

.toy-stage > .toy {
  width: min(var(--stage-w, 760px), 100%);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #14171f, #0b0d12);
  border-color: var(--line-firm);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.75);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.45s var(--ease-back), border-color 0.3s;
}
.toy-stage.open > .toy { transform: none; }
.toy-stage > .toy:hover { transform: none; border-color: var(--line-firm); }
/* 卡片在光台里是可滚动容器，右上角那团光晕不能再往外溢，否则会凭空长出滚动条 */
.toy-stage > .toy::after { inset: 0 0 auto auto; width: 70%; }

/* 放大后各台机器的尺寸约束：格子要变大，但不能大到要滚屏才能玩 */
.toy-stage > .toy--doodle { --stage-w: 980px; }
.toy-stage > .toy--piano { --stage-w: 940px; }
.toy-stage > .toy--bounce { --stage-w: 900px; }

.toy-stage .bubble-grid {
  max-width: 580px; width: 100%; margin: 0 auto;
  gap: clamp(4px, 0.7vw, 8px);
}
.toy-stage .whack-board { max-width: 470px; width: 100%; margin: 0 auto; }
.toy-stage .memory-grid { max-width: 430px; width: 100%; margin: 0 auto; }
.toy-stage .pads { max-width: 780px; width: 100%; margin: 0 auto; }

/* 弹珠：给足高度，物理空间变大更好玩 */
.toy-stage .toy--bounce .toy-canvas { height: min(62vh, 620px); aspect-ratio: auto; }

/* 涂鸦：死守 16/10 不变形，只用宽高上限控制大小，避免 resize 后重绘走形 */
.toy-stage .toy--doodle .toy-canvas {
  width: 100%;
  max-width: min(100%, calc(56vh * 1.6));
  margin: 0 auto;
}

/* ============================================================
   9. 六台机器
   ============================================================ */

/* ---------- 9.1 泡泡纸 ---------- */
.bubble-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(3px, 0.5vw, 6px);
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  touch-action: none;
}

.bubble {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.85), rgba(255,255,255,0.16) 42%, transparent 62%),
    radial-gradient(circle at 60% 70%, color-mix(in srgb, var(--toy) 60%, transparent), rgba(255,255,255,0.06) 70%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s var(--ease-back), background 0.3s, opacity 0.3s, box-shadow 0.3s;
}
.bubble:hover { transform: scale(1.12); }
.bubble.pop {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.6);
  transform: scale(0.82);
  animation: pop 0.32s var(--ease-out) forwards;
  pointer-events: none;
}
@keyframes pop {
  0%   { transform: scale(1.18); }
  46%  { transform: scale(0.78); }
  100% { transform: scale(0.82); }
}
.bubble-grid.is-done { animation: gridShake 0.4s var(--ease-io); }
@keyframes gridShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ---------- 9.2 打地鼠 ---------- */
.whack-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.2vw, 12px);
  padding: 6px;
  border-radius: 12px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255, 180, 58, 0.08), transparent 70%),
    rgba(0, 0, 0, 0.22);
}

.hole {
  position: relative;
  aspect-ratio: 1 / 0.82;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 118%, rgba(0,0,0,0.85) 38%, transparent 62%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.mole {
  position: absolute;
  left: 50%; bottom: 6%;
  width: 62%;
  aspect-ratio: 1 / 0.92;
  translate: -50% 0;
  border-radius: 48% 48% 40% 40%;
  background: radial-gradient(circle at 36% 30%, #ffd98a, #ffb43a 52%, #b06a12);
  transform: translateY(108%);
  transition: transform 0.16s var(--ease-out);
  will-change: transform;
}
.mole::before,
.mole::after {
  content: "";
  position: absolute;
  top: 30%;
  width: 14%; aspect-ratio: 1;
  border-radius: 50%;
  background: #2a1a05;
}
.mole::before { left: 24%; }
.mole::after  { right: 24%; }

.hole.up .mole { transform: translateY(0); }
.hole.hit .mole {
  transform: translateY(40%) scale(0.82, 0.6);
  filter: brightness(1.9);
}
.hole.miss .mole { animation: miss 0.2s var(--ease-io); }
@keyframes miss {
  0%, 100% { rotate: 0deg; }
  30%      { rotate: -8deg; }
  70%      { rotate: 8deg; }
}

/* ---------- 9.3 弹珠 ---------- */
.toy--bounce .toy-canvas { cursor: crosshair; }

/* ---------- 9.4 涂鸦 ---------- */
.toy--doodle .toy-canvas {
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px) 0 0 / 100% 26px,
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px) 0 0 / 26px 100%,
    rgba(0, 0, 0, 0.3);
  cursor: crosshair;
}
.toy-foot--tools { justify-content: space-between; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.2s var(--ease-back), box-shadow 0.2s;
}
.swatch:hover { transform: scale(1.15); }
.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor;
  transform: scale(1.1);
}
.doodle-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 9.5 钢琴 ---------- */
.pads {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: clamp(4px, 0.6vw, 8px);
  touch-action: manipulation;
}
.pad {
  position: relative;
  aspect-ratio: 1 / 2.6;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, #fdfdff, #d8dbe6);
  color: #1a1d26;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px;
  transition: transform 0.09s var(--ease-out), box-shadow 0.2s, background 0.2s;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), inset 0 -6px 10px rgba(0, 0, 0, 0.08);
}
.pad:hover { background: linear-gradient(180deg, #ffffff, #e6e9f2); }
.pad:active,
.pad.on {
  transform: translateY(4px) scaleY(0.98);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--toy) 70%, transparent),
    0 0 26px color-mix(in srgb, var(--toy) 65%, transparent),
    inset 0 -2px 6px rgba(0, 0, 0, 0.1);
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--toy) 45%, #fff));
}
.pad i {
  position: absolute; top: 8px; left: 50%; translate: -50% 0;
  font-style: normal;
  font-size: 10px;
  color: #9aa0b0;
}

/* ---------- 9.6 记忆翻牌 ---------- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 1vw, 10px);
}
.card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  perspective: 700px;
  background: none;
  padding: 0;
}
.card-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.45s var(--ease-out);
  border-radius: inherit;
}
.card.flipped .card-inner,
.card.matched .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: inherit;
  backface-visibility: hidden;
  font-size: clamp(18px, 2vw, 26px);
  border: 1px solid var(--line-firm);
}
.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #1b1f2b, #10131b);
  color: var(--fg-mute);
  font-family: var(--font-display);
  font-size: 16px;
}
.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #21252f, #171a22);
  border-color: color-mix(in srgb, var(--toy) 45%, transparent);
}
.card.matched .card-front {
  background: color-mix(in srgb, var(--toy) 22%, #171a22);
  border-color: var(--toy);
}
.card.matched { animation: matchPop 0.5s var(--ease-back); }
@keyframes matchPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ============================================================
   10. 成就
   ============================================================ */
.badge-progress {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 28px;
}
.badge-bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.badge-bar i {
  display: block;
  height: 100%; width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ce0ff, var(--accent), #ff6bd6);
  transition: width 0.7s var(--ease-out);
}
.badge-count {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.badge-item {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 0.4s, background 0.4s, transform 0.4s var(--ease-out);
}
.badge-item:hover { transform: translateY(-2px); border-color: var(--line-firm); }

.badge-item .ico {
  flex: none;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 17px;
  filter: grayscale(1) opacity(0.4);
  transition: filter 0.5s, background 0.5s, box-shadow 0.5s;
}
.badge-item .txt { min-width: 0; }
.badge-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-mute);
  transition: color 0.4s;
}
.badge-item small {
  display: block;
  font-size: 11.5px;
  color: var(--fg-mute);
  opacity: 0.7;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-item.locked small { filter: blur(0); }
.badge-item.locked .ico { filter: grayscale(1) opacity(0.28); }

.badge-item.unlocked {
  border-color: rgba(214, 255, 63, 0.32);
  background: rgba(214, 255, 63, 0.05);
}
.badge-item.unlocked .ico {
  filter: none;
  background: rgba(214, 255, 63, 0.14);
  box-shadow: 0 0 22px rgba(214, 255, 63, 0.16);
}
.badge-item.unlocked strong { color: var(--fg); }
.badge-item.unlocked small { color: var(--fg-dim); opacity: 1; }
.badge-item.unlocked::after {
  content: "✓";
  position: absolute; top: 10px; right: 12px;
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-display);
}

/* ============================================================
   11. 结尾与页脚
   ============================================================ */
.section--final { text-align: center; padding: clamp(90px, 15vh, 180px) 0; }
.final-inner { position: relative; }
.final h2 {
  font-size: clamp(32px, 6.4vw, 92px);
  margin: 18px 0 24px;
}
.final-sub {
  color: var(--fg-dim);
  max-width: 46ch;
  margin: 0 auto;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 30px 0;
  font-size: 12px;
  color: var(--fg-mute);
}
.foot-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; flex-wrap: wrap;
}
.kbd-hint { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kbd-hint kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px;
  padding: 0 4px;
  font-family: var(--font-display);
  font-size: 10px;
  border: 1px solid var(--line-firm);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.03);
}
.kbd-hint i {
  font-style: normal;
  margin-left: 6px;
  color: var(--fg-mute);
}

.noscript {
  position: fixed; inset: auto 0 0 0;
  z-index: 9999;
  padding: 14px;
  text-align: center;
  background: #ffb43a;
  color: #1a1200;
  font-size: 13px;
}

/* ============================================================
   12. 自定义光标
   ============================================================ */
.cursor-trail {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 8980;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}
body.has-cursor .cursor-trail { opacity: 1; }

.cursor-dot {
  position: fixed; top: 0; left: 0;
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(214, 255, 63, 0.85);
  pointer-events: none;
  z-index: 8990;
  opacity: 0;
  will-change: transform;
  transition: opacity 0.35s var(--ease-out),
              width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              margin 0.3s var(--ease-out), background 0.3s, box-shadow 0.3s;
}
body.has-cursor .cursor-dot { opacity: 1; }

body.cursor-hot .cursor-dot {
  width: 15px; height: 15px;
  margin: -7.5px 0 0 -7.5px;
  background: rgba(214, 255, 63, 0.28);
  box-shadow: 0 0 0 1px rgba(214, 255, 63, 0.9), 0 0 22px rgba(214, 255, 63, 0.55);
}

body.cursor-down .cursor-dot {
  width: 4px; height: 4px;
  margin: -2px 0 0 -2px;
  box-shadow: 0 0 22px rgba(214, 255, 63, 1);
}

body.has-cursor,
body.has-cursor * { cursor: none !important; }
/* 输入框恢复系统光标，别让人猜 */
body.has-cursor input,
body.has-cursor textarea { cursor: text !important; }

/* ============================================================
   13. 提示气泡 / 弹窗
   ============================================================ */
.toast-layer {
  position: fixed;
  left: 50%; bottom: 28px;
  translate: -50% 0;
  z-index: 9500;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(214, 255, 63, 0.34);
  background: rgba(14, 17, 22, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--fg);
  animation: toastIn 0.5s var(--ease-back) both;
}
.toast.out { animation: toastOut 0.4s var(--ease-out) forwards; }
.toast b { color: var(--accent); }
@keyframes toastIn {
  0%   { opacity: 0; transform: translateY(20px) scale(0.94); }
  100% { opacity: 1; transform: none; }
}
@keyframes toastOut {
  0%   { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(12px) scale(0.96); }
}

.modal {
  position: fixed; inset: 0;
  z-index: 9600;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(4, 5, 8, 0.78);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-box {
  width: min(520px, 100%);
  padding: 34px;
  border-radius: 22px;
  border: 1px solid var(--line-firm);
  background: linear-gradient(170deg, #14171f, #0c0e13);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.45s var(--ease-back);
}
.modal.open .modal-box { transform: none; }
.modal-ico { font-size: 42px; line-height: 1; }
.modal-box h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin: 16px 0 10px;
  letter-spacing: -0.02em;
}
.modal-box p { color: var(--fg-dim); font-size: 14px; margin-bottom: 24px; }
.modal-box .btn { width: 100%; justify-content: center; }

/* ============================================================
   14. 无障碍：尊重"减少动效"
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal-line > span, .fade-up { transform: none; opacity: 1; }
  .marquee-track { animation: none; }
  .mascot { animation: none; }
}

/* ============================================================
   15. 响应式收尾
   ============================================================ */
@media (max-width: 640px) {
  .bubble-grid { grid-template-columns: repeat(8, 1fr); }
  .pads { gap: 4px; }
  .pad { font-size: 9px; padding-bottom: 6px; }
  .hero { padding-top: 120px; }
  .toy-foot--tools { gap: 10px; }
  .foot-row { justify-content: center; text-align: center; }

  /* 小屏放大游玩：光台贴边，机器撑满，去掉多余的留白 */
  .toy-stage { padding: 46px 0 0; align-items: stretch; }
  .toy-stage > .toy {
    width: 100%; max-height: 100%;
    border-radius: 0; border-left: 0; border-right: 0;
  }
  .stage-tip { display: none; }
}

@media (max-width: 420px) {
  .bubble-grid { grid-template-columns: repeat(7, 1fr); }
  .tag--score { display: none; }
}
