/* ============================================================
   Daily Trivia — styles
   Re-theme by editing the CSS variables in :root below.
   ============================================================ */
:root {
  --bg: #0b0c0b;
  --bg-grad-1: #161815;
  --bg-grad-2: #070807;
  --card: #151614;
  --card-border: #2a2c28;
  --text: #ecebe7;
  --text-dim: #9a9c96;
  --accent: #4d5e7a;          /* muted grey-navy blue (primary) */
  --accent-hover: #627492;
  --accent-soft: rgba(77, 94, 122, 0.20);
  --crimson: #9b3b44;         /* dark crimson (secondary) */
  --crimson-soft: rgba(155, 59, 68, 0.18);
  --good: #6f8a64;
  --ok: #b29657;
  --meh: #b06a48;
  --bad: #44463f;
  --unique: #9b3b44;          /* crimson tag */
  --ranked: #4d5e7a;          /* grey-navy tag */
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  --font: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

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

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-grad-1), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0 16px;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 520px;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 24px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.game-no {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

/* ---------- screens / cards ---------- */
.screen { animation: fade 0.35s ease; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- start screen ---------- */
.tagline {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.lead {
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 22px;
}
.rules {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 26px;
}
.rule {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 16px;
  line-height: 1.5;
  color: var(--text-dim);
}
.rule-tag {
  align-self: flex-start;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
}
.tag-unique { background: var(--unique); }
.tag-ranked { background: var(--ranked); }

.date-line, .tagline em, .rule em { font-style: normal; }
.rule em { color: var(--text); font-weight: 600; }

.date-line {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 16px;
}
.conn-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.8;
}

/* form fields on the start screen */
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field-label .optional { font-weight: 400; opacity: 0.8; }
#screen-start .answer-input { margin-bottom: 16px; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

/* ---------- progress dots ---------- */
.progress {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}
.dot {
  height: 6px;
  flex: 1;
  max-width: 70px;
  border-radius: 999px;
  background: var(--card-border);
  transition: background 0.3s ease;
}
.dot.active { background: var(--accent); }
.dot.done { background: var(--good); }

/* ---------- question ---------- */
.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.q-type {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--unique);
}
.q-type.ranked { background: var(--ranked); }
.q-tags { display: inline-flex; align-items: center; gap: 8px; }
.q-cat {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
}
.q-count {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
}
.q-prompt {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.q-blurb {
  color: var(--text-dim);
  margin-bottom: 22px;
  line-height: 1.5;
}

.answer-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--bg-grad-2);
  border: 2px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.answer-input:focus { border-color: var(--accent); }
.answer-input:disabled { opacity: 0.6; }

/* ---------- autocomplete dropdown ---------- */
.ac-list {
  margin: -6px 0 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--bg-grad-1);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active {
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- reveal ---------- */
.reveal { margin-top: 6px; }
.score-pop {
  text-align: center;
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  animation: pop 0.4s ease;
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.your-answer {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.your-answer strong { color: var(--text); }

.answer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}
.answer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.answer-row .rank {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  width: 26px;
}
.answer-row .name { flex: 1; }
.answer-row .pts {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.answer-row.you {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.answer-row.you .pts { color: var(--text); }
.answer-row .cnt {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-right: 10px;
  font-variant-numeric: tabular-nums;
}
.answer-list .more {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding-top: 2px;
}

/* score color helpers */
.s-good { color: var(--good); }
.s-ok   { color: var(--ok); }
.s-meh  { color: var(--meh); }
.s-bad  { color: var(--text-dim); }

/* ---------- results ---------- */
.results-eyebrow {
  text-align: center;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.total-score {
  text-align: center;
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.total-out-of {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.bd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
}
.bd-square { font-size: 1.1rem; }
.bd-label { flex: 1; }
.bd-label .bd-q { font-weight: 700; }
.bd-label .bd-ans { color: var(--text-dim); font-size: 0.85rem; }
.bd-pts { font-weight: 800; font-variant-numeric: tabular-nums; }

.copied-note {
  text-align: center;
  color: var(--good);
  font-weight: 600;
  margin-top: 10px;
}
/* leaderboards */
.leaderboard-wrap {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lb-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.lb-row.me {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.lb-rank {
  width: 22px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.lb-name { flex: 1; }
.lb-total {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.lb-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 8px 2px;
}

.countdown-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 26px;
}
.countdown {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

/* ---------- footer ---------- */
.site-footer {
  width: 100%;
  max-width: 520px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 26px 0;
}

@media (max-width: 420px) {
  .q-prompt { font-size: 1.25rem; }
  .total-score { font-size: 3.2rem; }
}
