/* All-22 Builder — "Broadcast" UI (the builder page only; style.css stays with /draft, /about and /privacy).
   The look comes from the field's own name tags: dark panels, Roboto Condensed caps, gold for offense, blue for
   defense. Phones: the field near the top, settings in a "team sheet", pop-ups as bottom sheets. Wide screens
   (1000px+ and 560px+ tall): a header bar, a 340px control column that never scrolls, and the field. */

:root {
  --bg: #080b0f;
  --panel: #0e1319;
  --tag: #090d11;
  --sheet: #0b1016;
  --hover: #141a22;
  --line: rgba(255, 255, 255, 0.09);
  --tag-border: rgba(255, 255, 255, 0.22);
  --ghost-border: rgba(255, 255, 255, 0.12);
  --hover-border: rgba(255, 255, 255, 0.3);
  --text: #f3f5f8;
  --muted: #9aa3af;
  --subtle: #7d8794;
  --nav: #d5dae1;
  --gold: #f2c230;
  --gold-hover: #f7d35c;
  --on-gold: #1c1303;
  --on-gold-2: #5c4500;
  --off: #f2c230;
  --def: #5bc0f8;
  --st: #c4b5fd;
  --teal: #2dd4bf; /* Franchise's accent (franchise.css) */
  --on-teal: #042f2e;
  --red: #f87171;
  --red-fill: #dc2626;
  --red-hover: #ef4444;
  --red-light: #fca5a5;
  --red-small: #fecaca;
  --win: #4ade80;
  --hi-stat: #86efac;
  --white-hover: #dfe3e8;
  --open: #4ade80; /* open spots on the field while placing a pick */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rc: "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-field: "Roboto Condensed", "Arial Narrow", sans-serif;
  --gutter: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html, body { margin: 0; }
/* Phones: things scrolled into view (the field, when a pick is chosen) clear the sticky mode menu */
html { scroll-padding-top: 72px; }
body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
svg { flex: none; }

/* Builder vs. a challenge, and which challenge: 17–0 (region and type rolls) or 151 (one Pokémon a round) */
body.mode-draft .builder-only,
body:not(.mode-draft) .draft-only,
body.game-151 .only-170,
body:not(.game-151) .only-151 { display: none !important; }
/* "Tap" on touch screens, "Click" with a mouse */
.on-mouse { display: none; }
@media (pointer: fine) {
  .on-mouse { display: inline; }
  .on-touch { display: none; }
}

/* ======================================================================================== header + mode menu */
.app { display: flex; flex-direction: column; }
.wordmark {
  font-family: var(--rc);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
.wordmark span { color: var(--gold); }
.play-team {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 11px 0 9px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--rc);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.play-team:hover { background: var(--white-hover); }
.play-team svg { width: 14px; height: 14px; fill: currentColor; }
/* The account button beside it (profile.js): the same person icon signed in or out, a 40px circle */
.head-r { display: flex; align-items: center; gap: 8px; }
.acct-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--tag-border);
  border-radius: 50%;
  background: var(--tag);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.acct-btn:hover { background: var(--hover); border-color: var(--hover-border); }
.acct-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Phones: one row of boxes, each as wide as its words plus an even share of the room that's left */
.modes {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tag);
  font-family: var(--rc);
  text-transform: uppercase;
}
.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--nav);
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.mode + .mode { border-left: 1px solid var(--tag-border); }
.mode:hover { background: var(--hover); }
.mode:focus-visible { outline-offset: -3px; }
.mode svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode > span { font-size: 12.5px; font-weight: 800; }
.mode-board svg { stroke: var(--gold); stroke-width: 2.2; }
.mode-fr svg { stroke: var(--teal); stroke-width: 2.2; }
/* Franchise's NEW tag for its first month (profile.js adds .is-new until November 15, 2026): a small teal pill tucked
   into the box's top-right corner, clear of the crown and the label; out of the flow, so the box keeps its size */
.mode-fr.is-new::after {
  content: "New";
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 1px 3px 0.5px;
  border-radius: 3px;
  background: var(--teal);
  color: var(--on-teal);
  font-size: 7.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.mode-big b { font-size: 18px; font-weight: 800; }
.mode-big > span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.mode-170 b { color: var(--gold); }
.mode-151 b { color: var(--red); }
.mode-fd b { font-size: 14.5px; color: var(--st); }
.mode[aria-current="page"] { cursor: default; }
.mode-builder[aria-current="page"] { background: var(--text); color: var(--bg); }
.mode-builder[aria-current="page"] svg { stroke: var(--bg); }
.mode-170[aria-current="page"], .mode-board[aria-current="page"] { background: var(--gold); color: var(--on-gold); }
.mode-170[aria-current="page"] b { color: var(--on-gold); }
.mode-170[aria-current="page"] > span { color: var(--on-gold-2); }
.mode-board[aria-current="page"] svg { stroke: var(--on-gold); }
.mode-151[aria-current="page"] { background: var(--red-fill); color: #fff; }
.mode-151[aria-current="page"] b { color: #fff; }
.mode-151[aria-current="page"] > span { color: var(--red-small); }

/* ======================================================================================== layout: phones */
/* The header row (wordmark, Play with your team), then the menu, sticky. */
.site-head { display: contents; }
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "word play" "nav nav" "main main";
  align-items: center;
}
.wordmark { grid-area: word; padding-left: var(--gutter); height: 56px; line-height: 56px; overflow: hidden; text-overflow: ellipsis; }
.head-r { grid-area: play; margin-right: var(--gutter); justify-self: end; }
/* Phones: the header row holds the wordmark, "Play with your team" (always whole) and the account button. Up to
   429px wide they step down to fit one row: the wordmark to 18px, the button's text to 13px with its icon and
   padding a little smaller, and tighter gaps and sides. Under 373px one row can't hold them legibly, so the header
   takes two there: the wordmark and the account button, then a full-width Play button. (A browser that opted out of
   the account features has no account button, html.acct-off, and keeps the header as it was.) */
@media (max-width: 429px) {
  :root:not(.acct-off) .wordmark { padding-left: 12px; font-size: 18px; }
  :root:not(.acct-off) .head-r { gap: 6px; margin-right: 12px; }
  :root:not(.acct-off) .play-team { gap: 3px; padding: 0 7px 0 6px; font-size: 13px; }
  :root:not(.acct-off) .play-team svg { width: 12px; height: 12px; }
}
@media (max-width: 372px) {
  :root:not(.acct-off) .app { grid-template-areas: "word acct" "play play" "nav nav" "main main"; }
  :root:not(.acct-off) .head-r { display: contents; }
  :root:not(.acct-off) .acct-btn { grid-area: acct; justify-self: end; margin-right: 12px; }
  :root:not(.acct-off) .play-team { grid-area: play; justify-content: center; gap: 6px; margin: 0 12px 12px; padding: 0 12px; font-size: 14px; }
  :root:not(.acct-off) .play-team svg { width: 14px; height: 14px; }
}
.modes-bar {
  grid-area: nav;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px var(--gutter);
  background: rgba(8, 11, 15, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.modes { max-width: 560px; margin: 0 auto; }
.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
/* The controls column's pieces join the page flow around the field. */
.panel, .draft-panel, .dp-state { display: contents; }
.o-top { order: 1; }
.stage { order: 2; }
.o-bot { order: 3; }
.main .o-top, .main .o-bot {
  /* page gutters; 600–999px wide: content blocks capped at 560px, centered (the field stays full-bleed) */
  margin-left: max(var(--gutter), calc((100% - 560px) / 2));
  margin-right: max(var(--gutter), calc((100% - 560px) / 2));
}
.stage { margin: 0; }
body.mode-draft .stage { margin-top: 12px; }

/* ======================================================================================== titles, sections */
.title-block { padding: 16px 0 12px; }
/* the title, and in the builder a pair of binoculars: the Scouting Guide in a new tab (the row stays the title's height) */
.title-row { display: flex; align-items: center; gap: 10px; }
.title-row h1 { flex: 1; min-width: 0; }
.scout-link {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin: -6px -7px -6px 0;
  border-radius: 6px;
  color: var(--gold);
}
.scout-link:hover { background: var(--hover); color: var(--gold-hover); }
.scout-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 0; }
.scout-link svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.title-block h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  font-family: var(--rc);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.title-block h1 .n170 { color: var(--gold); }
.title-block h1 .n151 { color: var(--red); }
body.mode-draft .title-block { padding-bottom: 14px; }
.retro-badge {
  padding: 3px 7px 2px;
  border: 1.5px solid var(--gold);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  color: #fde047;
  white-space: nowrap;
}
.desc { margin: 7px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
#dp-setup > .desc { margin-top: -7px; margin-bottom: 12px; }
.sec { display: flex; align-items: center; gap: 10px; margin-top: 26px; padding-bottom: 10px; }
.sec h2 { margin: 0; font-family: var(--rc); font-size: 16px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.sec::after { content: ""; flex: 1; order: 1; height: 1px; background: var(--line); }
/* a link at the end of a section's rule (How it works → the Scouting Guide); it never adds height to the row */
.sec-link {
  order: 2;
  font-family: var(--rc);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold);
  text-decoration: none;
}
.sec-link:hover, .sec-link:focus-visible { color: var(--gold-hover); text-decoration: underline; text-underline-offset: 3px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.lbl { font-family: var(--rc); font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--muted); }

/* ======================================================================================== buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  font-family: var(--rc);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn svg.fill { fill: currentColor; stroke: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.white { background: var(--text); color: var(--bg); }
.btn.white:hover:not(:disabled) { background: var(--white-hover); }
.btn.white svg { stroke-width: 2.4; }
.btn.gold { background: var(--gold); color: var(--on-gold); }
.btn.gold:hover:not(:disabled) { background: var(--gold-hover); }
.btn.red { background: var(--red-fill); color: #fff; }
.btn.red:hover:not(:disabled) { background: var(--red-hover); }
.btn.outline { background: var(--tag); border: 1px solid var(--tag-border); color: var(--text); }
.btn.outline:hover:not(:disabled) { background: var(--hover); }
.btn.quiet { background: transparent; border: 1px solid var(--ghost-border); color: var(--muted); height: 44px; font-size: 14px; }
.btn.quiet:hover:not(:disabled) { color: var(--text); border-color: var(--hover-border); }
.btn.big { height: 52px; font-size: 19px; }
.btn small { font-size: 12px; font-weight: 700; text-transform: none; color: var(--muted); }
.text-btn {
  min-height: 44px;
  margin: -12px 0;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 3px;
}
.text-btn:hover { color: var(--text); }

/* ======================================================================================== options (radio chips) */
.opts { display: grid; gap: 4px; }
.opts label { position: relative; display: flex; min-width: 0; cursor: pointer; }
.opts input { position: absolute; opacity: 0; pointer-events: none; }
.opts label > span {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 0 4px;
  border: 1px solid var(--ghost-border);
  border-radius: 5px;
  background: var(--tag);
  color: var(--muted);
  font-family: var(--rc);
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.opts label > span small { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; opacity: 0.7; }
.opts label:hover > span { color: var(--text); border-color: var(--hover-border); }
.opts input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); }
.opts.def input:checked + span { background: rgba(91, 192, 248, 0.14); border-color: var(--def); color: var(--def); }
.opts.off input:checked + span { background: rgba(242, 194, 48, 0.14); border-color: var(--off); color: var(--off); }
.opts.kick input:checked + span { background: rgba(196, 181, 253, 0.14); border-color: var(--st); color: var(--st); }
.opts input:disabled + span { opacity: 0.4; }
.opts label:has(input:disabled) { cursor: not-allowed; }
.opts label:has(input:disabled):hover > span { color: var(--muted); border-color: var(--ghost-border); }
.opts input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.opts.c2 { grid-template-columns: repeat(2, var(--w, 66px)); }
.opts.c3 { grid-template-columns: repeat(3, var(--w, 76px)); }
.opts.w66 { --w: 66px; }
.opts.w76 { --w: 76px; }
.opts.w80 { --w: 80px; }
.opts.w92 { --w: 92px; }

/* A sheet row: label on the left, options on the right */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 10px 0 14px;
}
.row + .row, .pool + .row { border-top: 1px solid var(--line); }
.row .lbl { flex: 1; min-width: 0; }

/* Legendaries on/off */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -12px 0;
  font-family: var(--rc);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.toggle:hover { color: var(--text); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--tag-border);
  transition: background 0.15s, border-color 0.15s;
}
.track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .track { background: var(--gold); border-color: var(--gold); }
.toggle input:checked + .track::after { transform: translateX(16px); background: var(--bg); }
.toggle:has(input:checked) { color: var(--text); }
.toggle input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ======================================================================================== builder */
.actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
.actions .s3 { grid-column: span 3; }
.actions .s2 { grid-column: span 2; }
.pool { padding: 12px 12px 12px 14px; }
.pool-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.opts.gens { grid-template-columns: repeat(5, 1fr); }
.opts.gens label > span { min-height: 44px; }
.pool-line { margin: 10px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.retro-note { margin-top: 6px; margin-bottom: 0; font-size: 12px; color: var(--subtle); }
.discord-cta { margin-top: 14px; gap: 9px; font-size: 16px; }
.discord-cta svg { width: 19px; height: 19px; color: #8b95f9; }

/* ======================================================================================== challenges */
.box.setup .row:first-child { border-top: 0; }
#dp-start { width: auto; margin-top: 12px; }
.dp-lb {
  min-height: 1.4em;
  margin-top: 10px;
  margin-bottom: 0;
  overflow: hidden;
  font-size: 12.5px;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}
.dp-lb a { color: var(--gold); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Scorebug: round · region · type · Legendaries (17–0) / round · ORIGINAL 151 · rerolls (151) / the final */
.bug {
  display: flex;
  align-items: stretch;
  height: 44px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tag);
  font-family: var(--rc);
  text-transform: uppercase;
  line-height: 1;
}
.bug small { font-size: 10px; font-weight: 700; }
.bug-round { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 10px; background: var(--gold); color: var(--on-gold); }
.bug-round b { font-size: 18px; font-weight: 800; white-space: nowrap; }
.bug-round b small { font-size: 12px; }
body.game-151 .bug-round { background: var(--red-fill); color: #fff; }
.bug-side { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 10px; border-left: 1px solid var(--tag-border); text-align: center; }
.bug-side small { color: var(--muted); }
.bug-side b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bug-name { flex: 1; display: flex; align-items: center; padding: 0 12px; font-size: 16px; font-weight: 800; }
/* The roll's chips are the scorebug's region and type cells. */
.bug .chip { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 12px; font-size: 18px; font-weight: 800; white-space: nowrap; }
.bug .chip small { font-size: 12px; font-weight: 700; color: var(--muted); }
.bug .chip.region { flex: 1; overflow: hidden; }
.bug .chip.type { padding: 0 14px; }
.bug .chip.blank { font-size: 17px; color: var(--subtle); }
.bug .chip.blank:first-of-type { flex: 1; }
.bug .chip.blank + .chip.blank { flex: none; border-left: 1px dashed var(--tag-border); }
.bug .chip.blank.spinning { animation: blank-pulse 0.7s ease-in-out infinite alternate; }
@keyframes blank-pulse { to { color: var(--text); } }
.bug.final { height: 58px; border-color: var(--gold); }
.bug-final { display: flex; align-items: center; padding: 0 12px; background: var(--gold); color: var(--on-gold); font-size: 15px; font-weight: 800; }
.bug-record { flex: 1; display: flex; align-items: center; padding: 0 14px; font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bug-record.perfect { color: var(--gold); }
.bug-score { align-items: flex-end; padding: 0 14px; text-align: right; }
.bug-score small { font-size: 11px; }
.bug-score b { font-size: 28px; }

/* 22 ticks, one per round */
.ticks { display: grid; grid-template-columns: repeat(22, 1fr); gap: 2px; margin-top: 8px; }
.ticks i { display: block; height: 4px; background: rgba(255, 255, 255, 0.12); }
.ticks i.done { background: var(--gold); }
.ticks i.now { background: rgba(242, 194, 48, 0.4); }
body.game-151 .ticks i.done { background: var(--red); }
body.game-151 .ticks i.now { background: rgba(248, 113, 113, 0.4); }
/* 17 squares, one per game (gold all round on a perfect season) */
.squares { display: grid; grid-template-columns: repeat(17, 1fr); gap: 3px; margin-top: 8px; }
.squares i { display: block; height: 6px; border-radius: 1px; background: var(--win); }
.squares i.loss { background: var(--red); }
.squares.perfect i { background: var(--gold); }
/* which pieces each state shows (the containers are hidden by app.js; these are the shared ones) */
body:not([data-dp="turn"]):not([data-dp="placing"]) .ticks,
body:not([data-dp="done"]) .squares,
body:not([data-dp="placing"]) .callout,
body:not([data-dp="turn"]) #dp-choose,
body:not([data-dp="turn"]):not([data-dp="placing"]) .meta,
body:not([data-dp="done"]) .done-actions { display: none !important; }

/* The pick waiting to be placed */
.pick-card { display: flex; flex-direction: column; gap: 10px; }
.pc-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pick-card .thumb { width: 52px; height: 52px; flex: none; }
.pc-main { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.pc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; font-family: var(--rc); text-transform: uppercase; }
.pc-head b { overflow: hidden; font-size: 21px; font-weight: 800; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.pc-num { font-size: 12.5px; font-weight: 700; color: var(--subtle); text-transform: none; }
#dp-change { flex: none; }
body:not(.game-151) .pick-card { min-height: 60px; padding: 4px 6px; border: 1px solid var(--gold); border-radius: 6px; background: var(--tag); justify-content: center; }
body.game-151 .pick-card { padding: 12px; background: var(--panel); border: 1px solid rgba(248, 113, 113, 0.55); border-radius: 8px; }
body.game-151 .pick-card .thumb { width: 64px; height: 64px; }
body.game-151 .pc-row { gap: 12px; }
body.game-151 .pc-main { gap: 6px; }
body.game-151 .pc-head b { font-size: 23px; }
.reroll { height: 44px; font-size: 16px; }
.reroll svg { width: 16px; height: 16px; stroke-width: 2.4; }
.reroll small { padding: 1px 8px; border-radius: 999px; font-family: var(--font); font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.25); }
.reroll:disabled { background: var(--tag); border: 1px solid var(--ghost-border); color: var(--muted); }
.reroll:disabled small { background: none; color: var(--subtle); }

.callout {
  margin-top: 12px;
  margin-bottom: 0;
  padding: 12px;
  border: 1px dashed rgba(242, 194, 48, 0.6);
  border-radius: 6px;
  font-family: var(--rc);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  color: var(--gold);
}
body.game-151 .callout { border-color: rgba(248, 113, 113, 0.55); color: var(--red-light); }
body.game-151 #dp-choose { background: var(--red-fill); color: #fff; }
body.game-151 #dp-choose:hover:not(:disabled) { background: var(--red-hover); }
#dp-choose { margin-top: 12px; }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
body[data-dp="placing"] .meta { margin-top: 12px; }
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.done-actions #dp-season { grid-column: 1 / -1; }
.done-actions .btn { height: 44px; font-size: 16px; }
.done-actions .btn.big { height: 52px; font-size: 19px; }

/* Bests (Best record gets the widest cell, for "17–0 ×12") */
.bests {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  margin-top: 20px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-family: var(--rc);
  text-transform: uppercase;
}
.bests > div { min-width: 0; padding: 10px 12px; }
.bests > div + div { border-left: 1px solid var(--line); }
.bests dt { font-size: 12px; font-weight: 700; color: var(--subtle); white-space: nowrap; }
.bests dd { margin: 2px 0 0; font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bests dd.perfect { color: var(--gold); }
.bests dd small { font-size: 0.6em; }
.draft-panel .sec { margin-top: 24px; }
.rules { margin-top: 0; margin-bottom: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.rules-sprites { margin-top: 14px; }

/* ======================================================================================== field */
.field-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1536 / 1064;
  overflow: hidden;
  border-block: 1px solid var(--line);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  container-type: inline-size; /* the roll pop-up scales with it */
}
#field { display: block; width: 100%; height: 100%; }
#hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none; /* a press and hold shows the player's card */
}
/* a spot's name tag takes taps over any other spot that reaches across it (app.js gives the tag's box in fractions
   of the spot's border box: 100% + its 2px borders) */
#hotspots .hotspot::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(var(--tag-l) * (100% + 4px) - 2px);
  bottom: -2px;
  width: calc(var(--tag-w) * (100% + 4px));
  height: calc(var(--tag-h) * (100% + 4px));
}
.hotspot:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.4); }
.hotspot:focus-visible { outline: 2px solid var(--gold); outline-offset: 0; }
.hotspot.drop-target { background: rgba(242, 194, 48, 0.16); border-color: var(--gold); }
.hotspot.dragging { opacity: 0.4; }
/* In a challenge: no dragging (so swipes on the field scroll the page); open spots pulse while placing. */
#hotspots.draft .hotspot { cursor: pointer; touch-action: manipulation; }
#hotspots.draft .hotspot.locked { cursor: default; }
.hotspot.open-slot {
  border-color: rgba(74, 222, 128, 0.7);
  background: rgba(74, 222, 128, 0.07);
  animation: open-pulse 1.6s ease-in-out infinite;
}
.hotspot.open-slot:hover { background: rgba(74, 222, 128, 0.2); border-color: var(--open); }
@keyframes open-pulse { 50% { border-color: rgba(74, 222, 128, 0.22); } }
/* A player's card: hover them on the field (press and hold on a touchscreen) */
.player-card {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 248px;
  padding: 9px 10px 8px;
  border: 1px solid var(--tag-border);
  border-radius: 8px;
  background: var(--hover);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
  font-family: var(--rc);
  text-transform: uppercase;
  pointer-events: none;
}
.player-card[hidden] { display: none; }
.player-card .pl-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.player-card .pos-chip { padding: 2px 6px; font-size: 13px; }
.player-card .nm { min-width: 0; overflow: hidden; font-size: 17px; font-weight: 800; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.player-card .leg { flex: none; font-size: 14px; color: var(--gold); }
.player-card .num { flex: none; margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--subtle); font-variant-numeric: tabular-nums; }
.player-card .pl-size { font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; color: var(--muted); }
.ghost {
  position: fixed;
  z-index: 50;
  width: 96px;
  height: 96px;
  pointer-events: none;
  transform: translate(-50%, -60%);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
}
.ghost.pixelated { image-rendering: pixelated; }

/* ======================================================================================== shinies */
/* A shiny player on a field: three small stars twinkling around it (app.js / field.js place them, in fractions of the
   field). They don't take taps. */
.shy-sparks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* a pixel sparkle (a plus, five cells across, a white middle) that twinkles in steps, like the sprites' own frames */
.shy-sparks i {
  position: absolute;
  aspect-ratio: 1;
  background: radial-gradient(circle, #fff 0 14%, #ffe680 15% 34%, #ffc93a 35%);
  clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
  opacity: 0;
  animation: shy-spark 2.8s steps(1, end) infinite;
}
@keyframes shy-spark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  6% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(0.4); }
  30%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
}
/* The picker: a shiny the account has found shows shiny, with a small star at its picture's corner */
.grid .mon.shy::before {
  content: "";
  position: absolute;
  top: 7px;
  left: calc(50% - 31px);
  width: 12px;
  height: 12px;
  background: var(--gold);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
/* ...and the switch for the player in this spot: shiny (gold) or their usual colors */
.shy-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  margin-left: auto;
  padding: 0 10px 0 8px;
  border: 1px solid var(--tag-border);
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-family: var(--rc);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.shy-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.shy-toggle[aria-pressed="true"] { border-color: rgba(242, 194, 48, 0.55); background: rgba(242, 194, 48, 0.12); color: var(--gold); }
.shy-toggle[aria-pressed="true"] svg { fill: currentColor; stroke: none; }
.shy-toggle:hover { border-color: var(--hover-border); color: var(--text); }
.shy-toggle[aria-pressed="true"]:hover { color: var(--gold-hover); }

/* ======================================================================================== the roll (reels over the field) */
.roll-pop {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.18));
  cursor: pointer;
  animation: roll-fade 0.18s ease-out;
  transition: opacity 0.18s;
}
.roll-pop.out { opacity: 0; }
@keyframes roll-fade { from { opacity: 0; } }
.roll-card {
  --reel-h: clamp(46px, 6.6cqw, 88px);
  --ring: var(--gold);
  --ring-soft: rgba(242, 194, 48, 0.16);
  --ring-glow: rgba(242, 194, 48, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2cqw, 14px);
  padding: clamp(10px, 2cqw, 24px) clamp(14px, 2.8cqw, 34px);
  border-radius: 8px;
  background: rgba(9, 13, 17, 0.95);
  border: 1px solid var(--tag-border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  animation: roll-card-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
body.game-151 .roll-card { --ring: var(--red); --ring-soft: rgba(248, 113, 113, 0.16); --ring-glow: rgba(248, 113, 113, 0.25); }
@keyframes roll-card-in { from { transform: scale(0.85); opacity: 0; } }
.roll-title {
  font-family: var(--rc);
  font-size: clamp(11px, 1.3cqw, 15px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ring);
}
.reels { display: flex; gap: clamp(8px, 1.6cqw, 18px); }
.reel { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 0.6cqw, 8px); }
.reel-win {
  position: relative;
  width: clamp(112px, 15.5cqw, 210px);
  height: var(--reel-h);
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel);
  border: 1.5px solid var(--tag-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.reel-win::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(var(--panel), transparent 20%, transparent 80%, var(--panel));
}
.reel-win.landed, .reel-win.held { border-color: var(--ring); }
.reel-win.landed { box-shadow: 0 0 0 3px var(--ring-soft), 0 0 26px var(--ring-glow); animation: reel-land 0.4s ease-out; }
@keyframes reel-land { 40% { transform: scale(1.07); } }
.reel-strip { position: absolute; top: 0; left: 0; right: 0; }
.reel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(var(--reel-h) - 3px); /* inside the window's 1.5px border */
  font-family: var(--rc);
  line-height: 1.1;
  text-transform: uppercase;
}
.reel-item b { font-size: clamp(17px, 2.3cqw, 30px); font-weight: 800; }
.reel-item small { font-size: clamp(10px, 1.1cqw, 14px); font-weight: 700; color: var(--muted); }
.reel-item .type { padding: 0.25em 0.65em; border-radius: 5px; font-size: clamp(14px, 1.9cqw, 24px); font-weight: 800; }
.reel.mon .reel-win { width: clamp(200px, 30cqw, 400px); }
.reel-item.mon { flex-direction: row; gap: clamp(6px, 1cqw, 12px); padding: 0 10px; }
.reel-item.mon img { flex: none; width: auto; height: calc(var(--reel-h) * 0.86); }
.reel-item.mon img.pixelated { image-rendering: pixelated; }
.reel-item.mon b { overflow: hidden; font-size: clamp(15px, 2.1cqw, 27px); white-space: nowrap; text-overflow: ellipsis; }
.reel-label, .roll-skip { font-family: var(--rc); font-size: clamp(10px, 1.05cqw, 12.5px); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.reel-label { color: var(--muted); }
.roll-skip { color: var(--subtle); }

/* ======================================================================================== Pokémon types, stats */
.type { background: rgb(var(--t)); color: #16161a; }
.t-normal { --t: 168, 167, 122; }
.t-fire { --t: 238, 129, 48; }
.t-water { --t: 99, 144, 240; }
.t-electric { --t: 247, 208, 44; }
.t-grass { --t: 122, 199, 76; }
.t-ice { --t: 150, 217, 214; }
.t-fighting { --t: 194, 46, 40; }
.t-poison { --t: 163, 62, 161; }
.t-ground { --t: 226, 191, 101; }
.t-flying { --t: 169, 143, 243; }
.t-psychic { --t: 249, 85, 135; }
.t-bug { --t: 166, 185, 26; }
.t-rock { --t: 182, 161, 54; }
.t-ghost { --t: 115, 87, 151; }
.t-dragon { --t: 111, 53, 252; }
.t-dark { --t: 112, 87, 70; }
.t-steel { --t: 183, 183, 206; }
.t-fairy { --t: 214, 133, 173; }
.t-fighting, .t-poison, .t-ghost, .t-dragon, .t-dark { color: #fff; }
.cand-types { display: flex; flex-wrap: wrap; gap: 4px; }
.cand-types .type { padding: 2px 7px; border-radius: 3px; font-family: var(--rc); font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.cand-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 5px 0;
  border-block: 1px solid var(--line);
  font-family: var(--rc);
}
.cand-stats > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.cand-stats i { font-size: 10.5px; font-style: normal; font-weight: 700; text-transform: uppercase; color: var(--subtle); }
.cand-stats .hi { color: var(--hi-stat); }
.cand-stats .lo { color: var(--subtle); }
/* The 151 panel: height and weight under the stats */
.cand-stats .size { display: block; grid-column: 1 / -1; padding-top: 6px; font-size: 13.5px; font-weight: 700; line-height: 1.2; text-align: center; text-transform: uppercase; color: var(--text); }
.cand-stats .size b { font-weight: 700; }
.cand-stats .size i { display: inline; font-size: inherit; font-weight: 700; color: var(--muted); }
[data-tip] { cursor: help; }
@media (hover: none) { [data-tip] { cursor: pointer; } }
.stat-tip {
  position: fixed;
  z-index: 70;
  max-width: 230px;
  padding: 8px 10px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--hover);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
  pointer-events: none;
}
.stat-tip[hidden] { display: none; }
.stat-tip b { display: block; margin-bottom: 2px; font-family: var(--rc); font-size: 14px; font-weight: 800; text-transform: uppercase; color: var(--text); }

/* ======================================================================================== pop-ups */
/* Phones: bottom sheets. Wide screens: centered windows (see the wide-screen block). */
dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  max-height: none;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--tag-border);
  border-radius: 12px 12px 0 0;
  background: var(--sheet);
  color: var(--text);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
dialog.sheet[open] { display: flex; animation: sheet-up 0.2s ease-out; }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0.4; } }
dialog.sheet::before {
  content: "";
  flex: none;
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.picker-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 4px 6px 10px var(--gutter);
}
.picker-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.picker-title h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-family: var(--rc);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.picker-title h2 svg.trophy { width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.close:hover { background: var(--hover); color: var(--text); }
.close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.pos-chip {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--tag-border);
  border-radius: 5px;
  background: var(--tag);
  font-family: var(--rc);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}
.pos-chip.off { color: var(--off); }
.pos-chip.def { color: var(--def); }
.pos-chip.st { color: var(--st); }
.picker-hint { flex: none; margin: 10px var(--gutter) 6px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

/* ----- Pokémon picker ----- */
.picker-tools { flex: none; display: flex; gap: 8px; padding: 0 var(--gutter); }
.picker-tools input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--tag);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* keeps iOS from zooming */
  transition: border-color 0.15s;
}
.picker-tools input::placeholder { color: var(--subtle); }
.picker-tools input:focus { outline: none; border-color: var(--gold); }
.picker-tools .btn { flex: none; height: 44px; font-size: 15px; }
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 6px;
  padding: 4px var(--gutter) var(--gutter);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.grid .mon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 6px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-family: var(--rc);
  text-transform: uppercase;
  transition: border-color 0.15s;
}
.grid .mon:hover { border-color: var(--hover-border); }
.grid .mon[hidden], .empty-msg[hidden] { display: none; }
.grid .mon img { width: 56px; height: 56px; image-rendering: pixelated; }
.grid .mon .num { font-size: 11.5px; font-weight: 700; color: var(--subtle); text-transform: none; font-variant-numeric: tabular-nums; }
.grid .mon .nm { max-width: 100%; font-size: 13px; font-weight: 800; line-height: 14.3px; text-align: center; overflow-wrap: break-word; }
.grid .mon.current { border-color: var(--gold); background: rgba(242, 194, 48, 0.1); }
.grid .mon .tag {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 5px;
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  background: var(--tag);
  font-size: 11px;
  font-weight: 800;
}
.grid .mon .tag.off { color: var(--off); }
.grid .mon .tag.def { color: var(--def); }
.grid .mon .tag.st { color: var(--st); }
.grid .mon .leg { position: absolute; top: 3px; left: 6px; font-size: 13px; color: var(--gold); }
/* Base stats (HP Atk Def / SpA SpD Spe: greener when high, dimmer when low) and size, lined up along
   each row's bottom edge whatever the names above them wrap to */
.grid .mon .ms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px 0;
  width: 100%;
  margin-top: auto;
  padding: 5px 1px 0;
  border-top: 1px solid var(--line);
}
.grid .mon .ms > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.grid .mon .ms i { font-size: 9px; font-style: normal; font-weight: 700; color: var(--subtle); }
.grid .mon .ms .hi { color: var(--hi-stat); }
.grid .mon .ms .lo { color: var(--subtle); }
.grid .mon .msz {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 5px;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.grid .mon .msz span { white-space: nowrap; }
.empty-msg { grid-column: 1 / -1; padding: 24px; font-size: 14px; text-align: center; color: var(--muted); }

/* ----- Choose a Pokémon (17–0) ----- */
.roll-bar { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 0 var(--gutter); }
.roll-bar .bug.roll { width: 100%; }
.rerolls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rerolls .btn { height: 44px; padding: 0 10px; font-size: 14px; gap: 6px; }
.rerolls .btn svg { width: 15px; height: 15px; color: var(--muted); }
.rerolls .btn:disabled svg { display: none; }
.cand-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 4px var(--gutter) var(--gutter);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s;
}
.cand:hover:not(:disabled) { border-color: var(--hover-border); }
.cand.current { border-color: var(--gold); background: rgba(242, 194, 48, 0.08); }
.cand.locked { opacity: 0.45; cursor: not-allowed; }
.cand .thumb { width: 64px; height: 64px; flex: none; }
.cand-main { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.cand-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-family: var(--rc); text-transform: uppercase; }
.cand-name .nm { overflow: hidden; font-size: 19px; font-weight: 800; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.cand-name .leg { font-size: 14px; color: var(--gold); }
.cand-name .num { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--subtle); text-transform: none; font-variant-numeric: tabular-nums; }
.cand-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--rc); font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.cand.locked .cand-foot { color: var(--gold); }

/* ----- Season results ----- */
.season-body { flex: 1; min-height: 0; padding: 0 var(--gutter) 4px; overflow-y: auto; overscroll-behavior: contain; }
.season-card { display: flex; justify-content: center; padding: 0; border-radius: 8px; }
.season-card img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 300px);
  max-height: calc(100svh - 300px);
  border-radius: 8px;
  background: var(--panel);
  -webkit-touch-callout: default;
  user-select: auto;
  -webkit-user-select: auto;
}
.season-card img.loading { animation: card-wait 1s ease-in-out infinite alternate; }
@keyframes card-wait { to { background: var(--hover); } }
/* A run that found shinies: the card's foil (app.js bakes it into the picture) moves on the results. A sheen crosses
   the card now and then, and the foil's colors drift over its foil (the header and the footer, not the season's
   squares or the field) as if it were tilting, with a few stars twinkling: all over the picture and never taking its
   taps (pressing and holding still saves it). Reduced motion: still, with no sheen. */
.season-foil { position: relative; display: block; max-width: 100%; border-radius: 8px; }
.season-foil .foil-shine { display: none; }
.season-foil.holo {
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 12px 46px rgba(178, 140, 255, 0.22), 0 0 30px rgba(255, 214, 102, 0.12);
}
.season-foil.holo .foil-shine {
  display: block;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 32.5%, transparent 94.5%, #000 95.5%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 32.5%, transparent 94.5%, #000 95.5%);
}
/* the foil's colors, drifting */
.foil-shine::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: repeating-linear-gradient(125deg, rgba(255, 138, 214, 0.5) 0, rgba(255, 214, 102, 0.5) 5%, rgba(128, 255, 204, 0.5) 10%, rgba(120, 196, 255, 0.5) 15%, rgba(196, 150, 255, 0.5) 20%, rgba(255, 138, 214, 0.5) 25%);
  mix-blend-mode: soft-light;
  opacity: 0.32;
  pointer-events: none;
  animation: foil-drift 10s ease-in-out infinite alternate;
}
/* the sheen: a soft band of light across the card, then a rest */
.season-foil.holo::after {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -45%;
  width: 40%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.06) 32%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.06) 68%, rgba(255, 255, 255, 0));
  pointer-events: none;
  transform: skewX(-16deg);
  animation: foil-sheen 7s ease-in-out 0.6s infinite;
}
@keyframes foil-sheen { 0% { transform: translateX(0) skewX(-16deg); } 45%, 100% { transform: translateX(400%) skewX(-16deg); } }
@keyframes foil-drift { from { transform: translate(-7%, -4%); } to { transform: translate(7%, 4%); } }
/* twinkles in the card's open spaces (the stars of .shy-sparks, in fractions of the card) */
.foil-shine i:nth-child(1) { left: 42%; top: 5%; width: 2.4%; animation-delay: 0.2s; }
.foil-shine i:nth-child(2) { left: 51.5%; top: 21.5%; width: 2.2%; animation-delay: 1.1s; }
.foil-shine i:nth-child(3) { left: 95%; top: 30.5%; width: 2%; animation-delay: 1.9s; }
.foil-shine i:nth-child(4) { left: 84%; top: 10.5%; width: 2.2%; animation-delay: 0.7s; }
.foil-shine i:nth-child(5) { left: 61%; top: 96.6%; width: 2%; animation-delay: 2.4s; }
.season-hint { margin: 10px 0; font-size: 12.5px; line-height: 1.4; text-align: center; color: var(--muted); }
.season-more summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-family: var(--rc);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
}
.season-more summary::-webkit-details-marker { display: none; }
.season-more summary::after { content: ""; flex: 1; order: 1; height: 1px; background: var(--line); }
.season-more summary svg { order: 2; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.season-more[open] summary svg { transform: rotate(180deg); }
.season-more summary:hover svg { stroke: var(--text); }
.season-notes { margin: 4px 0 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.season-games { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 0 0 12px; padding: 0; list-style: none; }
.season-games li {
  display: grid;
  grid-template-columns: 22px 16px 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  font-family: var(--rc);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.season-games .wk, .season-games .ors { font-size: 12px; color: var(--subtle); }
.season-games .res { font-weight: 800; }
.season-games .win .res { color: var(--win); }
.season-games .loss .res { color: var(--red); }
.season-games .opp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.season-how { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: var(--subtle); }
.season-actions {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px var(--gutter) 16px;
  border-top: 1px solid var(--line);
}
.season-actions .post-btn, .season-actions .post-note { grid-column: 1 / -1; }
.season-actions .btn:not(.post-btn) { height: 46px; font-size: 16px; }
.post-btn { gap: 8px; height: auto; min-height: 44px; padding-block: 6px; font-size: 15px; line-height: 1.15; white-space: normal; text-align: center; }
.post-btn svg { width: 17px; height: 17px; stroke: var(--gold); stroke-width: 2.3; }
.post-btn span { min-width: 0; }
.post-btn.posted { border-color: rgba(242, 194, 48, 0.45); }
.post-note { margin: 0; font-size: 12.5px; line-height: 1.4; text-align: center; color: var(--subtle); }

/* ----- Leaderboard ----- */
.board-tabs { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 0 var(--gutter); }
.tabs-g {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tag);
  font-family: var(--rc);
  text-transform: uppercase;
}
.tabs-g label { position: relative; display: flex; min-width: 0; cursor: pointer; }
.tabs-g label + label { border-left: 1px solid var(--tag-border); }
.tabs-g input { position: absolute; opacity: 0; pointer-events: none; }
.tabs-g span { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 48px; line-height: 1; color: var(--nav); }
.tabs-g b { font-size: 17px; font-weight: 800; }
.tabs-g small { font-size: 10.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tabs-g label:hover span { background: var(--hover); }
.tabs-g input:checked + span { background: var(--gold); color: var(--on-gold); }
.tabs-g input:checked + span small { color: var(--on-gold-2); }
.tabs-g input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -3px; }
.opts.tabs-s { grid-template-columns: 1fr 1fr; }
.board-note { flex: none; margin: 10px var(--gutter) 6px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.board-cols {
  flex: none;
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) 52px 40px;
  gap: 10px;
  padding: 0 calc(var(--gutter) - 2px + 8px) 4px;
  font-family: var(--rc);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--subtle);
}
.board-cols span:first-child { grid-column: 3; }
.board-cols span:not(:first-child) { text-align: right; }
.board-list { flex: 1; min-height: 140px; margin: 0; padding: 0 calc(var(--gutter) - 2px) 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.board-row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) 52px 40px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
}
.board-row:has(.br-remove) { grid-template-columns: 28px 34px minmax(0, 1fr) 52px 40px 30px 30px; }
.board-row + .board-row { border-top: 1px solid var(--line); }
.board-row.me { background: rgba(242, 194, 48, 0.08); box-shadow: inset 0 0 0 1px rgba(242, 194, 48, 0.5); }
.board-row.me + .board-row, .board-row + .board-row.me { border-top-color: transparent; }
.br-rank { font-family: var(--rc); font-size: 19px; font-weight: 800; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-row.top1 { --metal: #facc15; --metal-glow: rgba(250, 204, 21, 0.5); --metal-tint: rgba(250, 204, 21, 0.13); }
.board-row.top2 { --metal: #d4d4d8; --metal-glow: rgba(212, 212, 216, 0.4); --metal-tint: rgba(212, 212, 216, 0.1); }
.board-row.top3 { --metal: #e0975e; --metal-glow: rgba(224, 151, 94, 0.45); --metal-tint: rgba(224, 151, 94, 0.12); }
.board-row.top1, .board-row.top2, .board-row.top3 { background: linear-gradient(90deg, var(--metal-tint), transparent 80%); }
.board-row.top1 .br-pic, .board-row.top2 .br-pic, .board-row.top3 .br-pic { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--metal); }
.br-trophy { display: block; width: 26px; height: 26px; margin: 0 auto; color: var(--metal); filter: drop-shadow(0 0 5px var(--metal-glow)); }
.br-trophy .tr-body { fill: currentColor; }
.br-trophy .tr-handles { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.br-trophy .tr-shine { fill: none; stroke: #fff; stroke-opacity: 0.6; stroke-width: 1.3; stroke-linecap: round; }
.br-pic {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--hover);
  font-family: var(--rc);
  font-size: 16px;
  font-weight: 800;
  color: var(--muted);
}
.br-pic img { width: 100%; height: 100%; object-fit: cover; }
.br-name { display: flex; flex-direction: column; min-width: 0; }
.br-name b, .br-name small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.br-name b { font-size: 14px; font-weight: 700; }
.br-name small { font-size: 12px; color: var(--subtle); }
.br-rec, .br-score { font-family: var(--rc); font-size: 22px; font-weight: 800; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.br-rec.perfect { color: var(--gold); }
.br-score { color: var(--muted); }
.br-remove { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--red); }
.br-remove:hover { background: var(--hover); }
.br-rename { color: var(--muted); }
.br-remove svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.br-flag { grid-column: 3 / -1; margin: -4px 0 0; font-size: 12px; font-weight: 700; color: var(--red); }
.board-more { padding: 6px 8px 12px; font-size: 12.5px; text-align: center; color: var(--subtle); }
.board-more button {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 3px;
}
.board-more button:hover { color: var(--text); }
.board-foot { flex: none; padding: 10px var(--gutter) 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.board-foot p { margin: 0; }
.board-foot a { color: var(--gold); font-weight: 600; }
.board-foot button { padding: 0; border: 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25); text-underline-offset: 3px; }
.board-foot button:hover { color: var(--text); }
.board-foot .board-fine { margin-top: 6px; font-size: 11.5px; line-height: 1.4; color: var(--subtle); }

/* ======================================================================================== My teams */
/* The title row's pill (no height added to the control column; on wide screens and small phones just its icon,
   beside the Scouting Guide's binoculars, so the title stays on one line) and its pop-up: save the lineup on the
   field, then open, rename or delete saved ones */
.teams-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  margin: -4px 0;
  padding: 0 10px 0 8px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--tag);
  color: var(--text);
  font-family: var(--rc);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.teams-link:hover { background: var(--hover); border-color: var(--hover-border); }
.teams-link svg { width: 15px; height: 15px; fill: none; stroke: var(--gold); stroke-width: 2.3; stroke-linejoin: round; }
@media (max-width: 380px) {
  .teams-link { padding: 0 8px; }
  .teams-link span { display: none; }
}
.teams-pool { padding-top: 3px; font-family: var(--rc); font-size: 14px; font-weight: 700; text-transform: uppercase; white-space: nowrap; color: var(--muted); }
.teams-save { flex: none; display: flex; gap: 8px; padding: 0 var(--gutter); }
.teams-save input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--tag);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* iPhones zoom in on anything smaller */
}
.teams-save input::placeholder { color: var(--subtle); }
.teams-save input:focus { outline: none; border-color: var(--gold); }
.teams-save .btn { flex: none; padding: 0 16px; }
.teams-list { flex: 1; min-height: 0; margin: 0; padding: 0 calc(var(--gutter) - 2px) 12px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.team-row { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 2px 8px 4px; }
.team-row + .team-row { border-top: 1px solid var(--line); }
.team-info { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.team-info b, .team-info small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.team-info b { font-size: 15px; font-weight: 700; }
.team-info small { font-size: 12.5px; color: var(--muted); }
.team-row .team-open { flex: none; height: 38px; padding: 0 14px; font-size: 14px; }
.team-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.team-icon:hover { background: var(--hover); color: var(--text); }
.team-icon.team-delete { color: var(--red); }
.team-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.teams-empty { flex: 1; margin: 0; padding: 18px var(--gutter) 24px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
/* phones: the sheet only as tall as its list */
dialog.teams-sheet { height: auto; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }

/* ======================================================================================== the age question */
/* age.js: "What year were you born?", a year (and a month, for the one year that needs it), then a button that says
   the answer back and sends it: "I was born in 1998 · Continue" (the account page, the Fantasy Draft's chat) */
.age-q { display: flex; flex-direction: column; gap: 10px; }
.age-ask { margin: 0; font-family: var(--rc); font-size: 19px; font-weight: 800; line-height: 1.1; text-transform: uppercase; }
.age-row { display: flex; gap: 8px; }
.age-select {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 32px 0 12px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--tag) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3af' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* iPhones zoom in on a menu under 16px when it's tapped */
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.age-select:hover { border-color: var(--hover-border); }
.age-select:focus { outline: none; border-color: var(--gold); }
.age-select option { background: var(--panel); color: var(--text); }
/* the answer said back can be long ("I was born in September 2013 · Continue"): it wraps rather than overflows */
.age-go { width: 100%; height: auto; min-height: 46px; padding: 8px 16px; line-height: 1.15; white-space: normal; text-align: center; }

/* ======================================================================================== toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  background: var(--hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ======================================================================================== footer */
footer {
  margin-top: 28px;
  padding: 18px var(--gutter) 24px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
footer p { margin: 0; }
footer a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.3); text-underline-offset: 3px; }
footer a:hover { text-decoration-color: currentColor; }
footer .fine { margin-top: 10px; font-size: 11px; line-height: 1.5; color: var(--subtle); }
@media (max-width: 999px) {
  footer > * { max-width: 560px; margin-left: auto; margin-right: auto; }
}
/* The Patch Notes link's dot: a note this browser hasn't read yet (saves.js adds .notes-new) */
.notes-new::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--gold); vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  .hotspot.open-slot, .bug .chip.blank.spinning, .roll-pop, .roll-card, .reel-win.landed, .season-card img.loading, dialog.sheet[open] { animation: none; }
  .shy-sparks i { animation: none; opacity: 0.85; transform: translate(-50%, -50%) scale(0.8); }
  .season-foil.holo::after { display: none; }
  .foil-shine::after { animation: none; }
  .shy-sparks i:nth-child(3n + 2) { opacity: 0.6; transform: translate(-50%, -50%) scale(0.6); }
  .btn, .opts label > span, .track, .track::after, #toast { transition: none; }
}

/* ======================================================================================== small phones */
/* The mode menu's six boxes share one row: up to 429px wide its sides line up with the header row's (12px) and its
   words take a size down, a little more up to 380px; under 360px the Leaderboard shows its trophy alone. */
@media (max-width: 429px) {
  :root:not(.acct-off) .modes-bar { padding-inline: 12px; }
  .mode > span { font-size: 11.5px; }
  .mode-big b { font-size: 17px; }
  .mode-fd b { font-size: 13.5px; }
  .mode-big > span { font-size: 10px; }
}
@media (max-width: 380px) {
  .wordmark { font-size: 18.5px; }
  .picker-title h2 { font-size: min(22px, 5.3vw); } /* "Offense: pick a Pokémon" fits a 320px phone */
  .play-team { gap: 5px; padding: 0 9px 0 8px; font-size: 13px; }
  .modes-bar { padding-inline: 12px; }
  .mode > span { font-size: 11px; }
  .mode-big b { font-size: 16.5px; }
  .mode-fd b { font-size: 13px; }
  .mode-big > span { font-size: 9.5px; }
  .bug .chip { font-size: 16px; padding: 0 10px; }
  .bug .chip.type { padding: 0 10px; }
  .bug-name { font-size: 15px; }
}
/* Phones: picker names only as much smaller as the tile needs for the longest ones (Brambleghast,
   Crabominable) to fit whole, so no name breaks mid-word (their line keeps its height) */
@media (max-width: 599px) {
  .grid .mon .nm { font-size: min(13px, calc(3.5vw - 2.6px)); }
}
/* Under 360px the Sprites row's three options would cover its label: narrower options. And the Bests
   strip's numbers would spill out of their cells: smaller ones. The picker has three tiles to a row,
   so names stay readable. The line under Start run takes a size down, so it fits whole on its one line.
   The mode menu's Leaderboard shows its trophy alone (its name stays for screen readers), in a box still easy to tap. */
@media (max-width: 359px) {
  .mode-board { min-width: 34px; }
  .mode-board > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mode-board svg { width: 20px; height: 20px; }
  .opts.w76 { --w: 64px; }
  .opts.c3 label > span { padding: 0 2px; font-size: 13.5px; }
  .bests > div { padding-inline: 8px; }
  .bests dd { font-size: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid .mon .nm { font-size: min(13px, calc(4.6vw - 2.8px)); }
  .dp-lb { font-size: 11.5px; }
}
@media (min-width: 600px) and (max-width: 999px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .grid .mon img { width: 64px; height: 64px; }
  .cand-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .roll-bar { flex-direction: row; align-items: center; }
  .roll-bar .bug.roll { width: auto; flex: 1; min-width: 260px; }
  .season-games { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(9, auto); grid-auto-flow: column; gap: 4px 10px; }
}
/* Phones: the roll fills the field (sizes follow the field's width), so it reads at a glance. */
@media (max-width: 600px) {
  .roll-card { --reel-h: 24cqw; gap: 2.4cqw; padding: 3.2cqw 4cqw; }
  .roll-title { font-size: 3.6cqw; }
  .reels { gap: 2.4cqw; }
  .reel-win { width: 41cqw; }
  .reel.mon .reel-win { width: 84cqw; }
  .reel-item b, .reel-item.mon b { font-size: 7cqw; }
  .reel-item small { font-size: 3.4cqw; }
  .reel-item .type { font-size: 5.8cqw; }
  .reel-label, .roll-skip { font-size: 3.2cqw; }
}

/* ======================================================================================== wide screens */
@media (min-width: 1000px) and (min-height: 560px) {
  :root { --gutter: 22px; }
  html { scroll-padding-top: 0; }
  .app { display: flex; flex-direction: column; align-items: stretch; height: 100vh; height: 100svh; }
  .site-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 28px;
    height: 64px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
  }
  .wordmark { height: auto; padding: 0; font-size: 24px; line-height: 1; overflow: visible; }
  .modes-bar { position: static; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .modes { display: flex; height: 40px; max-width: none; margin: 0; }
  .mode { flex-direction: row; gap: 7px; height: 100%; padding: 0 16px; }
  .mode svg { width: 17px; height: 17px; }
  .mode > span, .mode-big > span { font-size: 15px; font-weight: 800; color: inherit; }
  .mode-big b, .mode-fd b { font-size: 17px; }
  .mode-fd b { font-size: 15px; }
  .mode-170[aria-current="page"] > span, .mode-151[aria-current="page"] > span { color: inherit; }
  .mode-fr.is-new::after { padding: 1px 3.5px 0.5px; font-size: 8px; letter-spacing: 0.06em; } /* (above the label's end) */
  .head-r { margin: 0 0 0 auto; }

  .main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 340px minmax(0, calc((100vh - 108px) * 1536 / 1064));
    grid-template-columns: 340px minmax(0, calc((100svh - 108px) * 1536 / 1064));
    grid-template-rows: minmax(0, 1fr);
    justify-content: center;
    gap: 28px;
    padding: 20px 28px 24px;
  }
  /* The controls column: never scrolls at the sizes people use (see the height steps below). */
  .panel { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; scrollbar-width: none; padding-bottom: 4px; }
  .panel > *, .panel .draft-panel > *, .panel .dp-state > * { flex-shrink: 0; }
  .panel::-webkit-scrollbar { display: none; }
  .main .o-top, .main .o-bot { margin-left: 0; margin-right: 0; }
  .stage { order: 0; min-width: 0; align-self: start; margin: 0 !important; }
  .field-wrap { border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); }

  .title-block { padding: 0 0 14px; }
  .title-block h1 { font-size: 32px; gap: 6px 8px; }
  .retro-badge { padding: 2px 6px 1px; font-size: 12px; }
  .desc { margin-top: 8px; }
  .actions { margin-top: 0; }
  .sec { margin-top: 22px; }
  body.mode-draft .panel > .draft-panel { display: contents; }

  /* Pop-ups: centered windows */
  dialog.sheet {
    inset: 0;
    width: min(880px, calc(100vw - 64px));
    height: min(760px, calc(100vh - 64px));
    height: min(760px, calc(100dvh - 64px));
    margin: auto;
    border: 1px solid var(--tag-border);
    border-radius: 10px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
  }
  dialog.sheet[open] { animation: dialog-in 0.16s ease-out; }
  @keyframes dialog-in { from { opacity: 0; transform: scale(0.98); } }
  dialog.sheet::before { display: none; }
  dialog.season-sheet { width: min(1040px, calc(100vw - 64px)); height: min(800px, calc(100vh - 64px)); height: min(800px, calc(100dvh - 64px)); }
  dialog.board-sheet { width: min(760px, calc(100vw - 64px)); height: min(820px, calc(100vh - 64px)); height: min(820px, calc(100dvh - 64px)); }
  dialog.teams-sheet { width: min(600px, calc(100vw - 64px)); height: fit-content; max-height: min(680px, calc(100vh - 64px)); max-height: min(680px, calc(100dvh - 64px)); }
  .teams-link { justify-content: center; width: 40px; height: 40px; margin: -6px -4px -6px 0; padding: 0; border: 0; background: none; }
  .teams-link:hover { background: var(--hover); }
  .teams-link span { display: none; }
  .teams-link svg { width: 24px; height: 24px; stroke-width: 2; }
  .picker-head { padding: 14px 10px 12px var(--gutter); }
  .picker-title h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .grid .mon img { width: 64px; height: 64px; }
  .roll-bar { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
  .roll-bar .bug.roll { width: auto; min-width: 300px; }
  .rerolls { display: flex; }
  .rerolls .btn { padding: 0 12px; }
  .cand-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .season-body { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 12px; }
  .season-card img { max-height: calc(min(800px, 100vh - 64px) - 200px); }
  .season-hint { margin-bottom: 0; }
  .season-games { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(9, auto); grid-auto-flow: column; gap: 4px 10px; }
  .season-actions { display: flex; align-items: center; }
  .season-actions .post-btn { flex: 1; min-width: 0; min-height: 46px; }
  .season-actions .post-note { flex: 1 1 100%; order: 3; }
  .season-actions .btn:not(.post-btn) { flex: none; padding: 0 16px; }
  .board-tabs { flex-direction: row; }
  .tabs-g { flex: 1; }
  .opts.tabs-s { grid-template-columns: repeat(2, 96px); }
  .opts.tabs-s label > span { min-height: 50px; }

  footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; margin: 0; padding: 22px 28px 28px; }
  footer .fine { max-width: 440px; margin: 0; font-size: 11.5px; text-align: right; }
}
/* Narrower wide screens: the menu drops "Challenge" and the header tightens so it all fits on one bar. */
@media (min-width: 1000px) and (max-width: 1279px) and (min-height: 560px) {
  .site-head { gap: 18px; padding: 0 22px; }
  .mode { padding: 0 12px; }
  .mode-170 > span, .mode-151 > span { display: none; }
  .main { padding-inline: 22px; gap: 22px; }
}
/* Under 1100px the six boxes take a size down as well, and the wordmark with them. */
@media (min-width: 1000px) and (max-width: 1099px) and (min-height: 560px) {
  .site-head { gap: 14px; }
  .wordmark { font-size: 22px; }
  .mode { gap: 6px; padding: 0 8px; }
  .mode svg { width: 16px; height: 16px; }
  .mode > span, .mode-big > span { font-size: 14px; }
  .mode-big b { font-size: 16px; }
  .mode-fd b { font-size: 14px; }
}
/* 1280–1359px: "Challenge" stays; the boxes and the header's gaps are a little narrower so the six fit. */
@media (min-width: 1280px) and (max-width: 1359px) and (min-height: 560px) {
  .site-head { gap: 24px; }
  .mode { padding: 0 11px; }
}

/* ======================================================================================== wide screens: height steps */
/* The controls column never scrolls (the owner asked for that): shorter windows get a tighter column. Measured with
   the column's content height in every state (builder, run setup, a round, placing, season over) from 560px up. */
@media (min-width: 1000px) and (min-height: 560px) and (max-height: 899px) {
  .row { min-height: 48px; }
  .opts label > span { min-height: 36px; }
  .opts.gens label > span { min-height: 40px; }
  .sec { margin-top: 18px; padding-bottom: 8px; }
  .draft-panel .sec { margin-top: 18px; }
  .bests { margin-top: 14px; }
  .bests > div { padding: 8px 12px; }
  .bests dd { font-size: 24px; }
  .discord-cta { margin-top: 8px; }
  .retro-note { margin-top: 4px; line-height: 1.3; }
  .pool-line { margin-top: 8px; line-height: 1.35; }
}
/* Under 800px: Defense, Offense and Kicker share one strip (label over the options) */
@media (min-width: 1000px) and (min-height: 560px) and (max-height: 799px) {
  .team-sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .team-sheet > .pool, .team-sheet > .sprites-row { grid-column: 1 / -1; }
  .team-sheet > .row:not(.sprites-row) { flex-direction: column; align-items: stretch; gap: 6px; min-height: 0; padding: 9px 8px 10px; border-top: 1px solid var(--line); }
  .team-sheet > .row:not(.sprites-row) + .row:not(.sprites-row) { border-left: 1px solid var(--line); }
  .team-sheet > .row:not(.sprites-row) .lbl { font-size: 12.5px; text-align: center; }
  .team-sheet > .row:not(.sprites-row) .opts.c2 { grid-template-columns: 1fr 1fr; }
  .team-sheet > .sprites-row { border-top: 1px solid var(--line); }
  .box.setup .row { min-height: 44px; }
  .title-block h1 { font-size: 28px; }
  .title-block { padding-bottom: 12px; }
  .pool { padding-block: 8px; }
  .pool-head { margin-bottom: 6px; }
  .pool-line { margin-top: 6px; }
  .discord-cta { margin-top: 6px; }
  .actions { gap: 5px; }
  .actions .btn { height: 42px; }
  .actions .btn.quiet { height: 38px; }
  .btn.big { height: 48px; font-size: 18px; }
  .callout { padding: 10px; font-size: 15px; }
  .rules { font-size: 13px; line-height: 1.45; }
  .rules-sprites { margin-top: 10px; }
  body.game-151 .pick-card { gap: 8px; padding: 10px 12px; }
  .reroll { height: 40px; }
}
/* Under 700px: the builder's and the run setup's descriptions make way for the controls */
@media (min-width: 1000px) and (min-height: 560px) and (max-height: 699px) {
  .desc.builder-only, #dp-setup > .desc { display: none; }
  .title-block { padding-bottom: 10px; }
  .pool-line { font-size: 12px; line-height: 1.35; }
  .sec { margin-top: 14px; padding-bottom: 6px; }
  .draft-panel .sec { margin-top: 14px; }
  .bests { margin-top: 12px; }
  .bests dd { font-size: 22px; }
  .rules { font-size: 12.5px; line-height: 1.4; }
  .opts label > span { min-height: 34px; }
  .opts.gens label > span { min-height: 36px; }
  .opts label > span small { margin-top: 1px; font-size: 10.5px; }
  .row { min-height: 44px; }
  .box.setup .row { min-height: 42px; }
  .discord-cta { height: 40px; margin-top: 6px; }
  .retro-note { font-size: 11.5px; }
  .dp-lb { margin-top: 8px; }
  #dp-start { margin-top: 10px; }
  .ticks, .squares { margin-top: 6px; }
  .callout { margin-top: 10px; padding: 8px; }
}
/* Under 620px: How it works keeps its Sprites row; its text and the Team sheet heading go */
@media (min-width: 1000px) and (min-height: 560px) and (max-height: 619px) {
  .title-block h1 { font-size: 26px; }
  .sec.builder-only { display: none; }
  .actions + .sec + .team-sheet, .actions ~ .team-sheet { margin-top: 10px; }
  .pool-line { display: none; }
  .draft-panel .sec, .rules { display: none; }
  .rules-sprites { margin-top: 10px; }
  .bests > div { padding: 6px 10px; }
  .bests dt { font-size: 11px; }
  .bests dd { font-size: 20px; }
  .meta { margin-top: 6px; }
  body[data-dp="placing"] .meta { margin-top: 8px; }
  body.game-151 .pick-card .thumb { width: 52px; height: 52px; }
  body.game-151 .pc-head b { font-size: 20px; }
  .cand-stats > span { font-size: 15px; }
}
/* 151, placing a pick, under 700px: its big pick card needs How it works' room (the Sprites row stays) */
@media (min-width: 1000px) and (min-height: 560px) and (max-height: 699px) {
  body.game-151[data-dp="placing"] .draft-panel .sec, body.game-151[data-dp="placing"] .rules { display: none; }
}
