/* EeveeDex — one layout for the computer (sidebar) and the phone (tab bar, full-screen sheets). */

:root {
  /* The colours the user can change (Réglages → Couleurs) are set on <html> by theme.js; these are the defaults. */
  --eevee: rgb(184 128 77);
  --accent: #76a8f4;
  --accent-tint: rgb(118 168 244 / 0.18);
  --gradient: linear-gradient(135deg, #76e7f4, #76a8f4, #8376f4);
  --on-accent: #10204a;
  /* Main colour used as text: darkened when it is light (theme.js), as is in dark mode. */
  --accent-ink: var(--accent-ink-light, color-mix(in srgb, #76a8f4 62%, #0b1636));
  --tint: #76a8f4;
  --green: #2fb350;
  --pink: #e5484d;
  --binder-cover: #76a8f4;
  --deck-cover: #8376f4;
  /* Neutral greys, lightly tinted with the theme's background colour. */
  --bg-base: #f5f6f8;
  --sidebar-base: #eceef2;
  --bg: color-mix(in srgb, var(--tint) 5%, var(--bg-base));
  --sidebar: color-mix(in srgb, var(--tint) 7%, var(--sidebar-base));
  --surface: #ffffff;
  --surface-2: color-mix(in srgb, var(--tint) 4%, #edeef1);
  --text: #1a1c21;
  --secondary: #676c76;
  --tertiary: #9da1aa;
  --border: rgb(0 0 0 / 0.08);
  --red: #e0383e;
  --teal: #2aa7b8;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.14);
  --header-h: 120px;
  --sidebar-w: 240px;
  --tabbar-h: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-base: #131518;
    --sidebar-base: #181a1e;
    --bg: color-mix(in srgb, var(--tint) 6%, var(--bg-base));
    --sidebar: color-mix(in srgb, var(--tint) 8%, var(--sidebar-base));
    --surface: color-mix(in srgb, var(--tint) 4%, #1f2125);
    --surface-2: color-mix(in srgb, var(--tint) 6%, #2a2d32);
    --text: #f1f2f4;
    --secondary: #a3a7ae;
    --tertiary: #6c7078;
    --border: rgb(255 255 255 / 0.09);
    --accent-ink: var(--accent);
    --shadow: 0 10px 30px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: 0.4; }
a { color: var(--accent-ink); }
img { display: block; }

.secondary { color: var(--secondary); }
.tertiary { color: var(--tertiary); }
.caption { font-size: 12px; }
.nums { font-variant-numeric: tabular-nums; }
.center { text-align: center; justify-content: center; }
.spacer { flex: 1; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.block { display: block; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.green { color: var(--green); }
.teal { color: var(--teal); }
.big { font-size: 18px; font-weight: 700; }
.warning { color: #d97706; font-weight: 500; }
.stack > * + * { margin-top: 28px; }

/* MARK: Layout */

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 10px calc(12px + env(safe-area-inset-bottom));
  background: var(--sidebar); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; padding: 4px 8px 10px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary); padding: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.nav-item:hover { background: rgb(128 128 128 / 0.1); }
.nav-item.on { background: var(--accent-tint); font-weight: 600; }
.nav-icon { display: inline-flex; color: var(--secondary); }
.nav-icon.eevee { color: var(--accent-ink); }
.nav-icon.collection { color: var(--teal); }
.nav-icon.wishlist { color: var(--pink); }
.nav-short { display: none; }
.nav-count { margin-left: auto; font-size: 12px; color: var(--secondary); }
.tabbar { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.banner-warning { padding: 8px 24px; background: rgb(245 158 11 / 0.15); font-size: 13px; }

.page-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: calc(14px + env(safe-area-inset-top)) 24px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.page-title { flex: 1 1 260px; min-width: 0; }
.page-title h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.page-title p { font-size: 13px; }
.search-field {
  flex: 0 1 340px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--secondary);
}
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field .clear { display: inline-flex; padding: 4px; border-radius: 50%; background: var(--tertiary); color: var(--surface); }
.toolbar { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.content { padding: 20px 24px 40px; }

@media (max-width: 799px), (max-height: 560px) {
  :root { --tabbar-h: 56px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 19; /* below the header, whose filter sheets must cover it */
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
  }
  .tabbar .nav-item { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 0; border-radius: 0; font-size: 10px; font-weight: 500; color: var(--secondary); text-align: center; }
  .tabbar .nav-item:hover { background: none; }
  .tabbar .nav-item.on { background: none; color: var(--accent-ink); font-weight: 600; }
  .tabbar .nav-item.on .nav-icon { color: var(--accent-ink); }
  .tabbar .nav-title, .tabbar .nav-count { display: none; }
  .tabbar .nav-short { display: block; }
  .tabbar .icon { width: 22px; height: 22px; }

  .page-header { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; gap: 8px; }
  .page-title h1 { font-size: 26px; }
  .search-field { flex: 1 0 100%; }
  /* One scrolling row of filters instead of several lines. */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  .content { padding: 14px 16px 32px; }
  .banner-warning { padding: 8px 16px; }
  .hide-narrow { display: none; }
}

/* MARK: Controls */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; border-radius: 9px;
  background: var(--surface-2); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text);
}
.button:hover:not(:disabled) { filter: brightness(0.96); }
.button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.button.active { background: var(--accent-tint); color: var(--accent-ink); }
.button.danger { color: var(--red); }
.button.pink { color: var(--pink); }
.button.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.button.wide { width: 100%; }
.button .ellipsis { max-width: 180px; }
.link { color: var(--accent-ink); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.link.small { font-size: 13px; }

.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); flex: none; }
.icon-button.danger { color: var(--red); background: none; }

.segmented { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--surface-2); }
.segmented button { padding: 5px 11px; border-radius: 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.segmented button.on { background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); font-weight: 600; }

/* A label over an invisible native select: the device shows its own picker. */
.select-button { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; min-height: 28px; border-radius: 7px; background: var(--surface-2); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.select-button.button { min-height: 34px; padding: 6px 12px; font-size: 14px; font-weight: 500; border-radius: 9px; }
.select-button::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); opacity: 0.6; }
.select-button select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }

select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 30px 7px 10px; border-radius: 8px; border: 1px solid var(--border); background-color: var(--surface-2);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
  font-size: 15px; max-width: 100%;
}
.text-field { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 16px; outline: none; }

.stepper { display: inline-flex; align-items: center; border-radius: 8px; background: var(--surface-2); }
.stepper button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; }
.stepper-value { min-width: 30px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background 0.2s; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.2s; }
input.switch:checked { background: var(--green); }
input.switch:checked::after { transform: translateX(18px); }

.progress { height: 6px; border-radius: 3px; background: rgb(128 128 128 / 0.2); overflow: hidden; }
.progress > div { height: 100%; border-radius: 3px; background: var(--bar, var(--accent)); transition: width 0.3s; }
.progress.wide { width: 260px; max-width: 80vw; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgb(128 128 128 / 0.25); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner.small { width: 20px; height: 20px; border-width: 2px; }
.spinner.tiny { display: inline-block; width: 14px; height: 14px; border-width: 2px; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* MARK: Popover (dropdown on a computer, bottom sheet on a phone) */

.popover-anchor { position: relative; }
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  width: 330px; max-height: min(70vh, 520px); overflow-y: auto;
  padding: 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.group-card .popover { left: auto; right: 0; width: 260px; }
.popover-backdrop, .popover-done { display: none; }
.popover-head { display: flex; align-items: center; justify-content: space-between; }
.menu { display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 8px; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--red); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.type-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; font-weight: 500; text-align: left; }
.type-pill.on { background: var(--type); color: #fff; }
.check-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.check-row .ellipsis { flex: 1; }

@media (max-width: 799px), (max-height: 560px) {
  .popover-backdrop { display: block; position: fixed; inset: 0; z-index: 49; background: rgb(0 0 0 / 0.35); }
  .popover, .group-card .popover {
    position: fixed; inset: auto 0 0 0; top: auto; width: auto; max-height: 78vh;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0;
    animation: rise 0.2s ease-out;
  }
  .popover-done { display: inline-flex; margin-top: 4px; }
  .menu button { padding: 13px 8px; font-size: 16px; }
  .check-list { max-height: none; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* MARK: Cards */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 16px; }
@media (max-width: 799px), (max-height: 560px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; } }

.card-image { position: relative; aspect-ratio: 63 / 88; overflow: hidden; background: linear-gradient(rgb(128 128 128 / 0.18), rgb(128 128 128 / 0.08)); }
.card-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.2s; }
.card-image img.loaded { opacity: 1; }
.card-image .spinner { position: absolute; top: calc(50% - 10px); left: calc(50% - 10px); }
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; color: var(--secondary); font-size: 11px; text-align: center; }

.tile { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.tile-image { position: relative; cursor: pointer; border-radius: 8px; transition: transform 0.15s ease-out, box-shadow 0.15s; box-shadow: 0 2px 6px rgb(0 0 0 / 0.12); }
.tile-image.owned { box-shadow: 0 0 0 3px var(--green), 0 2px 6px rgb(0 0 0 / 0.12); }
.tile-badge { position: absolute; top: 6px; right: 6px; }
.tile-heart { position: absolute; top: 6px; left: 6px; opacity: 0; transition: opacity 0.15s; }
.tile-heart.pinned { opacity: 1; }
@media (hover: hover) {
  .tile:hover .tile-image { transform: scale(1.02); box-shadow: 0 6px 16px rgb(0 0 0 / 0.25); }
  .tile:hover .tile-image.owned { box-shadow: 0 0 0 3px var(--green), 0 6px 16px rgb(0 0 0 / 0.25); }
  .tile:hover .tile-heart { opacity: 1; }
}
/* No hover on a phone: the heart is always there. */
@media (hover: none) { .tile-heart { opacity: 1; } }
.tile-text { min-width: 0; }
.tile-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-set { font-size: 11px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-actions { display: flex; align-items: center; gap: 5px; }

.owned-badge { display: inline-flex; align-items: center; gap: 2px; padding: 3px 7px; border-radius: 999px; background: var(--green); color: #fff; font-size: 11px; font-weight: 800; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
.not-owned-badge { display: block; width: 17px; height: 17px; border-radius: 50%; border: 2px dashed rgb(255 255 255 / 0.95); filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.6)); }
.heart-button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: rgb(0 0 0 / 0.42); color: #fff; }
.heart-button.on { color: var(--pink); }
.member-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: color-mix(in srgb, var(--member) 70%, var(--text)); background: color-mix(in srgb, var(--member) 18%, transparent); }
.member-dot { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; }

/* MARK: Eevee catalog */

.eevee-banner { padding: 20px; border-radius: 18px; background: var(--gradient); color: #fff; text-shadow: 0 1px 3px rgb(10 20 60 / 0.35); display: flex; flex-direction: column; gap: 14px; }
.banner-top { display: flex; align-items: flex-start; gap: 16px; }
.banner-top > div:first-child { flex: 1; }
.eevee-banner h2 { font-size: 28px; font-weight: 800; }
.eevee-banner p { color: rgb(255 255 255 / 0.88); margin-top: 4px; }
.banner-score { text-align: right; display: flex; flex-direction: column; }
.banner-score strong { font-size: 34px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.banner-score span { font-size: 14px; color: rgb(255 255 255 / 0.88); }
.eevee-banner .progress { background: rgb(255 255 255 / 0.3); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: rgb(255 255 255 / 0.2); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: #fff; color: rgb(0 0 0 / 0.8); }
.chip-detail { opacity: 0.75; font-variant-numeric: tabular-nums; font-weight: 500; }
@media (max-width: 799px), (max-height: 560px) {
  .eevee-banner { padding: 16px; border-radius: 16px; }
  .eevee-banner h2 { font-size: 22px; }
  .eevee-banner p { display: none; }
  .banner-score strong { font-size: 26px; }
  .chips { margin: 0 -16px; padding: 0 16px; }
}

.member-section { margin-top: 18px; }
.section-header {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border);
}
.section-header.sticky { position: sticky; top: var(--header-h); z-index: 10; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.section-header h3 { font-size: 19px; font-weight: 700; }
.section-progress { width: 140px; }
@media (max-width: 799px), (max-height: 560px) {
  .section-header h3 { font-size: 16px; }
  .section-header .secondary { font-size: 13px; }
  .section-progress { width: 56px; }
}
.floating-status { position: fixed; left: 50%; bottom: calc(20px + var(--tabbar-h) + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; z-index: 25; }

/* MARK: Other Pokémon */

.set-list { display: flex; flex-direction: column; gap: 8px; }
.set-row { scroll-margin-top: calc(var(--header-h) + 8px); }
.set-banner { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); text-align: left; }
.set-banner.expanded { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.set-banner .chevron { display: inline-flex; color: var(--secondary); transition: transform 0.15s; }
.set-banner.expanded .chevron { transform: rotate(90deg); }
.set-logo { flex: none; width: 96px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--tertiary); }
.set-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.set-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-name strong { font-size: 15px; }
.set-name small { font-size: 12px; }
.owned-count { color: var(--green); font-size: 14px; font-weight: 600; white-space: nowrap; }
.set-cards { padding: 12px 0 16px; }
.search-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-summary .type-pill { padding: 4px 10px; border-radius: 999px; }
@media (max-width: 799px), (max-height: 560px) {
  .set-banner { gap: 10px; padding: 10px; }
  .set-logo { width: 64px; height: 28px; }
  .set-name strong { font-size: 14px; }
  .owned-count { font-size: 12px; }
}

/* MARK: Collection */

.tile-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.stats { display: flex; flex-direction: column; gap: 16px; }
.stats-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ring-box { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring-box h3 { font-size: 15px; }
.ring { position: relative; flex: none; width: 120px; height: 120px; border-radius: 50%; background: rgb(128 128 128 / 0.15); }
.ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ring);
  -webkit-mask: conic-gradient(#000 var(--done), transparent 0); mask: conic-gradient(#000 var(--done), transparent 0); }
.ring-center { position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center strong { font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring-center small { font-size: 11px; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-tile { display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 58px; }
.stat-tile strong { display: block; font-size: 17px; }
.stat-tile small { display: block; font-size: 12px; }
.member-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.member-stat { display: flex; align-items: center; gap: 10px; padding: 10px; }
.member-stat .row { margin-bottom: 4px; }
.member-stat strong { font-size: 14px; }
.breakdowns { display: flex; flex-wrap: wrap; gap: 16px 28px; }
.overline { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary); margin-bottom: 6px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; white-space: nowrap; }
@media (max-width: 799px), (max-height: 560px) {
  .stats-top { grid-template-columns: 1fr; }
  .ring { width: 104px; height: 104px; }
  .ring-center { inset: 12px; }
  .stat-tile strong { font-size: 15px; }
  .member-stats { grid-template-columns: 1fr 1fr; }
  .member-stat .member-dot { width: 24px; height: 24px; font-size: 12px; }
}

.highlight-section {
  padding: 20px; border-radius: 22px; border: 2px solid transparent;
  background:
    linear-gradient(color-mix(in srgb, var(--bg) 86%, transparent), color-mix(in srgb, var(--bg) 86%, transparent)) padding-box,
    var(--gradient) padding-box,
    var(--gradient) border-box;
}
.collection-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.collection-heading h2 { font-size: 26px; font-weight: 800; }
.collection-heading h2.small { font-size: 21px; font-weight: 700; }
.gradient-dot { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--gradient); color: #fff; flex: none; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 14px; align-items: start; }
.group-card { display: flex; gap: 14px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.group-card[style*="--highlight"] { border: 1.5px solid color-mix(in srgb, var(--highlight) 60%, transparent); }
.group-image { position: relative; flex: none; width: 92px; cursor: pointer; align-self: flex-start; border-radius: 6px; box-shadow: 0 1px 4px rgb(0 0 0 / 0.15); }
.visual-note { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); padding: 2px 5px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 9px; font-weight: 600; white-space: nowrap; }
.group-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.group-body > .link { align-self: flex-start; }
.group-body strong.block { font-size: 15px; }
.group-body small { font-size: 12px; }
.group-body .popover-anchor > .button { min-height: 30px; padding: 4px 8px; }
.entry-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
@media (max-width: 799px), (max-height: 560px) {
  .highlight-section { padding: 14px; border-radius: 18px; margin: 0 -4px; }
  .collection-heading h2 { font-size: 22px; }
  .group-card { gap: 10px; padding: 10px; }
  .group-image { width: 78px; }
}

/* MARK: Sheets (card details, settings) */

.sheet-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgb(0 0 0 / 0.42); animation: fade 0.15s ease-out; }
.sheet { position: relative; width: min(940px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; border-radius: 18px; background: var(--bg); box-shadow: var(--shadow); }
.sheet.narrow { width: min(540px, 100%); }
.sheet-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg); }
.sheet-bar h2 { font-size: 19px; font-weight: 700; }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 799px), (max-height: 560px) {
  .sheet-backdrop { padding: 0; align-items: stretch; }
  .sheet, .sheet.narrow { width: 100%; max-height: none; border-radius: 0; animation: rise 0.22s ease-out; }
  .sheet-bar { padding: calc(8px + env(safe-area-inset-top)) 16px 8px; border-bottom: 1px solid var(--border); }
}

.detail { display: grid; grid-template-columns: 330px 1fr; gap: 28px; padding: 0 24px 28px; }
.detail-visual { display: flex; flex-direction: column; gap: 10px; }
.detail-image { position: relative; border-radius: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
.detail-image.drop { outline: 4px dashed var(--accent); outline-offset: 4px; }
.custom-note { position: absolute; top: 10px; left: 10px; padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 12px; font-weight: 600; }
.language-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; }
.lang-button { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 40px; height: 44px; border-radius: 8px; border: 1px solid var(--border); }
.lang-button .flag { font-size: 18px; line-height: 1.1; }
.lang-button .code { font-size: 9px; font-weight: 800; }
.lang-button.on { background: var(--accent-tint); border-color: var(--accent); }
.lang-button.dim { opacity: 0.55; }
.lang-button:disabled { opacity: 0.28; }
.detail-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-name { font-size: 30px; font-weight: 800; line-height: 1.15; user-select: text; }
.detail-set { font-size: 17px; margin-top: -10px; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; }
.info-grid dt { color: var(--secondary); }
.info-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; user-select: text; }
.group-box { padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.group-box-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.owned-section { display: flex; flex-direction: column; gap: 10px; }
.owned-section h3 { font-size: 17px; }
.add-form { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--secondary); }
.prices { display: flex; flex-direction: column; gap: 16px; }
.owned-value { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.source-header { margin-bottom: 6px; }
.headline-prices { gap: 24px; margin-bottom: 8px; }
.headline-price { font-size: 22px; font-weight: 800; }
.price-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.price-table th { text-align: left; font-weight: 400; color: var(--secondary); padding: 3px 0; }
.price-table thead th { font-size: 12px; font-weight: 600; text-align: right; }
.price-table td { text-align: right; padding: 3px 0 3px 12px; white-space: nowrap; }
@media (max-width: 799px), (max-height: 560px) {
  .detail { grid-template-columns: 1fr; gap: 20px; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
  .detail-image { width: min(300px, 78vw); margin: 0 auto; }
  .detail-name { font-size: 26px; }
  .add-form .field:first-child, .add-form .field:nth-child(2) { flex: 1 1 140px; }
}

.form { padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.form .overline { margin: 12px 4px 0; }
.form-group { border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; min-height: 50px; }
.form-row + .form-row { border-top: 1px solid var(--border); }
.form-row > span { flex: 1; }
.form-row select { max-width: 55%; }
.form .caption { margin: 6px 4px 0; }

/* MARK: States */

.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; padding: 40px 20px; text-align: center; }
.state.compact { min-height: 120px; padding: 20px; }
.state h3 { font-size: 19px; }
.state p { max-width: 460px; }
p.empty-note { padding: 24px; text-align: center; }

/* MARK: Copies, quick add, More */

.location-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--secondary); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.location-pill.bulk { color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.location-pill.wishlist { color: var(--pink); background: color-mix(in srgb, var(--pink) 14%, transparent); }
.location-pill.binder, .location-pill.deck { color: var(--accent-ink); background: var(--accent-tint); }
.entry-row.wanted > :not(.got-it):not(.icon-button):not(.owned-toggle) { opacity: 0.6; }
.got-it { color: var(--green); }
/* A card the user doesn't have yet is shown greyed. */
.group-card.wanted .group-image { filter: grayscale(1); opacity: 0.55; }
.entry-row > .stepper-value { padding: 0 6px; }

.add-sheet-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.add-card-summary { display: flex; align-items: center; gap: 12px; }
.add-thumb { width: 64px; flex: none; }
.add-form-wrap { display: flex; flex-direction: column; gap: 12px; }
.add-form .field { flex: 1 1 140px; }
.add-form .field select { width: 100%; }
.owned-check { align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.owned-check input { margin-top: 2px; }
.owned-check small { font-size: 12px; }

.only-phone { display: none; }
.catalog-switch { flex: 1 0 100%; }
.catalog-switch button { flex: 1; }

.more-list { overflow: hidden; }
.more-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; text-align: left; font-size: 16px; }
.more-row + .more-row { border-top: 1px solid var(--border); }
.more-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--secondary); }
.more-icon.teal { color: #fff; background: var(--teal); }
.more-icon.pink { color: #fff; background: var(--pink); }

@media (max-width: 799px), (max-height: 560px) {
  .only-phone { display: inline-flex; }
  /* The quick add sheet slides up from the bottom instead of covering the screen. */
  .sheet-backdrop.small-sheet { align-items: flex-end; }
  .small-sheet .sheet { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .small-sheet .sheet-bar { padding-top: 12px; }
  .add-sheet-body { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }
  .location-pill { max-width: 130px; }
}

/* MARK: Binders */

img.pixel { image-rendering: pixelated; }
.icon.flip { transform: scaleX(-1); }
.icon.up { transform: rotate(-90deg); }
.icon.down { transform: rotate(90deg); }

.binder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.binder-card { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: transform 0.15s, box-shadow 0.15s; }
@media (hover: hover) { .binder-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); } }
.binder-cover { position: relative; height: 150px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--binder-cover) 70%, #fff), var(--binder-cover) 55%, color-mix(in srgb, var(--binder-cover) 70%, #000)); }
.kind-eeveelutions .binder-cover { background: var(--gradient); }
.kind-pokedex .binder-cover { background: linear-gradient(180deg, #e3363b 0 50%, #f4f4f4 50%); }
.binder-icon img { width: 84px; height: 84px; }
.binder-icon { color: #fff; }
.cover-card { position: absolute; width: 78px; top: 22px; box-shadow: 0 4px 12px rgb(0 0 0 / 0.3); border-radius: 5px; }
.cover-card.c0 { transform: rotate(-10deg) translateX(-62px); }
.cover-card.c1 { transform: translateY(-6px); z-index: 1; }
.cover-card.c2 { transform: rotate(10deg) translateX(62px); }
.cover-card.wanted, .add-thumb.wanted { filter: grayscale(1); opacity: 0.6; }
.binder-info { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.binder-info strong { font-size: 16px; }
.binder-info small { font-size: 12px; }

.back-link { flex: 1 0 100%; font-size: 14px; }
.jump-field { display: flex; gap: 6px; }
.jump-field input { width: 120px; padding: 6px 10px; }
.binder-content { padding-top: 16px; }
.spread-nav { display: flex; align-items: center; gap: 12px; }
.icon-button.big { width: 40px; height: 40px; border-radius: 50%; }
.spread { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; justify-items: center; align-items: start; }
.spread.single { grid-template-columns: 1fr; }
.page-counter { margin-top: 10px; }

.binder-page {
  /* As large as possible while the whole page stays on screen. */
  width: min(100%, calc((100dvh - var(--header-h) - 150px) * var(--cols) * 0.716 / var(--rows)));
  padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.08); border-top: 4px solid var(--section, var(--border));
}
.binder-page-head { display: flex; align-items: center; gap: 6px; min-height: 30px; margin-bottom: 8px; }
.binder-page-head .popover-anchor > .button { min-height: 28px; padding: 3px 8px; }
.binder-page-head .popover { left: auto; right: 0; width: 280px; }
.section-tab { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--section, var(--accent)) 18%, transparent); color: color-mix(in srgb, var(--section, var(--accent)) 75%, var(--text)); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-tab.first { background: var(--section, var(--accent)); color: #fff; }
.slots { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; }

.slot { position: relative; aspect-ratio: 63 / 88; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.slot.empty { border: 1.5px dashed color-mix(in srgb, var(--text) 22%, transparent); background: color-mix(in srgb, var(--surface-2) 60%, transparent); color: var(--tertiary); }
@media (hover: hover) { .slot.empty:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-tint); } }
.slot-sprite { width: 72%; opacity: 0.32; }
.slot-name { position: absolute; left: 3px; right: 3px; bottom: 4px; font-size: 10px; line-height: 1.2; color: var(--secondary); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-name b { display: block; font-weight: 600; color: var(--tertiary); }
.slot.filled .card-image { width: 100%; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
.slot.filled.wanted .card-image, .slot.filled.wanted .slot-text { filter: grayscale(1); opacity: 0.5; }
.slot-text { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; padding: 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; overflow: hidden; }
.slot-text .slot-sprite { position: absolute; top: 12%; left: 14%; }
.slot-text strong { position: relative; font-size: 11px; line-height: 1.2; }
.slot-text small { position: relative; font-size: 9px; color: var(--secondary); }
.wanted-badge { position: absolute; top: 4px; left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--pink); color: #fff; font-size: 9px; font-weight: 700; }
.reserved-badge { position: absolute; bottom: 4px; left: 4px; display: flex; align-items: center; padding-right: 5px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }
.reserved-badge img { width: 22px; height: 22px; }
.reserved-badge small { font-size: 9px; font-weight: 700; color: var(--secondary); }
.slot.drop-target { outline: 2px dashed var(--accent); outline-offset: 1px; }
.slot.over { outline: 3px solid var(--accent); }
.slot.is-moving { opacity: 0.35; }
.moving-bar {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--tabbar-h) + env(safe-area-inset-bottom));
  width: min(560px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); font-weight: 600; font-size: 14px;
}
.moving-bar .button { background: rgb(255 255 255 / 0.3); color: inherit; }

.grid-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.grid-preset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1.5px solid transparent; font-size: 12px; font-weight: 600; }
.grid-preset.on, .grid-custom.on { border-color: var(--accent); background: var(--accent-tint); }
.grid-preview { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 2px; width: calc(var(--cols) * 9px); }
.grid-preview i { aspect-ratio: 63 / 88; border-radius: 1px; background: var(--tertiary); }
.grid-custom { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1.5px solid transparent; font-size: 13px; }
.small-number { width: 54px; padding: 5px 6px; text-align: center; }
.section-list { display: flex; flex-direction: column; gap: 4px; }
.section-row { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.section-row .icon-button { width: 28px; height: 28px; }

.picker { padding: 0 20px 20px; }
.picker-tabs { width: 100%; }
.picker-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.picker-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.picker-body > .link { align-self: flex-start; }
.picker-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-controls .search-field { flex: 1 1 220px; }
.picker-hint { padding: 20px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.picker-card { position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0; }
.picker-card strong { font-size: 13px; }
.picker-card small { font-size: 11px; }
.owned-badge.small { position: absolute; top: 4px; right: 4px; font-size: 10px; padding: 2px 6px; }
.tiny-sprite { width: 30px; height: 30px; margin: -6px 0; }
.ask-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--accent-tint); }
.menu.boxed { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.add-sheet-body .location-pill { margin-top: 6px; }

@media (max-width: 799px), (max-height: 560px) {
  .binder-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .binder-cover { height: 110px; }
  .cover-card { width: 58px; top: 16px; }
  .cover-card.c0 { transform: rotate(-10deg) translateX(-44px); }
  .cover-card.c2 { transform: rotate(10deg) translateX(44px); }
  .binder-icon img { width: 64px; height: 64px; }
  .binder-content { padding: 10px 10px 32px; }
  /* Swipe between pages; the arrows sit below the page. */
  .spread-nav { flex-wrap: wrap; justify-content: center; gap: 10px 40px; }
  .spread { order: -1; flex: 1 0 100%; grid-template-columns: 1fr; }
  .binder-page { width: 100%; padding: 8px; }
  .slots { gap: 5px; }
  .slot-name { font-size: 9px; }
  .picker { padding: 0 16px calc(20px + env(safe-area-inset-bottom)); }
  .picker-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .jump-field input { width: 100px; }
}

/* A phone held sideways: little height, so the header scrolls away and a binder page fits the screen. */
@media (max-height: 560px) {
  .page-header { position: static; }
  .section-header.sticky { top: 0; }
  .binder-page { width: min(100%, calc((100dvh - var(--tabbar-h) - env(safe-area-inset-bottom) - 64px) * var(--cols) * 0.716 / var(--rows))); }
  .spread { justify-items: center; }
}

/* MARK: Decks */

.kind-deck .binder-cover { background: linear-gradient(135deg, color-mix(in srgb, var(--deck-cover) 70%, #fff), var(--deck-cover) 55%, color-mix(in srgb, var(--deck-cover) 70%, #000)); }
.kind-deck .binder-icon { color: #fff; }
.deck-content { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.deck-counter { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.deck-counter > strong { font-size: 30px; font-weight: 900; }
.deck-counter > strong span { font-size: 18px; font-weight: 600; }
.deck-counter small { display: block; margin-top: 6px; font-size: 12px; }
.deck-section h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.deck-rows { display: flex; flex-direction: column; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.deck-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.deck-row + .deck-row { border-top: 1px solid var(--border); }
.deck-row strong { font-size: 15px; }
.deck-row small { font-size: 12px; }
.deck-row.wanted .deck-thumb, .deck-row.wanted strong { opacity: 0.55; }
.deck-row.wanted .deck-thumb { filter: grayscale(1); }
.deck-thumb { width: 46px; flex: none; border-radius: 4px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); }
.deck-row .got-it { margin-top: 2px; }

.choice-sheet { z-index: 120; }
.choice-body { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.choice-body h2 { font-size: 19px; }
@media (max-width: 799px), (max-height: 560px) {
  .choice-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .deck-counter > strong { font-size: 26px; }
}

/* MARK: Card recognition */

.recognizer { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.scan-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-tint); font-size: 13px; }
.scan-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scan-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; color: var(--accent); }
.scan-choice strong { color: var(--text); font-size: 15px; }
.scan-choice small { font-size: 12px; }
@media (hover: hover) { .scan-choice:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-tint); } }

.camera { display: flex; flex-direction: column; gap: 10px; }
.camera-box { position: relative; height: min(62vh, 560px); border-radius: 14px; overflow: hidden; background: #000; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The card-shaped frame (same maths as frameIn: 80 % of the height, or of the width), the rest dimmed. */
.camera-frame { position: absolute; top: 50%; left: 50%; height: min(80%, calc(80cqw / 0.716)); aspect-ratio: 63 / 88; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.45); pointer-events: none; }
.camera-box { container-type: size; }
.camera-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px #000; }
.live-match { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.live-match.sure { border-color: var(--green); }
.live-thumb { width: 36px; flex: none; }
.camera-actions { justify-content: space-between; }
.shutter { width: 66px; height: 66px; border-radius: 50%; background: #fff; border: 5px solid var(--accent); box-shadow: 0 2px 8px rgb(0 0 0 / 0.3); }
.shutter:active { transform: scale(0.94); }
.shutter-spacer { width: 80px; }

.photo-crop { display: flex; flex-direction: column; gap: 12px; }
.photo-box { position: relative; max-height: 60vh; max-width: 100%; margin: 0 auto; overflow: hidden; border-radius: 10px; touch-action: none; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.crop-frame { position: absolute; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.45); cursor: move; touch-action: none; }
.photo-crop input[type="range"] { width: 100%; accent-color: var(--accent); }

.scan-results { display: flex; flex-direction: column; gap: 10px; }
.results-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.picker-card.best .card-image { box-shadow: 0 0 0 3px var(--green); }
@media (max-width: 799px), (max-height: 560px) {
  .camera-box { height: 56vh; }
  .results-grid { grid-template-columns: repeat(3, 1fr); }
}
.set-badge { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 7px 2px 4px; border-radius: 6px; background: var(--accent-tint); color: var(--text); font-size: 12px; white-space: nowrap; overflow: hidden; }
.set-badge img { height: 16px; width: auto; max-width: 28px; object-fit: contain; }
.set-badge b { font-weight: 800; letter-spacing: 0.02em; color: var(--accent-ink); }
.set-badge.small { padding: 1px 5px 1px 3px; font-size: 11px; vertical-align: middle; }
.set-badge.small img { height: 13px; }
.picker-card .set-badge { align-self: flex-start; }

/* A card's copies: a read-only summary until the card is tapped. */
.group-card { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.group-card.editing { cursor: default; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@media (hover: hover) { .group-card:not(.editing):hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); } }
.copy-summary { display: flex; flex-direction: column; gap: 6px; }
.summary-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--secondary); }
.summary-line b { color: var(--text); }
.summary-line.wanted > span { opacity: 0.6; }

/* Set symbols (the small icon printed on the cards): easier to recognize than the set's name. */
.set-symbol-inline { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0; font-size: 12px; color: var(--secondary); vertical-align: middle; }
.set-symbol-inline img { flex: none; height: 16px; width: auto; max-width: 32px; object-fit: contain; }
.set-symbol-inline.large { font-size: 17px; gap: 8px; }
.set-symbol-inline.large img { height: 24px; max-width: 48px; }
.picker-card .set-symbol-inline { align-self: stretch; }
.group-body .set-symbol-inline, .deck-row .set-symbol-inline { display: flex; margin-top: 2px; }
.set-title { display: inline-flex; align-items: center; gap: 6px; }
.set-title img { height: 18px; width: auto; max-width: 36px; object-fit: contain; }
.owned-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--secondary); cursor: pointer; white-space: nowrap; }
.owned-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.owned-toggle.on { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.entry-row.wanted > .owned-toggle { opacity: 1; }
.deck-row .owned-toggle { margin-top: 4px; }
.deck-row.wanted .owned-toggle { opacity: 1; }
.page-label-field select { width: 100%; }
.page-label-field { margin-bottom: 4px; }
.reserve-form { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; }
.reserve-form label { display: inline-flex; align-items: center; gap: 6px; }
.reserve-form .small-number { width: 68px; }
.gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gen-option { display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); border: 1.5px solid transparent; font-size: 12px; cursor: pointer; }
.gen-option { border-left: 4px solid var(--gen); }
.gen-option.on { border-color: var(--gen); border-left-width: 4px; background: color-mix(in srgb, var(--gen) 14%, transparent); }
.gen-option input { margin: 2px 0 0; accent-color: var(--gen); }
.gen-option b { color: color-mix(in srgb, var(--gen) 80%, var(--text)); }
/* Pokédex slots: the generation's colour on the border, and its number in the corner. */
.slot.empty.reserved { border-color: color-mix(in srgb, var(--gen) 65%, transparent); background: color-mix(in srgb, var(--gen) 9%, var(--surface-2)); }
.slot.empty.reserved .slot-name b { color: color-mix(in srgb, var(--gen) 80%, var(--text)); }
.slot.filled.reserved { box-shadow: 0 0 0 2px var(--gen); }
.gen-option small { font-size: 10px; }

/* Colours */
.color-field { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.color-field input[type="color"] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
.color-row { align-items: center; }
.theme-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.theme-preset { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
@media (hover: hover) { .theme-preset:hover { transform: scale(1.1); } }

/* Card search: filter by set */
.edition-filter { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.edition-filter select { flex: 1; min-width: 0; max-width: 100%; }
.scan-others { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
/* Pokédex: a card that isn't the slot's Pokémon */
.wrong-badge { position: absolute; top: 4px; right: 4px; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: #f59e0b; color: #fff;
  font-size: 13px; font-weight: 900; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface), 0 1px 4px rgb(0 0 0 / 0.3); }
.slot.filled.reserved:has(.wrong-badge) { box-shadow: 0 0 0 2px #f59e0b; }

/* A card missing from the database, made by the user */
.custom-card-form { display: flex; flex-direction: column; gap: 12px; }
.custom-card-top { display: flex; gap: 14px; align-items: flex-start; }
.custom-photo { flex: none; width: 110px; cursor: pointer; }
.custom-photo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 63 / 88; border-radius: 8px;
  border: 1.5px dashed color-mix(in srgb, var(--text) 25%, transparent); color: var(--secondary); background: var(--surface-2); }
.custom-fields { grid-template-columns: 1fr; }
.custom-pokemon { display: flex; align-items: center; gap: 6px; font-size: 13px; min-height: 24px; }
.center-link { align-self: center; margin: 14px auto 4px; display: flex; }

/* MARK: Accounts (login, password, admin) */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; font-weight: 800; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; }
.auth-brand img { width: 44px; height: 44px; border-radius: 11px; }
.auth-tabs { display: flex; }
.auth-tabs button { flex: 1; }
.auth-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.auth-field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 500; }
.auth-field textarea { resize: vertical; font: inherit; }
.auth-notice { padding: 10px 12px; border-radius: 10px; background: var(--accent-tint); font-size: 14px; }
.auth-error { padding: 10px 12px; border-radius: 10px; background: rgb(229 72 77 / 0.12); color: var(--red); font-size: 14px; }
.form-row.block { display: block; }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.muted { background: var(--surface-2); color: var(--secondary); }
.admin { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.admin section { display: flex; flex-direction: column; gap: 10px; }
.admin .overline { display: flex; align-items: center; gap: 8px; }
.admin-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.admin-card.disabled { opacity: 0.65; }
.admin-card .form-group { background: var(--bg); }
.admin-fields select { max-width: 60%; }
.admin-message { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-actions select { max-width: 100%; }
.admin-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--accent-tint); }
.admin-secret code.secret { display: block; margin: 6px 0; font-size: 22px; font-weight: 700; letter-spacing: 0.04em; user-select: all; }
.narrow-field { max-width: 60%; }
.form-row > .badge { flex: none; }
