/* Save Bets — mobile-first prototype. No framework, no build step:
   this loads fast on a low-end Android phone over mobile data, which is the
   actual target device for a WhatsApp-distributed game. */

:root {
  --bg:        #0B0F1A;
  --surface:   #141A2A;
  --surface-2: #1D2538;
  --line:      #2A3348;
  --text:      #F2F5FA;
  --muted:     #8A96AE;
  --accent:    #4F7DFF;
  --accent-ink:#FFFFFF;
  --money:     #F5B942;
  --savings:   #3DD68C;
  --danger:    #FF6B6B;
  --radius:    14px;
  --gutter:    16px;
  --tap:       52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--gutter) 32px;
  display: flex; flex-direction: column;
}

/* ---------- shared ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px; gap: 12px;
}
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 15px; }
.brand span { color: var(--money); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.pill strong { color: var(--text); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

button {
  font: inherit; cursor: pointer; border: none;
  border-radius: 12px; min-height: var(--tap);
  width: 100%; font-weight: 650; letter-spacing: -0.01em;
  transition: transform .06s ease, opacity .15s ease;
}
button:active { transform: scale(0.985); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line);
}
.btn-danger { background: var(--danger); color: #1A0A0A; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.spacer { flex: 1; }

/* ---------- landing ---------- */

.hero-eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 8px;
}
.hero-title {
  font-size: 30px; line-height: 1.1; font-weight: 750;
  letter-spacing: -0.03em; margin: 0 0 6px;
}
.hero-sub { color: var(--muted); margin: 0 0 20px; font-size: 15px; }

.pool {
  background: linear-gradient(160deg, #2A2213 0%, var(--surface) 70%);
  border: 1px solid #4A3A18;
  border-radius: var(--radius);
  padding: 20px 16px; text-align: center;
}
.pool-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--money); opacity: .85;
}
.pool-amount {
  font-size: 40px; font-weight: 750; letter-spacing: -0.035em;
  color: var(--money); margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}
.pool-growing { font-size: 13px; color: var(--muted); }
.pool-growing .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--savings); margin-right: 6px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; font-size: 13px;
}

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact { background: var(--surface); border: 1px solid var(--line);
        border-radius: 12px; padding: 12px 8px; text-align: center; }
.fact-n { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.fact-l { font-size: 11px; color: var(--muted); margin-top: 2px; }

.prizes { display: flex; flex-direction: column; gap: 10px; }
.prize { display: flex; align-items: center; gap: 12px; }
.prize-pos {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line);
}
.prize-pos.p1 { background: var(--money); color: #2A2213; border-color: var(--money); }
.prize-body { flex: 1; min-width: 0; }
.prize-name { font-size: 14px; font-weight: 600; }
.prize-meta { font-size: 12px; color: var(--muted); }

.sharer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px;
}
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

.sticky-cta {
  position: sticky; bottom: 0;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}

/* ---------- entry ---------- */

.split-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.split-row:last-child { border-bottom: none; }
.split-key { display: flex; align-items: center; gap: 9px; }
.swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.split-val { font-weight: 650; font-variant-numeric: tabular-nums; }

.split-bar {
  display: flex; height: 8px; border-radius: 999px;
  overflow: hidden; margin-bottom: 14px;
}
.split-bar i { display: block; height: 100%; }

/* ---------- play ---------- */

.play-head { padding: 12px 0 8px; }
.progress-track {
  height: 5px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.progress-fill {
  height: 100%; background: var(--accent);
  transition: width .3s ease; border-radius: 999px;
}
.timer-track {
  height: 5px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin-top: 8px;
}
.timer-fill {
  height: 100%; background: var(--savings);
  border-radius: 999px; transition: width 1s linear, background .3s ease;
}
.timer-fill.warn   { background: var(--money); }
.timer-fill.danger { background: var(--danger); }

.q-category {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); font-weight: 650;
}
.q-text {
  font-size: 22px; line-height: 1.32; font-weight: 650;
  letter-spacing: -0.02em; margin: 10px 0 22px;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-align: left;
  padding: 14px; border-radius: 12px; min-height: var(--tap);
  font-weight: 500; font-size: 15px;
}
.option:active { background: var(--surface-2); }
.option.picked { border-color: var(--accent); background: #1A2340; }
.option-key {
  width: 27px; height: 27px; flex: none; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.option.picked .option-key {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---------- result ---------- */

.score-ring {
  width: 150px; height: 150px; margin: 4px auto 14px;
  position: relative; display: grid; place-items: center;
}
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-n {
  font-size: 42px; font-weight: 750; letter-spacing: -0.04em;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.score-d { font-size: 13px; color: var(--muted); margin-top: 3px; }

.rank-line { font-size: 17px; font-weight: 600; }
.rank-line b { color: var(--accent); }

.earned {
  display: flex; align-items: center; gap: 11px;
  background: #10281D; border: 1px solid #1E4A36;
  border-radius: 12px; padding: 13px 14px;
}
.earned-icon {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: var(--savings); color: #06231A;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}

.lb { display: flex; flex-direction: column; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.lb-row:last-child { border-bottom: none; }
.lb-row.you { background: #1A2340; margin: 0 -12px; padding: 11px 12px;
              border-radius: 10px; border-bottom-color: transparent; }
.lb-pos { width: 30px; flex: none; color: var(--muted);
          font-variant-numeric: tabular-nums; font-weight: 600; }
.lb-name { flex: 1; min-width: 0; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 650; font-variant-numeric: tabular-nums; }
.lb-time { width: 58px; text-align: right; color: var(--muted);
           font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- replay warning ---------- */

.warn-box {
  background: #2A1A12; border: 1px solid #5A3520;
  border-radius: 12px; padding: 15px;
}
.warn-title {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; margin-bottom: 7px; color: var(--money);
}

.view { animation: in .22s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1 } }

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

/* ---------- forms (verification) ---------- */

.field { display: block; margin-bottom: 4px; }
.field-label { font-size: 13px; color: var(--muted); margin-bottom: 7px; }

input[type="tel"], input[type="text"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; min-height: var(--tap);
  -webkit-appearance: none; appearance: none;
}
input:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: #55607A; }

.code-input {
  text-align: center; font-size: 26px; font-weight: 700;
  letter-spacing: 0.35em; font-variant-numeric: tabular-nums;
  padding-left: 0.35em;   /* balances the trailing letter-space */
}

.consent {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px;
}
/* Drawn explicitly rather than left to the UA. The default dark-mode
   checkbox renders as a filled light square, which reads as TICKED when it is
   not — unacceptable on a consent control, where the whole point is that the
   unticked state is unmistakable. */
.consent input[type="checkbox"] {
  width: 22px; height: 22px; flex: none; margin: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  border: 2px solid var(--muted);
  border-radius: 6px;
  display: grid; place-content: center;
  cursor: pointer;
}
.consent input[type="checkbox"]::before {
  content: ""; width: 11px; height: 11px; border-radius: 2px;
  transform: scale(0); transition: transform .12s ease;
  background: #fff;
}
.consent input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
}
.consent input[type="checkbox"]:checked::before { transform: scale(1); }
.consent input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent label { font-size: 13px; color: var(--muted); line-height: 1.45; }

.form-error {
  background: #2A1216; border: 1px solid #5A2530;
  color: #FFB3B3; border-radius: 10px; padding: 11px 13px; font-size: 13px;
}

.q-report {
  display: block; width: auto; margin: 16px auto 0;
  background: none; border: none; min-height: 0;
  font-size: 12px; color: var(--muted); text-decoration: underline;
  text-underline-offset: 3px; font-weight: 400;
}
