/* ==========================================================================
   The Daily Dan — shared styles
   Pixel Yale scenes behind NYT-style square panels.
   Yale palette · Pixelify Sans accents · Franklin/Caslon/Playfair for text.

   Contents: tokens · base · scene · panels & buttons · header · hub hero ·
   trail · who's playing · Dan · splash · game shell · modal · results
   (curve, leaderboard, stats) · playtest · motion · small screens
   ========================================================================== */

:root {
  --yale-blue: #00356b;
  --yale-blue-2: #286dc0;
  --yale-blue-3: #63aaff;
  --yale-blue-4: #dbe9fa;
  --yale-blue-5: #eef4fc;
  --accent-orange: #bd5319;
  --accent-green: #5f712d;
  --gold: #f2c94c;

  --ink: #14111c;
  --ink-2: #4a4a55;
  --ink-3: #7a7883;
  --line: #d6d3cc;
  --line-2: #ebe7de;
  --paper: #fffdf8;
  --paper-2: #f6f1e6;

  --good: #4c8a3a;
  --good-bg: #e7f3e2;
  --bad: #c0392b;
  --bad-bg: #fbe6e3;

  --shadow: rgba(4, 14, 36, .55);
  --px: 3px;                         /* pixel border width */
  --drop: 6px 6px 0 var(--shadow);   /* hard pixel drop shadow */

  --pixel: "Jersey 20", "Pixelify Sans", "Courier New", monospace;   /* Jersey 20 is loaded for digits only */
  --serif: "Libre Caslon Text", Georgia, serif;
  --display: "Playfair Display", Georgia, serif;
  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 54px;
  --col: 640px;
}

/* a soft cross-fade between the trail and the game pages, where the browser supports it */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .26s; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-variant-ligatures: none; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #0b1736;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
body > header, body > section, body > main, body > footer { position: relative; z-index: 1; }
body.play > main { flex: 1; display: flex; flex-direction: column; }
:focus-visible { outline: 3px solid var(--yale-blue-3); outline-offset: 2px; }
::selection { background: var(--yale-blue); color: #fff; }

/* ---------- Pixel scene canvas ---------- */
canvas.scene {
  position: fixed; top: 0; left: 0;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}
.scene-tag {
  position: fixed; left: 12px; bottom: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--pixel); font-size: 13px; letter-spacing: .5px;
  color: #fff;
  background: rgba(4, 14, 36, .6);
  border: 2px solid rgba(255, 255, 255, .55);
  padding: 4px 9px;
  pointer-events: none;
  animation: fade .6s ease both;
}
.scene-tag svg { width: 8px; height: 10px; }

/* ---------- Panels: the core "square box" ---------- */
.panel {
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--drop);
}

/* ---------- Buttons: square, pixel-pressed ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; min-width: 140px; padding: 0 22px;
  border: var(--px) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 700; font-size: 15px; letter-spacing: .3px;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s var(--ease), box-shadow .08s var(--ease), background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--yale-blue); color: #fff; }
.btn.primary:hover { background: #0a4a8c; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.small { height: 38px; min-width: 0; padding: 0 16px; font-size: 14px; }
.btn.small:not(.ghost):not(.primary) { background: var(--yale-blue); color: #fff; }
.btn.small:not(.ghost):not(.primary):hover { background: #0a4a8c; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.on { background: var(--yale-blue); color: #fff; }
.btn[disabled], .btn.locked { opacity: .45; pointer-events: none; box-shadow: none; transform: translate(1px, 1px); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Header bar ---------- */
.topbar {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: var(--paper);
  border-bottom: var(--px) solid var(--ink);
  position: sticky; top: 0; z-index: 30;
}
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 2px; min-width: 92px; }
.topbar .right { justify-content: flex-end; }
.brand {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 24px;
  text-decoration: none;
  color: var(--yale-blue);
  white-space: nowrap;
  letter-spacing: .5px;
  transition: color .15s ease;
}
.brand:hover { color: var(--yale-blue-2); }
.brand .the { font-weight: 400; font-size: .72em; margin-right: 2px; }
.icon-btn {
  width: 40px; height: 40px;
  border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: background .15s ease, transform .08s ease;
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--pixel); font-weight: 700; font-size: 16px;
  color: var(--accent-orange);
  background: #fff3e6;
  border: 2px solid var(--ink);
  padding: 2px 9px 2px 6px;
}
.streak-chip svg { width: 16px; height: 16px; }

/* ---------- Hub hero (over the sky) ---------- */
.hero {
  text-align: center;
  padding: 34px 16px 0;
  color: #fff;
}
.hero .kicker {
  display: inline-block;
  font-family: var(--pixel); font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  background: var(--yale-blue); color: #fff;
  border: var(--px) solid var(--ink);
  padding: 3px 10px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.hero h1 {
  font-family: var(--pixel); font-weight: 700;
  font-size: clamp(46px, 11vw, 88px); line-height: .95;
  margin: 16px 0 0;
  color: #fff;
  text-shadow: 4px 4px 0 var(--yale-blue), 8px 8px 0 rgba(4, 14, 36, .45);
  letter-spacing: 1px;
}
.hero h1 .the { font-weight: 400; font-size: .5em; display: block; letter-spacing: 4px; text-transform: uppercase; }

/* the dare: a tilted tag pinned under the title */
.hero .challenge { margin: 20px 0 16px; }
.hero .challenge span {
  display: inline-block;
  position: relative;
  font-family: var(--display); font-style: italic; font-weight: 800;
  font-size: clamp(19px, 5vw, 30px); line-height: 1.15;
  color: var(--yale-blue);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  padding: 7px 20px 9px;
  box-shadow: 5px 5px 0 var(--shadow);
  transform: rotate(-1.6deg);
}
.hero .challenge span::before, .hero .challenge span::after {
  content: "";
  position: absolute; top: 50%;
  width: 9px; height: 9px;
  background: var(--gold);
  border: 2px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}
.hero .challenge span::before { left: -7px; }
.hero .challenge span::after { right: -7px; }
.hero .sub {
  font-family: var(--serif); font-size: clamp(16px, 3.6vw, 19px);
  margin: 0 auto; max-width: 520px; line-height: 1.4;
  text-shadow: 2px 2px 0 rgba(4, 14, 36, .6);
}
.hero .dateline {
  margin-top: 14px;
  display: inline-flex; gap: 10px; align-items: center;
  font-size: 13px; font-weight: 600;
  background: rgba(4, 14, 36, .55);
  padding: 6px 12px;
}

/* "Yale student?" prompt for people off campus */
.yale-ask {
  max-width: 520px; margin: 22px auto 0;
  padding: 14px 16px 16px;
  color: var(--ink); text-align: left;
  display: grid; gap: 12px;
  animation: fade .4s ease both;
}
.yale-ask p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.yale-ask p b { color: var(--ink); }
.yale-ask .btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- The trail of games ---------- */
.trail {
  width: 100%; max-width: var(--col); margin: 0 auto;
  padding: 0 16px 56px;
  flex: 1;
}
.trail-col { position: relative; padding-top: 140px; }
.step {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px 16px 16px;
  text-decoration: none;
  position: relative;
  transition: box-shadow .16s var(--ease), background .2s ease;
}
/* lift on hover with shadow only: moving the card would knock Dan off it */
.step.is-open:hover { box-shadow: 9px 9px 0 var(--shadow); }
.step.is-open:hover .tile svg { transform: scale(1.08) rotate(-3deg); }
.step .tile {
  width: 84px; height: 84px;
  border: var(--px) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, .16) 0 50%, transparent 50%);
}
.step .tile svg { width: 56px; height: 56px; transition: transform .25s var(--ease); }
.step .eyebrow, .splash-card .eyebrow {
  font-family: var(--pixel); font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--yale-blue-2);
}
.step h3 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 2px 0 2px; line-height: 1.05; }
.step p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.step .status { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.step .status b { color: var(--yale-blue); }
.step.is-done .tile::after {
  content: "✓";
  position: absolute; right: -10px; bottom: -10px;
  width: 26px; height: 26px;
  background: var(--good); color: #fff; font-weight: 800; font-size: 15px;
  border: var(--px) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.step.is-current .go .btn { animation: nudge 2.4s ease-in-out 1.4s infinite; }
.step.is-locked { background: #e9e5dc; box-shadow: 6px 6px 0 rgba(4, 14, 36, .35); }
.step.is-locked .tile { filter: grayscale(1) brightness(1.15); opacity: .55; }
.step.is-locked h3, .step.is-locked p { color: var(--ink-3); }
.lock {
  font-family: var(--pixel); font-size: 13px; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.lock svg { width: 16px; height: 16px; }

/* dotted pixel path between steps */
.link {
  height: 104px;
  margin-left: 56px;
  width: 6px;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .9) 0 6px, transparent 6px 14px);
  filter: drop-shadow(2px 2px 0 var(--shadow));
}
.link.lit {
  background: repeating-linear-gradient(to bottom, var(--yale-blue-3) 0 6px, transparent 6px 14px);
  background-size: 6px 14px;
  animation: march 1.6s linear infinite;
}

/* Composite score panel */
.dan-score {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
  padding: 18px;
}
.dan-score .big {
  width: 92px; height: 92px;
  background: var(--yale-blue); color: #fff;
  border: var(--px) solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--pixel); font-weight: 700; font-size: 38px; line-height: 1;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, .14) 0 50%, transparent 50%);
}
.dan-score .big small { font-size: 11px; font-weight: 500; letter-spacing: 1px; margin-top: 6px; opacity: .85; }
.dan-score h4 { margin: 0 0 4px; font-family: var(--display); font-size: 22px; }
.dan-score p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.dan-score.is-locked { background: #e9e5dc; }
.dan-score.is-locked .big { background-color: var(--ink-3); }
.progress-dots { display: flex; gap: 6px; margin-top: 10px; }
.progress-dots span { width: 14px; height: 14px; background: var(--line); border: 2px solid var(--ink); transition: background .3s ease; }
.progress-dots span.on { background: var(--yale-blue-3); }

/* ---------- Who's playing ---------- */
.me-panel {
  margin-top: 28px;
  padding: 16px;
  display: grid; gap: 14px;
}
.me-head { display: flex; align-items: center; gap: 12px; }
.me-head p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.who {
  flex: none;
  font-family: var(--pixel); font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 9px;
  border: 2px solid var(--ink);
  white-space: nowrap;
}
.who.yale { background: var(--yale-blue); color: #fff; }
.who.visitor { background: #fff; color: var(--ink); }
.me-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.me-fields label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); }
.me-fields .btn { grid-column: 1 / -1; justify-self: start; }
select, input[type="text"] {
  font-family: inherit; font-size: 15px; font-weight: 500;
  height: 40px; padding: 0 10px; width: 100%;
  border: var(--px) solid var(--ink);
  background: #fff; color: var(--ink);
  border-radius: 0;
  -webkit-appearance: none; appearance: none;
  transition: box-shadow .15s ease;
}
select {
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select:focus, input[type="text"]:focus { outline: none; box-shadow: 3px 3px 0 var(--yale-blue-3); }
input::placeholder { color: var(--ink-3); font-weight: 400; }

footer {
  padding: 22px 16px 52px;
  text-align: center;
  font-size: 12px; line-height: 1.6;
  color: rgba(255, 255, 255, .85);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .6);
}

/* ---------- Handsome Dan ---------- */
.dan {
  position: absolute;
  z-index: 5;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.dan canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.dan.hop canvas { animation: danhop .35s ease; }
.dan.walking { cursor: default; }
.dan-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 50%;
  transform: translateX(calc(50% + var(--shift, 0px)));
  background: #fff;
  border: var(--px) solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 6px 10px;
  font-family: var(--pixel); font-size: 15px; line-height: 1.2;
  white-space: nowrap;
  max-width: min(300px, 78vw);
  animation: bubble .22s var(--ease);
}
.dan-bubble.wrap { white-space: normal; width: max-content; text-align: center; }
.dan-bubble::after {
  content: "";
  position: absolute; left: calc(50% - var(--shift, 0px)); top: 100%;
  width: 9px; height: 9px;
  background: #fff;
  border-right: var(--px) solid var(--ink);
  border-bottom: var(--px) solid var(--ink);
  transform: translate(-50%, -5px) rotate(45deg);
}
/* on game pages the bubble sits beside Dan so the header never clips it */
.dan.bubble-left .dan-bubble {
  bottom: auto; top: 18%;
  right: calc(100% + 12px);
  transform: none;
  animation-name: fade;
  --shift: 0px !important;
}
.dan.bubble-left .dan-bubble::after {
  left: 100%; top: 50%;
  border-right: var(--px) solid var(--ink);
  border-bottom: 0;
  border-top: var(--px) solid var(--ink);
  transform: translate(-6px, -50%) rotate(45deg);
}
.dan-dust {
  position: absolute; z-index: 4;
  width: 5px; height: 5px;
  background: rgba(255, 255, 255, .85);
  pointer-events: none;
  animation: dust .5s ease-out forwards;
}

/* ---------- Splash (per game) ---------- */
.splash {
  flex: 1;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 104px 16px 48px;
  animation: fade .3s ease both;
  transition: opacity .18s ease;
}
.splash.out { opacity: 0; }
.splash-card { width: 100%; max-width: 440px; position: relative; text-align: center; }
.splash-card .band {
  height: 150px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: var(--px) solid var(--ink);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, .14) 0 50%, transparent 50%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 6px);
}
.splash-card .band svg { width: 84px; height: 84px; animation: bob 3.2s ease-in-out infinite; }
.splash-card .body { padding: 22px 22px 26px; }
.splash-card .eyebrow { font-size: 14px; letter-spacing: 1.4px; }
.splash-card h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 10vw, 54px); margin: 4px 0 2px; line-height: 1; }
.splash-card .tagline { font-family: var(--serif); font-size: 19px; margin: 6px 0 20px; color: var(--ink-2); line-height: 1.35; }
.splash-card .btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.splash-card .btn { min-width: 200px; }
.splash-card .meta { margin-top: 20px; font-size: 13px; color: var(--ink-3); line-height: 1.6; }
.splash-card .meta b { display: block; color: var(--ink); font-size: 14px; }

/* ---------- Game screen ---------- */
.game {
  width: calc(100% - 32px); max-width: 560px;
  margin: 100px auto 48px;
  padding: 16px 16px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--drop);
  position: relative;
  animation: fade .28s ease both;       /* opacity only: Dan is standing on it */
}
.game-bar {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--pixel); font-size: 15px; color: var(--ink-2);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line-2);
}
.game-bar b { color: var(--ink); }
.timer {
  font-family: var(--pixel);
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 20px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  position: relative;
  white-space: nowrap;
}
.timer svg { width: 18px; height: 18px; }
.game-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.game-actions:empty { display: none; }
.hint { font-size: 14px; color: var(--ink-3); text-align: center; min-height: 20px; margin: 0; line-height: 1.4; }
.hint b { color: var(--ink); }

/* Hint button with cooldown */
.hint-btn { position: relative; overflow: hidden; }
.hint-btn svg { width: 15px; height: 15px; color: var(--accent-orange); transition: color .2s ease; }
.hint-btn[disabled] { opacity: 1; pointer-events: none; color: var(--ink-3); box-shadow: 3px 3px 0 var(--line); border-color: var(--line); transform: none; }
.hint-btn[disabled] svg { color: var(--line); }
.hint-btn .cd { font-family: var(--pixel); font-variant-numeric: tabular-nums; }
.hint-btn .bar {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0;
  background: var(--yale-blue-3);
  transition: width .2s linear;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 14, 36, .5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fade .2s ease;
  transition: opacity .16s ease;
}
.modal-backdrop.out { opacity: 0; }
.modal {
  background: var(--paper);
  width: 100%; max-width: 500px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: var(--px) solid var(--ink);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 26px 22px 22px;
  position: relative;
  animation: rise .26s var(--ease);
  transition: transform .16s ease;
}
.modal-backdrop.out .modal { transform: translateY(8px); }
.modal.wide { max-width: 620px; }
.modal .close { position: absolute; top: 8px; right: 8px; }
.modal h2 { font-family: var(--pixel); font-size: 30px; margin: 0 34px 4px 0; font-weight: 700; color: var(--yale-blue); line-height: 1.05; }
.modal h3 { font-family: var(--pixel); font-size: 14px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; margin: 22px 0 10px; }
.modal p, .modal li { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.modal li { margin-bottom: 4px; }
.modal ul { padding-left: 20px; margin: 8px 0; }
.modal .lede { font-family: var(--serif); font-size: 18px; color: var(--ink); margin: 0 0 6px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.footnote { font-size: 11px !important; color: var(--ink-3) !important; margin: 16px 0 0; text-align: center; }

/* ---------- Results: verdict, tabs, curve, leaderboard, stats ---------- */
.verdict {
  display: flex; align-items: center; gap: 14px;
  background: var(--yale-blue-5);
  border: var(--px) solid var(--ink);
  padding: 12px 14px; margin-top: 14px;
}
.grade {
  width: 56px; height: 56px; flex: none;
  background: var(--yale-blue); color: #fff;
  border: var(--px) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 27px; font-weight: 800; line-height: 1;
  animation: stamp .45s var(--ease) .15s both;
}
.verdict .txt { font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.verdict .txt b { color: var(--ink); font-size: 16px; display: block; font-variant-numeric: tabular-nums; }

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  border: var(--px) solid var(--ink);
}
.tab {
  height: 36px;
  border: 0; border-right: 2px solid var(--ink);
  background: var(--paper);
  font-family: var(--pixel); font-size: 14px; letter-spacing: .8px; text-transform: uppercase;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.tab:last-child { border-right: 0; }
.tab:hover { background: var(--paper-2); }
.tab.on { background: var(--yale-blue); color: #fff; }
[data-pane] { animation: fade .22s ease; padding-top: 14px; }

.curve-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.curve-wrap .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow .5s var(--ease) both; }
.curve-caption { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; gap: 8px; border-top: 2px solid var(--line-2); padding-top: 5px; }
.college-line { margin: 12px 0 0 !important; font-size: 14px !important; text-align: center; }
.college-line b { color: var(--yale-blue); }

/* Leaderboard: Yale students are blue rows in one straight column.
   A visitor is a white row, slotted in where they'd place and nudged out of line. */
.lb-note { margin: 0 0 10px !important; font-size: 14px !important; text-align: center; }
.lb-note b { color: var(--yale-blue); }
.lb { list-style: none; margin: 0; padding: 0 16px 0 0; display: grid; gap: 5px; }
.lb .lb-row {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  min-height: 36px; padding: 5px 12px 5px 6px;
  background: var(--yale-blue); color: #fff;
  border: 2px solid var(--ink);
  font-size: 14px !important; line-height: 1.25 !important;
  margin: 0 !important;
  animation: fade .3s ease both;
}
.lb-row .rk { font-family: var(--pixel); font-size: 15px; text-align: center; color: var(--yale-blue-4); font-variant-numeric: tabular-nums; }
.lb-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255, 255, 255, .78); font-size: 13px; }
.lb-row .nm b { color: #fff; font-size: 14px; font-weight: 700; }
.lb-row .nm em {
  font-style: normal; font-family: var(--pixel); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  margin-left: 8px; padding: 1px 6px;
  background: var(--gold); color: var(--ink);
}
.lb-row .vl { font-family: var(--pixel); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb .lb-row.me { background: var(--yale-blue-2); box-shadow: 3px 3px 0 var(--gold); }
.lb .lb-row.visitor {
  background: #fff; color: var(--ink);
  transform: translateX(16px);              /* out of line with the Yale column */
  box-shadow: 3px 3px 0 var(--shadow);
}
.lb-row.visitor .rk { color: var(--ink-3); }
.lb-row.visitor .nm, .lb-row.visitor .nm b { color: var(--ink); }
.lb-row.visitor .nm em { background: var(--ink); color: #fff; }
.lb-gap { text-align: center; color: var(--ink-3) !important; font-family: var(--pixel); letter-spacing: 3px; line-height: 1 !important; margin: 0 !important; }
.lb-how { margin: 14px 0 0 !important; font-size: 13px !important; text-align: center; }
.lb-how a { color: var(--yale-blue-2); font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-top: 4px; }
.stat-row > div { background: var(--paper-2); border: 2px solid var(--line); padding: 10px 2px 8px; }
.stat-row .num { font-family: var(--pixel); font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-row .lbl { font-size: 11px; color: var(--ink-2); line-height: 1.2; }

/* Toast */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border: var(--px) solid #fff;
  padding: 10px 16px;
  font-family: var(--pixel); font-size: 15px;
  z-index: 200;
  max-width: calc(100vw - 32px); text-align: center;
  animation: toast .22s var(--ease);
  transition: opacity .2s ease;
}
.toast.out { opacity: 0; }

/* Confetti when a game is finished */
.confetti { position: fixed; inset: 0; z-index: 150; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: 34%;
  animation: confetti 1.6s cubic-bezier(.2, .6, .4, 1) both;
}

/* ---------- Playtest controls ---------- */
.playtest-bar {
  position: fixed; right: 12px; bottom: 12px; z-index: 50;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  max-width: calc(100vw - 24px);
  background: #fff6c9;
  border: var(--px) solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 8px 10px;
}
.playtest-bar .pt-label {
  font-family: var(--pixel); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase;
  background: var(--accent-orange); color: #fff; padding: 2px 6px;
}
.playtest-bar .btn.small { height: 32px; padding: 0 12px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pick { display: grid; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); }
.all-games { display: flex; flex-wrap: wrap; gap: 8px; }
.all-games .btn.small { height: 32px; padding: 0 10px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- Motion ---------- */
/* The trail fades in card by card once the page has been scrolled to the right
   place. Opacity only, so Dan's perch is never thrown off. The slow fallback
   keeps everything visible even if the script is late. */
.hub .hero > * { animation: fade .5s ease both; }
.hub .hero > :nth-child(2) { animation-delay: .06s; }
.hub .hero > :nth-child(3) { animation-delay: .16s; }
.hub .hero > :nth-child(4) { animation-delay: .26s; }
.hub .hero > :nth-child(n + 5) { animation-delay: .34s; }
.hub .step, .hub .link, .hub .dan-score, .hub .me-panel { animation: fade .5s ease 1.6s both; }
.hub.ready .step, .hub.ready .link, .hub.ready .dan-score, .hub.ready .me-panel { animation: fadeb .5s ease both; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
.hub.ready .link.lit { animation: fadeb .5s ease both, march 1.6s linear infinite; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeb { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bubble { from { opacity: 0; transform: translate(calc(50% + var(--shift, 0px)), 6px); } to { opacity: 1; transform: translate(calc(50% + var(--shift, 0px)), 0); } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes danhop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
@keyframes dust { from { opacity: .9; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(-8px, -12px) scale(.4); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes nudge { 0%, 86%, 100% { transform: none; box-shadow: 3px 3px 0 var(--ink); } 92% { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); } }
@keyframes march { from { background-position: 0 0; } to { background-position: 0 14px; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes stamp { 0% { transform: scale(1.7) rotate(-10deg); opacity: 0; } 60% { transform: scale(.94) rotate(2deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  18% { transform: translate(calc(var(--dx) * .45), -110px) rotate(calc(var(--rot) * .5)); opacity: 1; }
  100% { transform: translate(var(--dx), 62vh) rotate(calc(var(--rot) * 3)); opacity: 0; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .step { grid-template-columns: 64px 1fr; gap: 12px; padding: 14px; }
  .step .tile { width: 64px; height: 64px; }
  .step .tile svg { width: 44px; height: 44px; }
  .step .go { grid-column: 1 / -1; }
  .step .go .btn { width: 100%; }
  .step h3 { font-size: 24px; }
  .link { margin-left: 42px; height: 88px; }
  .trail-col { padding-top: 120px; }
  .hero { padding-top: 24px; }
  .hero h1 { margin-top: 12px; }
  .hero .challenge { margin: 16px 0 12px; }
  .dan-score { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .me-fields { grid-template-columns: 1fr; }
  .me-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .brand { font-size: 20px; }
  .topbar .left, .topbar .right { min-width: 80px; }
  .game { margin-top: 82px; width: calc(100% - 20px); padding: 12px 12px 18px; gap: 12px; }
  .splash { padding-top: 84px; }
  .modal { padding: 24px 16px 18px; }
  .modal h2 { font-size: 26px; }
  .lb { padding-right: 12px; }
  .lb-row.visitor { transform: translateX(12px); }
  .picks { grid-template-columns: 1fr; }
  .playtest-bar { left: 8px; right: 8px; bottom: 8px; padding: 6px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .playtest-bar .btn.small { height: 28px; padding: 0 9px; font-size: 12px; flex: none; }
  .playtest-bar .pt-label { font-size: 11px; flex: none; }
  .scene-tag { display: none; }
}

/* ==========================================================================
   Holiday edition. html[data-holiday] is set by js/common.js; the dates are in
   js/scene.js. Kept light: a string of lights, snow on the cards, a candy-cane trail.
   ========================================================================== */
/* a string of lights under the header */
html[data-holiday] .topbar::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% + var(--px)); height: 11px;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 9px, #d62839 9px 15px, transparent 15px 33px, #f2c94c 33px 39px, transparent 39px 57px, #2f9a55 57px 63px, transparent 63px 81px, #3f8ae0 81px 87px, transparent 87px 96px) 0 5px / 96px 6px repeat-x,
    repeating-linear-gradient(90deg, transparent 0 11px, var(--ink) 11px 13px, transparent 13px 24px) 0 0 / 24px 5px repeat-x;
  filter: drop-shadow(1px 1px 0 rgba(10, 14, 30, .45));
}
html[data-holiday] .topbar::before {            /* every other bulb glows on and off, slowly */
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% + var(--px) + 5px); height: 6px; z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(255, 255, 255, .7) 9px 15px, transparent 15px 57px, rgba(255, 255, 255, .7) 57px 63px, transparent 63px 96px) 0 0 / 96px 6px repeat-x;
  animation: twinkle 2.8s ease-in-out infinite alternate;
}
/* snow settled on top of the cards */
html[data-holiday] .dan-score { position: relative; }
html[data-holiday] .step::before,
html[data-holiday] .dan-score::before,
html[data-holiday] .game::before,
html[data-holiday] .splash-card::before {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: calc(100% + var(--px)); height: 8px;
  pointer-events: none;
  background:
    linear-gradient(#dbe6f3, #dbe6f3) 0 100% / 100% 2px no-repeat,
    linear-gradient(#fff, #fff) 0 100% / 100% 4px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 10px, #fff 10px 46px, transparent 46px 72px, #fff 72px 94px, transparent 94px 132px, #fff 132px 152px, transparent 152px 178px) 0 0 / 178px 4px repeat-x;
  filter: drop-shadow(0 calc(var(--px) * -1) 0 var(--ink)) drop-shadow(var(--px) 0 0 var(--ink)) drop-shadow(calc(var(--px) * -1) 0 0 var(--ink));
}
/* the lit part of the trail turns candy cane */
html[data-holiday] .link.lit {
  background: repeating-linear-gradient(to bottom, #e0353f 0 6px, transparent 6px 14px, #fff 14px 20px, transparent 20px 28px);
  background-size: 6px 28px;
  animation: march2 3.2s linear infinite;
}
html[data-holiday] .hub.ready .link.lit { animation: fadeb .5s ease both, march2 3.2s linear infinite; }
@keyframes twinkle { from { opacity: 0; } to { opacity: .85; } }
@keyframes march2 { from { background-position: 0 0; } to { background-position: 0 28px; } }

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