* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #08100f;
  --pine: #0f2a24;
  --snow: #f5fbf4;
  --mist: #b9d2c9;
  --muted: #7fa096;
  --line: rgba(201, 238, 224, 0.18);
  --star: #ffd64f;
  --boost: #57f0c5;
  --ice: #8edcff;
  --rock: #665b54;
  --danger: #ff7a64;
  --shadow: rgba(0, 0, 0, 0.42);
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% -10%, rgba(87, 240, 197, 0.22), transparent 30rem),
    linear-gradient(180deg, #102d27 0%, #08100f 56%, #050908 100%);
  color: var(--snow);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

button,
a {
  font: inherit;
  color: inherit;
}

.shell {
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100% - 24px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 12px 0 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin-bottom: 10px;
}

.brand {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(245, 251, 244, 0.06);
  text-decoration: none;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: calc(100svh - 92px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(142, 220, 255, 0.28);
  border-radius: 22px;
  background: #0a1614;
  box-shadow:
    0 0 0 1px rgba(87, 240, 197, 0.12),
    0 30px 80px var(--shadow);
  touch-action: none;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#game-canvas:active {
  cursor: grabbing;
}

.hud {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-pill {
  display: flex;
  min-width: 64px;
  flex-direction: column;
  gap: 1px;
  padding: 6px 11px;
  border-radius: 11px;
  background: rgba(5, 12, 11, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hud-pill strong {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.05;
}

.hud-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-pill {
  text-align: right;
}

.combo-pill {
  align-items: center;
  border: 1px solid rgba(255, 214, 79, 0.5);
}

.combo-pill strong {
  color: var(--star);
}

.boost-flag {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 4;
  padding: 4px 14px;
  border: 1px solid rgba(87, 240, 197, 0.7);
  border-radius: 999px;
  background: rgba(87, 240, 197, 0.16);
  color: var(--boost);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  transform: translateX(-50%);
  box-shadow: 0 0 22px rgba(87, 240, 197, 0.45);
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 30%, rgba(8, 22, 20, 0.62), rgba(4, 9, 8, 0.88));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.panel {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--boost);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0 0 22px;
  color: var(--mist);
  font-size: 15px;
}

.cta {
  display: inline-flex;
  min-width: 180px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(180deg, var(--star), #f0b400);
  color: #2a1f04;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(255, 214, 79, 0.3);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 48px rgba(255, 214, 79, 0.4);
}

.cta:active {
  transform: translateY(0);
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hint.link {
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 3px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(245, 251, 244, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.result-score {
  margin: 4px 0 16px;
  color: var(--star);
  font-size: clamp(54px, 16vw, 76px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.02em;
}

.result-meta {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.result-meta div {
  display: flex;
  min-width: 96px;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(245, 251, 244, 0.05);
}

.result-meta strong {
  font-size: 22px;
  font-weight: 900;
}

.result-title-crash {
  color: var(--danger);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .shell {
    width: calc(100% - 16px);
  }

  .hud-pill {
    min-width: 56px;
    padding: 5px 9px;
  }

  .hud-pill strong {
    font-size: 17px;
  }
}
