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

: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;

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

  --good: #4c8a3a;
  --bad: #c0392b;

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

  --pixel: "Pixelify Sans", "Courier New", monospace;
  --serif: "Libre Caslon Text", Georgia, serif;
  --display: "Playfair Display", Georgia, serif;
  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

  --header-h: 54px;
  --col: 640px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-variant-ligatures: none; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #0b1736;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
body > header, body > section, body > main, body > footer { position: relative; z-index: 1; }

/* ---------- Pixel skyline 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;
}
.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);
}

/* ---------- 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;
}
.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);
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- 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 .05s ease, box-shadow .05s ease;
  white-space: nowrap;
}
.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: #00285a; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.small { height: 38px; min-width: 0; padding: 0 16px; font-size: 14px; }
.btn.ghost { background: var(--paper); }
.btn[disabled], .btn.locked { opacity: .5; pointer-events: none; box-shadow: none; }

/* ---------- 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 10px;
  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; }
.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;
}

/* ---------- 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: transform .12s ease;
}
.step.is-open:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--shadow); }
.step .tile {
  width: 84px; height: 84px;
  border: var(--px) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.step .tile svg { width: 56px; height: 56px; }
.tile.kings { background: var(--yale-blue); }
.tile.shuttle { background: var(--yale-blue-3); }
.tile.blitz { background: var(--accent-orange); }
.step .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 { position: relative; }
.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-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); }

/* 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;
}
.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; }
.progress-dots { display: flex; gap: 6px; margin-top: 10px; }
.progress-dots span { width: 14px; height: 14px; background: var(--line); border: 2px solid var(--ink); }
.progress-dots span.on { background: var(--yale-blue-3); }

.college-row {
  margin-top: 26px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px;
  font-size: 14px; color: var(--ink-2);
}
select {
  font-family: inherit; font-size: 14px;
  height: 38px; padding: 0 10px;
  border: var(--px) solid var(--ink);
  background: #fff; color: var(--ink);
  border-radius: 0;
}

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

/* ---------- Hint button with cooldown ---------- */
.hint-btn { position: relative; overflow: hidden; }
.hint-btn[disabled] { opacity: 1; pointer-events: none; color: var(--ink-3); box-shadow: 3px 3px 0 var(--line); border-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;
}

/* ---------- 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); }

/* ---------- 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(50%);
  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: 260px;
  animation: rise .2s ease;
}
.dan-bubble::after {
  content: "";
  position: absolute; left: 50%; 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;
}
.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);
}
@keyframes danhop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }

/* ---------- Splash (per game) ---------- */
.splash {
  flex: 1;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 104px 16px 48px;
}
.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);
}
.splash-card .band svg { width: 84px; height: 84px; }
.splash-card .band.kings { background: var(--yale-blue); }
.splash-card .band.shuttle { background: var(--yale-blue-3); }
.splash-card .band.blitz { background: var(--accent-orange); }
.splash-card .body { padding: 22px 22px 26px; }
.splash-card .eyebrow { font-family: var(--pixel); font-size: 14px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--yale-blue-2); }
.splash-card h1 { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 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;
}
.game-bar {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--pixel); font-size: 15px; color: var(--ink-2);
}
.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;
}
.timer svg { width: 18px; height: 18px; }
.game-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hint { font-size: 14px; color: var(--ink-3); text-align: center; min-height: 20px; margin: 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 14, 36, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fade .18s ease;
}
.modal {
  background: var(--paper);
  width: 100%; max-width: 500px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: var(--px) solid var(--ink);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 26px 22px 22px;
  position: relative;
  animation: rise .2s ease;
}
.modal .close { position: absolute; top: 8px; right: 8px; }
.modal h2 { font-family: var(--pixel); font-size: 30px; margin: 0 0 4px; font-weight: 700; color: var(--yale-blue); }
.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 ul { padding-left: 20px; margin: 8px 0; }
.modal .lede { font-family: var(--serif); font-size: 18px; color: var(--ink); margin: 0 0 6px; }

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

.curve-wrap { margin-top: 6px; }
.curve-wrap svg { width: 100%; height: auto; display: block; }
.curve-caption { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 4px; gap: 8px; }
.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(--pixel); font-size: 26px; font-weight: 700;
}
.verdict .txt { font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.verdict .txt b { color: var(--ink); font-size: 16px; display: block; }
.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-top: 16px; text-align: center; }

/* 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;
  animation: fade .15s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dan-bubble { animation-name: bubble; }
@keyframes bubble { from { opacity: 0; transform: translate(50%, 6px); } to { opacity: 1; transform: translate(50%, 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); } }

@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: 12px 0 8px; }
  .dan-score { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .brand { font-size: 20px; }
  .topbar .left, .topbar .right { min-width: 80px; }
  .game { margin-top: 82px; }
  .splash { padding-top: 84px; }
}

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