/* The Daily Nolan - clean sans-serif, flat grey surfaces, one blue accent. */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --line: #e6e6e9;
  --surface: #f4f4f6;
  --surface-hover: #ebebef;
  --ink: #111114;
  --muted: #6e6e78;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --fill: rgba(47, 111, 237, 0.14);
  --fill-mine: rgba(47, 111, 237, 0.3);
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --card: #17171a;
    --line: #26262b;
    --surface: #1f1f23;
    --surface-hover: #28282d;
    --ink: #f2f2f4;
    --muted: #9696a0;
    --accent: #6b97ff;
    --accent-ink: #0f0f11;
    --fill: rgba(107, 151, 255, 0.16);
    --fill-mine: rgba(107, 151, 255, 0.34);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: inherit; }

.page { max-width: 600px; margin: 0 auto; padding: 20px 16px 48px; }
.hidden { display: none !important; }

/* ---------- masthead ---------- */

.masthead { padding: 4px 0 24px; }
.masthead-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}
.logo {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 18px 0 4px;
}
.logo a { text-decoration: none; }
.tagline { margin: 0; color: var(--muted); }

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}
.prompt {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.blurb { margin: 0 0 12px; color: var(--muted); }

/* ---------- options / results ---------- */

.options { display: grid; gap: 8px; margin-top: 18px; }
@media (min-width: 520px) {
  .options.n2:not(.revealed) { grid-template-columns: 1fr 1fr; }
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.options:not(.revealed) .option:not(:disabled):hover { background: var(--surface-hover); }
.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.option:disabled { cursor: default; }

.options.busy .option { opacity: 0.5; }
.options.busy .option.chosen { opacity: 1; animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.option .label { position: relative; z-index: 1; flex: 1; overflow-wrap: anywhere; }
.option .pct { position: relative; z-index: 1; font-variant-numeric: tabular-nums; color: var(--muted); }
.option .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--fill);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.options.revealed .option { font-weight: 500; }
.options.revealed .option.mine { font-weight: 700; }
.options.revealed .option.mine .fill { background: var(--fill-mine); }
.options.revealed .option.mine .pct { color: var(--ink); }
.options.revealed .option.mine .label::after {
  content: "your pick";
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.status { min-height: 1.2em; margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); }
.status.error { color: #d93636; }
.total { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); }
.total:not(.hidden) + .status:empty { display: none; }

/* ---------- after-vote ---------- */

.verdict { font-size: 1.15rem; font-weight: 600; line-height: 1.35; margin: 0 0 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.12s ease, opacity 0.12s ease;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { color: var(--accent-ink); background: var(--accent); }
.btn.primary:hover { opacity: 0.9; }

.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 20px; margin: 18px 0 0; padding: 0; font-size: 0.9rem; color: var(--muted); }
.stats li b { color: var(--ink); font-variant-numeric: tabular-nums; }

.countdown {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 4px 0 20px;
  font-variant-numeric: tabular-nums;
}
.countdown button { margin-left: 8px; }

/* ---------- yesterday ---------- */

.yesterday summary { cursor: pointer; font-weight: 600; }
.yesterday .y-prompt { font-weight: 600; margin: 14px 0 10px; }
.y-row { margin: 10px 0; }
.y-row .y-label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; }
.y-bar { height: 6px; background: var(--surface); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.y-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.y-total { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; }

/* ---------- misc ---------- */

.footer { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 28px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 160%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  font-weight: 600;
  color: var(--bg);
  background: var(--ink);
  border-radius: 10px;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
  visibility: hidden;
  z-index: 10;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform 0.25s ease; }

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