:root {
  --bg: #09070d;
  --ink: #f4efe4;
  --muted: #9b9488;
  --line: rgba(244, 239, 228, 0.1);
  --gold: #f0c14b;
  --gold-2: #ffec9a;
  --rip: #ff4d6d;
  --wotc: #d4a017;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --font: "Sora", system-ui, sans-serif;
  --display: "Archivo Black", "Sora", sans-serif;
}

* { box-sizing: border-box; }
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(140, 90, 255, 0.14), transparent 55%),
    radial-gradient(700px 480px at -10% 110%, rgba(20, 8, 40, 0.45), transparent 50%),
    var(--bg);
  overflow-x: hidden;
  transition: background 0.45s ease;
}
body.on-home {
  background:
    radial-gradient(1100px 620px at 88% -8%, rgba(240, 193, 75, 0.14), transparent 52%),
    radial-gradient(860px 540px at 8% 12%, rgba(118, 64, 255, 0.2), transparent 56%),
    radial-gradient(700px 480px at -10% 110%, rgba(20, 8, 40, 0.45), transparent 50%),
    var(--bg);
}
body.on-auth {
  background:
    radial-gradient(980px 560px at 12% -8%, rgba(155, 109, 255, 0.18), transparent 54%),
    radial-gradient(820px 480px at 92% 8%, rgba(240, 193, 75, 0.12), transparent 50%),
    radial-gradient(700px 480px at -10% 110%, rgba(20, 8, 40, 0.45), transparent 50%),
    var(--bg);
}
body.on-collection {
  background:
    radial-gradient(980px 540px at 92% -12%, rgba(240, 193, 75, 0.11), transparent 52%),
    radial-gradient(760px 480px at 6% 18%, rgba(118, 64, 255, 0.16), transparent 56%),
    radial-gradient(700px 480px at -10% 110%, rgba(20, 8, 40, 0.45), transparent 50%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.nav-btn, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 8;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.noscript-note {
  margin: 24px auto;
  max-width: 640px;
  padding: 16px 20px;
  border: 1px solid rgba(240, 193, 75, 0.35);
  border-radius: 14px;
  background: rgba(240, 193, 75, 0.06);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.noscript-note b { display: block; margin-bottom: 4px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 7, 13, 0.78);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(160deg, var(--gold), #c4891a);
  color: #1a1408; font-family: var(--display); font-size: 18px;
  box-shadow: 0 0 24px rgba(240, 193, 75, 0.35);
}
.brand-name { font-family: var(--display); letter-spacing: 0.04em; font-size: 18px; line-height: 1; }
.brand-name span { color: var(--gold); }
.brand-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.nav-btn.active { background: var(--ink); color: #111; }
.nav-btn.active:hover { background: var(--ink); color: #111; }
/* Splits primary navigation from the account-level tabs. */
.nav-sep { width: 1px; align-self: stretch; margin: 4px 4px; background: var(--line); }

.header-right { display: flex; align-items: center; gap: 10px; }
.pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); font-weight: 600; font-size: 13px; }
.pill.gold { border-color: rgba(240,193,75,0.35); color: var(--gold-2); }
.claim { border: 0; background: linear-gradient(180deg, #ffe08a, var(--gold)); color: #1a1408; font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.claim:disabled { opacity: 0.45; cursor: default; }
.auth-entry {
  min-width: 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
}
.trainer-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 4px 10px 4px 4px;
  border: 1px solid rgba(240, 193, 75, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}
.trainer-chip:hover { background: rgba(255, 255, 255, 0.08); }
.trainer-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--avatar, var(--gold));
  color: #1a1408;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
}
.trainer-chip-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
  line-height: 1.15;
}
.trainer-chip-copy b {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trainer-chip-copy small {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 80px; }
body.on-home .wrap { width: min(1240px, calc(100% - 40px)); }
body.on-shop .wrap { width: min(1280px, calc(100% - 40px)); }
body.on-collection .wrap { width: min(1240px, calc(100% - 40px)); }

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}
.shop-layout .pack-grid { grid-template-columns: repeat(2, 1fr); }
.shop-rail {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 16px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    rgba(14, 11, 20, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 239, 228, 0.18) transparent;
}
.shop-rail-head { margin: 0 0 12px; padding: 0 4px; }
.shop-rail-head h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.03em;
}
.shop-rail-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.shop-rail-head .kicker { margin-bottom: 6px; }
.set-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail-era {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 7, 13, 0.45);
  overflow: hidden;
}
.rail-era[open] { background: rgba(9, 7, 13, 0.72); }
.rail-era summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}
.rail-era summary::-webkit-details-marker { display: none; }
.rail-era summary::marker { content: ""; }
.rail-era-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.rail-era-title b {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.02em;
  font-weight: 400;
}
.rail-era-title small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail-era-count {
  flex: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rail-era summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  rotate: 45deg;
  translate: 0 -2px;
  transition: rotate 0.16s ease, translate 0.16s ease;
}
.rail-era[open] > summary::after {
  rotate: 225deg;
  translate: 0 2px;
}
.rail-sets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px 8px;
}
.rail-set {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.rail-set:hover { border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); }
.rail-set.active {
  border-color: rgba(240, 193, 75, 0.5);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.14), rgba(255, 255, 255, 0.02));
}
.rail-set.active b { color: var(--gold); }
.rail-set.is-queued { cursor: default; opacity: 0.72; }
.rail-set.is-queued:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.03); }
.rail-set:disabled { opacity: 0.45; cursor: default; }
.rail-symbol {
  width: 22px;
  height: 22px;
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.rail-set-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.rail-set-copy b {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-set-copy small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-set .live-tag,
.rail-set .soon {
  flex: none;
  padding: 3px 6px;
}

.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; align-items: center; margin-bottom: 42px; }
.kicker { color: var(--gold); letter-spacing: 0.22em; text-transform: uppercase; font-size: 11px; font-weight: 700; margin: 0 0 12px; }
h1 { font-family: var(--display); font-size: clamp(42px, 7vw, 76px); line-height: 0.9; margin: 0 0 16px; letter-spacing: -0.02em; }
h1 em { font-style: normal; color: var(--gold); }
.lede { max-width: 50ch; color: #cbbfae; font-size: 16px; line-height: 1.65; margin: 0 0 22px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stat { min-width: 110px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.03); }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }

.hero-art { position: relative; height: 360px; }
.float-card {
  position: absolute; width: 168px;
  filter: drop-shadow(0 24px 30px rgba(0,0,0,0.55));
  animation: float 5.5s ease-in-out infinite;
}
.float-card:nth-child(1) { left: 28px; top: 8px; transform: rotate(-8deg); }
.float-card:nth-child(2) { right: 36px; top: 48px; animation-delay: -1.8s; transform: rotate(7deg); }
.float-card:nth-child(3) { left: 110px; bottom: 0; animation-delay: -3s; transform: rotate(3deg); width: 140px; }
.float-card:nth-child(4) { right: 8px; bottom: 18px; animation-delay: -4.2s; transform: rotate(-4deg); width: 128px; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 8px 0 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-family: var(--display); letter-spacing: 0.04em; font-size: 22px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.pack-odds { color: var(--gold) !important; letter-spacing: 0.04em; }

.pack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.pack-card {
  border: 1px solid var(--line); border-radius: 22px; padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.pack-tag { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; color: var(--gold); margin-bottom: 12px; }
.pack-card h3 { margin: 14px 0 8px; font-family: var(--display); font-size: 24px; }
.blurb { color: #c3b9ac; font-size: 14px; line-height: 1.55; margin: 0 0 16px; flex: 1; }
.pack-meta { display: flex; justify-content: space-between; align-items: center; }
.cost { font-weight: 700; color: var(--gold-2); }
.buy { border: 0; background: var(--ink); color: #111; font-weight: 700; padding: 10px 16px; border-radius: 12px; }
.buy:disabled { opacity: 0.4; cursor: default; }

.shop-wrapper, .booster {
  position: relative;
  background: transparent;
  border: 0;
}
.shop-wrapper {
  display: flex;
  justify-content: center;
  padding: 12px 8px 4px;
  background: transparent;
}
.shop-wrapper picture,
.pack-art picture { display: contents; }
.shop-wrapper img {
  height: 280px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 22px 28px rgba(0,0,0,0.72));
}
.pack-card:hover { border-color: rgba(240,193,75,0.35); transform: translateY(-4px); }

.open-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.trick-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.trick-toggle input { accent-color: var(--gold); width: 16px; height: 16px; }
.trick-hint { color: var(--muted); font-size: 12px; }

.soon, .live-tag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  background: #111; color: var(--gold); padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--gold);
}
.live-tag { color: #111; background: var(--gold); }

.tcg {
  --px: 0.5;
  --py: 0.42;
  --hyp: 0.12;
  position: relative;
  aspect-ratio: 63 / 88;
  background: transparent;
  overflow: visible;
  isolation: isolate;
  container-type: inline-size;
  /* Art window in 63×88 space, measured off unpadded SV / Mega Evolution
     scans (733×1024). Name-bar seam ≈ image y=97 → SVG y=82; Pokédex bar
     ≈ image y=484 → SVG y=416. Left edge sits on the inner art line
     (x=50), not the type-colored frame. */
  /* Foil textures — generated by scripts/make_foil_textures.py, all seamless. */
  --foil-grain: url("../assets/foil/grain.png");
  --foil-glitter: url("../assets/foil/glitter.png");
  --foil-cosmos: url("../assets/foil/cosmos.png");
  --foil-weave: url("../assets/foil/weave.png");
  --foil-metal: url("../assets/foil/metal.png");
  --foil-facet: url("../assets/foil/facet.png");
  --foil-prism: url("../assets/foil/prism.png");
  --win-holo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='880' viewBox='0 0 630 880' preserveAspectRatio='xMidYMid meet'%3E%3Crect width='630' height='880' fill='white' fill-opacity='0'/%3E%3Crect x='50' y='82' width='534' height='334' fill='white'/%3E%3C/svg%3E");
  --win-evo: url("../assets/masks/win-evo.png");
  /* Same windows as the .foil-holo.foil-energy / .foil-holo.foil-trainer
     clip-paths below, as SVG masks for the reverse-holo subtract path. */
  --win-holo-energy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='880' viewBox='0 0 630 880' preserveAspectRatio='xMidYMid meet'%3E%3Crect width='630' height='880' fill='white' fill-opacity='0'/%3E%3Crect x='24' y='120' width='580' height='445' rx='8' fill='white'/%3E%3C/svg%3E");
  --win-holo-trainer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='880' viewBox='0 0 630 880' preserveAspectRatio='xMidYMid meet'%3E%3Crect width='630' height='880' fill='white' fill-opacity='0'/%3E%3Crect x='49' y='124' width='538' height='337' rx='8' fill='white'/%3E%3C/svg%3E");
}
.tcg img,
.tcg .foil,
.tcg .glare {
  /* Printed card radius (2.5 mm / 63×88 mm). Clips square scans and the
     black corner matte some mirrors baked in. Foil pattern is unchanged. */
  border-radius: 3.97% / 2.84%;
}
.tcg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}

/* Printed rarity mark, bottom-right like the real cards. */
.pip {
  font-style: normal;
  line-height: 1;
  letter-spacing: -0.04em;
}
.pip.tone-ink { color: #ece5d7; }
.pip.tone-gold { color: #f4c752; text-shadow: 0 0 6px rgba(244, 199, 82, 0.5); }
.pip.tone-silver { color: #d3daea; }
.pip.tone-future {
  background: linear-gradient(135deg, #5fb8ff, #ff6fd0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pip.tone-mega { color: #ff5fa2; }
.pip.tone-megaAlt { color: #66e08a; }
.pip.tone-black { color: #14131a; -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.9); }
.pip.tone-white { color: #ffffff; }
.pip.tone-ace { color: #ff3d8b; text-shadow: 0 0 6px rgba(255, 61, 139, 0.45); }
.pip.tone-shiny { color: #9fd8ff; text-shadow: 0 0 6px rgba(159, 216, 255, 0.45); }

.rarity-ico {
  width: 15px;
  height: 15px;
  flex: none;
  color: #ece5d7;
}
.rarity-ico svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.rarity-ico.tone-gold { color: #f4c752; filter: drop-shadow(0 0 4px rgba(244, 199, 82, 0.55)); }
.rarity-ico.tone-silver { color: #d3daea; filter: drop-shadow(0 0 3px rgba(211, 218, 234, 0.35)); }
.rarity-ico.tone-future { color: #d06bff; filter: drop-shadow(0 0 4px rgba(180, 100, 255, 0.5)); }
.rarity-ico.tone-mega { color: #ff5fa2; filter: drop-shadow(0 0 4px rgba(255, 95, 162, 0.45)); }
.rarity-ico.tone-megaAlt { color: #66e08a; }
.rarity-ico.tone-black { color: #14131a; filter: drop-shadow(0 0 0 0.7px #fff); }
.rarity-ico.tone-white { color: #ffffff; }
.rarity-ico.tone-ace { color: #ff3d8b; filter: drop-shadow(0 0 4px rgba(255, 61, 139, 0.45)); }
.rarity-ico.tone-shiny { color: #9fd8ff; filter: drop-shadow(0 0 4px rgba(159, 216, 255, 0.45)); }

.rarity-stamp {
  position: absolute;
  right: 4.5%;
  bottom: 3.4%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  padding: 0.32em 0.52em;
  border-radius: 999px;
  background: rgba(6, 4, 10, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.65);
  font-size: clamp(12px, 12cqw, 24px);
  line-height: 1;
  pointer-events: none;
}
/* Reverse holos share their rarity symbol with the normal print, so the stamp
   itself carries the tell. */
.rarity-stamp.rev {
  border-color: rgba(150, 225, 255, 0.7);
  box-shadow: 0 0 9px rgba(120, 215, 255, 0.4), 0 2px 7px rgba(0, 0, 0, 0.65);
}

/* Both overlay layers mask themselves against the card art, so the shine
   covers the entire card and clips exactly at its printed rounded corners
   rather than at a guessed rectangle. mask-size:contain mirrors the img's
   object-fit:contain so the geometry lines up at any card size. */
.tcg .foil,
.tcg .glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-mask-image: var(--art);
  mask-image: var(--art);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Clear varnish gloss every card has, tracking the cursor. */
.tcg .glare {
  z-index: 4;
  opacity: 0;
  transition: opacity 0.18s ease;
  mix-blend-mode: overlay;
  background: radial-gradient(
    farthest-corner circle at var(--mx, 50%) var(--my, 50%),
    hsla(0, 0%, 100%, 0.42) 0%,
    hsla(0, 0%, 100%, 0.1) 24%,
    transparent 58%
  );
}
.tcg.lit .glare { opacity: 0.32; }
.tcg.lit.foil-sir .glare,
.tcg.lit.foil-gold .glare,
.tcg.lit.foil-ultra .glare,
.tcg.lit.foil-ex .glare { opacity: 0.4; }
/* ---- Foil ----------------------------------------------------------------
   Pointer-driven holofoil: color-dodge rainbow + grain, same family of tricks
   as a real card under a lamp. Each rarity gets its own pattern. */
.tcg .foil {
  z-index: 3;
  opacity: calc(0.28 * var(--foil-strength, 1));
  transition: opacity 0.2s ease, filter 0.2s ease;
  mix-blend-mode: color-dodge;
  filter: brightness(0.72) contrast(1.2) saturate(0.45);
}
.tcg.lit .foil {
  opacity: calc(0.46 * var(--foil-strength, 1));
  filter: brightness(0.78) contrast(1.28) saturate(0.55);
}
.tcg.foil-none .foil { display: none; }

/* Sparkle grain: a real tiled noise texture (assets/foil/grain.png, generated
   by scripts/make_foil_textures.py) crawling with the pointer, with the old
   procedural specks kept underneath so the sparkle has two scales. */
.tcg .foil::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.4;
  background-image:
    var(--foil-grain),
    radial-gradient(circle at 18% 22%, #fff 0 0.55px, transparent 1px),
    radial-gradient(circle at 72% 48%, #fff 0 0.45px, transparent 0.9px),
    radial-gradient(circle at 44% 78%, #ffe9b8 0 0.5px, transparent 0.95px),
    radial-gradient(circle at 86% 16%, #c8f4ff 0 0.4px, transparent 0.8px);
  background-size: 128px 128px, 17px 17px, 25px 21px, 13px 15px, 21px 27px;
  background-position:
    calc(var(--px) * 34px) calc(var(--py) * 26px),
    calc(var(--px) * 28px) calc(var(--py) * 20px),
    calc(var(--px) * -18px) calc(var(--py) * 24px),
    calc(var(--px) * 14px) calc(var(--py) * -16px),
    calc(var(--px) * -22px) calc(var(--py) * 10px);
}

/*
 * Specular bars. Two banded gradients rather than one, tracked at different
 * rates and in opposite directions, then blended together with `screen`. Real
 * foil is two reflective layers at slightly different depths, and it is that
 * parallax between them — not the bars themselves — that reads as depth when
 * the card moves.
 */
.tcg .foil::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: hard-light;
  opacity: 0.55;
  --bar: 3%;
  --bar-lit: rgba(255, 255, 255, 0.5);
  --bar-off: rgba(0, 0, 0, 0);
  background-image:
    repeating-linear-gradient(
      98deg,
      var(--bar-off) calc(var(--bar) * 2),
      var(--bar-lit) calc(var(--bar) * 3),
      var(--bar-off) calc(var(--bar) * 3.6),
      var(--bar-lit) calc(var(--bar) * 4),
      var(--bar-off) calc(var(--bar) * 5),
      var(--bar-off) calc(var(--bar) * 13)
    ),
    repeating-linear-gradient(
      82deg,
      var(--bar-off) calc(var(--bar) * 2),
      var(--bar-lit) calc(var(--bar) * 3),
      var(--bar-off) calc(var(--bar) * 3.4),
      var(--bar-lit) calc(var(--bar) * 4),
      var(--bar-off) calc(var(--bar) * 5),
      var(--bar-off) calc(var(--bar) * 9)
    );
  background-size: 200% 200%, 200% 200%;
  /* Opposite signs and different multipliers — this is the whole trick. */
  background-position:
    calc(50% - var(--px) * 165%) calc(50% + var(--py) * 60%),
    calc(50% + var(--px) * 90%) calc(50% - var(--py) * 75%);
  background-blend-mode: screen;
}

/* Idle life when you're not touching the card. */
.tcg:not(.foil-none):not(.lit) .foil::after {
  animation: foilGlint 5.6s ease-in-out infinite;
}
/* The two bar layers drift apart and back, so the idle card still shows the
   parallax rather than one flat sweep. */
@keyframes foilGlint {
  0% { background-position: 150% 40%, -50% 60%; }
  40% { background-position: -60% 60%, 160% 40%; }
  100% { background-position: -60% 60%, 160% 40%; }
}

/* Regular holo / rare: rainbow bars in the illustration window only. */
.foil-holo .foil {
  background-image:
    repeating-linear-gradient(
      90deg,
      hsl(2 92% 68%) 0 3%,
      hsl(48 95% 66%) 7%,
      hsl(118 80% 62%) 14%,
      hsl(188 90% 64%) 21%,
      hsl(248 88% 68%) 28%,
      hsl(308 85% 68%) 35%,
      hsl(2 92% 68%) 42%
    ),
    /* 1px scanlines: at 8px the banding read as stripes rather than foil. */
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.55) 0 1px,
      rgba(255, 255, 255, 0.5) 1px 2px
    ),
    radial-gradient(
      farthest-corner circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.28) 0%,
      transparent 42%
    );
  background-size: 240% 100%, 2px 100%, 140% 140%;
  background-position:
    calc(var(--px) * 100%) 0,
    0 0,
    var(--mx, 50%) var(--my, 50%);
  /* Blend the scanlines into the rainbow in a single paint rather than
     stacking another element over it — the interference between the two is
     what gives the rainbow its metallic grain. */
  background-blend-mode: overlay, normal, normal;
}
.foil-holo .foil,
.foil-holo .glare {
  -webkit-mask-image: var(--art);
  mask-image: var(--art);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Illustration inner frame (63×88): top 82, right 46, bottom 464, left 50. */
  -webkit-clip-path: inset(9.318% 7.302% 52.727% 7.937%);
  clip-path: inset(9.318% 7.302% 52.727% 7.937%);
}
/* Stage 1/2: bitmap window with the evo badge punched out (same 733×1024
   as the scans). clip-path inset is off — percentages on the clipped box
   moved the hole into the art. */
.foil-holo.foil-evo .foil,
.foil-holo.foil-evo .glare {
  -webkit-clip-path: none;
  clip-path: none;
  -webkit-mask-image: var(--art), var(--win-evo);
  -webkit-mask-size: contain, contain;
  -webkit-mask-position: center, center;
  -webkit-mask-repeat: no-repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-image: var(--art), var(--win-evo);
  mask-mode: alpha, alpha;
  mask-size: contain, contain;
  mask-position: center, center;
  mask-repeat: no-repeat, no-repeat;
  mask-composite: intersect;
}
/* "Trainer's Pokemon": an owner portrait sits over the bottom-right of the
   illustration, and the foil stops at the character's outline. Every owner
   draws a different one — N's hair spikes up, Iono's sweeps left, Ethan wears
   a cap, Team Rocket adds an "R" — so the window is cut per portrait by
   scripts/make_owner_masks.py and named on the card by --win-owner. The
   evolution badge is punched into the same file, so this replaces --win-evo
   rather than stacking with it. */
.foil-holo.foil-owner .foil,
.foil-holo.foil-owner .glare {
  -webkit-clip-path: none;
  clip-path: none;
  -webkit-mask-image: var(--art), var(--win-owner);
  -webkit-mask-size: contain, contain;
  -webkit-mask-position: center, center;
  -webkit-mask-repeat: no-repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-image: var(--art), var(--win-owner);
  mask-mode: alpha, alpha;
  mask-size: contain, contain;
  mask-position: center, center;
  mask-repeat: no-repeat, no-repeat;
  mask-composite: intersect;
}
/* Special Energy: art window runs nearly edge to edge, much wider than the
   Pokémon one. Measured off me5-83 / me5-84 (733×1024): 28,139 → 703,657,
   i.e. 24,120 → 604,565 here. */
.foil-holo.foil-energy .foil,
.foil-holo.foil-energy .glare {
  -webkit-mask-image: var(--art);
  mask-image: var(--art);
  -webkit-clip-path: inset(13.636% 4.127% 35.795% 3.810%);
  clip-path: inset(13.636% 4.127% 35.795% 3.810%);
}
/* Trainer: Supporter, Item, Stadium and Tool all share one window — checked
   against me5-78, me5-72 and me5-76 (733×1024): 57,144 → 683,537, i.e.
   49,124 → 587,461 here. Horizontally it lines up with the Pokémon window. */
.foil-holo.foil-trainer .foil,
.foil-holo.foil-trainer .glare {
  -webkit-mask-image: var(--art);
  mask-image: var(--art);
  -webkit-clip-path: inset(14.091% 6.825% 47.614% 7.778%);
  clip-path: inset(14.091% 6.825% 47.614% 7.778%);
}
/* Pokémon ex: illustration is the whole face, so skip the window cutout.
   Crystal facets over the rainbow give the full-art foil its angular break-up
   instead of a smooth sweep. */
.foil-ex .foil {
  background-image:
    var(--foil-facet),
    repeating-linear-gradient(
      90deg,
      hsl(2 92% 68%) 0 3%,
      hsl(48 95% 66%) 7%,
      hsl(118 80% 62%) 14%,
      hsl(188 90% 64%) 21%,
      hsl(248 88% 68%) 28%,
      hsl(308 85% 68%) 35%,
      hsl(2 92% 68%) 42%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.5) 0 1px,
      rgba(255, 255, 255, 0.45) 1px 2px
    ),
    radial-gradient(
      farthest-corner circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.22) 0%,
      transparent 42%
    );
  background-size: 150px 150px, 240% 100%, 2px 100%, 140% 140%;
  background-position:
    calc(var(--px) * 26px) calc(var(--py) * 20px),
    calc(var(--px) * 100%) 0,
    0 0,
    var(--mx, 50%) var(--my, 50%);
  background-blend-mode: overlay, overlay, normal, normal;
}

/* Reverse: cosmos holofoil on the frame/text, photo stays matte. The real
   cosmos flake texture carries the pattern now; the gradients under it supply
   the colour it reflects. */
.foil-reverse .foil {
  opacity: 0.4;
  background-image:
    var(--foil-cosmos),
    radial-gradient(circle at 20% 30%, #fff 0 0.7px, transparent 1.1px),
    radial-gradient(circle at 70% 60%, #d4f0ff 0 0.6px, transparent 1px),
    radial-gradient(circle at 45% 80%, #ffd6f2 0 0.55px, transparent 0.95px),
    linear-gradient(
      115deg,
      hsl(200 90% 70% / 0.3),
      hsl(280 80% 72% / 0.3),
      hsl(40 90% 68% / 0.24),
      hsl(160 80% 68% / 0.3)
    );
  background-size:
    192px 192px, 14px 14px, 22px 18px, 11px 13px, 220% 220%;
  background-position:
    calc(var(--px) * 26px) calc(var(--py) * 22px),
    calc(var(--px) * 16px) calc(var(--py) * 14px),
    calc(var(--px) * -12px) calc(var(--py) * 18px),
    calc(var(--px) * 10px) calc(var(--py) * -10px),
    calc(var(--px) * 80%) calc(var(--py) * 80%);
  /* Flakes take their colour from the gradient beneath instead of sitting on
     top of it as a grey film. */
  background-blend-mode: overlay, normal, normal, normal, normal;
}
.tcg.lit.foil-reverse .foil { opacity: calc(0.5 * var(--foil-strength, 1)); }
.foil-reverse .foil {
  -webkit-mask-image: var(--art), var(--win-holo);
  -webkit-mask-size: contain, contain;
  -webkit-mask-position: center, center;
  -webkit-mask-repeat: no-repeat, no-repeat;
  -webkit-mask-composite: source-out;
  mask-image: var(--art), var(--win-holo);
  mask-mode: alpha, alpha;
  mask-size: contain, contain;
  mask-position: center, center;
  mask-repeat: no-repeat, no-repeat;
  mask-composite: subtract;
}
/* Stage 1/2: the window's top-left corner cuts through the evo badge, so with
   the plain rect the foil stopped halfway across it and left a seam. --win-evo
   takes the badge back out of the subtracted region, so the badge is foiled
   edge to edge — which is also how a real reverse holo prints it, the badge
   being part of the foiled frame layer rather than the illustration. */
.foil-reverse.foil-evo .foil {
  -webkit-mask-image: var(--art), var(--win-evo);
  mask-image: var(--art), var(--win-evo);
}
/* Reverse holo takes the same file the other way round: subtracting a window
   that already has the portrait cut out of it leaves the portrait foiled,
   which is how a real reverse prints it — the badge belongs to the foiled
   frame layer, not to the matte illustration. */
.foil-reverse.foil-owner .foil {
  -webkit-mask-image: var(--art), var(--win-owner);
  mask-image: var(--art), var(--win-owner);
}
.foil-reverse.foil-energy .foil {
  -webkit-mask-image: var(--art), var(--win-holo-energy);
  mask-image: var(--art), var(--win-holo-energy);
}
.foil-reverse.foil-trainer .foil {
  -webkit-mask-image: var(--art), var(--win-holo-trainer);
  mask-image: var(--art), var(--win-holo-trainer);
}
.foil-reverse .glare {
  -webkit-mask-image: var(--art), var(--win-holo);
  -webkit-mask-size: contain, contain;
  -webkit-mask-position: center, center;
  -webkit-mask-repeat: no-repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-image: var(--art), var(--win-holo);
  mask-mode: alpha, alpha;
  mask-size: contain, contain;
  mask-position: center, center;
  mask-repeat: no-repeat, no-repeat;
  mask-composite: intersect;
}
.foil-reverse.foil-evo .glare {
  -webkit-mask-image: var(--art), var(--win-evo);
  mask-image: var(--art), var(--win-evo);
}
.foil-reverse.foil-owner .glare {
  -webkit-mask-image: var(--art), var(--win-owner);
  mask-image: var(--art), var(--win-owner);
}
.foil-reverse.foil-energy .glare {
  -webkit-mask-image: var(--art), var(--win-holo-energy);
  mask-image: var(--art), var(--win-holo-energy);
}
.foil-reverse.foil-trainer .glare {
  -webkit-mask-image: var(--art), var(--win-holo-trainer);
  mask-image: var(--art), var(--win-holo-trainer);
}
/* Illustration Rare: full-art glitter, shinier than a window holo. */
.foil-ir .foil {
  background-image:
    var(--foil-glitter),
    radial-gradient(circle at 24% 28%, #fff 0 0.7px, transparent 1.2px),
    radial-gradient(circle at 66% 54%, #fff6c8 0 0.6px, transparent 1.1px),
    radial-gradient(circle at 48% 84%, #c8f0ff 0 0.5px, transparent 1px),
    repeating-linear-gradient(48deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-38deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 7px),
    linear-gradient(
      118deg,
      hsl(320 90% 70% / 0.45),
      hsl(45 95% 68% / 0.45),
      hsl(140 80% 65% / 0.4),
      hsl(200 90% 68% / 0.45),
      hsl(270 85% 70% / 0.45)
    );
  background-size:
    170px 170px,
    15px 15px, 23px 19px, 11px 14px,
    100% 100%, 100% 100%,
    260% 260%;
  background-position:
    calc(var(--px) * 30px) calc(var(--py) * 24px),
    calc(var(--px) * 20px) calc(var(--py) * 16px),
    calc(var(--px) * -16px) calc(var(--py) * 20px),
    calc(var(--px) * 12px) calc(var(--py) * -14px),
    0 0, 0 0,
    calc(var(--px) * 90%) calc(var(--py) * 70%);
  filter: brightness(0.78) contrast(1.22) saturate(0.5);
}
.tcg.lit.foil-ir .foil {
  opacity: 0.52;
  filter: brightness(0.82) contrast(1.3) saturate(0.6);
}

/* Special Illustration Rare: stamped/etched texture like Pokumon “Textured”
   holofoil — grain and crosshatch catch the lamp, rainbow rides the ridges. */
/*
 * Premium foils.
 *
 * These used to inherit `mix-blend-mode: color-dodge` from `.tcg .foil` with a
 * flat brightness around 0.8, which blew out to near-white over bright card
 * art. Two changes fix that, both borrowed as technique from how the
 * pokemon-cards-css project handles its fancier rarities:
 *
 *  1. Brightness is driven by pointer distance rather than fixed — dim at rest
 *     (the card is not catching a lamp), brightening as you move toward the
 *     edges. `--hyp` is already the 0..1 distance from card centre.
 *  2. Each rarity gets its own blend mode instead of everything colour-dodging.
 *     Only the gold keeps colour-dodge, which is what suits metal.
 */

/* Special Illustration Rare: etched crosshatch, deep colour rather than glare. */
.foil-sir {
  --tex: var(--foil-weave);
}
.foil-sir .foil {
  /* Lower opacity than the plain holos: the etched sheen should sit over the
     illustration, not replace it. */
  opacity: 0.34;
  /* screen only ever lightens. hard-light was multiplying the texture's dark
     areas into the art, which is what made these read as muddy. */
  mix-blend-mode: screen;
  background-image:
    var(--tex),
    repeating-linear-gradient(31deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(
      108deg,
      hsl(325 90% 70% / 0.55) 0 4%,
      hsl(38 95% 66% / 0.5) 10%,
      hsl(150 80% 62% / 0.46) 18%,
      hsl(196 92% 66% / 0.52) 26%,
      hsl(262 88% 72% / 0.55) 34%,
      hsl(325 90% 70% / 0.55) 42%
    );
  background-size: 84px 84px, 7px 7px, 240% 100%;
  background-position:
    calc(var(--px) * 34px) calc(var(--py) * 26px),
    calc(var(--px) * 10px) calc(var(--py) * -8px),
    calc(var(--px) * 100%) 0;
  background-blend-mode: soft-light, overlay, normal;
  filter: brightness(calc(0.62 + var(--hyp, 0.12) * 0.4)) contrast(1.25) saturate(1.45);
}
.tcg.lit.foil-sir .foil {
  opacity: 0.46;
  /* Must repeat the filter: `.tcg.lit .foil` is three classes and would
     otherwise win over `.foil-sir .foil` and restore the blown-out look. */
  filter: brightness(calc(0.62 + var(--hyp, 0.12) * 0.4)) contrast(1.25) saturate(1.45);
}
.foil-sir .foil::before {
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image:
    var(--tex),
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 6px);
  background-size: 64px 64px, 9px 9px;
  background-position:
    calc(var(--px) * -24px) calc(var(--py) * 20px),
    calc(var(--px) * 8px) calc(var(--py) * -6px);
}
.foil-sir .foil::after {
  opacity: 0.4;
  background: linear-gradient(
    100deg,
    transparent 42%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 58%
  );
}

/* Ultra Rare: oil-slick diffraction. Its own material — these are ex full arts
   and used to share the plain facet foil with Double Rares. */
.foil-ultra .foil {
  opacity: 0.32;
  mix-blend-mode: screen;
  background-image:
    var(--foil-prism),
    repeating-linear-gradient(
      74deg,
      hsl(190 92% 68% / 0.45) 0 5%,
      hsl(268 88% 70% / 0.45) 12%,
      hsl(320 88% 68% / 0.4) 20%,
      hsl(150 76% 60% / 0.4) 28%,
      hsl(190 92% 68% / 0.45) 36%
    ),
    radial-gradient(
      farthest-corner circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.26) 0%,
      transparent 48%
    );
  background-size: 132px 132px, 230% 100%, 150% 150%;
  background-position:
    calc(var(--px) * 40px) calc(var(--py) * 32px),
    calc(var(--px) * 100%) 0,
    var(--mx, 50%) var(--my, 50%);
  background-blend-mode: soft-light, normal, overlay;
  filter: brightness(calc(0.64 + var(--hyp, 0.12) * 0.4)) contrast(1.2) saturate(1.45);
}
.tcg.lit.foil-ultra .foil {
  opacity: 0.44;
  filter: brightness(calc(0.64 + var(--hyp, 0.12) * 0.4)) contrast(1.2) saturate(1.45);
}
.foil-ultra .foil::after {
  opacity: 0.45;
  background: linear-gradient(
    98deg,
    transparent 42%,
    rgba(200, 235, 255, 0.3) 50%,
    transparent 58%
  );
}

/* Mega Hyper Rare: brushed gold metal. Colour-dodge suits metal, but it needs a
   much darker base than the other foils or the gold reads as white. */
.foil-gold {
  --tex: var(--foil-metal);
}
.foil-gold .foil {
  opacity: 0.4;
  background-image:
    var(--tex),
    radial-gradient(circle at 22% 26%, #fff8d6 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 70% 58%, #ffe08a 0 0.6px, transparent 1.2px),
    repeating-linear-gradient(
      122deg,
      rgba(255, 214, 120, 0.22) 0 1px,
      transparent 1px 4px,
      rgba(90, 60, 12, 0.3) 4px 5px
    ),
    linear-gradient(
      118deg,
      #6b4409,
      #d8b055,
      #8c6412,
      #ffe9a8,
      #6f4b0d,
      #e8c374
    );
  background-size:
    /* Brushed metal reads as direction, so stretch it across the card. */
    170% 100%,
    14px 14px, 21px 18px,
    100% 100%,
    240% 240%;
  background-position:
    calc(var(--px) * 60%) calc(var(--py) * 30%),
    calc(var(--px) * 18px) calc(var(--py) * 14px),
    calc(var(--px) * -14px) calc(var(--py) * 20px),
    0 0,
    calc(var(--px) * 90%) calc(var(--py) * 70%);
  background-blend-mode: soft-light, overlay, overlay, multiply, normal;
  filter: brightness(calc(0.42 + var(--hyp, 0.12) * 0.32)) contrast(1.12) saturate(2.1);
  mix-blend-mode: color-dodge;
}
.tcg.lit.foil-gold .foil {
  opacity: 0.5;
  filter: brightness(calc(0.42 + var(--hyp, 0.12) * 0.32)) contrast(1.12) saturate(2.1);
}
.foil-gold .foil::after {
  opacity: 0.5;
  background: linear-gradient(
    102deg,
    transparent 42%,
    rgba(255, 226, 150, 0.3) 50%,
    transparent 58%
  );
}

.spread-card .tcg,
.slot-face .tcg,
.inspect-art .tcg,
.focus-card.flipped .face-back .tcg,
.home-float .tcg,
.home-film .tcg {
  transition: transform 0.18s ease;
}
.spread-card .tcg.lit,
.slot-face .tcg.lit,
.inspect-art .tcg.lit,
.focus-card.flipped .face-back .tcg.lit,
.home-float .tcg.lit,
.home-film .tcg.lit {
  transform: perspective(760px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(1.05);
}
.focus-card.flipping .face-back .tcg.lit { transform: none; }

.tcg.holo img {
  filter:
    drop-shadow(0 0 14px rgba(255, 186, 70, 0.48))
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
/* With the foil patterns gone, the edge glow is what marks a card as foiled,
   so holo and reverse get distinct colours rather than sharing one. */
.tcg.rare-glow img {
  filter:
    drop-shadow(0 0 11px rgba(150, 195, 255, 0.38))
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
.tcg.reverse img {
  filter:
    drop-shadow(0 0 3px rgba(190, 240, 255, 0.5))
    drop-shadow(0 0 15px rgba(120, 215, 255, 0.42))
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
.tcg.special-illustration-rare img,
.tcg.mega-hyper-rare img {
  filter:
    drop-shadow(0 0 18px rgba(255, 214, 120, 0.55))
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
/* Hit rarities glint a touch faster and brighter than commons. */
.tcg.holo:not(.lit) .foil::after {
  animation-duration: 4.4s;
}

.tcg.back img {
  object-fit: contain;
}

.collection-tools,
.bulk-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.search, .filter {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
}
.search:focus-visible, .filter:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.search { flex: 1; min-width: 200px; }
select.filter {
  color-scheme: dark;
  background: #14111a;
  color: var(--ink);
}
select.filter option {
  background: #14111a;
  color: var(--ink);
}
.dex-bar { height: 8px; border-radius: 99px; background: #1c1822; overflow: hidden; margin: 0 0 22px; }
.dex-bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--rip)); transition: width 0.4s ease; }

.binder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--binder-min, 150px), 1fr)); gap: 14px; }
.binder-slot {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background: #100e15;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.binder-slot:hover { border-color: rgba(240, 193, 75, 0.32); }
.slot-face {
  display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.slot-meta { margin-top: 8px; min-height: 38px; }
.slot-meta b { display: block; font-size: 13px; line-height: 1.25; }
.slot-meta span { color: var(--muted); font-size: 11px; }
.slot-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.slot-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-2);
  letter-spacing: 0.01em;
}
.slot-miss {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.count-badge, .new-badge {
  position: absolute; z-index: 3;
  font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 999px;
}
.count-badge { top: 8px; right: 8px; background: #222; }
.new-badge {
  left: 50%; bottom: -10px; right: auto; top: auto;
  transform: translateX(-50%);
  background: var(--gold); color: #1a1408;
}
.sell-btn {
  position: relative; z-index: 4; margin-top: 0; width: auto;
  border: 1px solid var(--line); background: transparent; border-radius: 8px;
  padding: 5px 10px; font-size: 11px; color: var(--muted);
}
.sell-btn:hover { color: var(--gold); border-color: rgba(240,193,75,0.4); }
.bulk-card.missing .tcg {
  opacity: 0.4;
  filter: grayscale(0.5) brightness(0.82);
  transition: opacity 0.18s ease, filter 0.18s ease;
}
.bulk-card.missing .foil,
.bulk-card.missing .glare { display: none; }
.bulk-card.missing:hover .tcg {
  opacity: 0.78;
  filter: grayscale(0.12) brightness(0.95);
}

/* ---- Catalog -------------------------------------------------------------
   Set symbol and status badge live in their own header row. Previously they
   were absolutely positioned over the logo, so wide logos ran under them. */
.catalog-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
}
.catalog-summary span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.catalog-summary b { color: var(--ink); font-size: 15px; }
.catalog-summary .now b { color: var(--gold); }

.era-block { margin-bottom: 38px; }
.era-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}
.era-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.era-span,
.era-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.era-rule { flex: 1; height: 1px; background: var(--line); }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.catalog-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.catalog-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}
.catalog-card.live {
  border-color: rgba(240, 193, 75, 0.45);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.08), rgba(255, 255, 255, 0.02));
}

.catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 26px;
  margin: 0 0 10px;
}
.catalog-symbol {
  width: 24px;
  height: 24px;
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.catalog-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 74px;
  margin: 0 0 12px;
  box-sizing: border-box;
  overflow: hidden;
}
.catalog-logo {
  /* Absolute cap, not a percentage: set logos vary wildly in aspect ratio, and
     a percentage max-height resolves against a content-sized row that has
     already grown to the image's natural height, so it never clamps. */
  max-width: 100%;
  max-height: 74px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}
/* Shown only when the logo 404s, so the tile still names the set. */
.logo-fallback {
  display: none;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.2;
  color: var(--muted);
  text-align: center;
}
.catalog-art.no-logo .catalog-logo { display: none; }
.catalog-art.no-logo .logo-fallback { display: block; }

.catalog-card h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.02em;
}
.catalog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.catalog-meta span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.catalog-note {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.soon { color: var(--muted); border-color: var(--line); background: transparent; }

/* ---- Home / Account / Settings ------------------------------------------- */
.home-page { position: relative; }
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(280px, 0.98fr);
  gap: 28px 40px;
  align-items: center;
  margin: 0 0 48px;
  min-height: 460px;
}
.home-copy { position: relative; z-index: 2; max-width: 38rem; }
.home-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(40px, 6.4vw, 72px);
  text-wrap: balance;
}
.home-copy .lede { font-size: 17px; max-width: 46ch; }
.home-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.home-cta .solid {
  padding: 13px 22px;
  font-size: 15px;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  box-shadow: 0 12px 32px rgba(240, 193, 75, 0.28);
}
.home-cta .ghost { padding: 13px 20px; }

.home-pulse {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.home-ring {
  --pct: 0;
  position: relative;
  width: 74px;
  height: 74px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--pct) * 1%), rgba(244, 239, 228, 0.08) 0);
  box-shadow: 0 0 24px rgba(240, 193, 75, 0.12);
}
.home-ring > span {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #0c0a12;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.05;
}
.home-ring b { font-size: 16px; font-weight: 700; }
.home-ring small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-pulse-stat b { display: block; font-size: 20px; line-height: 1.15; }
.home-pulse-stat span { color: var(--muted); font-size: 11px; font-weight: 600; }

.home-stage {
  position: relative;
  min-height: 430px;
  isolation: isolate;
}
.home-stage-glow {
  position: absolute;
  inset: 8% 6% 4%;
  background:
    radial-gradient(circle at 52% 42%, rgba(240, 193, 75, 0.2), transparent 46%),
    radial-gradient(circle at 30% 70%, rgba(120, 72, 255, 0.28), transparent 52%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}
.home-stage-packs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.home-pack-float {
  position: absolute;
  height: 250px;
  width: auto;
  filter: drop-shadow(0 28px 28px rgba(0, 0, 0, 0.62));
  animation: homeSway 7.5s ease-in-out infinite;
  opacity: 0.92;
}
.home-pack-float img { height: 250px; width: auto; }
.home-pack-float:nth-child(1) {
  left: -4%;
  top: 18%;
  transform: rotate(-18deg);
  animation-delay: -1.4s;
}
.home-pack-float:nth-child(2) {
  right: -2%;
  top: 8%;
  transform: rotate(16deg);
  animation-delay: -3.6s;
}
.home-fan { position: relative; z-index: 2; height: 430px; }
.home-float {
  position: absolute;
  width: 188px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 26px 28px rgba(0, 0, 0, 0.58));
  animation: homeFloat 6.2s ease-in-out infinite;
  transform: rotate(var(--spin, 0deg));
}
.home-float:nth-child(1) { left: 4%; top: 10%; --spin: -13deg; z-index: 3; }
.home-float:nth-child(2) { left: 34%; top: -2%; --spin: 5deg; z-index: 5; width: 214px; }
.home-float:nth-child(3) { right: 2%; top: 16%; --spin: 12deg; z-index: 2; width: 168px; }
.home-float:nth-child(4) { left: 22%; bottom: -4%; --spin: -7deg; z-index: 4; width: 156px; }
.home-float:hover,
.home-float:focus-visible {
  z-index: 8;
  animation-play-state: paused;
  outline: none;
  transform: rotate(var(--spin, 0deg)) translateY(-8px) scale(1.05);
}
@keyframes homeFloat {
  0%, 100% { transform: rotate(var(--spin, 0deg)) translateY(0); }
  50% { transform: rotate(var(--spin, 0deg)) translateY(-14px); }
}
@keyframes homeSway {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.home-block { margin: 0 0 36px; }
.home-block-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 0 0 16px;
}
.home-block-head h2 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-size: 22px;
}
.home-block-head p { margin: 0; color: var(--muted); font-size: 13px; }
.home-block-head .text-btn {
  border: 0;
  background: transparent;
  color: var(--gold-2);
  font-weight: 700;
  font-size: 13px;
  padding: 0;
}
.home-block-head .text-btn:hover { color: var(--gold); }

.home-sets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.home-set {
  --set-glow: rgba(140, 72, 255, 0.38);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 8px 12px;
  align-items: center;
  overflow: visible;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 90% at 12% 110%, var(--set-glow), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.home-set[data-set="me4"] { --set-glow: rgba(32, 168, 214, 0.4); }
.home-set[data-set="me5"] { --set-glow: rgba(132, 72, 255, 0.42); }
.home-set:hover,
.home-set:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(240, 193, 75, 0.42);
  outline: none;
}
.home-set-fan {
  position: relative;
  height: 188px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.home-pack-float picture,
.home-set-pack picture { display: contents; }
.home-set-pack {
  position: relative;
  width: auto;
  margin: 0 -22px;
  transition: transform 0.22s ease;
}
.home-set-pack img {
  height: 176px;
  width: auto;
  max-width: none;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.55));
}
.home-set-pack:nth-child(1) { transform: rotate(-12deg) translateY(14px); z-index: 1; }
.home-set-pack:nth-child(2) { transform: rotate(0deg); z-index: 3; }
.home-set-pack:nth-child(3) { transform: rotate(12deg) translateY(14px); z-index: 2; }
.home-set:hover .home-set-pack:nth-child(1) { transform: rotate(-17deg) translateY(4px); }
.home-set:hover .home-set-pack:nth-child(2) { transform: rotate(0deg) translateY(-8px); }
.home-set:hover .home-set-pack:nth-child(3) { transform: rotate(17deg) translateY(4px); }
.home-set-copy { min-width: 0; }
.home-set-copy .live-tag { display: inline-block; margin-bottom: 8px; }
.home-set-copy h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.02em;
}
.home-set-copy p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.home-set-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.home-set-meta b { color: var(--ink); font-weight: 700; letter-spacing: 0; text-transform: none; }
.home-set .dex-bar { height: 6px; margin: 0; }

.home-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.home-step {
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.home-step b {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.16em;
}
.home-step h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
}
.home-step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* ---- Hero proof points ---------------------------------------------------- */
.home-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.home-proof li { position: relative; padding-left: 15px; }
.home-proof li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240, 193, 75, 0.7);
}
.home-proof b { display: block; font-size: 13px; }
.home-proof span { color: var(--muted); font-size: 12px; }

/* ---- Market board ---------------------------------------------------------
   Binder worth on the left, the set's priciest cards on the right. */
.home-market {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: stretch;
}
.home-worth,
.home-board {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.home-worth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px 22px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(240, 193, 75, 0.12), transparent 60%),
    rgba(255, 255, 255, 0.03);
}
.home-worth-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-worth b {
  font-family: var(--display);
  font-size: clamp(30px, 4.4vw, 42px);
  line-height: 1.05;
  color: var(--gold-2);
}
.home-worth p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.home-pnl { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.home-pnl.up { color: #6ee7a0; }
.home-pnl.down { color: #ff8898; }
.home-worth-chart { margin: 12px -4px 0; }
.home-worth-note {
  margin: 10px 0 0 !important;
  font-size: 12.5px;
  color: var(--muted);
}
.home-worth-cta { margin-top: auto; padding-top: 16px; }
.home-worth-cta .solid { width: 100%; }

/* Compact net-worth sparkline. */
.pc-spark { height: 96px; cursor: default; }
.pc-spark.flat { --pc-key: var(--gold); }
.pc-base {
  stroke: rgba(244, 239, 228, 0.28);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}
.pc-empty-sm { font-size: 12.5px; padding: 18px 0 6px; }

/* ---- Your pulls -----------------------------------------------------------
   One block: the best pull featured, the rest as a strip. A lone card in a
   plain flex row read as a broken layout. */
.home-pulls {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: stretch;
}
.home-hit {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(240, 193, 75, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(240, 193, 75, 0.14), transparent 60%),
    rgba(255, 255, 255, 0.03);
}
.home-hit-art {
  flex: none;
  width: 104px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.home-hit-art:hover { transform: translateY(-4px) scale(1.02); }
.home-hit-art:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 8px; }
.home-hit-copy { min-width: 0; }
.home-hit-label {
  display: block;
  color: var(--gold-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home-hit-copy h3 {
  margin: 6px 0 4px;
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.home-hit-copy p { margin: 0; color: var(--muted); font-size: 12.5px; }
.home-hit-value {
  margin-top: 10px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--gold-2);
}

.home-strip {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}
.home-strip-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home-strip .home-film { margin-top: 4px; }

.home-board { padding: 16px 18px 10px; }
.home-board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-board-note { color: rgba(240, 193, 75, 0.75); letter-spacing: 0.08em; }
.home-board-list { margin: 0; padding: 0; list-style: none; }
.home-board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 10px;
  transition: background 0.16s ease;
}
.home-board-list li:first-child .home-board-row { border-top: 0; }
.home-board-row:hover { background: rgba(255, 255, 255, 0.05); }
.home-board-row:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.home-board-rank {
  flex: none;
  width: 20px;
  font-family: var(--display);
  font-size: 13px;
  color: rgba(244, 239, 228, 0.35);
}
.home-board-name { flex: 1; min-width: 0; }
.home-board-name b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-board-name small { color: var(--muted); font-size: 11.5px; }
.home-board-price {
  flex: none;
  font-family: var(--display);
  font-size: 15px;
  color: var(--gold-2);
  white-space: nowrap;
}

.home-odds {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.home-odd {
  padding: 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.home-odd b {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--gold-2);
}
.home-odd span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-film {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scrollbar-width: thin;
}
.home-film .mini-card { width: 96px; flex: none; }
.home-film .rarity-stamp { font-size: 10px; }

.home-road {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.home-chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
}
.home-chip.origin {
  border-color: rgba(212, 160, 23, 0.45);
  color: #e6c56a;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.panel-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px 20px;
  background: rgba(255, 255, 255, 0.03);
}
.panel h3 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-note { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel-empty { margin: 0; color: var(--muted); font-size: 13px; }
.panel.danger { border-color: rgba(255, 110, 110, 0.3); margin-top: 16px; }
.danger-btn { border-color: rgba(255, 110, 110, 0.45); color: #ff9d9d; }
.danger-btn:hover { background: rgba(255, 110, 110, 0.12); }

.panel-stats { display: flex; flex-wrap: wrap; gap: 20px; }
.panel-stats.wide { gap: 26px; }
.panel-stats b { display: block; font-size: 21px; line-height: 1.2; }
.panel-stats span { color: var(--muted); font-size: 12px; }
.panel-progress { margin-top: 18px; }
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}
.progress-head b { color: var(--ink); }

.mini-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-card {
  width: 62px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.16s ease;
}
.mini-card:hover { transform: translateY(-4px); }
/* The stamp's minimum size is tuned for binder-scale cards; at 62px it would
   swallow the artwork. */
.mini-card .rarity-stamp { font-size: 9px; padding: 0.26em 0.44em; }

.account-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.06), rgba(255, 255, 255, 0.02));
}
.account-id { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.account-id h3 { margin: 0 0 4px; font-family: var(--display); font-size: 20px; }
.account-id p { margin: 0; color: var(--muted); font-size: 13px; }
.account-id .soon { margin-left: auto; }
.mark.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 24px; }
.soon-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.9; }

.trainer-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--avatar, var(--gold));
  color: #1a1408;
  font-family: var(--display);
  font-size: 28px;
  box-shadow: 0 0 28px rgba(240, 193, 75, 0.28);
}
.account-id .trainer-mark { flex: none; }
.account-title {
  display: inline-block;
  margin: 0 0 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(240, 193, 75, 0.35);
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.account-handle { color: var(--gold); font-weight: 600; }
.account-bio {
  margin: 8px 0 0;
  max-width: 52ch;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ach-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.ach-chip.on {
  border-color: rgba(240, 193, 75, 0.4);
  background: rgba(240, 193, 75, 0.08);
}
.ach-chip.off { opacity: 0.45; }
.ach-chip b { font-size: 13px; }
.ach-chip span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.set-progress { display: flex; flex-direction: column; gap: 14px; }
.set-progress-row .progress-head { margin-bottom: 6px; }
.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.activity-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.activity-list li:first-child { border-top: 0; padding-top: 0; }
.activity-list span { color: var(--muted); font-size: 12px; }
.activity-list time {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.field input,
.field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
}
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.85; }
.color-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.color-pick.on { border-color: var(--ink); }
.form-error {
  min-height: 1.2em;
  margin: 0 0 12px;
  color: #ff9d9d;
  font-size: 13px;
}
.trainer-picks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.trainer-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  color: inherit;
}
.trainer-pick.on {
  border-color: rgba(240, 193, 75, 0.45);
  background: rgba(240, 193, 75, 0.08);
}
.trainer-pick .trainer-avatar { width: 36px; height: 36px; font-size: 15px; }
.trainer-pick b { display: block; font-size: 14px; }
.trainer-pick small { color: var(--muted); font-size: 12px; }
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(280px, 1.08fr);
  gap: 28px 48px;
  align-items: start;
}
.auth-copy h1 {
  margin: 8px 0 14px;
  font-size: clamp(36px, 5vw, 56px);
}
.auth-copy .lede { max-width: 46ch; }
.auth-points {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.auth-points li { padding-left: 18px; position: relative; }
.auth-points li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 11px;
  top: 4px;
}
.auth-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background: rgba(12, 10, 18, 0.72);
  box-shadow: var(--shadow);
}
.auth-card .solid { width: 100%; min-width: 0; }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.auth-tab {
  flex: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.auth-tab.on { background: var(--ink); color: #111; }
.auth-guest {
  display: block;
  width: 100%;
  margin-top: 10px;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.check-row input { margin-top: 3px; accent-color: var(--gold); }
.account-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.toggle-list { display: flex; flex-direction: column; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.toggle-row:first-child { border-top: 0; padding-top: 0; }
.toggle-row > span { display: block; flex: 1; }
.toggle-row b { display: block; font-size: 14px; font-weight: 600; }
.toggle-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
/* Native checkbox stays for keyboard and a11y; the pill is the visual. */
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}
.toggle-row input:checked ~ .switch {
  background: rgba(240, 193, 75, 0.28);
  border-color: rgba(240, 193, 75, 0.55);
}
.toggle-row input:checked ~ .switch::after { transform: translateX(18px); background: var(--gold); }
.toggle-row input:focus-visible ~ .switch { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- Bulk / Binder ---------------------------------------------------------
   Bulk is the inventory grid; the binder is the curated showcase, laid out as
   a facing spread of nine-pocket pages like a real one. */
.view-intro {
  margin: -4px 0 18px;
  max-width: 72ch;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.bulk-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 28px;
  align-items: end;
  margin: 0 0 26px;
}
.bulk-copy h1 {
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 54px);
  letter-spacing: 0.03em;
  line-height: 0.95;
  margin: 0 0 12px;
}
.bulk-copy .lede {
  margin: 0;
  max-width: 52ch;
  color: #cbbfae;
}
.bulk-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.bulk-pulse {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.bulk-browse {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(14, 11, 20, 0.55);
}
.bulk-eras {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0 0 12px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 239, 228, 0.18) transparent;
}
.bulk-era {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 7, 13, 0.35);
  text-align: left;
  min-width: 148px;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.bulk-era b {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.02em;
  font-weight: 400;
  color: var(--ink);
}
.bulk-era small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bulk-era:hover { border-color: rgba(255, 255, 255, 0.18); }
.bulk-era.on {
  border-color: rgba(240, 193, 75, 0.5);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.14), rgba(255, 255, 255, 0.02));
}
.bulk-era.on b { color: var(--gold); }
.bulk-era-sets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.bulk-set-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 7, 13, 0.4);
  color: var(--ink);
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.bulk-set-card:hover { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.04); }
.bulk-set-card.active {
  border-color: rgba(240, 193, 75, 0.5);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.14), rgba(255, 255, 255, 0.02));
}
.bulk-set-card.active b { color: var(--gold); }
.bulk-set-card.is-queued { cursor: default; opacity: 0.78; }
.bulk-set-card.is-queued:hover { border-color: var(--line); background: rgba(9, 7, 13, 0.4); }
.bulk-set-card:disabled { opacity: 0.45; cursor: default; }
.bulk-set-card .rail-symbol {
  width: 28px;
  height: 28px;
}
.bulk-set-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.bulk-set-copy b {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-set-copy small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.bulk-set-card .live-tag,
.bulk-set-card .soon {
  flex: none;
  padding: 3px 7px;
}
.bulk-era-empty {
  margin: 0;
  padding: 8px 2px;
  color: var(--muted);
  font-size: 13px;
}
.bulk-rarities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.rarity-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.rarity-chip:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.18);
}
.rarity-chip.on {
  border-color: rgba(240, 193, 75, 0.5);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.16), rgba(255, 255, 255, 0.03));
  color: var(--gold-2);
}
.rarity-marks {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}
.bulk-seg { margin-left: auto; }
.bulk-result,
.binder-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.bulk-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  place-items: start;
  padding: 28px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
}
.bulk-empty b { color: var(--ink); font-size: 15px; }

.link-btn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--gold-2);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-btn:hover { color: var(--gold); }

.binder-actions { display: flex; gap: 8px; }
.binder-spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.binder-page {
  position: relative;
  padding: 18px 18px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  /* A page lifts off the ring: lighter at the spine edge, shadowed away. */
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02) 22%),
    rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.binder-spread .binder-page:last-child {
  background:
    linear-gradient(270deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02) 22%),
    rgba(255, 255, 255, 0.025);
}
.binder-pockets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.binder-page-no {
  position: absolute;
  bottom: 8px;
  right: 14px;
  color: rgba(244, 239, 228, 0.3);
  font-size: 11px;
  font-weight: 600;
}

.pocket {
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: 10px;
}
.pocket.empty {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(244, 239, 228, 0.16);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(244, 239, 228, 0.28);
  font-size: 22px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.pocket.empty:hover {
  border-color: rgba(240, 193, 75, 0.5);
  color: var(--gold);
  background: rgba(240, 193, 75, 0.06);
}
.pocket.empty:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pocket.filled { border: 0; }
.pocket-card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.16s ease;
}
.pocket-card:hover { transform: translateY(-3px); }
.pocket-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12, 10, 16, 0.92);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.16s ease, color 0.16s ease;
}
.pocket.filled:hover .pocket-clear,
.pocket-clear:focus-visible { opacity: 1; }
.pocket-clear:hover { color: #ff9d9d; border-color: rgba(255, 110, 110, 0.5); }

.binder-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}
.binder-nav button:disabled { opacity: 0.35; cursor: default; }

/* Card picker */
.picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 4, 8, 0.72);
  backdrop-filter: blur(3px);
}
.picker {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, calc(100% - 32px));
  max-height: min(76vh, 720px);
  overflow: auto;
  padding: 20px 22px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(12, 10, 16, 0.98);
  box-shadow: var(--shadow);
}
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.picker-head h3 { margin: 0; font-family: var(--display); font-size: 18px; }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 12px;
}
.picker-card {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease;
}
.picker-card:hover { transform: translateY(-4px); }
.picker-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.picker-name {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-meta { display: block; color: var(--muted); font-size: 11px; }

@media (max-width: 860px) {
  .binder-spread { grid-template-columns: 1fr; }
  .binder-page { padding: 14px 14px 24px; }
}

/* ---- Settings page --------------------------------------------------------
   Panels sit in a responsive grid; each row is copy on the left and its control
   on the right, collapsing to stacked on narrow screens. */
.set-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.set-bar p { margin: 0; color: var(--muted); font-size: 13px; }
.set-bar button:disabled { opacity: 0.4; cursor: default; }
.set-bar button:disabled:hover { background: transparent; }

.set-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}
.set-panel { padding: 20px 22px 8px; }
.set-panel-head { margin-bottom: 4px; }
.set-panel-head h3 { margin: 0 0 4px; }
.set-panel-head p { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.set-list { display: flex; flex-direction: column; }
.set-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.set-list .set-row:first-child { border-top: 0; padding-top: 0; }
.set-row:last-child { padding-bottom: 18px; }
.set-copy { display: block; flex: 1; min-width: 0; }
.set-copy b { display: block; font-size: 14px; font-weight: 600; }
.set-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Segmented control for the pick-one settings. */
.seg {
  display: inline-flex;
  flex: none;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.seg-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on {
  background: rgba(240, 193, 75, 0.16);
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(240, 193, 75, 0.45);
}
.seg-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.set-danger { margin-top: 16px; padding-bottom: 20px; }
.set-danger .set-panel-head p { max-width: 62ch; }

@media (max-width: 620px) {
  .set-groups { grid-template-columns: 1fr; }
  .set-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .set-row.toggle-row { flex-direction: row; align-items: center; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; text-align: center; }
}

/* Settings kill-switches. */
body.no-shine .tcg .glare,
body.no-shine .tcg .foil { display: none; }
body.no-stamps .rarity-stamp { display: none; }
body.no-tilt .spread-card .tcg.lit,
body.no-tilt .slot-face .tcg.lit,
body.no-tilt .inspect-art .tcg.lit,
body.no-tilt .focus-card .tcg.lit,
body.no-tilt .home-float .tcg.lit,
body.no-tilt .home-film .tcg.lit { transform: none; }
body.no-motion .tcg .foil,
body.no-motion .tcg .foil::before,
body.no-motion .tcg .foil::after,
body.no-motion .focus-aura.rays::before,
body.no-motion .focus-wrap.rainbow .focus-aura,
body.no-motion .overlay.dealing.rainbow::before,
body.no-motion .focus-card.t2.flipped.settled .pull-lift,
body.no-motion .focus-card.t3.flipped.settled .pull-lift { animation: none; }
body.no-motion .hit-spark,
body.no-motion .overlay.hit-shake .rip-stage,
body.no-motion .focus-card.deal.from-pack { animation: none; }
body.no-motion .focus-sub,
body.no-motion .focus-meta,
body.no-motion .focus-aura,
body.no-motion .overlay.dealing::after,
body.no-motion .overlay.dealing.rainbow::before { transition: none; }
body.no-motion .home-float,
body.no-motion .home-pack-float { animation: none; }

/* Hit effects are separate from idle motion: the spark burst and the screen
   shake are the flashy part, and some people want the shimmer without them. */
body.no-flash .hit-spark { display: none; }
body.no-flash .overlay.hit-shake .rip-stage { animation: none; }
body.no-flash .overlay.hit-flash::after { opacity: 0; }

html.dialog-open,
html.dialog-open body {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
}
html.dialog-open body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6, 4, 10, 0.95);
  backdrop-filter: blur(16px) saturate(120%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.overlay.dealing {
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(6, 4, 10, 0.97);
}
.overlay.dealing::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 38%, var(--aura, transparent), transparent 58%);
  opacity: 0;
  transition: opacity 0.42s ease;
  pointer-events: none;
  z-index: 0;
}
.overlay.dealing.glow-on::after { opacity: 1; }
.overlay.dealing.rainbow::after { opacity: 0; }
.overlay.dealing.rainbow::before {
  content: "";
  position: fixed;
  inset: -30%;
  background: conic-gradient(
    from 0deg at 50% 38%,
    rgba(255, 59, 92, 0.28),
    rgba(255, 176, 32, 0.2),
    rgba(93, 255, 122, 0.16),
    rgba(62, 198, 255, 0.22),
    rgba(122, 92, 255, 0.24),
    rgba(255, 59, 92, 0.28)
  );
  filter: blur(48px);
  opacity: 0;
  animation: rainbowWash 7s linear infinite;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.42s ease;
}
.overlay.dealing.rainbow.glow-on::before { opacity: 1; }
@keyframes rainbowWash {
  to { transform: rotate(360deg); }
}
.overlay.hit-flash {
  box-shadow: inset 0 0 180px rgba(255, 255, 255, 0.1);
}
.overlay.dealing.rainbow.hit-flash {
  box-shadow: inset 0 0 180px rgba(255, 255, 255, 0.1);
}
.overlay.aura-snap,
.overlay.aura-snap::before,
.overlay.aura-snap::after,
.focus-wrap.aura-snap .focus-aura,
.focus-wrap.aura-snap .focus-aura::before {
  transition: none !important;
  animation: none !important;
}
.overlay.hit-shake .rip-stage {
  animation: packShake 0.48s ease-out;
}
@keyframes packShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px) rotate(-0.4deg); }
  36% { transform: translateX(6px) rotate(0.35deg); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
}
.rip-stage {
  position: relative;
  text-align: center;
  width: min(1080px, 100%);
  overflow: visible;
  margin: auto;
}
.overlay-leave {
  position: sticky;
  top: 0;
  z-index: 8;
  display: block;
  margin: 0 0 12px auto;
  min-width: 0;
  padding: 8px 14px;
  background: rgba(9, 7, 13, 0.78);
}
.rip-hint { color: var(--muted); margin-bottom: 16px; min-height: 24px; }

.overlay.dealing .rip-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.focus-card.deal.from-pack {
  animation: dealFromPack 0.64s cubic-bezier(0.22, 1, 0.32, 1) both;
}
@keyframes dealFromPack {
  from {
    opacity: 0;
    transform: translateY(56px) scale(0.72) rotateZ(-5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.booster {
  width: min(270px, 68vw);
  margin: 0 auto 18px;
  position: relative;
  user-select: none;
  touch-action: none;
  cursor: grab;
  overflow: visible;
}
.booster.tearing { cursor: grabbing; }
.tear-handle {
  position: absolute;
  top: -8px;
  left: -6px;
  right: -6px;
  height: 16%;
  z-index: 8;
  padding: 0;
  border: 0;
  margin: 0;
  cursor: grab;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}
.tear-handle:focus { outline: none; }
.tear-handle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 8px;
}
.booster.tearing .tear-handle {
  pointer-events: none;
  cursor: grabbing;
}
.pack-rest,
.pack-scrap { width: 100%; }
.pack-rest {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.55));
}
.booster.dragging .pack-rest { animation: packStress 0.2s linear infinite; }
.booster.torn .pack-rest { animation: packSettle 0.3s ease-out both; }
@keyframes packStress {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  25% { transform: translate3d(-0.6px, 0.3px, 0) rotate(-0.1deg); }
  75% { transform: translate3d(0.6px, -0.2px, 0) rotate(0.1deg); }
}
@keyframes packSettle {
  0% { transform: translateY(-2px) scale(1.006); }
  55% { transform: translateY(1px) scale(0.988); }
  100% { transform: none; }
}

/* Dark band under the torn edge so the pack reads as opened, not cropped. */
.pack-mouth {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, clip-path;
  background: linear-gradient(
    180deg,
    rgba(4, 3, 8, 0) 4%,
    rgba(4, 3, 8, 0.95) 7.2%,
    rgba(7, 6, 13, 0.6) 11%,
    rgba(10, 8, 16, 0) 15%
  );
}
.pack-scrap {
  position: absolute;
  inset: 0;
  z-index: 6;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity, clip-path;
  filter:
    drop-shadow(0 1.5px 0 rgba(246, 238, 219, 0.72))
    drop-shadow(0 7px 12px rgba(0, 0, 0, 0.5));
}
.booster.tearing .pack-scrap {
  z-index: 7;
  visibility: visible;
  opacity: 1;
}
/* Clip lives on .pack-art so the parent's filter can draw the torn paper fringe. */
.pack-art {
  width: 100%;
  will-change: clip-path;
}
.pack-art img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}
.booster.emptied .pack-scrap,
.overlay.dealing .pack-scrap,
.booster.emptied .pack-rest,
.overlay.dealing .pack-rest,
.booster.emptied .pack-mouth,
.overlay.dealing .pack-mouth {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tear-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
  opacity: 0;
}
.booster.tearing .tear-svg { opacity: 1; }
.tear-edge {
  fill: none;
  stroke: #f2e8d2;
  stroke-width: 0.55;
  stroke-linecap: round;
  stroke-linejoin: miter;
  filter: drop-shadow(0 0.4px 0.3px rgba(52, 36, 16, 0.7));
}
.overlay.dealing .tear-svg {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tear-crumbs {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}
.crumb {
  position: absolute;
  display: block;
  border-radius: 1px;
  background: #f0e5cd;
  box-shadow: 0 0 0 0.5px rgba(40, 28, 12, 0.35);
  animation: crumbFly 0.72s cubic-bezier(0.22, 0.7, 0.3, 1) var(--dly, 0ms) both;
}
@keyframes crumbFly {
  from { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  70% { opacity: 0.9; }
  to { opacity: 0; transform: translate(var(--cx), var(--cy)) rotate(var(--rot)); }
}

.focus-wrap {
  --aura: transparent;
  position: relative;
  display: grid;
  place-items: center;
  width: min(720px, 100%);
  margin: 0 auto;
}
.focus-meta {
  margin: 0 0 10px;
  min-height: 72px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.38s ease, transform 0.38s ease;
  pointer-events: none;
}
.focus-meta.in {
  opacity: 1;
  transform: none;
}
.focus-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.focus-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  padding: 0.2em 0.45em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}
.focus-mark.rev {
  border-color: rgba(150, 225, 255, 0.75);
  box-shadow: 0 0 8px rgba(120, 215, 255, 0.35);
}
.focus-mark .pip { font-style: normal; }
.focus-title {
  font-family: var(--display);
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: 1.05;
  margin: 0;
}
.focus-rarity {
  margin: 0;
  color: #cbbfae;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.focus-stage {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 320px) 48px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 460px;
  width: 100%;
  perspective: 1400px;
  perspective-origin: 50% 42%;
}
.focus-aura {
  position: absolute;
  grid-column: 1 / -1;
  grid-row: 1;
  left: 50%;
  top: 50%;
  width: 68%;
  height: 96%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--aura, transparent), transparent 68%);
  filter: blur(22px) saturate(1.15);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.42s ease;
}
.focus-wrap.revealed .focus-aura { opacity: 1; }
.focus-wrap.rainbow .focus-aura {
  width: 82%;
  height: 118%;
  background: conic-gradient(
    from 0deg,
    #ff3b5c,
    #ffb020,
    #5dff7a,
    #3ec6ff,
    #7a5cff,
    #ff3b5c
  );
  filter: blur(24px) saturate(1.35);
  animation: rainbowSpin 4.5s linear infinite;
}
.focus-wrap.revealed.rainbow .focus-aura { opacity: 0.7; }
@keyframes rainbowSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.focus-aura.rays::before {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0 8%,
    rgba(255, 220, 130, 0.38) 12%,
    transparent 18% 50%,
    rgba(255, 210, 110, 0.28) 56%,
    transparent 64% 100%
  );
  animation: spinRays 9s linear infinite;
}
.focus-wrap.rainbow .focus-aura.rays::before {
  background: conic-gradient(
    from 0deg,
    #ff3b5c 0 10%,
    transparent 14% 46%,
    #3ec6ff 50 62%,
    transparent 66% 100%
  );
}
@keyframes spinRays {
  to { transform: rotate(360deg); }
}
.hit-fx {
  position: absolute;
  grid-column: 1 / -1;
  grid-row: 1;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}
.focus-nav.prev { grid-column: 1; grid-row: 1; }
.focus-card { grid-column: 2; grid-row: 1; }
.focus-nav.next { grid-column: 3; grid-row: 1; }
.hit-spark {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 7px;
  height: 7px;
  margin: -3px;
  border-radius: 50%;
  background: #ffe08a;
  box-shadow: 0 0 10px rgba(255, 220, 120, 0.9);
  animation: sparkOut 0.9s cubic-bezier(0.16, 0.84, 0.3, 1) var(--dly, 0ms) both;
}
.hit-spark.t1 { background: #9be7ff; box-shadow: 0 0 10px rgba(120, 210, 255, 0.9); }
.hit-spark.t2 { width: 8px; height: 8px; }
.hit-spark.t3 {
  width: 9px;
  height: 9px;
  background: #fff4c4;
  box-shadow: 0 0 14px rgba(255, 230, 150, 1);
}
@keyframes sparkOut {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.15); }
}
.focus-sub {
  display: none;
}
.focus-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 3;
  padding: 0 0 4px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.focus-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.focus-nav:disabled { opacity: 0.25; cursor: default; }
.focus-card {
  --flip-ms: 0.62s;
  position: relative;
  z-index: 2;
  width: min(300px, 72vw);
  aspect-ratio: 63 / 88;
  cursor: pointer;
  transform-style: preserve-3d;
  justify-self: center;
}
.focus-card.deal {
  animation: dealIn 0.42s cubic-bezier(0.22, 1, 0.32, 1) both;
}
@keyframes dealIn {
  from {
    opacity: 0;
    transform: translateY(52px) rotateZ(-9deg) scale(0.88);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pull-lift {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.focus-card.flipping .pull-lift {
  transform: translateY(-12px) scale(1.04);
}
.focus-card.t2.flipping .pull-lift,
.focus-card.t3.flipping .pull-lift {
  transform: translateY(-18px) scale(1.08);
}
.focus-card.t2.flipped.settled .pull-lift,
.focus-card.t3.flipped.settled .pull-lift {
  animation: rarePulse 2.6s ease-in-out infinite;
}
@keyframes rarePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
.focus-card.no-anim .pull-inner,
.focus-card.no-anim .pull-lift { transition: none !important; animation: none !important; }
.pull-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--flip-ms) cubic-bezier(0.33, 0.09, 0.15, 1);
  will-change: transform;
}
.focus-card.flipped .pull-inner { transform: rotateY(180deg); }
.face-front, .face-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: visible;
  pointer-events: none;
}
.focus-card:not(.flipped) .face-front,
.focus-card.flipped .face-back { pointer-events: auto; }
.face-front { transform: rotateY(0deg) translateZ(1px); }
.face-back { transform: rotateY(180deg) translateZ(1px); }
.face-front .tcg, .face-back .tcg { width: 100%; height: 100%; }
.inspect-art .tcg { width: 100%; }
.focus-card .tcg,
.inspect-art .tcg,
.spread-card .tcg,
.home-float .tcg {
  touch-action: none;
}

.thumbs {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: nowrap;
  margin-top: 14px;
  min-height: 78px;
  padding: 10px 12px 12px;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.thumb {
  width: 48px;
  border-radius: 7px;
  overflow: visible;
  opacity: 0.72;
  box-sizing: border-box;
  flex-shrink: 0;
  display: block;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.thumb:hover { opacity: 1; transform: translateY(-4px); }
.thumb.current { opacity: 1; outline: 2px solid var(--gold); outline-offset: 3px; }
.thumb.hit { outline: 1px solid rgba(240, 193, 75, 0.45); outline-offset: 2px; }
.thumb.rev { outline: 1px solid rgba(120, 210, 255, 0.4); outline-offset: 2px; }
.thumb.empty {
  width: 48px;
  aspect-ratio: 63 / 88;
  border: 1px dashed var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.02);
}
.thumb.empty.hit {
  border-color: rgba(240, 193, 75, 0.35);
  color: var(--gold-2);
}
.thumb.empty.rev {
  border-color: rgba(120, 210, 255, 0.32);
  color: #9be7ff;
}
.thumb.empty.energy { color: #d7c9a4; }

.spread { display: block; margin: 2px 0 4px; }
.spread-head { margin-bottom: 20px; }
.spread-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.spread-head h2 {
  font-family: var(--display);
  font-size: clamp(24px, 4vw, 40px);
  margin: 0 0 14px;
  line-height: 1.05;
}
.spread-stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.spread-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
}
.spread-stats b { color: var(--ink); font-weight: 700; }
.spread-stats .best { border-color: rgba(240, 193, 75, 0.42); }

.spread-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
}
.spread-card {
  position: relative;
  display: block;
  width: 108px;
  padding: 0;
  border: 0;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  animation: spreadIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.spread-card.hit { width: 122px; }
/* Gold rim rides the image alpha so it hugs the printed card corners
   instead of a guessed rectangle over the letterboxed box. */
.spread-card.top-pull .tcg img {
  filter:
    drop-shadow(0 0 2px rgba(255, 226, 150, 0.95))
    drop-shadow(0 0 5px rgba(244, 199, 82, 0.8))
    drop-shadow(0 0 20px rgba(244, 199, 82, 0.55))
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
.chip {
  position: absolute;
  z-index: 5;
  top: 2%;
  right: 4%;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 999px;
  pointer-events: none;
}
.chip.new { background: var(--gold); color: #1a1408; }
.spread-tip { color: var(--muted); font-size: 12px; margin: 18px 0 0; }
@keyframes spreadIn {
  from { opacity: 0; transform: translateY(16px) scale(0.86); }
  to { opacity: 1; transform: none; }
}

.overlay-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(6, 4, 10, 0.94) 28%);
}
.ghost, .solid { border-radius: 12px; padding: 10px 16px; font-weight: 700; min-width: 128px; }
.ghost { background: transparent; border: 1px solid var(--line); }
.ghost.accent { border-color: rgba(240, 193, 75, 0.42); color: var(--gold-2); }
.solid { border: 0; background: var(--gold); color: #1a1408; }

.inspect-stage { width: min(920px, 100%); margin: auto; }
.inspect-close { margin-bottom: 12px; }
.inspect-grid { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; text-align: left; }
.inspect-info h2 { font-family: var(--display); margin: 0 0 8px; font-size: 36px; }
.inspect-info p { color: #cbbfae; }
.atk { border-top: 1px solid var(--line); padding: 10px 0; }
.atk b { margin-right: 8px; }
.atk em { color: var(--gold); font-style: normal; font-size: 12px; }
.atk p { margin: 6px 0 0; font-size: 14px; }
.flavor { font-style: italic; }
.artist { color: var(--muted) !important; font-size: 13px; }

/* ---- Price history chart --------------------------------------------------
   Lives in the card inspector. Up/down recolour the whole chart via --pc-key
   so line, fill and delta always agree. */
.price-card {
  --pc-key: var(--gold);
  margin: 18px 0 14px;
  padding: 16px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.price-card .pc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pc-now { display: flex; flex-direction: column; gap: 2px; }
.pc-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.pc-now b {
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.05;
  color: var(--ink);
}
.pc-delta { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pc-delta.up { color: #6ee7a0; }
.pc-delta.down { color: #ff8898; }

.pc-ranges {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.pc-range {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
}
.pc-range:hover { color: var(--ink); }
.pc-range.on { background: rgba(240, 193, 75, 0.16); color: var(--gold-2); }
.pc-range:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pc-figure { position: relative; margin: 0; touch-action: pan-y; }
.pc-svg {
  display: block;
  width: 100%;
  height: 190px;
  overflow: visible;
  cursor: crosshair;
}
.pc-svg.up { --pc-key: #6ee7a0; }
.pc-svg.down { --pc-key: #ff8898; }
.pc-line {
  fill: none;
  stroke: var(--pc-key);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* preserveAspectRatio="none" stretches the viewBox, which would smear the
     stroke; this keeps it an even width at any card size. */
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pc-key) 45%, transparent));
}
.pc-stop-a { stop-color: var(--pc-key); stop-opacity: 0.28; }
.pc-stop-b { stop-color: var(--pc-key); stop-opacity: 0; }
.pc-cross {
  stroke: rgba(244, 239, 228, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.12s ease;
}
.pc-marker {
  fill: var(--pc-key);
  stroke: #0b0910;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.12s ease;
}
.pc-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 8, 14, 0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  z-index: 2;
}
.pc-tip b { display: block; font-size: 14px; }
.pc-tip span { color: var(--muted); font-size: 11px; }

.pc-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}
.pc-band { color: rgba(244, 239, 228, 0.5); }

.pc-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.pc-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240, 193, 75, 0.7);
}

.pc-sell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.pc-own { color: var(--muted); font-size: 13px; }
.pc-sell-btn { padding: 9px 16px; font-size: 13px; }

@media (max-width: 620px) {
  .pc-now b { font-size: 25px; }
  .pc-svg { height: 150px; }
}

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #17141d; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; z-index: 50; transition: 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.site-footer {
  border-top: 1px solid var(--line); padding: 18px 28px 28px; color: var(--muted);
  font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-footer a { color: var(--gold-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .pack-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
  .home-odds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-rail {
    position: static;
    max-height: none;
  }
}
@media (max-width: 860px) {
  .hero, .pack-grid, .inspect-grid, .home-hero, .home-sets, .home-steps,
  .home-market, .home-pulls { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .site-header { flex-wrap: wrap; }
  .home-stage { display: none; }
  .home-hero { min-height: 0; margin-bottom: 24px; }
  .home-copy h1,
  h1 { font-size: clamp(28px, 8vw, 40px); line-height: 1.05; }
  .home-set { grid-template-columns: 1fr; }
  .home-set-fan { height: 132px; overflow: hidden; }
  .home-set-pack img { height: 120px; }
  .home-odds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-proof { gap: 8px 18px; }
  .home-worth { padding: 16px; }
  .auth-page { grid-template-columns: 1fr; }
  .account-id { flex-wrap: wrap; }
  .account-actions { margin-left: 0; }
  .ghost, .solid { min-width: 0; padding: 10px 12px; }
  .inspect-info h2 { font-size: 24px; }
  .shop-layout .pack-grid,
  .pack-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand tools"
      "nav nav";
    align-items: center;
    gap: 8px 10px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .brand { grid-area: brand; min-width: 0; }
  .mark { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }
  .brand-name { font-size: 15px; }
  .brand-sub { display: none; }
  .header-right {
    grid-area: tools;
    gap: 6px;
    min-width: 0;
  }
  .nav {
    grid-area: nav;
    order: unset;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn { flex: 0 0 auto; padding: 7px 11px; font-size: 12px; }
  .nav-sep { flex: 0 0 1px; }
  .pill { padding: 6px 9px; font-size: 12px; }
  .claim { font-size: 12px; padding: 6px 10px; }
  .auth-entry { padding: 6px 10px; font-size: 12px; }
  .trainer-chip-copy small { display: none; }
  .trainer-chip { max-width: 132px; }
  .wrap,
  body.on-home .wrap,
  body.on-shop .wrap,
  body.on-collection .wrap {
    width: calc(100% - 20px);
    padding: 16px 0 88px;
  }
  .site-footer { padding: 16px 12px max(24px, env(safe-area-inset-bottom)); }
  .collection-tools,
  .bulk-toolbar { gap: 8px; }
  .search { min-width: 0; flex: 1 1 100%; font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .filter { flex: 1 1 calc(50% - 4px); }
  .bulk-head { grid-template-columns: 1fr; gap: 12px; }
  .bulk-copy h1 { font-size: clamp(26px, 8vw, 34px); }
  .bulk-seg { margin-left: 0; flex: 1 1 100%; justify-content: space-between; }
  .bulk-seg .seg-btn { flex: 1; text-align: center; }
  .bulk-era-sets { grid-template-columns: 1fr; }
  .bulk-era { min-width: 120px; }
  .shop-wrapper { padding: 8px 0 0; }
  .shop-wrapper img {
    height: auto;
    max-height: 200px;
    width: auto;
    max-width: 100%;
  }
  .pack-card { padding: 14px; }
  .pack-card h3 { font-size: 18px; margin: 10px 0 6px; }
  .blurb { font-size: 13px; margin: 0 0 12px; }
  .stat { min-width: 0; flex: 1 1 30%; padding: 10px; }
  .stat b { font-size: 18px; }
  .binder-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(42vw, 140px), 1fr));
    gap: 10px;
  }
  .home-film .mini-card { width: 80px; }
  .home-cta { margin-top: 18px; }
  .inspect-art { max-width: 220px; margin: 0 auto; }
  .inspect-grid { gap: 16px; }
  .radio { right: 10px; bottom: 10px; }
}

@media (max-width: 620px) {
  .home-pack-float:nth-child(1) { left: 0; }
  .home-pack-float:nth-child(2) { right: 0; }
}

/*
 * Respect the OS setting, not just the in-app toggle. This mirrors what
 * body.no-motion does so a reduced-motion visitor gets a still, readable
 * page: no shimmer, no sway, no spark burst, no card sway on hover.
 */
@media (prefers-reduced-motion: reduce) {
  .home-float,
  .home-pack-float,
  .float-card,
  .home-set-pack,
  .tcg .foil,
  .tcg .foil::before,
  .tcg .foil::after,
  .tcg .glare,
  .focus-aura,
  .hit-spark,
  .crumb,
  .spread-card,
  .focus-card,
  .pull-inner {
    animation: none !important;
  }
  .focus-card,
  .pull-inner,
  .tcg,
  .tcg img {
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* --- added in review pass ------------------------------------------------ */

/* A card whose art failed to load keeps its frame instead of showing a
   broken-image icon. */
.tcg.art-missing {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    #14111a;
  border: 1px solid var(--line);
  border-radius: 4.6% / 3.3%;
}
.tcg.art-missing img { opacity: 0; }
.tcg.art-missing::after {
  content: "art unavailable";
  position: absolute;
  inset: auto 8% 10% 8%;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tcg.art-missing .foil,
.tcg.art-missing .glare { display: none; }

.save-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Radio ----------------------------------------------------------------
   Fixed mini player. z-index stays under .overlay (40) so pack ripping and
   the inspector never fight it. :has() hides the widget while a dialog is
   up so it does not ghost through the 95% overlay. */
.radio {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 22;
  width: 56px;
  pointer-events: none;
}
.radio > * { pointer-events: auto; }
.radio-peek {
  position: relative;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(240, 193, 75, 0.35);
  border-radius: 16px;
  overflow: hidden;
  background: #141018;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.radio-peek-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.radio-peek-eq {
  display: none;
  position: absolute;
  right: 5px;
  bottom: 5px;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(9, 7, 13, 0.72);
}
.radio.is-playing .radio-peek-eq { display: flex; }
.radio-peek-eq i {
  display: block;
  width: 2px;
  height: 4px;
  background: var(--gold);
  animation: radio-eq 0.7s ease-in-out infinite;
}
.radio-peek-eq i:nth-child(2) { animation-delay: -0.2s; height: 8px; }
.radio-peek-eq i:nth-child(3) { animation-delay: -0.45s; }
@keyframes radio-eq {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}
body.no-motion .radio-peek-eq i { animation: none; transform: none; }

.radio-panel {
  display: none;
  width: 292px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(14, 11, 20, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}
.radio.is-open {
  width: 292px;
}
.radio.is-open .radio-peek { display: none; }
.radio.is-open .radio-panel { display: block; }

.radio-now {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.radio-cover {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #111;
}
.radio-copy { min-width: 0; }
.radio-kicker {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.radio-copy b {
  display: block;
  font-size: 14px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.radio-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.radio-hide {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.radio-hide:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.2); }

.radio-progress {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.radio-seek,
.radio-vol input {
  width: 100%;
  height: 4px;
  margin: 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.radio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.radio-controls button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}
.radio-controls .radio-play {
  width: 42px;
  background: var(--gold);
  border-color: transparent;
  color: #1a1408;
  font-size: 14px;
}
.radio-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}
.radio-vol input { flex: 1; }

.radio-list {
  max-height: 196px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 239, 228, 0.18) transparent;
}
.radio-track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.radio-track img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}
.radio-track span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.radio-track b {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.radio-track small { color: var(--muted); font-size: 10px; }
.radio-track:hover { background: rgba(255, 255, 255, 0.05); }
.radio-track.on {
  border-color: rgba(240, 193, 75, 0.4);
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.12), rgba(255, 255, 255, 0.02));
}
.radio-track.on b { color: var(--gold); }

body:has(#overlay:not(.hidden)) .radio,
body:has(#inspect:not(.hidden)) .radio {
  display: none;
}

@media (min-width: 961px) {
  body.on-shop .shop-rail { padding-bottom: 72px; }
}
@media (max-width: 620px) {
  .radio { right: 12px; bottom: 12px; }
  .radio.is-open { width: min(292px, calc(100vw - 24px)); }
  .radio-panel { width: min(292px, calc(100vw - 24px)); }
}

.notes-list { display: grid; gap: 14px; }
.notes-entry {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.notes-entry header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.notes-entry h3 { margin: 0; font-size: 18px; }
.notes-entry time { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.notes-entry ul { margin: 0; padding: 0 0 0 18px; color: #cbbfae; font-size: 14px; line-height: 1.55; }
.notes-entry li { margin: 0 0 6px; }
.notes-empty { color: var(--muted); }

/*
 * Phone pack-open is a normal scrolling column. Stretch-to-viewport and
 * absolutely pinned chrome clipped the card, Done, and the spread.
 */
@media (max-width: 720px) {
  #overlay,
  #inspect {
    display: block;
    justify-content: unset;
    align-items: unset;
    overflow-x: hidden;
    overflow-y: auto;
    padding: max(10px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  }
  #overlay .rip-stage,
  #overlay.dealing .rip-stage,
  #inspect .inspect-stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex: none;
    width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    gap: 10px;
  }
  #overlay .overlay-leave {
    position: static;
    align-self: flex-end;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
  }
  #overlay .rip-hint {
    min-height: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
  }
  #overlay .booster {
    width: min(188px, 52vw);
    margin: 4px auto 8px;
  }
  #overlay .focus-wrap {
    flex: none;
    display: block;
    width: 100%;
  }
  #overlay .focus-meta {
    min-height: 5.5rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  #overlay .focus-kicker {
    min-height: 1.2rem;
  }
  #overlay .focus-title {
    font-size: 18px;
    line-height: 1.15;
    min-height: 2.3em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  #overlay .focus-stage {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    min-height: 0;
    width: 100%;
    gap: 4px;
  }
  #overlay .focus-aura,
  #overlay .hit-fx {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  #overlay .focus-nav.prev { grid-column: 1; grid-row: 1; }
  #overlay .focus-card { grid-column: 2; grid-row: 1; }
  #overlay .focus-nav.next { grid-column: 3; grid-row: 1; }
  #overlay .focus-card {
    width: min(210px, 58vw);
    max-height: none;
    height: auto;
    justify-self: center;
    align-self: center;
  }
  #overlay .focus-nav {
    width: 36px;
    height: 36px;
    font-size: 24px;
    align-self: center;
    justify-self: center;
  }
  #overlay .thumbs {
    flex: none;
    min-height: 58px;
    margin: 0;
    padding: 6px 8px;
    gap: 4px;
    max-width: none;
    width: 100%;
  }
  #overlay .thumbs.hidden {
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
    border-color: transparent;
    background: transparent;
  }
  #overlay .thumb,
  #overlay .thumb.empty { width: 36px; }
  #overlay .overlay-actions {
    position: sticky;
    bottom: 0;
    z-index: 8;
    flex: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 8px;
    margin: 16px 0 0;
    padding: 14px 0 max(14px, env(safe-area-inset-bottom));
    min-height: 6.5rem;
    background: linear-gradient(180deg, transparent, rgba(6, 4, 10, 0.97) 36%);
  }
  #overlay .overlay-actions.hidden { display: none !important; }
  #overlay .overlay-actions .ghost,
  #overlay .overlay-actions .solid {
    flex: 1 1 calc(50% - 8px);
    width: auto;
    min-width: 0;
    grid-column: auto;
  }
  #overlay .spread { margin: 0; }
  #overlay .spread-card { width: 92px; }
  #overlay .spread-card.hit { width: 104px; }
  .spread-card .tcg.lit,
  .focus-card.flipped .face-back .tcg.lit {
    transform: perspective(760px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(1.02);
  }
}
