/* ============================================================
   THE THOMPSON FAMILY GAZETTE
   Editorial newsprint aesthetic. Fraunces + Newsreader + Mono.
   ============================================================ */

:root {
  --paper:        #f4ece0;
  --paper-warm:   #ede2cf;
  --paper-deep:   #e3d6ba;
  --ink:          #1a1410;
  --ink-soft:     #3b3127;
  --ink-fade:     #6b5f50;
  --ink-faint:    #8e8270;
  --rule:         #2a2018;
  --rule-soft:    #b5a78d;
  --oxblood:      #8a2c1d;
  --oxblood-deep: #6e2417;
  --gold:         #b58e3f;
  --moss:         #5a7c44;
  --kraft:        #c47a3b;
  --shadow-warm:  0 1px 0 rgba(255,250,235,0.5), 0 14px 40px rgba(56,40,20,0.18);

  --serif-display: 'Fraunces', 'Times New Roman', serif;
  --serif-body:    'Newsreader', 'Georgia', serif;
  --mono:          'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
*::selection { background: var(--ink); color: var(--paper); }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: #d7c8a8;
  color: var(--ink);
  font-family: var(--serif-body);
  font-feature-settings: 'onum' 1, 'liga' 1, 'kern' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
}

/* The "page" — sits on a darker board */
.paper {
  position: relative;
  max-width: 1180px;
  margin: 32px auto;
  padding: 56px 64px 48px;
  background:
    radial-gradient(1200px 600px at 80% 0%, rgba(184,142,63,0.06), transparent 70%),
    radial-gradient(900px 500px at 0% 100%, rgba(138,44,29,0.05), transparent 70%),
    var(--paper);
  box-shadow:
    0 0 0 1px rgba(60,40,20,0.07),
    0 30px 60px -20px rgba(60,40,20,0.35),
    0 80px 120px -40px rgba(60,40,20,0.25);
  /* overflow stays visible so tooltips can extend beyond section edges */
}

/* Paper grain — SVG noise */
.grain {
  position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.45;
  mix-blend-mode: multiply;
  z-index: 0;
}
.paper > * { position: relative; z-index: 1; }

/* ============================================================
   MASTHEAD
============================================================ */
.masthead { margin-bottom: 36px; animation: rise 600ms cubic-bezier(.2,.7,.2,1) both; }
.masthead-bar {
  height: 3px;
  background: var(--rule);
  margin: 0;
}
.masthead-bar.top    { height: 5px; background: var(--ink); }
.masthead-bar.mid    { height: 1px; background: var(--rule); margin: 16px 0 14px; }
.masthead-bar.bottom { height: 5px; background: var(--ink); margin-top: 12px; box-shadow: 0 4px 0 var(--paper), 0 5px 0 var(--rule); }

.masthead-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.masthead-row.eyebrow {
  padding: 10px 4px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead-row.eyebrow .eb-left { text-align: left; }
.masthead-row.eyebrow .eb-center { text-align: center; }
.masthead-row.eyebrow .eb-right { text-align: right; }

.nameplate {
  text-align: center;
  margin: 14px 0 10px;
  line-height: 0.92;
  font-family: var(--serif-display);
  font-style: normal;
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'wght' 600;
  letter-spacing: -0.018em;
  font-weight: 600;
}
.nameplate .np-the {
  display: block;
  font-style: italic;
  font-variation-settings: 'opsz' 60, 'SOFT' 100, 'wght' 400;
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: -4px;
}
.nameplate .np-name {
  display: block;
  font-size: clamp(48px, 9vw, 104px);
  text-transform: uppercase;
  font-feature-settings: 'lnum' 1;
  color: var(--ink);
}
.nameplate .np-name.lower {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'wght' 500;
  text-transform: none;
  font-size: clamp(58px, 11vw, 128px);
  letter-spacing: -0.025em;
  margin-top: -8px;
}

/* WORDLE — six tiles, printed-on-paper feel */
.nameplate .np-tiles {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 0.6vw, 8px);
  margin-top: 14px;
}
.big-tile {
  display: grid;
  place-items: center;
  width:  clamp(48px, 9.5vw, 108px);
  aspect-ratio: 1 / 1;
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial Black', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(28px, 5.6vw, 64px);
  line-height: 1;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  position: relative;
  flex-shrink: 0;
  user-select: none;
  /* lift slightly off the paper */
  box-shadow:
    0 2px 0 rgba(20,16,12,0.18),
    0 8px 18px -8px rgba(40,30,20,0.4);
  animation: tileFlip 600ms cubic-bezier(.2,.7,.2,1) both;
}
.big-tile:nth-child(1) { animation-delay: 80ms; }
.big-tile:nth-child(2) { animation-delay: 160ms; }
.big-tile:nth-child(3) { animation-delay: 240ms; }
.big-tile:nth-child(4) { animation-delay: 320ms; }
.big-tile:nth-child(5) { animation-delay: 400ms; }
.big-tile:nth-child(6) { animation-delay: 480ms; }

.big-tile.correct { background: #6aaa64; }
.big-tile.present { background: #c9b458; }
.big-tile.absent  { background: #787c7e; }

/* Ink-print noise overlay */
.big-tile::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.32 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.55;
  pointer-events: none;
}
/* Tiny inner highlight to simulate uneven ink density */
.big-tile::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), transparent 40%);
  pointer-events: none;
}
.big-tile > * { position: relative; z-index: 1; }
/* The letter is direct text node — wrap if needed */
.big-tile { isolation: isolate; }

@keyframes tileFlip {
  0%   { opacity: 0; transform: rotateX(-90deg) translateY(8px); }
  60%  { opacity: 1; transform: rotateX(0deg) translateY(0); }
  100% { opacity: 1; transform: rotateX(0deg) translateY(0); }
}

.masthead-row.tagline {
  padding: 6px 0 10px;
  font-family: var(--serif-body);
  font-style: italic;
  font-variation-settings: 'opsz' 24;
  font-size: 14px;
  color: var(--ink-soft);
}
.masthead-row.tagline .tag-left { text-align: left; }
.masthead-row.tagline .tag-center { text-align: center; }
.masthead-row.tagline .tag-right { text-align: right; }
.tag-left .latin { font-family: var(--serif-display); font-style: italic; font-size: 13px; color: var(--ink-fade); }

.masthead-row.dateline {
  padding: 6px 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.dl-section { text-align: left; font-weight: 700; color: var(--ink); }
.dl-status { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.dl-stats { text-align: right; }
.dl-stats .num { font-feature-settings: 'tnum' 1; color: var(--ink); font-weight: 700; }

.dl-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 2px var(--paper);
  position: relative;
}
.dl-status[data-state="ready"] { color: var(--moss); }
.dl-status[data-state="ready"] .dot { background: var(--moss); animation: pulse 2.4s ease-in-out infinite; }
.dl-status[data-state="qr"] { color: var(--gold); }
.dl-status[data-state="qr"] .dot { background: var(--gold); }
.dl-status[data-state="error"] { color: var(--oxblood); }
.dl-status[data-state="error"] .dot { background: var(--oxblood); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--paper), 0 0 0 0 rgba(90,124,68,0); }
  50%      { box-shadow: 0 0 0 2px var(--paper), 0 0 0 6px rgba(90,124,68,0.18); }
}

/* ============================================================
   PERIOD SELECTOR (global)
============================================================ */
.period-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.period-label {
  color: var(--ink-soft);
  font-weight: 700;
}
.period-applies {
  color: var(--ink-faint);
  text-align: right;
  font-style: italic;
  font-family: var(--serif-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}
.period-seg {
  display: inline-flex;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  justify-self: center;
}
.period-btn {
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 9px 14px;
  color: var(--ink-fade);
  cursor: pointer;
  border-right: 1px dotted var(--rule-soft);
  transition: color 160ms ease, background 160ms ease;
}
.period-btn:last-child { border-right: 0; }
.period-btn:hover { color: var(--ink); }
.period-btn.active {
  color: var(--paper);
  background: var(--ink);
}

/* ============================================================
   KICKERS, RULES, SECTION HEADS
============================================================ */
.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--oxblood);
  padding: 4px 0;
  border-bottom: 1px solid var(--oxblood);
}
.kicker.tiny { font-size: 10px; padding: 2px 0; }

.rule {
  position: relative;
  height: 1px;
  background: var(--rule);
  margin: 36px 0 14px;
  text-align: center;
}
.rule .rule-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
}
.rule.decorative {
  background: transparent;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  height: 5px;
}

.section { animation: rise 700ms cubic-bezier(.2,.7,.2,1) both; }
.section:nth-of-type(2) { animation-delay: 60ms; }
.section:nth-of-type(3) { animation-delay: 120ms; }
.section:nth-of-type(4) { animation-delay: 180ms; }
.section-head { margin-bottom: 14px; }

.headline {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 96, 'SOFT' 30, 'wght' 500;
  font-weight: 500;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
  color: var(--ink);
}
.headline-small {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 30, 'wght' 500;
  font-weight: 500;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.08;
  letter-spacing: -0.012em;
  margin: 6px 0 6px;
  color: var(--ink);
}
.deck {
  font-family: var(--serif-body);
  font-style: italic;
  font-variation-settings: 'opsz' 24;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 64ch;
  margin: 0 0 10px;
}
.subdeck {
  font-family: var(--serif-body);
  font-style: italic;
  font-variation-settings: 'opsz' 18;
  color: var(--ink-fade);
  font-size: 14px;
  margin: 0;
}

.empty {
  font-family: var(--serif-body);
  font-style: italic;
  color: var(--ink-fade);
  text-align: center;
  padding: 22px 12px;
}

/* ============================================================
   LEAD STORY (today's results)
============================================================ */
.lead {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  align-items: start;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  animation: rise 700ms cubic-bezier(.2,.7,.2,1) both;
  animation-delay: 30ms;
}
.lead-text .deck::first-letter {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'wght' 700;
  font-weight: 700;
  font-style: normal;
  float: left;
  font-size: 4.6em;
  line-height: 0.86;
  padding: 8px 10px 0 0;
  color: var(--ink);
}

.lead-results {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.lead-results li {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: baseline;
  column-gap: 22px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.lead-results li:last-child { border-bottom: 0; }
.lead-results li.empty { display: block; text-align: center; }
.lead-results .rank {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 96, 'SOFT' 0, 'wght' 600;
  font-style: italic;
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
  text-align: right;
  padding-right: 6px;
}
.lead-results li.gold .rank { color: var(--oxblood); }
.lead-results .player-cell {
  display: flex; align-items: baseline; gap: 12px;
}
.swatch {
  width: 9px; height: 9px;
  background: currentColor;
  border-radius: 1px;
  display: inline-block;
  position: relative; top: -1px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18) inset;
}
.player-name {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0;
  color: var(--ink);
}
.posted-at {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: lowercase;
}

/* ============================================================
   SCORE PILLS — inked badges, like sports box scores
============================================================ */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'wght' 700;
  font-weight: 700;
  font-size: 19px;
  min-width: 48px;
  height: 32px;
  padding: 0 10px;
  border-radius: 2px;
  letter-spacing: 0.02em;
  color: var(--paper);
  background: var(--ink);
  position: relative;
}
.score-pill::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.7;
  pointer-events: none;
  border-radius: inherit;
}
.score-pill.score-1 { background: var(--moss); }
.score-pill.score-2 { background: var(--moss); }
.score-pill.score-3 { background: #6e8a4e; }
.score-pill.score-4 { background: var(--ink); }
.score-pill.score-5 { background: var(--kraft); }
.score-pill.score-6 { background: var(--oxblood); }
.score-pill.score-X { background: var(--oxblood-deep); color: var(--paper-warm); }

/* ============================================================
   STANDINGS TABLE
============================================================ */
.standings-wrap { overflow-x: auto; }
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--serif-body);
  font-feature-settings: 'tnum' 1;
}
.lb-table thead th {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 12px 8px;
  text-align: left;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-warm);
}
.lb-table thead th.num { text-align: right; }
.lb-table tbody td {
  padding: 12px 12px;
  border-bottom: 1px dotted var(--rule-soft);
  font-size: 16px;
  color: var(--ink);
  transition: background 180ms ease;
}
.lb-table tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.lb-table tbody tr:hover td { background: rgba(184,142,63,0.08); }
.lb-table tbody td.num {
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1;
  font-size: 14px;
  text-align: right;
  color: var(--ink-soft);
}
.lb-table tbody td.num.primary {
  color: var(--ink);
  font-weight: 700;
}
.lb-table tbody td.rank-col {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 0, 'wght' 500;
  font-style: italic;
  font-size: 18px;
  width: 32px;
  text-align: right;
  color: var(--ink-fade);
}
.lb-table tbody tr.gold td.rank-col { color: var(--oxblood); font-weight: 700; }
.lb-table tbody td.contestant {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600;
  font-size: 18px;
}
.lb-table tbody tr.empty td { text-align: center; font-style: italic; color: var(--ink-fade); padding: 24px 12px; }

/* ============================================================
   CHRONICLE / chart
============================================================ */
.chronicle .seg {
  display: inline-flex;
  gap: 0;
  padding: 0;
  margin: 8px 0 18px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.seg-btn {
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 9px 16px;
  color: var(--ink-fade);
  cursor: pointer;
  border-right: 1px dotted var(--rule-soft);
  transition: color 160ms ease, background 160ms ease;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  color: var(--paper);
  background: var(--ink);
}

.chart-wrap {
  position: relative;
  height: 320px;
  padding: 6px 0 0;
}

/* ============================================================
   TWO-COLUMN DIST + STREAKS
============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  margin-top: 0;
}

/* ============================================================
   DISTRIBUTION — HEATMAP
============================================================ */
.heatmap {
  display: grid;
  /* name | 1 2 3 4 5 6 X | total */
  grid-template-columns: minmax(140px, 1.4fr) repeat(7, 1fr) auto;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.heatmap > * {
  padding: 10px 8px;
  border-right: 1px dotted var(--rule-soft);
}
.heatmap > *:nth-child(9n) { border-right: 0; }   /* total col */

.heatmap .hm-head {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
  padding: 8px 4px;
}
.heatmap .hm-head.name { text-align: left; padding-left: 12px; }
.heatmap .hm-head.total-col { text-align: right; padding-right: 12px; }

.heatmap .hm-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600;
  font-size: 16px;
  border-bottom: 1px dotted var(--rule-soft);
}

.heatmap .hm-cell {
  position: relative;
  text-align: center;
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px dotted var(--rule-soft);
  padding: 14px 6px;
  transition: filter 180ms ease;
}
.heatmap .hm-cell.zero { color: var(--ink-faint); font-weight: 400; }
.heatmap .hm-cell.peak::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--ink);
  pointer-events: none;
}
.heatmap .hm-cell .pct {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--ink-fade);
  letter-spacing: 0.06em;
  margin-top: 1px;
}
.heatmap .hm-cell.zero .pct { color: var(--ink-faint); }
.heatmap .hm-cell:hover { filter: contrast(1.05); }

.heatmap .hm-total {
  text-align: right;
  padding: 14px 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px dotted var(--rule-soft);
}
.heatmap .hm-total strong {
  color: var(--ink);
  font-weight: 700;
  font-feature-settings: 'tnum' 1;
}

/* Last row removes its dotted bottom (the section already has a solid one) */
.heatmap .hm-name:last-child,
.heatmap .hm-cell:last-child,
.heatmap .hm-total:last-child {
  border-bottom: 0;
}

/* Tints for buckets — each cell sets a CSS var --t (0..1) for opacity blend */
.heatmap .hm-cell {
  background:
    linear-gradient(0deg, rgba(0,0,0,calc(var(--t, 0) * 0.04)), rgba(0,0,0,calc(var(--t, 0) * 0.04))),
    var(--bg, var(--paper));
}
.heatmap .hm-cell.b-1 { --bg: rgba(90,124,68, calc(0.05 + var(--t, 0) * 0.85)); }
.heatmap .hm-cell.b-2 { --bg: rgba(90,124,68, calc(0.05 + var(--t, 0) * 0.78)); }
.heatmap .hm-cell.b-3 { --bg: rgba(110,138,78, calc(0.05 + var(--t, 0) * 0.78)); }
.heatmap .hm-cell.b-4 { --bg: rgba(26,20,16,  calc(0.05 + var(--t, 0) * 0.78)); }
.heatmap .hm-cell.b-5 { --bg: rgba(196,122,59, calc(0.05 + var(--t, 0) * 0.85)); }
.heatmap .hm-cell.b-6 { --bg: rgba(138,44,29,  calc(0.05 + var(--t, 0) * 0.85)); }
.heatmap .hm-cell.b-X { --bg: rgba(110,36,23,  calc(0.05 + var(--t, 0) * 0.92)); }
.heatmap .hm-cell.hot.b-4,
.heatmap .hm-cell.hot.b-6,
.heatmap .hm-cell.hot.b-X { color: var(--paper); }
.heatmap .hm-cell.hot.b-4 .pct,
.heatmap .hm-cell.hot.b-6 .pct,
.heatmap .hm-cell.hot.b-X .pct { color: rgba(244,236,224,0.7); }

/* ============================================================
   CHRONICLE — SMALL MULTIPLES
============================================================ */
.chronicle-wrap {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.chronicle-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(0, 3fr) 1.2fr;
  align-items: center;
  gap: 24px;
  padding: 14px 4px;
  border-bottom: 1px dotted var(--rule-soft);
}
.chronicle-row:last-child { border-bottom: 0; }
.chronicle-row .cr-name {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600;
  font-size: 17px;
  display: flex; align-items: baseline; gap: 10px;
  color: var(--ink);
}
.chronicle-row .cr-name small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin-top: 2px;
}
.chronicle-row .cr-spark {
  position: relative;
  height: 60px;
  width: 100%;
}
.chronicle-row .cr-spark svg {
  display: block;
  width: 100%; height: 100%;
  overflow: visible;
}

/* Reference gridlines */
.cr-spark .cr-grid {
  stroke: rgba(40,30,20,0.16);
  stroke-width: 0.4;
}
.cr-spark .cr-grid.dashed {
  stroke-dasharray: 1.2 2.4;
  stroke: rgba(40,30,20,0.12);
}
.cr-spark .cr-grid-label {
  fill: var(--ink-faint);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
}

/* Per-player average reference (horizontal dashed in their color) */
.cr-spark .cr-mean {
  fill: none;
  stroke-width: 0.6;
  stroke-dasharray: 2 3;
  opacity: 0.55;
}

/* Connecting line — thin, low opacity */
.cr-spark .cr-line {
  fill: none;
  stroke-width: 0.85;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.42;
}

/* Data points */
.cr-spark .cr-pt {
  /* No stroke, no halo */
}
.cr-spark .cr-pt.fail {
  /* Failed solves rendered slightly larger in oxblood */
}

/* Endpoint label (latest score, sits beside the rightmost dot) */
.cr-spark .cr-end-label {
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1;
  font-size: 9px;
  font-weight: 700;
  fill: var(--ink);
}
.cr-spark .cr-end-label.fail { fill: var(--oxblood-deep); }

.chronicle-row .cr-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  text-align: right;
}
.chronicle-row .cr-stat {
  display: flex; flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.chronicle-row .cr-stat .v {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 0, 'wght' 600;
  font-feature-settings: 'tnum' 1;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}
.chronicle-row .cr-stat .v.muted { color: var(--ink-faint); }
.chronicle-row .cr-stat .l {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-fade);
}

/* ============================================================
   STREAKS
============================================================ */
.streaks { list-style: none; padding: 0; margin: 0; }
.streaks li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dotted var(--rule-soft);
}
.streaks li:first-child { border-top: 1px solid var(--rule); }
.streaks li:last-child  { border-bottom: 1px solid var(--rule); }
.streak-num {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'wght' 700;
  font-feature-settings: 'tnum' 1;
  font-size: 26px;
  color: var(--moss);
  letter-spacing: -0.01em;
}
.streak-num small {
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin: 0 4px;
}
.streak-num.zero { color: var(--ink-faint); }

/* ============================================================
   HEAD TO HEAD
============================================================ */
.h2h {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 36px;
}
.h2h-row { padding: 4px 0 12px; border-bottom: 1px dotted var(--rule-soft); }
.h2h-line {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 6px;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600;
  font-size: 16px;
  color: var(--ink);
}
.h2h-line .vs {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-fade);
  font-weight: 400;
}
.h2h-bar {
  display: flex; height: 4px; overflow: hidden;
  background: var(--paper-deep);
  border-radius: 1px;
}
.h2h-bar .a { background: var(--moss); }
.h2h-bar .b { background: var(--oxblood); }
.h2h-bar .t { background: var(--rule-soft); }
.h2h-counts {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-fade);
  font-feature-settings: 'tnum' 1;
}
.h2h-counts .lhs { color: var(--moss); font-weight: 700; }
.h2h-counts .rhs { color: var(--oxblood); font-weight: 700; }

/* ============================================================
   HARDEST / EASIEST PUZZLES
============================================================ */
.extremes-row { gap: 36px; align-items: stretch; }
.extreme-list {
  list-style: none; padding: 0; margin: 0;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.extreme-list li {
  display: grid;
  grid-template-columns: 28px auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 4px;
  border-bottom: 1px dotted var(--rule-soft);
}
.extreme-list li:last-child { border-bottom: 0; }
.extreme-list li.empty { display: block; text-align: center; }
.extreme-list .ex-rank {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 0, 'wght' 500;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-fade);
  text-align: center;
}
.extreme-list li:first-child .ex-rank { color: var(--ink); }

.tile-row { display: inline-flex; gap: 3px; }
.tile-mini {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-family: 'Helvetica Neue', 'Arial', system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: white;
  letter-spacing: 0.02em;
  position: relative;
  user-select: none;
}
.tile-mini.correct { background: #6aaa64; }
.tile-mini.present { background: #c9b458; }
.tile-mini.absent  { background: #787c7e; }
.tile-mini.unknown { background: var(--paper-warm); color: var(--ink-fade); border: 1px dashed var(--rule-soft); }
.tile-mini::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.32 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay; opacity: 0.55; pointer-events: none;
}

.ex-meta {
  font-family: var(--serif-body);
  font-size: 14px;
  line-height: 1.3;
}
.ex-meta .num {
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.ex-meta .ex-sub {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin-top: 3px;
}

.ex-avg {
  text-align: right;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'wght' 700;
  font-feature-settings: 'tnum' 1;
  font-size: 30px;
  line-height: 1;
}
.hardest-card .ex-avg { color: var(--oxblood); }
.easiest-card .ex-avg { color: var(--moss); }
.ex-avg small {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin-top: 3px;
}

/* ============================================================
   HOUR ACTIVITY STRIP
============================================================ */
.activity-section { padding-bottom: 4px; }
.hour-strip {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
  padding: 6px 0 4px;
  margin-top: 4px;
}
.hour-bar {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--paper-warm);
  border: 1px solid rgba(40,30,20,0.06);
  transition: filter 160ms ease;
}
.hour-bar.has::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--moss);
  opacity: var(--t, 0);
}
.hour-bar:hover { filter: contrast(1.04); }
.hour-bar .hb-tip {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 6px; padding: 4px 8px;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 5;
}
.hour-bar:hover .hb-tip { opacity: 1; }

.hour-axis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  margin-top: 4px;
  padding: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-fade);
}
.hour-axis span { text-align: center; }

.activity-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--serif-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.activity-insights .insight strong {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 700;
  color: var(--ink);
}

/* ============================================================
   SPOTLIGHT (PLAYER PROFILE)
============================================================ */
.spotlight-section { padding-bottom: 8px; }
.spotlight-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}
.player-pick {
  display: flex; gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pp-chip {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: currentColor;
  border: 0;
  cursor: pointer;
  position: relative;
  transition: transform 160ms ease;
  padding: 0;
}
.pp-chip span {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 30, 'wght' 700;
  font-size: 14px;
  color: white;
  text-transform: uppercase;
}
.pp-chip:hover { transform: translateY(-1px); }
.pp-chip.active::after {
  content: '';
  position: absolute; inset: -3px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.spotlight {
  border-top: 2px solid var(--ink);
  padding-top: 22px;
}
.spotlight .empty { padding: 36px 12px; }

.sp-hero {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 24px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.sp-avatar {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
  display: grid; place-items: center;
  box-shadow: 0 6px 24px -8px rgba(40,30,20,0.4);
}
.sp-avatar::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 50%);
}
.sp-avatar::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.28 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay; opacity: 0.6; pointer-events: none;
}
.sp-avatar span {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'wght' 700;
  font-size: 56px;
  color: white;
  letter-spacing: -0.01em;
  position: relative; z-index: 1;
}

.sp-meta h3 {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 96, 'SOFT' 30, 'wght' 600;
  font-size: clamp(28px, 4vw, 42px);
  margin: 0;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.sp-meta .sp-line {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 6px;
}
.sp-meta .sp-line strong {
  font-style: normal;
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 700;
  color: var(--ink);
}

.sp-headstats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 22px;
  text-align: right;
}
.sp-headstat .v {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'wght' 700;
  font-feature-settings: 'tnum' 1;
  font-size: 32px;
  color: var(--ink);
}
.sp-headstat .v sup {
  font-size: 16px; color: var(--ink-fade); font-weight: 500;
}
.sp-headstat .l {
  font-family: var(--mono);
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-fade); margin-top: 2px;
}

.sp-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1.1fr;
  gap: 28px;
  padding-top: 18px;
}
.sp-block .sp-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--oxblood); margin-bottom: 10px;
  border-bottom: 1px solid var(--oxblood);
  padding-bottom: 4px;
}

/* Distribution bars (horizontal) */
.sp-dist { display: flex; flex-direction: column; gap: 6px; }
.sp-dist-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
}
.sp-dist-row .lbl { text-align: right; font-weight: 700; color: var(--ink); }
.sp-dist-bar {
  position: relative;
  height: 18px;
  background: var(--paper-warm);
  border: 1px solid rgba(40,30,20,0.05);
}
.sp-dist-bar .fill {
  position: absolute; inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: currentColor;
  transition: width 360ms cubic-bezier(.2,.7,.2,1);
}
.sp-dist-bar .fill.fail { background: var(--oxblood); }
.sp-dist-bar .ct {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--ink); mix-blend-mode: difference; color: white;
}

/* Radar */
.sp-radar { position: relative; }
.sp-radar svg { width: 100%; height: auto; display: block; }
.sp-radar .axis-label {
  font-family: var(--mono);
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  fill: var(--ink-fade);
}
.sp-radar .grid { fill: none; stroke: rgba(40,30,20,0.18); stroke-width: 0.6; }
.sp-radar .axis { stroke: rgba(40,30,20,0.16); stroke-width: 0.4; }
.sp-radar .area { fill: currentColor; fill-opacity: 0.18; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.sp-radar .pt { fill: currentColor; }

/* Player hour strip (smaller variant) */
.sp-hours .hour-strip {
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
}
.sp-hours .hour-bar { aspect-ratio: 1 / 1.1; }
.sp-foot {
  margin-top: 10px;
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Last 30 days mini sparkline at bottom of spotlight */
.sp-trend {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dotted var(--rule-soft);
}
.sp-trend svg { display: block; width: 100%; height: 60px; }
.sp-trend-svg { display: block; width: 100%; height: 60px; }
.sp-trend .cr-line { fill: none; stroke: currentColor; stroke-width: 1.1; opacity: 0.55; }
.sp-trend .cr-pt   { fill: currentColor; }
.sp-trend .cr-pt.fail { fill: var(--oxblood-deep); }
.sp-trend .cr-grid { stroke: rgba(40,30,20,0.10); stroke-width: 0.4; stroke-dasharray: 1.2 2.4; }

/* ============================================================
   TOOLTIPS
============================================================ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms;
  z-index: 50;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 1px;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(40,30,20,0.32);
}
[data-tooltip]::before {
  content: '';
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::after,
[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip]:hover::before { transform: translateX(-50%) translateY(0); }

/* Suppress on touch devices to avoid sticky tooltips */
@media (hover: none) {
  [data-tooltip]::before, [data-tooltip]::after { display: none; }
}

/* ============================================================
   COLOPHON
============================================================ */
.colophon {
  margin-top: 48px;
  text-align: center;
  font-family: var(--serif-body);
  font-style: italic;
  color: var(--ink-soft);
}
.colophon-text {
  padding: 16px 0;
  font-size: 14px;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn-link {
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--oxblood);
  cursor: pointer;
  padding: 0;
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease;
}
.btn-link:hover { border-color: var(--oxblood); }

.btn.solid {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 1px;
  cursor: pointer;
  transition: background 180ms ease;
}
.btn.solid:hover { background: var(--oxblood); }
.btn.solid:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   MODAL
============================================================ */
.modal {
  border: 0;
  background: transparent;
  padding: 0;
  width: min(580px, calc(100vw - 24px));
}
.modal::backdrop {
  background: rgba(28,18,8,0.55);
  backdrop-filter: blur(2px) sepia(0.15);
}
.modal-paper {
  background: var(--paper);
  border: 1px solid rgba(40,30,20,0.18);
  box-shadow:
    0 30px 80px -20px rgba(28,18,8,0.45),
    0 0 0 8px var(--paper-warm),
    0 0 0 9px rgba(40,30,20,0.18);
  position: relative;
  overflow: hidden;
}
.modal-grain {
  position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: multiply;
}
.modal-paper > * { position: relative; z-index: 1; }
.modal-head {
  padding: 28px 32px 18px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.modal-head .close { position: absolute; top: 28px; right: 32px; }
.modal-head h2 {
  font-family: var(--serif-display);
  font-variation-settings: 'opsz' 96, 'SOFT' 30, 'wght' 600;
  font-size: 32px;
  letter-spacing: -0.015em;
  margin: 6px 0 0;
}
.modal-section {
  padding: 22px 32px;
  border-bottom: 1px dotted var(--rule-soft);
}
.modal-section:last-child { border-bottom: 0; }
.modal-state, .modal-note {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 8px 0 0;
}
.modal-note.status { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-fade); }
.muted { color: var(--ink-fade); font-size: 13px; font-style: italic; }
.lbl {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lbl.tiny { font-size: 9px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row-group { display: flex; flex-direction: column; gap: 6px; }
input[type="number"], input[type="text"], select {
  background: var(--paper-warm);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 13px;
  border-radius: 1px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input:focus, select:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
select { font-family: var(--serif-body); font-size: 14px; min-width: 200px; }

.qr-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 18px; background: var(--paper-warm); border: 1px solid var(--rule-soft); margin-top: 12px; }
.qr-wrap p { margin: 0; font-family: var(--serif-body); font-style: italic; font-size: 14px; color: var(--ink-soft); text-align: center; }
.qr-wrap img {
  width: 240px; height: 240px;
  background: white;
  padding: 12px;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

#playersBody { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.player-edit-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--paper-warm);
  border: 1px solid var(--rule-soft);
}
.player-edit-row input[type="color"] {
  width: 28px; height: 28px;
  padding: 0;
  border: 1px solid var(--rule-soft);
  background: transparent;
  cursor: pointer;
}
.player-edit-row input[type="text"] { font-family: var(--serif-display); font-variation-settings: 'opsz' 24, 'SOFT' 30, 'wght' 600; font-size: 14px; }
.player-edit-row .muted { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }
.save-player {
  background: transparent; color: var(--ink); border: 1px solid var(--ink);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer; border-radius: 0;
  transition: background 160ms ease, color 160ms ease;
}
.save-player:hover { background: var(--ink); color: var(--paper); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 980px) {
  .paper { padding: 28px 22px 36px; margin: 12px; }
  .lead { grid-template-columns: 1fr; gap: 18px; }
  .two-col { grid-template-columns: 1fr; gap: 12px; }
  .h2h { grid-template-columns: 1fr; gap: 12px; max-height: none; }
  .masthead-row.eyebrow,
  .masthead-row.tagline,
  .masthead-row.dateline { grid-template-columns: 1fr; gap: 4px; text-align: center !important; }
  .masthead-row .eb-left, .masthead-row .eb-right,
  .masthead-row .tag-left, .masthead-row .tag-right,
  .masthead-row .dl-section, .masthead-row .dl-stats { text-align: center !important; }
  .nameplate .np-name { font-size: clamp(40px, 13vw, 64px); }
  .nameplate .np-name.lower { font-size: clamp(48px, 16vw, 80px); }
}

/* ==== Phone (≤720px) ==== */
@media (max-width: 720px) {
  body { font-size: 15.5px; line-height: 1.5; }
  .paper { padding: 22px 14px 26px; margin: 6px; }

  /* Masthead */
  .nameplate { margin: 8px 0 6px; }
  .nameplate .np-the { font-size: 15px; }
  .nameplate .np-name { font-size: clamp(28px, 7.5vw, 44px); letter-spacing: 0; }
  .nameplate .np-tiles { gap: 4px; margin-top: 8px; }
  .big-tile { width: clamp(38px, 12vw, 60px); font-size: clamp(20px, 7vw, 34px); }

  /* Headlines */
  .headline { font-size: clamp(26px, 7vw, 34px); margin: 6px 0 10px; }
  .headline-small { font-size: clamp(20px, 5.6vw, 26px); }
  .deck { font-size: 15px; }
  .lead-text .deck::first-letter { float: none; font-size: 1em; padding: 0; color: inherit; }

  /* Period selector */
  .period-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
    padding-top: 12px;
  }
  .period-label, .period-applies { display: none; }
  .period-seg {
    width: 100%;
    justify-self: stretch;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }
  .period-btn {
    padding: 9px 6px;
    font-size: 10px;
    letter-spacing: 0.08em;
    border-right: 1px dotted var(--rule-soft);
  }

  /* Today's results — wrap time onto a second line */
  .lead-results li {
    grid-template-columns: 38px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 3px;
    padding: 12px 0;
  }
  .lead-results .rank {
    grid-row: 1 / 3;
    align-self: center;
    font-size: 22px;
    padding-right: 4px;
  }
  .lead-results .player-cell { grid-column: 2; grid-row: 1; align-items: center; }
  .lead-results .score-pill {
    grid-column: 3; grid-row: 1; align-self: center;
    font-size: 16px; min-width: 42px; height: 28px;
  }
  .lead-results .posted-at {
    grid-column: 2 / 4; grid-row: 2;
    text-align: left;
    font-size: 10px;
  }
  .player-name { font-size: 15px; }

  /* Chronicle — name + stats above sparkline */
  .chronicle-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name  stats"
      "spark spark";
    column-gap: 12px;
    row-gap: 6px;
    padding: 14px 0;
    align-items: center;
  }
  .chronicle-row .cr-name { grid-area: name; font-size: 15px; }
  .chronicle-row .cr-name small { display: none; }
  .chronicle-row .cr-spark { grid-area: spark; height: 46px; }
  .chronicle-row .cr-stats {
    grid-area: stats;
    grid-template-columns: repeat(3, auto);
    gap: 14px;
    text-align: right;
  }
  .chronicle-row .cr-stat .v { font-size: 16px; }
  .chronicle-row .cr-stat .l { font-size: 8px; letter-spacing: 0.14em; }

  /* Streaks — keep compact, ensure no wrapping */
  .streaks li { padding: 11px 0; gap: 8px; }
  .streak-num { font-size: 22px; }
  .streak-num small { font-size: 9px; margin: 0 3px; letter-spacing: 0.14em; }
  .player-cell { gap: 8px; }

  /* Heatmap — tighter columns, hide secondary text */
  .heatmap {
    grid-template-columns: 96px repeat(7, minmax(0, 1fr)) 44px;
  }
  .heatmap .hm-head {
    font-size: 9px;
    padding: 6px 2px;
    letter-spacing: 0.08em;
  }
  .heatmap .hm-head.name { padding-left: 8px; }
  .heatmap .hm-head.total-col { padding-right: 6px; font-size: 8px; }
  .heatmap .hm-name {
    padding: 8px 8px;
    font-size: 13px;
    gap: 6px;
  }
  .heatmap .hm-cell {
    padding: 10px 2px;
    font-size: 12px;
  }
  .heatmap .hm-cell .pct { font-size: 7px; letter-spacing: 0; }
  .heatmap .hm-total { padding: 8px 6px; font-size: 10px; letter-spacing: 0.06em; }

  /* Standings table */
  .lb-table thead th { font-size: 9px; padding: 8px 6px; letter-spacing: 0.1em; }
  .lb-table tbody td { font-size: 14px; padding: 10px 6px; }
  .lb-table tbody td.contestant { font-size: 15px; gap: 8px; }
  .lb-table tbody td.num { font-size: 12px; }
  .lb-table tbody td.rank-col { font-size: 15px; }

  /* Section spacing */
  .rule { margin: 28px 0 10px; }

  /* Extremes */
  .extreme-list li {
    grid-template-columns: 18px auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 2px;
  }
  .extreme-list .ex-rank { grid-row: 1 / 3; }
  .extreme-list .tile-row { grid-column: 2; grid-row: 1; }
  .extreme-list .ex-meta { grid-column: 3; grid-row: 1; align-self: center; }
  .extreme-list .ex-avg  { grid-column: 2 / 4; grid-row: 2; text-align: left; padding-top: 2px; }
  .ex-avg { font-size: 22px; }
  .tile-mini { width: 22px; height: 22px; font-size: 11px; }

  /* Activity */
  .hour-strip { gap: 2px; }
  .hour-axis { font-size: 8px; }
  .activity-insights { grid-template-columns: 1fr; gap: 10px; font-size: 13px; }

  /* Spotlight */
  .spotlight-head { grid-template-columns: 1fr; gap: 10px; }
  .player-pick { justify-content: flex-start; }
  .pp-chip { width: 28px; height: 28px; }
  .pp-chip span { font-size: 12px; }

  .sp-hero {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
  }
  .sp-avatar { width: 80px; height: 80px; }
  .sp-avatar span { font-size: 38px; }
  .sp-meta { grid-column: 2; grid-row: 1; }
  .sp-headstats {
    grid-column: 1 / 3; grid-row: 2;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
  }
  .sp-headstat .v { font-size: 22px; }
  .sp-headstat .l { font-size: 8px; letter-spacing: 0.14em; }
  .sp-meta h3 { font-size: 24px; }
  .sp-meta .sp-line { font-size: 13px; }

  .sp-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  /* Modal */
  .modal-section { padding: 16px 18px; }
  .modal-head { padding: 22px 18px 14px; }
  .modal-head h2 { font-size: 24px; }
  .modal-head .close { top: 22px; right: 18px; }
  .qr-wrap img { width: 200px; height: 200px; }
  .player-edit-row {
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 8px;
  }
  .player-edit-row input[type="color"] { grid-column: 1; grid-row: 1 / 3; }
  .player-edit-row input[type="text"] { grid-column: 2 / 4; grid-row: 1; }
  .player-edit-row .muted { grid-column: 2; grid-row: 2; }
  .player-edit-row .save-player { grid-column: 3; grid-row: 2; }
}


/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-warm); }
::-webkit-scrollbar-thumb { background: var(--rule-soft); border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-fade); }
