:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --text: #171a21;
  --muted: #5d6475;
  --border: #dde1ea;
  --accent: #1f5fd1;
  --accent-text: #ffffff;
  --up: #12805c;
  --down: #c2352b;
  --warn: #a15c00;
  --warn-bg: #fff3dc;
  --shadow: 0 1px 2px rgba(20, 24, 33, .06), 0 4px 16px rgba(20, 24, 33, .06);
  --radius: 14px;
  --chart-line: #1f5fd1;
  --chart-fill: rgba(31, 95, 209, .12);
  --chart-grid: #e6e9f0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --surface: #181b23; --surface-2: #222631; --text: #eceef3; --muted: #9aa1b2;
    --border: #2b303c; --accent: #6b9cff; --accent-text: #0b1020; --up: #3ccf91; --down: #ff7468;
    --warn: #ffbf5e; --warn-bg: #3a2c12; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --chart-line: #6b9cff; --chart-fill: rgba(107, 156, 255, .15); --chart-grid: #262a35; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #181b23; --surface-2: #222631; --text: #eceef3; --muted: #9aa1b2;
  --border: #2b303c; --accent: #6b9cff; --accent-text: #0b1020; --up: #3ccf91; --down: #ff7468;
  --warn: #ffbf5e; --warn-bg: #3a2c12; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --chart-line: #6b9cff; --chart-fill: rgba(107, 156, 255, .15); --chart-grid: #262a35; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.up { color: var(--up); }
.down { color: var(--down); }
.num { font-variant-numeric: tabular-nums; }

/* Top bar and navigation */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 16px;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.topsearch { flex: 1; max-width: 460px; min-width: 0; position: relative; display: flex; align-items: center; }
.topsearch > span { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.topsearch svg { width: 18px; height: 18px; }
.topsearch input[type=search] {
  width: 100%; padding: 8px 12px 8px 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit;
}
.topsearch input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.nav a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav svg { width: 20px; height: 20px; }
@media (max-width: 899px) {
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0; background: var(--surface);
    border-top: 1px solid var(--border); justify-content: space-around; z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; font-size: 12px; gap: 2px; padding: 6px 10px; }
  .topsearch { max-width: none; }
}
@media (max-width: 560px) { .brand { display: none; } }

main { max-width: 1240px; margin: 0 auto; padding: 16px; }

/* Generic pieces */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 17px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--down); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--text); }
input[type=text], input[type=number], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
textarea { width: 100%; min-height: 180px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.field > * { color: var(--text); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Summary */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat .sub { font-size: 13px; margin-top: 2px; }
@media (max-width: 480px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 12px; }
  .stat .value { font-size: 20px; }
}

/* Chart */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 4px 8px;
  border-radius: 8px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%);
}
.chart-empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; }

/* Card grid */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0 12px; }
.toolbar input[type=search] { flex: 1 1 200px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; text-align: left; padding: 0;
}
.tile:hover { border-color: var(--accent); }
.tile .img { background: var(--surface-2); aspect-ratio: 63 / 88; position: relative; }
.tile .img img { width: 100%; height: 100%; object-fit: contain; }
.tile .qty { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.72); color: #fff; font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 999px; }
.tile .flag { position: absolute; top: 6px; left: 6px; }
.tile .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.tile .name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .price { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-top: 4px; }

/* List view */
.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.list th, .list td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.list th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.list tr { cursor: pointer; }
.list tbody tr:hover { background: var(--surface-2); }
.list img { width: 36px; border-radius: 3px; }
.list .r { text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

/* Card detail sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 15, .55); z-index: 50; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 24px 16px; }
.sheet { background: var(--bg); border-radius: 18px; width: 100%; max-width: 1040px; box-shadow: var(--shadow); position: relative; }
@media (max-width: 899px) { .sheet-backdrop { padding: 0; } .sheet { border-radius: 0; min-height: 100%; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: 18px 18px 0 0; position: sticky; top: 0; z-index: 2; }
@media (max-width: 899px) { .sheet-head { border-radius: 0; padding-top: calc(14px + env(safe-area-inset-top)); } }
.sheet-head h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-areas: "img info" "copy info" "coll info" "rep rep"; grid-template-rows: auto auto 1fr auto; gap: 16px; padding: 16px; align-items: start; }
.area-img { grid-area: img; } .area-info { grid-area: info; min-width: 0; } .area-copy { grid-area: copy; } .area-collections { grid-area: coll; } .area-reprints { grid-area: rep; min-width: 0; }
.reprints { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.reprints .tile .name { font-size: 13px; }
.area-info > .panel + .panel { margin-top: 16px; }
@media (max-width: 760px) { .sheet-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "img" "info" "copy" "coll" "rep"; } }
.card-img { width: 100%; max-width: 360px; margin: 0 auto; border-radius: 14px; cursor: zoom-in; box-shadow: var(--shadow); background: var(--surface-2); aspect-ratio: 63 / 88; object-fit: contain; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.attack { border-top: 1px solid var(--border); padding: 8px 0; }
.attack:first-child { border-top: 0; }
.attack .head { display: flex; gap: 8px; font-weight: 700; align-items: center; }
.attack .head .dmg { margin-left: auto; }
.energy { display: inline-flex; gap: 2px; }
.energy i { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.prices { width: 100%; border-collapse: collapse; font-size: 14px; }
.prices th, .prices td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: right; }
.prices th:first-child, .prices td:first-child { text-align: left; color: var(--muted); font-weight: 400; }
.prices tr.chosen td { font-weight: 700; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
/* Small question over a sheet (Cardmarket language filter) */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 15, .55); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; width: 100%; max-width: 340px; }
.dialog h2 { margin: 0 0 10px; font-size: 17px; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 0; }
.nav a span { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog .check { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.dialog .check input { width: 18px; height: 18px; margin: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 80; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 16px; }
.candidates { display: grid; gap: 8px; margin-top: 10px; }
.candidate { display: flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.candidate.current { border-color: var(--accent); }

/* Import / search */
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.result { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.result img.thumb { width: 64px; border-radius: 4px; cursor: zoom-in; }
.result .info { flex: 1; min-width: 0; }
.result .raw { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 8px; }
.option { border: 2px solid transparent; border-radius: 8px; padding: 2px; cursor: pointer; background: none; text-align: center; font-size: 11px; color: var(--muted); }
.option img { width: 100%; border-radius: 5px; }
.option.on { border-color: var(--accent); color: var(--text); }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); transition: width .2s; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px; }
.dropzone.over { border-color: var(--accent); color: var(--text); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 90; font-weight: 600; max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Shared bits added with the catalogue */
.page-title { margin: 0 0 12px; font-size: 22px; }
.gap { margin-bottom: 16px; }
.linklike { color: var(--accent); cursor: pointer; text-decoration: underline; }
.noimg { display: flex; align-items: center; justify-content: center; height: 100%; padding: 8px; text-align: center; color: var(--muted); font-size: 12px; }
.card-img.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tile { text-decoration: none; color: inherit; }
.tile.owned { border-color: var(--up); }
.thumbcell img, .thumbcell .product-ph { width: 36px; height: 50px; border-radius: 3px; font-size: 6px; }
.thumbcell .product-ph .nm { display: none; }

/* Sealed product placeholder (Cardmarket's files have no product pictures) */
.product-ph { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px;
  padding: 12px; text-align: center; background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.product-ph .cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.product-ph .nm { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.area-img .product-ph { aspect-ratio: 1; border-radius: 14px; box-shadow: var(--shadow); max-width: 360px; margin: 0 auto; }

/* Catalogue */
.lang-tabs { flex-wrap: wrap; margin-bottom: 8px; max-width: 100%; }
.segbtn { padding: 6px 12px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.segbtn.on { background: var(--surface-2); color: var(--text); }
.set-filter { flex: 1 1 220px; }
.era { margin-top: 20px; }
.era h2 { font-size: 18px; margin: 0 0 10px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 480px) { .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.set-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.set-tile:hover { border-color: var(--accent); }
.set-tile .logo { height: 64px; display: flex; align-items: center; justify-content: center; }
.set-tile .logo img { max-height: 64px; max-width: 100%; object-fit: contain; }
.set-tile .nm { font-weight: 700; font-size: 14px; }
.set-tile .meta { font-size: 12px; color: var(--muted); }
.crumbs { margin-bottom: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.set-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.set-logo { max-height: 70px; max-width: 200px; object-fit: contain; }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-tab { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.cat-tab .count { font-size: 12px; color: var(--muted); font-weight: 700; }
.cat-tab.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.cat-tab.on .count { color: var(--accent-text); opacity: .8; }
.warnline { color: var(--warn); font-weight: 600; }
.update-banner { background: var(--warn-bg); color: var(--warn); font-weight: 700; padding: 10px 16px; text-align: center; border-bottom: 1px solid var(--border); }

/* Account */
.auth-panel { max-width: 520px; }
.auth-fields { display: grid; gap: 10px; }
.auth-fields input { width: 100%; }
@media (max-width: 899px) { .nav a { padding: 6px 6px; } }


/* Collection picker */
.tile.missing .img > :first-child, tr.missing .thumbcell > * { opacity: .35; filter: grayscale(1); }
.tile.missing .name, tr.missing strong { color: var(--muted); }
.missing-badge { position: absolute; top: 6px; left: 6px; }
tr.missing .missing-badge { position: static; }
.section-title { font-size: 17px; margin: 22px 0 4px; }
.collection-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.collection-bar select { font-weight: 700; font-size: 16px; max-width: 100%; }

/* Pasted list: one line's own buttons */
.result-actions { margin-top: 8px; gap: 8px; }
.result.done { opacity: .6; }

/* a set without a logo shows one of its cards */
.set-tile .logo img.cover { height: 64px; width: auto; border-radius: 4px; }
.set-logo.cover { height: 72px; width: auto; border-radius: 4px; }

/* "Add to a collection": the collections a card is in */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip a { color: var(--text); text-decoration: none; }
.chip-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.chip-x:hover { color: var(--down); }

/* profile picture (or initials) */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex: none;
  color: #fff; font-weight: 700; overflow: hidden; background: var(--surface-2); }

/* set page summary: complete / master set, market price, card types */
.set-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.sum-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column;
  gap: 10px; min-height: 150px; overflow: hidden; position: relative; }
.sum-big { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.sum-label { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.sum-sub { color: var(--muted); font-size: .85rem; }
.sum-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sum-head { display: flex; align-items: center; gap: 12px; }
.donut { --p: 0%; width: 78px; height: 78px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--p), var(--surface-2) 0); }
.donut span { width: 58px; height: 58px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; color: var(--accent); }
.sum-master { margin-top: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; }
.sum-master .bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sum-master .bar div { height: 100%; background: var(--accent); }
.sum-market-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; max-width: 62%; }
.sum-top-cards { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.sum-top-card { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; color: var(--text); font-size: .85rem; text-decoration: none; }
.sum-top-card img, .sum-top-card .sum-noimg { width: 22px; height: 30px; object-fit: cover; border-radius: 3px; }
.sum-top-card .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sum-fan { position: absolute; right: -10px; top: 10px; bottom: 10px; width: 40%; }
.sum-fan img { position: absolute; height: 100%; max-height: 150px; border-radius: 8px; box-shadow: 0 4px 14px rgb(0 0 0 / .25); }
.sum-fan img:first-child { right: 34px; transform: rotate(-8deg); }
.sum-fan img:last-child { right: 0; transform: rotate(6deg); }
.type-blocks { display: grid; gap: 6px; flex: 1; min-height: 96px; }
.type-rest { display: grid; gap: 6px; }
.type-block { border-radius: 12px; padding: 8px 12px; color: #fff; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto;
  min-height: 0; overflow: hidden; }
.type-block .pc { grid-column: 1 / -1; justify-self: end; font-size: .72rem; font-weight: 700; opacity: .9; }
.type-block .n { font-size: 1.6rem; font-weight: 800; align-self: end; line-height: 1; }
.type-block .lb { font-size: .8rem; font-weight: 700; align-self: end; justify-self: end; grid-column: 2; }
.type-rest .type-block { grid-template-rows: auto; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.type-rest .type-block .pc { display: none; }
.type-rest .type-block .n { font-size: 1.2rem; align-self: center; }
.type-rest .type-block .lb { align-self: center; }
.type-pokemon { background: #3d8bf2; }
.type-trainer { background: #2fbf71; }
.type-energy { background: #ef4b4b; }
@media (max-width: 520px) { .sum-fan { display: none; } .sum-market-text { max-width: none; } }
.sum-noimg { display: block; font-size: 0; background: var(--surface-2); }
.sum-fan .sum-noimg { display: none; }

/* "Modify": selecting several tiles / rows for a mass change */
.modify-bar { position: sticky; top: 64px; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.modify-bar .spacer { flex: 1; }
.modify-bar .row { gap: 6px; align-items: center; }
.small-select { padding: 4px 8px; font-size: .85rem; max-width: 180px; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.selecting [data-key] { position: relative; cursor: pointer; }
.selecting .tile[data-key]::after { content: ''; position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: rgb(0 0 0 / .35); box-shadow: 0 1px 4px rgb(0 0 0 / .4); z-index: 3; }
.selecting .tile[data-key].selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.selecting .tile[data-key].selected::after { background: var(--accent); border-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat; }
.selecting tr[data-key] td:first-child { box-shadow: inset 4px 0 0 transparent; }
.selecting tr[data-key].selected td { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.selecting tr[data-key].selected td:first-child { box-shadow: inset 4px 0 0 var(--accent); }

/* the website before sign-in / invitation key: only the account panel */
.gated .nav, .gated .topsearch { display: none !important; }

/* phones: a long word or address (an error with a link in it) wraps instead of widening the page */
main { overflow-wrap: break-word; min-width: 0; }
.notice, .toast { overflow-wrap: anywhere; }
html, body { overflow-x: clip; }

/* prices loading behind the app (main.js) */
.prices-pill { position: fixed; left: 12px; bottom: 12px; z-index: 60; background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 13px; box-shadow: 0 2px 10px rgb(0 0 0 / .25); }
@media (max-width: 700px) { .prices-pill { bottom: 84px; } }

/* a password box with its show / hide button (account-view.js) */
.password-row { flex-wrap: nowrap; gap: 6px; }
.password-row input { flex: 1; min-width: 0; }
