/* Self-hosted fonts (SIL OFL 1.1, licences in /fonts). Latin + Latin
   Extended subsets, as Google Fonts serves them. No third-party requests. */
@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/press-start-2p-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/press-start-2p-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'VT323'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/vt323-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'VT323'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/vt323-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---- Palette ------------------------------------------------------------ */
:root {
  --red: #dc0a2d;
  --red-dark: #c8102e;
  --red-darker: #7a0117;
  --screen-bg: #eef3e8;
  --screen-dark: #1b1f1c;
  --ink: #1c1c1c;
  --blue: #2f6fb0;
  --blue-light: #6fb2e8;
  --amber: #f2b632;
  --green: #3fae57;
  --green-text: #1d7a36; /* --green fails AA as text on white */
  --grey: #cfd3ce;
  --gold: #e8b923;

  /* Theme tokens: what the rules below use. Light values here; the Night
     screen values follow. */
  color-scheme: light;
  --page-bg: #262a28;
  --surface: #fff;         /* panels, rows, tiles */
  --surface-2: #f3f5f1;    /* locked badges */
  --field: #fff;           /* inputs */
  --edge: var(--ink);      /* strong outlines */
  --line: #b7bdb2;         /* soft row borders */
  --rule: #c9cdc5;         /* dividers */
  --muted: #555a52;
  --track: #d9ded4;        /* progress bar background */
  --on-ink: #fff;          /* text on an --ink background */
  --link: #2f6fb0;
  --link-hover: #1f5288;
  --red-text: #c8102e;
  --money: #1d6b2f;
  --gold-text: #8a6508;
  --danger-text: #a01830;
  --warn-text: #8a4b00;
  --ghost-line: rgba(0,0,0,0.3);
  --want-bg: rgba(255,255,255,0.92);
  --want-on-bg: #fff8dc;
  --rare-tint: #fffbe8;
  --badge-tint: #f7f2ff;
  --badge-line: #b9a6de;
  --slab-tint: #eef2f4;
  --silhouette: brightness(0);
  --silhouette-op: 0.55;
}

/* ---- Night screen (dark mode, 2026-09-24) -------------------------------------
   Settings → Appearance: Follow device / Light / Dark, saved per trainer and
   mirrored to html[data-theme] by applyTheme() in app.js. The same values
   appear twice (device dark with no override, and an explicit Dark);
   test/theme.test.js fails if the two blocks drift apart. The red shell, the
   catch scene, slabs and the camera keep their own colours on purpose. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page-bg: #0d100e;
    --screen-bg: #1a1f1c;
    --ink: #e8efe4;
    --grey: #3a433d;
    --green-text: #6fcf87;
    --surface: #252b27;
    --surface-2: #1f2421;
    --field: #1f2521;
    --edge: #5b665e;
    --line: #3f4842;
    --rule: #3a423c;
    --muted: #a6b2a3;
    --track: #333b36;
    --on-ink: #1a1f1c;
    --link: #8cc1f0;
    --link-hover: #b5d8f7;
    --red-text: #ff7a8c;
    --money: #7fd494;
    --gold-text: #f0c75a;
    --danger-text: #ff8a99;
    --warn-text: #f2a65a;
    --ghost-line: rgba(255,255,255,0.3);
    --want-bg: rgba(37,43,39,0.92);
    --want-on-bg: #3d3620;
    --rare-tint: #3a3420;
    --badge-tint: #2c2638;
    --badge-line: #6f5f96;
    --slab-tint: #28303a;
    --silhouette: brightness(0) invert(1);
    --silhouette-op: 0.28;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #0d100e;
    --screen-bg: #1a1f1c;
    --ink: #e8efe4;
    --grey: #3a433d;
    --green-text: #6fcf87;
    --surface: #252b27;
    --surface-2: #1f2421;
    --field: #1f2521;
    --edge: #5b665e;
    --line: #3f4842;
    --rule: #3a423c;
    --muted: #a6b2a3;
    --track: #333b36;
    --on-ink: #1a1f1c;
    --link: #8cc1f0;
    --link-hover: #b5d8f7;
    --red-text: #ff7a8c;
    --money: #7fd494;
    --gold-text: #f0c75a;
    --danger-text: #ff8a99;
    --warn-text: #f2a65a;
    --ghost-line: rgba(255,255,255,0.3);
    --want-bg: rgba(37,43,39,0.92);
    --want-on-bg: #3d3620;
    --rare-tint: #3a3420;
    --badge-tint: #2c2638;
    --badge-line: #6f5f96;
    --slab-tint: #28303a;
    --silhouette: brightness(0) invert(1);
    --silhouette-op: 0.28;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page-bg);
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--ink);
}

body {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.app { width: 100%; max-width: 900px; }

button { font-family: inherit; cursor: pointer; color: var(--ink); }
input { font-family: inherit; }
/* Form controls don't inherit colours; element-level, so any class wins. */
input, select, textarea { background-color: var(--field); color: var(--ink); }

h1, h2, h3 { font-family: 'Press Start 2P', monospace; letter-spacing: 0.5px; }

/* ---- Pokédex chrome ------------------------------------------------------ */
.dex-shell {
  background: linear-gradient(160deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 0 3px rgba(0,0,0,0.15);
  border: 3px solid #700015;
}

.dex-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--red);
  border-radius: 10px 10px 0 0;
  border-bottom: 3px solid #a3021f;
}

.dex-lens {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #bfe9ff, var(--blue-light) 45%, var(--blue) 80%);
  border: 3px solid #1c3a52;
  box-shadow: 0 0 10px 2px rgba(111,178,232,0.7);
  position: relative;
  flex-shrink: 0;
}
.dex-lens-shine {
  position: absolute; top: 5px; left: 7px; width: 9px; height: 9px;
  background: rgba(255,255,255,0.85); border-radius: 50%;
}
.dex-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.3); }
.dex-dot--amber { background: var(--amber); }
.dex-dot--green { background: var(--green); }

.dex-screen {
  background: var(--screen-bg);
  border-radius: 0 0 10px 10px;
  border: 4px solid #111;
  padding: 16px;
  min-height: 200px;
}

.dex-screen--login {
  text-align: center;
  padding: 32px 24px 28px;
}

.brand { font-size: 22px; color: var(--red-text); margin: 6px 0 2px; }
.brand-sub { margin: 0 0 24px; opacity: 0.7; font-size: 18px; }

/* The hidden attribute must win over component display rules (.mini-row-wrap,
   .reset-out are flex), or "Show more" rows and empty boxes stay visible. */
[hidden] { display: none !important; }

/* ---- Login ---------------------------------------------------------------- */
.login-form { display: flex; flex-direction: column; gap: 14px; max-width: 280px; margin: 0 auto; text-align: center; }
/* Sign-in / join / reset text is centred throughout, wrapped lines included. */
.login-form input, #forgot-form input { text-align: center; }
#forgot-form { text-align: center; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.login-form input {
  font-size: 18px; padding: 8px 10px; border: 2px solid var(--edge); border-radius: 4px; background: var(--surface);
}
.login-error { color: var(--red-text); font-size: 16px; margin: 4px 0 0; }

.btn {
  font-size: 16px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 2px solid var(--edge);
  background: var(--grey);
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn--primary { background: var(--blue); color: #fff; border-color: #163656; }
.btn--gold { background: var(--gold); border-color: #7a5c0d; color: #1c1c1c; }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--ghost-line); }
.btn--sm { font-size: 13px; padding: 6px 10px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---- App header ---------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--red); border-radius: 10px 10px 0 0; border-bottom: 3px solid #a3021f;
  flex-wrap: wrap;
}
.topbar-count { color: #fff; font-family: 'Press Start 2P'; font-size: 11px; margin-left: auto; }

/* ---- Dex grid -------------------------------------------------------------- */
.gen-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.gen-tab {
  font-size: 14px; padding: 5px 10px; border-radius: 999px; border: 2px solid var(--edge);
  background: var(--surface);
}
.gen-tab.active { background: var(--blue); color: #fff; border-color: #163656; }

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; font-size: 18px; padding: 8px 10px; border: 2px solid var(--edge); border-radius: 4px; }

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.dex-slot {
  background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 6px 4px;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative;
}
.dex-slot.caught { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,185,35,0.35); }
.dex-sprite { position: relative; display: block; width: 56px; height: 56px; overflow: hidden; } /* zoomed sprites stay inside (no sideways scroll) */
/* Zoomed to the Pokémon's own bounding box by spriteFit() in app.js */
.dex-slot .dex-sprite img { position: absolute; max-width: none; height: auto; image-rendering: pixelated; }
.dex-slot.uncaught img { filter: var(--silhouette); opacity: var(--silhouette-op); }
.dex-slot-num { font-size: 16px; opacity: 0.6; } /* VT323 runs small: 12-13px was hard to read on iPad/desktop */
.dex-slot-name { font-size: 18px; line-height: 1.1; }
.dex-slot-tier {
  position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; transform: rotate(45deg);
  border: 1.5px solid var(--edge); box-shadow: 0 0 0 1px rgba(255,255,255,0.8);
}
.dex-slot-tier.tier-2, .dex-slot-tier.tier-3 { background: #cfd5dd; }
.dex-slot-tier.tier-4 { background: var(--gold); }
.dex-slot-tier.tier-5 { background: conic-gradient(#ff5b5b, #ffd84d, #5bd66b, #4da6ff, #b36bff, #ff5b5b); }
.dex-slot-tier.tier-6 { background: #e85a9a; }

/* ---- Search modal ---------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal {
  background: var(--screen-bg); border: 4px solid #111; border-radius: 10px;
  width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; padding: 18px;
}
.modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-header h2 { font-size: 15px; margin: 0; flex: 1; }

.pmon-list { display: flex; flex-direction: column; gap: 4px; }
.pmon-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 2px solid transparent;
  border-radius: 6px; background: var(--surface); text-align: left;
  font-size: 20px; color: var(--ink); width: 100%;
}
.pmon-row:hover { border-color: var(--link); }
.pmon-row img { width: 44px; height: 44px; image-rendering: pixelated; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
}
.card-tile {
  background: var(--surface); border: 2px solid var(--edge); border-radius: 8px; padding: 8px; text-align: center;
  display: flex; flex-direction: column; gap: 4px; font-size: 14px;
}
.card-tile img { width: 100%; border-radius: 4px; }
.card-tile .rarity { opacity: 0.7; }
.card-tile.owned { border-color: var(--green); }
.card-tile .owned-badge { color: var(--green-text); font-size: 12px; }

/* ---- Cutscene --------------------------------------------------------------- */
.cutscene {
  position: fixed; inset: 0; background: #1b1f1c; z-index: 100;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: #eee; text-align: center; overflow: hidden;
}
/* Battle-scene backdrop, drawn in CSS: sky + clouds, tree line on the
   horizon, a mown field, tall grass in the foreground, and the oval grass
   platform the wild Pokémon stands on. */
.cutscene-sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70px 20px at 16% 12%, #fff 62%, transparent 64%),
    radial-gradient(ellipse 48px 16px at 22% 9%, #fff 62%, transparent 64%),
    radial-gradient(ellipse 90px 22px at 80% 20%, #fff 62%, transparent 64%),
    radial-gradient(ellipse 56px 18px at 73% 17%, #fff 62%, transparent 64%),
    radial-gradient(ellipse 50px 14px at 52% 30%, rgba(255,255,255,0.85) 62%, transparent 64%),
    var(--sky, linear-gradient(180deg, #5fbde9 0%, #93d4f3 25%, #d4effa 42%));
}
.cutscene-field {
  position: absolute; left: 0; right: 0; top: 42%; bottom: 0;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,0.07) 0 16px, transparent 16px 32px),
    var(--field, linear-gradient(180deg, #8bd466 0%, #6cc04f 35%, #57a943 100%));
}
/* Tree line: two rows of round canopies sitting on the horizon. */
.cutscene-field::before {
  content: ''; position: absolute; left: 0; right: 0; top: -34px; height: 36px;
  background:
    radial-gradient(circle at 50% 100%, var(--tree-dark, #2c6e31) 0 20px, transparent 21px) 0 4px / 44px 36px repeat-x,
    radial-gradient(circle at 50% 100%, var(--tree-light, #3b8a3c) 0 16px, transparent 17px) 22px 0 / 44px 36px repeat-x;
}
.cutscene-grass {
  position: absolute; left: 0; right: 0; bottom: 0; height: 110px;
  filter: var(--grass-filter, none);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 90'%3E%3Cpath d='M0 90L5 34L10 90ZM8 90L15 18L21 90ZM19 90L25 40L30 90ZM28 90L36 12L42 90ZM40 90L46 30L51 90ZM49 90L56 20L62 90ZM58 90L62 38L64 90Z' fill='%232f7d33'/%3E%3Cpath d='M3 90L9 52L14 90ZM13 90L20 44L26 90ZM24 90L31 56L36 90ZM34 90L41 46L47 90ZM45 90L52 54L57 90ZM55 90L60 48L64 90Z' fill='%234aa845'/%3E%3C/svg%3E") 0 100% / 64px 110px repeat-x;
}
.cutscene-grass::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -12px; height: 70px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 90'%3E%3Cpath d='M0 90L5 34L10 90ZM8 90L15 18L21 90ZM19 90L25 40L30 90ZM28 90L36 12L42 90ZM40 90L46 30L51 90ZM49 90L56 20L62 90ZM58 90L62 38L64 90Z' fill='%232f7d33'/%3E%3Cpath d='M3 90L9 52L14 90ZM13 90L20 44L26 90ZM24 90L31 56L36 90ZM34 90L41 46L47 90ZM45 90L52 54L57 90ZM55 90L60 48L64 90Z' fill='%234aa845'/%3E%3C/svg%3E") 30px 100% / 52px 70px repeat-x;
  filter: brightness(1.12);
}
.encounter { position: relative; display: flex; justify-content: center; }
.encounter-base {
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 230px; height: 56px; border-radius: 50%;
  background: var(--base, radial-gradient(ellipse at 50% 38%, #b6e889 0 38%, #8fd068 62%, #6cae4f 100%));
  box-shadow: 0 5px 0 var(--base-edge, #4b8a3a), inset 0 -4px 0 rgba(0,0,0,0.08);
}
.encounter .encounter-sprite { position: relative; }
.cutscene-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; }

.encounter-sprite {
  width: 160px; height: 160px; object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,0.5));
  animation: encounter-pop 0.5s ease-out;
}
@keyframes encounter-pop {
  0% { transform: scale(0.2) translateY(40px); opacity: 0; }
  70% { transform: scale(1.1) translateY(-6px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

.cutscene-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  background: #fff; color: #111; padding: 14px 18px; border-radius: 6px;
  border: 3px solid #111; min-height: 1.4em; min-width: 260px;
}

.ball {
  width: 46px; height: 46px; border-radius: 50%;
  position: relative;
  background: linear-gradient(180deg, var(--ball-top, #d33) 0 48%, #111 48% 52%, #fff 52% 100%);
  border: 3px solid #111;
}
.ball::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px;
  background: #fff; border: 3px solid #111; border-radius: 50%; transform: translate(-50%, -50%);
}
.ball--poke { --ball-top: #dc0a2d; }
.ball--great { --ball-top: #2f6fb0; }
.ball--ultra { --ball-top: #f2b632; }
.ball--master { --ball-top: #6a2fb0; }

.ball-throw { animation: ball-arc 0.9s ease-in forwards; }
@keyframes ball-arc {
  0% { transform: translate(-120px, 60px) scale(0.6) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(0, 0) scale(1) rotate(420deg); opacity: 1; }
}
.ball-shake { animation: ball-shake 0.55s ease-in-out; }
@keyframes ball-shake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-18deg); }
  40% { transform: rotate(16deg); }
  60% { transform: rotate(-12deg); }
  80% { transform: rotate(8deg); }
}
.ball-flash {
  position: absolute; inset: -30px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255,255,255,0) 70%);
  animation: ball-flash 0.5s ease-out forwards;
}
@keyframes ball-flash { 0% { opacity: 0; transform: scale(0.3); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(2.4); } }

/* Solid, so it shows on dark scenes (rain, electric) too. */
.cutscene-skip { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(255,255,255,0.92); color: #111; border-color: #111; }

.catch-result { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.catch-result img.card-final { width: 160px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.6); }
/* A pill, so the rarity reads on any scene. */
.catch-banner { font-family: 'Press Start 2P'; font-size: 13px; color: var(--gold); background: rgba(0,0,0,0.72); padding: 6px 10px; border-radius: 6px; text-shadow: 0 1px 0 #000; }

/* ---- Dex entry ---------------------------------------------------------------- */
.catch-history { display: flex; flex-direction: column; gap: 8px; }
.catch-item { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 8px; }
.catch-item.best { border-color: var(--gold); }
.catch-item img { width: 44px; border-radius: 4px; }
.catch-item .meta { flex: 1; font-size: 15px; }
.catch-item .best-tag { color: var(--gold-text); font-size: 13px; } /* darker gold: 5.4:1 on white */

/* Muted text, not opacity: opacity also faded buttons inside (Browse cards
   on an empty Wants read as disabled, and failed contrast). */
.empty-state { text-align: center; padding: 30px 10px; color: color-mix(in srgb, currentColor 72%, transparent); }


@media (max-width: 480px) {
  body { font-size: 18px; }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .dex-sprite { width: 46px; height: 46px; }
}

/* ---- Views: Pokédex / Sets / Stats ------------------------------------------------ */
/* The section tabs stay pinned under the top bar on every tab, so another
   section is one tap away from the bottom of the 1,025-slot dex. */
.tabs-bar {
  position: sticky; top: var(--topbar-h, 0px); z-index: 16;
  background: var(--screen-bg); margin: -4px -16px 10px; padding: 6px 16px 4px;
}
.tabs-bar--shadow { box-shadow: 0 6px 6px -6px rgba(0, 0, 0, 0.25); }
.view-tabs { display: flex; gap: 0; margin: 0; border: 2px solid var(--edge); border-radius: 8px; overflow: hidden; }
.view-tab {
  flex: 1; font-family: 'Press Start 2P', monospace; font-size: 10px; padding: 10px 4px;
  background: var(--surface); border: 0; border-right: 2px solid var(--edge);
}
.view-tab:last-child { border-right: 0; }
.view-tab.active { background: var(--red-dark); color: #fff; }

.section-title { font-size: 11px; margin: 18px 0 10px; }
.section-title:first-child { margin-top: 4px; }
.hint { font-size: 15px; opacity: 0.65; margin: 8px 0; }

.bar { display: block; height: 10px; background: var(--track); border: 2px solid var(--edge); border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); }
.bar-fill--gold { background: var(--gold); }

/* Sets */
.set-list { display: flex; flex-direction: column; gap: 6px; }
.set-row {
  display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
.set-row:hover { border-color: var(--link); }
.set-symbol { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.set-row-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; font-size: 17px; }
.set-row-sub { font-size: 15px; opacity: 0.7; }
.set-logo { display: block; max-width: 220px; max-height: 80px; margin: 0 auto 8px; object-fit: contain; }
.set-progress-label { margin: 4px 0; text-align: center; }
.card-tile.missing img { filter: grayscale(1); opacity: 0.45; }

/* Card picker */
.picker-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; align-items: center; }
.picker-controls input[type="text"] { flex: 1 1 220px; font-size: 17px; padding: 7px 9px; border: 2px solid var(--edge); border-radius: 4px; }
.picker-controls select { font-family: inherit; font-size: 16px; padding: 6px; border: 2px solid var(--edge); border-radius: 4px; background: var(--surface); }
.check { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.card-meta { font-size: 13px; opacity: 0.75; }
.price { font-weight: bold; color: var(--money); }
#pmon-search { width: 100%; font-size: 18px; padding: 8px 10px; border: 2px solid var(--edge); border-radius: 4px; }

/* Dex entry copies */
.catch-item { align-items: flex-start; }
.catch-item-actions { display: flex; flex-direction: column; gap: 4px; }
.copy-details { font-size: 14px; color: var(--link); }
.copy-money { font-size: 14px; color: var(--money); }
.copy-notes { font-size: 14px; font-style: italic; opacity: 0.8; }

/* Edit form */
.edit-form { display: flex; flex-direction: column; gap: 12px; }
.edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 17px; }
.edit-form input, .edit-form select, .edit-form textarea {
  font-family: inherit; font-size: 17px; padding: 7px 9px; border: 2px solid var(--edge); border-radius: 4px; background: var(--surface);
}

/* Cutscene result buttons */
.catch-actions { display: flex; gap: 10px; }
.btn--light { background: var(--surface); }
/* Destructive confirm (Remove, Approve a password change). White on #c8102e is 5.9:1. */
.btn--danger { background: var(--red-dark); color: #fff; border-color: #7d0a1c; }

/* Stats */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat-tile { background: var(--surface); border: 2px solid var(--edge); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: 'Press Start 2P', monospace; font-size: 14px; color: var(--red-text); }
.stat-label { font-size: 15px; opacity: 0.75; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 64px; gap: 8px; align-items: center; font-size: 16px; }
.bar-num { text-align: right; opacity: 0.75; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-row {
  display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%;
}
.mini-row img { width: 36px; border-radius: 3px; }
.mini-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 16px; }
.mini-row-right { font-size: 16px; color: var(--money); white-space: nowrap; }

@media (max-width: 480px) {
  .bar-row { grid-template-columns: 96px 1fr 56px; }
  .view-tab { font-size: 9px; }
  .stat-tiles { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 12px; }
}

/* ---- Mobile readability (2026-09-21) ---------------------------------------
   VT323 renders roughly a third smaller than a normal font at the same px, so
   the desktop sizes (12-15px on labels/meta) are unreadable on a phone. The
   earlier mobile blocks only ever shrank things; this one scales text up. */
@media (max-width: 600px) {
  html, body { font-size: 22px; }
  .brand-sub, .login-form label, .search-bar input,
  #pmon-search { font-size: 20px; }
  .btn { font-size: 18px; }
  .btn--sm { font-size: 17px; padding: 8px 12px; }
  .topbar-count { font-size: 12px; }
  .gen-tab { font-size: 17px; padding: 6px 12px; }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .dex-slot-num { font-size: 16px; }
  .dex-slot-name { font-size: 18px; }
  .dex-slot-tier { width: 10px; height: 10px; }
  .modal-header h2 { font-size: 14px; line-height: 1.4; }
  .card-tile, .card-tile .owned-badge { font-size: 18px; }
  /* Wider tiles for the larger text, so Got it! and ✕ stay on one line. */
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .wish-tile .wish-actions .btn { white-space: nowrap; }
  .catch-banner { font-size: 13px; }
  .catch-item .meta { font-size: 19px; }
  .catch-item .best-tag { font-size: 17px; }
  .view-tab { font-size: 10px; padding: 12px 4px; }
  .section-title { font-size: 12px; line-height: 1.5; }
  .hint { font-size: 18px; }
  .set-row-main { font-size: 20px; }
  .set-row-sub { font-size: 18px; }
  .picker-controls input[type="text"], .edit-form label,
  .edit-form input, .edit-form select, .edit-form textarea { font-size: 19px; }
  .picker-controls select, .check { font-size: 18px; }
  .card-meta { font-size: 17px; }
  .copy-details, .copy-money, .copy-notes { font-size: 18px; }
  .stat-value { font-size: 14px; }
  .stat-label { font-size: 18px; }
  .bar-row { font-size: 18px; grid-template-columns: 104px 1fr 64px; }
  .mini-row-main, .mini-row-right { font-size: 19px; }
  .login-error { font-size: 18px; }
}

/* ---- Card zoom (tap a logged card's thumbnail) ------------------------------ */
.catch-item img.zoomable { cursor: zoom-in; }
.card-zoom {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; cursor: zoom-out;
}
.card-zoom img {
  max-width: min(100%, 480px); max-height: calc(100vh - 80px); object-fit: contain;
  border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
.card-zoom p { margin: 0; color: #ddd; font-size: 18px; opacity: 0.8; }
.card-zoom { padding: 0; }
.card-zoom > .pager-track { width: 100%; height: 100%; }
.card-zoom .pager-page { background: none; }
.zoom-page {
  position: relative; height: 100%; box-sizing: border-box; padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.zoom-page.pager-page--float { bottom: 0; }

/* ---- Accounts: sign in / register tabs, name prompt, account modal ---------- */
.auth-tabs { display: flex; max-width: 280px; margin: 0 auto 18px; border: 2px solid var(--edge); border-radius: 8px; overflow: hidden; }
.auth-tab {
  flex: 1; font-family: 'Press Start 2P', monospace; font-size: 10px; padding: 10px 4px;
  background: var(--surface); border: 0; color: var(--ink);
}
.auth-tab + .auth-tab { border-left: 2px solid var(--edge); }
.auth-tab.active { background: var(--red-dark); color: #fff; }
.field-hint { font-size: 15px; color: var(--muted); }
/* A button that reads as a link: centred under Sign in, full tap height. */
.link-btn {
  display: block; margin: 4px auto 0; min-height: 44px; padding: 8px 12px;
  background: none; border: 0; font-size: 18px; color: var(--link);
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--link-hover); }
.forgot-done { width: 100%; }
.welcome { margin: 0 0 4px; font-size: 19px; text-align: center; }
.form-msg { margin: 0; min-height: 1em; font-size: 16px; }
.form-msg.ok { color: var(--money); }
.form-msg.err { color: var(--red-text); }

/* ---- Leaderboard ------------------------------------------------------------- */
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.lb-row.me { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,185,35,0.35); }
.lb-rank { font-size: 13px; min-width: 38px; text-align: center; font-family: 'Press Start 2P', monospace; }
.lb-rank.medal {
  display: inline-flex; align-items: center; justify-content: center; justify-self: center;
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%; color: #1c1c1c; border: 2px solid var(--edge); font-size: 13px;
}
.lb-rank.medal-1 { background: var(--gold); }
.lb-rank.medal-2 { background: #cfd5dd; }
.lb-rank.medal-3 { background: #d99a5b; }
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 19px; }
.lb-main > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 15px; opacity: 0.7; }
.lb-you { color: var(--gold-text); font-weight: normal; }
.lb-score { font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--red-text); white-space: nowrap; }

@media (max-width: 600px) {
  .auth-tab { font-size: 11px; padding: 12px 4px; }
  .field-hint { font-size: 17px; }
  .lb-main { font-size: 21px; }
  .lb-sub { font-size: 17px; }
  .lb-score { font-size: 11px; }
}

/* ---- Type-themed catch scenes ---------------------------------------------------
   The meadow above is the default (Normal/Grass). Each scene only swaps the
   palette variables; night scenes also replace the clouds with stars.
   .cutscene-fx carries weather (snow, embers, rain…) above the backdrop and
   below the Pokémon. */
.cutscene-fx { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

.cutscene[data-scene="forest"] {
  --sky: linear-gradient(180deg, #7cc4a8 0%, #b5e0c2 25%, #dff2df 42%);
  --field: linear-gradient(180deg, #5da047 0%, #4a8a3a 40%, #3c7430 100%);
  --tree-dark: #174a1f; --tree-light: #23602a;
  --grass-filter: brightness(0.85);
}
.cutscene[data-scene="forest"] .cutscene-field::before { top: -58px; height: 60px; background-size: 30px 60px, 30px 60px; }

.cutscene[data-scene="volcano"] {
  --sky: linear-gradient(180deg, #2a0707 0%, #8f1f0d 28%, #f07a2a 42%);
  --field: linear-gradient(180deg, #6a2c18 0%, #45190f 45%, #2c0f09 100%);
  --tree-dark: #2a0d08; --tree-light: #4a1a0f;
  --grass-filter: hue-rotate(-95deg) saturate(1.6) brightness(0.95);
  --base: radial-gradient(ellipse at 50% 38%, #b3542a 0 38%, #8a3a1c 62%, #5e2412 100%);
  --base-edge: #3a140a;
}
.cutscene[data-scene="volcano"] .cutscene-sky { filter: saturate(0.6) brightness(0.8); }
.cutscene[data-scene="volcano"] .cutscene-fx {
  background:
    radial-gradient(circle 2px at 20% 30%, #ffb347 90%, transparent),
    radial-gradient(circle 1.5px at 60% 70%, #ff7a1a 90%, transparent),
    radial-gradient(circle 2px at 85% 50%, #ffd27a 90%, transparent);
  background-size: 140px 160px, 110px 130px, 170px 190px;
  animation: fx-rise 4s linear infinite;
}

.cutscene[data-scene="sea"] {
  --field:
    repeating-linear-gradient(180deg, rgba(255,255,255,0.18) 0 3px, transparent 3px 22px),
    linear-gradient(180deg, #3aa6dc 0%, #1f73b8 45%, #124f8a 100%);
  --tree-dark: transparent; --tree-light: transparent;
  --base: radial-gradient(ellipse at 50% 38%, #fbe7b0 0 38%, #efd08a 62%, #d8b265 100%);
  --base-edge: #b89048;
}
.cutscene[data-scene="sea"] .cutscene-grass,
.cutscene[data-scene="sky"] .cutscene-grass,
.cutscene[data-scene="city"] .cutscene-grass { display: none; }
.cutscene[data-scene="sea"] .cutscene-fx {
  background:
    radial-gradient(circle 5px at 30% 40%, transparent 60%, rgba(255,255,255,0.7) 65%, transparent 80%),
    radial-gradient(circle 3px at 70% 80%, transparent 55%, rgba(255,255,255,0.6) 62%, transparent 80%);
  background-size: 130px 170px, 90px 120px;
  animation: fx-rise 6s linear infinite;
}

.cutscene[data-scene="snow"] {
  --sky: linear-gradient(180deg, #8fb4cf 0%, #c6dcea 25%, #eef6fb 42%);
  --field: linear-gradient(180deg, #f7fbfe 0%, #e3eef5 45%, #cddfea 100%);
  --tree-dark: #5f8599; --tree-light: #93b6c8;
  --grass-filter: hue-rotate(95deg) saturate(0.35) brightness(1.7);
  --base: radial-gradient(ellipse at 50% 38%, #ffffff 0 38%, #e3eff7 62%, #c3d9e8 100%);
  --base-edge: #9dbcd1;
}
.cutscene[data-scene="snow"] .cutscene-fx {
  background:
    radial-gradient(circle 3px at 25% 20%, #fff 90%, transparent),
    radial-gradient(circle 2px at 70% 60%, #fff 90%, transparent),
    radial-gradient(circle 2.5px at 45% 85%, rgba(255,255,255,0.9) 90%, transparent);
  background-size: 120px 140px, 90px 110px, 160px 170px;
  animation: fx-fall 7s linear infinite;
}

.cutscene[data-scene="storm"] {
  --sky: linear-gradient(180deg, #232738 0%, #444a66 28%, #7d839e 42%);
  --field: linear-gradient(180deg, #b9ad48 0%, #978b2c 45%, #726821 100%);
  --tree-dark: #2e3522; --tree-light: #414a2e;
  --grass-filter: hue-rotate(-38deg) saturate(1.3) brightness(0.95);
  --base: radial-gradient(ellipse at 50% 38%, #f3de5a 0 38%, #d7bd33 62%, #ab931c 100%);
  --base-edge: #7c6a12;
}
.cutscene[data-scene="storm"] .cutscene-sky { filter: grayscale(0.7) brightness(0.75); }
.cutscene[data-scene="storm"] .cutscene-fx {
  background: repeating-linear-gradient(105deg, transparent 0 14px, rgba(200,215,255,0.35) 14px 15px, transparent 15px 34px);
  background-size: 200px 200px;
  animation: fx-rain 0.5s linear infinite;
}
.cutscene[data-scene="storm"] .cutscene-fx::after {
  content: ''; position: absolute; inset: 0; background: #fffbe0; opacity: 0;
  animation: fx-lightning 5s infinite;
}

/* Night scenes: stars and a moon instead of clouds. */
.cutscene[data-scene="night"] .cutscene-sky,
.cutscene[data-scene="haunted"] .cutscene-sky {
  background:
    radial-gradient(circle 22px at 80% 14%, #fff8d6 90%, transparent 100%),
    radial-gradient(circle 1.5px at 12% 10%, #fff 90%, transparent),
    radial-gradient(circle 1px at 30% 24%, #fff 90%, transparent),
    radial-gradient(circle 1.5px at 48% 8%, #fff 90%, transparent),
    radial-gradient(circle 1px at 62% 30%, #fff 90%, transparent),
    radial-gradient(circle 1px at 92% 34%, #fff 90%, transparent),
    radial-gradient(circle 1.5px at 22% 36%, #fff 90%, transparent),
    var(--sky);
}
.cutscene[data-scene="night"] {
  --sky: linear-gradient(180deg, #04060f 0%, #111a38 28%, #27325c 42%);
  --field: linear-gradient(180deg, #2a3a26 0%, #1c2919 45%, #121b10 100%);
  --tree-dark: #070d07; --tree-light: #0f1a0f;
  --grass-filter: brightness(0.45);
  --base: radial-gradient(ellipse at 50% 38%, #4f6b3d 0 38%, #3b5230 62%, #2a3b22 100%);
  --base-edge: #18230f;
}
.cutscene[data-scene="haunted"] {
  --sky: linear-gradient(180deg, #0f0920 0%, #2b1a4a 28%, #4d3472 42%);
  --field: linear-gradient(180deg, #312b40 0%, #221e2e 45%, #16131f 100%);
  --tree-dark: #0e0b15; --tree-light: #1b1626;
  --grass-filter: hue-rotate(150deg) saturate(0.5) brightness(0.5);
  --base: radial-gradient(ellipse at 50% 38%, #5d4f75 0 38%, #463a5c 62%, #2f2640 100%);
  --base-edge: #1c1528;
}
.cutscene[data-scene="haunted"] .cutscene-fx {
  background: radial-gradient(ellipse 60% 18% at 50% 72%, rgba(200,180,255,0.18), transparent 70%);
  animation: fx-fog 6s ease-in-out infinite alternate;
}
.cutscene[data-scene="night"] .cutscene-fx,
.cutscene[data-scene="haunted"] .cutscene-sky { animation: fx-twinkle 3s ease-in-out infinite alternate; }

.cutscene[data-scene="mystic"] {
  --sky: linear-gradient(180deg, #e46fb1 0%, #f2a8d3 25%, #fde2f1 42%);
  --field: linear-gradient(180deg, #c49ada 0%, #a076c2 45%, #7d55a0 100%);
  --tree-dark: #6a3f8c; --tree-light: #8b5fae;
  --grass-filter: hue-rotate(165deg) saturate(0.9);
  --base: radial-gradient(ellipse at 50% 38%, #f1d4fa 0 38%, #dcb2ee 62%, #b98bd6 100%);
  --base-edge: #8a5fae;
}
.cutscene[data-scene="fairy"] {
  --sky: linear-gradient(180deg, #ffb9dc 0%, #ffd6ea 25%, #fff2f8 42%);
  --field: linear-gradient(180deg, #f8bdd6 0%, #ef9dc1 45%, #e07fab 100%);
  --tree-dark: #e0689d; --tree-light: #f292bb;
  --grass-filter: hue-rotate(215deg) saturate(0.8) brightness(1.15);
  --base: radial-gradient(ellipse at 50% 38%, #fff0f7 0 38%, #fbd3e6 62%, #f2afcf 100%);
  --base-edge: #d9749f;
}
.cutscene[data-scene="mystic"] .cutscene-fx,
.cutscene[data-scene="fairy"] .cutscene-fx {
  background:
    radial-gradient(circle 2px at 20% 30%, #fff 90%, transparent),
    radial-gradient(circle 1.5px at 70% 65%, #fff6c9 90%, transparent),
    radial-gradient(circle 2px at 45% 80%, #fff 90%, transparent);
  background-size: 110px 130px, 150px 120px, 90px 170px;
  animation: fx-twinkle 1.6s ease-in-out infinite alternate, fx-rise 9s linear infinite;
}

.cutscene[data-scene="desert"] {
  --sky: linear-gradient(180deg, #e9a95a 0%, #f3cb8a 25%, #f9e6bf 42%);
  --field:
    repeating-linear-gradient(180deg, rgba(255,255,255,0.08) 0 10px, transparent 10px 26px),
    linear-gradient(180deg, #ddab66 0%, #c38b48 45%, #a06c33 100%);
  --tree-dark: #93522a; --tree-light: #b0693a;
  --grass-filter: hue-rotate(-62deg) saturate(0.55) brightness(1.15);
  --base: radial-gradient(ellipse at 50% 38%, #edc58c 0 38%, #d9a96a 62%, #bd8a4b 100%);
  --base-edge: #93612d;
}
.cutscene[data-scene="desert"] .cutscene-field::before { background-size: 70px 36px, 90px 36px; }

.cutscene[data-scene="mountain"] {
  --sky: linear-gradient(180deg, #d9502f 0%, #f0934c 26%, #fbd08c 42%);
  --field: linear-gradient(180deg, #b98a50 0%, #93683a 45%, #6e4b28 100%);
  --tree-dark: #5b3222; --tree-light: #7a4630;
  --grass-filter: hue-rotate(-50deg) saturate(0.8);
  --base: radial-gradient(ellipse at 50% 38%, #d8b07a 0 38%, #bf935b 62%, #9c7340 100%);
  --base-edge: #6e4b28;
}
.cutscene[data-scene="mountain"] .cutscene-field::before {
  top: -70px; height: 72px;
  background:
    linear-gradient(135deg, transparent 50%, var(--tree-dark) 50%) 0 0 / 72px 72px repeat-x,
    linear-gradient(225deg, transparent 50%, var(--tree-dark) 50%) 36px 0 / 72px 72px repeat-x;
}

.cutscene[data-scene="swamp"] {
  --sky: linear-gradient(180deg, #5b4c78 0%, #8a7ba8 26%, #b7aecb 42%);
  --field: linear-gradient(180deg, #56643c 0%, #414c2c 45%, #2f381f 100%);
  --tree-dark: #262f1b; --tree-light: #36422a;
  --grass-filter: hue-rotate(35deg) saturate(0.6) brightness(0.8);
  --base: radial-gradient(ellipse at 50% 38%, #8a6bb0 0 38%, #6f5294 62%, #533c73 100%);
  --base-edge: #3a2852;
}
.cutscene[data-scene="swamp"] .cutscene-fx {
  background:
    radial-gradient(circle 5px at 30% 60%, rgba(190,120,230,0.55) 80%, transparent),
    radial-gradient(circle 3px at 75% 85%, rgba(160,220,90,0.5) 80%, transparent);
  background-size: 150px 180px, 110px 140px;
  animation: fx-rise 7s linear infinite;
}

.cutscene[data-scene="sky"] {
  --sky: linear-gradient(180deg, #3f9fdc 0%, #79c3ee 40%, #bfe4f8 70%);
  --field:
    radial-gradient(ellipse 90px 30px at 15% 10%, #fff 62%, transparent 64%),
    radial-gradient(ellipse 120px 34px at 70% 5%, #fff 62%, transparent 64%),
    linear-gradient(180deg, #f4fbff 0%, #dff1fb 100%);
  --tree-dark: transparent; --tree-light: transparent;
  --base: radial-gradient(ellipse at 50% 38%, #ffffff 0 45%, #eaf6fd 70%, #cfe7f5 100%);
  --base-edge: #b3d4ea;
}

.cutscene[data-scene="dusk"] {
  --sky: linear-gradient(180deg, #1b1a4d 0%, #57388a 24%, #e07a4f 42%);
  --field: linear-gradient(180deg, #4b5a7c 0%, #36425f 45%, #242c42 100%);
  --tree-dark: #221d40; --tree-light: #332b58;
  --grass-filter: hue-rotate(190deg) saturate(0.5) brightness(0.6);
  --base: radial-gradient(ellipse at 50% 38%, #8290b3 0 38%, #69779a 62%, #4c587a 100%);
  --base-edge: #2e3753;
}
.cutscene[data-scene="dusk"] .cutscene-fx { background: radial-gradient(circle 1px at 30% 10%, #fff 90%, transparent) 0 0 / 80px 60px; opacity: 0.7; }

.cutscene[data-scene="city"] {
  --sky: linear-gradient(180deg, #9aa7b4 0%, #c3ccd5 26%, #e3e8ed 42%);
  --field:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 48px),
    linear-gradient(180deg, #a3abb3 0%, #8a939b 45%, #6f7880 100%);
  --base: radial-gradient(ellipse at 50% 38%, #dfe4e8 0 38%, #c3cad0 62%, #9ea7ae 100%);
  --base-edge: #6f7880;
}
.cutscene[data-scene="city"] .cutscene-field::before {
  top: -64px; height: 66px;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, #5b646c 8px 40px, transparent 40px 58px) 0 100% / 100% 42px no-repeat,
    repeating-linear-gradient(90deg, #7a848d 0 24px, transparent 24px 76px) 0 0 / 100% 66px no-repeat;
}

@keyframes fx-fall { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 30px 140px, -20px 110px, 20px 170px; } }
@keyframes fx-rise { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 10px -160px, -10px -130px, 0 -190px; } }
@keyframes fx-rain { from { background-position: 0 0; } to { background-position: -40px 200px; } }
@keyframes fx-lightning { 0%, 88%, 92%, 100% { opacity: 0; } 89% { opacity: 0.55; } 91% { opacity: 0.25; } }
@keyframes fx-twinkle { from { opacity: 0.65; } to { opacity: 1; } }
@keyframes fx-fog { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
@media (prefers-reduced-motion: reduce) {
  .cutscene-fx, .cutscene-fx::after, .cutscene-sky { animation: none !important; }
}

/* Type badges (dex entry). Official game colours. */
.type-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.type-badge {
  font-family: 'Press Start 2P', monospace; font-size: 9px; text-transform: uppercase;
  color: #fff; padding: 5px 8px; border-radius: 4px; text-shadow: 0 1px 0 rgba(0,0,0,0.4);
  background: #a8a77a;
}
/* Type colours (dex badges, filter chips). Official hues, shade-adjusted where
   needed so the label meets WCAG AA 4.5:1; text is white or ink, whichever reads better. */
.type-normal { --tc: #a8a77a; --tt: #1c1c1c; } /* #a8a77a -> #a8a77a, 6.9:1 */
.type-fire { --tc: #ee8130; --tt: #1c1c1c; } /* #ee8130 -> #ee8130, 6.3:1 */
.type-water { --tc: #6390f0; --tt: #1c1c1c; } /* #6390f0 -> #6390f0, 5.5:1 */
.type-electric { --tc: #d9b51c; --tt: #1c1c1c; } /* #d9b51c -> #d9b51c, 8.6:1 */
.type-grass { --tc: #5fae3c; --tt: #1c1c1c; } /* #5fae3c -> #5fae3c, 6.2:1 */
.type-ice { --tc: #6fc7c2; --tt: #1c1c1c; } /* #6fc7c2 -> #6fc7c2, 8.6:1 */
.type-fighting { --tc: #c22e28; --tt: #fff; } /* #c22e28 -> #c22e28, 5.7:1 */
.type-poison { --tc: #a33ea1; --tt: #fff; } /* #a33ea1 -> #a33ea1, 5.6:1 */
.type-ground { --tc: #c9a547; --tt: #1c1c1c; } /* #c9a547 -> #c9a547, 7.3:1 */
.type-flying { --tc: #8f79e0; --tt: #1c1c1c; } /* #8f79e0 -> #8f79e0, 4.9:1 */
.type-psychic { --tc: #f95587; --tt: #1c1c1c; } /* #f95587 -> #f95587, 5.4:1 */
.type-bug { --tc: #93a51a; --tt: #1c1c1c; } /* #93a51a -> #93a51a, 6.2:1 */
.type-rock { --tc: #b6a136; --tt: #1c1c1c; } /* #b6a136 -> #b6a136, 6.6:1 */
.type-ghost { --tc: #735797; --tt: #fff; } /* #735797 -> #735797, 5.9:1 */
.type-dragon { --tc: #6f35fc; --tt: #fff; } /* #6f35fc -> #6f35fc, 5.8:1 */
.type-dark { --tc: #705746; --tt: #fff; } /* #705746 -> #705746, 6.7:1 */
.type-steel { --tc: #8f8fb0; --tt: #1c1c1c; } /* #8f8fb0 -> #8f8fb0, 5.5:1 */
.type-fairy { --tc: #d685ad; --tt: #1c1c1c; } /* #d685ad -> #d685ad, 6.3:1 */
.type-badge { background: var(--tc, #a8a77a); color: var(--tt, #1c1c1c); text-shadow: none; }
@media (max-width: 600px) { .type-badge { font-size: 10px; } }
/* Keep the catch-scene text box off the screen edges on phones. */
.cutscene-text { max-width: calc(100vw - 32px); box-sizing: border-box; }

/* ---- Wishlist star on card tiles --------------------------------------------- */
.card-tile { position: relative; }
.want-btn {
  position: absolute; top: 4px; right: 4px; z-index: 1; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1;
  background: var(--want-bg); border: 2px solid var(--edge); border-radius: 50%; color: var(--muted); cursor: pointer;
}
.want-btn.on { color: var(--gold); background: var(--want-on-bg); border-color: #7a5c0d; }

/* ---- Achievements --------------------------------------------------------------- */
.badge-group { margin: 12px 0 6px; font-size: 16px; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.badge {
  background: var(--surface); border: 2px solid var(--gold); border-radius: 8px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
}
.badge.locked { border-color: var(--rule); background: var(--surface-2); }
.badge.locked .badge-icon { filter: grayscale(1); opacity: 0.45; }
.badge-icon { position: relative; display: block; width: 48px; height: 48px; overflow: hidden; margin: 0 auto; }
.badge-icon img { position: absolute; image-rendering: pixelated; }
.badge-name { font-size: 17px; font-weight: bold; }
.badge-desc { font-size: 14px; opacity: 0.7; line-height: 1.1; }
.badge .bar { width: 100%; margin-top: 4px; }
#all-badges { margin: 4px 0 8px; }

/* ---- Leaderboard buttons, feed, profiles ------------------------------------------- */
button.lb-row { width: 100%; text-align: left; font-family: inherit; color: inherit; cursor: pointer; }
.feed { display: flex; flex-direction: column; gap: 6px; }
.feed-item {
  display: flex; gap: 10px; align-items: center; background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.feed-item img { width: 40px; border-radius: 3px; cursor: zoom-in; }
.feed-item--rare { border-color: var(--gold); background: linear-gradient(90deg, var(--rare-tint), var(--surface)); }
.feed-item--badge { background: var(--badge-tint); border-color: var(--badge-line); }
.feed-icon { display: flex; min-width: 40px; max-width: 72px; justify-content: center; }
.feed-icon img { width: 36px; height: 36px; margin: 0 -6px; image-rendering: pixelated; }
.feed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 17px; line-height: 1.15; }
.feed-sub { font-size: 14px; opacity: 0.7; }
.feed-when { font-size: 14px; color: var(--muted); }
.feed-who { background: none; border: 0; padding: 0; font: inherit; color: var(--link); font-weight: bold; cursor: pointer; text-align: left; display: inline; }
.profile-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.profile-cards > img, .profile-card img { width: 100%; border-radius: 5px; cursor: zoom-in; display: block; }
.profile-card { margin: 0; }
.profile-card figcaption { font-size: 13px; text-align: center; opacity: 0.75; margin-top: 2px; }
.profile-card.holo img { box-shadow: 0 0 0 2px var(--gold); }

/* ---- Shiny pulls ------------------------------------------------------------------ */
.card-final-wrap { position: relative; border-radius: 8px; overflow: hidden; line-height: 0; }
.card-final-wrap.holo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.55) 38%, rgba(160,220,255,0.45) 45%, rgba(255,180,240,0.45) 52%, transparent 70%);
  background-size: 250% 100%; animation: holo-sweep 2.4s ease-in-out infinite;
}
.card-final-wrap.shiny { box-shadow: 0 0 0 3px #ffd84d, 0 0 28px 6px rgba(255,216,77,0.75); animation: shiny-pulse 1.6s ease-in-out infinite; }
@keyframes holo-sweep { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes shiny-pulse { 50% { box-shadow: 0 0 0 3px #fff3b0, 0 0 40px 12px rgba(255,216,77,0.95); } }
.ball-flash--shiny {
  inset: -60px;
  background: radial-gradient(circle, #fffbe0 0%, rgba(255,215,64,0.95) 30%, rgba(255,120,200,0.5) 55%, rgba(255,255,255,0) 72%);
  animation: ball-flash 0.9s ease-out forwards;
}
.shiny-pull { animation: screen-shake 0.45s ease-in-out 0.1s 1 both; }
@keyframes screen-shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
.sparkle-burst { position: absolute; left: 50%; top: 42%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.sparkle-burst span {
  position: absolute; width: 12px; height: 12px; margin: -6px;
  background: radial-gradient(circle, #fff 0 25%, #ffd84d 45%, transparent 70%);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  transform: rotate(var(--a)) translateY(0) scale(0.4); opacity: 0;
  animation: sparkle-out 1.1s ease-out forwards;
}
@keyframes sparkle-out {
  20% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1.6); opacity: 0; }
}
.catch-extra {
  font-family: 'Press Start 2P', monospace; font-size: 11px; line-height: 1.6; color: #fff;
  background: rgba(20,20,40,0.82); border: 2px solid var(--gold); border-radius: 6px; padding: 8px 12px;
  max-width: calc(100vw - 32px); box-sizing: border-box; text-align: center;
}
.badge-unlock { animation: badge-pop 0.5s ease-out both; }
@keyframes badge-pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .card-final-wrap.holo::after, .card-final-wrap.shiny, .shiny-pull, .sparkle-burst span, .badge-unlock { animation: none !important; }
}
@media (max-width: 600px) {
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-name { font-size: 19px; }
  .badge-desc, .feed-sub, .feed-when { font-size: 16px; }
  .feed-text { font-size: 19px; }
  .profile-card figcaption { font-size: 15px; }
}

/* Pokémon search suggestions: buttons don't inherit font-size, so set it. */
@media (max-width: 600px) {
  .pmon-row { font-size: 23px; padding: 8px 10px; }
  .pmon-row img { width: 52px; height: 52px; }
}

/* ---- Dex toolbar: Filter / Search / Log ------------------------------------- */
.dex-toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.dex-toolbar .btn { padding: 10px 4px; white-space: nowrap; }
.btn--active { background: var(--ink); color: var(--on-ink); }
.dex-toolbar + .search-bar input { width: 100%; }

/* Browse-mode card preview */
.card-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.card-preview-art { position: relative; width: min(100%, 300px); }
.card-preview-art img { display: block; width: 100%; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,0.35); cursor: zoom-in; }
.card-preview-meta { margin: 0; font-size: 19px; }
.card-preview .btn { width: min(100%, 300px); font-size: 18px; }
.card-preview .owned-badge { margin: 0; font-size: 18px; }
.want-toggle.on { background: var(--gold); color: #1c1c1c; border-color: #7a5c0d; }
@media (max-width: 600px) {
  .dex-toolbar .btn { font-size: 19px; }
  .card-preview-meta { font-size: 20px; }
  .card-preview .btn { font-size: 21px; padding: 12px 16px; }
}

/* ---- Header (all sizes): one line — lens, count, account button ------------ */
.topbar { flex-wrap: nowrap; }
.topbar-count { flex-shrink: 0; }
.signout-btn { width: 100%; margin-top: 18px; }

/* Chip rows (generations, leaderboard sorts) scroll sideways instead of wrapping. */
.gen-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.gen-tabs::-webkit-scrollbar { display: none; }
.gen-tab { flex-shrink: 0; white-space: nowrap; }

/* ---- Phone layout ------------------------------------------------------------ */
@media (max-width: 600px) {
  /* Use the whole screen: drop the device frame, keep the red header. */
  body { padding: 0; }
  .dex-shell { border-radius: 0; padding: 0; border: 0; box-shadow: none; min-height: 100vh; min-height: 100dvh; }
  .topbar, .dex-topbar { border-radius: 0; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
  .dex-screen { border-radius: 0; border-width: 0; padding: 12px 14px 20px; }
  .dex-screen--login { padding: 28px 18px; min-height: calc(100dvh - 56px); }
  .topbar-count { font-size: 11px; }

  /* Popups become full-screen sheets with a pinned title bar. */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal {
    max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0;
    padding: 0 14px 24px;
  }
  .modal-header {
    position: sticky; top: 0; z-index: 5; background: var(--screen-bg);
    margin: 0 -14px 12px; padding: 12px 14px; border-bottom: 2px solid var(--rule);
  }
  .modal-header h2, .modal-header h2[style] { font-size: 12px !important; line-height: 1.5; }

  /* Card picker: search box full width, the two dropdowns side by side. */
  .picker-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .picker-controls input[type="text"] { grid-column: 1 / -1; flex: none; width: 100%; }
  .picker-controls select, .picker-controls .check { width: 100%; min-width: 0; }

  /* Leaderboard rows: name + score on top, stats underneath at full width. */
  .lb-row { display: grid; grid-template-columns: 40px 1fr auto; grid-template-areas: "rank main score"; column-gap: 10px; padding: 10px; }
  .lb-rank { grid-area: rank; min-width: 0; }
  .lb-main { grid-area: main; }
  .lb-score { grid-area: score; align-self: start; padding-top: 4px; }
  .lb-sub { font-size: 16px; }

  /* Dex entry: card thumbnail a bit bigger, buttons side by side under the text. */
  .catch-item { flex-wrap: wrap; }
  .catch-item img { width: 64px; }
  .catch-item .meta { flex: 1 1 60%; }
  .catch-item-actions { flex-direction: row; width: 100%; }
  .catch-item-actions .btn { flex: 1; }

  .section-title { margin-top: 22px; }
  .dex-grid { gap: 8px; }
}

/* ---- Slabs ------------------------------------------------------------------------
   Drawn like a graded case: label strip on top in the company's colours, the
   card behind a clear window below. */
.slab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.slab-head .btn { flex-shrink: 0; }
.slab-totals { margin-bottom: 10px; }
.slab-sort { margin: 0 0 10px; }
.slab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.slab {
  --slab-accent: #666; --slab-label-bg: #fff; --slab-label-ink: #111;
  display: flex; flex-direction: column; gap: 6px; padding: 7px; width: 100%;
  background: linear-gradient(160deg, #f4f7f9, #d9e1e6 60%, #eef2f4);
  border: 2px solid #9aa6ae; border-radius: 10px; text-align: left; color: inherit;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7), 0 3px 8px rgba(0,0,0,0.18);
}
.slab-label {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px;
  background: var(--slab-label-bg); color: var(--slab-label-ink);
  border: 2px solid var(--slab-accent); border-radius: 4px; padding: 5px 6px; min-height: 52px;
}
.slab-co {
  writing-mode: vertical-rl; transform: rotate(180deg); font-family: 'Press Start 2P', monospace; font-size: 8px;
  color: var(--slab-accent); letter-spacing: 1px;
}
.slab-card { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.1; }
.slab-card strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.slab-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.75; }
.slab-cert { font-size: 12px; }
.slab-grade {
  display: flex; flex-direction: column; align-items: center; font-family: 'Press Start 2P', monospace;
  font-size: 16px; color: var(--slab-accent); line-height: 1.2;
}
.slab-grade small { font-family: 'VT323', monospace; font-size: 13px; color: var(--slab-label-ink); white-space: nowrap; }
.slab-window {
  display: block; background: rgba(255,255,255,0.55); border: 2px solid rgba(120,135,145,0.5);
  border-radius: 6px; padding: 8px; line-height: 0;
}
.slab-window img { width: 100%; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.slab--psa { --slab-accent: #c8102e; }
.slab--cgc { --slab-accent: #1b3f8b; }
.slab--bgs { --slab-accent: #8a6d1d; --slab-label-bg: linear-gradient(90deg, #f3e3a1, #fff6d2 50%, #e7cf7a); }
.slab--tag { --slab-accent: #fff; --slab-label-bg: #111; --slab-label-ink: #fff; }
.slab--ace { --slab-accent: #0b7a57; }
.slab--sgc { --slab-accent: #111; }
.slab-preview { max-width: 230px; margin: 0 auto 14px; cursor: zoom-in; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-form select { font-family: inherit; }
.feed-item--slab { border-color: #9aa6ae; background: linear-gradient(90deg, var(--slab-tint), var(--surface)); }
@media (max-width: 600px) {
  .slab-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .slab-card { font-size: 15px; }
  .slab-card strong { font-size: 17px; }
  .slab-grade { font-size: 14px; }
  .slab-grade small { font-size: 14px; }
  .view-tab { font-size: 9px; padding: 12px 2px; }
}
/* Two-up form rows: let inputs shrink to their column instead of overflowing. */
.form-row label { min-width: 0; }
.form-row input, .form-row select { width: 100%; min-width: 0; box-sizing: border-box; }

/* ---- Dex display toggle: Sprites / Binder ----------------------------------------
   Binder mode lays the grid out like binder pages: card-shaped pockets, the
   card you own in each, an empty sleeve with the silhouette where you don't. */
.dex-mode-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 0 0 10px; }
.dex-mode { display: flex; }
/* "Turn to" menu: desktop flip-book only (DexView). */
.binder-jump { margin-right: auto; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.binder-jump select { font-family: inherit; font-size: 18px; padding: 4px 8px; }
/* Full screen on/off: a round icon button beside Sprites/Binder. */
/* The button is stretched to the switch's height (.dex-mode-tools) and kept
   square; the minimum is that height too, for full screen, where the switch is hidden. */
.dex-mode-tools { display: flex; align-items: stretch; gap: 10px; }
.binder-full-btn {
  display: grid; place-items: center; aspect-ratio: 1; min-width: 29px; min-height: 29px; padding: 0;
  border: 2px solid var(--edge); border-radius: 50%; background: var(--surface); color: var(--ink);
  font-size: 17px; line-height: 1;
}
.binder-full-btn svg { width: 16px; height: 16px; }
.binder-full-btn:hover { background: var(--surface-2); }
.binder-full-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dex-mode-btn {
  font-size: 15px; padding: 5px 12px; background: var(--surface); border: 2px solid var(--edge);
}
.dex-mode-btn:first-child { border-radius: 999px 0 0 999px; border-right-width: 1px; }
.dex-mode-btn:last-child { border-radius: 0 999px 999px 0; border-left-width: 1px; }
.dex-mode-btn.active { background: var(--blue); color: #fff; border-color: #163656; }

.dex-grid--binder {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; padding: 10px; border-radius: 8px;
  background: #2b2f36; box-shadow: inset 0 0 0 2px #1a1d22;
}
.binder-slot {
  position: relative; aspect-ratio: 63 / 88; padding: 0; border: 0; border-radius: 6px;
  background: rgba(255,255,255,0.06); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.binder-slot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.binder-slot.caught:not(.no-art) { box-shadow: 0 2px 6px rgba(0,0,0,0.45); }
/* Sleeve sheen over the card */
.binder-slot.caught:not(.no-art)::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(125deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 35%);
}
.binder-slot .dex-slot-tier { top: 8px; right: 8px; }
.binder-pocket {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: #c4c8cf; /* 7:1 on the sleeve */
}
.binder-pocket .dex-slot-num { opacity: 1; }
.binder-sprite { position: relative; width: 78%; aspect-ratio: 1; flex-shrink: 0; }
.binder-pocket .binder-sprite img { position: absolute; max-width: none; height: auto; image-rendering: pixelated; }
.binder-slot.uncaught .binder-pocket img { filter: brightness(0) invert(1); opacity: 0.18; }
.binder-slot.no-art .binder-pocket { color: #fff; }
.binder-slot:hover, .binder-slot:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
@media (max-width: 600px) {
  .dex-mode-btn { font-size: 17px; padding: 6px 14px; }
  .dex-grid--binder { grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 8px; padding: 8px; }
  .binder-pocket .dex-slot-name { font-size: 15px; }
  .binder-pocket .dex-slot-num { font-size: 14px; }
}

/* Flash the Pokémon you just logged, after the dex scrolls to it. */
.dex-slot.just-caught, .binder-slot.just-caught { animation: just-caught 0.9s ease-in-out 1; position: relative; z-index: 1; }
@keyframes just-caught {
  40% { transform: scale(1.08); box-shadow: 0 0 0 3px var(--gold), 0 0 16px 4px rgba(232,185,35,0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .dex-slot.just-caught, .binder-slot.just-caught { animation: none; box-shadow: 0 0 0 3px var(--gold); }
}

/* Generation tabs + Filter/Search/Log stay pinned under the top bar, so they
   can be reached from the bottom of the dex without scrolling back up.
   --topbar-h is set by syncTopbarHeight() (the top bar is only sticky on phones). */
.dex-controls {
  position: sticky; top: calc(var(--topbar-h, 0px) + var(--tabs-h, 0px)); z-index: 15;
  background: var(--screen-bg);
  margin: 0 -16px 10px; padding: 8px 16px 2px;
  box-shadow: 0 6px 6px -6px rgba(0, 0, 0, 0.25);
}
@media (max-width: 600px) {
  .dex-controls { margin: 0 -14px 10px; padding: 8px 14px 2px; }
  .tabs-bar { margin: -4px -14px 8px; padding: 6px 14px 4px; }
}

/* "Logged X · Undo" bar after every catch. */
.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 200; display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px;
  background: #222; color: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  font-size: 17px;
}
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast .btn { flex-shrink: 0; background: var(--gold); border-color: #7a5c0d; color: #222; }

/* Recently logged: the row opens the dex entry, ✕ removes that copy. */
.mini-row-wrap { display: flex; align-items: stretch; gap: 6px; }
.mini-row-wrap .mini-row { flex: 1; min-width: 0; }
.row-remove { flex-shrink: 0; min-width: 44px; font-size: 18px; }

#preview-remove { color: var(--danger-text); }

/* ---- Card scanner ---- */
.dex-toolbar { grid-template-columns: repeat(3, 1fr); }
.scan-stage {
  position: relative; width: 100%; height: min(62vh, 560px); overflow: hidden;
  background: #111; border-radius: 10px;
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-stage--off video { display: none; }
.scan-stage--off .scan-guide, .scan-stage--off .snap-reticle { display: none; }
.scan-tip {
  position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center;
  color: #fff; font-size: 16px; text-shadow: 0 1px 3px #000; pointer-events: none;
}
.scan-stage--off .scan-tip { top: 50%; bottom: auto; transform: translateY(-50%); padding: 0 16px; }
@media (max-width: 600px) {
  .dex-toolbar .btn { font-size: 16px; padding: 10px 2px; }
  .scan-stage { height: 58vh; border-radius: 0; margin: 0 -14px; width: calc(100% + 28px); }
}

/* Pokémon Snap-style viewfinder: corner brackets, reticle, film counter, shutter. */
.scan-stage::after { /* faint scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 3px);
}
.scan-guide { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5); pointer-events: none; }
.scan-guide i { position: absolute; width: 34px; height: 34px; border: 4px solid var(--gold); filter: drop-shadow(0 0 2px #000); }
.scan-guide i:nth-child(1) { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.scan-guide i:nth-child(2) { top: -4px; right: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.scan-guide i:nth-child(3) { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.scan-guide i:nth-child(4) { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.snap-reticle {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.75); border-radius: 50%; pointer-events: none;
}
.snap-reticle::before, .snap-reticle::after { content: ""; position: absolute; background: rgba(255,255,255,0.75); }
.snap-reticle::before { left: 50%; top: -10px; bottom: -10px; width: 2px; transform: translateX(-50%); }
.snap-reticle::after { top: 50%; left: -10px; right: -10px; height: 2px; transform: translateY(-50%); }
.snap-hud {
  position: absolute; top: 10px; font-family: 'Press Start 2P', monospace; font-size: 11px; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 1px #000; pointer-events: none; letter-spacing: 1px;
}
.snap-hud--tl { left: 12px; }
.snap-hud--tr { right: 12px; }
.snap-rec { color: #ff3b3b; animation: snap-blink 1.2s steps(1) infinite; }
@keyframes snap-blink { 50% { opacity: 0; } }
.snap-shutter-fx { position: absolute; inset: 0; pointer-events: none; }
.snap-shutter-fx span { position: absolute; left: 0; right: 0; height: 50%; background: #000; transform: scaleY(0); }
.snap-shutter-fx span:first-child { top: 0; transform-origin: top; }
.snap-shutter-fx span:last-child { bottom: 0; transform-origin: bottom; }
.snap-shutter-fx.go { animation: snap-flash 0.45s ease-out; }
.snap-shutter-fx.go span { animation: snap-blades 0.28s ease-in-out; }
@keyframes snap-flash { 0% { background: rgba(255,255,255,0.95); } 100% { background: transparent; } }
@keyframes snap-blades { 0%, 100% { transform: scaleY(0); } 45%, 55% { transform: scaleY(1); } }

.scan-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.scan-photo { flex: 1; max-width: 120px; }
.snap-shutter {
  width: 74px; height: 74px; border-radius: 50%; padding: 0; cursor: pointer; flex-shrink: 0;
  background: linear-gradient(#e3350d 0 47%, #111 47% 53%, #f4f4f4 53%);
  border: 4px solid #111; box-shadow: 0 4px 0 #111; position: relative;
}
.snap-shutter span {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%);
  background: #f4f4f4; border: 4px solid #111; border-radius: 50%;
}
.snap-shutter:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #111; }
.snap-shutter:disabled { filter: grayscale(1); opacity: 0.5; }

.snap-check-title {
  font-family: 'Press Start 2P', monospace; font-size: 13px; text-align: center; margin: 6px 0 10px;
  letter-spacing: 2px; color: var(--ink);
}
.snap-oak {
  display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; padding: 10px 12px;
  background: var(--surface); border: 3px solid var(--edge); border-radius: 8px; min-height: 58px; font-size: 17px;
}
.snap-oak-name { font-family: 'Press Start 2P', monospace; font-size: 9px; color: var(--danger-text); }
@media (prefers-reduced-motion: reduce) {
  .snap-shutter-fx.go, .snap-shutter-fx.go span, .snap-rec { animation: none; }
}

.badge-unlock-icon { width: 32px; height: 32px; vertical-align: middle; image-rendering: pixelated; margin: -6px 2px -6px 0; }

/* Top bar: just the caught count and a round account button (the trainer's initial). */
.topbar-avatar {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer;
  background: #ffd9df; color: var(--red-darker); border: 2px solid #4d000f;
  font-family: 'Press Start 2P', monospace; font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-avatar:active { transform: translateY(1px); }

/* ---- Pokédex filter ------------------------------------------------------------
   Summary line is always visible (current gen + removable chips for everything
   else); the panel under it holds search, gen, show and type. The panel lives
   inside the sticky controls, so it scrolls itself rather than the page. */
.filter-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px;
}
.filter-summary > * { white-space: nowrap; }
.filter-summary[hidden] { display: none; }
.summary-chip {
  font-size: 14px; padding: 4px 9px; border-radius: 999px; border: 2px solid var(--edge);
}
.summary-chip:not(.type-chip) { background: var(--surface); }
.summary-clear { font-size: 14px; padding: 4px 6px; background: none; border: 0; color: var(--link); text-decoration: underline; }
.filter-count { font-size: 14px; opacity: 0.7; }

.filter-sheet {
  position: fixed; inset: 0; z-index: 60; background: var(--screen-bg);
  display: flex; justify-content: center;
}
.filter-sheet-inner {
  display: flex; flex-direction: column; width: 100%; max-width: 640px; height: 100%;
}
.filter-sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 2px solid var(--rule);
}
.filter-sheet-head h2 { font-size: 15px; margin: 0; flex: 1; }
.filter-sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 20px; }
.filter-sheet-body input[type="search"] {
  width: 100%; box-sizing: border-box; font-size: 18px; padding: 8px 10px;
  border: 2px solid var(--edge); border-radius: 4px;
}
.filter-sheet-foot {
  display: flex; gap: 8px; padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 2px solid var(--rule);
}
.filter-sheet-foot .btn { flex: 1; }
.filter-sheet-foot #filter-done { flex: 2; }
body.sheet-open { overflow: hidden; }
.filter-label { font-size: 14px; font-weight: bold; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; }

/* Type chips reuse the official type colours, faded until selected. */
.type-chip {
  font-size: 14px; padding: 6px 10px; border-radius: 6px; text-transform: capitalize;
  background: var(--surface); color: var(--ink); border: 2px solid var(--tc, #a8a77a); text-shadow: none;
}
.type-chip.on { background: var(--tc, #a8a77a); color: var(--tt, #1c1c1c); border-color: var(--edge); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }

.empty-state .btn { margin: 4px; }

@media (max-width: 600px) {
  .summary-chip, .summary-clear, .filter-count { font-size: 16px; }
  .type-chip { font-size: 16px; padding: 8px 6px; }
  .filter-label { font-size: 15px; }
  .filter-sheet-head h2 { font-size: 12px; }
  .filter-sheet-foot .btn { font-size: 18px; }
}

/* Wishlist filter: the wished-for card in each pocket, marked with a star. */
.wish-mark {
  position: absolute; bottom: 5px; right: 5px; z-index: 1;
  width: 22px; height: 22px; line-height: 20px; text-align: center; font-size: 13px;
  color: var(--gold); background: rgba(20,20,40,0.8); border: 1px solid var(--gold); border-radius: 50%;
}

/* Log a card: scanning first, typing as the fallback. */
.log-scan-btn { display: block; width: 100%; font-size: 20px; padding: 14px 16px; }
.log-or { text-align: center; margin: 14px 0 8px; opacity: 0.7; }
.catch-actions { flex-wrap: wrap; justify-content: center; }

/* Wild-encounter transition before the catch scene (encounterWipe). */
.encounter-wipe {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  animation: encounter-flash 0.3s steps(1) 1;
}
.encounter-wipe i {
  flex: 1; background: #1b1f1c; transform: scaleX(0); transform-origin: left;
  animation: encounter-bar 0.3s ease-in 0.3s forwards;
}
.encounter-wipe i:nth-child(even) { transform-origin: right; }
@keyframes encounter-flash {
  0%, 50% { background: #fff; }
  25%, 75%, 100% { background: transparent; }
}
@keyframes encounter-bar { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .encounter-wipe { animation: none; background: #1b1f1c; }
  .encounter-wipe i { animation: none; }
}

/* Details editor straight after a catch: Save / Save & scan next. */
.edit-actions { display: flex; gap: 8px; }
.edit-actions .btn { flex: 1; }

/* ---- Wishlist tab ---- */
.wish-summary { margin: 0 0 12px; font-size: 17px; }
.wish-sort { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 17px; }
.wish-sort select { font-family: inherit; font-size: 17px; padding: 6px; border: 2px solid var(--edge); border-radius: 4px; background: var(--surface); flex: 0 1 auto; min-width: 0; }
@media (max-width: 600px) { .wish-sort, .wish-sort select { font-size: 19px; } .wish-sort select { flex: 1; } }
.wish-tile { gap: 6px; }
.wish-card { padding: 0; border: 0; background: none; cursor: zoom-in; }
.wish-tile .wish-actions { display: flex; flex-direction: row; gap: 6px; margin-top: auto; }
.wish-tile .wish-actions [data-got] { flex: 1; }
@media (max-width: 480px) {
  .view-tab { font-size: 8px; padding: 10px 2px; }
  .wish-grid { grid-template-columns: 1fr 1fr; }
}

/* AI trainer label (bots.js) */
.ai-tag {
  display: inline-block; vertical-align: middle; margin-left: 4px;
  font-family: 'Press Start 2P', monospace; font-size: 8px; line-height: 1; letter-spacing: 0.05em;
  padding: 3px 4px; border-radius: 3px; background: #5b6470; color: #fff; text-shadow: none;
}

/* Feed: one opened pack = one item, with a strip of the cards. */
.feed-strip { display: flex; gap: 4px; overflow-x: auto; margin: 6px 0 2px; scrollbar-width: none; }
.feed-strip::-webkit-scrollbar { display: none; }
.feed-strip img { width: 44px; flex-shrink: 0; border-radius: 3px; cursor: zoom-in; }
.feed-item--pack .feed-text { min-width: 0; }

/* Sets tab: series groups */
.series { border: 2px solid var(--edge); border-radius: 8px; background: var(--surface); margin-bottom: 8px; }
.series > summary {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; cursor: pointer; list-style: none; position: relative;
  padding-right: 36px;
}
.series > summary::-webkit-details-marker { display: none; }
.series > summary::after { content: '▸'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); transition: transform 0.15s; }
.series[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
.series[open] > summary { border-bottom: 2px solid var(--rule); }
.series > .set-list { padding: 8px; }

/* Phones: the screen panel reaches the bottom even on short pages (Slabs,
   an empty wishlist), instead of the red body showing below it. */
@media (max-width: 600px) {
  .dex-screen:not(.dex-screen--login) { box-sizing: border-box; min-height: calc(100dvh - var(--topbar-h, 56px)); }
}

/* Welcome tutorial */
.modal.tutorial { max-width: 460px; display: flex; flex-direction: column; }
.tutorial-step { text-align: center; padding: 6px 4px 0; flex: 1; }
.tutorial-sprite { width: 120px; height: 120px; image-rendering: pixelated; }
.tutorial-title { font-family: 'Press Start 2P', monospace; font-size: 14px; line-height: 1.5; margin: 6px 0 12px; color: var(--red-text); }
.tutorial-text { font-size: 20px; line-height: 1.35; margin: 0 0 12px; }
.tutorial-dots { display: flex; justify-content: center; gap: 8px; margin: 12px 0; }
.tutorial-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.tutorial-dots span.on { background: var(--red-dark); }
.tutorial-nav { display: flex; gap: 10px; }
.tutorial-nav .btn { flex: 1; font-size: 18px; }
@media (max-width: 600px) {
  .tutorial-step { padding-top: 24px; }
  .tutorial-text { font-size: 22px; }
  .tutorial-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.feed-strip-more { align-self: center; flex-shrink: 0; font-size: 16px; opacity: 0.7; padding: 0 4px; }

/* Account → Trainers (admins): reset links */
.admin-trainer {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
  background: var(--surface); border: 2px solid var(--edge); border-radius: 8px; padding: 8px 10px;
}
.reset-out { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.reset-out input { width: 100%; font-size: 14px; padding: 6px 8px; border: 2px solid var(--edge); border-radius: 4px; }
.reset-actions { display: flex; gap: 6px; }
.reset-actions .btn { flex: 1; }

/* Popups take focus themselves (for screen readers); no ring on the box. */
.modal:focus { outline: none; }

/* A card tile and its wishlist star are sibling buttons (a button can't
   contain another), so the cell positions the star over the tile. */
.card-cell { position: relative; display: flex; }
.card-cell > .card-tile { flex: 1; width: 100%; min-width: 0; }

/* Text for screen readers only (page headings, step counts). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Trainer names in the feed are links to profiles: at least 24px tall to tap. */
.feed-who { min-height: 24px; min-width: 24px; display: inline-block; }
#filter-title:focus { outline: none; }

/* Reduced motion (device setting or Settings → Motion): one rule stills
   everything, including the catch scene's pop, throw and wobbles. Animations
   jump to their end state, so nothing is left half-drawn. */
.rm *, .rm *::before, .rm *::after {
  animation-duration: 0.01ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
.toast .toast-scan { background: #fff; border-color: #fff; color: #222; }

/* Settings: radio groups shown as segmented buttons */
.settings { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.setting { border: 0; padding: 0; margin: 0; }
.setting legend { font-weight: bold; margin-bottom: 6px; font-size: 17px; }
.seg { display: flex; border: 2px solid var(--edge); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { flex: 1; text-align: center; padding: 9px 6px; cursor: pointer; font-size: 16px; border-right: 2px solid var(--edge); }
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label { background: var(--blue); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: -3px; }
.setting .field-hint { margin: 6px 0 0; }
@media (max-width: 600px) { .seg label { font-size: 18px; } }

/* ---- Unknown Pokémon: tapping an uncaught slot -------------------------------------
   A dark dex screen with the silhouette, a slow scan line and nothing given away
   but the region. Log / See its cards at the bottom. */
.entry-screen {
  position: relative; overflow: hidden; border-radius: 8px; padding: 18px 0 10px;
  background: radial-gradient(ellipse at 50% 40%, #2c3a33 0%, var(--screen-dark) 75%);
  box-shadow: inset 0 0 0 3px #0c0f0d, inset 0 0 24px rgba(0,0,0,0.8);
  text-align: center;
}
.entry-screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 3px);
}
.entry-screen::before {
  content: ''; position: absolute; left: 0; right: 0; height: 40%; top: -40%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(120,255,170,0.08), transparent);
  animation: entry-scan 3.2s linear infinite;
}
@keyframes entry-scan { to { top: 100%; } }
.unknown-sprite { position: relative; width: min(60vw, 220px); aspect-ratio: 1; margin: 0 auto; }
.unknown-sprite img {
  position: absolute; max-width: none; height: auto; image-rendering: pixelated;
  filter: brightness(0) invert(1); opacity: 0.22;
  animation: unknown-flicker 4s steps(1) infinite;
}
@keyframes unknown-flicker { 0%, 92%, 100% { opacity: 0.22; } 94% { opacity: 0.1; } 96% { opacity: 0.3; } }
.entry-status {
  position: relative; margin: 6px 0 0; font-family: 'Press Start 2P', monospace; font-size: 11px;
  letter-spacing: 3px; color: #8fe3ad;
}
.entry-fields {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 4px 0;
  font-size: 20px;
}
.entry-fields dt { font-family: 'Press Start 2P', monospace; font-size: 10px; align-self: center; opacity: 0.7; }
.entry-fields dd { margin: 0; }
.entry-blurb { font-size: 18px; margin: 12px 4px 16px; }
.entry-actions { display: flex; gap: 8px; }
.entry-actions .btn { flex: 1; }
/* Caught: the same screen, switched on. Full-colour artwork on a lit panel. */
.entry-screen--lit {
  background: radial-gradient(ellipse at 50% 40%, #e9f7ee 0%, #a9d9b9 60%, #6fae86 100%);
  box-shadow: inset 0 0 0 3px #0c0f0d, inset 0 0 24px rgba(0,40,20,0.35);
}
.entry-screen--lit .entry-status { color: #06301a; }
.entry-art { position: relative; width: min(60vw, 220px); aspect-ratio: 1; margin: 0 auto; }
.entry-art img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.3)); }
.entry-fields .type-badges { margin: 0; }
.entry-subhead { font-size: 12px; margin: 20px 0 8px; }
.entry-fields + .entry-actions { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
  .entry-screen::before, .unknown-sprite img { animation: none; }
}
/* ---- Swiping between pages (createPager) ---------------------------------------
   The track bleeds to the popup's edges so pages slide in from the screen edge,
   not from inside a clipped window. pan-y leaves vertical scrolling to the
   browser and hands sideways drags to the script; pinch-zoom still works. */
.pager-track { position: relative; overflow: clip; }
.modal > .pager-track { margin: 0 -18px; }
.modal > .pager-track > .pager-page { padding: 0 18px; }
.pager-page { touch-action: pan-y pinch-zoom; background: var(--screen-bg); }
.pager-page--float { position: absolute; top: 0; left: 0; right: 0; }
.pager-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 44px; height: 64px; border: 0; padding: 0; cursor: pointer;
  background: rgba(0,0,0,0.28); color: #fff; font-size: 34px; line-height: 1;
  font-family: 'VT323', monospace;
}
.pager-nav:hover, .pager-nav:focus-visible { background: rgba(0,0,0,0.45); }
.pager-nav--prev { left: 0; border-radius: 0 8px 8px 0; }
.pager-nav--next { right: 0; border-radius: 8px 0 0 8px; }
.entry-screen--lit .pager-nav { background: rgba(6,48,26,0.22); color: #06301a; }
.entry-screen--lit .pager-nav:hover, .entry-screen--lit .pager-nav:focus-visible { background: rgba(6,48,26,0.38); }
@media (max-width: 600px) {
  .modal > .pager-track { margin: 0 -14px; }
  .modal > .pager-track > .pager-page { padding: 0 14px; }
}

/* ---- Requests (join / new password), approved by an admin ------------------------ */
.auth-intro { margin: 0; }
.request-sent p { margin: 0; font-size: 18px; }
.topbar-avatar { position: relative; }
.req-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--gold); color: #1c1c1c; border: 2px solid var(--edge);
  font-family: 'VT323', monospace; font-size: 16px; line-height: 16px; text-align: center;
}
.admin-request { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.admin-request .mini-row-main { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.request-warn { font-size: 16px; color: var(--warn-text); }
.request-actions { display: flex; gap: 6px; }
.request-done { margin: 8px 0; color: var(--green-text); }

/* ---- In-app confirm / alert (askConfirm) -------------------------------------------
   A small centred box on every screen size, including phones, where other
   popups become full-screen sheets. */
.modal-backdrop.modal-backdrop--dialog { align-items: center; padding: 16px; z-index: 60; }
.modal.modal--dialog {
  height: auto; max-width: 380px; max-height: 80vh; border: 4px solid #111; border-radius: 10px;
  padding: 20px 18px 16px;
}
.dialog-text { margin: 0 0 18px; font-size: 18px; line-height: 1.4; white-space: pre-line; text-align: center; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

/* Filter: "Only" toggles read as tick boxes, not as another pick-one choice. */

/* Account → Help */
.acct-help { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---- Get the app (Add to Home Screen) --------------------------------------------- */
.install-intro, .install-done { font-size: 17px; line-height: 1.45; margin: 0 0 6px; }
.install-done { color: var(--money); font-weight: bold; }
.install-steps { padding-left: 24px; margin: 0 0 10px; font-size: 17px; line-height: 1.5; }
.install-steps li { margin-bottom: 8px; }
.share-icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; color: var(--link); }
.install-tip {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 8px 8px 12px;
  background: var(--surface); border: 2px solid var(--blue); border-radius: 8px; font-size: 16px;
}
.install-tip span { flex: 1; }
.install-tip .btn { flex-shrink: 0; }
@media (max-width: 600px) {
  .install-steps, .install-intro, .install-done { font-size: 18px; }
  .install-tip { font-size: 17px; }
}

/* ---- Slab scanning -------------------------------------------------------------
   The guide is slab-shaped, with a line marking where the grading label goes. */
.scan-guide-label {
  position: absolute; left: 0; right: 0; top: 0; height: 21%;
  border-bottom: 2px dashed rgba(255, 215, 0, 0.8);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: 2px;
  color: rgba(255, 215, 0, 0.85); font-weight: normal; pointer-events: none;
}
.slab-read { margin: 6px 0 10px; font-size: 18px; }
.slab-read .hint { font-size: 16px; }
.slab-scanned { margin: 8px 0 0; }

/* Privacy page and Your data (2026-09-24). A link styled as a button needs
   the button's centring. */
.acct-help a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.privacy p { margin: 0 0 10px; line-height: 1.5; }

.nowrap { white-space: nowrap; }
/* What the app is, under the sign-in form (2026-09-24). */
/* Sign-in page footer: New here? / Get the app / Privacy as popups on one
   line, then the fan-project fine print (2026-09-24). */
.about p { margin: 0 0 10px; line-height: 1.5; }
.about-list { margin: 0 0 12px; padding: 0; list-style: none; }
.about-list li { position: relative; padding-left: 20px; margin: 0 0 6px; line-height: 1.4; }
.about-list li::before {
  content: ''; position: absolute; left: 3px; top: 0.5em; width: 7px; height: 7px;
  background: var(--red-text); transform: rotate(45deg);
}
.about-join { width: 100%; margin-top: 4px; }
.auth-foot { max-width: 320px; margin: 0 auto; text-align: center; }
.auth-foot-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; color: var(--muted); }
.auth-foot-links .link-btn { display: inline-block; margin: 0; font-size: 16px; }
.auth-foot-legal { margin: 4px 0 0; font-size: 13px; line-height: 1.3; color: var(--muted); }
/* "A … app": who runs this install, when OPERATOR_NAME is set (2026-09-26). */
.auth-foot-made { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.auth-foot-made a, .about-made a { color: inherit; }
@media (max-width: 600px) {
  .auth-foot-links .link-btn { font-size: 17px; }
  .auth-foot-legal { font-size: 15px; }
}

/* Skip link past the Dex grid: hidden until focused by keyboard (2026-09-24). */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { position: static; display: block; margin: 6px 0; padding: 8px; background: var(--surface); border: 2px solid var(--edge); border-radius: 6px; text-align: center; color: var(--ink); }
#dex-end:focus { outline: none; }
img.zoomable:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* A popup is open (e.g. Add details): the toast goes to the top so it never
   covers the popup's Save button. */
body:has(.modal-backdrop) .toast { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; }
/* First run: what to do with 1,025 empty slots. */
.first-run { margin: 8px 0 12px; padding: 12px; border: 2px dashed var(--edge); border-radius: 8px; background: var(--surface); text-align: center; }
.first-run p { margin: 0 0 8px; }
.first-run-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* The feed's thumbnail strip scrolls sideways: fade the edge to show there's more. */
.feed-strip--more { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
.badge-unlock-row { display: flex; justify-content: center; margin-bottom: 6px; }
.badge-unlock-row .badge-unlock-icon { margin: -6px -6px -6px 0; }
.scan-tip .link-btn { display: inline; min-height: 0; margin: 0; color: inherit; text-decoration: underline; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
/* Landscape phones: the pinned bars took a quarter of the screen, and the
   entry artwork filled what was left. */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar, .tabs-bar, .dex-controls { position: static !important; }
  .entry-art, .unknown-sprite { width: min(38vh, 220px); } /* square boxes: this caps the height */
}
/* Breathing room under the pinned tabs on every tab but the Dex (whose own
   toolbar sits there). */
#view-body:not([data-view="dex"]) { padding-top: 12px; }
/* Card preview on wider screens: ‹ › sit beside the card, not over its art. */
@media (min-width: 520px) {
  .card-preview-art .pager-nav--prev { left: -54px; border-radius: 8px; }
  .card-preview-art .pager-nav--next { right: -54px; border-radius: 8px; }
}

/* Scanner Photo check popup (2026-09-24): results over the camera. */
.scan-find { margin: 16px 0 8px; padding: 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); }
.scan-find label { display: block; margin-bottom: 6px; }
.scan-find-row { display: flex; gap: 8px; }
.scan-find-row input { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 8px 10px; border: 2px solid var(--edge); border-radius: 4px; }
.scan-find .field-hint { margin: 6px 0 0; }
.scan-browse { width: 100%; margin-top: 4px; }
.scan-results-actions { display: flex; justify-content: center; margin-top: 12px; }
.scan-results-actions .btn { min-width: 60%; }
.scan-more { width: 100%; margin-top: 8px; }

/* ---- Filter sheet, tidied (2026-09-24) ----------------------------------------
   One tile style for every option (equal widths in a grid, 44px tall), a
   segmented switch for Show, and on wider screens a centred panel instead of
   a sheet stretched across the whole window. */
.filter-sheet-body { padding: 14px 16px 20px; }
.filter-sec { margin-top: 18px; }
.filter-sec .filter-label { margin: 0 0 8px; }
.filter-grid { display: grid; gap: 6px; }
.filter-grid--gens { grid-template-columns: repeat(5, 1fr); }
.filter-grid--types { grid-template-columns: repeat(3, 1fr); }
.filter-grid--two { grid-template-columns: 1fr 1fr; }
.ftile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 44px; padding: 4px 6px; border-radius: 8px;
  background: var(--surface); color: var(--ink); border: 2px solid var(--edge);
  font-family: inherit; font-size: 17px; line-height: 1.1; cursor: pointer;
}
.ftile small { font-size: 13px; opacity: 0.7; }
.ftile.on { background: var(--blue); color: #fff; border-color: #163656; }
.ftile.on small { opacity: 0.9; }
.ftile--gen span { font-family: 'Press Start 2P', monospace; font-size: 11px; }
/* Types: the type colour as the border, filled when picked. */
.ftile--type { border-color: var(--tc, #a8a77a); text-transform: capitalize; }
.ftile--type.on { background: var(--tc, #a8a77a); color: var(--tt, #1c1c1c); border-color: var(--edge); }
/* A tick for the two on/off options. */
.ftile--check { flex-direction: row; gap: 8px; }
.ftile--check::before {
  content: ''; width: 16px; height: 16px; flex-shrink: 0; border: 2px solid currentColor; border-radius: 3px;
  font-size: 14px; line-height: 14px; text-align: center;
}
.ftile--check.on::before { content: '✓'; background: #fff; color: var(--blue); border-color: #fff; }
/* Show: one segmented switch, like Sprites / Binder. */
.filter-seg { display: grid; grid-template-columns: repeat(3, 1fr); }
.filter-seg .ftile { border-radius: 0; }
.filter-seg .ftile + .ftile { border-left-width: 0; }
.filter-seg .ftile:first-child { border-radius: 8px 0 0 8px; }
.filter-seg .ftile:last-child { border-radius: 0 8px 8px 0; }
@media (min-width: 700px) {
  .filter-sheet { background: rgba(0, 0, 0, 0.45); align-items: center; padding: 24px; }
  .filter-sheet-inner {
    height: auto; max-height: min(88vh, 760px); max-width: 560px;
    background: var(--screen-bg); border: 3px solid var(--edge); border-radius: 12px; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  }
  .filter-grid--gens { grid-template-columns: repeat(10, 1fr); }
  .filter-grid--gens .ftile { padding: 4px 2px; }
  .filter-grid--types { grid-template-columns: repeat(6, 1fr); }
  .ftile { font-size: 16px; }
}
/* Section names are real headings (for screen readers) but stay small, quiet
   labels, not the pixel heading font. */
.filter-sec h3.filter-label {
  font-family: 'VT323', monospace; font-size: 16px; font-weight: normal;
  text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75;
}
.ftile--gen small { font-size: 14px; }
/* A section heading with its sort menu on the same line (Sets tab). */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.section-head .section-title { margin-right: auto; }
.section-head .wish-sort { margin: 0; }
.section-head { margin: 20px 0 10px; }
.section-head:first-child { margin-top: 0; }
.section-head .section-title { margin: 0; }

/* ---- Friends (friend codes and requests) ---------------------------------------- */
/* The tabs are too narrow on phones for a number beside the label, and they
   clip their overflow, so a waiting request shows as a dot in the corner
   (the count is in the tab's aria-label and on the Friend requests list). */
.view-tab { position: relative; }
.tab-badge {
  position: absolute; top: 3px; right: 3px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--gold); border: 1px solid #1c1c1c;
}
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }
.lb-head .section-title { margin: 0; }
.friend-code-box { display: flex; flex-direction: column; gap: 8px; }
.friend-code {
  font-family: 'Press Start 2P', monospace; font-size: 18px; letter-spacing: 2px; text-align: center;
  padding: 12px 8px; border: 2px dashed var(--edge); border-radius: 6px; background: var(--surface-2); user-select: all;
}
.friend-newcode { align-self: flex-start; }

/* ---- Wants: binder / slabs switch, and slab wants ------------------------------ */
.wants-seg { margin: 0 0 14px; }
.slab-want-cell { display: flex; flex-direction: column; gap: 6px; }
.slab-want { display: flex; flex-direction: column; gap: 4px; }
.slab-want .slab { cursor: zoom-in; }
.slab-want-text { font-size: 15px; color: var(--muted); text-align: center; }
.slab-want-cell .wish-actions { justify-content: center; flex-wrap: nowrap; gap: 4px; }
.slab-want-cell .wish-actions .btn { padding-left: 8px; padding-right: 8px; min-width: 0; }

/* ---- Binder pages (Settings → Binder pages / Page numbers) -------------------------
   Each page is a dark binder sheet with --cols pockets across. Wide screens
   show pages side by side, like an open binder. */
.dex-grid--pages {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px; background: none; box-shadow: none; padding: 0;
}
.binder-page { border-radius: 8px; background: #2b2f36; box-shadow: inset 0 0 0 2px #1a1d22; padding: 8px 10px 10px; }
.binder-page-label {
  margin: 0 0 8px; font-family: 'VT323', monospace; font-weight: normal; font-size: 18px;
  color: #c4c8cf; letter-spacing: 1px;
}
.binder-page-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 8px; }
.binder-slot--empty { display: block; opacity: 0.35; }
/* Four across on a phone: smaller labels so names still fit a pocket. */
@media (max-width: 600px) {
  .binder-page { padding: 6px 6px 8px; }
  .binder-page-grid:is([data-cols="4"], [data-cols="5"], [data-cols="6"]) { gap: 5px; }
  .binder-page-grid:is([data-cols="4"], [data-cols="5"], [data-cols="6"]) .binder-pocket .dex-slot-name { font-size: 12px; }
  .binder-page-grid:is([data-cols="4"], [data-cols="5"], [data-cols="6"]) .binder-pocket .dex-slot-num { font-size: 12px; }
  .binder-page-grid:is([data-cols="4"], [data-cols="5"], [data-cols="6"]) .binder-slot .dex-slot-tier { top: 4px; right: 4px; }
  /* Five or six across: pockets are too small for a name, so number only. */
  .binder-page-grid:is([data-cols="5"], [data-cols="6"]) .binder-pocket .dex-slot-name { display: none; }
}

.binder-size { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.binder-size label { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.binder-size select { font-size: 18px; padding: 4px 8px; min-width: 64px; }
.binder-size > span[aria-hidden] { font-size: 20px; padding-bottom: 6px; }
.binder-size .field-hint { padding-bottom: 8px; }

/* ---- Account menu (a short list; each row opens its own page) ------------------------ */
.acct-card {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 14px;
  border: 2px solid var(--edge); border-radius: 10px; background: var(--surface);
}
.acct-avatar {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; font-family: 'Press Start 2P', monospace; font-size: 16px;
  border: 2px solid var(--edge);
}
.acct-card-text { display: flex; flex-direction: column; min-width: 0; font-size: 17px; }
.acct-card-text span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-group {
  display: flex; flex-direction: column; margin-bottom: 12px;
  border: 2px solid var(--edge); border-radius: 10px; overflow: hidden; background: var(--surface);
}
.acct-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; min-height: 56px;
  border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left;
  font-family: inherit; color: var(--ink); cursor: pointer;
}
.acct-row:last-child { border-bottom: 0; }
.acct-row:hover { background: var(--surface-2); }
.acct-row:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.acct-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.acct-row-main span { font-size: 15px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-row-go { font-size: 22px; color: var(--muted); }
.acct-count {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: grid; place-items: center;
  background: var(--gold); color: #1c1c1c; font-family: 'VT323', monospace; font-size: 17px;
}
.acct-subhead h2 { text-align: center; }
.acct-help--stack { grid-template-columns: 1fr; }

/* ---- Desktop width (wider than 1024px) --------------------------------------------
   Phones and tablets keep the 900px column exactly as before. On a desktop the
   app spans the window inside body's 16px margin; grids that auto-fill gain
   columns, and text-heavy lists keep a readable line length. Popups and sheets
   size themselves, so they are untouched. */
@media (min-width: 1025px) {
  .app { max-width: none; }
  /* Sign-in is a small centred card; a full-width one would just be empty. */
  .app:has(.dex-screen--login) { max-width: 900px; }
  /* Sets are rows: lay them out in columns rather than stretching each one. */
  .set-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  /* A list of series (the By series order) stays stacked: each series spans the
     width when open and its own set list gets the columns. */
  .set-list:has(> .series) { display: flex; }
  /* "No match" / "none started" spans the row rather than one cell. */
  .set-list > .empty-state { grid-column: 1 / -1; }
  /* Only five number tiles: share the row rather than leave empty tracks. */
  .stat-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  /* Binder pages: always two across, like an open binder, each taking half the
     width so the pair fills the Pokédex. On a wide window a page can be taller
     than the screen; scrolling reaches its bottom row. */
  .dex-grid--pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The flip-book (DexGrid FlipBook): one spread of two facing pages, each as
     large as fits the height DexGrid measures (--spread-h, the window below
     the grid's top) and half the width, with the page-turn arrows in the space
     either side. The height sum mirrors the page box: label 22px + 8px margin,
     padding 8px + 10px, 8px gaps, card-shaped (63:88) pockets. */
  .dex-grid--spread {
    --pocket-h: calc((var(--spread-h, 640px) - 30px - 18px - (var(--rows, 3) - 1) * 8px) / var(--rows, 3));
    --page-w: calc(var(--pocket-h) * 63 / 88 * var(--cols, 3) + (var(--cols, 3) - 1) * 8px + 20px);
    grid-template-columns: minmax(48px, 1fr) repeat(2, min(var(--page-w), calc((100% - 96px - 42px) / 2))) minmax(48px, 1fr);
    align-items: start;
  }
  .binder-page--blank { visibility: hidden; }
  .binder-flip {
    align-self: stretch; justify-self: center; width: 100%; max-width: 140px; padding: 0;
    border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer;
    font-family: 'VT323', monospace; font-size: 72px; line-height: 1;
  }
  .binder-flip:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
  .binder-flip:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
  .binder-flip:disabled { visibility: hidden; }
  /* Full screen (DexView): only the "Turn to" row and the open spread, edge
     to edge. The spread re-measures, so its pages grow into the space. */
  html.binder-full body { padding: 0; }
  html.binder-full .dex-shell { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--screen-bg); min-height: 100dvh; }
  html.binder-full .dex-screen { border: 0; border-radius: 0; padding: 10px 16px 12px; }
  html.binder-full :is(.topbar, .tabs-bar, .dex-controls, .dex-mode, .first-run, .install-tip) { display: none; }
  .dex-grid--pages > .empty-state { grid-column: 1 / -1; }
  .binder-page-label { font-size: 22px; line-height: 1; }
  /* Labels and the rarity mark grow with the pocket, never below their usual size. */
  .binder-page .binder-slot { container-type: inline-size; }
  .binder-page .binder-pocket .dex-slot-name { font-size: clamp(18px, 15cqi, 28px); }
  .binder-page .binder-pocket .dex-slot-num { font-size: clamp(16px, 13cqi, 24px); }
  .binder-page .binder-slot .dex-slot-tier { width: clamp(9px, 7cqi, 16px); height: clamp(9px, 7cqi, 16px); top: clamp(8px, 6.5cqi, 14px); right: clamp(8px, 6.5cqi, 14px); }
}

/* ---- Desktop readability (wider than 1024px) --------------------------------------
   VT323 renders about a third smaller than a normal font at the same px, and a
   desk is further away than a phone. The base sizes (13-17px) suited neither,
   so, like the phone block (Mobile readability), desktop gets its own: body
   text 17-21px, small print 16px and up, Press Start 2P labels 10px and up.
   From a font audit of every tab and popup at 1400px (2026-09-28). Last in the
   file so it beats the base rules. A new element with a small px size needs a
   line here as well as in the phone block. */
@media (min-width: 1025px) {
  /* Controls */
  .btn { font-size: 19px; }
  .btn--sm { font-size: 17px; padding: 8px 12px; }
  .view-tab { font-size: 13px; }
  .dex-mode-btn { font-size: 17px; }
  .seg label { font-size: 18px; }
  .gen-tab { font-size: 17px; padding: 6px 12px; }
  .check, .wish-sort, .wish-sort select { font-size: 19px; }
  .hint, .field-hint { font-size: 18px; }
  .ai-tag { font-size: 10px; }
  /* Filter sheet */
  .ftile { font-size: 18px; }
  .ftile small, .ftile--gen small { font-size: 16px; }
  .filter-label { font-size: 17px; }
  /* Card grids (picker, set checklist, wants) */
  .card-tile, .card-tile .owned-badge { font-size: 18px; }
  /* Wider tiles for the larger text, so Got it! and ✕ stay on one line. */
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .wish-tile .wish-actions .btn { white-space: nowrap; }
  .card-meta { font-size: 17px; }
  .wish-summary { font-size: 19px; }
  /* Sets */
  .set-row-main { font-size: 20px; }
  .set-row-sub { font-size: 18px; }
  /* Slabs. The label on the slab itself keeps its size: it copies a real
     grading label and is laid out to fit one (larger text cut the set names). */
  .slab-want-text { font-size: 18px; }
  /* Stats */
  .stat-label { font-size: 18px; }
  .bar-row { font-size: 18px; grid-template-columns: 140px 1fr 72px; }
  .mini-row-main, .mini-row-right { font-size: 19px; }
  .badge-group { font-size: 18px; }
  .badge-name { font-size: 19px; }
  .badge-desc { font-size: 16px; }
  /* Ranks, feed, trainer profiles */
  .lb-main { font-size: 21px; }
  .lb-sub { font-size: 17px; }
  .feed-text { font-size: 19px; }
  .feed-sub, .feed-when { font-size: 16px; }
  .profile-card figcaption { font-size: 16px; }
  /* Account */
  .acct-card-text { font-size: 19px; }
  .acct-row-main { font-size: 19px; }
  .acct-row-main span { font-size: 17px; }
  .setting legend { font-size: 19px; }
  .binder-size label { font-size: 18px; }

  /* Stats and Ranks are one centred column rather than lists pinned to the left. */
  #view-body:is([data-view="stats"], [data-view="ranks"]) { max-width: 960px; margin-inline: auto; }

  /* Popups: a little wider, and larger again than the page. */
  .modal { max-width: 760px; }
  /* [style]: some titles set a smaller size inline to fit a phone. */
  .modal-header h2, .modal-header h2[style] { font-size: 18px !important; line-height: 1.4; }
  .modal .btn { font-size: 21px; }
  .modal .btn--sm { font-size: 19px; padding: 8px 14px; }
  .modal .type-badge { font-size: 12px; padding: 6px 10px; }
  .entry-status { font-size: 14px; }
  .entry-fields { font-size: 24px; }
  .entry-fields dt { font-size: 13px; }
  .entry-blurb { font-size: 22px; }
  .entry-subhead { font-size: 15px; }
  .entry-art { width: 260px; }
  .modal .catch-item .meta { font-size: 21px; }
  .modal .catch-item .best-tag { font-size: 19px; }
  .modal :is(.copy-details, .copy-money, .copy-notes) { font-size: 20px; }
  .modal .card-meta { font-size: 19px; }
  .modal :is(.hint, .field-hint) { font-size: 20px; }
  .card-preview-meta { font-size: 22px; }
  .modal .edit-form label, .modal :is(.edit-form input, .edit-form select, .edit-form textarea) { font-size: 20px; }
}
