/* NORMAL — mobile-first, one thumb, system-ui on purpose (it's the most normal font there is) */
:root {
  --bg: #fafaf7;
  --ink: #141414;
  --muted: #77756e;
  --card: #ffffff;
  --line: #e6e4dd;
  --accent: #5b4df5;
  --accent-ink: #ffffff;
  --you: #0ea060;
  --soft: #f1efe9;
  --gold: #f5a623;
  --bad: #e5484d;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101012;
    --ink: #ececea;
    --muted: #8f8d86;
    --card: #1a1a1e;
    --line: #2a2a30;
    --accent: #8b7dff;
    --accent-ink: #14121f;
    --you: #34c98a;
    --soft: #222226;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}
#app {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 18px);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(0.98); }

.screen { display: flex; flex-direction: column; flex: 1; animation: rise 0.28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- title ---------- */
.title-screen { justify-content: center; text-align: center; gap: 14px; }
.logo {
  font-size: clamp(56px, 17vw, 84px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.logo .dot { color: var(--accent); }
.tagline { color: var(--muted); font-size: 17px; }
.day-label { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.streak-chip { font-weight: 700; color: var(--gold); font-size: 15px; }

.big-btn {
  background: var(--ink);
  color: var(--bg);
  font-size: 19px;
  font-weight: 800;
  padding: 18px;
  border-radius: 999px;
  width: 100%;
  margin-top: 10px;
}
.big-btn.accent { background: var(--accent); color: var(--accent-ink); }
.ghost-btn { color: var(--muted); font-size: 15px; padding: 12px; }

.howto { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.howto b { color: var(--ink); }

/* ---------- question flow ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.wordmark { font-weight: 900; font-size: 18px; letter-spacing: -0.02em; }
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--ink); }
.dots i.now { background: var(--accent); transform: scale(1.25); }

.phase-banner {
  margin: 14px 0 8px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
}
.phase-banner.crowd { background: var(--accent); color: var(--accent-ink); }
.phase-sub { color: var(--muted); font-size: 15px; margin-bottom: 4px; }

.q-text { font-size: clamp(26px, 7.2vw, 34px); font-weight: 850; line-height: 1.12; letter-spacing: -0.02em; margin: 8px 0 22px; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-bottom: 6px; }
.opt {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 16px;
  font-size: 17px;
  font-weight: 650;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}
.opt:active { border-color: var(--accent); }
.opt.picked { border-color: var(--accent); background: var(--soft); }
.opt .chip {
  float: right;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 9px;
}

/* slider */
.slider-wrap { margin-top: auto; padding: 10px 0 6px; }
.slider-value { text-align: center; font-size: 52px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 4px; }
.slider-value small { font-size: 20px; color: var(--muted); font-weight: 700; }
input[type="range"] { width: 100%; appearance: none; -webkit-appearance: none; height: 44px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--bg);
  margin-top: -12px; box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}
input[type="range"]::-moz-range-track { height: 10px; border-radius: 999px; background: var(--line); }
input[type="range"]::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); border: 4px solid var(--bg); }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }

/* rank */
.rank-hint { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.opt .rank-badge {
  float: right;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- reveal ---------- */
.reveal-head { margin: 12px 0 6px; }
.reveal-q { font-size: 21px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { position: relative; }
.bar-label { display: flex; justify-content: space-between; font-size: 15px; font-weight: 650; margin-bottom: 5px; gap: 8px; }
.bar-label .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 800; }
.bar-track { height: 14px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--line); width: 0; transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.bar-row.majority .bar-fill { background: var(--accent); }
.bar-row.majority .pct { color: var(--accent); }
.tag { font-size: 11.5px; font-weight: 800; border-radius: 6px; padding: 1.5px 7px; vertical-align: 2px; margin-left: 6px; }
.tag.you { background: var(--you); color: #fff; }
.tag.guess { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }

.hist { display: flex; align-items: flex-end; gap: 3px; height: 74px; margin: 6px 0 4px; }
.hist i { flex: 1; background: var(--line); border-radius: 4px 4px 0 0; min-height: 3px; transition: height 0.6s ease; }
.hist i.med { background: var(--accent); }
.hist-marks { position: relative; height: 24px; margin-bottom: 4px; }
.hist-marks .tag { position: absolute; transform: translateX(-50%); white-space: nowrap; }

.verdict-line {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 15px;
  line-height: 1.45;
}
.verdict-line b { font-weight: 800; }
.hit { color: var(--you); font-weight: 800; }
.miss { color: var(--bad); font-weight: 800; }
.near { color: var(--gold); font-weight: 800; }

.next-hint { text-align: center; color: var(--muted); font-size: 14px; margin-top: auto; padding: 16px 0 4px; }

/* ---------- finale ---------- */
.finale { text-align: center; justify-content: center; gap: 6px; }
.finale .day-label { margin-bottom: 4px; }
.big-pct { font-size: clamp(72px, 24vw, 110px); font-weight: 900; letter-spacing: -0.05em; line-height: 1; }
.big-pct span { color: var(--accent); }
.finale-word { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.finale-verdict { color: var(--muted); font-size: 17px; margin-bottom: 8px; }
.emoji-row { font-size: 26px; letter-spacing: 4px; margin: 4px 0; }
.hive-line { font-size: 16px; font-weight: 700; }
.finale-streak { color: var(--gold); font-weight: 800; font-size: 16px; }
.countdown { color: var(--muted); font-size: 14px; margin-top: 10px; font-variant-numeric: tabular-nums; }

/* share-image fallback overlay */
.img-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}
.img-overlay img {
  max-height: 62vh;
  max-width: min(90vw, 380px);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgb(0 0 0 / 0.5);
}
.img-overlay .big-btn { max-width: 320px; text-align: center; text-decoration: none; }
.img-overlay .ghost-btn { color: #fff; }

/* toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 30px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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