/* ============================================================================
   FLASHBACK — "before or after?" date-streak game. Built on /assets/base.css.
   Hot-pink accent + per-category colors, big tactile cards, a snappy year-flip
   reveal, a streak chip that heats up with your run. Mobile-first, touch +
   mouse + keyboard, no horizontal scroll.
   ============================================================================ */

:root {
  --accent: #ff3d7f;
  --accent-ink: #2a0011;
  --before: #4f9dff;     /* cool = earlier */
  --after: #ffb020;      /* warm = later */
  --heat: 0;             /* 0..1, driven by streak */
}

/* a soft glow at the bottom that intensifies as the streak climbs */
body::after {
  content: '';
  position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 150%, color-mix(in oklab, var(--accent) calc(var(--heat) * 24%), transparent), transparent 72%);
  transition: background 0.5s ease;
}

.topbar .brand { cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.streak-chip {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.92rem;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  padding: 6px 13px; border-radius: var(--r-pill);
  box-shadow: 0 0 calc(var(--heat) * 22px) color-mix(in oklab, var(--accent) calc(var(--heat) * 65%), transparent);
  transition: box-shadow 0.4s ease;
}
.streak-chip b { color: var(--accent); font-variant-numeric: tabular-nums; }
.streak-chip.bump { animation: chipBump 0.4s var(--ease-snap); }
@keyframes chipBump { 0% { transform: scale(1); } 42% { transform: scale(1.24); } 100% { transform: scale(1); } }

#stage { position: relative; min-height: 64dvh; }

/* ---- intro ---- */
.round { padding: 22px 20px 24px; }
.round .eyebrow { display: block; }
.round h2 { font-size: clamp(1.7rem, 7vw, 2.3rem); margin-top: 6px; }
.round .lead { margin-top: 8px; }
.howto { display: grid; gap: 12px; margin: 18px 0 22px; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 0.95rem; color: var(--ink-dim); }
.step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem; }
.step b { color: var(--ink); }
.tip { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); text-align: center; margin-top: 14px; letter-spacing: 0.04em; }
.duel-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent); border-radius: var(--r-pill); padding: 9px 14px; }

/* ---- per-category accent colors ---- */
.fcard[data-cat="Movies & TV"]      { --cat: #ff8fb3; }
.fcard[data-cat="Music"]            { --cat: #b69cff; }
.fcard[data-cat="Tech & Apps"]      { --cat: #5cd1ff; }
.fcard[data-cat="History"]          { --cat: #ffb968; }
.fcard[data-cat="Recent"]           { --cat: #ff6f61; }
.fcard[data-cat="Science & Space"]  { --cat: #5eead4; }
.fcard[data-cat="Sports & Games"]   { --cat: #a3e635; }
.fcard[data-cat="Culture & Brands"] { --cat: #ffd34d; }

/* ---- play: the two cards ---- */
.play { display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; padding-top: 8px; }
.fcard {
  --cat: var(--ink-faint);
  min-width: 0;
  position: relative; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), var(--bg-2));
  padding: 22px 18px 20px; min-height: 130px;
  display: grid; place-items: center; text-align: center; gap: 7px;
  box-shadow: var(--shadow); overflow: hidden;
}
/* category accent bar across the top */
.fcard::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--cat), color-mix(in oklab, var(--cat) 20%, transparent));
}
.fcard .fc-cat {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--cat);
}
.fcard .fc-cat::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cat); box-shadow: 0 0 8px var(--cat); }
.fcard .fc-emoji { font-size: 2.3rem; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
.fcard .fc-label { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 4.7vw, 1.55rem); line-height: 1.14; max-width: 22ch; }
.fcard .fc-year {
  font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 2rem; line-height: 1; color: var(--ink); letter-spacing: 0.01em;
}
.fcard .fc-q {
  font-family: var(--font-mono); font-weight: 700; font-size: 1.7rem; letter-spacing: 0.16em;
  color: var(--ink-faint); animation: qPulse 1.5s ease-in-out infinite;
}
@keyframes qPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.85; } }

.fcard.anchor { border-color: color-mix(in oklab, var(--cat) 32%, var(--line)); }
.fcard.mystery { border-style: dashed; border-color: color-mix(in oklab, var(--ink-faint) 60%, var(--line)); background: linear-gradient(180deg, var(--bg-2), var(--bg)); }

.fcard.swap-in { animation: swapIn 0.34s var(--ease-snap) both; }
.fcard.deal-in { animation: dealIn 0.34s var(--ease-snap) both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(-12px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes dealIn { from { opacity: 0; transform: translateY(22px) scale(0.97); } to { opacity: 1; transform: none; } }

/* the year flip reveal on the challenger */
.fc-year.flip { animation: yearFlip 0.46s var(--ease-snap) both; }
@keyframes yearFlip { 0% { transform: rotateX(90deg) scale(1.35); opacity: 0; } 55% { transform: rotateX(0) scale(1.14); opacity: 1; } 100% { transform: none; } }
.fcard.correct { border-color: var(--good); border-style: solid; box-shadow: 0 0 36px -6px color-mix(in oklab, var(--good) 60%, transparent); }
.fcard.correct .fc-year { color: var(--good); }
.fcard.wrong { border-color: var(--bad); border-style: solid; box-shadow: 0 0 36px -6px color-mix(in oklab, var(--bad) 60%, transparent); animation: cardShake 0.42s var(--ease); }
.fcard.wrong .fc-year { color: var(--bad); }
@keyframes cardShake { 0%,100% { transform: translateX(0); } 18% { transform: translateX(-8px); } 38% { transform: translateX(7px); } 58% { transform: translateX(-4px); } 78% { transform: translateX(3px); } }

/* connector between the reference card (top) and the mystery card (below) */
.connector { display: grid; place-items: center; height: 14px; margin: -3px 0; }
.connector::before { content: '▾'; font-size: 1rem; line-height: 1; color: var(--ink-faint); opacity: 0.7; }

/* the question sits directly under the mystery card, beside the buttons */
.qline { text-align: center; margin: 8px 0 2px; }
.qline .prompt { font-family: var(--font-body); color: var(--ink-dim); font-size: 1.02rem; }
.qline .prompt b { color: var(--ink); }
.qline .ref-year { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }

/* choice buttons */
.choices { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 8px; }
.choice {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(0.85rem, 3.6vw, 1.14rem); white-space: nowrap;
  border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 18px 6px; cursor: pointer;
  color: var(--ink); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.1s var(--ease-snap), border-color 0.16s, box-shadow 0.18s, background 0.16s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.choice:active { transform: translateY(1px) scale(0.97); }
.choice.before { color: var(--before); }
.choice.before:hover { border-color: var(--before); box-shadow: 0 0 0 1px var(--before), 0 14px 32px -18px var(--before); background: color-mix(in oklab, var(--before) 13%, var(--surface-2)); }
.choice.after { color: var(--after); }
.choice.after:hover { border-color: var(--after); box-shadow: 0 0 0 1px var(--after), 0 14px 32px -18px var(--after); background: color-mix(in oklab, var(--after) 13%, var(--surface-2)); }
.choices.locked .choice { pointer-events: none; }
.choices.locked .choice:not(.picked) { opacity: 0.4; }
.choice.picked.before { border-color: var(--before); box-shadow: 0 0 0 2px var(--before); transform: scale(1.02); background: color-mix(in oklab, var(--before) 16%, var(--surface-2)); }
.choice.picked.after { border-color: var(--after); box-shadow: 0 0 0 2px var(--after); transform: scale(1.02); background: color-mix(in oklab, var(--after) 16%, var(--surface-2)); }

.kbd-hint { text-align: center; margin-top: 12px; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; color: var(--ink-faint); }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---- result sheet ---- */
.result-head { text-align: center; margin-bottom: 6px; }
.result-head .eyebrow { display: block; }
.result-streak { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; font-size: clamp(3.4rem, 19vw, 5.2rem); line-height: 1; margin: 6px 0 0; }
.result-streak .lbl { color: var(--ink-faint); font-size: 0.24em; display: block; text-transform: uppercase; letter-spacing: 0.22em; margin-top: 8px; font-family: var(--font-mono); }
.result-sub { text-align: center; color: var(--accent); font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin-bottom: 14px; }
.missed-line { text-align: center; color: var(--ink-dim); font-size: 0.92rem; margin-bottom: 14px; }
.missed-line b { color: var(--ink); }
.sheet .share-grid { margin: 4px 0 16px; line-height: 1.5; }
.sheet .stats { margin: 10px 0 16px; }
.sheet-actions { display: grid; gap: 10px; }

/* head-to-head */
.duel-card { border-radius: var(--r-lg); border: 1px solid var(--line); padding: 16px; margin: 6px 0 16px; background: var(--surface); }
.duel-card.win { border-color: color-mix(in oklab, var(--good) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in oklab, var(--good) 28%, transparent); }
.duel-card.lose { border-color: color-mix(in oklab, var(--bad) 50%, var(--line)); }
.duel-card.tie { border-color: var(--warn); }
.duel-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.duel-side { text-align: center; }
.duel-side b { font-family: var(--font-mono); font-size: 1.9rem; display: block; line-height: 1; }
.duel-side span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); }
.duel-side.me b { color: var(--accent); }
.duel-mid { font-family: var(--font-display); color: var(--ink-faint); }
.duel-verdict { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin-top: 12px; }
.duel-card.win .duel-verdict { color: var(--good); }
.duel-card.lose .duel-verdict { color: var(--bad); }

.stage-anim { animation: fadeUp 0.36s var(--ease) both; }

/* ---- category picker ---- */
.packs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 18px 0 6px; }
.pcard {
  display: flex; align-items: center; gap: 14px; min-width: 0; text-align: left; cursor: pointer;
  padding: 16px 16px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); color: var(--ink);
  transition: transform 0.16s var(--ease-snap), border-color 0.18s, box-shadow 0.22s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.pcard:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--pc) 55%, var(--line)); box-shadow: 0 18px 44px -26px color-mix(in oklab, var(--pc) 75%, transparent); background: color-mix(in oklab, var(--pc) 7%, var(--surface)); }
.pcard:active { transform: translateY(0) scale(0.99); }
.pcard .pc-emoji { font-size: 1.9rem; width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 15px; background: color-mix(in oklab, var(--pc) 16%, var(--surface-2)); border: 1px solid color-mix(in oklab, var(--pc) 40%, transparent); }
.pcard .pc-body { flex: 1; min-width: 0; }
.pcard .pc-body b { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; display: block; }
.pcard .pc-blurb { color: var(--ink-dim); font-size: 0.88rem; }
.pcard .pc-best { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--pc); flex: none; }

/* ---- intro sub-nav ---- */
.subnav { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.linkish { background: none; border: none; cursor: pointer; color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; padding: 4px 2px; transition: color 0.18s; }
.linkish:hover { color: var(--accent); }
.subnav-tip { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.04em; }
