/* CollectibleTracker v0.2+
   Light = "Passport" (paper, ink, stamps). Dark = "Display cabinet" (graphite, lit shelves).
   Switched automatically by prefers-color-scheme. Palette deliberately avoids brand colours. */
:root {
  --bg: #f4eee1;
  --paper2: #efe7d6;
  --card: #fbf7ee;
  --ink: #1e2a44;
  --dim: #5d6474;
  --line: #d9cfbb;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --stamp: #c2412d;
  --gold: #b8892b;
  --ghost: #b9b2a3;
  --owned: #1f6f4a;
  --owned-bg: #dcefe1;
  --wish: #9a5b00;
  --wish-bg: #f8e7c4;
  --none: #a5342a;
  --none-bg: #f6ddd6;
  --danger: #b42318;
  --ring-track: #e3d9c5;
  --r: 14px;
  --tap: 48px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --dock-h: 124px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --paper2: #1b1a1f;
    --card: #1f1e24;
    --ink: #edeae3;
    --dim: #a19d96;
    --line: #34323b;
    --accent: #f6d38a;
    --accent-ink: #1a1408;
    --stamp: #7bd389;
    --gold: #f6d38a;
    --ghost: #3a3940;
    --owned: #7bd389;
    --owned-bg: #18301f;
    --wish: #f2b84b;
    --wish-bg: #33270f;
    --none: #ff9a8a;
    --none-bg: #3a1c19;
    --danger: #ff7b6e;
    --ring-track: #2c2b32;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(30, 42, 68, .045) 1px, transparent 1.2px),
    radial-gradient(rgba(194, 65, 45, .03) 1px, transparent 1.2px);
  background-size: 19px 19px, 27px 27px;
  background-position: 0 0, 9px 13px;
  color: var(--ink);
  font: 16px/1.4 var(--sans);
  padding-bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom));
}
@media (prefers-color-scheme: dark) {
  body { background-image: linear-gradient(180deg, #19181d 0%, #121214 60%); background-size: auto; background-attachment: fixed; }
}
button, input, select, textarea { font: inherit; color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.art-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.center { text-align: center; }
.small { font-size: 12.5px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: calc(6px + env(safe-area-inset-top)) 14px 6px;
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; max-width: 900px; margin: 0 auto; }
.logo { font: 600 19px/1.1 var(--serif); margin: 0; letter-spacing: .2px; }
.logo-b { color: var(--stamp); font-style: italic; margin-left: 2px; }
.icon-btn { min-width: var(--tap); min-height: 44px; border: 0; background: transparent; font-size: 22px; cursor: pointer; }

.series-tabs { display: flex; gap: 8px; overflow-x: auto; max-width: 900px; margin: 6px auto 2px; padding-bottom: 4px; scrollbar-width: none; }
.series-tabs::-webkit-scrollbar { display: none; }
.stab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 14.5px;
}
.stab .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.stab .pct { font: 700 12px var(--round); color: var(--dim); font-variant-numeric: tabular-nums; }
.stab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stab.on .pct { color: inherit; opacity: .8; }

main { max-width: 900px; margin: 0 auto; padding: 10px 14px; }

/* ---------- banners ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); margin-bottom: 10px; background: var(--card); border: 1px solid var(--line); font-size: 14.5px; }
.banner p { margin: 0; flex: 1; }
.banner.nudge { border-color: var(--wish); background: var(--wish-bg); }
.banner.migrate { border-color: var(--accent); }
.banner.news { border-style: dashed; }

/* ---------- hero ---------- */
.hero { display: flex; gap: 16px; align-items: center; padding: 8px 2px 14px; }
.ring { flex: none; position: relative; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring .trk { stroke: var(--ring-track); }
.ring .val { stroke: var(--stamp); stroke-linecap: round; transition: stroke-dasharray .5s cubic-bezier(.2, .8, .2, 1); }
.ring.done .val { stroke: var(--gold); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font: 800 20px var(--round); font-variant-numeric: tabular-nums; }
.ring.mini .num { font-size: 0; }
.hero-txt { min-width: 0; }
.hero h2 { font: 600 26px/1.15 var(--serif); margin: 0 0 2px; }
.hero .count { font: 700 17px var(--round); font-variant-numeric: tabular-nums; margin: 0; }
.hero .facts { color: var(--dim); font-size: 13.5px; margin: 2px 0 0; }
.hero .hint { color: var(--dim); font-size: 12.5px; margin: 4px 0 0; }
.hero .chip-note { display: inline-block; margin-top: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--line); color: var(--dim); }

/* ---------- segmented ---------- */
.seg { display: flex; max-width: 900px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; cursor: pointer; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg.big button { min-height: var(--tap); }
.seg.small { margin: 0; flex: 1; }

.quickmark { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); margin-bottom: 12px; border: 2px dashed var(--stamp); background: var(--card); position: sticky; top: 104px; z-index: 3; }
.quickmark p { margin: 0; flex: 1; font-size: 14.5px; }

/* ---------- grid ---------- */
.group { margin-bottom: 18px; }
.group-h { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; }
.group-h h3 { font: 600 18px var(--serif); margin: 0; flex: 1; }
.group-h .gc { font: 700 13.5px var(--round); color: var(--dim); font-variant-numeric: tabular-nums; }
.group.done .group-h h3::after { content: " \2605"; color: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); } }

.tile { position: relative; }
.tile .tap {
  position: relative; display: flex; flex-direction: column; align-items: center; width: 100%;
  padding: 6px 6px 8px; border-radius: var(--r); cursor: pointer; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent);
  background: color-mix(in srgb, var(--card) 70%, transparent);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
  transition: transform .12s ease;
}
.tile .tap:active { transform: scale(.96); }
.tile .art { width: 100%; aspect-ratio: 1; display: grid; place-items: center; }
.tile .art svg, .tile .art img { width: 100%; height: 100%; }
.tile .art img { object-fit: cover; border-radius: 10px; }
.tile .nm { font-size: 13px; font-weight: 650; line-height: 1.2; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.4em; }
.tile .sub { font-size: 11px; color: var(--dim); }
.mug-label { font-family: var(--round); font-weight: 800; letter-spacing: .3px; }

/* missing = ghost */
.tile:not(.have) .art { filter: grayscale(1) contrast(.9); opacity: .38; transition: opacity .25s, filter .25s; }
.tile:not(.have) .art img { opacity: .9; }
/* have = full colour + passport stamp */
.tile.have .tap { border-style: solid; border-color: color-mix(in srgb, var(--stamp) 45%, transparent); background: var(--card); box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 6px 14px -10px rgba(30, 42, 68, .45); }
.tile.have .tap::after {
  content: "\2713"; position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--stamp); color: var(--stamp); font: 900 15px/24px var(--round); text-align: center;
  transform: rotate(-14deg); background: color-mix(in srgb, var(--card) 60%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--card) 50%, transparent);
}
.tile.just .tap::after { animation: stamp .55s cubic-bezier(.2, 1.4, .3, 1); }
.tile.just .art { animation: pop .45s ease-out; }
@keyframes stamp { 0% { transform: scale(2.4) rotate(-40deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-14deg); opacity: 1; } }
@keyframes pop { 0% { transform: scale(.9); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }

.tile .flags { position: absolute; left: 7px; top: 7px; display: flex; gap: 3px; pointer-events: none; }
.flag { font: 800 11px/1 var(--round); padding: 3px 5px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--dim); }
.flag.wish { color: var(--wish); border-color: var(--wish); }
.flag.dup { color: var(--accent); border-color: var(--accent); }
.flag.q { color: var(--stamp); border-color: var(--stamp); }
.flag.cam { color: var(--dim); }
.tile .more {
  position: absolute; right: 2px; bottom: 2px; width: 34px; height: 30px; border: 0; background: transparent;
  color: var(--dim); font-size: 16px; letter-spacing: 1px; cursor: pointer; border-radius: 8px;
}
.tile.coming .tap { border-style: dotted; opacity: .75; }
.tile.coming .art { opacity: .22; }
.tile.unconfirmed:not(.have) .art { opacity: .3; }

/* dark: display cabinet */
@media (prefers-color-scheme: dark) {
  .tile .tap { border: 0; border-radius: 10px 10px 4px 4px; background: transparent; padding-bottom: 14px; }
  .tile .tap::before {
    content: ""; position: absolute; left: -6px; right: -6px; bottom: 0; height: 9px; border-radius: 2px;
    background: linear-gradient(#3a3640, #221f27 60%, #18161b); box-shadow: 0 6px 10px -4px rgba(0, 0, 0, .8);
  }
  .tile:not(.have) .art { filter: brightness(.18) grayscale(1); opacity: .7; }
  .tile.have .tap { background: radial-gradient(ellipse 70% 60% at 50% -8%, rgba(246, 211, 138, .30), transparent 70%); box-shadow: none; }
  .tile.have .art { filter: drop-shadow(0 0 10px rgba(246, 211, 138, .22)); }
  .tile.have .tap::after { border-color: var(--stamp); color: var(--stamp); background: rgba(20, 20, 22, .7); top: 4px; right: 4px; width: 24px; height: 24px; font-size: 13px; line-height: 20px; transform: none; box-shadow: 0 0 10px rgba(123, 211, 137, .35); }
  .tile.just .tap { animation: lighton .7s ease-out; }
  @keyframes lighton { 0% { background-color: rgba(246, 211, 138, .35); } 100% { background-color: transparent; } }
  .flag { background: #1b1a1f; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- custom list (My items) ---------- */
.stats { color: var(--dim); font-size: 14px; margin: 2px 0 10px; }
.list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; min-height: 76px; cursor: pointer; }
.thumb { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; display: grid; place-items: center; color: var(--dim); font-size: 26px; }
.meta { flex: 1; min-width: 0; }
.meta .t { font-weight: 650; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .s { color: var(--dim); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; font-size: 12px; font-weight: 700; letter-spacing: .4px; padding: 6px 9px; border-radius: 8px; text-transform: uppercase; }
.badge.owned { background: var(--owned-bg); color: var(--owned); }
.badge.wishlist { background: var(--wish-bg); color: var(--wish); }
.badge .x { margin-left: 4px; }
.orphans:empty { display: none; }
.add-custom { width: 100%; margin: 8px 0 4px; }
.empty { text-align: center; color: var(--dim); padding: 20px 10px; }
.empty .big { font-size: 19px; color: var(--ink); font-family: var(--serif); }

.foot { text-align: center; color: var(--dim); font-size: 12px; margin: 26px auto 0; max-width: 560px; }
.foot p { margin: 4px 0; }

/* ---------- dock (search near the thumb + tabs) ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  padding: 8px 12px calc(4px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.dock > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.search { position: relative; display: block; }
.search input {
  width: 100%; height: 52px; padding: 0 48px 0 16px; font-size: 19px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--card); -webkit-appearance: none; appearance: none;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 2px; top: 2px; width: 48px; height: 48px; border: 0; background: transparent; font-size: 26px; color: var(--dim); cursor: pointer; }
.tabs { display: flex; margin-top: 4px; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 50px; border: 0; background: transparent; color: var(--dim); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.tabs .ti { font-size: 20px; line-height: 24px; }
.tabs button.on { color: var(--ink); }
.tabs button.on .ti { color: var(--stamp); }

.results { max-height: min(62vh, 520px); overflow-y: auto; margin-bottom: 8px; padding: 2px; overscroll-behavior: contain; }
.vcard { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; border-radius: 20px; padding: 12px; background: var(--card); border: 2px solid var(--line); }
.vcard .art { width: 96px; height: 96px; }
.vcard .art svg, .vcard .art img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.vcard .verdict-word { font: 900 26px/1.05 var(--round); letter-spacing: .3px; margin: 0; }
.vcard .vn { font: 600 18px var(--serif); margin: 2px 0 0; }
.vcard .vs { color: var(--dim); font-size: 13px; margin: 0; }
.vcard .actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.vcard .actions .btn { flex: 1; min-height: 56px; font-size: 18px; border-radius: 14px; }
.vcard.have { border-color: var(--owned); background: var(--owned-bg); }
.vcard.have .verdict-word { color: var(--owned); }
.vcard.missing { border-color: var(--none); background: var(--none-bg); }
.vcard.missing .verdict-word { color: var(--none); }
.vcard.wish { border-color: var(--wish); background: var(--wish-bg); }
.vcard.wish .verdict-word { color: var(--wish); }
.vcard.coming .verdict-word { color: var(--dim); }
.vcard:not(.have) .art { filter: grayscale(.6); opacity: .7; }
.more-matches { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.more-matches button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); text-align: left; cursor: pointer; min-height: 50px; }
.more-matches .mm-art { width: 38px; height: 38px; flex: none; }
.more-matches .mm-art svg, .more-matches .mm-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.more-matches .mm-t { flex: 1; min-width: 0; }
.more-matches .mm-t b { display: block; font-size: 15px; }
.more-matches .mm-t span { font-size: 12.5px; color: var(--dim); }
.pill { font: 800 11px var(--round); padding: 4px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.pill.have { background: var(--owned-bg); color: var(--owned); }
.pill.missing { background: var(--none-bg); color: var(--none); }
.pill.wish { background: var(--wish-bg); color: var(--wish); }
.pill.coming { background: var(--line); color: var(--dim); }
.nores { text-align: center; padding: 14px; border-radius: 16px; background: var(--card); border: 1px dashed var(--line); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font-weight: 650; cursor: pointer; text-align: center; text-decoration: none;
}
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; margin: 10px 0; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.stamp { background: var(--stamp); border-color: var(--stamp); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.stamp { color: #10200f; } }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); width: 100%; margin-top: 18px; }
.link-btn { border: 0; background: transparent; color: var(--accent); min-height: 44px; min-width: 44px; padding: 0 6px; font-size: 17px; cursor: pointer; }
.link-btn.strong { font-weight: 700; }

/* ---------- sheets ---------- */
dialog.sheet { width: 100%; max-width: 640px; height: 100%; max-height: 100%; margin: 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--ink); }
@media (min-width: 700px) { dialog.sheet { height: auto; max-height: 92vh; margin-top: 4vh; border-radius: 18px; } }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font: 600 18px var(--serif); margin: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 14px 16px calc(40px + env(safe-area-inset-bottom)); }

.ts-top { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; margin-bottom: 12px; }
.ts-art { width: 132px; height: 132px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.ts-art svg { width: 100%; height: 100%; }
.ts-art img { width: 100%; height: 100%; object-fit: cover; }
.ts-name { font: 600 24px/1.15 var(--serif); margin: 0; }
.ts-sub { color: var(--dim); margin: 2px 0 6px; font-size: 14px; }
.ts-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ts-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ts-actions .btn { min-height: 54px; font-size: 16.5px; }
.ts-actions .wide { grid-column: 1 / -1; }
.ts-actions label.btn { position: relative; }
.ts-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.facts { margin: 8px 0; padding: 0; list-style: none; font-size: 14px; }
.facts li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.facts li span:first-child { color: var(--dim); }
.caption { font-size: 12px; color: var(--dim); font-style: italic; }

.field { display: block; font-size: 13.5px; color: var(--dim); margin-bottom: 12px; }
.field input, .field select, .field textarea, .row input[type=text] {
  display: block; width: 100%; margin-top: 4px; min-height: var(--tap); padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 17px;
}
.field textarea { min-height: 84px; resize: vertical; }
.grid2, .grid3 { display: grid; gap: 10px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 380px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.photo-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.photo-row img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.photo-btns { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.stepper { display: flex; align-items: center; margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.stepper button { width: var(--tap); height: var(--tap); border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--accent); }
.stepper output { flex: 1; text-align: center; font: 700 18px var(--round); color: var(--ink); }
.dup-hint, .dup-gate { border-radius: 12px; padding: 10px 12px; margin: -4px 0 12px; background: var(--wish-bg); color: var(--ink); font-size: 14.5px; }
.dup-gate { margin-top: 10px; border: 2px solid var(--wish); }
.gate-title { margin: 0 0 6px; font-weight: 700; color: var(--wish); }
.dup-gate ul { margin: 0 0 10px; padding-left: 0; list-style: none; }
.dup-gate li { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
.gate-btns { display: grid; gap: 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 8px; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips.small { flex-wrap: wrap; overflow: visible; margin-top: -4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 14px; }
.card h3 { margin: 0 0 6px; font: 600 17px var(--serif); }
.muted { color: var(--dim); font-size: 13.5px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.row input[type=text] { flex: 1; min-width: 140px; margin-top: 0; }
.preset { margin-bottom: 12px; }
.preset .ph { display: flex; justify-content: space-between; align-items: center; }
.preset textarea { width: 100%; min-height: 100px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px; font-size: 15px; }
fieldset.card { border: 1px solid var(--line); }
legend { font-weight: 700; padding: 0 4px; }
.radio, .toggle { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.radio input, .toggle input, .checks input { width: 22px; height: 22px; accent-color: var(--stamp); flex: none; }
.checks { display: grid; gap: 2px; margin: 4px 0 8px; }
.checks label { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; }
.import-summary { padding-left: 18px; }
.about p { font-size: 14px; }

.migrate-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.migrate-list li { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: start; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.migrate-list input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--stamp); }
.migrate-list .from { font-weight: 650; }
.migrate-list .to { color: var(--dim); font-size: 14px; }
.migrate-list .conf { font: 800 10.5px var(--round); text-transform: uppercase; padding: 2px 6px; border-radius: 6px; margin-left: 6px; background: var(--line); }
.migrate-list .conf.exact { background: var(--owned-bg); color: var(--owned); }
.migrate-list .conf.likely { background: var(--wish-bg); color: var(--wish); }

.onboard { text-align: center; }
.onboard-art { display: flex; justify-content: center; gap: 4px; margin: 6px 0 0; }
.onboard-art svg { width: 84px; height: 84px; }
.onboard h3 { font: 600 26px var(--serif); margin: 6px 0; }
.onboard .checks { text-align: left; max-width: 320px; margin: 0 auto; }

pre.swap { white-space: pre-wrap; font: 14px/1.5 ui-monospace, Menlo, monospace; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 80px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 14px; font-size: 15px; max-width: 92vw;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5);
}
.toast-btn { border: 0; background: transparent; color: var(--bg); font-weight: 800; text-decoration: underline; min-height: 36px; padding: 0 6px; cursor: pointer; }

/* ---------- map (v0.3) ---------- */
.map-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.map-head select { min-height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 10px; max-width: 48%; }
.map-wrap { position: relative; width: 100%; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.map-wrap svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.map-wrap .rg { stroke: var(--bg); stroke-width: .7; cursor: pointer; transition: fill .3s; }
.map-wrap .rg.c0 { fill: color-mix(in srgb, var(--ink) 8%, var(--card)); }
.map-wrap .rg.cn { fill: color-mix(in srgb, var(--ink) 4%, var(--card)); cursor: default; }
.map-wrap .rg.c1 { fill: color-mix(in srgb, var(--stamp) 30%, var(--card)); }
.map-wrap .rg.c2 { fill: color-mix(in srgb, var(--stamp) 62%, var(--card)); }
.map-wrap .rg.c3 { fill: var(--gold); }
.map-wrap .rg.sel { stroke: var(--ink); stroke-width: 2; }
.map-wrap .pin { stroke: var(--card); stroke-width: 1.2; }
.map-wrap .pin.have { fill: var(--owned); }
.map-wrap .pin.miss { fill: var(--none); fill-opacity: .55; }
.map-wrap .pin.coming { fill: var(--dim); fill-opacity: .5; }
.map-wrap .sphere { fill: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.map-legend { font-size: 12.5px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 2px; }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.lg0 { background: color-mix(in srgb, var(--ink) 8%, var(--card)); } .lg1 { background: color-mix(in srgb, var(--stamp) 30%, var(--card)); }
.lg2 { background: color-mix(in srgb, var(--stamp) 62%, var(--card)); } .lg3 { background: var(--gold); }
.lgh { background: var(--owned); border-radius: 50% !important; } .lgm { background: var(--none); opacity: .55; border-radius: 50% !important; }
.region-list h3 { font: 600 20px var(--serif); margin: 14px 2px 6px; }
.rl { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rl li { display: grid; grid-template-columns: 44px 1fr; gap: 6px 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.rl .rl-t { display: block; text-align: left; padding: 0; min-height: 0; color: var(--ink); font-size: inherit; }
.rl .rl-art { width: 44px; height: 44px; }
.rl .rl-art svg, .rl .rl-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.rl .rl-t b { display: block; font-size: 15px; }
.rl .rl-t span { font-size: 12.5px; color: var(--dim); }
.rl .rl-links { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.rl .rl-links a, .rl .rl-links button { font-size: 12.5px; min-height: 34px; padding: 0 9px; }

/* ---------- globe (v0.4) ---------- */
.globe-wrap { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1; margin: 0 auto; }
.globe-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.globe-ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.section-title { font: 600 20px var(--serif); margin: 16px 2px 8px; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.badges li { padding: 10px 12px; border-radius: 14px; border: 1.5px dashed var(--line); background: var(--card); }
.badges li b { display: block; font: 600 15.5px var(--serif); }
.badges li span { font-size: 12.5px; color: var(--dim); }
.badges li .prog { display: block; height: 5px; border-radius: 3px; background: var(--ring-track); margin-top: 6px; overflow: hidden; }
.badges li .prog i { display: block; height: 100%; background: var(--stamp); border-radius: 3px; }
.badges li.got { border-style: solid; border-color: var(--gold); }
.badges li.got b::before { content: "\2605  "; color: var(--gold); }
