:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --surface-2: #F5EEE3;
  --line: #E9DFD0;
  --ink: #23202E;
  --muted: #6E6878;
  --accent: #E0503A;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE4DD;
  --teal: #0E8A82;
  --teal-soft: #DAF1EE;
  --sun: #E9A21F;
  --sun-soft: #FDF0D3;
  --warn: #A9600A;
  --bad: #C93B3B;
  --slab: #ECEFF4;
  --slab-edge: #C8CEDA;
  --label: #FFFFFF;
  --label-ink: #23202E;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 6px 18px rgba(60, 40, 20, 0.06);
  --font-display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17141F;
    --surface: #211D2B;
    --surface-2: #2A2536;
    --line: #3A3448;
    --ink: #F3EEF7;
    --muted: #A9A1B6;
    --accent: #FF7A62;
    --accent-ink: #1B0E0A;
    --accent-soft: #42251F;
    --teal: #45C9BE;
    --teal-soft: #163532;
    --sun: #F7C661;
    --sun-soft: #3A3018;
    --warn: #F2B254;
    --bad: #F06A6A;
    --slab: #343044;
    --slab-edge: #4E4760;
    --label: #F3EEF7;
    --label-ink: #23202E;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17141F;
  --surface: #211D2B;
  --surface-2: #2A2536;
  --line: #3A3448;
  --ink: #F3EEF7;
  --muted: #A9A1B6;
  --accent: #FF7A62;
  --accent-ink: #1B0E0A;
  --accent-soft: #42251F;
  --teal: #45C9BE;
  --teal-soft: #163532;
  --sun: #F7C661;
  --sun-soft: #3A3018;
  --warn: #F2B254;
  --bad: #F06A6A;
  --slab: #343044;
  --slab-edge: #4E4760;
  --label: #F3EEF7;
  --label-ink: #23202E;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 48px;
}
@media (max-width: 719px) { body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
.shell { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 14px; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); transform: rotate(-6deg); box-shadow: var(--shadow); }
.brand h1 { font-size: 26px; font-weight: 700; line-height: 1; }
.brand small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 3px; }
.bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample { font-size: 12px; font-weight: 700; color: var(--warn); background: var(--sun-soft); border-radius: 999px; padding: 5px 10px; }
.me-chip { appearance: none; font: inherit; display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer; }
.me-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Nav: top bar on wide screens, bottom tab bar on phones */
.nav { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.nav a { appearance: none; flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; font: 700 14px var(--font-body); color: var(--muted); padding: 10px 12px; border-radius: 12px; cursor: pointer; position: relative; min-width: 0; }
.nav a[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav svg { width: 20px; height: 20px; flex: none; }
.count { font-size: 11px; font-weight: 800; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.count.sun { background: var(--sun); color: #23202E; }
@media (max-width: 719px) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; border-radius: 18px 18px 0 0; border-width: 1px 0 0; gap: 2px;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; }
  .nav .count { position: absolute; top: 0; left: calc(50% + 6px); }
}

/* Panels, buttons, pills */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.btn { appearance: none; font: inherit; font-weight: 800; font-size: 14px; border-radius: 12px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible, .btn:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { font-size: 12px; padding: 6px 10px; border-radius: 10px; }
select, input[type="search"], input[type="number"], textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0; }
textarea { width: 100%; resize: vertical; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill.good { background: var(--teal-soft); color: var(--teal); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.plain { background: var(--surface-2); color: var(--muted); }
.pill.turn { background: var(--sun-soft); color: var(--warn); }
.gchip { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 6px; white-space: nowrap; line-height: 1.5; }
.gchip.slab { background: var(--ink); color: var(--bg); }
.gchip.raw { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.gchip.want { background: var(--accent-soft); color: var(--accent); white-space: normal; }
.tag-trade { font-size: 11px; font-weight: 800; color: var(--teal); }
.tag-star { color: var(--sun); font-weight: 800; }

/* Card tile: 63 x 88 like a real card. Sleeve for raw cards, slab with label for graded. */
.tile { position: relative; width: 100%; aspect-ratio: 63 / 88; border-radius: 5.5% / 4%; overflow: hidden; container-type: inline-size; color: var(--ti, #FFFFFF);
  background: radial-gradient(130% 90% at 15% 0%, color-mix(in srgb, var(--c) 45%, #FFFFFF) 0%, var(--c) 50%, color-mix(in srgb, var(--c) 72%, #000000) 100%); }
.tile::before { content: ''; position: absolute; inset: 4.5%; border-radius: 4% / 3%; border: 1px solid rgba(255, 255, 255, 0.4); pointer-events: none; }
.tile .tn { position: absolute; top: 8%; left: 10%; right: 10%; font: 600 11.5cqw/1.1 var(--font-display); overflow-wrap: anywhere; }
.tile .mono { position: absolute; left: 20%; top: 31%; width: 60%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.2); font: 700 30cqw/1 var(--font-display); }
.tile .tf { position: absolute; left: 10%; right: 10%; bottom: 8%; display: flex; justify-content: space-between; gap: 4px; font: 700 6.5cqw/1.2 var(--font-body); opacity: 0.92; }
.tile .tf span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.holo::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, transparent 22%, rgba(255, 255, 255, 0.3) 38%, rgba(255, 255, 255, 0) 48%, rgba(255, 255, 255, 0.18) 58%, transparent 70%); }
.tile.photo { background: var(--surface-2) center / cover no-repeat; }
.tile.photo::before, .tile.photo .tf, .tile.photo .mono { display: none; }
.tile.photo .tn { top: auto; bottom: 0; left: 0; right: 0; padding: 22% 9% 8%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #FFFFFF; font-size: 9.5cqw; }
.t-fire { --c: #E4573D; } .t-water { --c: #2F80D9; } .t-lightning { --c: #F2C230; --ti: #2A2333; } .t-psychic { --c: #9A55CF; }
.t-grass { --c: #3F9E52; } .t-dark { --c: #3E4157; } .t-dragon { --c: #B8892F; } .t-colorless { --c: #B3AEBF; --ti: #2A2333; }
.tile.t-lightning::before, .tile.t-colorless::before { border-color: rgba(0, 0, 0, 0.18); }
.tile.t-lightning .mono, .tile.t-colorless .mono { background: rgba(255, 255, 255, 0.4); }
.thumb { width: 44px; border-radius: 4px; flex: none; }
.thumb .tn, .thumb .tf, .thumb::before { display: none; }
.thumb .mono { left: 14%; top: 28%; width: 72%; font-size: 40cqw; }
.thumb.in-slab { outline: 3px solid var(--slab-edge); }
.sleeved { padding: 3.5%; border-radius: 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--line); }
.slabbed { container-type: inline-size; padding: 5% 6% 7%; border-radius: 10px; display: grid; gap: 5px; border: 1px solid var(--slab-edge);
  background: linear-gradient(180deg, color-mix(in srgb, var(--slab) 70%, #FFFFFF), var(--slab)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.slabbed .lbl { background: var(--label); color: var(--label-ink); border-radius: 4px; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 3.5cqw 5cqw; border-bottom: 2px solid var(--accent); }
.lbl-l { display: grid; font: 800 6cqw/1.15 var(--font-body); letter-spacing: 0.04em; }
.lbl-l b { font-size: 7.5cqw; }
.lbl-g { font: 700 15cqw/1 var(--font-display); }

/* Mini rows (card in lists) */
.mrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 8px 12px 8px 8px; min-width: 0; }
.mname { font-weight: 800; font-size: 14px; overflow-wrap: anywhere; line-height: 1.3; }
.msub { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 6px; align-items: center; margin-top: 2px; }
.mprice { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.mprice small { display: block; font-weight: 600; font-size: 11px; color: var(--muted); }
.mprice.ref { color: var(--muted); font-style: italic; }

/* Matches & offers */
.match { scroll-margin-top: 16px; }
.mhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.who { appearance: none; border: 0; background: transparent; padding: 2px; margin: -2px; font: inherit; color: inherit; text-align: left; display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 12px; min-width: 0; }
.who:hover b { text-decoration: underline; }
.who:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 16px var(--font-display); background: var(--sun-soft); color: var(--warn); }
.who b { font-weight: 800; display: block; }
.who small { font-size: 12px; color: var(--muted); display: block; }
.swap { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); gap: 10px; align-items: start; }
.swap .col { display: grid; gap: 6px; min-width: 0; }
.swap h4 { font: 800 11px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.swap .arrow { align-self: center; color: var(--muted); display: grid; place-items: center; }
@media (max-width: 600px) { .swap { grid-template-columns: 1fr; } .swap .arrow { transform: rotate(90deg); justify-self: center; } }
.empty-col { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1.5px dashed var(--line); border-radius: 14px; padding: 12px; }
.balance { display: grid; gap: 6px; }
.track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; }
.track i { display: block; height: 100%; }
.track i.g { background: var(--teal); }
.track i.a { background: var(--accent); }
.blabel { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.blabel b { color: var(--ink); }
.even { font-weight: 800; font-size: 14px; }
.notes { margin: 0; padding: 10px 12px; list-style: none; display: grid; gap: 8px; font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 14px; }
.notes li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.notes b { color: var(--ink); }
.mfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; }
.terms .pill { font-size: 13px; padding: 5px 12px; }
details.history summary { cursor: pointer; font-size: 13px; font-weight: 800; color: var(--muted); }
.thread { display: grid; gap: 10px; border-left: 3px solid var(--line); padding-left: 12px; margin-top: 10px; }
.entry { font-size: 13px; display: grid; gap: 2px; }
.entry .who-line { font-weight: 800; }
.entry .note { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.typing { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.fair { font-size: 14px; font-weight: 800; }
.fair.over { color: var(--warn); }
.fair.under { color: var(--teal); }
.tips { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.tips b { color: var(--ink); }

/* Collection */
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.big-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 26px var(--font-display); flex: none; }
.profile h2 { font-size: 24px; }
.pstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .pstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hits { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--teal-soft); border-radius: 16px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.hits span { flex: 1 1 180px; }
.pstat { background: var(--surface-2); border-radius: 16px; padding: 10px 14px; }
.pstat b { display: block; font: 600 22px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.pstat small { color: var(--muted); font-weight: 700; font-size: 12px; }
.showcase-panel { background: linear-gradient(135deg, var(--sun-soft), var(--accent-soft)); border-color: transparent; }
.col-top { display: grid; gap: 18px; }
@media (min-width: 900px) { .col-top { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: stretch; } .col-top .pstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .col-top .panel { align-content: start; } }
.showcase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; max-width: 640px; align-items: end; }
@media (max-width: 480px) { .showcase { gap: 10px; } }
.feat { appearance: none; border: 0; background: transparent; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 8px; align-content: start; min-width: 0; }
.feat:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.feat .art { transition: transform 0.15s ease; }
.feat:hover .art { transform: translateY(-3px) rotate(-1deg); }
@media (prefers-reduced-motion: reduce) { .feat .art { transition: none; } }
.feat .cap b { display: block; font: 600 15px/1.2 var(--font-display); overflow-wrap: anywhere; }
.feat .cap span { font-size: 12px; color: var(--muted); font-weight: 700; }
.feat.empty .slot { aspect-ratio: 63 / 100; border: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; padding: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; font: inherit; font-weight: 700; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pager { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.page { position: relative; background: var(--surface-2); border-radius: 20px; padding: 16px 16px 16px 46px; }
.page::before { content: ''; position: absolute; left: 14px; top: 0; bottom: 0; width: 18px;
  background:
    radial-gradient(circle, var(--bg) 0 6px, var(--line) 6.5px 8px, transparent 8.5px) 0 16% / 18px 18px no-repeat,
    radial-gradient(circle, var(--bg) 0 6px, var(--line) 6.5px 8px, transparent 8.5px) 0 50% / 18px 18px no-repeat,
    radial-gradient(circle, var(--bg) 0 6px, var(--line) 6.5px 8px, transparent 8.5px) 0 84% / 18px 18px no-repeat; }
.pockets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 640px; margin: 0 auto; }
.binder { display: grid; }
.binder.spread { grid-template-columns: 1fr 1fr; gap: 6px; }
.binder.spread .pockets { max-width: none; }
.page.left { padding: 16px 46px 16px 16px; border-radius: 20px 6px 6px 20px; }
.page.left::before { left: auto; right: 14px; }
.page.right { border-radius: 6px 20px 20px 6px; }
.pocket { appearance: none; border: 0; background: var(--surface); border-radius: 14px; padding: 8px; display: grid; gap: 6px; align-content: start; cursor: pointer; text-align: left; font: inherit; color: inherit; min-width: 0; box-shadow: var(--shadow); }
.pocket:hover { background: var(--accent-soft); }
.pocket:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pocket.static { cursor: default; }
.pocket.static:hover { background: var(--surface); }
.pocket .cap { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11px; font-weight: 700; min-height: 18px; }
.pocket.empty { background: transparent; border: 2px dashed var(--line); box-shadow: none; color: var(--muted); }
.pocket.empty:hover { background: var(--accent-soft); }
.pocket.empty .ph { aspect-ratio: 63 / 100; display: grid; place-items: center; font-size: 12px; font-weight: 800; text-align: center; }
.pocket.blank { cursor: default; }
.pocket.blank:hover { background: transparent; }
@media (max-width: 520px) {
  .page { padding: 10px 10px 10px 32px; }
  .page::before { left: 8px; }
  .pockets { gap: 8px; }
  .pocket { padding: 5px; border-radius: 10px; }
}
.wishgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .wishgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }

/* Prices */
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .stat-row { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font-weight: 700; }
td.sel, th.sel { background: var(--accent-soft); }
td small.n { display: block; font-size: 10px; color: var(--muted); font-weight: 600; }
td .ref { color: var(--muted); font-style: italic; }
.cardcell { display: flex; align-items: center; gap: 10px; }
.cardcell .thumb { width: 28px; }
.cardcell b { display: block; }
.cardcell span { font-size: 12px; color: var(--muted); }
.up { color: var(--teal); }
.down { color: var(--bad); }
.dim { color: var(--muted); font-size: 12px; font-weight: 600; }
.spark { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }

/* Dialogs */
.overlay { position: fixed; inset: 0; background: rgba(23, 20, 31, 0.5); display: grid; place-items: center; padding: 16px; z-index: 30; }
#pick { z-index: 36; }
#sheet { z-index: 34; }
.dialog { width: min(500px, 100%); max-height: 92%; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.dialog.wide { width: min(620px, 100%); }
.dialog h2:focus { outline: none; }
.bsec { display: grid; gap: 8px; }
.choices { display: grid; gap: 6px; }
.opt { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; cursor: pointer; }
.opt.nothumb { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 12px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt.off { opacity: 0.5; cursor: not-allowed; }
.opt .t { font-weight: 700; font-size: 14px; min-width: 0; }
.opt small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.opt small.fit { color: var(--teal); }
.opt .v { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cashbox { display: grid; gap: 10px; background: var(--surface-2); border-radius: 16px; padding: 14px; }
.money { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.money input { width: 130px; font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--surface); }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg label.off { opacity: 0.45; cursor: not-allowed; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.ship { font-size: 13px; background: var(--sun-soft); border-radius: 14px; padding: 10px 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check input { margin-top: 3px; }
.catrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: var(--surface-2); }
.catrow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 480px) { .catrow { grid-template-columns: 44px minmax(0, 1fr); } .catrow .acts { grid-column: 1 / -1; justify-content: stretch; } .catrow .acts .btn { flex: 1; } }
.catlist { display: grid; gap: 6px; max-height: 56vh; overflow-y: auto; }
.sheet-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 520px) { .sheet-grid { grid-template-columns: 1fr; } .sheet-grid .sheet-art { width: 58%; justify-self: center; } }
.sheet-info { display: grid; gap: 10px; min-width: 0; }
.sheet-info h2 { font-size: 24px; }
.valuebox { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.valuebox b { font: 600 24px var(--font-display); font-variant-numeric: tabular-nums; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; font-weight: 700; font-size: 14px; cursor: pointer; }
.switch small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.tog { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.tog:checked { background: var(--teal); }
.tog:checked::after { transform: translateX(18px); }
.tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tog:disabled { opacity: 0.45; cursor: not-allowed; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px; border-radius: 14px; padding: 10px 16px; z-index: 50; max-width: calc(100% - 32px); }
@media (max-width: 719px) { .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

/* ---- Production additions ---- */
.t-fighting { --c: #B5643A; } .t-metal { --c: #7D8A99; } .t-fairy { --c: #D86CA8; }
.center-card { max-width: 460px; margin: 5vh auto 0; }
.hero-title { font: 700 34px/1.1 var(--font-display); }
.field { display: grid; gap: 6px; }
.field > label, .field > .lab { font-weight: 800; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; }
.field small { color: var(--muted); font-size: 12px; }
.field small.warn-text { color: var(--bad); font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn.block { width: 100%; }
.btn.big { padding: 12px 16px; font-size: 15px; border-radius: 14px; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); font: 700 13px var(--font-body); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.demo-banner { background: var(--sun-soft); color: var(--warn); font-weight: 700; font-size: 13px; border-radius: 14px; padding: 10px 14px; }
.gchip.lang { background: var(--teal-soft); color: var(--teal); }
.offer-row { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 14px 16px; display: grid; gap: 8px; text-align: left; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow); width: 100%; }
.offer-row:hover { border-color: var(--accent); }
.offer-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.offer-row .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.offer-row .top b { font-weight: 800; }
.offer-row .sum { font-size: 13px; color: var(--muted); }
.dot-new { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.bubbles { display: grid; gap: 8px; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 14px; background: var(--surface-2); justify-self: start; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.me { justify-self: end; background: var(--accent-soft); }
.bubble small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; white-space: normal; }
.sys { justify-self: center; font-size: 12px; color: var(--muted); text-align: center; font-weight: 700; padding: 2px 8px; }
.termline { justify-self: stretch; border: 1px dashed var(--line); border-radius: 14px; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.termline b { color: var(--ink); }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.results { display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.result { appearance: none; border: 0; background: var(--surface-2); border-radius: 14px; padding: 8px 12px 8px 8px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.result:hover { background: var(--accent-soft); }
.result:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stars-input { display: flex; gap: 4px; }
.stars-input button { appearance: none; background: none; border: 0; font-size: 32px; line-height: 1; cursor: pointer; color: var(--line); padding: 2px; }
.stars-input button.on { color: var(--sun); }
.stars-input button:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }
.review { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 2px; font-size: 14px; }
.review .st { color: var(--sun); letter-spacing: 1px; }
.list-plain { display: grid; gap: 8px; }
.adminrow { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; font-size: 14px; }
.fatal { max-width: 560px; margin: 10vh auto; }
.legal { max-width: 720px; margin: 0 auto; }
.legal h1 { font: 700 30px var(--font-display); }
.legal h2 { margin-top: 18px; }
.legal p, .legal li { line-height: 1.65; }
.draft-note { background: var(--sun-soft); border-radius: 14px; padding: 10px 14px; font-weight: 700; color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.nav a { text-decoration: none; }
.me-chip, .icon-btn { text-decoration: none; }
.who { text-decoration: none; color: inherit; }
input:not([type]), input[type="text"], input[type="email"] { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
input:not([type]):focus, input[type="text"]:focus, input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
a { color: var(--accent); }
@media (max-width: 560px) {
  .brand small { display: none; }
  .icon-btn .lbl, #meChipText { display: none; }
  .me-chip { padding: 4px; }
  .bar { flex-wrap: nowrap; }
  .brand h1 { font-size: 22px; }
}
@media (max-width: 560px) {
  .bar-right { flex-wrap: nowrap; gap: 6px; }
  .bar-right .sample { display: none; }
  .logo { width: 38px; height: 38px; }
}
