:root {
  color-scheme: dark;
  --bg: #08100e;
  --ink: #f5f3e8;
  --muted: #a9b8af;
  --line: rgba(245, 243, 232, 0.16);
  --gold: #f4c65d;
  --cyan: #6de4ff;
  --rose: #ff5575;
  --green: #69f0ad;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(109, 228, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 12%, rgba(244, 198, 93, 0.16), transparent 24rem),
    linear-gradient(145deg, #07100d, #111512 50%, #170d12);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.hud {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 2px 14px;
}

.actions {
  align-self: center;
  display: grid;
  gap: 7px;
  justify-items: end;
}

.actions p {
  min-width: 104px;
  margin: 0;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: right;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.meters {
  display: grid;
  grid-template-columns: repeat(5, minmax(64px, 1fr));
  gap: 8px;
  min-width: min(340px, 100%);
}

.sound-toggle {
  padding: 10px 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.08);
  color: var(--ink);
  white-space: nowrap;
}

.meters div,
.controls div {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 8px;
  padding: 10px 12px;
}

.meters span {
  display: block;
  color: var(--gold);
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1;
}

.meters small,
.controls span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.game-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030604;
  aspect-ratio: 1200 / 780;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.34);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  background: rgba(3, 6, 4, 0.72);
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 6.5rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.overlay p {
  width: min(560px, 92vw);
  margin: 0;
  color: #dce5dd;
  font-size: 1rem;
  line-height: 1.45;
}

button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 13px 22px;
  background: var(--gold);
  color: #11100a;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 12px;
}

.controls strong {
  color: var(--ink);
}

.tutorial { position: absolute; right: 16px; bottom: 16px; display: grid; width: min(330px, calc(100% - 32px)); gap: 6px; padding: 13px; border: 1px solid rgba(109, 228, 255, 0.48); border-radius: 8px; background: rgba(3, 12, 11, 0.89); box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35); }
.tutorial span, .fine-print, .player-options p { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.tutorial button, .remaps button, .option-grid button { justify-self: start; padding: 8px 11px; font-size: 0.82rem; }
.player-options { display: grid; gap: 10px; padding-top: 12px; }
details { border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.045); padding: 11px 12px; }
summary { cursor: pointer; font-weight: 800; }
.remaps, .option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.remaps label, .option-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.88rem; }
.remaps button { min-width: 88px; color: var(--ink); background: rgba(255,255,255,0.1); border: 1px solid var(--line); }
.high-contrast { --muted: #e7f2ec; --line: rgba(255, 255, 255, 0.62); --cyan: #8cf4ff; --rose: #ff8da4; }
.high-contrast .game-wrap { border-width: 3px; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 16px, 560px);
    padding-top: 10px;
  }

  .hud {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-items: stretch;
  }

  .actions p {
    text-align: left;
  }

  .meters,
  .controls,
  .remaps,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .tutorial { bottom: 10px; right: 8px; width: calc(100% - 16px); }

  .game-wrap {
    aspect-ratio: 9 / 14;
  }
}
