/* boggledygook visualization — palette per dataviz reference instance.
   Variant identity colors (categorical slots 4/5/7, validated as a trio in
   both modes): classic = yellow, big = aqua, super = violet. Dictionary
   series keep slots 1–3 (blue/green/magenta). Variant color is always
   paired with a visible text label (two slots are sub-3:1 on light). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-1: #2a78d6; /* TWL06 */
  --series-2: #008300; /* SOWPODS */
  --series-3: #e87ba4; /* ENABLE1 */
  --seq: #256abf;      /* sequential blue 500 */
  --seq-track: #cde2fb;
  --accent-wash: rgba(42, 120, 214, 0.12);
  --v-classic: #eda100;
  --v-big: #1baf7a;
  --v-super: #4a3aa7;
  /* diverging pair (blue <-> red, neutral gray midpoint) — encodes SIGN only,
     never series identity, so it never collides with the reserved variant or
     dictionary categorical palettes. Validated all-pairs in both modes. */
  --div-over: #e34948;
  --div-under: #2a78d6;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-1: #3987e5;
    --series-2: #008300;
    --series-3: #d55181;
    --seq: #3987e5;
    --seq-track: #184f95;
    --accent-wash: rgba(57, 135, 229, 0.18);
    --v-classic: #c98500;
    --v-big: #199e70;
    --v-super: #9085e9;
    --div-over: #e66767;
    --div-under: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-1: #3987e5;
  --series-2: #008300;
  --series-3: #d55181;
  --seq: #3987e5;
  --seq-track: #184f95;
  --accent-wash: rgba(57, 135, 229, 0.18);
  --v-classic: #c98500;
  --v-big: #199e70;
  --v-super: #9085e9;
  --div-over: #e66767;
  --div-under: #3987e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* faint drifting letter cubes behind everything */
#backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; width: 100%; height: 100%; }

/* --- hero --- */
header.hero { text-align: center; padding: 28px 0 4px; position: relative; }
header.hero h1 { font-size: 46px; margin: 0; letter-spacing: -0.02em; }
header.hero .tagline {
  color: var(--text-secondary); font-size: 15.5px; max-width: 620px; margin: 10px auto 0;
}
header.hero .byline { font-size: 13.5px; color: var(--text-muted); margin: 10px 0 0; }
header.hero .byline a { color: var(--text-secondary); text-decoration-color: var(--baseline); }
header.hero .byline a:hover { color: var(--text-primary); }
header.hero .dot { margin: 0 8px; }
#themeToggle {
  position: absolute; top: 0; right: 0;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
}

/* --- hero boards --- */
.hero-boards { margin-top: 28px; }
.hero-board-row {
  display: flex; gap: 16px; justify-content: center; align-items: stretch; flex-wrap: wrap;
}
.hero-board {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  border-top: 3px solid var(--vc, var(--border));
  padding: 12px 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.hero-board .vtag { align-self: flex-start; }
.hero-board .word-now {
  min-height: 24px; font-size: 15px; font-weight: 600; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 8px;
}
.hero-board .board-stats { font-size: 12px; color: var(--text-muted); }
p.note.center { text-align: center; margin: 14px auto 0; }

/* variant tag chip — text stays in ink tokens, color carries via the swatch bar */
.vtag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
}
.vtag::before {
  content: ""; width: 14px; height: 5px; border-radius: 2.5px; background: var(--vc, var(--baseline));
}

/* points pill */
.pts {
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary);
  background: color-mix(in srgb, var(--vc, var(--seq)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc, var(--seq)) 35%, transparent);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --- reusable board component --- */
.bboard { position: relative; width: max-content; }
.bboard .bgrid { display: grid; gap: 4px; }
.bboard .cell {
  width: var(--cell, 52px); height: var(--cell, 52px); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--page); border: 1px solid var(--border);
  font-weight: 600; font-size: calc(var(--cell, 52px) * 0.38); position: relative;
}
.bboard .cell.blankface { background: var(--baseline); }
.bboard .cell.lit {
  border-color: color-mix(in srgb, var(--vc, var(--seq)) 65%, transparent);
  background: color-mix(in srgb, var(--vc, var(--seq)) 12%, var(--page));
}
.bboard .cell .step {
  position: absolute; top: 1px; right: 4px; font-size: 9px; font-weight: 500;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.bboard svg.trace {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}
.bboard .pencil {
  fill: none; stroke: var(--vc, var(--seq)); stroke-width: 3.2;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.82;
}

/* --- algorithm blurb --- */
section.algo { margin-top: 34px; }
section.algo h2 { font-size: 18px; margin: 0 0 8px; }
section.algo p { font-size: 14px; color: var(--text-secondary); margin: 0 0 8px; max-width: 820px; }
section.algo ul { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-secondary); }
section.algo li { margin: 5px 0; max-width: 800px; }
section.algo strong { color: var(--text-primary); }

/* --- how Boggle works / scoring --- */
section.rules { margin-top: 34px; }
section.rules h2 { font-size: 18px; margin: 0 0 8px; }
section.rules > p { font-size: 14px; color: var(--text-secondary); margin: 0 0 14px; max-width: 820px; }
section.rules strong { color: var(--text-primary); }
.rules-grid { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 780px) { .rules-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.score-scroll { min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.score-table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.score-table caption {
  caption-side: top; text-align: left; font-size: 12px; color: var(--text-muted); padding-bottom: 6px;
}
.score-table th, .score-table td { padding: 5px 9px; border-bottom: 1px solid var(--grid); text-align: center; }
.score-table thead th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; }
.score-table tbody th {
  text-align: left; font-weight: 600; color: var(--text-primary); white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.score-table tbody tr:last-child th, .score-table tbody tr:last-child td { border-bottom: 0; }
.score-table td { color: var(--text-secondary); }
.score-table td.none { color: var(--text-muted); }
.score-table td.hi { color: var(--text-primary); font-weight: 600; white-space: nowrap; }
.vdot { width: 9px; height: 9px; border-radius: 3px; background: var(--vc); flex: none; }
.score-table tr[data-v="classic"] { --vc: var(--v-classic); }
.score-table tr[data-v="big"] { --vc: var(--v-big); }
.score-table tr[data-v="super"] { --vc: var(--v-super); }
.rules-notes { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--text-secondary); }
.rules-notes li { margin: 0 0 8px; }
.rules-notes li:last-child { margin-bottom: 0; }
section.rules .note { margin-top: 14px; }

section { margin-top: 36px; }
section > h2 { font-size: 18px; margin: 0 0 4px; }
section > p.note { color: var(--text-secondary); font-size: 13.5px; margin: 2px 0 14px; max-width: 760px; }
p.note.trivia { margin-top: 12px; }

/* section/card headers with a "show N" control */
.sect-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sect-head h2 { font-size: 18px; margin: 0 0 4px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.showsel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.showsel .sel-label { font-size: 12px; color: var(--text-muted); }
.showsel select {
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
  border-radius: 7px; padding: 3px 6px; font: inherit; font-size: 12.5px; cursor: pointer;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

/* --- board-count cards --- */
.count-cards { display: grid; gap: 12px; }
.count-card { border-left: 4px solid var(--vc, var(--border)); min-width: 0; }
.count-card .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.count-card .head .grid-size { font-size: 12.5px; color: var(--text-muted); }
.count-card .bignum {
  overflow-x: auto; white-space: nowrap; margin: 8px 0 2px;
  font-size: clamp(18px, 3.2vw, 30px); font-weight: 600; letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums; scrollbar-width: thin; padding-bottom: 4px;
}
.count-card .sci { font-size: 13px; color: var(--text-secondary); }
.count-card .eternity { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.count-card .eternity strong { color: var(--text-primary); }

/* --- stat tiles --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tile .label { font-size: 13px; color: var(--text-secondary); }
.tile .value { font-size: 30px; font-weight: 600; margin-top: 2px; }
.tile .value small { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.tile .detail { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.tile.v-accent { border-top: 3px solid var(--vc, var(--border)); }

/* --- filter row --- */
.filters { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 18px 0 6px; position: sticky; top: 0; z-index: 5; background: var(--page); padding: 10px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-1); }
.seg button {
  border: 0; background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 13.5px; padding: 7px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.seg button .swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--vc, var(--baseline)); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: color-mix(in srgb, var(--vc, var(--seq)) 13%, transparent); color: var(--text-primary); font-weight: 600; }
.filters .flabel { font-size: 12.5px; color: var(--text-muted); margin-right: -8px; }

/* --- extreme boards --- */
.champ-note { font-size: 15px; color: var(--text-secondary); margin: 4px 0 14px; max-width: 760px; }
.champ-note strong { color: var(--text-primary); }
/* Every variant card is styled identically — only the accent color varies, so
   no single variant reads as "featured". Equal-height columns via stretch. */
.xtreme-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: stretch; }
.xcard { border-top: 3px solid var(--vc); display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.xhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }
.xstats { font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.xstats strong { color: var(--text-primary); font-size: 17px; }
/* full word list for an extreme board — fixed height keeps all cards equal */
.xwords-head { font-size: 12px; color: var(--text-muted); width: 100%; text-align: center; }
.xwords {
  /* Definite height, not flex:1 — the card has no definite height of its own,
     so a flexible basis makes the list grow to its full scroll height. */
  width: 100%; height: 208px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, transparent);
  display: flex; flex-direction: column;
  /* No smooth scrolling: jumping to row ~900 of a 3,393-row list would animate
     across tens of thousands of pixels. Positioned so .xword offsetTop is
     relative to this list, which the centering math in renderExtremes assumes. */
  position: relative;
}
.xwords:focus-visible { outline: 2px solid var(--vc); outline-offset: 2px; }
.xword {
  border: 0; border-bottom: 1px solid var(--grid); background: transparent; color: var(--text-primary);
  font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 10px;
}
.xword:last-child { border-bottom: 0; }
.xword:hover { background: var(--accent-wash); }
.xword.on {
  background: color-mix(in srgb, var(--vc) 15%, transparent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--vc);
}
.xword .xw { overflow: hidden; text-overflow: ellipsis; }
.xword .cpts { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--text-primary);
  border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: baseline;
}
.chip:hover { background: var(--accent-wash); }
.chip.on {
  background: color-mix(in srgb, var(--vc) 14%, transparent);
  border-color: color-mix(in srgb, var(--vc) 45%, transparent);
  font-weight: 600;
}
.chip .cpts { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dud {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  border-top: 1px dashed var(--grid); padding-top: 10px; width: 100%;
  margin-top: auto; /* pin to card bottom so all three cards align */
}
.dud .board-caption { text-align: left; max-width: 180px; margin: 0; }

/* --- words-per-board frequency --- */
.scale-seg button { padding: 4px 10px; font-size: 12px; }
.anno-title { font-size: 11.5px; font-weight: 600; fill: var(--text-primary); }
.anno { font-size: 11.5px; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tiles.rarity { margin-top: 12px; }
.wpb-table-wrap { max-height: 300px; overflow: auto; margin-top: 6px; }
.wpb-table-wrap thead th { position: sticky; top: 0; background: var(--surface-1); }

/* --- charts --- */
.chart-card h3 { font-size: 15px; margin: 0 0 2px; }
.chart-card .sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 10px; }
/* fixed-height scroll window so "show 100" doesn't blow up the card */
#topWords { max-height: 264px; overflow-y: auto; }
#topWords svg { display: block; }
svg text { font-family: inherit; }
.axis-label { font-size: 11px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar-name { font-size: 12.5px; fill: var(--text-primary); }
.bar-value { font-size: 11.5px; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bar-pts { font-size: 10.5px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.direct-label { font-size: 12px; font-weight: 600; fill: var(--text-primary); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin: 8px 2px 0; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* --- tooltip --- */
#tooltip {
  position: fixed; pointer-events: none; z-index: 50; display: none;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  max-width: 260px;
}
#tooltip .tt-title { font-weight: 600; margin-bottom: 3px; }
#tooltip .tt-row > span:first-child { white-space: nowrap; }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* --- longest words / witness board --- */
.longest-layout { display: grid; grid-template-columns: minmax(300px, 1fr) auto; gap: 18px; align-items: start; }
@media (max-width: 860px) { .longest-layout { grid-template-columns: 1fr; } }
.word-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.word-list .list-note { font-size: 11.5px; color: var(--text-muted); padding: 2px 10px 4px; }
.word-list button {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  border: 1px solid transparent; background: transparent; color: var(--text-primary);
  font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: left;
}
.word-list button:hover { background: var(--accent-wash); }
.word-list button.on { background: var(--accent-wash); border-color: var(--border); font-weight: 600; }
.word-list .meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.witness-host { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.board-caption { font-size: 12.5px; color: var(--text-secondary); text-align: center; max-width: 380px; margin: 0 auto; }

/* --- tables --- */
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; }
table.data th:first-child, table.data td:first-child { text-align: left; font-variant-numeric: normal; }
table.data thead th { color: var(--text-muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--baseline); }
table.data tbody tr { border-bottom: 1px solid var(--grid); }
table.data tbody tr:last-child { border-bottom: 0; }

details.tableview { margin-top: 10px; overflow-x: auto; }
details.tableview summary { cursor: pointer; font-size: 12.5px; color: var(--text-secondary); }
/* fixed-height scroll window so "show 100" doesn't blow up the card */
#expectedTable { max-height: 340px; overflow-y: auto; overflow-x: auto; }
#expectedTable thead th { position: sticky; top: 0; background: var(--surface-1); }

/* --- dictionary findability --- */
.find-top { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 14px; align-items: stretch; }
@media (max-width: 860px) { .find-top { grid-template-columns: 1fr; } }
.find-hero { border-top: 3px solid var(--vc, var(--border)); display: flex; flex-direction: column; justify-content: center; }
.find-hero .find-num {
  font-size: clamp(44px, 7vw, 60px); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em;
}
.find-hero .find-lead { font-size: 14px; color: var(--text-secondary); margin: 6px 0 12px; }
.find-hero .find-lead strong { color: var(--text-primary); }
.find-hero .find-foot { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }
.find-hero .find-foot strong { color: var(--text-secondary); }
.meter { height: 10px; border-radius: 999px; background: var(--seq-track); overflow: hidden; }
.meter-fill { height: 100%; background: var(--seq); border-radius: 999px; }
.find-break #findBreak svg { display: block; margin-top: 4px; }

.find-reasons {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 12px;
}
.reason { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reason.muted { opacity: 0.72; }
.reason-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reason-title { font-size: 14.5px; font-weight: 600; }
.reason-count { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reason-blurb { font-size: 13px; color: var(--text-secondary); margin: 0; }
.reason-blurb strong { color: var(--text-primary); }
.reason-exlabel { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.chips.left { justify-content: flex-start; }
.chip.static { cursor: default; }
.chip.static:hover { background: color-mix(in srgb, var(--vc, var(--seq)) 12%, transparent); }

/* --- every unplayable word (lazy-loaded per combo, windowed list) --- */
.unplay-card { margin-top: 12px; border-top: 3px solid var(--vc, var(--border)); }
.unplay-card h3 { font-size: 15px; margin: 0 0 2px; }
.unplay-card .sub {
  font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 10px; max-width: 820px;
}
.unplay-card .sub strong { color: var(--text-primary); }
.unplay-controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.unplay-list {
  position: relative; height: 300px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 8px;
}
.unplay-list.is-idle { height: auto; }
.unplay-list:focus-visible { outline: 2px solid var(--vc, var(--seq)); outline-offset: 2px; }
.unplay-spacer { position: relative; }
.unplay-row {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px; padding: 0 10px;
  border-bottom: 1px solid var(--grid); font-size: 12.5px;
}
.unplay-row:hover { background: var(--accent-wash); }
.unplay-w {
  font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.unplay-tag {
  flex: none; font-size: 10.5px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.unplay-meta {
  flex: none; margin-left: auto; padding-left: 10px; text-align: right;
  font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.unplay-empty { padding: 14px; font-size: 12.5px; color: var(--text-muted); }
.unplay-empty.is-error { color: var(--text-secondary); }
.unplay-foot {
  font-size: 12px; color: var(--text-muted); margin-top: 8px; font-variant-numeric: tabular-nums;
}

.cursed { margin-top: 12px; border-left: 4px solid var(--vc, var(--border)); }
.cursed h3 { font-size: 15px; margin: 0 0 10px; }
.cursed-body { font-size: 13.5px; color: var(--text-secondary); margin: 10px 0 0; max-width: 820px; }
.cursed-body strong { color: var(--text-primary); }
.diefaces { display: flex; flex-wrap: wrap; gap: 22px; }
.die-unit { display: flex; flex-direction: column; gap: 5px; }
.die-cap { font-size: 11.5px; color: var(--text-muted); }
.die { display: flex; gap: 4px; }
.die .face {
  width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--page); border: 1px solid var(--border); font-weight: 600; font-size: 13px;
}

/* --- letter frequency --- */
/* the stat-tile row and the chart card below it are separate blocks; without
   this they butt straight up against each other (every other section pairs
   them with the same 12px). */
#letterTiles { margin-bottom: 12px; }
.letter-tile .value { font-size: 34px; letter-spacing: 0.02em; }
.facet-title { font-size: 11.5px; font-weight: 600; fill: var(--text-primary); }
.letter-axis { font-size: 13px; fill: var(--text-secondary); font-weight: 600; }
/* per-strip headline: mean absolute gap from the dice, plus its neutral bar */
.gap-read { font-size: 10.5px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.gap-read .gap-val { font-weight: 700; fill: var(--text-primary); }
.gap-badge { font-size: 10px; fill: var(--text-secondary); font-weight: 600; }
/* the one direct label per strip sits in a tight gutter, so it carries a
   surface-coloured halo and can never be lost against a gridline or a bar */
.dev-label {
  font-size: 12px; font-weight: 600; fill: var(--text-primary);
  paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; stroke-linejoin: round;
}
.scale-note { font-size: 11.5px; color: var(--text-muted); margin: 8px 2px 0; line-height: 1.45; }
.fold-prose { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; max-width: 640px; }
.fold-prose p { margin: 8px 0 0; }
.fold-prose strong { color: var(--text-primary); }
#tooltip .tt-dev { color: var(--text-muted); }
.letter-table-wrap { max-height: 320px; overflow: auto; margin-top: 6px; }
.letter-table-wrap thead th { position: sticky; top: 0; background: var(--surface-1); }
#letterChart svg { display: block; }
#letterModeSeg button { padding: 5px 11px; font-size: 12.5px; }

footer { margin-top: 48px; color: var(--text-muted); font-size: 12.5px; border-top: 1px solid var(--grid); padding-top: 16px; }
footer code { font-size: 11.5px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

@media (prefers-reduced-motion: reduce) {
  .bboard .pencil { transition: none !important; animation: none !important; }
}

/* --- small screens --- */
@media (max-width: 640px) {
  .wrap { padding: 16px 14px 60px; }
  header.hero { padding-top: 46px; }
  header.hero h1 { font-size: 34px; }
  header.hero .tagline { font-size: 14px; }
  .hero-board { width: 100%; align-items: center; }
  .hero-board .vtag { align-self: center; }
  .filters { gap: 10px; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { padding: 7px 10px; white-space: nowrap; }
  .score-table { font-size: 12px; width: 100%; }
  .score-table th, .score-table td { padding: 5px 4px; }
  .score-table tbody th { padding-right: 6px; }
  .score-table td.hi { font-size: 11px; }
  .count-card .bignum { font-size: 17px; }
  .tile .value { font-size: 24px; }
  section { margin-top: 28px; }
  .sect-head { flex-wrap: wrap; }
  /* two-line unplayable rows: the word gets a line of its own rather than
     being ellipsized by its own tag and metadata. Pitch mirrors unplayRowH(). */
  .unplay-row { flex-wrap: wrap; align-content: center; padding: 4px 10px; gap: 6px 10px; }
  .unplay-w { flex: 1 0 100%; font-size: 13.5px; }
  .unplay-meta { padding-left: 0; }
  .unplay-controls { gap: 10px; }
  .unplay-controls .showsel { flex: 1 1 auto; }
  .unplay-controls select { max-width: 100%; }
}
