/* Stoop — evening sodium, one-handed, cheeky. */

:root {
  --bg: #1b1430;
  --ink: #f7efe2;
  --muted: #c9b8a0;
  --paper: #2a2144;
  --line: #3d3358;
  --sodium: #ffb347;
  --stoop: #ff7a59;
  --up: #7dd3b0;
  --ping: #8ab4ff;
  --good: #5ee0a0;
  --bad: #ff6b7a;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -10%, #3a2a18 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  max-width: 440px;
  margin: 0 auto;
  padding: 12px 12px calc(20px + env(safe-area-inset-bottom));
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 2px 12px;
}
h1 { font-size: 1.65rem; letter-spacing: -0.03em; }
h1 span { font-size: 0.9rem; color: var(--sodium); font-weight: 800; vertical-align: super; }
.header-right { display: flex; gap: 10px; align-items: center; }
#streak { font-weight: 800; }
#help-btn, .x {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.ticket {
  border: 2px dashed var(--sodium);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #241b38;
  margin-bottom: 14px;
}
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sodium);
  font-weight: 800;
}
.ticket h2 { font-size: 1.35rem; margin: 2px 0 4px; }
.ticket p:last-child { color: var(--muted); font-size: 0.95rem; }

.tick-no { font-size: 0.8rem; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.rail { display: flex; gap: 6px; margin-bottom: 12px; }
.dot {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: var(--line);
}
.dot.done { background: var(--up); }
.dot.done[data-act="stoop"] { background: var(--stoop); }
.dot.done[data-act="ping"] { background: var(--ping); }
.dot.now { background: var(--sodium); box-shadow: 0 0 10px #ffb34788; }
.dot.arrive { outline: 2px solid var(--ink); }

.stage {
  border-radius: 20px;
  padding: 22px 18px 20px;
  background: var(--paper);
  border: 2px solid var(--line);
  min-height: 150px;
  transition: transform 0.18s ease, background 0.2s;
}
.stage.flip { animation: flip 0.28s ease; }
@keyframes flip {
  0% { transform: rotateX(12deg) scale(0.98); opacity: 0.6; }
  100% { transform: none; opacity: 1; }
}
.stage.heat-1 { border-color: var(--sodium); }
.stage.heat-2 { border-color: var(--stoop); box-shadow: 0 0 0 3px #ff7a5933; }
.stage.caught { background: #1f3a2e; border-color: var(--good); }
.stage.missed { background: #3a1f2a; border-color: var(--bad); }
.card-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
#card-label { font-size: 1.7rem; margin: 6px 0 8px; letter-spacing: -0.03em; }
#card-sub { color: var(--muted); font-size: 1rem; line-height: 1.35; }

.flavor {
  min-height: 2.4em;
  margin: 12px 2px 14px;
  color: var(--muted);
  font-size: 0.95rem;
}
.flavor.pinged { color: var(--ping); }

.play-row, .btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.btn-row { grid-template-columns: 1fr 1fr; margin-top: 14px; }

button {
  appearance: none;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 14px 8px;
  border-radius: 14px;
  cursor: pointer;
}
button.primary { background: var(--stoop); border-color: #ff9a82; color: #2a1020; }
button:disabled { opacity: 0.45; cursor: default; }
#btn-up { background: #1f3a32; border-color: var(--up); }
#btn-ping { background: #1c2a44; border-color: var(--ping); }
button:active { transform: translateY(1px); }

#overlay, #help {
  position: fixed;
  inset: 0;
  background: #0d0a18cc;
  display: grid;
  place-items: end center;
  padding: 12px;
  z-index: 20;
}
#overlay[hidden], #help[hidden] { display: none; }
#overlay .card, #help .card {
  width: min(440px, 100%);
  background: #241b38;
  border: 2px solid var(--sodium);
  border-radius: 20px 20px 12px 12px;
  padding: 18px 16px 16px;
  position: relative;
  max-height: 88vh;
  overflow: auto;
}
.x { position: absolute; top: 10px; right: 10px; }
.big-score { font-size: 3.2rem; font-weight: 800; letter-spacing: -0.04em; }
.tier { font-size: 1.25rem; font-weight: 800; color: var(--sodium); }
.next-grade, .best, .streak-line { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }
.day-emojis { font-size: 1.35rem; letter-spacing: 0.08em; margin: 10px 0; }
.explain, .near { margin-top: 10px; line-height: 1.4; color: var(--ink); }
.near { color: var(--muted); }
.help-list { padding-left: 0; list-style: none; }
.help-list li { margin: 0.55rem 0; line-height: 1.4; }

.confetti {
  position: fixed;
  top: -20px;
  animation: fall 2.4s linear forwards;
  pointer-events: none;
  z-index: 40;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(240deg); opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  .stage.flip, .confetti { animation: none; }
}
