/* EARLIER or LATER: BTV — museum-placard / timeline aesthetic */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1b2338;          /* deep archival ink-blue */
  --bg2: #10162a;
  --card: #f4ecd7;        /* aged placard parchment */
  --ink: #26211a;
  --accent: #c08a3e;      /* aged brass */
  --hi: #3f7d8c;          /* earlier — patina teal */
  --lo: #b5533b;          /* later — oxidized copper */
  --gold: #e0b45c;        /* brass highlight */
}

html, body {
  min-height: 100%;
  background: radial-gradient(ellipse at 50% -10%, #26314e, var(--bg) 55%, var(--bg2));
  color: var(--card);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body { display: flex; flex-direction: column; align-items: center; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); }

button { font: inherit; cursor: pointer; border: none; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
#topbar {
  width: min(560px, 100%);
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 2px 10px;
}
.brand { font-weight: 900; font-size: 16px; letter-spacing: 0.5px; }
.brand .tb-or { color: var(--accent); font-style: italic; margin: 0 3px; font-weight: 700; }
.brand .btv { color: var(--gold); }
.scores { display: flex; gap: 8px; }
.badge {
  background: rgba(0,0,0,0.35); border-radius: 12px; padding: 4px 12px; text-align: center;
  border: 1px solid rgba(244,236,215,0.12);
}
.badge small { display: block; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.65; }
.badge b { font-size: 18px; font-weight: 900; color: var(--gold); }

/* ---------- screens ---------- */
.screen { width: min(560px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }

.big-title { margin-top: 7vh; font-size: clamp(44px, 12.5vw, 82px); font-weight: 900; line-height: 0.95; letter-spacing: -2px; }
.big-title .accent { color: var(--accent); }
.sub { margin-top: 12px; font-size: 13px; font-weight: 800; letter-spacing: 3px; color: var(--gold); }
.deck { margin-top: 20px; font-size: 16px; line-height: 1.55; color: #eee4cd; }
.deck.small { font-size: 13px; opacity: 0.75; margin-top: 10px; }
.deck .hi { color: #8fcede; } .deck .lo { color: #ec9884; }
.fineprint { margin-top: 14px; font-size: 12px; opacity: 0.55; }

.btn-lead {
  margin-top: 26px; padding: 16px 44px; border-radius: 999px;
  font-size: 19px; font-weight: 900; letter-spacing: 1px; color: #fff;
  background: linear-gradient(#cf9a49, #a9772f);
  box-shadow: 0 5px 0 #77520f, 0 12px 26px rgba(0,0,0,0.45);
  transition: transform 0.08s ease;
}
.btn-lead:active { transform: translateY(3px); box-shadow: 0 2px 0 #77520f; }
.btn-ghost {
  margin-top: 26px; padding: 15px 30px; border-radius: 999px;
  font-size: 17px; font-weight: 800; color: var(--card);
  background: rgba(255,255,255,0.08); border: 2px solid rgba(244,236,215,0.35);
}

/* ---------- cards ---------- */
#cards { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0; }
.card {
  width: 100%; background: var(--card); color: var(--ink);
  border-radius: 16px; padding: 20px 20px 18px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
  border: 1px solid rgba(38,33,26,0.15);
  transition: box-shadow 0.25s ease;
  position: relative;
}
/* engraved brass frame line, like a museum placard */
.card::before {
  content: ""; position: absolute; inset: 7px; border-radius: 10px;
  border: 1px solid rgba(38,33,26,0.22); pointer-events: none;
}
.card-era {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(40px, 11vw, 60px); font-weight: 800; line-height: 1;
  color: var(--accent); letter-spacing: 1px; font-variant-numeric: tabular-nums;
}
.card-era.flip { animation: flip 0.5s cubic-bezier(.2,.8,.2,1); }
@keyframes flip {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}
.card-event {
  margin-top: 8px; font-size: clamp(17px, 4.6vw, 20px); font-weight: 800;
  line-height: 1.3; letter-spacing: 0.1px;
}
.card-blurb {
  margin-top: 10px; font-size: 13px; line-height: 1.55; font-weight: 500; color: #574d3d;
}
.card-blurb a { color: #8a5a1f; font-weight: 700; white-space: nowrap; }
.mystery .card-era { color: #b0a68d; letter-spacing: 4px; }
.card.reveal-good { box-shadow: 0 0 0 4px var(--hi), 0 10px 28px rgba(0,0,0,0.4); }
.card.reveal-bad { box-shadow: 0 0 0 4px var(--lo), 0 10px 28px rgba(0,0,0,0.4); }
.card.reveal-good .card-era, .card.reveal-bad .card-era { color: var(--ink); }

/* ---------- timeline connector ---------- */
#link {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  margin: -2px 0; z-index: 2;
}
#link .link-line { width: 2px; height: 16px; background: rgba(224,180,92,0.5); }
#link .link-badge {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 14px;
  font-style: italic; letter-spacing: 0.5px;
  border: 4px solid var(--bg); box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.prompt { margin-top: 14px; font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #7a6f59; }
#guessRow { display: flex; gap: 10px; margin-top: 10px; }
.btn-guess {
  flex: 1; padding: 16px 8px; border-radius: 12px;
  font-size: 18px; font-weight: 900; letter-spacing: 0.5px; color: #fff;
  transition: transform 0.08s ease;
}
.btn-guess:active { transform: scale(0.96); }
.btn-guess.hi { background: linear-gradient(#4e93a3, var(--hi)); box-shadow: 0 4px 0 #2c5a66; }
.btn-guess.lo { background: linear-gradient(#c56245, var(--lo)); box-shadow: 0 4px 0 #7f3826; }

#verdict { margin-top: 14px; font-size: 19px; font-weight: 900; letter-spacing: 0.5px; }
#verdict.good { color: var(--hi); }
#verdict.bad { color: var(--lo); }

/* ---------- game over ---------- */
#gameover h2 { margin-top: 5vh; font-size: clamp(28px, 8vw, 44px); font-weight: 900; letter-spacing: -1px; }
.score-big { font-size: clamp(64px, 20vw, 110px); font-weight: 900; color: var(--gold); line-height: 1; }
.best-line { margin-top: 4px; font-size: 15px; font-weight: 800; color: #eee4cd; }
.best-line.new-best { color: #8fcede; }
.sources {
  margin-top: 16px; font-size: 12.5px; line-height: 1.7; color: #d5cbb2;
  background: rgba(0,0,0,0.3); border-radius: 14px; padding: 12px 16px; max-width: 100%;
}
.sources b { color: var(--gold); font-variant-numeric: tabular-nums; }
.sources a { color: var(--gold); }
.row { display: flex; gap: 12px; align-items: center; }
.cta-brief {
  margin-top: 22px; display: inline-block; padding: 10px 20px; border-radius: 999px;
  color: var(--gold); font-weight: 800; font-size: 14px; text-decoration: none;
  background: rgba(224,180,92,0.12); border: 1px solid rgba(224,180,92,0.5);
}

/* ---------- leaderboard ---------- */
.lb {
  margin-top: 20px; width: min(360px, 100%);
  background: rgba(0,0,0,0.32); border-radius: 16px; padding: 12px 16px;
  border: 1px solid rgba(244,236,215,0.12);
}
.chip {
  border: 2px solid rgba(244,236,215,0.3); background: rgba(0,0,0,0.3);
  color: var(--card); font-size: 13px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
}
.chip.sel { background: var(--accent); border-color: var(--gold); color: #fff; }
.lb-tabs { display: flex; gap: 6px; justify-content: center; }
.lb-tabs .chip { font-size: 12px; padding: 5px 12px; }
.lb ol { list-style: none; margin: 10px 0 4px; max-height: 30vh; overflow-y: auto; }
.lb li {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 14px; font-weight: 600; color: #eee4cd;
  padding: 3px 6px; border-radius: 8px;
}
.lb li .rank { width: 22px; text-align: right; opacity: 0.7; font-size: 12px; }
.lb li .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li .sc { font-weight: 900; color: var(--gold); }
.lb li.me { background: rgba(192,138,62,0.4); color: #fff; }
.lb .lb-status { font-size: 12px; color: var(--gold); opacity: 0.85; margin: 8px 0 2px; }
.lb-form { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.lb-form input {
  font: inherit; font-size: 14px; font-weight: 600; width: 160px;
  padding: 8px 12px; border-radius: 999px; border: 2px solid rgba(244,236,215,0.3);
  background: rgba(0,0,0,0.35); color: #fff; outline: none;
}
.lb-form input::placeholder { color: rgba(238,228,205,0.5); }
.lb-rename { font-size: 11px; padding: 4px 10px; margin-top: 8px; opacity: 0.85; }
.lb-form.hidden, .lb-rename.hidden { display: none; }

/* ---------- footer ---------- */
#footer { margin-top: auto; padding-top: 26px; font-size: 12px; opacity: 0.65; text-align: center; }
#footer a { color: var(--gold); }

/* wider screens: cards side by side across the timeline */
@media (min-width: 640px) {
  #cards { flex-direction: row; align-items: stretch; gap: 0; }
  .card { width: calc(50% - 24px); display: flex; flex-direction: column; }
  #link { flex-direction: row; margin: auto -14px; align-self: center; }
  #link .link-line { width: 14px; height: 2px; }
}
