@font-face {
  font-family: Syne;
  src: url("./fonts/syne-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Syne;
  src: url("./fonts/syne-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("./fonts/outfit-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("./fonts/outfit-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07060f;
  --ink: #f6f3ff;
  --muted: #a39bb8;
  --cyan: #6ff7ec;
  --magenta: #ff4dce;
  --gold: #ffe14a;
  --line: rgba(255, 255, 255, 0.12);
  --sans: Outfit, "Liberation Sans", sans-serif;
  --display: Syne, Outfit, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  background:
    radial-gradient(880px 460px at 12% 0%, rgba(255, 77, 206, 0.22), transparent 60%),
    radial-gradient(720px 480px at 90% 100%, rgba(111, 247, 236, 0.14), transparent 55%),
    radial-gradient(540px 380px at 55% 42%, rgba(120, 80, 255, 0.12), transparent 62%),
    var(--bg);
  overflow: hidden;
}

.app {
  height: 100dvh;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(280px, 460px);
  gap: 32px;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.copy { min-width: 0; }

.brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-transform: uppercase;
}

.score {
  margin: 18px 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(4.2rem, 8vw, 6.4rem);
  line-height: 0.82;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
}

.score.pop { animation: pop 0.18s ease-out; }

@keyframes pop {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}

.best {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.best strong {
  color: var(--gold);
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0;
}

.lede {
  margin: 22px 0 0;
  max-width: 28ch;
  color: var(--muted);
  line-height: 1.45;
}

.keys {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

kbd {
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  padding: 1px 7px;
}

.play {
  height: min(760px, calc(100dvh - 56px));
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.stage {
  position: relative;
  min-height: 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  overflow: hidden;
  background-color: rgba(5, 4, 14, 0.72);
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.6px),
    radial-gradient(circle at 74% 14%, rgba(255, 255, 255, 0.4) 0 1px, transparent 1.6px),
    radial-gradient(circle at 42% 48%, rgba(255, 255, 255, 0.28) 0 1px, transparent 1.6px),
    radial-gradient(circle at 84% 62%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.6px),
    radial-gradient(ellipse at 50% 100%, rgba(111, 247, 236, 0.16), transparent 58%),
    radial-gradient(ellipse at 50% 0%, rgba(255, 77, 206, 0.14), transparent 52%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), inset 0 0 80px rgba(80, 40, 120, 0.12);
}

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

.hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
  font-size: 0.95rem;
}

.hint[hidden] { display: none; }

.over {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(280px, 86%);
  transform: translate(-50%, -50%);
  padding: 22px 18px 18px;
  text-align: center;
  background: rgba(7, 6, 15, 0.82);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 36px rgba(255, 77, 206, 0.16);
}

.over[hidden] { display: none; }

.kicker {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ff8ad8;
  font-size: 0.78rem;
}

.final {
  margin: 8px 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 4.4rem;
  line-height: 0.85;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.over:not([hidden]) { animation: over-in 0.18s ease-out; }

@keyframes over-in {
  from { opacity: 0; transform: translate(-50%, -44%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.note {
  margin: 10px 0 0;
  color: var(--muted);
}

.dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.combo {
  margin: 0;
  min-height: 1.2em;
  color: var(--gold);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

button {
  appearance: none;
  border: 0;
  height: 48px;
  min-width: 132px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8ffef4, #1ad4c6);
  color: #061311;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

button:hover { filter: brightness(1.06); }

button:active { transform: translateY(1px); }

button.again {
  background: linear-gradient(180deg, #ff9ae4, #ff3dbe);
  color: #1a0612;
}

button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

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

@media (max-width: 800px) {
  body { overflow: hidden; }

  .app {
    max-width: 560px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
  }

  .copy {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    align-items: end;
  }

  .brand {
    grid-column: 1 / -1;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
  }

  .score {
    margin: 2px 0 0;
    font-size: clamp(2.6rem, 14vw, 3.6rem);
  }

  .best { margin: 0 0 6px; text-align: right; }

  .lede, .keys { display: none; }

  .play { height: auto; }
}

@media (max-width: 380px) {
  .brand { letter-spacing: 0.04em; font-size: 1.02rem; }
  button { min-width: 112px; padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .score.pop { animation: none; }
  .over:not([hidden]) { animation: none; }
}
