/* Rubik (SIL Open Font License: css/rubik-license.txt), Latin, every weight */
@font-face { font-family: Rubik; font-style: normal; font-weight: 300 800; font-display: swap; src: url(rubik.woff2) format("woff2"); }
/* MikeyReuter.com styles: mobile-first, light + dark; black / gray / white, a gold accent, Have green / Want red / Trade blue. */
:root {
  --bg: #f5f5f4; --surface: #fff; --surface-2: #efefed; --text: #18181b; --muted: #64646c; --border: #dcdcd8;
  --accent: #18181b; --on-accent: #fff; --gold: #9a7612;
  --have: #16a34a; --have-soft: #dcfce7; --want: #dc2626; --want-soft: #fee2e2; --trade: #2563eb; --trade-soft: #dbeafe;
  --warn: #a86400; --bad: #c42f2f; --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10; --surface: #18181b; --surface-2: #232327; --text: #ececec; --muted: #9a9aa2; --border: #2e2e33;
    --accent: #ececec; --on-accent: #18181b; --gold: #e6bf4f;
    --have: #22c55e; --have-soft: #0f2a1a; --want: #f87171; --want-soft: #2d1416; --trade: #60a5fa; --trade-soft: #14213a;
    --warn: #f0a83a; --bad: #f07070; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: #f5f5f4; color: #18181b; background: var(--bg); color: var(--text);
  font: 13px/1.4 Rubik, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; margin-top: 12px; }
p { margin: 4px 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }
p.center { margin: 10px 0 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.error { color: var(--bad); margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); min-width: 0;
}
textarea { height: auto; padding: 6px 8px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-weight: 600; font-size: .85rem;
  cursor: pointer; white-space: nowrap; color: var(--text);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { opacity: .88; background: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.icon { width: 30px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- header: computer = logo left · menu middle · account right; phone = logo middle, menu below ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; grid-template-areas: "brand nav acct";
  align-items: center; gap: 4px 12px; padding: 7px 12px; padding: 7px max(12px, calc((100% - 1280px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { grid-area: brand; justify-self: start; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text); line-height: 1; }
.brand:hover { text-decoration: none; }
.brand img { height: 24px; width: auto; display: block; }
.brand small, .foot [data-version] { color: var(--muted); font-size: .68rem; font-weight: 600; }
/* the menu: centered; if it ever doesn't fit, it slides sideways by itself (the page never does) */
.top nav { grid-area: nav; display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav::before, .top nav::after { content: ''; margin: auto; } /* centers it, and still scrolls from the first item */
.top nav a { flex: none; padding: 5px 10px; border-radius: 7px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.top nav a:hover { background: var(--surface-2); text-decoration: none; }
.top nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.top-right { grid-area: acct; justify-self: end; display: flex; align-items: center; gap: 8px; }
.sync { font-size: .75rem; font-weight: 700; color: var(--have); white-space: nowrap; transition: opacity .6s; }
.sync.saving { color: var(--muted); }
.sync.error { color: var(--bad); }
.sync.fade { opacity: 0; }
main { display: block; max-width: 1280px; margin: 0 auto; padding: 14px 12px 32px; min-height: 70vh; }
.foot {
  max-width: 1280px; margin: 0 auto; padding: 14px 12px 20px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted);
  text-align: center;
}
.wordmark { font-weight: 900; } /* footer text "MikeyReuter.com" */
.wordmark b { color: var(--gold); }
.head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 10px; text-align: center; }

/* ---------- totals bar under the header (collection pages) ---------- */
.statsbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.stats-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1280px; margin: 0 auto; padding: 4px 12px; }
.scell {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 6px; min-width: 0; padding: 1px 8px; border: 0;
  border-left: 1px solid var(--border); background: none; line-height: 1.3; cursor: pointer;
}
.scell:first-child { border-left: 0; }
.scell:hover { background: var(--surface-2); }
.slabel { font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.scell.have .slabel { color: var(--have); }
.scell.want .slabel { color: var(--want); }
.scell.trade .slabel { color: var(--trade); }
.snum { font-size: .92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scell.owned .snum { color: var(--gold); }
.sval { font-size: .76rem; font-weight: 600; white-space: nowrap; }
.savg { font-size: inherit; font-weight: 400; color: var(--muted); }
.srange { font-size: .66rem; color: var(--muted); white-space: nowrap; }
.bar { height: 6px; border-radius: 9px; background: var(--border); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--have); }
.statsbar > .bar { height: 2px; border-radius: 0; background: transparent; }
.set-progress { display: grid; justify-items: center; gap: 4px; font-size: .8rem; font-weight: 600; }
.set-progress .bar { width: 220px; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- toolbar ---------- */
.seg { display: flex; flex-wrap: wrap; justify-content: center; margin: 12px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 10px auto 0; }
.toolbar .seg { margin: 0; }
.toolbar .btn { height: 32px; }
.toolbar .tally { margin: 0; font-size: .75rem; color: var(--muted); white-space: nowrap; } /* "Continue: Base Set", "211 of 211 sets" */
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 7px 7px 0; }
.seg .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); position: relative; }

/* ---------- search (magnifying glass + the box it opens), Filter button and the panel it opens ---------- */
.search-box { display: flex; max-width: 640px; margin: 10px auto 0; }
.search-box input { flex: 1 1 auto; }
.btn.mag-btn { width: 32px; }
.mag-btn.on { background: var(--surface-2); border-color: var(--muted); }
.mag { position: relative; width: 11px; height: 11px; margin: -3px 0 0 -3px; border: 2px solid currentColor; border-radius: 50%; }
.mag::after {
  content: ""; position: absolute; right: -4px; bottom: -5px; width: 2px; height: 6px; border-radius: 1px; background: currentColor;
  transform: rotate(-45deg);
}
.filter-btn { position: relative; }
.filter-btn::before { content: ""; width: 12px; height: 10px; background: currentColor; clip-path: polygon(0 0, 100% 0, 62% 50%, 62% 100%, 38% 85%, 38% 50%); }
.filter-btn.active::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.filter-btn[aria-expanded="true"] { background: var(--surface-2); }
.filter-panel {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: end; gap: 8px 12px; max-width: 900px; margin: 8px auto 0;
  padding: 10px 12px;
}
.ctl { display: grid; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ctl select, .ctl input { color: var(--text); font-size: .85rem; font-weight: 400; text-transform: none; letter-spacing: 0; }
.pair { display: flex; gap: 4px; }
.pair input { width: 84px; }
.check { display: flex; align-items: center; gap: 6px; height: 32px; font-size: .8rem; }
.check input { height: auto; }

/* ---------- sets ---------- */
.serie { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 28px 0 0; }
.serie::before, .serie::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border)); }
.serie::after { background: linear-gradient(90deg, var(--border), transparent); }
.serie h2 { font-size: 1.2rem; letter-spacing: .02em; }
.serie-syms { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 10px auto 0; max-width: 1000px; }
.serie-syms .sym { height: 28px; max-width: 40px; margin: 0; }
.fold { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.fold:hover { color: var(--gold); }
.fold:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.count {
  font-size: .7rem; font-weight: 600; padding: 1px 7px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
  color: var(--muted);
}
.chev { display: inline-block; font-size: .75rem; transition: transform .15s; }
.closed .chev { transform: rotate(-90deg); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, 112px); justify-content: start; gap: 8px; margin-top: 10px; }
.set-tile { position: relative; display: flex; padding: 8px; }
.set-tile > a { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.set-tile > a > .bar { margin-top: auto; } /* every tile's bar at the very bottom, lined up */
.set-tile > a:hover { text-decoration: none; }
.set-tile:hover { border-color: var(--muted); }
.set-tile.done { border-color: var(--gold); }
.set-tile.here { box-shadow: inset 0 0 0 2px var(--gold); } /* the set open below (row of sets on set pages) */
.set-rail { margin-bottom: 8px; }
.set-rail .carousel.sets { --w: 84px; } /* the row of sets on top stays small */
.set-tile.off { border-style: dashed; }
.set-tile.off > a { opacity: .35; filter: grayscale(1); }
.set-logo { height: 52px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.set-logo img { width: 100%; height: 100%; object-fit: contain; } /* the logo always fits its box */
.logo-text { font-weight: 800; color: var(--muted); text-align: center; font-size: .85rem; }
/* symbol beside the name, the name on up to 2 lines (each in its own box, so lines never overlap) */
.set-name { display: flex; align-items: flex-start; gap: 5px; height: 2.5em; font-weight: 700; font-size: .85rem; line-height: 1.25; min-width: 0; } /* always 2 lines tall: tiles line up */
.set-name .sym { flex: none; margin: 1px 0 0; }
.set-name > span { min-width: 0; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.set-meta { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; text-align: center; }
.set-head .row { justify-content: center; }
.set-head .set-logo { width: 110px; height: 44px; }
.sym { height: 14px; width: auto; max-width: 22px; object-fit: contain; vertical-align: -2px; margin-right: 5px; }
h1 .sym { height: 22px; max-width: 32px; vertical-align: -3px; margin-right: 8px; }
.card-group .sym { height: 18px; max-width: 26px; }

/* on/off switch (admin: count or hide a set / series). Series: always visible; set tiles: on hover */
.switch {
  position: relative; width: 28px; height: 16px; flex: none; padding: 0; border: 0; border-radius: 9px; background: var(--border);
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.serie .switch, .set-tile:hover .switch, .set-tile:focus-within .switch { opacity: 1; }
@media (hover: none) { .switch { opacity: 1; } } /* phones/tablets: no hover, so always show */
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface);
  transition: transform .15s;
}
.switch[aria-checked="true"] { background: var(--gold); }
.switch[aria-checked="true"]::after { transform: translateX(12px); }
.set-tile .switch { position: absolute; top: 6px; right: 6px; }

/* ---------- home: card rows + sections that open below themselves ---------- */
.dash { margin-top: 22px; }
.dash-head { display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 1.05rem; }
.dash-head a { display: inline-flex; align-items: center; color: var(--text); }
.dash-head a:hover { color: var(--gold); text-decoration: none; }
/* a Home card row's title: the set tile in a line (logo, symbol + name, then "year · owned/total" beside it) */
.set-title { gap: 10px; min-width: 0; }
.set-title-logo { flex: none; display: inline-flex; align-items: center; height: 30px; max-width: 120px; }
.set-title-logo img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.set-title-logo .logo-text { font-size: .75rem; }
.set-title-name { display: inline-flex; align-items: center; min-width: 0; }
.unl-btn { height: 26px; font-size: .75rem; } /* a 1st Edition row's folded Unlimited version */
/* one row that never wraps: at most 8 fit across, the rest scroll sideways (snapping to whole tiles) */
.car-wrap { display: flex; align-items: center; justify-content: center; gap: 4px; }
.carousel { --w: calc(var(--tile, 156px) * .72); display: grid; grid-auto-flow: column; grid-auto-columns: var(--w); gap: 8px; width: fit-content; min-width: 0;
  max-width: min(100%, calc(8 * var(--w) + 7 * 8px + 8px)); padding: 4px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 4px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; } /* no scrollbar: ‹ ›, drag and swipe move the row */
.carousel > * { scroll-snap-align: start; }
.carousel.sets { --w: 112px; }
.carousel .set-tile { padding: 6px; }
.carousel .set-logo { height: 34px; }
.carousel .set-name { font-size: .72rem; }
.carousel .set-meta { font-size: .66rem; }
.car-btn { flex: none; font-size: 1.2rem; }
.car-wrap.fits .car-btn { visibility: hidden; }
@media (hover: none) { .car-btn { display: none; } } /* touch screens: swipe the row instead */
/* Home: slim pills "− Have 1 +": left half −1, right half +1 (the whole pill is the target) */
.mqs { display: grid; gap: 2px; margin-top: auto; padding-top: 1px; }
.mqr { --c: var(--have); display: grid; grid-template-columns: 1fr 12px; gap: 2px; align-items: center; }
.mqr.want { --c: var(--want); }
.mqr.trade { --c: var(--trade); }
.mq-x { all: unset; display: var(--on, block); font-size: .7rem; line-height: 1; text-align: center; color: var(--muted); cursor: pointer; }
.mq-line { all: unset; display: var(--off, none); height: 3px; border-radius: 2px; background: var(--c); opacity: .25; cursor: pointer; }
.mqr.nz .mq-line { opacity: 1; box-shadow: 0 0 5px var(--c); } /* hidden but not 0: the line glows in its color */
.mq-line:hover { opacity: .7; }
[data-hide~=have] .mqr.have, [data-hide~=want] .mqr.want, [data-hide~=trade] .mqr.trade { --on: none; --off: block; grid-template-columns: 1fr; } /* hidden: just the line */
.mq {
  position: relative; display: var(--on, grid); grid-template-columns: 1fr 1fr; height: 17px; border: 1px solid var(--c);
  border-radius: 9px; overflow: hidden; font-size: .66rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
}
.mq::before { content: ''; position: absolute; inset: 0; background: var(--c); opacity: 0; pointer-events: none; }
.nz > .mq::before { opacity: .18; } 
.mq button {
  all: unset; display: flex; align-items: center; padding: 0 6px; color: var(--text); cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mq .mq-up { justify-content: flex-end; }
.mq button:hover, .mq button:active { background: var(--surface-2); }
.mq button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.mq-l { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3px; pointer-events: none; color: var(--c); }
.mq-n { color: var(--muted); }
.nz > .mq .mq-n { color: var(--text); }
.mini-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cboxes { display: inline-flex; gap: 2px; }
.cbox { min-width: 15px; padding: 0 3px; border-radius: 3px; font-size: .62rem; line-height: 15px; text-align: center; color: #fff; }
.cbox.have { background: var(--have); }
.cbox.want { background: var(--want); }
.cbox.trade { background: var(--trade); }
.mini { display: flex; flex-direction: column; gap: 2px; padding: 6px; font-size: .78rem; color: var(--text); }
.mini-open { all: unset; display: grid; gap: 3px; width: 100%; cursor: pointer; }
.mini img { width: 100%; aspect-ratio: 245 / 342; object-fit: contain; border-radius: 4px; background: var(--surface-2); }
.mini-name { display: flex; align-items: center; gap: 4px; font-weight: 700; overflow: hidden; white-space: nowrap; }
.mini-name .sym, .mini-name .set-abbr { margin: 0; }
.mini-name .sym { height: 18px; max-width: 28px; }
.mini-name > .mini-open { display: block; width: auto; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Collection (binder checklist): set tiles left → right, cards down ---------- */
.binder { overflow: auto; max-height: 84vh; margin-top: 6px; padding: 4px; user-select: none; -webkit-user-select: none; }
.binder > .track { display: flex; align-items: flex-start; gap: 4px; width: max-content; zoom: var(--bz, 1); } /* Collection's own − / + */
.rail-wrap { margin-top: 6px; }
/* Collection: one slim bar (tools, then ‹ scrollbar ›), styled like the totals bar */
.toolbar.sheet-bar {
  flex-wrap: nowrap; gap: 6px; margin-top: 8px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.sheet-bar .btn { height: 28px; font-size: .85rem; }
.sheet-bar .zoom .btn { width: 28px; }
.sheet-bar .hrail { margin: 0; height: 10px; border-radius: 5px; background: var(--surface-2); scrollbar-width: thin; }
.sheet-bar .rail-wrap { flex: 1; min-width: 120px; margin: 0; }
.sheet-bar .hrail::-webkit-scrollbar { height: 8px; }
@media (max-width: 640px) { .toolbar.sheet-bar { flex-wrap: wrap; justify-content: center; } .sheet-bar .rail-wrap { flex-basis: 100%; } }
.rail-wrap .hrail { flex: 1; min-width: 0; margin: 0; }
.bcol { flex: 0 0 calc(var(--tile, 156px) * .64); min-width: 0; width: calc(var(--tile, 156px) * .64); display: flex; flex-direction: column; gap: 1px; }
.bcol > .set-tile { position: sticky; top: 0; z-index: 1; height: 124px; margin-bottom: 3px; padding: 5px; box-shadow: 0 -4px 0 4px var(--surface); }
.bcol .set-logo { height: 30px; }
.bcol .set-name { height: 2.4em; font-size: .68rem; }
.bcol .set-meta { font-size: .62rem; }
.bcell {
  all: unset; box-sizing: border-box; display: block; padding: 0 4px; border-radius: 3px; font-size: .6rem; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.bcell.have { background: var(--have); color: #04170b; font-weight: 600; }
.binder, .hrail { scrollbar-color: var(--muted) var(--surface-2); }
.binder { cursor: grab; }
.carousel { cursor: grab; }
.binder.dragging, .carousel.dragging, .dragging * { cursor: grabbing; }
.carousel.dragging { scroll-snap-type: none; } /* glide freely; it settles on a tile afterwards */
/* Home card rows that drift by themselves: the cards sit in one track that slides (a transform, on the graphics chip) */
.carousel.drift { display: block; scroll-snap-type: none; }
/* the card rows always lay out sideways, drifting or not */
.carousel.tracked { display: block; }
.carousel.tracked > .track { display: grid; grid-auto-flow: column; grid-auto-columns: var(--w); gap: 8px; width: max-content; }
.carousel.tracked > .track > * { scroll-snap-align: start; }
/* a drifting row keeps its own graphics layer, so it slides without being redrawn */
.carousel.drift > .track { will-change: transform; transform: translate3d(0, 0, 0); backface-visibility: hidden; }
/* Home: ⌄ under the rows = show more sets (they also come by themselves when you scroll down to it) */
.more-rows {
  display: block; margin: 10px auto 0; width: 44px; height: 30px; border: 1px solid var(--border); border-radius: 15px;
  background: var(--surface); cursor: pointer;
}
.more-rows:hover { background: var(--surface-2); }
.vee {
  display: block; width: 10px; height: 10px; margin: -4px auto 0; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.hrail { overflow-x: auto; overflow-y: hidden; margin-top: 6px; scrollbar-width: auto; }
.hrail > div { height: 1px; }
.hrail::-webkit-scrollbar { height: 14px; }
.hrail::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 7px; }
.bcell:hover, .bcell:focus-visible { outline: 1px solid var(--gold); outline-offset: -1px; }
.bcell.dim { opacity: .2; }
.bcol.off .bcell { opacity: .35; }

/* ---------- Backup ▾ menu (List) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; height: 32px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 36px; z-index: 5; display: grid; gap: 4px; min-width: 170px; padding: 6px; }

/* ---------- cards ---------- */
.card-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: 20px 0 8px; font-size: 1.05rem; }
.card-group .fold { font-size: inherit; }
.card-group .open-set { font-size: .78rem; font-weight: 600; }
.sheet td.symc { width: 30px; text-align: center; } .sheet td.symc .sym { height: 18px; max-width: 26px; margin: 0; }
.card-group .set-title-logo { height: 26px; max-width: 100px; margin-right: 6px; }
.set-abbr {
  flex: none; font-size: .58rem; font-weight: 800; line-height: 1.5; padding: 0 3px; border: 1px solid var(--border); border-radius: 4px;
  color: var(--muted); white-space: nowrap;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, var(--tile, 156px)); justify-content: center; gap: 8px; max-width: calc(16 * var(--tile, 156px) + 15 * 8px); margin: 0 auto; } /* at most 16 across */
/* the Cards tab and set pages use the whole window (the rest of the site stays 1280 px wide) */
[data-view="cards"] main, [data-view="set"] main, [data-view="sets"] main { max-width: none; }
/* card size: − / + in the toolbar of every page with cards; two-finger pinch on the cards does the same */
.zoom { display: inline-flex; }
.zoom .btn { width: 32px; font-size: 1.1rem; border-radius: 0; }
.zoom .btn:first-child { border-radius: 7px 0 0 7px; }
.zoom .btn:last-child { border-radius: 0 7px 7px 0; margin-left: -1px; }
.zoom .pct { width: auto; min-width: 50px; margin-left: -1px; font-size: .8rem; font-variant-numeric: tabular-nums; } /* Collection size, 100% = its start */
.card-grid, .minis, .binder { touch-action: pan-x pan-y; }
.sentinel { height: 1px; }
/* the two smallest card sizes ("compact") */
[data-tiles="compact"] .card-grid { gap: 6px; }
.card { content-visibility: auto; contain-intrinsic-size: auto 300px; }
.track .card { content-visibility: visible; } /* Home rows: a placeholder height would stretch the row */
.card.owned { border-color: var(--have); }
/* bulk edit: chosen cards get a gold frame (never anything over the picture) */
.card.picked { outline: 3px solid var(--gold); outline-offset: 1px; }
.bcell.picked { box-shadow: inset 0 0 0 2px var(--gold); }
.sheet tr.picked td { background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--gold); }
/* a 1st Edition set's cards: "1st" next to the set symbol */
.set-ed { display: inline-flex; align-items: center; gap: 2px; flex: none; font-size: .62rem; font-weight: 700; color: var(--gold); }
.card-img { padding: 0; border: 0; border-radius: 5px; background: var(--surface-2); cursor: pointer; aspect-ratio: 245 / 342; }
.card-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 5px; }
img.pending { opacity: 0; } /* an Unlimited card while its 1st Edition stamp is covered */
[data-counts="off"] .card .mqs { display: none; } /* Add / remove cards off: no pills */
.toolbar .btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.card-meta { display: flex; justify-content: space-between; gap: 4px; font-size: .72rem; color: var(--muted); }
.card-meta span:last-child { color: var(--text); font-weight: 600; }
.chips { display: flex; gap: 3px; margin-top: auto; }
.chip {
  flex: 1; text-align: center; font-size: .72rem; font-weight: 700; padding: 2px 4px; border-radius: 6px; background: var(--surface-2);
  color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip.nz.have { background: var(--have-soft); color: var(--have); }
.chip.nz.want { background: var(--want-soft); color: var(--want); }
.chip.nz.trade { background: var(--trade-soft); color: var(--trade); }
.steppers { display: grid; gap: 2px; margin-top: auto; }
.stepper { display: grid; grid-template-columns: 38px 24px minmax(0, 40px) 24px; justify-content: center; gap: 3px; align-items: center; } /* small number box, never stretched wide */
.stepper label { font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.stepper.have label { color: var(--have); }
.stepper.want label { color: var(--want); }
.stepper.trade label { color: var(--trade); }
.stepper button { height: 22px; padding: 0; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 800; }
.stepper.have button { background: var(--have-soft); color: var(--have); }
.stepper.want button { background: var(--want-soft); color: var(--want); }
.stepper.trade button { background: var(--trade-soft); color: var(--trade); }
.stepper button:hover { border-color: currentColor; }
input.qty { height: 22px; width: 100%; padding: 0 2px; text-align: center; font-weight: 700; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input.qty::-webkit-inner-spin-button, input.qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.qty.nz.have { background: var(--have-soft); border-color: var(--have); color: var(--have); }
input.qty.nz.want { background: var(--want-soft); border-color: var(--want); color: var(--want); }
input.qty.nz.trade { background: var(--trade-soft); border-color: var(--trade); color: var(--trade); }

/* ---------- tables ---------- */
.sheet-wrap { overflow: auto; max-height: 78vh; } /* scrolls inside, so the header row can stay visible */
.sheet { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { padding: 3px 6px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.sheet thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-size: .7rem; text-transform: uppercase; color: var(--muted); }
.sheet thead button { all: unset; cursor: pointer; }
.sheet [aria-sort="ascending"] button::after { content: " ▲"; }
.sheet [aria-sort="descending"] button::after { content: " ▼"; }
.sheet .r { text-align: right; }
.sheet td.q { width: 50px; padding: 2px 3px; }
/* tap a box: − / + float beside it, over the next cells, so the column never gets wider */
.qbox { position: relative; display: block; }
.qbox .step {
  position: absolute; top: 50%; z-index: 3; display: none; width: 22px; height: 22px; padding: 0; transform: translateY(-50%);
  border: 1px solid var(--gold); border-radius: 5px; background: var(--surface-2); line-height: 1; cursor: pointer;
}
.qbox .step:first-child { right: calc(100% + 2px); }
.qbox .step:last-child { left: calc(100% + 2px); }
.qbox:focus-within .step { display: block; }
.sheet tr > :first-child { padding-left: 28px; } /* room for the first column's − */
.sheet td.q input, .sheet td.q .chip { width: 46px; display: block; }
.sheet td.name button { all: unset; cursor: pointer; }
.sheet td.name button:hover { color: var(--gold); text-decoration: underline; }
.sheet td.name, .sheet td.setc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sheet tr.owned td.name { font-weight: 700; }
.sheet tbody tr:hover td { background: var(--surface-2); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 10px 0; }

/* ---------- dialogs + forms ---------- */
dialog { padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); width: min(860px, calc(100vw - 16px)); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); } /* dvh: the visible part of a phone screen */
dialog.small { width: min(340px, calc(100vw - 16px)); }
dialog:not([open]) { display: none; }
dialog.modal { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 30; overflow: auto; box-shadow: 0 0 0 100vmax rgba(8, 10, 14, .6); } /* browsers without <dialog> */
dialog::backdrop { background: rgba(8, 10, 14, .6); }
.dlg-close { position: absolute; top: 8px; right: 8px; }
.dlg { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; padding: 14px; }
.dlg-img { all: unset; display: block; align-self: start; cursor: zoom-in; border-radius: 8px; }
.dlg-img:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.dlg-img img { display: block; width: 100%; border-radius: 8px; }
/* card picture full screen: tap it to zoom in on that spot */
dialog.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0;
  background: rgba(8, 10, 14, .94);
}
dialog.viewer.modal { top: 0; left: 0; transform: none; }
.viewer-stage { display: grid; place-items: center; width: 100%; height: 100%; overflow: auto; }
.viewer-stage img { max-width: 96vw; max-height: 94vh; border-radius: 12px; cursor: zoom-in; }
.viewer-stage.zoomed { display: block; }
.viewer-stage.zoomed img { max-width: none; max-height: none; height: 220vh; display: block; margin: 0 auto; cursor: zoom-out; }
.viewer .dlg-close { position: fixed; z-index: 1; }
.dlg h2 { padding-right: 36px; }
.dlg .steppers, .dlg .chips { max-width: 280px; margin: 8px 0; }
.dlg .stepper { justify-content: start; }
.dlg-nav { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
/* card popup: "More details" (folded) */
.more { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.more summary { cursor: pointer; font-weight: 700; color: var(--gold); }
.gtext { margin: 8px 0; font-size: .85rem; }
.gtext p { margin: 2px 0 0; }
.flavor { font-style: italic; color: var(--muted); font-size: .85rem; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; font-size: .85rem; }
dt { color: var(--muted); }
dd { margin: 0; }
.prices { width: 100%; border-collapse: collapse; font-size: .8rem; }
.prices th, .prices td { padding: 3px 4px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.prices th:first-child, .prices td:first-child { text-align: left; white-space: normal; }
.prices thead th { color: var(--muted); font-size: .7rem; }
.prices tr.sel td { background: var(--surface-2); }
.prices input { height: auto; margin: 0 4px 0 0; vertical-align: middle; }
.form { display: grid; gap: 8px; padding: 14px; }
.form h2 { padding-right: 36px; }
.field-row { display: grid; gap: 2px; }
.field-row label { font-size: .75rem; font-weight: 700; color: var(--muted); }
input.otp { letter-spacing: .25em; }
.form .form { padding: 0; } /* the sign-in forms inside the account box */
.form .sign-in { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); } /* Guest panel: the sign-in part */
.sign-in-off { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; opacity: .5; } /* sign-in switched off: shown, greyed out */
.sign-in-off :disabled { opacity: 1; }

/* ---------- profile + admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { display: grid; gap: 2px; padding: 8px 10px; font-size: .75rem; text-align: center; }
.stat b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover, a.stat:focus-visible { border-color: var(--gold); }
.sheet .link { all: unset; cursor: pointer; text-decoration: underline; }
.sheet .link:hover, .sheet .link:focus-visible { color: var(--gold); }
.profile-form { max-width: 560px; margin: 0 auto; }
.share { display: grid; justify-items: center; gap: 6px; margin: 6px auto 14px; max-width: 620px; }
.people { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.person { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; align-items: center; padding: 8px 10px; color: inherit; text-decoration: none; }
.person .avatar, .trader .avatar { width: 40px; height: 40px; font-size: 1.1rem; grid-row: span 2; }
.trader { justify-content: center; padding: 0; margin-bottom: 8px; }
.trade-list { display: grid; padding: 4px; }
.trade-row {
  all: unset; display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 6px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: .85rem;
}
.trade-row:last-child { border-bottom: 0; }
.trade-row:hover, .trade-row:focus-visible { background: var(--surface-2); }
.trade-row img { width: 36px; border-radius: 3px; }
.console-out {
  min-height: 240px; max-height: 60vh; max-height: 60dvh; overflow: auto; margin: 0; padding: 10px;
  font: .78rem/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.console-form { padding: 8px 0 0; grid-template-columns: 1fr auto; align-items: center; }
.console-form .row { margin: 0; }
.console-in { font: 16px ui-monospace, Menlo, Consolas, monospace; } /* 16 px: phones don't zoom in on it */
.profile-card { display: grid; gap: 8px; }
.as-bar {
  position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 12px; background: var(--gold); color: #111; font-weight: 600;
}
.as-bar[hidden] { display: none; }
.stats.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 4px 0; }
.stats.mini .stat { padding: 6px 4px; min-width: 0; justify-items: center; }
.stats.mini .stat:last-child { grid-column: 1 / -1; } /* Value: the whole last row */
.stats.mini .stat b { max-width: 100%; white-space: nowrap; overflow: hidden; } /* shrunk to fit by fitText() when too long */
.avatar-btn { all: unset; position: relative; flex: none; border-radius: 50%; cursor: pointer; }
.avatar-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.avatar-edit {
  position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold); color: #111; font-size: .7rem;
}
.pic-row { align-items: center; gap: 12px; }
.profile-top { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); color: var(--gold); font-size: 1.5rem; font-weight: 700;
}
/* the account box (Guest panel, sign-in, your profile) is centered; tables inside stay left-aligned */
#acctDlg .form, #acctDlg .field-row { text-align: center; }
#acctDlg .row, #acctDlg .check, #acctDlg .profile-top { justify-content: center; }
#acctDlg .profile-top { padding: 0 36px; text-align: left; }
#acctDlg .form h2 { padding: 0 36px; } /* room for ✕ on both sides, so the title sits in the middle */
.btn.google {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: #1f1f1f; border-color: #dadce0;
  font-weight: 600;
}
.btn.google img { width: 18px; height: 18px; }
.email-form { grid-template-columns: 1fr auto; align-items: end; column-gap: 8px; }
.email-form .error { grid-column: 1 / -1; }
.email-form .row { margin: 0; }
.btn.google + .email-form { padding-top: 10px; border-top: 1px solid var(--border); }
.delete-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.legal { font-size: .75rem; }
.guest-backup { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.account-foot { justify-content: space-between; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); } /* Log out at the bottom right */
.admin-sec { margin-top: 18px; }
.admin-sec > h2 { margin-bottom: 8px; text-align: center; }
.days { display: grid; gap: 4px; padding: 10px 12px; }
.day { display: grid; grid-template-columns: 44px 1fr 170px; gap: 10px; align-items: center; font-size: .78rem; font-variant-numeric: tabular-nums; }
.day .bar { height: 8px; }
.tops { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tops h3 { margin: 0 0 4px; text-align: center; }
main > .row, .admin-sec .row { justify-content: center; margin-top: 10px; }
.sheet-wrap .sheet td { overflow-wrap: anywhere; }
.sheet tr.below > td { background: var(--surface-2); padding: 8px; } /* a visitor's pages, opened under their row */
.trail + .trail { margin-top: 10px; }
.trail .sheet-wrap { max-height: none; }
.diag { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.diag li { display: grid; grid-template-columns: 52px 1fr; gap: 2px 10px; padding: 8px 10px; }
.diag small { grid-column: 2; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.st { font-size: .7rem; text-align: center; border-radius: 5px; padding: 2px 0; background: var(--surface-2); color: var(--muted); }
.st.pass { background: var(--have-soft); color: var(--have); }
.st.warn { color: var(--warn); }
.st.fail { color: var(--bad); }
pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow: auto; font-size: .75rem; }

/* ---------- about / terms / privacy ---------- */
.legal { max-width: 720px; margin: 0 auto; line-height: 1.55; }
.legal h1, .legal > .muted:first-of-type { text-align: center; }
.legal .lead { font-size: 1rem; }
.legal h2 { font-size: 1rem; margin: 18px 0 4px; }
.contact { display: grid; gap: 8px; }
.contact label { display: grid; gap: 2px; font-size: .8rem; font-weight: 700; }
.contact label .muted { font-weight: 400; }
.contact .hp, .sign-in .hp { position: absolute; left: -9999px; } /* the robot traps: people never see them */

/* ---------- simple version (<div id="simple" hidden>): never shown where the app runs; see js/fallback.js ---------- */
.links { list-style: none; max-width: 960px; margin: 8px auto 0; padding: 0; columns: 3 240px; column-gap: 24px; }
.links li { padding: 3px 0; break-inside: avoid; }
.card > picture img { display: block; width: 100%; height: auto; border-radius: 5px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: flex; gap: 10px; align-items: center;
  max-width: calc(100vw - 24px); padding: 8px 12px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: .85rem;
}
.has-bulk .toast { bottom: calc(24px + var(--bulk-h, 44px)); }
.bulk-bar {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 19; display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center; gap: 6px; width: max-content; max-width: calc(100vw - 16px); padding: 6px 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3); font-size: .85rem;
}
.bulk-bar .btn.have { color: var(--have); }
.bulk-bar .btn.want { color: var(--want); }
.bulk-bar .btn.trade { color: var(--trade); }
.has-bulk main { padding-bottom: 90px; }
/* copy / print list */
.list-text { max-height: 60vh; margin: 0; white-space: pre-wrap; font-size: .8rem; line-height: 1.5; }
@media print {
  .printing body > :not(#cardDlg), .printing #cardDlg .dlg-close, .printing .list-tools { display: none !important; }
  .printing #cardDlg { position: static; display: block; width: auto; max-height: none; border: 0; background: #fff; color: #000; }
  .printing .list-text { max-height: none; overflow: visible; background: none; color: #000; }
}
.toast button { background: none; border: 1px solid currentColor; color: inherit; border-radius: 6px; padding: 2px 8px; cursor: pointer; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) { .srange { display: none; } } /* Min–High range: wide screens only (always in the tooltip) */
@media (max-width: 640px) {
  .top { grid-template-areas: ". brand acct" "nav nav nav"; padding-top: 8px; }
  .brand { justify-self: center; }
  .brand img { height: 20px; } /* the long wordmark leaves room for the account button, so it stays centered */
  .top nav { gap: 0; }
  .top nav a { padding: 5px 6px; font-size: .8rem; }
  .dlg { grid-template-columns: 1fr; }
  .dlg-img { max-width: 240px; margin: 0 auto; }
  /* the card popup is a sheet from the bottom: swipe it down, tap above it or ✕ to close; only its inside scrolls */
  #cardDlg, #acctDlg { width: 100%; max-width: none; max-height: 88vh; max-height: 88dvh; margin: auto 0 0; border: 0; border-radius: 16px 16px 0 0; }
  #cardDlg[open], #acctDlg[open] { display: flex; flex-direction: column; overflow: hidden; }
  #acctDlg > .form { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  #cardDlg[open]::before, #acctDlg[open]::before { content: ''; flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--border); } /* grab handle */
  #cardDlg > .dlg, #cardDlg > .form { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .prices { display: block; overflow-x: auto; } /* the price table scrolls sideways instead of running off the screen */
  .carousel.minis { --w: calc(var(--tile, 156px) * .9); } /* Home card rows: bigger cards on phones (− / + still resize them) */
  .card-grid, .set-grid { gap: 6px; }
  .set-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } /* Collection: 3 set tiles across, filling the width */
  .set-tile { padding: 6px; }
  .set-name { font-size: .72rem; }
  .set-meta { font-size: .66rem; }
  .set-logo { height: 40px; }
  .set-title-logo { height: 24px; max-width: 90px; }
  .dash-head { flex-wrap: wrap; gap: 4px 8px; font-size: .95rem; }
  .stats-in { padding: 4px 2px; }
  .scell { gap: 0 4px; padding: 0 3px; line-height: 1.25; }
  .slabel { flex-basis: 100%; text-align: center; }
  .snum { font-size: .82rem; }
  .sval { font-size: .7rem; }
  .savg, .scell.owned .sval { display: none; }
  .filter-panel { justify-content: stretch; }
  .filter-panel .ctl { flex: 1 1 140px; }
  .day { grid-template-columns: 40px 1fr; }
  .day span:last-child { grid-column: 2; }
}
/* touch screens: the same thin look, but bigger targets for a finger */
@media (pointer: coarse) {
  .mq { height: 24px; border-radius: 12px; }
  .mqr { grid-template-columns: 1fr 22px; gap: 1px; }
  .mq-x { display: var(--on, flex); align-items: center; justify-content: center; align-self: stretch; font-size: .85rem; }
  .mq-line { height: 6px; }
  .sheet thead button { padding: 8px 0; }
  input.qty { height: 30px; }
  .top nav a { padding: 9px 10px; }
}
