@font-face {
  font-family: 'Fredoka';
  src: url('../shared/fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg-top: #1d2350;
  --bg-bottom: #10142f;
  --ink: #f3f1ff;
  --muted: #9aa0d6;
  --panel: #232a5c;
  --gold: #ffc23d;
  --accent: #5ad1a4;
  --danger: #ff6b57;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-bottom);
  color: var(--ink);
  font-family: 'Fredoka', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body {
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-top), var(--bg-bottom) 70%);
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  max-width: 620px;
  margin: 0 auto;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 16px 4px;
}

.best {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 600;
  font-size: 18px;
}
.best svg { width: 20px; height: 20px; fill: var(--gold); }

.score {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.score.bump { transform: scale(1.12); }

.icon-btn {
  justify-self: end;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; fill: none; }

.stage {
  flex: 1;
  position: relative;
  min-height: 0;
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.sheet {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 28, 0.62);
  backdrop-filter: blur(3px);
  padding: 16px;
  z-index: 10;
  animation: fade 0.18s ease;
}
.sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.sheet-card {
  width: min(360px, 100%);
  background: linear-gradient(180deg, #2b3370, #222859);
  border-radius: 22px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: rise 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes rise { from { transform: translateY(18px) scale(0.97); opacity: 0; } }

.sheet-card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.sheet-card p { margin: 0 0 4px; color: #cfd2f5; line-height: 1.45; font-size: 16px; }

.btn {
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  border: 0;
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.btn:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2); }
.btn.primary { background: var(--accent); color: #0f2a22; }
.btn.reward { background: var(--gold); color: #3a2600; }
.btn.reward svg { width: 18px; height: 18px; fill: currentColor; }
.btn[hidden] { display: none; }

.small-link { color: var(--muted); text-align: center; font-size: 14px; margin-top: 4px; }

.over-kicker { text-align: center; color: var(--muted) !important; font-size: 17px !important; }
.over-score { text-align: center; font-size: 64px; font-weight: 700; line-height: 1.05; }
.over-best { text-align: center; color: var(--gold) !important; font-weight: 600; margin-bottom: 10px !important; }
