:root {
  --bg: #0a1512;
  --bg-2: #10201b;
  --line: #1f3a31;
  --text: #eaf6f0;
  --muted: #93b3a6;
  --coral: #ff7a5c;
  --camo: #6fe0b0;
  --alert: #ff5a5a;
  --firefly: #ffe27a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #17352b 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--firefly); }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(10, 21, 18, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .5px;
  text-decoration: none;
}

.logo .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 14px var(--coral);
}

.top nav { display: flex; gap: clamp(10px, 3vw, 28px); }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; }
.top nav a:hover { color: var(--text); }

@media (max-width: 420px) {
  .top nav a:first-child { display: none; }
}

/* Stage */
.play { padding: clamp(10px, 2.5vw, 24px) clamp(8px, 3vw, 28px) 8px; }

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  width: min(100%, 680px, calc(100svh - 230px));
  min-width: min(100%, 320px);
  padding: 8px;
  border-radius: 20px;
  background: #07120f;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  touch-action: none;
  cursor: crosshair;
}

/* HUD */
.hud-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 8px;
}

.hud-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.score { font-size: 24px; font-weight: 800; }
.round { color: var(--muted); font-weight: 700; }
.round b { color: var(--text); margin-left: 2px; }

.hearts { display: flex; gap: 4px; }
.hearts i {
  width: 14px;
  height: 14px;
  background: var(--coral);
  clip-path: path("M7 13.2 1.4 7.6A3.4 3.4 0 0 1 7 3a3.4 3.4 0 0 1 5.6 4.6Z");
  transition: opacity .3s, transform .3s;
}
.hearts i.lost { opacity: .18; transform: scale(.8); }

.timer {
  min-width: 2.4em;
  padding: 2px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--firefly);
}
.timer.urgent { color: var(--alert); border-color: var(--alert); }

.hud-actions { display: flex; justify-content: flex-end; gap: 6px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .cross { display: none; }
.icon-btn.muted .wave { display: none; }
.icon-btn.muted .cross { display: inline; }

.hud-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  padding: 10px 4px 2px;
}

.meter { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.meter .bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; }
.meter em { font-style: normal; min-width: 3ch; text-align: right; }
.meter.camo i { background: var(--camo); }
.meter.alert i { background: linear-gradient(90deg, #ffb24e, var(--alert)); }
.meter.alert.hot .bar { box-shadow: 0 0 10px var(--alert); }

.hint {
  grid-column: 1 / -1;
  min-height: 1.5em;
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.hint[data-tone="good"] { color: var(--camo); }
.hint[data-tone="warn"] { color: var(--coral); }
.hint[data-tone="bad"] { color: var(--alert); }

.stage.is-attract .hud-top > *,
.stage.is-attract .hud-bottom > * { visibility: hidden; }

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: inherit;
  text-align: center;
  background: rgba(7, 18, 15, .6);
  transition: opacity .25s;
}

.stage.is-attract .overlay {
  justify-content: flex-end;
  padding-bottom: 12%;
  background: linear-gradient(to bottom, rgba(7, 18, 15, 0) 40%, rgba(7, 18, 15, .85));
}

.overlay.hidden { opacity: 0; pointer-events: none; }
.stage.is-attract .overlay h1 { letter-spacing: .25em; text-indent: .25em; }

.overlay h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 64px);
  line-height: 1.1;
  letter-spacing: .04em;
  text-indent: .04em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .6);
}

.overlay p { margin: 0; color: var(--muted); }
.overlay .best { font-size: 14px; margin-top: 4px; }
.overlay .best b { color: var(--firefly); }

.btn {
  margin-top: 14px;
  padding: 12px 38px;
  border: 0;
  border-radius: 99px;
  background: var(--coral);
  color: #1a0b08;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255, 122, 92, .45);
  transition: transform .12s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  padding: 8px 24px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

/* Sections */
.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px clamp(16px, 4vw, 32px) 8px;
}

.section h2 { margin: 0 0 20px; font-size: 26px; }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.steps li {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.steps h3 { margin: 12px 0 4px; font-size: 18px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

.ico { width: 44px; height: 44px; border-radius: 50%; }
.ico-move { background: var(--coral); box-shadow: 0 0 18px var(--coral); }
.ico-blend { border-radius: 10px; background: radial-gradient(circle at 35% 35%, #55895d, #33604a); border: 2px dashed rgba(255, 255, 255, .3); }
.ico-light { border-radius: 0; background: linear-gradient(to top, rgba(255, 226, 122, .95), rgba(255, 226, 122, .1)); clip-path: polygon(50% 100%, 8% 0, 92% 0); }

.keys { margin: 18px 0 0; color: var(--muted); font-size: 14px; }
kbd {
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 22px 18px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--firefly);
  box-shadow: 0 0 10px var(--firefly);
}
.timeline time { font-weight: 700; color: var(--firefly); font-variant-numeric: tabular-nums; }
.timeline p { margin: 2px 0 0; color: var(--muted); }
.timeline b { color: var(--text); }

details {
  border-bottom: 1px solid var(--line);
  padding: 14px 4px;
}
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }

.foot {
  margin-top: 56px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}
