/* PokeQuota — full dark mode */
:root {
  --bg: #0a0a0f;
  --card: #14141c;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --link: #7dd3fc;
  --link-hover: #bae6fd;
  --accent: #14b8a6;
  --row-alt: #101018;
  --up-bg: #14532d; --up-fg: #86efac;
  --down-bg: #7f1d1d; --down-fg: #fca5a5;
  --flat-bg: #713f12; --flat-fg: #fde68a;
  --na-bg: #334155; --na-fg: #cbd5e1;
  --sell-bg: #7f1d1d; --sell-fg: #fca5a5;
  --hold-bg: #14532d; --hold-fg: #86efac;
  --watch-bg: #713f12; --watch-fg: #fde68a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background-color: #050508;
  background-image:
    radial-gradient(circle at 8% 18%, rgba(238, 21, 21, 0.22) 0 70px, transparent 71px),
    radial-gradient(circle at 8% 18%, transparent 0 28px, rgba(248, 250, 252, 0.08) 28px 31px, transparent 32px),
    radial-gradient(circle at 92% 70%, rgba(255, 203, 5, 0.16) 0 90px, transparent 91px),
    radial-gradient(circle at 70% 8%, rgba(59, 130, 246, 0.2) 0 120px, transparent 121px),
    linear-gradient(165deg, #050508 0%, #0a0a12 45%, #0b1020 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.wrap {
  max-width: min(1480px, 100%);
  width: 100%;
  margin: 0.55rem auto 0.55rem;
  padding: 0.7rem 0.85rem 1.75rem;
  background: rgba(15, 15, 22, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* Full-bleed dark Pokémon header with lightning backdrop */
header.site {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  color: #f8fafc;
  background-color: #050508;
  background-image:
    radial-gradient(circle at 8% 40%, rgba(255, 203, 5, 0.12) 0 80px, transparent 81px),
    radial-gradient(circle at 88% 55%, rgba(255, 203, 5, 0.1) 0 90px, transparent 91px),
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.18) 0 100px, transparent 101px),
    linear-gradient(115deg, #030305 0%, #0c0c14 42%, #0a1228 72%, #050508 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  position: relative;
  z-index: 2;
}
header.site::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("/assets/header-lightning.svg?v=20260928q") center / 100% 100% no-repeat;
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
}
header.site::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(5, 5, 8, 0.55) 0%,
    rgba(5, 5, 8, 0.2) 35%,
    rgba(5, 5, 8, 0.15) 65%,
    rgba(5, 5, 8, 0.45) 100%
  );
  pointer-events: none;
  z-index: 0;
}
header.site .header-inner {
  max-width: min(1480px, 100%);
  width: 100%;
  margin: 0 auto;
  padding: 1.55rem 1.15rem 1.45rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem 1rem;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

header.site .brand {
  justify-self: start;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* PokeQuota lockup — transparent cartoon wordmark, Poké Ball as Q */
header.site h1.brand-lockup {
  display: block;
  margin: 0;
  background: none;
  -webkit-text-fill-color: initial;
  color: inherit;
  filter: none;
  font-style: normal;
}

header.site h1.brand-lockup .brand-wordmark {
  display: block;
  height: clamp(6.2rem, 17vw, 10rem);
  width: auto;
  max-width: min(100%, 84rem);
  border-radius: 0.5rem;
  background: transparent;
  /* no navy/white pill overlay — PNG is already transparent */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

header.site .sub {
  color: rgba(226, 232, 240, 0.85);
  font-size: 0.9rem;
  margin: 0.2rem 0 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

header.site .update-cadence {
  color: rgba(148, 163, 184, 0.78);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0.28rem 0 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
header.site nav.tabs { justify-self: end; z-index: 1; }
@media (max-width: 720px) {
  header.site .header-inner { grid-template-columns: 1fr; }
  header.site nav.tabs { justify-self: start; }
}

nav.tabs a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

nav.tabs a:hover {
  border-color: rgba(255, 203, 5, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-decoration: none;
}
nav.tabs a.active {
  background: linear-gradient(135deg, #ee1515, #c40808);
  border-color: #ffcb05;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 203, 5, 0.35);
}

/* Tighter card grid — matches clean header spacing */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.4rem;
  margin: 0.55rem 0 0.85rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.65rem 0.75rem;
}

.stat .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0;
  color: var(--text);
}

.stat .hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.85rem;
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--text);
}

.panel p { margin: 0.35rem 0; color: var(--muted); font-size: 0.92rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: var(--accent);
  color: #042f2e !important;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
}

.btn.secondary {
  background: #1e1e2a;
  color: var(--text) !important;
  border: 1px solid var(--border);
}

.btn:hover { filter: brightness(1.08); }

.note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.55rem 0 0;
}

.table-wrap {
  /* Page scrolls vertically, including over the cards, so the header and footer
     stay reachable. Horizontal pan stays here for wide tables. No max-height:
     a capped box plus overscroll-behavior:contain traps the wheel inside. */
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  /* No top padding — sticky header must sit flush at scrollport top */
  padding: 0 0.45rem 0.85rem;
  max-width: 100%;
  max-height: none;
  scrollbar-gutter: auto;
}
.table-wrap::-webkit-scrollbar {
  height: 8px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 203, 5, 0.35);
  border-radius: 999px;
}

.panel { overflow: visible; }
.wrap { overflow: visible; }

html, body {
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 100%;
  height: auto;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 0;
  table-layout: auto;
  color: var(--text);
}

th, td {
  box-sizing: border-box;
  padding: 0.4rem 0.4rem;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.055);
  vertical-align: middle;
}

th {
  background: #1a1a24;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
  white-space: normal;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  line-height: 1.2;
}

tr:nth-child(even) td { background: var(--row-alt); }
tr.blank-row td { opacity: 0.72; }

td.name { font-weight: 600; color: var(--text); }
td.muted, .muted { color: var(--muted); }
td.num, th.num, td.money {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
}
td.name { max-width: 14rem; }
td.muted { max-width: 16rem; white-space: normal; word-break: break-word; }
td.money { text-align: right; }
th.money { text-align: right; }
td.blank { color: #64748b; }

/* Avg / Raw primary price + compact last-3 solds */
td.money:has(.avg-cell) {
  white-space: normal;
  vertical-align: top;
}
/* Catalog tables: vertical middle for all body cells (incl. price stacks) */
table.raw tbody td,
table.graded tbody td {
  vertical-align: middle !important;
}
table.raw tbody td.money:has(.avg-cell),
table.graded tbody td.money:has(.avg-cell) {
  vertical-align: middle !important;
}
.avg-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  line-height: 1.25;
}
.avg-cell .avg-main {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}
.avg-cell .last3 {
  display: block;
  max-width: 11.5rem;
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  opacity: 0.92;
}
.avg-cell .last3-label {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-right: 0.2rem;
}

.avg-cell .sold-d {
  color: var(--muted, #94a3b8);
  font-weight: 400;
  font-size: 0.92em;
}
td.money.blank .avg-cell .avg-main { color: #64748b; }

/* Graded Avg: last-known sale older than ~90 days — show real sale date */
.avg-cell.stale .avg-main {
  color: var(--text);
}
.avg-cell .comp-date {
  display: block;
  max-width: 11.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fbbf24;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}
.avg-cell .comp-date-label {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #d97706;
  margin-right: 0.2rem;
  font-weight: 700;
}
table.graded td:nth-child(6) .comp-date {
  text-align: center !important;
  margin-left: auto;
  margin-right: auto;
}

.thumb {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1e1e2a;
  display: block;
  max-width: none !important;
  flex-shrink: 0;
  -webkit-flex-shrink: 0;
}


.thumb.graded {
  width: 40px;
  height: 56px;
}

/* Wide catalog tables: floor width + sticky thumb/name for phone swipe */
table.raw {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  -webkit-border-horizontal-spacing: 0;
  -webkit-border-vertical-spacing: 0;
}
table.graded {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  -webkit-border-horizontal-spacing: 0;
  -webkit-border-vertical-spacing: 0;
}

/* Slim Raw price column so Black Label stays on-screen without sideways scroll */
table.raw th,
table.raw td {
  padding-left: 0.28rem;
  padding-right: 0.28rem;
  font-size: 0.78rem;
}
table.raw th.money,
table.raw td.money {
  font-size: 0.72rem;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  white-space: nowrap;
}
/* Column 6 = Raw (+ last 3) */
table.raw th:nth-child(6),
table.raw td:nth-child(6) {
  width: 5.4rem;
  max-width: 5.4rem;
  box-sizing: border-box;
}
table.raw td:nth-child(6).money:has(.avg-cell) {
  white-space: normal;
}
table.raw th:nth-child(6),
table.raw td:nth-child(6) {
  text-align: center !important;
  vertical-align: middle !important;
}
table.raw td:nth-child(6).money:has(.avg-cell) {
  vertical-align: middle !important;
}
table.raw td:nth-child(6) .avg-cell {
  justify-content: center;
}
table.raw td:nth-child(6) .avg-cell {
  align-items: center !important;
  gap: 0.06rem;
}
table.raw td:nth-child(6) .avg-main {
  font-size: 0.74rem;
  font-weight: 650;
  text-align: center !important;
}
table.raw td:nth-child(6) .last3 {
  max-width: 5.1rem;
  font-size: 0.56rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: center !important;
  margin-left: auto;
  margin-right: auto;
}
table.raw td:nth-child(6) .last3-label {
  display: none; /* drop "Last 3" label — prices alone are enough */
}
table.raw th:nth-child(7),
table.raw td:nth-child(7),
table.raw th:nth-child(8),
table.raw td:nth-child(8) {
  width: 4.4rem;
  max-width: 4.4rem;
}
table.raw th:nth-child(9),
table.raw td:nth-child(9),
table.raw th:nth-child(10),
table.raw td:nth-child(10),
table.raw th:nth-child(12),
table.raw td:nth-child(12) {
  width: 4.8rem;
  max-width: 4.8rem;
}
/* BGS 10 sits between CGC Pristine and Black Label */
table.raw th:nth-child(12),
table.raw td:nth-child(12) {
  min-width: 4.6rem;
}
table.raw th.th-tier,
table.raw td.tier-pristine,
table.raw td.tier-black {
  width: 5.6rem;
  max-width: 5.6rem;
  font-size: 0.7rem;
}
table.raw th.th-tier .badge {
  font-size: 0.58rem;
  padding: 0.08rem 0.28rem;
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
}
table.raw td.name,
table.raw th:nth-child(2) {
  width: auto;
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Column 3 = Set — wider so set names stay readable */
table.raw th:nth-child(3),
table.raw td:nth-child(3) {
  width: 7.5rem;
  max-width: 9rem;
  min-width: 6.5rem;
  padding-left: 0.28rem;
  padding-right: 0.28rem;
  font-size: 0.72rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
table.raw th:nth-child(3) {
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}
table.raw td:nth-child(5),
table.raw th:nth-child(5) {
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}
table.raw th:nth-child(4),
table.raw td.num {
  width: 5.75rem;
  max-width: 6.5rem;
  min-width: 5.25rem;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 0.74rem;
  box-sizing: border-box;
}

/* Slim Graded Set + Avg columns (match raw-page tighten-up) */
table.graded th,
table.graded td {
  padding-left: 0.28rem;
  padding-right: 0.28rem;
  font-size: 0.78rem;
}
table.graded th.money,
table.graded td.money {
  font-size: 0.72rem;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}
table.graded th:nth-child(2),
table.graded td.name {
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Column 3 = Set */
table.graded th:nth-child(3),
table.graded td:nth-child(3) {
  width: 5.25rem;
  max-width: 5.25rem;
  padding-left: 0.18rem;
  padding-right: 0.18rem;
  font-size: 0.68rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
table.graded th:nth-child(3) {
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}
table.graded th:nth-child(4),
table.graded td:nth-child(4) {
  width: 18%;
  max-width: none;
  min-width: 0;
  font-size: 0.72rem;
  white-space: normal;
}
table.graded th:nth-child(5),
table.graded td:nth-child(5) {
  width: 5rem;
  max-width: 5rem;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Column 6 = Avg (+ last 3) — raw-equivalent */
table.graded th:nth-child(6),
table.graded td:nth-child(6) {
  width: 12%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}
table.graded td:nth-child(6).money:has(.avg-cell) {
  white-space: normal;
}
table.graded th:nth-child(6),
table.graded td:nth-child(6) {
  text-align: center !important;
}
table.graded td:nth-child(6) .avg-cell {
  align-items: center !important;
  gap: 0.12rem;
}
table.graded td:nth-child(6) .avg-main {
  text-align: center !important;
}
table.graded td:nth-child(6) .last3 {
  text-align: center !important;
  margin-left: auto;
  margin-right: auto;
}
table.graded td:nth-child(6) .avg-main {
  font-size: 0.74rem;
  font-weight: 650;
}
table.graded td:nth-child(6) .last3 {
  max-width: 5.1rem;
  font-size: 0.56rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
table.graded td:nth-child(6) .last3-label {
  display: none;
}
/* Columns 7–10 = +1 grade / PSA 10 / TAG Pristine 10 / Black Label */
table.graded th:nth-child(7),
table.graded td:nth-child(7),
table.graded th:nth-child(8),
table.graded td:nth-child(8),
table.graded th:nth-child(9),
table.graded td:nth-child(9),
table.graded th:nth-child(10),
table.graded td:nth-child(10) {
  width: 9%;
  max-width: 6.5rem;
  min-width: 4.25rem;
  font-size: 0.7rem;
  white-space: nowrap;
  text-align: right;
  box-sizing: border-box;
}
table.graded th:nth-child(9),
table.graded td:nth-child(9),
table.graded th:nth-child(10),
table.graded td:nth-child(10) {
  width: 10%;
  max-width: 7.25rem;
}
/* Column 11 = Trend / action */
table.graded th:nth-child(11),
table.graded td:nth-child(11) {
  width: 14%;
  max-width: none;
  min-width: 0;
}
table.graded .trend-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
}
table.graded .trend-cell .badge {
  font-size: 0.62rem;
  padding: 0.1rem 0.32rem;
}


table.raw th:nth-child(1),
table.raw td:nth-child(1),
table.graded th:nth-child(1),
table.graded td:nth-child(1) {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #14141c;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.35);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
table.raw th:nth-child(1),
table.graded th:nth-child(1) {
  background: #0a1a3f;
  z-index: 120;
  top: 0;
}
table.raw th:nth-child(2),
table.raw td:nth-child(2) {
  position: -webkit-sticky;
  position: sticky;
  left: 4.5rem;
  z-index: 3;
  background: #14141c;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.28);
  min-width: 6.5rem;
  max-width: 10rem;
}
table.graded th:nth-child(2),
table.graded td:nth-child(2) {
  position: -webkit-sticky;
  position: sticky;
  left: 3.6rem;
  z-index: 3;
  background: #14141c;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.28);
  min-width: 7.5rem;
  max-width: 11rem;
}
table.raw th:nth-child(2),
table.graded th:nth-child(2) {
  background: #0a1a3f;
  z-index: 120;
  top: 0;
}
table.raw tr:nth-child(even) td:nth-child(1),
table.raw tr:nth-child(even) td:nth-child(2),
table.graded tr:nth-child(even) td:nth-child(1),
table.graded tr:nth-child(even) td:nth-child(2) {
  background: var(--row-alt);
}

/* Raw + graded: ~1.5× thumbs + taller rows */

/* Raw thumb col: hug card image; Name sticky immediately beside it */
table.raw th:nth-child(1),
table.raw td:nth-child(1) {
  width: 4.5rem;
  max-width: 4.5rem;
  min-width: 0;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  box-sizing: border-box;
}
table.raw .thumb {
  width: 66px;
  height: 93px;
}
/* Graded thumb column: hug slab; name sticky immediately beside it */
table.graded th:nth-child(1),
table.graded td:nth-child(1) {
  width: 3.6rem;
  max-width: 3.6rem;
  min-width: 0;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  box-sizing: border-box;
  vertical-align: middle;
}
table.graded td:nth-child(1) .thumb,
table.graded td:nth-child(1) .thumb.graded {
  margin-left: auto;
  margin-right: auto;
}

table.graded .thumb,
table.graded .thumb.graded {
  width: 52px;
  height: 73px;
  object-fit: cover;
}
table.raw th,
table.raw td,
table.graded th,
table.graded td {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
table.raw td:has(.thumb),
table.graded td:has(.thumb) {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

td:has(.thumb) {
  position: relative;
  overflow: visible !important;
  z-index: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
/* Hover zoom must beat sticky Name col (same z-index + later DOM otherwise covers it) */
tr:has(.thumb:hover) {
  position: relative;
  z-index: 40;
}
table.raw td:nth-child(1):has(.thumb:hover),
table.graded td:nth-child(1):has(.thumb:hover),
table.raw tr:has(.thumb:hover) td:nth-child(1),
table.graded tr:has(.thumb:hover) td:nth-child(1) {
  z-index: 60 !important;
  overflow: visible !important;
  -webkit-transform: none;
  transform: none;
}
table.raw tr:has(.thumb:hover) td:nth-child(2),
table.graded tr:has(.thumb:hover) td:nth-child(2) {
  z-index: 2 !important;
}
.thumb {
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  transform-origin: left center;
  cursor: zoom-in;
  will-change: transform;
}
.thumb:hover {
  transform: scale(2.6);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  border-color: rgba(125, 211, 252, 0.55);
  position: relative;
  z-index: 70;
  outline: 3px solid #0a0a0f;
}
@media (hover: none) {
  .thumb:hover { transform: none; box-shadow: none; outline: none; }
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.up { background: var(--up-bg); color: var(--up-fg); }
.badge.down { background: var(--down-bg); color: var(--down-fg); }
.badge.stable, .badge.flat { background: var(--flat-bg); color: var(--flat-fg); }
.badge.none { background: var(--na-bg); color: var(--na-fg); }

.badge.sell { background: var(--sell-bg); color: var(--sell-fg); }
.badge.hold { background: var(--hold-bg); color: var(--hold-fg); }
.badge.watch { background: var(--watch-bg); color: var(--watch-fg); }
.badge.na { background: var(--na-bg); color: var(--na-fg); }

.badge.pristine {
  background: linear-gradient(135deg, rgba(255, 203, 5, 0.22), rgba(255, 203, 5, 0.08));
  color: #ffe566;
  border: 1px solid rgba(255, 203, 5, 0.55);
  box-shadow: 0 0 10px rgba(255, 203, 5, 0.15);
}
.badge.black-label {
  background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
  color: #ffcb05;
  border: 1px solid rgba(255, 203, 5, 0.65);
  box-shadow: 0 0 12px rgba(255, 203, 5, 0.12);
}
.name-with-tier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}
.grade-with-tier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
th.th-tier {
  white-space: nowrap;
}
th.th-tier .badge {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
  letter-spacing: 0.02em;
  text-transform: none;
}
td.money.tier-pristine {
  box-shadow: inset 2px 0 0 rgba(255, 203, 5, 0.45);
}
td.money.tier-black {
  box-shadow: inset 2px 0 0 rgba(255, 203, 5, 0.75);
  background: rgba(0, 0, 0, 0.18);
}

.trend-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

footer.site {
  margin-top: 1.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .wrap { margin: 0.35rem; padding: 0.55rem 0.35rem 1.5rem; border-radius: 12px; }
  .cards { gap: 0.35rem; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.35rem 0.3rem; }
  .table-wrap { padding: 0 0.2rem 0.7rem; }
  table.main th:nth-child(5),
  table.main td:nth-child(5) { display: none; }
  table.graded th:nth-child(5),
  table.graded td:nth-child(5) { display: none; }
  table.raw th:nth-child(5),
  table.raw td:nth-child(5) { display: none; }
}
@media (max-width: 640px) {
  header.site h1 { font-size: clamp(1.55rem, 7vw, 2.25rem); font-style: italic; }
  .stat .value { font-size: 1.05rem; }
  table { font-size: 0.74rem; }
  th, td { padding: 0.28rem 0.22rem; }
  .table-wrap { padding: 0 0.1rem 0.55rem; border-radius: 10px; }
  .table-meta { font-size: 0.72rem; gap: 0.25rem 0.45rem; margin-bottom: 0.35rem; }
  .thumb { width: 36px; height: 50px; }
  .thumb.graded { width: 34px; height: 48px; }
  table.raw .thumb { width: 48px !important; height: 68px !important; max-width: none !important; }
  table.graded .thumb,
  table.graded .thumb.graded { width: 42px !important; height: 59px !important; max-width: none !important; }
  table.raw th,
  table.raw td,
  table.graded th,
  table.graded td {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  table.raw th:nth-child(2),
  table.raw td:nth-child(2) {
    left: 3.4rem;
    min-width: 0;
    max-width: 7.5rem;
  }
  table.graded th:nth-child(1),
  table.graded td:nth-child(1) {
    width: 3rem;
    max-width: 3rem;
    min-width: 0;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }
  table.graded th:nth-child(2),
  table.graded td:nth-child(2) {
    left: 3rem;
    min-width: 0;
    width: 26%;
    max-width: 7.5rem;
  }
  table.raw { min-width: 0; width: 100%; }
  table.graded { min-width: 0; width: 100%; }
  table.graded th:nth-child(3),
  table.graded td:nth-child(3),
  table.graded th:nth-child(5),
  table.graded td:nth-child(5) { display: none; }
  /* Keep Set + Number visible; only drop Finish on phone */
  table.raw th:nth-child(5),
  table.raw td:nth-child(5) { display: none; }
  table.raw th:nth-child(1),
  table.raw td:nth-child(1) {
    width: 3.4rem;
    max-width: 3.4rem;
    min-width: 0;
  }
  table.raw th:nth-child(3),
  table.raw td:nth-child(3) {
    width: 5.5rem;
    max-width: 6.5rem;
    min-width: 4.5rem;
    font-size: 0.65rem;
  }
  table.raw th:nth-child(4),
  table.raw td.num,
  table.raw td:nth-child(4) {
    width: 5.25rem;
    max-width: 5.75rem;
    min-width: 4.75rem;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 0.68rem;
  }
  th.th-tier .badge {
    font-size: 0.62rem;
    padding: 0.1rem 0.35rem;
  }
  .avg-cell .last3 { max-width: 9.5rem; font-size: 0.62rem; }
  .badge { font-size: 0.65rem; padding: 0.12rem 0.35rem; }
  table.main th:nth-child(4),
  table.main td:nth-child(4),
  table.main th:nth-child(5),
  table.main td:nth-child(5) { display: none; }
}


/* Cross-browser table parity (Safari + Chromium/DuckDuckGo): same widths/images */
.table-wrap {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}
table.raw,
table.graded {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0;
}
/* Safari: don't let intrinsic image min-content inflate sticky cols */
table.raw td:nth-child(1),
table.graded td:nth-child(1),
table.raw th:nth-child(1),
table.graded th:nth-child(1) {
  overflow: hidden;
}
table.raw td:nth-child(1):has(.thumb:hover),
table.graded td:nth-child(1):has(.thumb:hover) {
  overflow: visible !important;
}
/* Explicit thumb box sizes — identical in Safari and Chromium */
table.raw .thumb {
  width: 66px !important;
  height: 93px !important;
  max-width: none !important;
  object-fit: cover;
}
table.graded .thumb,
table.graded .thumb.graded {
  width: 52px !important;
  height: 73px !important;
  max-width: none !important;
  object-fit: cover;
}
@supports (-webkit-touch-callout: none) {
  /* Safari only: prefix helpers — widths match Chromium rules above (no divergent layout) */
  html {
    -webkit-text-size-adjust: 100%;
  }
  table.raw,
  table.graded {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 640px) {
  .table-wrap {
    scrollbar-gutter: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Graded phone: fit columns; drop sticky min-widths Safari treats as floor */
  table.graded th:nth-child(1),
  table.graded td:nth-child(1) {
    width: 3rem;
    max-width: 3rem;
    min-width: 0;
    box-sizing: border-box;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }
  table.graded th:nth-child(2),
  table.graded td:nth-child(2),
  table.graded td.name {
    left: 3rem;
    min-width: 0 !important;
    width: 24%;
    max-width: 6.5rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
  }
  /* Info cols expand to fill remaining page width (no empty center / right cluster) */
  table.graded th:nth-child(4),
  table.graded td:nth-child(4) {
    width: 18%;
    max-width: none;
    min-width: 0;
    white-space: normal;
    overflow: hidden;
  }
  table.graded th:nth-child(6),
  table.graded td:nth-child(6) {
    width: 26%;
    max-width: none;
    min-width: 0;
  }
  table.graded td:nth-child(6) .last3 {
    max-width: 100%;
    overflow: hidden;
  }
  table.graded td:nth-child(6) .avg-cell {
    align-items: center !important;
  }
  table.graded th:nth-child(7),
  table.graded td:nth-child(7) {
    width: 32%;
    max-width: none;
    min-width: 0;
  }
  table.graded .trend-cell {
    flex-wrap: wrap;
    gap: 0.12rem;
  }
  table.graded .trend-cell .badge {
    font-size: 0.58rem;
    padding: 0.08rem 0.28rem;
  }
  table.graded td.money,
  table.graded th.money {
    white-space: normal;
  }
}

#card-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#card-lightbox.open { display: flex; }
#card-lightbox .lb-dialog {
  position: relative;
  max-width: min(920px, 96vw);
  max-height: 92vh;
  background: #14141c;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  padding: 0.75rem;
}
#card-lightbox img {
  display: block;
  max-width: min(880px, 92vw);
  max-height: calc(92vh - 2rem);
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}
#card-lightbox .lb-close {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 999px;
  background: #ee1515;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
#card-lightbox .lb-close:hover { background: #c40808; }
.thumb { cursor: zoom-in; }


/* Overview recommendation panels */
.rec-section {
  margin: 0.35rem 0 0.5rem;
}
.rec-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: var(--text);
}
.rec-head .note {
  margin: 0 0 0.65rem;
}
.rec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.rec-panel {
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem 0.8rem 0.7rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rec-panel > header h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #fff;
}
.rec-panel > header .rec-blurb {
  margin: 0.25rem 0 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.rec-panel.up { border-top: 3px solid #22c55e; }
.rec-panel.sell { border-top: 3px solid #ef4444; }
.rec-panel.watch { border-top: 3px solid #eab308; }
.rec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.rec-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.4rem 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.rec-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1e1e2a;
  flex-shrink: 0;
}
.rec-thumb.placeholder {
  display: inline-block;
  background: linear-gradient(145deg, #1e1e2a, #2a2a38);
}
.rec-meta { min-width: 0; }
.rec-name {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.25;
}
.rec-sub {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}
.rec-detail {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.3;
}
.rec-more {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}
.rec-more:hover { color: var(--link-hover); text-decoration: underline; }
@media (max-width: 960px) {
  .rec-grid { grid-template-columns: 1fr; }
}


/* Compact as-of meta on raw pricing */
.table-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin: 0 0 0.45rem;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.35;
}
.table-meta .note-inline {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
}

.table-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 1 1 100%;
  margin: 0 0 0.15rem 0;
  margin-left: auto;
  max-width: 100%;
  min-width: 0;
}
.table-sort label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}
.table-sort select {
  flex: 0 1 22rem;
  width: min(22rem, 100%);
  max-width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
  background-color: #1e1e2a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.35rem 2rem 0.35rem 0.7rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #ffcb05 50%),
    linear-gradient(135deg, #ffcb05 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 55%, calc(100% - 0.7rem) 55%;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
  touch-action: manipulation;
}
.table-sort select:focus {
  outline: 2px solid #ffcb05;
  outline-offset: 1px;
}
@media (max-width: 720px) {
  .table-sort {
    justify-content: flex-end;
    margin-left: auto;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .table-toolbar {
    flex-wrap: nowrap;
    align-items: center;
  }
  .table-toolbar .table-sort {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    justify-content: flex-end;
  }
  .table-sort select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: calc(100% - 3.2rem);
  }
}
.asof-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}
.asof-badge time {
  color: #ffcb05;
  font-variant-numeric: tabular-nums;
}
.asof-mini {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #94a3b8;
  white-space: nowrap;
}

/* Two-line grade/price headers: label + muted as-of date */
.th-label {
  display: block;
  line-height: 1.2;
}
.th-asof {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #94a3b8;
  white-space: nowrap;
  line-height: 1.15;
  opacity: 0.95;
}
th.money .th-label {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
th.th-tier .th-label {
  text-transform: none;
  letter-spacing: 0;
}
th.th-tier .th-label .badge {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
}

/* Column header sticks flush to top of the table scroll area */
table.raw,
table.graded {
  margin-top: 0 !important;
}
table.raw thead,
table.graded thead {
  position: relative;
  z-index: 100;
}
table.raw thead tr,
table.graded thead tr {
  margin: 0;
  padding: 0;
}
table.raw thead th,
table.graded thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0 !important;
  z-index: 100 !important;
  margin: 0 !important;
  /* Fully opaque deep navy — solid paint above + below edge kills peek-through */
  background-color: #0a1a3f !important;
  background-image: none !important;
  background-clip: border-box;
  opacity: 1 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  color: #e8eefc !important;
  /* Upward solid shadow seals any subpixel gap above the sticky edge */
  box-shadow:
    0 -40px 0 0 #0a1a3f,
    0 -2px 0 0 #0a1a3f,
    0 3px 0 #0a1a3f,
    0 10px 18px rgba(0, 0, 0, 0.55);
  min-height: 4.75rem;
  padding-top: 1.35rem !important;
  padding-bottom: 1.35rem !important;
  border-top: none !important;
}
table.raw thead th .th-asof,
table.graded thead th .th-asof,
table.raw thead th .muted,
table.graded thead th .muted {
  color: #a8b8d8 !important;
}
table.raw thead th:nth-child(1),
table.raw thead th:nth-child(2),
table.graded thead th:nth-child(1),
table.graded thead th:nth-child(2) {
  z-index: 120 !important;
  background-color: #0a1a3f !important;
  background-image: none !important;
  color: #e8eefc !important;
  top: 0 !important;
}
/* Center all catalog table content (header + body) — every cell */
table.raw,
table.graded,
table.raw th,
table.raw td,
table.graded th,
table.graded td {
  text-align: center !important;
}
table.raw th.money,
table.raw td.money,
table.graded th.money,
table.graded td.money,
table.raw td.name,
table.graded td.name,
table.raw td.num,
table.graded td.num,
table.raw th.num,
table.graded th.num,
table.raw td.muted,
table.graded td.muted {
  text-align: center !important;
}
table.raw thead th,
table.graded thead th {
  text-align: center !important;
}
table.raw .thumb,
table.graded .thumb,
table.graded .thumb.graded {
  margin-left: auto;
  margin-right: auto;
  display: block;
}
table.raw td:has(.thumb),
table.graded td:has(.thumb) {
  text-align: center !important;
}
/* Flex stacks inside cells (prices, badges) must center too */
table.raw .avg-cell,
table.graded .avg-cell {
  align-items: center !important;
}
table.raw .avg-cell .avg-main,
table.graded .avg-cell .avg-main,
table.raw .avg-cell .last3,
table.graded .avg-cell .last3 {
  text-align: center !important;
  margin-left: auto;
  margin-right: auto;
}
table.raw .trend-cell,
table.graded .trend-cell {
  justify-content: center !important;
  align-items: center !important;
}
table.raw .name-with-tier,
table.graded .name-with-tier {
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}

/* Full-bleed navy bar behind sticky cells (covers horizontal padding gutters) */
.table-wrap:has(table.raw),
.table-wrap:has(table.graded) {
  background-image: linear-gradient(#0a1a3f, #0a1a3f);
  background-size: 100% 4.75rem;
  background-repeat: no-repeat;
  background-position: top left;
  background-attachment: local;
}
/* Keep hover zoom below the pinned header */
table.raw tr:has(.thumb:hover),
table.graded tr:has(.thumb:hover) {
  z-index: 40 !important;
}
table.raw td:nth-child(1):has(.thumb:hover),
table.graded td:nth-child(1):has(.thumb:hover),
table.raw tr:has(.thumb:hover) td:nth-child(1),
table.graded tr:has(.thumb:hover) td:nth-child(1) {
  z-index: 50 !important;
}
table.raw .thumb:hover,
table.graded .thumb:hover {
  z-index: 55 !important;
}

/* Slightly thicker thead rows to fit as-of line */
table.raw thead th,
table.graded thead th {
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
  vertical-align: bottom;
  white-space: normal;
  line-height: 1.3;
}
table.raw thead th.money,
table.graded thead th.money {
  white-space: normal;
}

@media (max-width: 900px) {
  .asof-mini { display: none; }
  .th-asof { font-size: 0.52rem; margin-top: 0.15rem; }
}
@media (max-width: 640px) {
  table.raw thead th,
  table.graded thead th {
    padding-top: 1.1rem !important;
    padding-bottom: 1.1rem !important;
    min-height: 4rem;
  }
  .th-asof { font-size: 0.5rem; }
}

/* Full-screen lightbox with pinch/scroll zoom */
#card-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  touch-action: none;
}
#card-lightbox.open { display: flex; }
#card-lightbox .lb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-out;
}
#card-lightbox .lb-img {
  display: block;
  max-width: min(920px, 94vw);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  background: #0a0a0f;
  transform-origin: center center;
  transition: transform 0.05s linear;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}
#card-lightbox .lb-img:active { cursor: grabbing; }
#card-lightbox .lb-hint {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #e2e8f0;
  background: rgba(15, 15, 22, 0.85);
  border: 1px solid rgba(255,255,255,0.12);
  pointer-events: none;
  white-space: nowrap;
}
#card-lightbox .lb-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 999px;
  background: #ee1515;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
}
#card-lightbox .lb-close:hover { background: #c40808; }
.thumb, .rec-thumb { cursor: zoom-in; }

/* ===== iPhone / narrow mobile polish (desktop unchanged) ===== */
/* Tablet (+ small laptop): Raw keeps horizontal scroll so BGS 10 + tier cols stay readable */
@media (max-width: 960px) {
  .table-wrap:has(table.raw) {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    max-height: none;
  }
  table.raw {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
  }
  table.raw th,
  table.raw td {
    white-space: nowrap;
  }
  table.raw th:nth-child(2),
  table.raw td:nth-child(2) {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Grade comps: floor widths so Safari/iOS don't crush under fixed→auto switch */
  table.raw th:nth-child(7),
  table.raw td:nth-child(7),
  table.raw th:nth-child(8),
  table.raw td:nth-child(8),
  table.raw th:nth-child(9),
  table.raw td:nth-child(9),
  table.raw th:nth-child(10),
  table.raw td:nth-child(10),
  table.raw th:nth-child(12),
  table.raw td:nth-child(12) {
    min-width: 4.75rem !important;
    width: auto !important;
    max-width: none !important;
  }
  table.raw th.th-tier,
  table.raw td.tier-pristine,
  table.raw td.tier-black {
    min-width: 5.5rem !important;
    width: auto !important;
    max-width: none !important;
  }
}

@media (max-width: 640px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  header.site .header-inner {
    padding: 1.15rem max(0.85rem, env(safe-area-inset-right, 0px))
             1.05rem max(0.85rem, env(safe-area-inset-left, 0px));
    gap: 0.65rem 0.75rem;
  }
  header.site .sub { font-size: 0.82rem; }
  header.site .update-cadence {
    font-size: 0.68rem;
    line-height: 1.3;
    max-width: 22rem;
  }
  /* Touch-friendly nav pills (~44px tall) */
  nav.tabs {
    gap: 0.4rem;
    width: 100%;
  }
  nav.tabs a {
    min-height: 2.75rem;
    padding: 0.55rem 0.95rem;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(255, 203, 5, 0.25);
    touch-action: manipulation;
  }
  .wrap {
    margin: 0.3rem max(0.35rem, env(safe-area-inset-right, 0px))
            0.85rem max(0.35rem, env(safe-area-inset-left, 0px));
    padding: 0.65rem 0.45rem 1.35rem;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }
  .stat { padding: 0.7rem 0.65rem; }
  .stat .label { font-size: 0.7rem; }
  .stat .value { font-size: 1.12rem; }
  .stat .hint { font-size: 0.72rem; }
  .table-meta {
    font-size: 0.78rem;
    line-height: 1.4;
  }
  .asof-badge {
    min-height: 1.75rem;
    padding: 0.25rem 0.55rem;
    display: inline-flex;
    align-items: center;
  }
  /* Readable table type + taller row hit area */
  table.graded,
  table.raw,
  table.main {
    font-size: 0.8rem !important;
  }
  table.graded th,
  table.graded td,
  table.raw th,
  table.raw td,
  table.main th,
  table.main td {
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
  }
  .badge {
    font-size: 0.7rem !important;
    padding: 0.22rem 0.45rem !important;
    min-height: 1.5rem;
    display: inline-flex;
    align-items: center;
  }
  .table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    /* subtle edge cue that more columns exist when scrolling */
    background:
      linear-gradient(#14141c 33%, rgba(20,20,28,0)) 0 0 / 100% 14px,
      linear-gradient(rgba(20,20,28,0), #14141c 67%) 0 100% / 100% 14px,
      radial-gradient(farthest-side at 0 50%, rgba(255,203,5,0.22), transparent) 0 0 / 18px 100%,
      radial-gradient(farthest-side at 100% 50%, rgba(255,203,5,0.22), transparent) 100% 0 / 18px 100%,
      #14141c;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll, local;
  }
  /* Graded + Raw: horizontal scroll so columns stay readable (was crushing Graded) */
  table.graded,
  table.raw {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
  }
  table.graded th,
  table.graded td,
  table.raw th,
  table.raw td {
    white-space: nowrap;
  }
  table.graded th:nth-child(2),
  table.graded td:nth-child(2),
  table.graded td.name,
  table.raw th:nth-child(2),
  table.raw td:nth-child(2) {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Graded phone: readable mins; sticky Name sits beside thumb col */
  table.graded th:nth-child(1),
  table.graded td:nth-child(1) {
    width: 3.25rem !important;
    max-width: 3.25rem !important;
    min-width: 3.25rem !important;
  }
  table.graded th:nth-child(2),
  table.graded td:nth-child(2),
  table.graded td.name {
    left: 3.25rem !important;
    min-width: 8.5rem !important;
    max-width: 10rem !important;
    width: 9rem !important;
  }
  table.graded th:nth-child(4),
  table.graded td:nth-child(4) {
    min-width: 5.5rem !important;
    max-width: none !important;
    width: auto !important;
  }
  table.graded th:nth-child(6),
  table.graded td:nth-child(6) {
    min-width: 7.5rem !important;
    max-width: none !important;
    width: auto !important;
  }
  table.graded th:nth-child(7),
  table.graded td:nth-child(7) {
    min-width: 8.5rem !important;
    max-width: none !important;
    width: auto !important;
  }
  table.graded .avg-cell .last3 {
    max-width: 9rem !important;
    white-space: normal;
  }
  table.graded .trend-cell {
    flex-wrap: nowrap !important;
    justify-content: center;
  }
  table.raw th:nth-child(2),
  table.raw td:nth-child(2) {
    max-width: 9rem;
  }
  /* Raw phone: keep grade comps (incl. new BGS 10) from crushing while swiping */
  table.raw th:nth-child(7),
  table.raw td:nth-child(7),
  table.raw th:nth-child(8),
  table.raw td:nth-child(8),
  table.raw th:nth-child(9),
  table.raw td:nth-child(9),
  table.raw th:nth-child(10),
  table.raw td:nth-child(10),
  table.raw th:nth-child(12),
  table.raw td:nth-child(12) {
    min-width: 4.75rem !important;
    max-width: none !important;
    width: auto !important;
  }
  table.raw th.th-tier,
  table.raw td.tier-pristine,
  table.raw td.tier-black {
    min-width: 5.5rem !important;
    max-width: none !important;
    width: auto !important;
  }
  .table-wrap:has(table.raw)::before,
  .table-wrap:has(table.graded)::before {
    content: "Swipe sideways for more columns";
    display: block;
    position: sticky;
    left: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    white-space: normal;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(148, 163, 184, 0.9);
    padding: 0.35rem 0.45rem 0.45rem;
    text-align: center;
    text-transform: none !important;
  }
  /* Lightbox safe on notched phones */
  #card-lightbox {
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
             max(0.75rem, env(safe-area-inset-right, 0px))
             max(0.75rem, env(safe-area-inset-bottom, 0px))
             max(0.75rem, env(safe-area-inset-left, 0px));
  }
  #card-lightbox .lb-close {
    width: 2.6rem;
    height: 2.6rem;
    top: 0.35rem;
    right: 0.35rem;
  }
  .thumb {
    -webkit-tap-highlight-color: rgba(255, 203, 5, 0.2);
    touch-action: manipulation;
  }
}

@media (max-width: 390px) {
  .cards { grid-template-columns: 1fr 1fr; }
  header.site h1 { font-size: clamp(1.35rem, 8vw, 1.85rem); }
}

/* ===== Portfolio hero ===== */
.portfolio-hero {
  display: block;
  text-align: left;
  background: linear-gradient(135deg, rgba(12, 18, 40, 0.95) 0%, rgba(20, 20, 28, 0.98) 55%, rgba(40, 28, 8, 0.55) 100%);
  border: 1px solid rgba(255, 203, 5, 0.35);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1rem;
  margin: 0.35rem 0 0.9rem;
  box-shadow: 0 0 28px rgba(255, 203, 5, 0.08);
}
.portfolio-hero-main { grid-column: 1; grid-row: 1; min-width: 0; }
.pf-actions {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
  max-width: 22rem;
}
.portfolio-hero .pf-actions .pf-mini,
.portfolio-hero .pf-panel .pf-mini {
  text-transform: none !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0.22rem 0.45rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  white-space: nowrap;
}
.portfolio-hero .pf-btn-add-g::before,
.portfolio-hero .pf-btn-add-r::before { content: "+"; font-weight: 800; }
.portfolio-hero .pf-btn-rem-g::before,
.portfolio-hero .pf-btn-rem-r::before { content: "\2212"; font-weight: 800; }
.portfolio-hero .pf-btn-add-g {
  background: #ffcb05 !important;
  color: #1a1200 !important;
  border: 1px solid #ffe56a !important;
}
.portfolio-hero .pf-btn-rem-g {
  background: rgba(255, 203, 5, 0.12) !important;
  color: #ffcb05 !important;
  border: 1px solid #ffcb05 !important;
}
.portfolio-hero .pf-btn-add-r {
  background: #3b82f6 !important;
  color: #fff !important;
  border: 1px solid #93c5fd !important;
}
.portfolio-hero .pf-btn-rem-r {
  background: rgba(59, 130, 246, 0.14) !important;
  color: #93c5fd !important;
  border: 1px solid #3b82f6 !important;
}
.pf-panel,
.pf-status { grid-column: 1 / -1; }

.portfolio-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffcb05;
}
.portfolio-total {
  margin: 0.2rem 0 0.15rem;
  text-align: left;
  font-size: clamp(1.85rem, 6vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(185deg, #fff6b0 0%, #ffcb05 45%, #f0a800 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.portfolio-sub {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 600;
}
.portfolio-sub .dot { color: #64748b; margin: 0 0.25rem; }
.portfolio-note { margin: 0.45rem 0 0; font-size: 0.78rem; }

.pf-mini {
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  border-radius: 8px;
}
button.pf-mini {
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn.secondary.pf-mini { border-color: rgba(255, 255, 255, 0.18); }
.pf-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
}
.pf-panel[hidden] { display: none !important; }
.pf-status[hidden] { display: none !important; }
.pf-panel input {
  flex: 1 1 5.5rem;
  min-width: 0;
  background: #1e1e2a;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
}
.pf-panel input:focus {
  outline: 2px solid #ffcb05;
  outline-offset: 1px;
}
.pf-panel .btn { flex: 0 0 auto; }
.pf-del {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 8px;
}
.pf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.pf-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
}
.pf-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  color: #f1f5f9;
}
.pf-meta {
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
}
.pf-price {
  color: #ffcb05;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-price.is-blank { color: #94a3b8; font-weight: 600; }

.inventory-total {
  display: inline-flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.04rem;
  margin: 0;
  padding: 0.4rem 0.85rem 0.45rem;
  width: max-content;
  max-width: 100%;
  border-radius: 16px;
  background: linear-gradient(160deg, #1a1810 0%, #14141c 100%);
  border: 1px solid rgba(255, 203, 5, 0.35);
  flex: 0 0 auto;
  box-shadow: 0 0 18px rgba(255, 203, 5, 0.06);
}
.inventory-total.is-raw {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.04rem;
  padding: 0.4rem 0.85rem 0.45rem;
  width: max-content;
  max-width: 100%;
  border-radius: 16px;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  margin: 0 0 0.15rem;
}
.table-toolbar .inventory-total {
  margin-right: auto;
  flex: 0 0 auto;
}
.table-toolbar .inventory-total.is-raw {
  flex: 0 0 auto;
}
.table-toolbar .table-sort {
  flex: 0 1 auto;
  width: auto;
  margin: 0 0 0 auto;
}
.inventory-total-k {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
  white-space: nowrap;
}
.inventory-total-v {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.05;
  color: #ffcb05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inventory-total.is-raw .inventory-total-v {
  font-size: 1.55rem;
  line-height: 1.05;
}
.inventory-total-note {
  flex: none;
  width: 0;
  min-width: 100%;
  max-width: none;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  color: #94a3b8;
  text-transform: none !important;
}
.inventory-total.is-raw .inventory-total-note {
  flex: none;
  width: 0;
  min-width: 100%;
  max-width: none;
}

.stat.portfolio-stat {
  border-color: rgba(255, 203, 5, 0.35);
  background: linear-gradient(160deg, #1a1810 0%, #14141c 100%);
}
.stat.portfolio-stat .value { color: #ffcb05; }

/* ===== Chase / heat tables ===== */
table.heat-table { width: 100%; border-collapse: collapse; }
.pct-down { color: #f87171 !important; font-weight: 700; }
.pct-up { color: #4ade80 !important; font-weight: 700; }
.pct-flat { color: #94a3b8 !important; }

.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.heat-cell {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.7rem 0.75rem 0.85rem;
  background: color-mix(in srgb, #ffcb05 calc(var(--heat, 0) * 55%), #14141c);
  min-height: 5.2rem;
}
.heat-tier {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.heat-dollars {
  display: block;
  font-weight: 700;
  color: #ffcb05;
  margin-top: 0.15rem;
}
.heat-qty {
  display: block;
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.85);
  margin-top: 0.1rem;
}

.hot-list { display: grid; }
.hot-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.2rem 0.65rem;
  align-items: start;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hot-name-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}
.hot-chart {
  flex: 0 0 9.5rem;
  width: 9.5rem;
}
.hot-row:last-child { border-bottom: 0; }
.hot-rank {
  font-weight: 800;
  font-size: 1rem;
  color: #ffcb05;
}
.hot-name { font-weight: 700; flex: 0 1 auto; min-width: 0; }
.hot-name a { color: inherit; text-decoration: none; }
.hot-name a:hover { text-decoration: underline; }
.hot-meta, .hot-range {
  color: #94a3b8;
  font-size: 0.78rem;
  margin: 0.15rem 0 0;
}
.hot-worth {
  margin-top: 0.2rem;
  font-weight: 700;
  color: #ffcb05;
}
.hot-worth.up { color: #4ade80; }
.hot-worth.down { color: #f87171; }
.hot-spark { width: 100%; height: auto; display: block; }
@media (max-width: 720px) {
  .hot-row { grid-template-columns: 1.35rem minmax(0, 1fr); gap: 0.15rem 0.4rem; }
  .hot-chart { flex-basis: 6.5rem; width: 6.5rem; }
  .hot-name-line { gap: 0.35rem; }
}

.heat-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: #ffcb05;
  box-shadow: 0 0 8px rgba(255, 203, 5, 0.6);
}

.bar-chart { display: grid; gap: 0.45rem; }
.bar-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
}
.bar-label { font-weight: 700; color: #e2e8f0; font-size: 0.85rem; }
.bar-track {
  height: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #ffcb05);
  border-radius: 999px;
}
.bar-val { font-size: 0.82rem; font-weight: 700; color: #ffcb05; }

.split-track {
  display: flex;
  height: 2.2rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.split-graded, .split-raw {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.split-graded { background: linear-gradient(90deg, #1d4ed8, #3b82f6); color: #fff; }
.split-raw { background: linear-gradient(90deg, #a16207, #ffcb05); color: #1a1200; }

@media (max-width: 720px) {
  .portfolio-hero { display: block; text-align: left; }
  .pf-actions {
    grid-column: 1;
    grid-row: 1;
    max-width: 100%;
    margin-bottom: 0.35rem;
  }
  .portfolio-hero-main { grid-row: 2; }
  .portfolio-sub { font-size: 0.8rem; }
  .bar-row { grid-template-columns: 3rem 1fr auto; }
  nav.tabs a { padding: 0.3rem 0.55rem; font-size: 0.8rem; }
}

/* ===== US EN Releases ===== */
.releases-overview {
  border-color: rgba(255, 203, 5, 0.28);
  background: linear-gradient(145deg, rgba(10, 16, 36, 0.95) 0%, #14141c 70%);
  margin: 0.2rem 0 0.85rem;
}
.releases-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffcb05;
}
.releases-overview-title {
  margin: 0.15rem 0 0.55rem;
  font-size: 1.15rem;
  color: #f8fafc;
}
.rel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.55rem;
}
.rel-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 0.55rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(5, 5, 8, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.rel-item-art,
.rel-item-art img {
  width: 64px;
}
.rel-item-art {
  align-self: stretch;
}
.rel-item-art img {
  display: block;
  height: 80px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: rgba(5, 5, 8, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.rel-item-content {
  min-width: 0;
}
.rel-item .rel-date {
  display: block;
  margin-bottom: 0.12rem;
  font-weight: 800;
  font-size: 0.78rem;
  color: #ffcb05;
  letter-spacing: 0.01em;
}
.rel-item .rel-name {
  display: block;
  font-weight: 700;
  color: #f1f5f9;
  font-size: 0.92rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.rel-item .rel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  color: #94a3b8;
  font-size: 0.78rem;
}
.releases-more { margin: 0.7rem 0 0.2rem; }
.releases-cite { margin-top: 0.45rem; font-size: 0.75rem; }
.badge.in-collection {
  background: rgba(255, 203, 5, 0.18);
  color: #ffcb05;
  border: 1px solid rgba(255, 203, 5, 0.45);
  font-weight: 700;
}
.releases-hero .releases-stats { margin-top: 0.65rem; }
.releases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem;
  margin: 0.35rem 0 1rem;
}
.rel-card {
  background: #14141c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}
.rel-card.owned {
  border-color: rgba(255, 203, 5, 0.4);
  box-shadow: 0 0 18px rgba(255, 203, 5, 0.07);
}
.rel-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.rel-card .rel-date {
  font-weight: 800;
  color: #ffcb05;
  font-size: 0.88rem;
}
.rel-card-title {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
  color: #f8fafc;
  line-height: 1.25;
}
.rel-card-meta {
  margin: 0 0 0.35rem;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
}
.rel-card-meta .dot { margin: 0 0.25rem; color: #64748b; }
.rel-era { color: #cbd5e1; }
.rel-notes { margin: 0; color: #94a3b8; font-size: 0.82rem; line-height: 1.4; }
.rel-src { color: #93c5fd; text-decoration: none; font-weight: 600; }
.rel-src:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .rel-list {
    grid-template-columns: 1fr;
  }
  .rel-item {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 0.45rem 0.6rem;
    padding: 0.4rem 0.5rem;
  }
  .rel-item-art,
  .rel-item-art img {
    width: 56px;
  }
  .rel-item-art img {
    height: 70px;
  }
  .rel-item .rel-date {
    font-size: 0.76rem;
  }
  .rel-item .rel-name {
    font-size: 0.86rem;
  }
}

/* ===== Multi-language Releases ===== */
.lang-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.35rem;
}
.lang-chip {
  display: inline-block;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}
.lang-chip:hover { border-color: #ffcb05; color: #ffcb05; }
.releases-lang {
  margin: 1rem 0 1.25rem;
  scroll-margin-top: 1rem;
}
.releases-lang-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin: 0 0 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 203, 5, 0.22);
}
.releases-lang-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #f8fafc;
}
.releases-lang-count {
  margin: 0;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
}
.rel-lang-pill {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* ===== Release pack/box art ===== */
.rel-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.75rem 0.85rem;
  align-items: start;
}
.rel-art {
  width: 88px;
  flex: 0 0 88px;
}
.rel-art img {
  display: block;
  width: 88px;
  height: 110px;
  object-fit: contain;
  object-position: center top;
  border-radius: 8px;
  background: rgba(5, 5, 8, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.rel-art-placeholder img {
  object-fit: cover;
}
.rel-card-body {
  min-width: 0;
}
.rel-card-body .rel-card-title {
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .rel-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0.55rem 0.65rem;
  }
  .rel-art,
  .rel-art img {
    width: 72px;
  }
  .rel-art img {
    height: 90px;
  }
  .releases-grid {
    grid-template-columns: 1fr;
  }
}


/* Visible title case without rewriting source data */
html body, html body * {
  text-transform: capitalize !important;
}
header.site h1.brand-lockup,
header.site h1.brand-lockup .brand-wordmark,
.table-sort, .table-sort * {
  text-transform: none !important;
}
.panel h2, .rec-head h2, .releases-overview-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.15;
}
.rec-panel > header h3 {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: .01em;
}


/* Add from photo / by hand — toolbar controls and confirm dialog */
.table-toolbar {
  flex-wrap: wrap;
}
.add-card-actions {
  position: relative;
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0;
}
.add-card-actions .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.95rem;
  font-size: 1rem;
  line-height: 1.2;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.add-card-actions .btn.secondary {
  border: 1px solid var(--border);
}
.add-card-note,
.added-note {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #94a3b8;
}
.added-note {
  font-size: 0.68rem;
  font-weight: 600;
  margin-top: 0.15rem;
}
.add-card-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(5, 5, 8, 0.78);
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(1.25rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.75rem;
}
.add-card-dialog {
  width: min(28rem, 100%);
  flex: 1 1 18rem;
  min-width: min(15rem, 58%);
  max-width: 28rem;
  margin: 0;
  background: #14141c;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  box-sizing: border-box;
}
.add-card-dialog h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
}
.add-card-status,
.add-card-error {
  margin: 0 0 0.65rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.4;
}
.add-card-error { color: #fca5a5; }
.add-card-fields { display: flex; flex-direction: column; gap: 0.55rem; }
.add-field { display: flex; flex-direction: column; gap: 0.25rem; }
.add-field span {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #94a3b8;
}
.add-card-dialog input,
.add-card-dialog select {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
  background: #1e1e2a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
}
.add-card-dialog input:focus,
.add-card-dialog select:focus {
  outline: 2px solid #ffcb05;
  outline-offset: 1px;
}
.add-card-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.add-card-form-actions .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.95rem;
  font-size: 1rem;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.add-card-form-actions .btn.secondary { border: 1px solid var(--border); }
.add-card-dialog,
.add-card-dialog *,
.add-lookup,
.add-lookup *,
.add-card-note,
.added-note {
  text-transform: none !important;
}
.add-lookup-below {
  width: min(20rem, 42%);
  flex: 0 1 18rem;
  min-width: min(9.5rem, 36%);
  margin: 0;
  align-self: flex-start;
  max-height: calc(100dvh - 1.6rem);
  overflow: auto;
  background: #14141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  box-sizing: border-box;
}
tr.user-added.price-missing td.name .price-flag {
  display: inline-flex;
  align-items: center;
  margin-top: 0.28rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid #f87171;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
tr.user-added.price-missing {
  box-shadow: inset 3px 0 0 #f87171;
}
.price-flag { text-transform: none !important; }

@media (max-width: 720px) {
  .table-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .add-card-actions .btn {
    flex: 1 1 auto;
  }
}

.add-field { position: relative; }
.add-suggest {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0.3rem;
  position: static;
  max-height: 11rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #1a1a24;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
.add-suggest[hidden] { display: none; }
.add-suggest li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 50px;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.add-suggest li.is-active,
.add-suggest li:hover {
  background: rgba(255, 203, 5, 0.14);
}
.add-suggest-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 3px;
  flex: 0 0 auto;
  background: #0b0b12;
}
.add-suggest-thumb-empty { display: inline-block; }
.add-suggest-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.add-suggest-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #f8fafc;
  line-height: 1.2;
}
.add-suggest-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}


.add-lookup { margin: 0.15rem 0 0.35rem; }
.add-lookup[hidden] { display: none; }
.add-lookup-note {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.4;
}
.add-lookup-one {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.add-lookup-caption {
  margin: 0;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.35;
}
.add-lookup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(50vh, 28rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.add-lookup-hit {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  min-height: 74px;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
}
.add-lookup-hit:hover,
.add-lookup-hit:focus {
  background: rgba(255, 203, 5, 0.14);
  outline: 2px solid #ffcb05;
  outline-offset: 1px;
}
.add-lookup-img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: #0b0b12;
}
.add-lookup-one .add-lookup-img {
  width: 72px;
  height: 100px;
}
.add-lookup-img-empty { display: inline-block; }
.add-lookup-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}
.add-lookup-name {
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.2;
}
.add-lookup-set,
.add-lookup-num {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.3;
}
.add-lookup,
.add-lookup * { text-transform: none !important; }

/* Row delete. Not part of the portfolio bubble. */
td.row-actions,
th.row-actions-h {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}
.row-delete {
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: #b91c1c;
  color: #fff !important;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.row-delete:hover { filter: brightness(1.08); }
.row-check-label {
  display: none;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
}
table.is-selecting .row-check-label { display: inline-flex; }
table.is-selecting .row-delete { display: none; }
.row-check {
  width: 1.35rem;
  height: 1.35rem;
  min-height: 0;
  accent-color: #ffcb05;
}
.row-select-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 160;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem max(1rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: #14141c;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}
.row-select-bar[hidden] { display: none; }
.row-select-count {
  font-weight: 800;
  color: #f8fafc;
  min-width: 6rem;
}
.row-select-bar .btn {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.row-select-bar .btn.secondary { border: 1px solid var(--border); }
.row-select-bar .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.row-confirm {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 5, 8, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.row-confirm-dialog {
  width: min(26rem, 100%);
  background: #14141c;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 1rem 1rem 1.05rem;
  box-sizing: border-box;
}
.row-confirm-text {
  margin: 0 0 0.85rem;
  color: #f8fafc;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 650;
}
.row-delete-go {
  background: #b91c1c !important;
  color: #fff !important;
}
.row-delete,
.row-check-label,
.row-select-bar,
.row-select-bar *,
.row-confirm,
.row-confirm * {
  text-transform: none !important;
}

/* Add / delete bubbles at the top of Graded and Raw. */
.collection-bubbles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin: 0;
}
.collection-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.02rem;
  margin: 0;
  padding: 0.48rem 0.95rem 0.52rem;
  width: max-content;
  max-width: 100%;
  border-radius: 16px;
  background: linear-gradient(160deg, #1a1810 0%, #14141c 100%);
  border: 1px solid rgba(255, 203, 5, 0.45);
  box-shadow: 0 0 18px rgba(255, 203, 5, 0.06);
  color: #f8fafc;
  font: inherit;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}
.collection-bubble-k {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.1;
  color: #ffcb05;
}
.collection-bubble-s {
  font-size: 0.72rem;
  font-weight: 650;
  color: #94a3b8;
}
#bubble-add-card { border-color: rgba(74, 222, 128, 0.55); }
#bubble-add-card .collection-bubble-k { color: #bbf7d0; }
#bubble-delete-card { border-color: rgba(248, 113, 113, 0.5); }
#bubble-delete-card .collection-bubble-k { color: #fecaca; }
.collection-bubble,
.collection-bubble * { text-transform: none !important; }
.add-card-actions > #add-by-hand {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
table.is-picking tbody tr { cursor: pointer; }
table.is-picking tbody tr:hover { outline: 1px solid rgba(255, 203, 5, 0.45); outline-offset: -2px; }
.row-select-bar.is-pick-one .row-select-ok { display: none; }
td.name .row-check-label { margin: 0 0 0.2rem; }

/* Sort stays top-right. Add and Delete sit under it, on both tabs. */
.table-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "inv sort"
    "inv bubbles"
    "actions actions";
  align-items: start;
  justify-content: stretch;
}
.table-toolbar .inventory-total { grid-area: inv; margin-right: 0; }
.table-toolbar .table-sort { grid-area: sort; justify-self: end; margin-left: 0; }
.table-toolbar .collection-bubbles { grid-area: bubbles; justify-self: end; }
.table-toolbar .add-card-actions { grid-area: actions; }
@media (max-width: 720px) {
  .table-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "inv"
      "sort"
      "bubbles"
      "actions";
  }
  .table-toolbar .table-sort,
  .table-toolbar .collection-bubbles { justify-self: end; }
}
