/* NumRush web — theme mirrors the iOS "Option A soft gradient" palette. */
:root {
  --bg: #faf8f5;
  --coral: #ff7b7b;
  --mint: #7bdcb5;
  --yellow: #ffd166;
  --teal: #14b8a6;
  --purple: #8b5cf6;
  --orange: #f5a623;
  --text: #2d3436;
  --text-2: #636e72;
  --white: #fff;
  --shadow: 0 8px 24px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:active { transform: scale(.98); }

/* ---------- Home ---------- */
.title { text-align: center; font-size: 52px; font-weight: 900; letter-spacing: -1px; margin: 24px 0 32px; }
.title .num { color: var(--teal); }
.title .rush { color: var(--mint); }
.section-label { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--text-2); margin: 8px 4px; text-transform: uppercase; }
.card-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }

.mode-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--white); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); text-align: left; width: 100%;
  transition: transform .1s ease;
}
.mode-card .badge {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 22px;
}
.badge.yellow { background: rgba(255,209,102,.22); color: var(--orange); }
.badge.coral  { background: rgba(255,123,123,.18); color: var(--coral); }
.badge.purple { background: rgba(139,92,246,.16); color: var(--purple); }
.mode-card .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mode-card .name { font-size: 19px; font-weight: 800; }
.mode-card .tag { font-size: 13px; color: var(--text-2); }
.mode-card .best { text-align: right; flex: none; }
.mode-card .best .lbl { font-size: 10px; font-weight: 800; color: var(--text-2); letter-spacing: .5px; }
.mode-card .best .val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--teal); }
.mode-card .chev { color: rgba(99,110,114,.5); font-size: 20px; flex: none; }
.foot { margin-top: auto; text-align: center; color: var(--text-2); font-size: 12px; padding-top: 24px; }

/* ---------- Game ---------- */
.game { flex: 1; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.topbar .timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 6px; }
.topbar .timer.low { color: var(--coral); }
.topbar .score { font-size: 26px; font-weight: 900; color: var(--coral); font-variant-numeric: tabular-nums; }
.topbar .combo { font-weight: 800; font-size: 18px; min-width: 54px; text-align: right; }
.topbar .combo .bolt { color: var(--yellow); }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 18px; color: var(--text-2); }

.play-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; position: relative; }
.combo-pop { position: absolute; top: 8%; font-size: 30px; font-weight: 900; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.target { font-size: 56px; font-weight: 900; letter-spacing: -1px; transition: transform .18s ease; }
.target.hit { transform: scale(1.12); }
.input {
  min-width: 160px; height: 62px; padding: 0 24px; border-radius: 16px; background: var(--white);
  box-shadow: var(--shadow); display: grid; place-items: center;
  font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace;
}
.input.empty { color: rgba(99,110,114,.35); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.key {
  height: 64px; border-radius: 15px; background: var(--white); box-shadow: var(--shadow);
  font-size: 27px; font-weight: 800; color: var(--text); display: grid; place-items: center;
  transition: transform .08s, opacity .08s;
}
.key:active { transform: scale(.95); opacity: .9; }
.key.submit { background: var(--mint); color: var(--white); }
.key.del { color: var(--text-2); font-size: 22px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(45,52,54,.92); color: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  padding: 40px 24px; text-align: center; z-index: 20; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay h1 { font-size: 48px; font-weight: 900; }
.overlay .sub { font-size: 18px; font-weight: 800; color: rgba(255,255,255,.7); letter-spacing: 1px; }
.overlay .bigscore { font-size: 76px; font-weight: 900; font-variant-numeric: tabular-nums; }
.overlay .points { font-size: 14px; font-weight: 800; color: rgba(255,255,255,.5); letter-spacing: 1px; }
.overlay .newhigh { color: var(--yellow); font-size: 18px; font-weight: 900; }
.stats { display: flex; gap: 26px; }
.stats .stat { display: flex; flex-direction: column; gap: 4px; min-width: 74px; }
.stats .stat .v { font-size: 26px; font-weight: 800; }
.stats .stat .k { font-size: 11px; font-weight: 800; color: rgba(255,255,255,.45); letter-spacing: .5px; }
.pill {
  width: 100%; max-width: 320px; padding: 16px; border-radius: 999px; font-size: 18px; font-weight: 800;
  color: var(--white); background: var(--coral); box-shadow: var(--shadow);
}
.pill.ghost { background: transparent; border: 1px solid rgba(255,255,255,.3); color: rgba(255,255,255,.75); font-size: 16px; }
.btn-col { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 25; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 6px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }

/* ---------- Multiplayer ---------- */
.mp-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.mp-header .iconbtn { font-size: 26px; font-weight: 700; }
.mp-title { font-size: 20px; font-weight: 800; }
.mode-card.select { align-items: center; }
.mode-card.select .radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(99,110,114,.35); flex: none; }
.mode-card.select.selected { outline: 2px solid var(--coral); background: rgba(255,123,123,.06); }
.mode-card.select.selected .radio { border-color: var(--coral); background: radial-gradient(circle, var(--coral) 42%, transparent 46%); }
.join-row { display: flex; gap: 10px; margin-bottom: 20px; }
.join-row .pill { max-width: 120px; }
.code-input { flex: 1; min-width: 0; padding: 14px 18px; border-radius: 14px; background: var(--white); box-shadow: var(--shadow); font-size: 17px; font-weight: 700; color: var(--text); border: none; outline: none; }
.code-input.wide { width: 100%; margin-bottom: 8px; }
.code-input::placeholder { color: rgba(99,110,114,.5); font-weight: 500; }
.pill { margin-bottom: 8px; }

.detail { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.detail-hero { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,123,123,.14); display: grid; place-items: center; font-size: 42px; margin-top: 8px; }
.detail-hero.yellow { background: rgba(255,209,102,.22); }
.detail-title { font-size: 26px; font-weight: 900; }
.detail-sub { font-size: 15px; color: var(--text-2); max-width: 300px; line-height: 1.4; }
.detail .pill { width: 100%; margin-top: 6px; }

.scoreboard { display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0; }
.sb-cell { flex: 1; background: var(--white); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 8px; }
.sb-cell.win { outline: 2px solid var(--mint); }
.sb-score { font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sb-lbl { font-size: 11px; font-weight: 800; color: var(--text-2); letter-spacing: .5px; margin-top: 2px; }
.sb-vs { font-size: 13px; font-weight: 800; color: var(--text-2); }

.rank-banner { background: rgba(123,220,181,.18); color: var(--teal); font-weight: 800; padding: 10px 18px; border-radius: 12px; }
.leaderboard { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; }
.lb-row.me { outline: 2px solid var(--teal); }
.lb-rank { font-size: 18px; width: 32px; text-align: center; }
.lb-name { flex: 1; text-align: left; font-weight: 700; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--coral); }

.code-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; background: var(--white); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; margin-top: 8px; text-align: left; }
.code-lbl { font-size: 11px; font-weight: 800; color: var(--text-2); letter-spacing: .5px; }
.code-val { font-size: 26px; font-weight: 900; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.code-box .iconbtn { color: var(--coral); }

.dur-row { display: flex; gap: 10px; margin-bottom: 8px; }
.dur { flex: 1; background: var(--white); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dur b { font-size: 20px; } .dur span { font-size: 12px; color: var(--text-2); }
.dur.selected { background: var(--yellow); color: var(--text); }
.dur.selected span { color: rgba(45,52,54,.7); }

.toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--white); padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 14px; z-index: 40; box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  *, .target, .key { transition: none !important; animation: none !important; }
}
