/* TCG Stockpile styles · Shannon Cain */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --binder: #1b1736;
  --binder-deep: #120f24;
  --holo: linear-gradient(115deg, #5ef0ff 0%, #a77bff 48%, #ffb84d 100%);
  --binder-ink: #f3f5fa;
  --page: #eef1f6;
  --sheet: #e6eaf2;
  --pocket: #ffffff;
  --pocket-empty: #dde3ed;
  --ink: #182033;
  --ink-2: #4a5470;
  --ink-3: #78829c;
  --line: #d0d7e3;
  --have: #13917f;
  --have-soft: #d4f1ec;
  --warn: #a8650a;
  --warn-soft: #fbecd2;
  --bad: #b8323d;
  --bad-soft: #f8dcde;
  --focus: #6a4cff;
  --radius-pocket: 7px;
  --radius-panel: 14px;
  --tabs-h: 64px;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #11152a;
    --sheet: #171c33;
    --pocket: #1e2440;
    --pocket-empty: #151a30;
    --ink: #e8ebf4;
    --ink-2: #b2b9cf;
    --ink-3: #7c859f;
    --line: #2b3253;
    --have: #3cc7b2;
    --have-soft: #123a37;
    --warn: #f0a83a;
    --warn-soft: #3a2a10;
    --bad: #ff7a83;
    --bad-soft: #3d1b20;
    --focus: #8ea9ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-stretch: 100%;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--pocket); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- binder spine (top bar) */
.spine {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--binder);
  color: var(--binder-ink);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.06);
}
.spine-mark { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.spine-mark span { font-weight: 780; font-stretch: 118%; font-size: 17px; letter-spacing: -.01em; }
.spine-search { flex: 1; min-width: 0; }
.spine-search input {
  width: 100%; height: 40px; border-radius: 10px; border: 0; padding: 0 12px;
  background: rgba(255,255,255,.12); color: var(--binder-ink);
  font-size: 16px;
}
.spine-search input::placeholder { color: rgba(243,245,250,.62); }
@media (max-width: 420px) { .spine-mark span { display: none; } }

/* ---------- tabs: bottom bar on phones, rail on desktop */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--binder-deep);
  color: rgba(243,245,250,.66);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 11.5px; font-weight: 560; min-height: 44px;
}
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: #fff; }
.tabs a[aria-current="page"] span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tabs .tab-scan svg { width: 46px; height: 46px; padding: 10px; margin-top: -22px; border-radius: 50%;
  background: var(--have); color: #fff; box-shadow: 0 0 0 5px var(--binder-deep); stroke-width: 2; }
.tabs .tab-wide { display: none; }

@media (min-width: 960px) {
  body { padding-bottom: 40px; padding-left: 216px; }
  .spine { padding-left: 24px; }
  .tabs {
    top: 0; right: auto; width: 216px; height: 100dvh; padding: 84px 12px 24px;
    grid-template-columns: 1fr; grid-auto-rows: 48px; align-content: start; gap: 2px;
  }
  .spine { position: sticky; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 15px; }
  .tabs a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .tabs a[aria-current="page"] { background: rgba(255,255,255,.1); }
  .tabs a[aria-current="page"] span { text-decoration: none; }
  .tabs .tab-scan svg { width: 24px; height: 24px; padding: 0; margin: 0; background: none; box-shadow: none; color: var(--have); }
  .tabs .tab-wide { display: flex; }
  .spine-mark { position: fixed; left: 24px; top: 20px; z-index: 31; }
}

/* ---------- page layout */
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 0; outline: none; }
@media (min-width: 960px) { main { padding: 32px 32px 0; } }
.page-head { margin: 4px 0 18px; }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -.012em; }
h1 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; font-stretch: 116%; }
h2 { font-size: 21px; font-weight: 760; font-stretch: 112%; }
h3 { font-size: 17px; font-weight: 700; font-stretch: 106%; }
.lede { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }
.muted { color: var(--ink-3); }
.num { font-stretch: 72%; font-variant-numeric: tabular-nums; }
section + section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a { font-size: 14.5px; color: var(--ink-2); }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--pocket); font-weight: 650; font-size: 15.5px; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--binder); border-color: var(--binder); color: var(--binder-ink); }
@media (prefers-color-scheme: dark) { .btn.primary { background: #3a4580; border-color: #3a4580; } }
.btn.go { background: var(--have); border-color: var(--have); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--pocket); font-size: 16px;
}
textarea.input { min-height: 84px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .field { min-width: 0; }
@media (max-width: 520px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.toolbar .input { flex: 1 1 220px; }
.toolbar select.input { flex: 0 1 200px; }

.panel { background: var(--pocket); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--sheet); color: var(--ink-2); font-size: 14.5px; }
.note.warn { background: var(--warn-soft); color: var(--ink); }
.note.bad { background: var(--bad-soft); color: var(--ink); }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; background: var(--sheet); color: var(--ink-2); white-space: nowrap; }
.badge.have { background: var(--have-soft); color: var(--have); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- binder pages: the card grid */
.binder {
  display: grid; gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px; border-radius: var(--radius-panel);
  background: var(--sheet);
}
@media (min-width: 640px) { .binder { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px; } }
@media (min-width: 900px) { .binder { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.pocket {
  position: relative; display: block; aspect-ratio: 63 / 88; border-radius: var(--radius-pocket);
  text-decoration: none; overflow: hidden; background: var(--pocket);
  box-shadow: 0 0 0 1px var(--line);
}
.pocket img { width: 100%; height: 100%; object-fit: cover; }
.pocket.have::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(168deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,0) 26%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.pocket.need { background: var(--pocket-empty); box-shadow: inset 0 2px 6px rgba(10,16,40,.14), 0 0 0 1px var(--line); }
.pocket.need img { opacity: .2; filter: grayscale(1) contrast(.8); }
.pocket .ghost {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 8px; gap: 2px;
}
.pocket .ghost b { font-size: clamp(20px, 5.4vw, 30px); font-weight: 820; font-stretch: 70%; line-height: 1; color: var(--ink-2); }
.pocket .ghost small { font-size: 11.5px; line-height: 1.2; color: var(--ink-2); font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pocket .qty {
  position: absolute; right: 6px; top: 6px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--binder); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center;
  font-stretch: 80%; font-variant-numeric: tabular-nums;
}
.pocket-caption { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.binder-group { margin-top: 22px; }
.binder-group h3 { margin: 0 0 10px; }

/* ---------- progress */
.progress { display: grid; gap: 6px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--pocket-empty); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--have); border-radius: inherit; }
.progress-text { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--ink-2); }

/* ---------- lists */
.rows { display: grid; gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: var(--pocket); text-decoration: none; min-height: 60px;
}
.row:hover { background: var(--sheet); }
.row .thumb { width: 42px; aspect-ratio: 63/88; border-radius: 4px; object-fit: cover; background: var(--pocket-empty); }
.row .sym { width: 30px; height: 30px; object-fit: contain; }
.row .title { font-weight: 650; line-height: 1.25; }
.row .sub { font-size: 13.5px; color: var(--ink-3); line-height: 1.3; }
.row .end { text-align: right; font-size: 14px; color: var(--ink-2); }
.row .dex { font-stretch: 70%; font-weight: 780; font-size: 20px; color: var(--ink-3); width: 46px; font-variant-numeric: tabular-nums; }
.series-head { margin: 26px 0 8px; font-size: 15px; color: var(--ink-3); font-weight: 650; }

.star { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink-3); }
.star svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.star[aria-pressed="true"] { color: var(--warn); }
.star[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- home */
.hero { padding: 6px 0 4px; }
.hero h1 { font-size: clamp(34px, 10vw, 64px); font-stretch: 122%; font-weight: 820; line-height: 1; }
.hero h1 .count { font-stretch: 68%; font-variant-numeric: tabular-nums; }
.hero p { font-size: 17px; color: var(--ink-2); margin: 10px 0 0; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); gap: 10px; overflow-x: auto;
  padding-bottom: 6px; scroll-snap-type: x mandatory; }
.scroller > * { scroll-snap-align: start; }
@media (min-width: 900px) { .scroller { grid-auto-flow: row; grid-template-columns: repeat(6, 1fr); overflow: visible; } }
.chase { display: grid; gap: 10px; }
@media (min-width: 760px) { .chase { grid-template-columns: 1fr 1fr; } }
.chase-item { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; text-decoration: none; }
.chase-item img { width: 52px; height: 52px; object-fit: contain; }

/* ---------- slab label (estimates) */
.slab {
  display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 0;
  border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--pocket);
}
.slab .slab-text { padding: 10px 14px; display: grid; gap: 2px; align-content: center; }
.slab .slab-text b { font-size: 15.5px; line-height: 1.2; }
.slab .slab-text span { font-size: 13px; color: var(--ink-2); }
.slab .slab-grade {
  display: grid; place-items: center; padding: 6px 16px; min-width: 86px; background: var(--ink); color: var(--page);
  text-align: center;
}
.slab .slab-grade strong { font-size: 40px; line-height: 1; font-weight: 840; font-stretch: 70%; font-variant-numeric: tabular-nums; }
.slab .slab-grade small { font-size: 11.5px; font-weight: 650; opacity: .8; }
.slab.mini .slab-grade strong { font-size: 26px; }
.slab.mini .slab-grade { min-width: 58px; }
.slab.mini .slab-text { padding: 8px 10px; }
.slab.pending .slab-grade { background: var(--ink-3); }

/* ---------- card page */
.card-hero { display: grid; gap: 22px; }
@media (min-width: 760px) { .card-hero { grid-template-columns: minmax(240px, 340px) 1fr; align-items: start; } }
.card-art { border-radius: 14px; overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 14px 32px -16px rgba(10,16,40,.5); aspect-ratio: 63/88; background: var(--pocket-empty); }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 15px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.copy { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.copy img { width: 54px; border-radius: 5px; }

/* ---------- scan: capture steps */
.steps { display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.shot { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: var(--radius-panel); background: var(--pocket); border: 1.5px solid var(--line); }
.shot.done { border-color: var(--have); }
.shot-head { display: flex; gap: 10px; align-items: baseline; }
.shot-head::before {
  counter-increment: step; content: counter(step);
  font-stretch: 70%; font-weight: 820; font-size: 28px; line-height: 1; color: var(--ink-3);
}
.shot.optional .shot-head::before { content: "+"; }
.shot p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.shot-preview { aspect-ratio: 4/3; border-radius: 10px; background: var(--sheet); overflow: hidden; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.shot-preview img { width: 100%; height: 100%; object-fit: contain; }
.shot input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-bar { height: 6px; border-radius: 999px; background: var(--pocket-empty); overflow: hidden; margin-top: 10px; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--have); transition: width .2s; }

/* ---------- scan: report */
.report { display: grid; gap: 16px; }
@media (min-width: 980px) { .report { grid-template-columns: 1.1fr 1fr; align-items: start; } .report .span { grid-column: 1 / -1; } }
.cats { display: grid; gap: 10px; }
.cat { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat:last-child { border-bottom: 0; }
.cat b { font-weight: 680; }
.cat .score { font-stretch: 70%; font-weight: 820; font-size: 24px; font-variant-numeric: tabular-nums; }
.cat p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.cat.limit .score { color: var(--bad); }
.defects { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.defects li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 14.5px; }
.corner-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.corner-grid figure { margin: 0; }
.corner-grid img { border-radius: 6px; width: 100%; aspect-ratio: 1; object-fit: cover; }
.corner-grid figcaption { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- centering editor */
.center-edit { display: grid; gap: 12px; }
@media (min-width: 640px) { .center-edit { grid-template-columns: minmax(0, 1fr) 200px; } }
.ce-stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 10px; overflow: hidden; background: #000; }
.ce-stage img { width: 100%; pointer-events: none; }
.ce-line { position: absolute; background: var(--have); opacity: .9; }
.ce-line.v { top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.ce-line.h { left: 0; right: 0; height: 2px; margin-top: -1px; }
.ce-line.sel { background: #ff4fa3; }
.ce-hit { position: absolute; }
.ce-hit.v { top: 0; bottom: 0; width: 36px; margin-left: -18px; cursor: ew-resize; }
.ce-hit.h { left: 0; right: 0; height: 36px; margin-top: -18px; cursor: ns-resize; }
.ce-side { display: grid; gap: 10px; align-content: start; }
.ce-loupe { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #000; display: block; }
@media (max-width: 639px) {
  .ce-side { grid-template-columns: 132px 1fr; column-gap: 14px; align-items: start; }
  .ce-loupe { grid-row: span 3; }
  .ce-side > .nudge, .ce-side > .badge, .ce-side > .btn-row { grid-column: 1 / -1; }
  .ce-side > .badge { justify-self: start; }
}
.ce-read { font-size: 15px; display: grid; gap: 4px; }
.ce-read .num { font-size: 22px; font-weight: 780; }
.nudge { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- login */
.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 16px; }

/* ---------- misc */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%);
  background: var(--ink); color: var(--page); padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; pointer-events: auto; }
@media (min-width: 960px) { .toast { bottom: 24px; left: calc(50% + 108px); } }
.empty { padding: 28px 18px; text-align: center; border-radius: var(--radius-panel); border: 1.5px dashed var(--line); color: var(--ink-2); }
.empty .btn { margin-top: 12px; }
.loading { padding: 40px 0; text-align: center; color: var(--ink-3); }
.more { display: flex; justify-content: center; margin-top: 16px; }
details.panel summary { cursor: pointer; font-weight: 680; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* Scan: choose between filing and grading */
.choices { display: grid; gap: 12px; }
@media (min-width: 760px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: start; padding: 18px; text-decoration: none;
  background: var(--pocket); border: 1.5px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); }
.choice:hover { border-color: var(--ink-3); }
.choice b { display: block; font-size: 19px; font-weight: 760; margin-bottom: 4px; }
.choice span span { color: var(--ink-2); font-size: 15px; line-height: 1.4; }
.choice-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--have); color: #fff; }
.choice:last-child .choice-icon { background: var(--binder); }
.choice-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

/* Add by photo */
.add-grid { display: grid; gap: 14px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .add-grid { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); } }
.add-capture { display: grid; gap: 12px; }
.add-photo { aspect-ratio: 4/3; border-radius: 10px; background: var(--sheet); overflow: hidden; display: grid; place-items: center;
  color: var(--ink-3); font-size: 14px; text-align: center; padding: 0 18px; }
.add-photo img { width: 100%; height: 100%; object-fit: contain; }
.add-capture .btn-row .btn { flex: 1 1 140px; }
.file-btn { position: relative; }
.file-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.add-status { margin: 0; font-size: 14.5px; min-height: 1.4em; }
.add-chosen { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; margin-bottom: 18px; }
.add-chosen img { width: 112px; aspect-ratio: 63/88; object-fit: cover; border-radius: 7px; box-shadow: 0 6px 18px -8px rgba(10,16,40,.5); }
.add-chosen h2 { font-size: 22px; line-height: 1.15; }
.pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; }
@media (min-width: 640px) { .pick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Quick add shows finish, quantity and condition; "More details" opens the full form in its usual layout. */
.quick:not(.full) .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.quick:not(.full) .form-grid > .field:first-child { grid-column: 1 / -1; }
.quick:not(.full) .form-grid > .field:nth-child(n+4) { display: none; }
details.others { margin-top: 16px; }
details.others summary { cursor: pointer; font-weight: 650; color: var(--ink-2); }
.spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line);
  border-top-color: var(--have); vertical-align: -2px; margin-right: 6px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Languages, prints and value */
.pocket { position: relative; }
.lang-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 5px; font-size: 11px;
  font-weight: 750; letter-spacing: .03em; background: var(--binder); color: var(--binder-ink); vertical-align: 2px; }
.pocket .lang-tag { position: absolute; top: 5px; left: 5px; }
.no-photo { display: grid; place-items: center; height: 100%; font-size: 12px; color: var(--ink-3); text-align: center; padding: 6px; }
.variants { margin-top: 18px; }
.variants h3 { margin: 0 0 8px; }
.variants .row { grid-template-columns: 0 1fr auto; }
.lang-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin-top: 12px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--have); flex: none; }

/* Bulk import */
.import-drop .btn-row .btn { flex: 1 1 180px; }
.big-pick { width: 100%; min-height: 60px; font-size: 18px; }
.upload-total { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--have-soft); color: var(--ink); font-size: 14.5px; }
.tips { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.quick-switch { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--sheet); font-size: 14.5px; }
.quick-on .binder .pocket { cursor: copy; }
.quick-on .binder .pocket.need { box-shadow: inset 0 0 0 2px var(--have); }
.upload-list { display: grid; gap: 8px; margin-top: 12px; }
.upload-item .sub { font-size: 14px; color: var(--ink-2); word-break: break-word; }
.import-kind { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--sheet); color: var(--ink-2); }
.import-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .import-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.import-item { min-width: 0; }
.import-item-head { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: start; }
.import-item-head .title { font-weight: 680; }
.import-item-head .sub { font-size: 13.5px; color: var(--ink-2); }
.import-crop { width: 76px; aspect-ratio: 63/88; object-fit: cover; border-radius: 6px; background: var(--sheet); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Collecting by Pokémon */
.family { margin: 0 0 16px; }
.family-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
@media (min-width: 760px) { .family-strip { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
.family-member { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 10px; border-radius: 12px; text-decoration: none;
  background: var(--pocket); border: 1.5px solid var(--line); color: var(--ink); font-size: 14px; }
.family-member.current { border-color: var(--have); }
.family-member img, .family-member .no-photo { width: 64px; aspect-ratio: 63/88; object-fit: cover; border-radius: 5px; }
.family-member .num { color: var(--ink-3); font-size: 13px; }
.new-tag { position: absolute; top: 5px; right: 5px; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 750;
  background: var(--warn); color: #fff; display: inline-flex; align-items: center; }

.buy-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.buy-links a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--pocket); color: var(--ink); text-decoration: none; font-weight: 600; }
.buy-links a:hover { border-color: var(--ink-3); }
.buy-links.compact { margin-top: 4px; gap: 4px; }
.buy-links.compact a { min-height: 28px; padding: 0 7px; font-size: 12px; }

.ordered-tag { position: absolute; top: 5px; right: 5px; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 750;
  background: var(--have); color: #fff; display: inline-flex; align-items: center; }
.ordered-note { margin: 0 0 12px; }
.warn-text { color: var(--warn); font-weight: 650; }
.row.order .thumb { display: block; }
.order-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

/* ---------------------------------------------------------------- accounts and plans */
body.signed-out .tabs, body.signed-out .spine-search, body.signed-out .plan-pill { display: none; }
body.signed-out .spine { display: none; }
.auth { min-height: calc(100dvh - 48px); display: grid; place-content: center; gap: 18px; padding: 24px 16px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; justify-self: center; color: var(--ink); text-decoration: none;
  font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.auth .login { width: min(420px, calc(100vw - 32px)); display: grid; gap: 14px; margin: 0; }
.auth .login h1 { margin: 0; font-size: 28px; }
.auth .login .lede { margin: -6px 0 2px; }
.auth .field small { display: block; margin-top: 4px; font-size: 13px; }
.auth-links { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.fine { font-size: 13px; margin: 0; }
.form-msg { margin: 0; min-height: 1.2em; color: var(--bad); font-size: 14.5px; }
.form-msg.ok { color: var(--have); }
.plan-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,.1); color: var(--binder-ink); text-decoration: none; font-size: 13px; font-weight: 650; white-space: nowrap; }
.plan-pill b { font-weight: 800; }
.plan-pill.full { background: var(--warn); color: #fff; }
.toast-action { color: inherit; font-weight: 800; margin-left: 6px; text-decoration: underline; }
.account-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); }
.account-link h2 { margin: 0 0 2px; }
.account-link span { font-size: 26px; color: var(--ink-3); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-top: 12px; }
.meter { padding: 12px 14px; border-radius: 12px; background: var(--sheet); display: grid; gap: 4px; }
.meter > span { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.meter b { font-size: 24px; font-weight: 820; }
.meter b small, .meter > small { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.meter .bar { height: 6px; border-radius: 99px; background: var(--pocket-empty); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--holo); border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.meter.full .bar i { background: var(--warn); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; margin-bottom: 12px; }
.plan { position: relative; padding: 20px; border-radius: var(--radius-panel); background: var(--pocket); border: 1px solid var(--line);
  display: grid; gap: 8px; align-content: start; }
.plan.current { border-color: transparent; background: linear-gradient(var(--pocket), var(--pocket)) padding-box, var(--holo) border-box;
  border: 2px solid transparent; }
.plan h3 { margin: 0; font-size: 20px; }
.plan .price { margin: 0; }
.plan .price b { font-size: 34px; font-weight: 850; letter-spacing: -.02em; }
.plan .price span { color: var(--ink-3); font-weight: 600; }
.plan p { margin: 0; }
.plan ul { margin: 4px 0 8px; padding-left: 18px; color: var(--ink-2); font-size: 14.5px; }
.plan .btn, .plan .badge { justify-self: start; }
.danger-zone { border: 1px solid var(--bad-soft); }
.form-grid .btn-row.wide { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- favorites and groups */
.fav { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-3); flex: none; }
.fav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; transition: transform .25s cubic-bezier(.2,.8,.2,1), fill .2s; }
.fav[aria-pressed="true"] { color: #ff4f7b; }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.fav.pop svg { animation: fav-pop .45s cubic-bezier(.2,.8,.2,1); }
@keyframes fav-pop { 40% { transform: scale(1.35); } }
.fav:hover { background: var(--sheet); }
.end-pair { display: flex; align-items: center; gap: 2px; }
.fav-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 130px); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.fav-card { scroll-snap-align: start; display: grid; gap: 4px; text-decoration: none; color: var(--ink); padding: 10px; border-radius: 14px; background: var(--pocket); border: 1px solid var(--line); }
.fav-card img, .fav-card .no-photo { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 6px; }
.fav-card b { font-size: 14.5px; line-height: 1.2; }
.fav-card span { font-size: 12.5px; color: var(--ink-3); }
.add-chip { border-style: dashed !important; }
.new-group { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.crumb { margin: 0 0 4px; font-size: 14.5px; font-weight: 650; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.g-card { display: grid; gap: 4px; align-content: start; }
.g-remove { width: 100%; }
.pick { position: relative; padding: 0; border: 2px solid transparent; border-radius: var(--radius-pocket); background: var(--pocket-empty); cursor: pointer; aspect-ratio: 63/88; overflow: hidden; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick .lang-tag { position: absolute; top: 5px; left: 5px; }
.pick-cap { position: absolute; inset: auto 0 0; padding: 14px 6px 5px; font-size: 11px; font-weight: 650; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); text-align: left; }
.pick.on { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.pick.on::after { content: "✓"; position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%; background: var(--focus); color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 14px; }
.pick.in { opacity: .45; cursor: default; }
.pick-in { position: absolute; top: 5px; right: 5px; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--have); color: #fff; }
.adder-actions { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); margin-top: 12px; padding: 10px; border-radius: 14px; background: color-mix(in srgb, var(--pocket) 92%, transparent); backdrop-filter: blur(8px); }
@media (min-width: 960px) { .adder-actions { bottom: 12px; } }
#g-results:empty { display: none; }

/* ---------------------------------------------------------------- shop inventory and sales */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; margin-bottom: 16px; }
.tile-stat { padding: 14px 16px; border-radius: 14px; background: var(--pocket); border: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.tile-stat span { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.tile-stat b { font-size: clamp(20px, 5vw, 26px); font-weight: 830; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile-stat small { font-size: 12.5px; color: var(--ink-3); }
.neg { color: var(--bad) !important; }
.pos { color: var(--have) !important; }
.inv-row { grid-template-columns: auto 42px minmax(0, 1fr) auto; }
.inv-row:not(:has(.inv-check)) { grid-template-columns: 42px minmax(0, 1fr) auto; }
.inv-row.sel { background: color-mix(in srgb, var(--focus) 8%, var(--pocket)); }
.inv-check { width: 22px; height: 22px; accent-color: var(--focus); }
.inv-price { display: grid; justify-items: end; gap: 2px; text-align: right; }
.inv-price b { font-size: 18px; }
.inv-price small { font-size: 12.5px; color: var(--ink-3); }
.inv-actions { display: flex; gap: 6px; margin-top: 6px; }
.loc { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--sheet); font-weight: 650; font-size: 12.5px; margin-right: 4px; }
.row .badge { margin-left: 4px; height: 20px; font-size: 11.5px; }
.bulk-bar { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); z-index: 15; margin-top: 12px; padding: 12px; border-radius: 16px;
  background: var(--ink); color: var(--page); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; box-shadow: 0 16px 40px -16px rgba(0,0,0,.5); }
.bulk-bar .btn:not(.primary) { background: transparent; color: var(--page); border-color: rgba(255,255,255,.3); }
.bulk-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.input.mini { height: 36px; width: 74px; padding: 0 8px; }
.input.mini.wide { width: 140px; }
select.input.mini { width: auto; }
@media (min-width: 960px) { .bulk-bar { bottom: 12px; } }
.sell-form { margin: 6px 0; }
.sell-form h3 { margin: 0 0 12px; }
.bars { display: grid; gap: 10px; margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14.5px; }
.bar-row .bar { height: 10px; border-radius: 99px; background: var(--sheet); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; border-radius: inherit; background: var(--holo); }
@media (max-width: 560px) {
  .inv-row, .inv-row:not(:has(.inv-check)) { grid-template-columns: 42px minmax(0, 1fr); }
  .inv-row:has(.inv-check) { grid-template-columns: auto 42px minmax(0, 1fr); }
  .inv-row .inv-price { grid-column: 1 / -1; grid-template-columns: 1fr auto; justify-items: start; text-align: left; align-items: center; }
  .inv-row .inv-price .inv-actions { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
}
.bulk-bar .input { color: var(--ink); background: var(--pocket); border-color: transparent; }
.bulk-bar .btn.primary { background: var(--holo); color: #120f24; border-color: transparent; }
button.toast-action { background: none; border: 0; padding: 0 2px; font: inherit; font-weight: 800; color: inherit; text-decoration: underline; cursor: pointer; }
