/* help: styles used only by this feature (src/features/help). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- 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); }
@media (max-width: 600px) {
  .install-steps, .install-intro, .install-done { font-size: 18px; }
}

/* ---- Slab scanning ---- */
.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: styles used only by this feature (src/features/auth). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- 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);
}
@media (max-width: 600px) {
  .login-form label { font-size: 20px; }
}

/* ---- Pokédex chrome ---- */
.dex-screen--login > .auth-foot { padding-top: 28px; }
/* The free space is shared equally: above the title, between the title and
   the form, and between the form and the footer. */
.dex-screen--login > .brand { margin-top: auto; }
.dex-screen--login > .auth-body { margin-block: auto; }
@media (min-width: 601px) {
  body:has(.dex-screen--login) { align-items: center; min-height: 100dvh; }
  .app:has(.dex-screen--login) { max-width: 560px; }
}

.brand { font-size: 32px; color: var(--red-text); margin: 6px 0 8px; }
.brand-sub { margin: 0 0 24px; opacity: 0.7; font-size: 23px; }

/* ---- 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; }
.forgot-done { width: 100%; }

/* ---- Leaderboard ---- */

@media (max-width: 600px) {
  .auth-tab { font-size: 11px; padding: 12px 4px; }
}

/* ---- Phone layout ---- */
@media (max-width: 600px) {
  .dex-screen--login { padding: 28px 18px; min-height: calc(100dvh - 56px); }
}

/* ---- Wishlist tab ---- */
@media (max-width: 600px) {
  .dex-screen:not(.dex-screen--login) { box-sizing: border-box; min-height: calc(100dvh - var(--topbar-h, 56px)); }
}

/* ---- Requests (join / new password), approved by an admin ---- */
.auth-intro { margin: 0; }
/* Open sign-up: Cloudflare Turnstile's box on the Join form (usually empty). */
.turnstile:empty { display: none; }

/* ---- Slab scanning ---- */
.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); }
@media (max-width: 600px) {
  .auth-foot-links .link-btn { font-size: 17px; }
  .auth-foot-legal { font-size: 15px; }
}

/* ---- Desktop readability (wider than 1024px) ---- */
@media (min-width: 1025px) {

  /* Sign-in: larger brand, form and footer to suit the taller card. */
  .brand { font-size: 40px; margin-bottom: 10px; }
  .brand-sub { font-size: 25px; margin-bottom: 30px; }
  .login-form, .auth-tabs { max-width: 340px; }
  .login-form label, .login-form input { font-size: 20px; }
  .auth-tab { font-size: 12px; padding: 12px 4px; }
  .auth-foot { max-width: 420px; }
  .auth-foot-links .link-btn { font-size: 18px; }
  .auth-foot-made { font-size: 17px; }
  .auth-foot-legal { font-size: 15px; }
}
/* tutorial: styles used only by this feature (src/features/tutorial). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Wishlist tab ---- */
.tutorial-step { text-align: center; padding: 6px 4px 0; flex: 1; }
.tutorial-sprite { width: 120px; height: 120px; image-rendering: pixelated; }
.tutorial-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.tutorial-nav { display: flex; gap: 10px; }
@media (max-width: 600px) {
  .tutorial-step { padding-top: 24px; }
  .tutorial-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}
/* friends: styles used only by this feature (src/features/friends). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Friends (friend codes and requests) ---- */
.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; }
/* account: styles used only by this feature (src/features/account). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Wishlist tab ---- */

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

/* ---- Requests (join / new password), approved by an admin ---- */
.request-warn {
  font-size: 16px;
  color: var(--warn-text);
}
/* Open sign-up: today's new accounts against the cap (Account → Requests). */
.signups-status {
  margin: 0 0 8px;
}
.signups-full {
  color: var(--warn-text);
}

/* ---- In-app confirm / alert (askConfirm) ---- */

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

/* ---- Binder pages (Settings → Binder pages / Page numbers) ---- */

.binder-size {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.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 readability (wider than 1024px) ---- */
@media (min-width: 1025px) {
  /* Account */
  .acct-card-text {
    font-size: 19px;
  }
  .acct-row-main {
    font-size: 19px;
  }
  .acct-row-main span {
    font-size: 17px;
  }
  .binder-size label {
    font-size: 18px;
  }
}

/* ---- Admin switches (#112) ---- */
.switch-field {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* ---- Account → Switches (admins only) ---- */
.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 14px;
  min-height: 64px;
  border-bottom: 1px solid var(--rule);
}
.switch-row:last-child {
  border-bottom: 0;
}
.switch-row .acct-row-main span {
  white-space: normal;
} /* the sub-line may wrap */
/* A source under "Card pictures": indented, on the softer surface. */
.switch-row--sub {
  padding-left: 30px;
  background: var(--surface-2);
}

/* The On / Off control is the app's .seg, narrower, and Off reads as a
   warning when it's picked: white on --red-dark is 5.9:1. */
.seg--switch {
  width: 132px;
}
.seg--switch label {
  padding: 9px 4px;
}
.seg--switch input[value='off']:checked + label {
  background: var(--red-dark);
  color: #fff;
}
.seg--switch input:disabled + label {
  cursor: default;
}
.seg--switch:has(input:disabled) {
  opacity: 0.5;
}

/* Account menu: the row's sub-line when anything is off. */
.acct-row-main span.acct-warn {
  color: var(--warn-text);
}

/* Recent changes */
.switch-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.switch-log .mini-row {
  cursor: default;
}
.switch-log .mini-row-main span {
  font-size: 15px;
  color: var(--muted);
}
.switch-log .mini-row-main strong .is-off {
  font-size: inherit;
  color: var(--red-text);
}
.switch-log .mini-row-main strong .is-on {
  font-size: inherit;
  color: var(--green-text);
}

/* Import cards (ImportCards.tsx): Account → Your data. Existing tokens only. */
.import-file {
  position: relative;
  cursor: pointer;
}
.import-busy {
  padding: 12px 0;
}
.import-bar {
  animation: import-busy 1.2s ease-in-out infinite alternate;
}
@keyframes import-busy {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .import-bar {
    animation: none;
    opacity: 0.5;
  }
}
.import-group {
  margin-top: 18px;
}
.import-group .section-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.import-row {
  min-height: 56px;
  flex-wrap: wrap;
  background: var(--surface);
}
.import-row--off {
  border-style: dashed;
  color: var(--muted);
}
.import-row--missing {
  color: var(--red-text);
  gap: 8px;
}
.import-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}
.import-row-main input {
  accent-color: var(--blue);
  width: 22px;
  height: 22px;
  flex: none;
}
.import-row small {
  color: var(--muted);
  font-size: 15px;
}
.import-row .import-warn {
  color: var(--warn-text);
}
.import-row .btn--sm {
  min-height: 44px;
}
.import-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  width: 100%;
}
.import-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.import-tile img {
  width: 64px;
}
.import-tile[aria-pressed='true'] {
  border: 3px solid var(--link);
}
.import-tile[aria-pressed='true']::after {
  content: '✓';
  color: var(--link);
}
.import-foot {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--rule);
  background: var(--screen-bg);
  margin-top: 12px;
}
.import-headline {
  font-family: 'Press Start 2P', monospace;
  color: var(--red-text);
}
.import-newdex {
  color: var(--money);
  font-size: 22px;
}
.import-missing .mini-row {
  color: var(--red-text);
}
/* scanner: styles used only by this feature (src/features/scanner). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Card scanner ---- */
.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; transition: opacity .2s; }
/* Hidden while a freshly opened camera settles (Scanner.tsx, SETTLE_FRAMES). */
.scan-stage video.scan-video--settling { opacity: 0; transition: none; }
.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) {
  .scan-stage { height: 58vh; border-radius: 0; margin: 0 -14px; width: calc(100% + 28px); }
  /* The camera fills the sheet and the shutter row sits at the bottom, in thumb reach. */
  .modal.scan-modal { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
  .scan-modal .scan-stage { flex: 1; height: auto; min-height: 0; }
  .scan-modal .scan-actions { margin: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); }
}

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

/* ---- Slab scanning ---- */
.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; }
.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; }

/* 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; }
/* catch: styles used only by this feature (src/features/catch). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

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

.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; }
.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;
}

/* ---- 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[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="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="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="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="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="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="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="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="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="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="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="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;
}
@media (prefers-reduced-motion: reduce) {
  .cutscene-fx, .cutscene-fx::after, .cutscene-sky { animation: none !important; }
}

/* ---- Shiny pulls ------------------------------------------------------------------ */
.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 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;
}

/* ---- Cutscene ---- */
/* 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 .encounter-sprite { position: relative; }
.cutscene-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; }
@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;
}
@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; }
}
@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; }

/* ---- Views: Pokédex / Sets / Stats ---- */

/* Cutscene result buttons */
.catch-actions { display: flex; gap: 10px; }

/* ---- Mobile readability (2026-09-21) ---- */
@media (max-width: 600px) {
  .catch-banner { font-size: 13px; }
}

/* ---- Type-themed catch scenes ---- */
.cutscene-fx { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.cutscene[data-scene="forest"] .cutscene-field::before { top: -58px; height: 60px; background-size: 30px 60px, 30px 60px; }
.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"] .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"] .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"] .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="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"] .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"] .cutscene-field::before { background-size: 70px 36px, 90px 36px; }
.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"] .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="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"] .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%); } }
/* Keep the catch-scene text box off the screen edges on phones. */
.cutscene-text { max-width: calc(100vw - 32px); box-sizing: border-box; }

/* ---- 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); } }
.sparkle-burst { position: absolute; left: 50%; top: 42%; width: 0; height: 0; z-index: 3; pointer-events: none; }
@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); } }

/* ---- Card scanner ---- */

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

/* ---- Pokédex filter ---- */
.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; }
}

/* ---- Wishlist tab ---- */
.toast .toast-scan { background: #fff; border-color: #fff; color: #222; }

/* ---- Slab scanning ---- */
.badge-unlock-row { display: flex; justify-content: center; margin-bottom: 6px; }
.badge-unlock-row .badge-unlock-icon { margin: -6px -6px -6px 0; }

/* ---- After a catch, with the scene Off or Quick (issue #55) ---- */
/* Off: the after-catch bar. The "Logged" toast in two rows: what was logged
   (and any new badge, which wraps instead of being cut off), then the same
   next steps as the catch scene. */
.toast.toast--catch { flex-direction: column; align-items: stretch; gap: 8px;
  width: calc(100vw - 32px); max-width: 440px; padding: 8px 8px 12px 16px; overflow: hidden; }
.toast--catch .toast-head { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.toast--catch .toast-head > span { flex: 1; min-width: 0; font-size: 19px; white-space: normal; }
.toast--catch .toast-extra { display: block; white-space: normal; color: var(--gold); font-size: 16px; } /* #e8b923 on #222: 8.6:1 */
.toast--catch .toast-close { flex-shrink: 0; width: 44px; height: 44px; background: transparent; border: 0; box-shadow: none;
  color: #fff; font-size: 22px; padding: 0; }
.toast--catch .toast-actions { display: flex; gap: 8px; padding-right: 8px; }
.toast--catch .toast-details { background: #fff; border-color: #fff; color: #222; }
.toast--catch .toast-scan { background: var(--gold); border-color: #7a5c0d; color: #222; }
.toast--catch .toast-undo { background: transparent; border-color: rgba(255,255,255,0.55); color: #fff; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast--catch { outline: 1px solid rgba(255,255,255,0.18); } }
:root[data-theme="dark"] .toast--catch { outline: 1px solid rgba(255,255,255,0.18); }
.catch-sheet { width: 100%; max-width: 480px; background: var(--screen-bg); color: var(--ink);
  border: 4px solid #111; border-bottom: 0; border-radius: 10px 10px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 160ms ease-out; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .catch-sheet { animation: none; } }
.catch-sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.catch-sheet-head .ball { width: 28px; height: 28px; border-width: 2px; flex-shrink: 0; }
.catch-sheet-head .ball::after { width: 8px; height: 8px; border-width: 2px; }
.catch-sheet-head .btn { min-height: 44px; }
.catch-sheet-body { display: flex; gap: 14px; align-items: flex-start; }
.catch-sheet-body .card-final-wrap { width: 112px; flex-shrink: 0; line-height: normal; }
.catch-sheet-body .card-final { display: block; width: 100%; height: auto; }
.catch-sheet-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 19px; }
.catch-sheet-meta strong { font-size: 22px; }
.catch-sheet-meta .muted { color: var(--muted); }
.catch-tier { display: inline-flex; align-items: center; gap: 8px; }
.catch-tier .dex-slot-tier { position: static; display: inline-block; }
.catch-sheet-note { margin-top: 6px; padding: 6px 10px; border-radius: 6px; font-size: 18px;
  background: var(--rare-tint); border: 2px solid var(--gold); color: var(--ink); }
.catch-sheet-note strong { font-size: inherit; }
.catch-sheet .catch-actions { margin-top: 16px; }
@media (min-width: 601px) {
  .catch-sheet { max-width: 440px; border-bottom: 4px solid #111; border-radius: 10px; }
}
/* logging: styles used only by this feature (src/features/logging). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Search modal ---- */

.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); }

/* ---- Shiny pulls ---- */
@media (max-width: 600px) {
  .pmon-row { font-size: 23px; padding: 8px 10px; }
}

/* ---- Dex toolbar: Filter / Search / Log ---- */

/* 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-meta { margin: 0; font-size: 19px; }
@media (max-width: 600px) {
  .card-preview-meta { font-size: 20px; }
}

/* ---- Pokédex filter ---- */
.log-or { text-align: center; margin: 14px 0 8px; opacity: 0.7; }

/* ---- Slab scanning ---- */

.nowrap { white-space: nowrap; }
@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; }
}

/* ---- Desktop readability (wider than 1024px) ---- */
@media (min-width: 1025px) {
  .card-preview-meta { font-size: 22px; }
}
/* dex: styles used only by this feature (src/features/dex). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Dex grid ---- */

.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); } /* zoomed sprites stay inside (no sideways scroll) */
/* Zoomed to the Pokémon's own bounding box by spriteFit() in src/lib/sprites.ts */
.dex-slot .dex-sprite img { position: absolute; max-width: none; height: auto; image-rendering: pixelated; }
.dex-slot-num { font-size: 16px; color: var(--muted); } /* --muted on --surface is 7:1 light, 6.5:1 Night; the old 0.6 opacity was 4.48:1 */ /* VT323 runs small: 12-13px was hard to read on iPad/desktop */
.dex-slot-name { font-size: 18px; line-height: 1.1; }

/* ---- 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 .meta { flex: 1; font-size: 15px; }
.catch-item .best-tag { color: var(--gold-text); font-size: 13px; }

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

/* ---- Views: Pokédex / Sets / Stats ---- */

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

/* ---- Mobile readability (2026-09-21) ---- */
@media (max-width: 600px) {
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .dex-slot-num { font-size: 16px; }
  .dex-slot-name { font-size: 18px; }
  .catch-item .meta { font-size: 19px; }
  .catch-item .best-tag { font-size: 17px; }
  .copy-details, .copy-money, .copy-notes { font-size: 18px; }
}

/* ---- Card zoom (tap a logged card's thumbnail) ---- */
.catch-item img.zoomable { cursor: zoom-in; }

/* ---- Type-themed catch scenes ---- */

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

/* ---- Dex toolbar: Filter / Search / Log ---- */
.dex-toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.btn--active { background: var(--ink); color: var(--on-ink); }

/* ---- Phone layout ---- */
@media (max-width: 600px) {

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

/* ---- Dex display toggle: Sprites / Binder ---- */
.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; }
/* 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.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; color: inherit; }
.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; }
}

/* ---- Card scanner ---- */
.dex-toolbar { grid-template-columns: repeat(3, 1fr); }

/* ---- Pokédex filter ---- */
.filter-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px;
}
.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-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-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 20px; }
.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 #filter-done { flex: 2; }
.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); }

@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; }
}

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

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

/* ---- Unknown Pokémon: tapping an uncaught slot ---- */
.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; }
/* 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) ---- */
.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); }

/* ---- Slab scanning ---- */

/* 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); }
@media (max-width: 600px), (pointer: coarse) {
  .skip-link:focus { min-height: var(--tap); box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
}
/* 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; }
@media (max-height: 500px) and (orientation: landscape) {
  .entry-art, .unknown-sprite { width: min(38vh, 220px); }
}

/* ---- Filter sheet, tidied (2026-09-24) ---- */
.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;
}
/* 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-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; }

/* ---- Binder pages (Settings → Binder pages / Page numbers) ---- */
.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; }

/* Swipe across (phones and tablets, Settings → Turning pages; SwipeBinder.tsx):
   one page at a time. pan-y leaves vertical scrolling to the browser and hands
   sideways drags to the pager; overflow: clip keeps the neighbour out of sight
   until it slides in. The page is as wide as the screen allows and no taller
   than what's left of it (--spread-h): 100dvh, the height visible right now,
   so a phone browser's address bar sliding in or out resizes the page with no
   re-measure, less the space above and below the grid, which useSwipeFit()
   measures (100vh first for browsers without dvh). There is no minimum: on a
   short screen the pockets shrink rather than the page scrolling (#133; a
   phone held sideways shows two pages instead, see below). Pockets keep
   their card shape (63:88). The sum takes the larger vertical padding (8px +
   10px on tablets) and the smaller sideways one (6px + 6px on phones), so a
   rounding slip makes the page smaller, never taller. */
.binder-swipe {
  position: relative; display: block; overflow: clip; touch-action: pan-y pinch-zoom;
  --spread-h: max(0px, calc(100vh - var(--swipe-above, 185px) - var(--swipe-below, 70px)));
  --spread-h: max(0px, calc(100dvh - var(--swipe-above, 185px) - var(--swipe-below, 70px)));
  --pocket-h: max(0px, calc((var(--spread-h) - 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 + 12px);
}
.binder-swipe .binder-page { width: min(100%, var(--page-w)); margin: 0 auto; box-sizing: border-box; }
/* While a finger drags, the next page rides in beside it. */
.binder-swipe-pg--peek { position: absolute; top: 0; left: 0; right: 0; }

/* The turn bar under the page: ‹  3 of 114 ▼  ›, at thumb height. */
.binder-turn { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 2px; }
.binder-turn-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0 0 4px; box-sizing: border-box;
  border: 2px solid var(--edge); border-radius: 50%; background: var(--surface); color: var(--ink);
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
  font-family: 'VT323', monospace; font-size: 34px; line-height: 1; cursor: pointer;
}
.binder-turn-btn:active { transform: translateY(2px); box-shadow: none; }
.binder-turn-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* At either end the arrow goes but keeps its space, so the counter stays put. */
.binder-turn-btn:disabled { visibility: hidden; }
/* The counter is a "Turn to" menu: the real <select> sits invisibly on top, so a tap opens the phone's own page list. */
.binder-turn-where {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 132px; min-height: 44px; padding: 0 12px; box-sizing: border-box;
  border: 2px solid var(--edge); border-radius: 999px; background: var(--surface);
  font-family: 'VT323', monospace; font-size: 20px; color: var(--ink);
}
.binder-turn-where .caret { font-size: 14px; color: var(--muted); }
.binder-turn-where:has(select:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-height: 500px) and (orientation: landscape) {
  body:has(.binder-spread--land) { padding: 0; }
  body:has(.binder-spread--land) .app { max-width: none; }
  .binder-spread--land {
    --land-gutter: 56px;
    --spread-h: max(0px, calc(100vh - 32px - 42px - 2px));
    --spread-h: max(0px, calc(100dvh - 32px - 42px - 2px));
    /* Page box: padding 6px + 8px, 6px gaps, no label. Pockets keep their card shape (63:88). */
    --pocket-h: max(0px, calc((var(--spread-h) - 14px - (var(--rows, 3) - 1) * 6px) / var(--rows, 3)));
    --page-w: calc(var(--pocket-h) * 63 / 88 * var(--cols, 3) + (var(--cols, 3) - 1) * 6px + 12px);
    display: grid; align-items: center; gap: 6px 0;
    grid-template-columns: minmax(var(--land-gutter), 1fr) auto minmax(var(--land-gutter), 1fr);
    grid-template-rows: 36px auto;
    touch-action: pan-y pinch-zoom; overflow: clip;
  }
  .binder-land-where { grid-column: 1 / -1; grid-row: 1; justify-self: center; min-height: 36px; font-size: 18px; }
  /* The invisible menu reaches 4px above and below: still a 44px tap. */
  .binder-land-where select { inset: -4px 0; height: auto; }
  .binder-spread--land .binder-turn-btn { grid-row: 2; align-self: center; justify-self: center; }
  .binder-land-prev { grid-column: 1; }
  .binder-land-next { grid-column: 3; }
  /* The spread slides within its own box; the next one rides in beside it while a finger drags. */
  .binder-land-view { grid-column: 2; grid-row: 2; position: relative; overflow: clip; }
  .binder-spread--land .binder-page-pair {
    display: grid; column-gap: 8px; align-items: start;
    grid-template-columns: repeat(2, min(var(--page-w), calc((100vw - 20px - 2 * var(--land-gutter) - 8px) / 2)));
  }
  .binder-spread--land .binder-page { padding: 6px 6px 8px; }
  .binder-spread--land .binder-page-label { display: none; }
  .binder-spread--land .binder-page-grid { gap: 6px; }
  .binder-spread--land .binder-page--blank { visibility: hidden; }
  /* The 4-across phone label sizes for every layout; 5 or 6 across, number only. */
  .binder-spread--land .binder-pocket :is(.dex-slot-name, .dex-slot-num) { font-size: 12px; }
  .binder-spread--land .binder-slot .dex-slot-tier { top: 4px; right: 4px; }
  .binder-spread--land .binder-page-grid:is([data-cols="5"], [data-cols="6"]) .binder-pocket .dex-slot-name { display: none; }
}
.binder-slot--empty { display: block; opacity: 0.35; }
@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; }
}

/* ---- Desktop width (wider than 1024px) ---- */
@media (min-width: 1025px) {
  /* 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; }
  html.binder-full :is(.topbar, .tabs-bar, .dex-controls, .dex-mode, .first-run, .install-tip) { display: none; }
  .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) ---- */
@media (min-width: 1025px) {
  .dex-mode-btn { font-size: 17px; }
  /* Filter sheet */
  .ftile { font-size: 18px; }
  .ftile small, .ftile--gen small { font-size: 16px; }
  .filter-label { font-size: 17px; }
  .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; }
}

/* ---- What trainers see with pictures switched off ---- */

/* Binder pocket, card pictures off: a text card in the pocket instead of the
   picture. Themed (surface + ink), so it reads in light and dark. */
.binder-slot.text-card {
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line), 0 2px 6px rgba(0,0,0,0.45);
}
.text-card-body {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  gap: 4px; padding: 10px 8px; text-align: center;
}
.text-card-body .dex-slot-name { font-size: 18px; }
.text-card-body .text-card-set,
.text-card-body .text-card-num { font-size: 15px; color: var(--muted); line-height: 1.1; }

/* Uncaught sprites: the real image sits under a CSS filter, so stop the browser
   from dragging it, long-press-saving it or selecting it (which would reveal it).
   pointer-events: none lets the tap fall through to the slot button. */
.dex-slot.uncaught img,
.binder-slot.uncaught .binder-pocket img,
.unknown-sprite img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}
/* ranks: styles used only by this feature (src/features/ranks). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Leaderboard ---- */
.lb-main > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--red-text); white-space: nowrap; }

/* ---- Feed ---- */
.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-icon img { width: 36px; height: 36px; margin: 0 -6px; image-rendering: pixelated; }
.feed-sub { font-size: 14px; opacity: 0.7; }
.feed-when { font-size: 14px; color: var(--muted); }
/* 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; }
@media (max-width: 600px) {
  .feed-sub, .feed-when { font-size: 16px; }
}

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

/* ---- Mobile readability (2026-09-21) ---- */
@media (max-width: 600px) {
  .gen-tab { font-size: 17px; padding: 6px 12px; }
}

/* ---- 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-sub { font-size: 15px; opacity: 0.7; }

@media (max-width: 600px) {
  .lb-main { font-size: 21px; }
  .lb-sub { font-size: 17px; }
  .lb-score { font-size: 11px; }
}

/* ---- Leaderboard buttons, feed, profiles ---- */
button.lb-row { width: 100%; text-align: left; font-family: inherit; color: inherit; cursor: pointer; }
.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-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 17px; line-height: 1.15; }
.profile-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.profile-card { margin: 0; }
.profile-card figcaption { font-size: 13px; text-align: center; opacity: 0.75; margin-top: 2px; }
.trade-meta { display: block; font-size: 12px; }
.profile-card.holo img { box-shadow: 0 0 0 2px var(--gold); }

/* ---- Shiny pulls ---- */
@media (max-width: 600px) {
  .feed-text { font-size: 19px; }
  .profile-card figcaption { font-size: 15px; }
}

/* ---- Header (all sizes): one line — lens, count, account button ---- */

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

/* ---- Phone layout ---- */
@media (max-width: 600px) {

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

/* ---- Slabs ---- */
.feed-item--slab { border-color: #9aa6ae; background: linear-gradient(90deg, var(--slab-tint), var(--surface)); }

/* ---- Wishlist tab ---- */
.feed-item--pack .feed-text { min-width: 0; }
.feed-strip-more { align-self: center; flex-shrink: 0; font-size: 16px; opacity: 0.7; padding: 0 4px; }

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

/* ---- Friends (friend codes and requests) ---- */
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }

/* ---- Desktop readability (wider than 1024px) ---- */
@media (min-width: 1025px) {
  .gen-tab { font-size: 17px; padding: 6px 12px; }
  /* 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; }
}
/* sets: styles used only by this feature (src/features/sets). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Dex grid ---- */

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }

/* ---- Views: Pokédex / Sets / Stats ---- */

/* Sets */
.set-list { display: flex; flex-direction: column; gap: 6px; }
.set-row:hover { border-color: var(--link); }
.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; }
.set-to-complete { margin: 4px 0; text-align: center; }

/* ---- Wishlist tab ---- */
.series > .set-list { padding: 8px; }

/* ---- Filter sheet, tidied (2026-09-24) ---- */
/* 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 .wish-sort { margin: 0; }
.section-head { margin: 20px 0 10px; }
.section-head .section-title { margin: 0; }

/* ---- Desktop width (wider than 1024px) ---- */
@media (min-width: 1025px) {
  /* 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; }
}
/* slabs: styles used only by this feature (src/features/slabs). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Slabs ---- */
.slab-totals { margin-bottom: 10px; }
.slab-sort { margin: 0 0 10px; }

/* ---- Slab scanning ---- */
.slab-scanned { margin: 8px 0 0; }
/* stats: styles used only by this feature (src/features/stats). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Views: Pokédex / Sets / Stats ---- */
.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; }

@media (max-width: 480px) {
  .bar-row { grid-template-columns: 96px 1fr 56px; }
}

/* ---- Mobile readability (2026-09-21) ---- */
@media (max-width: 600px) {
  .bar-row { font-size: 18px; grid-template-columns: 104px 1fr 64px; }
}

/* ---- Dex display toggle: Sprites / Binder ---- */

/* Recently logged: the row opens the dex entry, ✕ removes that copy. */
.mini-row-wrap { display: flex; align-items: stretch; gap: 6px; }

/* ---- Desktop readability (wider than 1024px) ---- */
@media (min-width: 1025px) {
  .bar-row { font-size: 18px; grid-template-columns: 140px 1fr 72px; }
}
/* wants: styles used only by this feature (src/features/wants). Shared styles,
   the palette and fonts are in public/css/style.css, which loads first. */

/* ---- Wishlist tab ---- */
.wish-summary { margin: 0 0 12px; font-size: 17px; }
.wish-tile { gap: 6px; }
.wish-card { padding: 0; border: 0; background: none; cursor: zoom-in; }

/* ---- 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-cell .wish-actions { justify-content: center; flex-wrap: nowrap; gap: 4px; }

/* ---- Trades tab (tiles shared with profiles: components/TradeTile.tsx) ---- */
.trade-edit { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: center; }

/* ---- Desktop readability (wider than 1024px) ---- */
@media (min-width: 1025px) {
  .wish-summary { font-size: 19px; }
}
