/* soclose.gg — mobile-first daily estimation game */

:root {
  --bg: #0a0f1e;
  --bg-elev: #141b2d;
  --bg-elev-2: #1b2238;
  --border: #222c47;
  --border-glow: rgba(0, 240, 255, 0.18);
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --accent: #00f0ff;
  --accent-dim: #00b8c4;
  --gold: #ffd700;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% -10%, rgba(0, 240, 255, 0.08), transparent 40%),
    radial-gradient(circle at 90% 110%, rgba(0, 240, 255, 0.05), transparent 40%);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea { user-select: text; -webkit-user-select: text; }

button {
  font-family: inherit;
  font-weight: 600;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Screens ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 14px) 20px calc(var(--safe-bottom) + 20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .32s ease, transform .32s ease;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ===== Buttons ===== */
.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #001318;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.01em;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0, 240, 255, 0.26), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
}
.primary-btn.big { min-height: 60px; font-size: 19px; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.5; box-shadow: none; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: color .2s, border-color .2s, background .2s;
}
.ghost-btn:active { background: rgba(255,255,255,0.04); color: var(--text); }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border-radius: 12px;
  transition: color .15s, background .15s;
}
.icon-btn:active { background: rgba(255,255,255,0.06); color: var(--text); }

/* ===== Home ===== */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.logo-mark { width: 28px; height: 28px; }
.logo-word { color: var(--text); font-weight: 800; letter-spacing: -0.02em; font-size: 20px; }
.logo-dot { color: var(--accent); }

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 10px 0;
}

.home-hero { text-align: center; }
.home-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: 999px;
  border: 1px solid var(--border-glow);
}
.home-title {
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-top: 16px;
}
.home-title em { color: var(--accent); font-style: normal; }
.home-sub {
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 12px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.home-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}
.home-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.home-card-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.home-card-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-card-streak { text-align: right; }
.streak-flame {
  display: inline-block;
  filter: drop-shadow(0 0 6px rgba(251,146,60,0.7));
  animation: flicker 1.8s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50%      { transform: scale(1.08) rotate(2deg); }
}

.home-completed {
  margin-top: 16px;
  text-align: center;
  color: var(--text-dim);
}
.home-completed.hidden { display: none; }
.completed-score { font-size: 15px; margin-bottom: 6px; }
.completed-score strong { color: var(--accent); font-family: var(--font-mono); font-size: 18px; }
.countdown { font-size: 13px; color: var(--text-dim); font-family: var(--font-mono); }

.home-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ===== Game ===== */
.game-topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
}
.game-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 700;
  text-align: center;
}
.progress-track {
  height: 4px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 8px var(--accent);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.game-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(249, 115, 22, 0.1);
  color: #fdba74;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-mono);
}

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 8px;
}

.category-pill {
  align-self: flex-start;
  padding: 6px 12px;
  background: var(--bg-elev);
  color: var(--accent);
  border: 1px solid var(--border-glow);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.question-text {
  font-size: clamp(22px, 6.2vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  padding-right: 4px;
}

.input-wrap {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity .3s, transform .3s;
}
.input-wrap.hidden { opacity: 0; pointer-events: none; transform: scale(0.96); position: absolute; }

/* MC options */
.mc-wrap {
  margin-top: auto;
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp .35s cubic-bezier(.2,.8,.2,1);
}
.mc-wrap.shown { display: flex; }

.mc-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 60px;
  padding: 14px 18px;
  background: var(--bg-elev);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  width: 100%;
  transition: border-color .15s, background .15s, transform .1s;
  cursor: pointer;
}
.mc-option:active { transform: scale(0.98); }
.mc-option:hover { border-color: var(--accent); }
.mc-option:disabled { cursor: default; }
.mc-option .mc-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.mc-option.correct {
  background: rgba(34, 197, 94, 0.14);
  border-color: var(--green);
  color: var(--text);
}
.mc-option.correct .mc-letter {
  background: var(--green);
  color: #06210f;
}
.mc-option.incorrect {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
  opacity: 0.9;
}
.mc-option.incorrect .mc-letter {
  background: var(--red);
  color: #2b0708;
}
.mc-option.dim { opacity: 0.5; }

.input-row {
  position: relative;
  display: flex;
  align-items: baseline;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 18px 22px;
  transition: border-color .25s, box-shadow .25s;
}
.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.12);
}
#guess-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(40px, 11vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
  width: 100%;
}
#guess-input::placeholder { color: #475569; }
.unit-label {
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 600;
  margin-left: 10px;
  white-space: nowrap;
}

/* ===== Reveal ===== */
.reveal {
  display: none;
  flex-direction: column;
  gap: 18px;
  animation: fadeInUp .45s cubic-bezier(.2,.8,.2,1);
  margin-top: auto;
}
.reveal.shown { display: flex; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.reveal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.reveal-col {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}
.reveal-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.reveal-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.gauge-wrap {
  padding: 14px 4px 0;
}
.gauge {
  position: relative;
  height: 10px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: visible;
  border: 1px solid var(--border);
}
.gauge-bar {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--gold));
  border-radius: 999px;
  transform-origin: left center;
  transition: width .8s cubic-bezier(.2,.8,.2,1), left .8s cubic-bezier(.2,.8,.2,1);
  opacity: 0.35;
}
.gauge-marker-correct {
  position: absolute;
  left: 50%;
  top: -6px;
  width: 2px;
  height: 22px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transform: translateX(-50%);
}
.gauge-marker-guess {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 14px;
  height: 26px;
  background: var(--gold);
  border-radius: 4px;
  transform: translateX(-50%) scale(0);
  transition: left .9s cubic-bezier(.2,.8,.2,1), transform .4s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}
.gauge-marker-guess.shown { transform: translateX(-50%) scale(1); }
.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-pop {
  text-align: center;
  padding: 10px 0;
}
.score-tier {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.score-tier.bullseye { color: var(--gold); }
.score-tier.great    { color: var(--green); }
.score-tier.good     { color: var(--yellow); }
.score-tier.ok       { color: var(--orange); }
.score-tier.bad      { color: var(--red); }
.score-points {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.score-points .score-unit {
  font-size: 18px;
  color: var(--text-dim);
  margin-left: 6px;
  font-weight: 700;
}

.fun-fact {
  font-size: 13px;
  color: var(--text-dim);
  padding: 12px 14px;
  background: var(--bg-elev);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.fun-fact:empty { display: none; }

/* ===== Results ===== */
.results-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-top: 10px;
  -webkit-overflow-scrolling: touch;
}
.results-header {
  text-align: center;
  padding: 20px 0 10px;
}
.results-total {
  font-family: var(--font-mono);
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: 10px;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.3);
}
.results-total-max {
  font-size: 22px;
  color: var(--text-dim);
  margin-left: 6px;
}
.results-streak {
  margin-top: 12px;
  font-size: 16px;
  color: #fdba74;
  font-weight: 700;
  font-family: var(--font-mono);
}
.results-streak.lost { color: var(--text-dim); }

.results-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp .4s forwards;
}
.result-row .tier-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.tier-dot.bullseye { background: var(--gold); }
.tier-dot.great    { background: var(--green); }
.tier-dot.good     { background: var(--yellow); }
.tier-dot.ok       { background: var(--orange); }
.tier-dot.bad      { background: var(--red); }

.result-row .res-q {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.result-row .res-q strong { color: var(--text); font-size: 14px; font-weight: 600; }
.result-row .res-pts {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.results-countdown {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-mono);
}
.ad-slot {
  min-height: 0;
  background: transparent;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal[aria-hidden="false"] { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(var(--safe-bottom) + 24px);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}
.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 18px;
}
.stats-sub {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat {
  background: var(--bg-elev-2);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
}
.stat-v { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.stat-l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.histogram {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  align-items: end;
  height: 90px;
}
.hist-bar {
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  opacity: 0.6;
  transition: opacity .2s;
}
.hist-bar.empty { background: var(--border); opacity: 0.4; }

.how-panels { display: flex; flex-direction: column; gap: 14px; }
.how-panel {
  background: var(--bg-elev-2);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}
.how-emoji { font-size: 38px; margin-bottom: 6px; }
.how-panel h4 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.how-panel p { color: var(--text-dim); font-size: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 30px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
  white-space: nowrap;
}
.toast.shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Pulse for bullseye */
@keyframes bullseye-pulse {
  0%, 100% { text-shadow: 0 0 10px var(--gold), 0 0 20px var(--gold); }
  50%      { text-shadow: 0 0 25px var(--gold), 0 0 50px var(--gold); }
}
.score-tier.bullseye { animation: bullseye-pulse 1.2s ease-in-out infinite; }

/* =============================================================
   HOME — tighter hero + mode grid
============================================================= */
.home-title {
  font-size: clamp(28px, 7vw, 38px);
}
.home-main {
  justify-content: flex-start;
  padding-top: 8px;
  gap: 18px;
}
.home-hero { padding-top: 4px; }

.mode-section {
  margin-top: 4px;
}
.mode-section-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0.7;
}
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 18px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: left;
  transition: transform .15s, border-color .2s, background .2s;
  position: relative;
  overflow: hidden;
  min-height: 110px;
}
.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 10%, rgba(0, 240, 255, 0.08), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
}
.mode-card:active { transform: scale(0.97); }
.mode-card:hover { border-color: var(--border-glow); background: var(--bg-elev-2); }
.mode-card:hover::before { opacity: 1; }
.mode-card[data-mode="practice"] { --accent-local: #00f0ff; }
.mode-card[data-mode="category"] { --accent-local: var(--gold); }
.mode-card[data-mode="speed"]    { --accent-local: #a855f7; }
.mode-card[data-mode="hard"]     { --accent-local: #fb923c; }
.mode-icon {
  font-size: 26px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.25));
}
.mode-card[data-mode="speed"] .mode-icon {
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.5));
  animation: mode-zap 2s ease-in-out infinite;
}
@keyframes mode-zap {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
.mode-card[data-mode="hard"] .mode-icon {
  filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.55));
  animation: flicker 1.8s ease-in-out infinite;
}
.mode-card-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.mode-card-sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
  font-weight: 500;
}

/* =============================================================
   MODE BADGE + TIMER
============================================================= */
.mode-badge {
  display: none;
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border);
  margin-top: -6px;
  margin-bottom: 4px;
}
.mode-badge.shown { display: inline-flex; align-items: center; gap: 6px; }
.mode-badge.practice { color: var(--accent); border-color: var(--border-glow); }
.mode-badge.category { color: var(--gold); border-color: rgba(255, 215, 0, 0.25); }
.mode-badge.speed    { color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }
.mode-badge.hard     { color: #fb923c; border-color: rgba(251, 146, 60, 0.35); }

.timer-bar {
  display: none;
  height: 3px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  margin-top: -8px;
  margin-bottom: 8px;
}
.timer-bar.shown { display: block; }
.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308 60%, #ef4444);
  transform-origin: right center;
  transition: transform 0.05s linear;
}
.timer-fill.warn { animation: timer-pulse 0.5s ease-in-out infinite; }
@keyframes timer-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.5); }
}

/* =============================================================
   CATEGORY PICKER
============================================================= */
.modal-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: -10px;
  margin-bottom: 18px;
}
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cat-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  transition: transform .12s, border-color .2s;
  min-height: 62px;
}
.cat-pill:active { transform: scale(0.97); }
.cat-pill:hover  { border-color: var(--accent); }
.cat-pill-name   { font-weight: 700; font-size: 15px; }
.cat-pill-count  { font-size: 11px; color: var(--text-dim); margin-top: 2px; font-family: var(--font-mono); }

/* =============================================================
   CONFETTI
============================================================= */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}
.confetti-particle {
  position: absolute;
  width: 10px;
  height: 14px;
  top: 40%;
  left: 50%;
  opacity: 0.95;
  border-radius: 2px;
  will-change: transform, opacity;
}
@keyframes confetti-fall {
  0%   { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--cx, 0px), var(--cy, 520px), 0) rotate(var(--cr, 720deg)); opacity: 0; }
}

/* =============================================================
   SCREEN FLASH
============================================================= */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 140;
  background: radial-gradient(circle at 50% 50%, currentColor, transparent 60%);
  transition: opacity .3s ease-out;
  mix-blend-mode: screen;
}
.screen-flash.flash { opacity: 0.35; transition: opacity .15s ease-out; }
.screen-flash.bullseye { color: #ffd700; }
.screen-flash.great    { color: #22c55e; }
.screen-flash.good     { color: #eab308; }
.screen-flash.ok       { color: #f97316; }
.screen-flash.bad      { color: #ef4444; }

/* Subtle screen shake on bullseye */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, 2px); }
  80% { transform: translate(2px, -1px); }
}
.shake { animation: screen-shake 0.4s ease-in-out; }

/* =============================================================
   ACHIEVEMENTS
============================================================= */
.achievement-pop {
  position: fixed;
  top: calc(var(--safe-top) + 20px);
  left: 50%;
  transform: translate(-50%, -120%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 12px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(0, 240, 255, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 215, 0, 0.3);
  z-index: 220;
  transition: transform .5s cubic-bezier(.2, 1.2, .3, 1);
  pointer-events: none;
  min-width: 280px;
}
.achievement-pop.shown { transform: translate(-50%, 0); }
.achievement-icon {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), #fbbf24);
  border-radius: 12px;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
}
.achievement-label {
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.9;
}
.achievement-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  margin-top: 1px;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ach-badge {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  transition: border-color .2s;
}
.ach-badge.unlocked {
  background: linear-gradient(160deg, rgba(255, 215, 0, 0.1), var(--bg-elev-2));
  border-color: rgba(255, 215, 0, 0.35);
}
.ach-badge.locked { opacity: 0.4; filter: grayscale(0.8); }
.ach-icon { font-size: 22px; }
.ach-name { font-size: 10px; font-weight: 700; color: var(--text); line-height: 1.1; }
.ach-badge.locked .ach-name { color: var(--text-dim); }

/* =============================================================
   TIGHTER HOME HEADER
============================================================= */
.home-card { padding: 18px; }
.home-card .primary-btn { margin-top: 4px; }
.home-completed { margin-top: 10px; }

/* Category pill color accents */
.category-pill[data-cat="Geography"]   { color: #60a5fa; }
.category-pill[data-cat="History"]     { color: #fbbf24; }
.category-pill[data-cat="Science"]     { color: #a5f3fc; }
.category-pill[data-cat="Pop Culture"] { color: #f472b6; }
.category-pill[data-cat="Money"]       { color: #86efac; }
.category-pill[data-cat="Sports"]      { color: #fb923c; }
.category-pill[data-cat="Food & Drink"]{ color: #fde047; }
.category-pill[data-cat="Human Body"]  { color: #c084fc; }

/* Hidden utility */
.hidden { display: none !important; }

/* Enhanced big-score reveal */
.score-points {
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.score-points.pop { transform: scale(1.1); }

/* Pulsing accent for PLAY TODAY when available */
@keyframes play-pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(0, 240, 255, 0.26), inset 0 1px 0 rgba(255,255,255,0.3); }
  50%      { box-shadow: 0 8px 30px rgba(0, 240, 255, 0.5), 0 0 0 4px rgba(0, 240, 255, 0.1), inset 0 1px 0 rgba(255,255,255,0.3); }
}
#btn-play:not(:disabled) { animation: play-pulse 2.4s ease-in-out infinite; }

/* =============================================================
   AD SLOTS
============================================================= */
.ad-slot-wrap {
  position: relative;
  margin-top: 18px;
  min-height: 90px;
  max-height: 120px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-banner {
  width: 100%;
  min-height: 88px;
  display: block;
  position: relative;
  z-index: 2;
}
.ad-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.05em;
  opacity: 0.5;
  z-index: 1;
  pointer-events: auto;
}
.ad-fallback a {
  color: var(--accent);
  margin-left: 6px;
  text-decoration: none;
  pointer-events: auto;
}
.ad-slot-wrap.loaded .ad-fallback { display: none; }

@media (min-width: 600px) {
  .screen {
    padding: 40px;
    width: 100%;
    max-width: 520px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(8px);
  }
  .screen.active { transform: translateX(-50%); }
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(circle at 20% 20%, rgba(0, 240, 255, 0.04), transparent 50%),
      radial-gradient(circle at 80% 80%, rgba(0, 240, 255, 0.04), transparent 50%);
    pointer-events: none;
  }
}
