:root {
  --bg: #050806;
  --surface: #0a100c;
  --surface-raised: #0e1711;
  --surface-deep: #070c09;
  --text: #edf7ef;
  --muted: #94a99a;
  --dim: #617368;
  --line: rgba(211, 255, 221, 0.1);
  --line-strong: rgba(211, 255, 221, 0.18);
  --lime: #c8ff62;
  --lime-bright: #dcff92;
  --lime-soft: rgba(200, 255, 98, 0.11);
  --mint: #61f2c3;
  --amber: #ffc857;
  --red: #ff7161;
  --font-display: "Bahnschrift", "Aptos Display", "Segoe UI Variable Display", "Microsoft YaHei", sans-serif;
  --font-body: "Aptos", "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(circle at 12% -8%, rgba(159, 255, 82, 0.075), transparent 34rem),
    radial-gradient(circle at 92% 9%, rgba(255, 190, 87, 0.045), transparent 28rem),
    radial-gradient(circle at 50% 110%, rgba(69, 210, 150, 0.055), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font: inherit;
}

::selection {
  color: #0b1207;
  background: var(--lime);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ambient,
.page-grid {
  position: fixed;
  pointer-events: none;
}

.ambient {
  z-index: 0;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.6;
}

.ambient-a {
  top: -18rem;
  left: -10rem;
  width: 40rem;
  height: 40rem;
  background: rgba(151, 255, 72, 0.07);
  animation: ambientDrift 18s ease-in-out infinite alternate;
}

.ambient-b {
  right: -15rem;
  bottom: -18rem;
  width: 38rem;
  height: 38rem;
  background: rgba(255, 174, 64, 0.045);
  animation: ambientDrift 23s ease-in-out infinite alternate-reverse;
}

.page-grid {
  z-index: 0;
  inset: 0;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(195, 255, 115, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(195, 255, 115, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 18%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 18%, transparent 78%);
}

.site-header,
.arcade,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding:
    max(26px, calc(env(safe-area-inset-top) + 14px))
    max(32px, calc(env(safe-area-inset-right) + 20px))
    12px
    max(32px, calc(env(safe-area-inset-left) + 20px));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: var(--lime);
  filter: drop-shadow(0 0 16px rgba(200, 255, 98, 0.14));
  place-items: center;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1;
}

.brand-copy small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: 1px solid var(--line);
  background: rgba(13, 21, 16, 0.72);
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition:
    border-color 180ms ease,
    color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.icon-btn {
  width: 40px;
  padding: 0;
  border-radius: 11px;
}

.ghost-btn {
  padding: 0 14px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
}

.icon-btn:hover,
.ghost-btn:hover {
  border-color: rgba(200, 255, 98, 0.34);
  background: rgba(23, 35, 25, 0.88);
  color: var(--lime-bright);
}

.icon-btn:active,
.ghost-btn:active {
  transform: translateY(1px);
}

.icon-btn:disabled,
.ghost-btn:disabled {
  cursor: default;
  opacity: 0.35;
  transform: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.icon-btn.small .icon {
  width: 16px;
  height: 16px;
}

.icon-btn.is-muted {
  color: var(--dim);
}

.arcade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 334px;
  align-items: start;
  gap: 28px;
  width: min(100%, 1240px);
  margin: 12px auto 0;
  padding:
    0
    max(32px, calc(env(safe-area-inset-right) + 20px))
    0
    max(32px, calc(env(safe-area-inset-left) + 20px));
}

.game-column {
  min-width: 0;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, clamp(360px, 62vh, 600px));
  margin: 0 auto 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.signal-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.signal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(200, 255, 98, 0.8);
  animation: signalPulse 2.5s ease-in-out infinite;
}

.signal-code {
  color: rgba(120, 140, 126, 0.55);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 19, 14, 0.7);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.status-pill[data-state="running"] {
  border-color: rgba(200, 255, 98, 0.25);
  background: rgba(200, 255, 98, 0.06);
  color: var(--lime);
}

.status-pill[data-state="running"] .status-dot {
  animation: signalPulse 1.1s ease-in-out infinite;
}

.status-pill[data-state="paused"],
.status-pill[data-state="countdown"] {
  border-color: rgba(255, 200, 87, 0.24);
  background: rgba(255, 200, 87, 0.055);
  color: var(--amber);
}

.status-pill[data-state="over"] {
  border-color: rgba(255, 113, 97, 0.26);
  background: rgba(255, 113, 97, 0.06);
  color: var(--red);
}

.scorebar {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 36px);
  width: min(100%, clamp(360px, 62vh, 600px));
  margin: 0 auto 10px;
  padding: 11px 14px 11px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(20, 31, 23, 0.82), rgba(10, 16, 12, 0.9)),
    var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 18px 45px rgba(0, 0, 0, 0.17);
  backdrop-filter: blur(14px);
}

.score-primary,
.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.metric-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1;
}

.score-primary strong,
.metric strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-primary strong {
  color: #efffdc;
  font-size: 30px;
  text-shadow: 0 0 24px rgba(200, 255, 98, 0.18);
}

.metric {
  padding-left: clamp(16px, 2.5vw, 30px);
  border-left: 1px solid var(--line);
}

.metric strong {
  font-size: 19px;
}

.scorebar-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.board-shell {
  position: relative;
  width: min(100%, clamp(360px, 62vh, 600px));
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(209, 255, 219, 0.14);
  border-radius: 20px;
  background: #07100b;
  box-shadow:
    inset 0 0 0 1px rgba(200, 255, 98, 0.025),
    inset 0 0 70px rgba(0, 0, 0, 0.5),
    0 34px 90px rgba(0, 0, 0, 0.45),
    0 0 0 6px rgba(6, 11, 8, 0.75);
  isolation: isolate;
}

.board-shell::after {
  position: absolute;
  z-index: 2;
  top: -42%;
  left: 0;
  width: 100%;
  height: 32%;
  background: linear-gradient(180deg, transparent, rgba(200, 255, 98, 0.035), transparent);
  content: "";
  pointer-events: none;
  animation: scanSweep 8s linear infinite;
}

.board-shell.is-hit {
  animation: boardHit 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: crosshair;
}

#gameCanvas:focus-visible {
  outline: 2px solid rgba(200, 255, 98, 0.85);
  outline-offset: -4px;
}

.board-scanlines,
.board-vignette {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.board-scanlines {
  opacity: 0.14;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

.board-vignette {
  background:
    radial-gradient(circle at 50% 42%, transparent 35%, rgba(1, 5, 2, 0.24) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 11%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.34);
}

.overlay {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 5vw, 44px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(18, 31, 21, 0.72), rgba(3, 7, 4, 0.93) 66%),
    rgba(3, 8, 5, 0.78);
  backdrop-filter: blur(4px);
  animation: overlayIn 280ms ease both;
}

.overlay-inner {
  width: min(100%, 420px);
}

.overlay-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 15px;
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1.4;
}

.overlay-kicker::before {
  width: 18px;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0.7;
}

.overlay-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(46px, 9vmin, 78px);
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 0.84;
  text-wrap: balance;
}

.overlay-title span {
  color: var(--lime);
  text-shadow: 0 0 40px rgba(200, 255, 98, 0.16);
}

.overlay-copy {
  max-width: 340px;
  margin: 21px auto 0;
  color: #a9bbae;
  font-size: 12.5px;
  line-height: 1.75;
  text-wrap: pretty;
}

.overlay-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 280px);
  margin: 22px auto 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overlay-stats > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.overlay-stats > div + div {
  border-left: 1px solid var(--line);
}

.overlay-stats span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.18em;
}

.overlay-stats strong {
  color: var(--lime-bright);
  font-family: var(--font-mono);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 25px;
}

.overlay.is-countdown {
  background:
    radial-gradient(circle at 50% 50%, rgba(28, 44, 26, 0.8), rgba(3, 7, 4, 0.94) 70%),
    rgba(3, 8, 5, 0.82);
}

.overlay.is-countdown .overlay-title {
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: clamp(100px, 26vmin, 190px);
  font-weight: 500;
  letter-spacing: -0.1em;
  line-height: 0.85;
  text-shadow:
    0 0 50px rgba(200, 255, 98, 0.2),
    0 0 120px rgba(200, 255, 98, 0.08);
}

.overlay.is-countdown .overlay-copy {
  margin-top: 24px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.overlay.is-over .overlay-title {
  color: #fff2ed;
  font-size: clamp(44px, 8.6vmin, 72px);
}

.overlay.is-over .overlay-title span {
  color: var(--red);
  text-shadow: 0 0 44px rgba(255, 113, 97, 0.14);
}

.overlay.is-record .overlay-title span {
  color: var(--amber);
  text-shadow: 0 0 44px rgba(255, 200, 87, 0.15);
}

.overlay.is-record .overlay-kicker {
  color: var(--amber);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.btn-primary {
  border-color: rgba(224, 255, 144, 0.8);
  background: var(--lime);
  color: #101807;
  box-shadow:
    0 11px 28px rgba(166, 240, 53, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.btn-primary:hover {
  background: var(--lime-bright);
  box-shadow:
    0 14px 34px rgba(166, 240, 53, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: rgba(15, 24, 18, 0.72);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(200, 255, 98, 0.26);
  background: rgba(24, 37, 27, 0.88);
  color: var(--lime-bright);
}

.btn:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.ghost-btn:focus-visible,
.mode-btn:focus-visible,
.dpad-btn:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.under-board {
  width: min(100%, clamp(360px, 62vh, 600px));
  margin: 12px auto 0;
}

.desktop-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 17px;
  margin: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.desktop-hint > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.desktop-hint .hint-muted {
  color: rgba(97, 115, 104, 0.62);
}

kbd {
  display: inline-grid;
  min-width: 21px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 5px;
  background: rgba(14, 23, 17, 0.8);
  color: #b7c8bc;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1;
  place-items: center;
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 48px);
  gap: 5px;
  width: max-content;
  margin: 14px auto 0;
  touch-action: none;
}

.dpad-btn {
  display: grid;
  width: 54px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 24, 18, 0.8);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  place-items: center;
  transition:
    background-color 100ms ease,
    color 100ms ease,
    border-color 100ms ease,
    transform 100ms ease;
}

.dpad-btn .icon {
  width: 19px;
  height: 19px;
}

.dpad-btn:hover {
  border-color: rgba(200, 255, 98, 0.24);
  color: var(--lime);
}

.dpad-btn.is-pressed,
.dpad-btn:active {
  border-color: var(--lime);
  background: var(--lime);
  color: #0e1608;
  transform: scale(0.95);
}

.dpad-up {
  grid-area: 1 / 2;
}

.dpad-left {
  grid-area: 2 / 1;
}

.dpad-pause {
  grid-area: 2 / 2;
  border-style: dashed;
  color: var(--dim);
}

.dpad-right {
  grid-area: 2 / 3;
}

.dpad-down {
  grid-area: 3 / 2;
}

.rail {
  position: sticky;
  top: 18px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(165deg, rgba(21, 33, 24, 0.6), rgba(8, 14, 10, 0.92) 56%),
    var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 30px 70px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px);
}

.rail-section + .rail-section {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.17em;
}

.section-label span:last-child {
  color: rgba(97, 115, 104, 0.55);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 9, 6, 0.55);
}

.mode-btn {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 3px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 170ms ease,
    border-color 170ms ease,
    color 170ms ease;
}

.mode-btn small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.mode-btn:hover:not(:disabled) {
  background: rgba(200, 255, 98, 0.05);
  color: var(--text);
}

.mode-btn.is-active {
  border-color: rgba(200, 255, 98, 0.22);
  background: rgba(200, 255, 98, 0.1);
  color: var(--lime-bright);
  box-shadow: inset 0 1px 0 rgba(200, 255, 98, 0.08);
}

.mode-btn.is-active small {
  color: rgba(200, 255, 98, 0.55);
}

.mode-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.mode-note {
  margin: 9px 1px 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.025em;
  line-height: 1.5;
}

.run-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.run-stats > div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 19, 14, 0.5);
}

.run-stats span {
  color: var(--dim);
  font-size: 9px;
}

.run-stats strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: grid;
  grid-template-columns: 17px 1fr auto;
  align-items: center;
  gap: 4px 6px;
  min-height: 25px;
}

.legend li span {
  color: var(--muted);
  font-size: 10.5px;
}

.legend li b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.legend li em {
  grid-column: 2 / 4;
  color: var(--dim);
  font-style: normal;
  font-size: 8.5px;
  line-height: 1.2;
}

.orb {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.orb-energy {
  background: radial-gradient(circle at 35% 30%, #f6ffd9 0 18%, var(--lime) 38%, #6fac2b 100%);
  box-shadow: 0 0 10px rgba(200, 255, 98, 0.38);
}

.orb-core {
  border-radius: 3px;
  background: radial-gradient(circle at 35% 30%, #fff5d5 0 18%, var(--amber) 42%, #b87a12 100%);
  box-shadow: 0 0 10px rgba(255, 200, 87, 0.34);
  transform: rotate(45deg);
}

.orb-danger {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255, 113, 97, 0.8);
  background: rgba(255, 113, 97, 0.1);
  box-shadow: 0 0 10px rgba(255, 113, 97, 0.2);
}

.core-note {
  margin: 12px 0 0;
  padding-left: 9px;
  border-left: 1px solid rgba(255, 200, 87, 0.28);
  color: var(--dim);
  font-size: 9.5px;
  line-height: 1.6;
}

.keys-section {
  padding-top: 15px;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--dim);
  font-size: 9px;
}

.key-cluster {
  display: inline-flex;
  gap: 3px;
}

.key-or {
  display: inline-flex;
  align-items: center;
  color: rgba(97, 115, 104, 0.45);
  font-family: var(--font-mono);
  font-size: 8px;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 18px;
}

.rail-actions .btn {
  width: 100%;
  min-height: 42px;
  font-size: 11.5px;
}

.rail-actions .btn-ghost {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: var(--dim);
}

.rail-actions .btn-ghost:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.site-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(100%, 1240px);
  margin: 22px auto 0;
  padding:
    16px
    max(32px, calc(env(safe-area-inset-right) + 20px))
    max(30px, calc(env(safe-area-inset-bottom) + 18px))
    max(32px, calc(env(safe-area-inset-left) + 20px));
  color: rgba(97, 115, 104, 0.68);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.12em;
}

.footer-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

.footer-end {
  margin-left: auto;
}

.help-dialog {
  width: min(100% - 32px, 660px);
  max-height: min(90svh, 760px);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--text);
}

.help-dialog::backdrop {
  background: rgba(1, 4, 2, 0.76);
  backdrop-filter: blur(8px);
}

.dialog-inner {
  max-height: min(90svh, 760px);
  padding: 26px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    radial-gradient(circle at 80% 0%, rgba(200, 255, 98, 0.06), transparent 22rem),
    linear-gradient(160deg, #111c14, #080e0a 62%);
  box-shadow:
    0 44px 120px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.help-dialog[open] .dialog-inner {
  animation: dialogIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-head p {
  margin: 0 0 6px;
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.help-grid h3 {
  margin: 0 0 9px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.help-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.help-grid p + p {
  margin-top: 10px;
}

.help-score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.help-score-list > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(9, 15, 11, 0.58);
}

.help-score-list span:not(.orb) {
  color: var(--muted);
  font-size: 10.5px;
}

.help-score-list b {
  margin-left: auto;
  color: var(--lime-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.manual-note {
  padding-left: 10px;
  border-left: 1px solid rgba(255, 200, 87, 0.32);
}

.dialog-tip {
  display: flex;
  gap: 13px;
  margin-top: 22px;
  padding: 13px 14px;
  border: 1px solid rgba(200, 255, 98, 0.11);
  border-radius: 11px;
  background: rgba(200, 255, 98, 0.035);
}

.dialog-tip span {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.12em;
}

.dialog-tip p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.dialog-close {
  width: 100%;
  margin-top: 20px;
}

@keyframes ambientDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3rem, 2rem, 0) scale(1.08); }
}

@keyframes signalPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes scanSweep {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(460%); opacity: 0; }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes boardHit {
  0%, 100% { transform: translate3d(0, 0, 0); border-color: rgba(255, 113, 97, 0.32); }
  20% { transform: translate3d(-4px, 2px, 0); }
  40% { transform: translate3d(4px, -2px, 0); }
  60% { transform: translate3d(-2px, -1px, 0); }
  80% { transform: translate3d(2px, 1px, 0); }
}

@media (max-width: 1060px) {
  .arcade {
    grid-template-columns: minmax(0, 1fr) 304px;
    gap: 22px;
    padding:
      0
      max(24px, calc(env(safe-area-inset-right) + 14px))
      0
      max(24px, calc(env(safe-area-inset-left) + 14px));
  }

  .site-header,
  .site-footer {
    padding-right: max(24px, calc(env(safe-area-inset-right) + 14px));
    padding-left: max(24px, calc(env(safe-area-inset-left) + 14px));
  }

  .rail {
    padding: 16px;
  }
}

@media (max-width: 940px) {
  .arcade {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 780px);
    gap: 20px;
  }

  .game-meta,
  .scorebar,
  .board-shell,
  .under-board {
    width: min(100%, 620px);
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 24px;
    width: min(100%, 620px);
    margin: 0 auto;
  }

  .rail-section + .rail-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .keys-section {
    display: none;
  }

  .rail-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
    margin-top: 0;
  }

  .rail-actions .btn-ghost {
    min-height: 42px;
    border-color: var(--line);
    background: rgba(15, 24, 18, 0.72);
    color: var(--text);
  }

  .site-footer {
    width: min(100%, 780px);
  }
}

@media (hover: none), (max-width: 780px) {
  .touch-controls {
    display: grid;
  }

  .desktop-hint {
    display: none;
  }

  .under-board {
    margin-top: 10px;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding:
      max(18px, calc(env(safe-area-inset-top) + 8px))
      max(16px, calc(env(safe-area-inset-right) + 8px))
      8px
      max(16px, calc(env(safe-area-inset-left) + 8px));
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-copy strong {
    font-size: 12px;
  }

  .brand-copy small {
    font-size: 6.5px;
  }

  .ghost-btn {
    width: 40px;
    padding: 0;
  }

  .ghost-btn span {
    display: none;
  }

  .arcade {
    margin-top: 8px;
    padding:
      0
      max(14px, calc(env(safe-area-inset-right) + 8px))
      calc(14px + env(safe-area-inset-bottom))
      max(14px, calc(env(safe-area-inset-left) + 8px));
  }

  .game-meta {
    margin: 0 2px 8px;
    font-size: 8px;
  }

  .signal-code {
    display: none;
  }

  .game-meta,
  .scorebar {
    width: 100%;
  }

  .scorebar {
    gap: 13px;
    padding: 9px 10px 9px 13px;
    border-radius: 13px;
  }

  .score-primary strong {
    font-size: 25px;
  }

  .metric {
    padding-left: 13px;
  }

  .metric strong {
    font-size: 16px;
  }

  .scorebar-actions {
    gap: 4px;
  }

  .icon-btn.small {
    width: 34px;
    height: 34px;
  }

  .board-shell {
    width: 100%;
    border-radius: 16px;
    box-shadow:
      inset 0 0 0 1px rgba(200, 255, 98, 0.025),
      0 24px 60px rgba(0, 0, 0, 0.38);
  }

  .overlay {
    padding: 20px;
  }

  .overlay-title {
    font-size: clamp(40px, 11.5vmin, 64px);
  }

  .overlay-copy {
    margin-top: 18px;
    font-size: 11.5px;
    line-height: 1.65;
  }

  .overlay-actions {
    margin-top: 20px;
  }

  .btn {
    min-height: 43px;
    padding: 0 17px;
    font-size: 11.5px;
  }

  .overlay-stats {
    margin-top: 18px;
    padding: 10px 0;
  }

  .overlay-stats strong {
    font-size: 22px;
  }

  .under-board {
    width: 100%;
  }

  .rail {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    padding: 15px;
    border-radius: 16px;
  }

  .rail-section + .rail-section {
    padding-top: 15px;
    border-top: 1px solid var(--line);
  }

  .rail-section:nth-child(2) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }

  .rail-section:nth-child(2) .section-label {
    grid-column: 1 / -1;
  }

  .rail-section:nth-child(2) .core-note {
    grid-column: 1 / -1;
  }

  .rail-actions {
    grid-template-columns: 1fr;
    gap: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .rail-actions .btn-ghost {
    min-height: 36px;
    border-color: transparent;
    background: transparent;
    color: var(--dim);
  }

  .site-footer {
    display: none;
  }

  .help-dialog {
    width: calc(100% - 24px);
  }

  .dialog-inner {
    padding: 20px;
    border-radius: 18px;
  }

  .dialog-head h2 {
    font-size: 27px;
  }

  .help-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
    padding-top: 18px;
  }

  .dialog-tip {
    margin-top: 18px;
  }
}

@media (max-width: 780px) and (max-height: 720px) {
  .touch-controls {
    grid-template-columns: repeat(5, 48px);
    grid-template-rows: 46px;
    gap: 4px;
    width: max-content;
    margin-top: 10px;
  }

  .dpad-btn {
    width: 48px;
    height: 46px;
  }

  .dpad-up {
    grid-area: 1 / 2;
  }

  .dpad-left {
    grid-area: 1 / 1;
  }

  .dpad-pause {
    grid-area: 1 / 3;
  }

  .dpad-right {
    grid-area: 1 / 5;
  }

  .dpad-down {
    grid-area: 1 / 4;
  }
}

@media (max-width: 380px) {
  .brand-copy small {
    display: none;
  }

  .scorebar {
    gap: 9px;
  }

  .metric {
    padding-left: 9px;
  }

  .score-primary strong {
    font-size: 22px;
  }

  .metric strong {
    font-size: 14px;
  }

  .overlay-title {
    font-size: 38px;
  }

  .overlay-actions {
    gap: 7px;
  }

  .overlay-actions .btn {
    padding: 0 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
