/* Pokemo - Poke Ball red, electric yellow, card-frame panels. Mobile first. */
:root {
  --red: #e3350d;
  --red-deep: #b31f04;
  --yellow: #ffcb05;
  --yellow-deep: #e0a800;
  --navy: #1d2c5e;
  --blue: #3b6fd8;
  --bg: #fff8e6;
  --bg-dots: rgba(227, 53, 13, 0.06);
  --panel: #ffffff;
  --panel-2: #fff3cc;
  --text: #1a1d2e;
  --muted: #69708a;
  --line: #ece4cc;
  --chip: #f4efe0;
  --gain: #1f9d55;
  --loss: #d62f2f;
  --warn-bg: #fff1c2;
  --warn-text: #8a5a00;
  --on-red: #ffffff;
  --on-yellow: #1a1d2e;
  --frame: var(--yellow);
  --shadow: 0 2px 0 rgba(26, 29, 46, 0.08), 0 10px 24px -12px rgba(26, 29, 46, 0.25);
  --radius: 20px;
  --tap: 48px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1222;
    --bg-dots: rgba(255, 203, 5, 0.05);
    --panel: #171d33;
    --panel-2: #20284a;
    --text: #eef1fb;
    --muted: #9aa3c4;
    --line: #2a3359;
    --chip: #232b4d;
    --gain: #4ade80;
    --loss: #ff6b6b;
    --warn-bg: #3a2c05;
    --warn-text: #ffd866;
    --frame: #c99d00;
    --shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 12px; line-height: 1.15; letter-spacing: 0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 16px; margin-top: 18px; }
code { background: var(--chip); padding: 1px 6px; border-radius: 6px; }
a { color: var(--blue); font-weight: 700; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar: Poke Ball ---------- */
.topbar { position: sticky; top: 0; z-index: 30; }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg, var(--red) 0%, var(--red-deep) 100%);
  color: var(--on-red);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.brand img { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25)); }
.ball-band { height: 8px; background: #1a1d2e; position: relative; }
.ball-band span {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff; border: 6px solid #1a1d2e; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.18); color: #fff; cursor: pointer;
}
.icon-btn.active { background: #fff; color: var(--red); }

/* nav: desktop pills in the bar, phone = bottom dock */
.tabs { display: flex; gap: 6px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  font: 700 15px var(--font-body); color: #fff; background: transparent;
  padding: 9px 16px; border-radius: 999px;
}
.tab:hover { background: rgba(255, 255, 255, 0.14); }
.tab.active { background: #fff; color: var(--red); }
.tab .ball { display: contents; }
.tab .ball svg { width: 22px; height: 22px; }

@media (max-width: 720px) {
  .brand { font-size: 23px; }
  .tabs {
    position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    justify-content: space-around; align-items: flex-end;
    background: var(--panel); border: 3px solid var(--frame); border-radius: 26px;
    padding: 6px 8px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.35);
  }
  .tab { flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); padding: 6px 14px; min-height: var(--tap); }
  .tab.active { background: transparent; color: var(--red); }
  .tab:hover { background: transparent; }
  .tab-scan { margin-top: -30px; }
  .tab .ball {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(180deg, var(--red) 0 50%, #fff 50% 100%);
    border: 4px solid #1a1d2e; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); position: relative;
  }
  .tab .ball::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: #1a1d2e; }
  .tab .ball svg {
    position: relative; z-index: 1; width: 30px; height: 30px; padding: 5px; border-radius: 50%;
    background: #fff; border: 3px solid #1a1d2e; color: #1a1d2e; stroke-width: 2.2;
  }
  .tab-scan.active .ball svg { color: var(--red); }
}

/* ---------- layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 22px 14px 16px; }
.view[hidden] { display: none; }
.view:not([hidden]) { animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* panels look like trading cards: yellow frame, rounded, soft inner */
.panel {
  background: var(--panel); border: 5px solid var(--frame); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 16px; position: relative;
}
.panel.narrow { max-width: 580px; margin-left: auto; margin-right: auto; }
.step {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #ff8a6b, var(--red) 60%, var(--red-deep));
  color: #fff; font-size: 15px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.panel.done .snap-zone { padding: 14px; }
.panel.done .snap-zone .snap-card { width: 44px; height: 60px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1 1 200px; min-width: 0; }

/* stepper */
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: s; }
.stepper li {
  flex: 1; text-align: center; font: 600 12px var(--font-display); color: var(--muted); counter-increment: s;
  display: grid; justify-items: center; gap: 4px;
}
.stepper li::before {
  content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel); border: 3px solid var(--line); font-size: 13px; color: var(--muted); transition: all 0.2s;
}
.stepper li.on { color: var(--text); }
.stepper li.on::before { background: var(--red); border-color: var(--red-deep); color: #fff; }

/* ---------- controls ---------- */
button, .button {
  font: 700 15px var(--font-body); cursor: pointer; min-height: var(--tap);
  border: 2px solid var(--line); background: var(--panel); color: var(--text);
  padding: 10px 18px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.08s, box-shadow 0.15s, border-color 0.15s;
}
button:hover, .button:hover { border-color: var(--yellow-deep); }
button:active, .button:active { transform: translateY(1px) scale(0.98); }
button.primary, .button.primary {
  background: linear-gradient(180deg, #ff5a33, var(--red)); border-color: var(--red-deep); color: #fff;
  box-shadow: 0 3px 0 var(--red-deep);
}
button.primary:active { box-shadow: 0 1px 0 var(--red-deep); }
button.big { font-size: 17px; padding: 12px 22px; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.danger { color: var(--loss); border-color: currentColor; background: transparent; }
button.small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
button:disabled { opacity: 0.6; cursor: progress; }
button:focus-visible, .button:focus-visible, .tab:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

input, select, textarea {
  font: 600 16px var(--font-body); color: var(--text); background: var(--bg);
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; min-height: var(--tap);
}
input.short { width: 140px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--yellow-deep); box-shadow: 0 0 0 3px rgba(255, 203, 5, 0.35); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.grid-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.grid-form .full { grid-column: 1 / -1; }
.hint { font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: 0; }
fieldset { border: 2px dashed var(--line); border-radius: 14px; padding: 12px; }
legend { font-size: 13px; font-weight: 800; color: var(--muted); padding: 0 6px; text-transform: uppercase; }

/* snap zone */
.snap-zone {
  display: grid; justify-items: center; gap: 8px; text-align: center; cursor: pointer;
  padding: 26px 16px; margin-bottom: 14px; border-radius: 18px;
  border: 3px dashed var(--yellow-deep); background: var(--panel-2);
  transition: padding 0.2s;
}
.snap-zone:hover { border-color: var(--red); }
.snap-zone strong { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.snap-card {
  width: 84px; height: 116px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--yellow), #ffe36e); border: 4px solid #fff; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.35);
  color: var(--red); transition: all 0.2s;
}
.snap-card svg { width: 38px; height: 38px; stroke-width: 2.2; }

.segmented { display: inline-flex; background: var(--chip); border-radius: 14px; padding: 4px; }
.segmented button { border: 0; background: transparent; min-height: 40px; padding: 6px 16px; box-shadow: none; }
.segmented button.active { background: var(--panel); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); color: var(--red); }

.alert { padding: 12px 14px; border-radius: 14px; margin: 10px 0; font-size: 14px; font-weight: 700; }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }

.canvas-wrap { display: flex; justify-content: center; margin: 12px -6px; background: #0b0d18; border-radius: 14px; overflow: hidden; }
#centering-canvas { touch-action: none; display: block; max-width: 100%; }

.ratios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.ratios div { background: var(--panel-2); border-radius: 14px; padding: 10px 6px; text-align: center; }
.ratios .label { display: block; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ratios strong { font: 600 19px var(--font-display); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .ratios strong { font-size: 15px; } }

/* predictions styled like slab labels */
.predictions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pred { border-radius: 12px; padding: 10px 12px; background: var(--panel); border: 2px solid var(--line); position: relative; overflow: hidden; }
.pred::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--slab, var(--muted)); }
.pred.slab-PSA { --slab: #d62f2f; }
.pred.slab-BGS { --slab: linear-gradient(90deg, #9aa3b5, #e6e9ef, #9aa3b5); }
.pred.slab-CGC { --slab: #2f6fd6; }
.pred.slab-TAG { --slab: #1a1d2e; }
.pred .co { font-size: 12px; font-weight: 800; color: var(--muted); margin-top: 4px; letter-spacing: 0.06em; }
.pred .gr { font: 700 26px var(--font-display); }
.pred .meta { font-size: 12px; color: var(--muted); }
.pred.top { border-color: var(--yellow-deep); background: linear-gradient(160deg, var(--panel) 60%, var(--panel-2)); }
.pred.top .gr { color: var(--gain); }
.star { color: var(--yellow-deep); }

/* identify */
.guess { background: var(--panel-2); border-radius: 16px; padding: 14px; margin: 14px 0; font-size: 14.5px; }
.guess dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.guess dt { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; padding-top: 2px; }
.guess dd { margin: 0; }
.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
@media (max-width: 480px) { .candidates { grid-template-columns: repeat(2, 1fr); } }
.cand {
  border: 3px solid var(--line); border-radius: 14px; padding: 8px; background: var(--panel);
  display: grid; gap: 4px; text-align: left; font-weight: 600; font-size: 12.5px; align-content: start; min-height: 0;
}
.cand img { width: 100%; aspect-ratio: 63 / 88; object-fit: contain; border-radius: 8px; background: var(--chip); }
.cand.selected { border-color: var(--red); box-shadow: 0 0 0 4px rgba(227, 53, 13, 0.2); }
.cand b { font-size: 14px; }

.selected-card { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.selected-card img { width: 78px; border-radius: 8px; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.4); }
.selected-card b { font-family: var(--font-display); font-size: 18px; font-weight: 600; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; }
tr.highlight td { background: rgba(255, 203, 5, 0.22); }
.gain { color: var(--gain); font-weight: 800; }
.loss { color: var(--loss); font-weight: 800; }

/* ---------- vault binder ---------- */
.filters { margin-top: 4px; }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .vault-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.vcard {
  background: var(--panel); border: 4px solid var(--frame); border-radius: 18px; box-shadow: var(--shadow);
  padding: 8px; display: grid; gap: 6px; text-align: left; font-weight: 600; cursor: pointer; color: var(--text);
  align-content: start; min-height: 0; transition: transform 0.15s, box-shadow 0.15s;
}
.vcard:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.45); }
.vcard .art { position: relative; display: block; border-radius: 10px; overflow: hidden; background: var(--chip); }
.vcard img { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: contain; }
.vcard img.placeholder { object-fit: none; opacity: 0.5; }
.vcard .holo {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0;
  background: linear-gradient(115deg, transparent 25%, rgba(255, 0, 140, 0.35) 38%, rgba(255, 230, 0, 0.35) 46%, rgba(0, 220, 255, 0.35) 54%, transparent 66%);
  background-size: 250% 250%; transition: opacity 0.2s;
}
.vcard:hover .holo, .vcard:focus-visible .holo { opacity: 1; animation: shine 1.6s linear infinite; }
@keyframes shine { from { background-position: 100% 100%; } to { background-position: 0 0; } }
.vcard .name { font: 600 15px/1.2 var(--font-display); padding: 0 2px; }
.vcard .sub { font-size: 12px; color: var(--muted); padding: 0 2px; }
.vcard .money { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; padding: 0 2px; }
.vcard.up { border-color: #8fd9a8; }
.vcard.down { border-color: #f2a3a3; }
@media (prefers-color-scheme: dark) { .vcard.up { border-color: #2e7d4f; } .vcard.down { border-color: #8a3434; } }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 2px; }
/* status chips use energy-type colours */
.chip { border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; background: var(--chip); color: var(--text); }
.chip.st-raw { background: #e7e3d6; color: #4b4f5e; }
.chip.st-submitted { background: #b763cf; color: #fff; }
.chip.st-graded { background: var(--yellow); color: #3a2c00; }
.chip.st-sold { background: var(--red); color: #fff; }

/* ---------- profit ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.hero-stat {
  grid-column: 1 / -1; border-radius: var(--radius); padding: 20px 18px; color: #fff;
  background: radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.18), transparent 40%), linear-gradient(135deg, var(--navy), #2f4596);
  border: 5px solid var(--frame); box-shadow: var(--shadow);
}
.hero-stat .label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; opacity: 0.8; }
.hero-stat .value { font: 700 40px var(--font-display); margin: 2px 0; }
.hero-stat .value .gain { color: #7dffad; }
.hero-stat .value .loss { color: #ff9b9b; }
.hero-stat .sub { opacity: 0.85; font-size: 14px; }
.hp { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.hp-label { font: 700 12px var(--font-display); background: var(--yellow); color: #1a1d2e; padding: 2px 8px; border-radius: 6px; }
.hp-track { position: relative; flex: 1; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.35); }
.hp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ff6b6b, #ffcb05 45%, #4ade80 60%); border-radius: 999px; transition: width 0.6s; }
.hp-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #fff; }
.kpi { background: var(--panel); border: 4px solid var(--frame); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.kpi .label { font-size: 11.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font: 700 24px var(--font-display); font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.kpi.good { border-color: #8fd9a8; }
.kpi.bad { border-color: #f2a3a3; }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } .hero-stat .value { font-size: 34px; } .kpi .value { font-size: 20px; } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .panel { margin-bottom: 0; }
.two-col + .two-col, .two-col + .panel { margin-top: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.two-col > *, .kpis > *, .vault-grid > *, .grid-form > *, .candidates > *, .predictions > * { min-width: 0; }
.panel { min-width: 0; }
.bar { height: 12px; border-radius: 999px; min-width: 3px; background: linear-gradient(90deg, var(--yellow), var(--red)); }

/* ---------- dialog: bottom sheet on phones ---------- */
dialog {
  width: min(740px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  border: 5px solid var(--frame); border-radius: var(--radius); padding: 0;
  background: var(--panel); color: var(--text);
}
dialog::backdrop { background: rgba(10, 12, 28, 0.6); backdrop-filter: blur(2px); }
dialog[open] { animation: rise 0.2s ease-out; }
@media (max-width: 720px) {
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  dialog[open] { animation: sheet 0.25s ease-out; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-head {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  position: sticky; top: 0; z-index: 1; color: #fff;
  background: linear-gradient(180deg, var(--red), var(--red-deep)); border-bottom: 6px solid #1a1d2e;
}
.dialog-head h2 { margin: 0; color: #fff; }
.dialog-head button { font-size: 26px; color: #fff; min-height: 44px; }
#item-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.item-top { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.item-top img { width: 130px; border-radius: 10px; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.45); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: #1a1d2e; color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  border: 3px solid var(--yellow); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px); z-index: 60; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 721px) { #toast { bottom: 24px; } body { padding-bottom: 32px; } }
/* ---------- catalog ---------- */
.full-width { width: 100%; margin: 4px 0 10px; }
.type-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.type-chips::-webkit-scrollbar { display: none; }
.type-chips[hidden] { display: none; }
.type-chip {
  flex: none; min-height: 38px; padding: 6px 14px; border-radius: 999px; font-size: 13.5px;
  border: 2px solid var(--line); background: var(--panel); box-shadow: none;
}
.type-chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.sync-bar { margin-top: 6px; display: grid; gap: 6px; }
.progress { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.progress[hidden] { display: none; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow), var(--red)); transition: width 0.3s; }

.series {
  background: var(--panel); border: 4px solid var(--frame); border-radius: 18px; margin-bottom: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.series summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 16px; min-height: var(--tap);
}
.series summary::-webkit-details-marker { display: none; }
.series summary::after { content: "›"; font: 700 24px var(--font-display); color: var(--muted); transition: transform 0.2s; }
.series[open] summary::after { transform: rotate(90deg); }
.series-name { font: 600 18px var(--font-display); flex: 1; }
.set-list { display: grid; border-top: 2px solid var(--line); }
.set-row {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; text-align: left;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 10px 14px; font-weight: 600;
}
.set-row:last-child { border-bottom: 0; }
.set-row:hover { background: var(--panel-2); }
.set-row img { width: 64px; height: 36px; object-fit: contain; }
.set-code {
  width: 64px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  background: var(--chip); font: 700 12px var(--font-display); color: var(--muted); overflow: hidden;
}
.set-main { display: grid; min-width: 0; }
.set-main b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.product-grid > * { min-width: 0; }
@media (max-width: 480px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.ptile {
  background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 8px;
  display: grid; gap: 5px; align-content: start;
}
.pimg { display: block; background: #fff; border-radius: 10px; overflow: hidden; }
.pimg img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.pimg img.placeholder { object-fit: none; opacity: 0.5; }
.pname { font: 600 14px/1.25 var(--font-display); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pprice { font: 700 18px var(--font-display); color: var(--gain); }
.ptile .row { gap: 6px; flex-wrap: wrap; }
.ptile a.small { font-size: 13px; }
.chip.type { background: var(--navy); color: #fff; }
.chip.st-sealed { background: #3fa9f5; color: #fff; }
#item-dialog .product-grid { margin-top: 10px; }

/* sealed items hide card-only fields */
.grid-form[data-kind="sealed"] .card-only { display: none; }

/* nav: settings lives in the header on desktop, in the dock on phones */
.tab-settings { display: none; }
@media (max-width: 720px) {
  .tab-settings { display: inline-flex; }
  .topbar .icon-btn { display: none; }
  .tab { padding: 6px 4px; flex: 1; min-width: 0; }
  .tabs { left: 8px; right: 8px; padding: 6px 4px; }
  .tab .ball { width: 60px; height: 60px; }
}

/* footer credit */
.credit { display: flex; justify-content: center; padding: 8px 16px 24px; }
.credit-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px;
  font: 600 14px var(--font-display); letter-spacing: 0.02em; color: #1a1d2e;
  background: linear-gradient(135deg, var(--yellow), #ffe36e 50%, var(--yellow));
  border: 3px solid #1a1d2e; box-shadow: 0 4px 0 #1a1d2e, 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}
.credit-badge strong { color: var(--red); font-weight: 700; }

.empty { text-align: center; padding: 34px 12px; color: var(--muted); font-weight: 700; }

/* phone ergonomics: full-width primary actions */
@media (max-width: 480px) {
  main { padding: 16px 10px; }
  .panel { padding: 16px 12px; border-width: 4px; }
  #identify-btn, #price-form button, #add-form button.primary, #item-form button.primary, #login-form button { width: 100%; }
  .grow-mobile { flex: 1; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .grid-form label:has(textarea), .grid-form label:has(input[name="name"]), .grid-form label:has(input[name="market_query"]) { grid-column: 1 / -1; }
  #manual-search input { flex: 1 1 100%; }
  #manual-search input.short { flex: 1; }
  .filters > * { flex: 1 1 45%; }
}

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