
:root {
  /* TOPTCGS redesign — Pokémon-only build */
  --bg: #0a0a0f;
  --s1: rgba(255,255,255,0.03);
  --s2: rgba(255,255,255,0.05);
  --s3: rgba(245,208,32,0.3);
  --border: rgba(255,255,255,0.08);
  --accent: #f5d020;
  --accent-bright: #ffd900;
  --red: #f87171;
  --text: #e8e6f0;
  --muted: rgba(255,255,255,0.4);
  --green: #4ade80;
  /* Pokémon accent (single-game build) */
  --pokemon: #f5d020;
  --game-color: #f5d020;
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; min-height: 100vh; display: flex; flex-direction: column; opacity: 0; transition: opacity 0.2s; overflow-x: hidden; max-width: 100vw; }
body.fonts-ready { opacity: 1; }

/* PSA graded-price section is hidden globally until grading data is
   complete across all sets. Toggle off by removing this class from
   <body>. The modal still fetches PSA data internally, but no UI is
   rendered for it. */
body.hide-psa #m-psa-section { display: none; }
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(245,208,32,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,208,32,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; width: 100%; flex: 1; }

/* Header */
/* padding-top = ad-top height (76px) + original spacing (36px).
   This keeps the logo/hero in the same position whether or not
   the ad network renders or removes the .ad-top element. */
header { padding: 36px 0 0; display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: 'Bebas Neue', sans-serif; font-size: 30px; letter-spacing: 4px; color: var(--accent); cursor: pointer; text-decoration: none; display: inline-block; }
.logo span { color: var(--text); }

/* Hero */
.hero { padding: 48px 0 36px; position: relative; }
.hero::before {
  content: ''; position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 320px; max-width: 100%;
  background: radial-gradient(ellipse at center, rgba(245,208,32,0.08) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-family: 'Bebas Neue', sans-serif; font-size: 72px; line-height: 0.9; letter-spacing: 2px; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--game-color, var(--accent)); display: block; transition: color 0.3s; }
.hero p { color: var(--muted); font-size: 15px; line-height: 1.6; font-weight: 400; max-width: 440px; }

/* Game selector */
.game-tabs { display: flex; gap: 8px; margin-top: 28px; flex-wrap: wrap; }
.gtab {
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 2px;
  padding: 8px 18px; border-radius: 3px; border: 1px solid var(--border);
  color: var(--muted); background: var(--s1); cursor: pointer;
  transition: all 0.15s; text-transform: uppercase;
  border-left-width: 3px;
}
.gtab:hover { border-color: var(--muted); color: var(--text); }
.gtab.active { color: var(--bg); font-weight: 600; }
.gtab[data-game="pokemon"]         { border-left-color: var(--pokemon); }
.gtab[data-game="pokemon"] .ti { color: var(--pokemon); }
.gtab.active .ti { color: var(--bg); }
.gtab[data-game="pokemon"].active  { background: var(--pokemon); border-color: var(--pokemon); }

/* Search box */
/* Landing — search hidden until game is chosen */
@keyframes searchFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
#search-box { display: none; }
#search-box.revealed { display: block; animation: searchFadeIn 0.45s cubic-bezier(0.22,1,0.36,1) forwards; }
#filters-row { display: none; }
#filters-row.revealed { display: flex; animation: searchFadeIn 0.5s cubic-bezier(0.22,1,0.36,1) forwards; }

/* "Choose your card game" landing label */
#hero-choose {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--muted);
  margin-top: 32px;
  opacity: 1;
  transition: opacity 0.3s;
}
#hero-choose.hidden { opacity: 0; pointer-events: none; }

.search-box {
  margin-top: 28px; background: var(--s2); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius); overflow: hidden; position: relative;
  transition: border-color 0.3s; max-width: 640px;
}
.search-box.focused { border-color: rgba(245,208,32,0.5); }
.search-inner { display: flex; align-items: stretch; }
.search-icon { display: flex; align-items: center; padding: 0 18px; color: rgba(255,255,255,0.3); font-size: 20px; flex-shrink: 0; }
input#q, input#landing-q {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 17px; padding: 18px 0; min-width: 0;
}
input#q::placeholder, input#landing-q::placeholder { color: rgba(255,255,255,0.25); }
.search-btn {
  background: var(--game-color, var(--accent)); color: var(--bg); border: none;
  padding: 0 26px; font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 2px; font-weight: 600; cursor: pointer; transition: background 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.search-btn:hover { background: var(--accent-bright); }

/* Autocomplete */
.ac-drop {
  position: fixed;
  background: var(--s2); border: 1px solid var(--border); border-radius: 6px;
  z-index: 9999; overflow-y: auto; display: none; box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  max-height: 60vh;
}
.ac-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s;
  /* Stagger pop-in: each row fades + slides in 60ms after the previous.
     Per-row delay is set inline via --d so renderAC can control the cascade. */
  opacity: 0; transform: translateY(-4px);
  animation: ac-pop 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes ac-pop {
  to { opacity: 1; transform: translateY(0); }
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--s3); }
.ac-img { width: 32px; height: 44px; object-fit: contain; border-radius: 3px; background: var(--s2); flex-shrink: 0; }
.ac-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ac-meta { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); }
.ac-price { margin-left: auto; font-family: 'Bebas Neue', sans-serif; font-size: 18px; color: var(--game-color, var(--accent)); flex-shrink: 0; }

/* Stub state — shown while we have a name but no print info yet (set/num/img/usd).
   Shimmering placeholders for image/meta/price tell the user "loading print info". */
.ac-stub-img,
.ac-stub-meta,
.ac-stub-price {
  background: linear-gradient(90deg, var(--s3) 0%, var(--border) 50%, var(--s3) 100%);
  background-size: 200% 100%;
  animation: ac-shimmer 1.2s ease-in-out infinite;
  border-radius: 3px;
  display: inline-block;
}
.ac-stub-img { width: 32px; height: 44px; flex-shrink: 0; }
.ac-stub-meta { width: 80px; height: 10px; margin-top: 4px; }
.ac-stub-price { width: 50px; height: 18px; margin-left: auto; flex-shrink: 0; }
@keyframes ac-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* (Skeleton loading rows removed — they were causing perceived sluggishness.
   We now show nothing during the brief 80ms+RTT window, then pop in real
   results with a quick fade. Matches reference behavior.) */

/* Filters */
.filters { display: flex; gap: 10px; margin-top: 12px; flex-wrap: nowrap; align-items: center; position: relative; z-index: 100; }
.filter-label { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); letter-spacing: 1px; flex-shrink: 0; }
select {
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 7px 12px; font-family: 'DM Sans', sans-serif;
  font-size: 13px; outline: none; cursor: pointer; transition: border-color 0.15s;
  flex: 1; min-width: 0;
}
#lang-select { flex: 0 0 auto; width: 80px; }

/* Results header */
.results-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: 10px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.results-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.3); font-weight: 500; font-family: 'DM Mono', monospace; }
.results-count { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }
.results-count strong { color: var(--text); }

/* Card grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 40px; }

/* Landing sections — exactly 5 cards in a row */
.landing-section { margin-bottom: 36px; }
.landing-section .card-grid-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.landing-section .card-grid-row .card-tile { font-size: 12px; }
.landing-section .card-grid-row .tile-name { font-size: 12px; }
.landing-section .card-grid-row .tile-price { font-size: 20px; }
.landing-section .card-grid-row .card-tile-info { padding: 9px 10px; }
@media (max-width: 760px) {
  .landing-section .card-grid-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 460px) {
  .landing-section .card-grid-row { grid-template-columns: repeat(2, 1fr); }
}

/* Section header — compact, sits above each landing section */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 14px;
  gap: 12px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 1px;
  color: var(--text);
  line-height: 1;
}
.section-title .section-accent { color: var(--accent); }
.section-sub {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase;
}

/* Gainer % badge that overlays on the tile */
.gain-badge {
  font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 700;
  color: var(--green); margin-top: 3px; letter-spacing: 0.5px;
  display: inline-flex; align-items: center; gap: 3px;
}
.gain-badge.down { color: var(--red); }

/* Popular sets — horizontal scrollable row of set tiles */
.popular-sets-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 760px) {
  .popular-sets-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 460px) {
  .popular-sets-row { grid-template-columns: repeat(2, 1fr); }
}
.set-tile {
  background: var(--s1); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0; display: flex; flex-direction: column;
}
.set-tile:hover { transform: translateY(-3px); border-color: var(--s3); }
.set-tile-img-wrap {
  aspect-ratio: 16 / 11; background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.set-tile-img-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 0.08s ease-out;
}
.set-tile-img-wrap img.loaded { opacity: 1; }
.set-tile-info { padding: 9px 11px; }
.set-tile-game {
  font-family: 'DM Mono', monospace; font-size: 9px;
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 3px;
}
.set-tile-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.set-tile-meta {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--muted); margin-top: 3px;
}

/* Most-searched chip row */
.searched-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.searched-chip {
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: var(--s1); border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px; border-radius: 20px;
  cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.searched-chip:hover { border-color: var(--accent); color: var(--accent); }
.searched-chip .searched-count {
  font-size: 10px; color: var(--muted);
  background: var(--s2); padding: 2px 7px; border-radius: 10px;
}
.searched-chip:hover .searched-count { color: var(--accent); }
.card-tile {
  background: var(--s1); border: 0.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform 0.2s, border-color 0.2s;
}
.card-tile:hover { transform: translateY(-3px); border-color: rgba(245,208,32,0.3); }
.rarity-stripe { height: 3px; width: 100%; }
.rs-common   { background: var(--muted); }
.rs-uncommon { background: var(--green); }
.rs-rare     { background: #4a9eff; }
.rs-holo     { background: linear-gradient(90deg, #9b6dff, #4a9eff, var(--accent)); }
.rs-ultra    { background: linear-gradient(90deg, var(--accent), var(--red)); }
.card-img-wrap { aspect-ratio: 2.5/3.5; background: var(--s2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-img-wrap img.loaded { /* no-op — kept for backward compat with onload handlers */ }
.card-tile-info { padding: 11px 13px; }
.tile-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-set  { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-price { font-family: 'Bebas Neue', sans-serif; font-size: 22px; color: var(--game-color, var(--accent)); line-height: 1; }
.tile-price.na { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }
.tile-rarity { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); margin-top: 3px; }
.chase-star { font-size: 0.65em; margin-left: 5px; cursor: help; filter: drop-shadow(0 0 2px rgba(245,208,32,0.5)); vertical-align: middle; position: relative; top: -1px; }
.card-tile.is-chase { box-shadow: 0 0 0 1.5px rgba(245,208,32,0.35), 0 4px 24px rgba(245,208,32,0.08); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 8px 0 48px; flex-wrap: wrap; }
.pg-btn {
  background: var(--s1); border: 1px solid var(--border); color: var(--muted);
  font-family: 'DM Mono', monospace; font-size: 12px; padding: 8px 14px;
  border-radius: 4px; cursor: pointer; transition: all 0.15s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--game-color, var(--accent)); color: var(--game-color, var(--accent)); }
.pg-btn.active { border-color: var(--game-color, var(--accent)); color: var(--game-color, var(--accent)); background: rgba(245,200,66,0.05); }
.pg-btn:disabled { opacity: 0.3; cursor: default; }

/* Loading / Empty */
.loading { display: flex; align-items: center; gap: 14px; padding: 48px 0; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 14px; }
.spin { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--game-color, var(--accent)); border-radius: 50%; animation: rot 0.7s linear infinite; flex-shrink: 0; }
/* Skeleton cards shown while JSON loads */
@keyframes skel-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skel-card { background: var(--s1); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.skel-img { aspect-ratio: 2.5/3.5; background: linear-gradient(90deg, var(--s2) 0%, #1e1e2e 50%, var(--s2) 100%); background-size: 200% 100%; animation: skel-shimmer 2s ease-in-out infinite; }
.skel-info { padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.skel-line { height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--s2) 0%, #1e1e2e 50%, var(--s2) 100%); background-size: 200% 100%; animation: skel-shimmer 2s ease-in-out infinite; }
.skel-line.w70 { width: 70%; }
.skel-line.w45 { width: 45%; }
.skel-line.w30 { width: 30%; height: 8px; }
@keyframes rot { to { transform: rotate(360deg); } }
.empty { padding: 64px 0; text-align: center; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty p { font-size: 15px; }

/* Modal */
.modal-bg { display: flex; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 200; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.18s ease, visibility 0.18s ease; }
.modal-bg.open { opacity: 1; visibility: visible; pointer-events: all; }
.modal { background: var(--s1); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto; overflow-x: hidden; position: relative; transform: scale(0.97); transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1); will-change: transform; }
.modal-bg.open .modal { transform: scale(1); }

/* ── Mobile: bottom sheet ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }
  .modal-bg.open .modal { transform: translateY(0); }
  /* Drag handle pill */
  .modal-head::before {
    content: '';
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
  }
  .modal-head { position: relative; padding-top: 22px; }
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--s3); }
.modal-body { padding: 18px 22px 22px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 22px; }
@media(max-width:500px) { .modal-body { grid-template-columns: 1fr; } }
.modal-card-col { display: flex; flex-direction: column; gap: 8px; }
.modal-card-img { width: 100%; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.08s ease-out; aspect-ratio: 5 / 7; background: var(--s2, rgba(255,255,255,0.03)); }
.modal-card-img.is-loaded { opacity: 1; }
.modal-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.modal-set { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }
.modal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: 'DM Mono', monospace; font-size: 11px; padding: 4px 10px; border-radius: 3px; background: var(--s2); border: 1px solid var(--border); color: var(--muted); }
.chip.hl { border-color: var(--game-color, var(--accent)); color: var(--game-color, var(--accent)); }
.pb-variants { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pbv { text-align: center; }
.pbv-label { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px; }
.pbv-val { font-family: 'Bebas Neue', sans-serif; font-size: 18px; color: var(--text); }

.ext-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ext-btn { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); text-decoration: none; border: 1px solid var(--border); padding: 6px 12px; border-radius: 3px; transition: all 0.15s; letter-spacing: 1px; }
.ext-btn:hover { border-color: var(--game-color, var(--accent)); color: var(--game-color, var(--accent)); }

/* New modal sections — Details, From Set, Markets */
.m-section { margin-top: 2px; }
.m-section-label { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--muted); letter-spacing: 1.5px; padding-bottom: 5px; margin-bottom: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
.m-section:empty, .m-section.is-empty { display: none; }

/* Cardmarket-style data table: label left, value right, thin separators */
.m-details-table { display: flex; flex-direction: column; }
.m-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); padding: 4px 0; border-bottom: 1px solid var(--s2); font-size: 11px; gap: 8px; }
.m-row:last-child { border-bottom: none; }
.m-row-label { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; }
.m-row-val { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.m-row-val.is-accent { color: var(--game-color, var(--accent)); }
.m-row-val.is-link { color: var(--game-color, var(--accent)); cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.m-row-val.is-link:hover { text-decoration-style: solid; }
.m-row-val.is-mono { font-family: 'DM Mono', monospace; font-size: 10.5px; }
.m-row-val .delta-up { color: #4ade80; font-family: 'DM Mono', monospace; font-size: 10px; margin-left: 6px; }
.m-row-val .delta-down { color: #ef4444; font-family: 'DM Mono', monospace; font-size: 10px; margin-left: 6px; }
.m-row-val .muted { color: var(--muted); font-size: 10px; margin-left: 4px; }

/* PSA Graded Prices section ─────────────────────────────────────── */
.psa-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.psa-tab {
  font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--border); padding: 5px 10px; border-radius: 3px;
  cursor: pointer; user-select: none; transition: border-color 0.15s, color 0.15s;
}
.psa-tab:hover { color: var(--text); }
.psa-tab.is-active { color: var(--text); background: rgba(255,255,255,0.03); }
.psa-grid { display: flex; flex-direction: column; }
.psa-row {
  display: grid; grid-template-columns: 56px minmax(0,1fr) 78px;
  align-items: center; gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--s2); font-size: 11px;
}
.psa-row:last-child { border-bottom: none; }
.psa-row-top .psa-label { color: var(--text); font-weight: 600; }
.psa-row-top .psa-val { color: var(--game-color, var(--accent)); font-weight: 600; }
.psa-label { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); letter-spacing: 0.5px; }
.psa-bar { height: 4px; background: var(--s2); border-radius: 2px; overflow: hidden; min-width: 0; }
.psa-bar-fill { height: 100%; border-radius: 2px; opacity: 0.65; transition: width 0.2s ease; }
.psa-val { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text); text-align: right; }
.psa-source { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--muted); margin-top: 8px; letter-spacing: 0.5px; }
.psa-source a { color: var(--muted); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.psa-source a:hover { color: var(--game-color, var(--accent)); }

/* Price-related rows get a subtle highlight so they group together */
.m-row.is-price { background: var(--s2); padding-left: 6px; padding-right: 6px; margin: 0 -6px; border-bottom-color: var(--border); }

.m-fromset-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--s2); border: 1px solid var(--border); border-radius: 5px; cursor: pointer; transition: all 0.15s; min-width: 0; }
.m-fromset-card:hover { border-color: var(--game-color, var(--accent)); }
.m-fromset-logo { width: 40px; height: 28px; flex: 0 0 40px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.04); border-radius: 3px; padding: 3px; }
.m-fromset-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.m-fromset-info { flex: 1; min-width: 0; }
.m-fromset-name { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-fromset-meta { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-fromset-arrow { color: var(--muted); font-size: 13px; transition: all 0.15s; flex-shrink: 0; }
.m-fromset-card:hover .m-fromset-arrow { color: var(--game-color, var(--accent)); transform: translateX(2px); }

/* Markets grid: 2 cols, compact */
#m-markets-section .ext-links { display: flex; flex-direction: column; gap: 5px; margin-top: 0; }
#m-markets-section .ext-btn { text-align: center; padding: 6px 8px; font-size: 10px; letter-spacing: 0.5px; }

/* Price block — tighter than before */
.price-box { background: var(--s2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.pb-main-val { font-family: 'Bebas Neue', sans-serif; font-size: 38px; color: var(--game-color, var(--accent)); line-height: 1; }

/* Inline price chart on full width */
.pb-chart-full { height: 60px; position: relative; margin-top: 6px; cursor: pointer; background: rgba(0,0,0,0.15); border-radius: 3px; overflow: hidden; }
.pb-chart-full canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Staggered fade-in for card grid — each tile delays slightly after the previous */
.card-tile:nth-child(1)  { animation-delay: 0ms; }
.card-tile:nth-child(2)  { animation-delay: 40ms; }
.card-tile:nth-child(3)  { animation-delay: 80ms; }
.card-tile:nth-child(4)  { animation-delay: 120ms; }
.card-tile:nth-child(5)  { animation-delay: 160ms; }
.card-tile:nth-child(6)  { animation-delay: 200ms; }
.card-tile:nth-child(7)  { animation-delay: 240ms; }
.card-tile:nth-child(8)  { animation-delay: 280ms; }
.card-tile:nth-child(9)  { animation-delay: 320ms; }
.card-tile:nth-child(10) { animation-delay: 360ms; }
.card-tile:nth-child(11) { animation-delay: 390ms; }
.card-tile:nth-child(12) { animation-delay: 420ms; }
.card-tile:nth-child(n+13) { animation-delay: 440ms; }

/* Top banner — static, stays at top, doesn't scroll with page */
.top-banner {
  position: static;
  width: 100%; display: flex; justify-content: center; align-items: center;
  padding: 8px 24px; height: 76px;
  box-sizing: border-box;
}
.bottom-banner {
  width: 100%; display: flex; justify-content: center;
  padding: 8px 24px; margin-top: 16px;
}
.banner-slot {
  width: 100%; max-width: 728px; height: 60px;
  border: 1px solid rgba(255,255,255,0.015); border-radius: 4px;
}

.img-zoom-bg{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.92);z-index:400;align-items:center;justify-content:center;cursor:zoom-out;pointer-events:none;}
.img-zoom-bg.open{display:flex;pointer-events:all;}
.img-zoom-bg img{max-height:85vh;max-width:85vw;border-radius:10px;box-shadow:0 16px 64px rgba(0,0,0,0.8);}
.coming-soon-tip { position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%); background:var(--s1); border:1px solid var(--border); color:var(--muted); font-family:'DM Mono',monospace; font-size:10px; padding:4px 8px; border-radius:4px; white-space:nowrap; pointer-events:none; z-index:100; }

/* ── Subpage (About / Privacy / Terms) ─────────────────────────── */
#subpage { display: none; }
body.subpage-active .wrap > *:not(header) { display: none !important; }
body.subpage-active #subpage { display: block !important; padding: 48px 0 64px; }
.subpage-back { display: inline-flex; align-items: center; gap: 6px; font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 1px; color: var(--muted); text-decoration: none; margin-bottom: 36px; transition: color 0.15s; }
.subpage-back:hover { color: var(--accent); }
.subpage-title { font-family: 'Bebas Neue', sans-serif; font-size: 52px; letter-spacing: 3px; color: var(--text); margin-bottom: 32px; line-height: 1; }
.subpage-section-title { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; margin-top: 28px; }
.subpage-section-title:first-of-type { margin-top: 0; }
.subpage-body p { font-family: 'DM Sans', sans-serif; font-size: 15px; color: var(--muted); line-height: 1.8; margin-bottom: 16px; }
.subpage-body p:last-child { margin-bottom: 0; }
.subpage-body strong { color: var(--text); font-weight: 500; }
.subpage-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
#set-sheet-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 99998; backdrop-filter: blur(2px);
}
#set-sheet-overlay.open { display: block; }
#set-sheet {
  display: none; position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--s1); border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0; z-index: 99999;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 80vh; display: flex; flex-direction: column;
}
#set-sheet.open { transform: translateY(0); display: flex; }
#set-sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 10px auto 0; flex-shrink: 0;
}
#set-sheet-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: 3px;
  color: var(--muted); padding: 10px 16px 8px; flex-shrink: 0;
}
#set-sheet-search-wrap { padding: 0 12px 8px; flex-shrink: 0; }
#set-sheet-search {
  width: 100%; box-sizing: border-box; font-family: 'DM Mono', monospace;
  font-size: 13px; background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 6px; outline: none;
}
#set-sheet-list { overflow-y: auto; flex: 1; }

/* ============================================================
   TOPTCGS redesign — homepage structure (matches mockups)
   ============================================================ */

/* Top nav bar */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  background: rgba(10,10,15,0.95); position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(8px);
}
.topnav-logo { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 2px; color: var(--accent); text-decoration: none; }
.topnav-logo span { color: var(--text); }
.topnav-links { display: flex; gap: 4px; font-size: 13px; }
.topnav-link { color: rgba(255,255,255,0.45); cursor: pointer; transition: all 0.2s; text-decoration: none; padding: 5px 12px; border-radius: 6px; font-weight: 500; letter-spacing: 0.2px; }
.topnav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.topnav-link.active { color: var(--accent); background: rgba(245,208,32,0.06); border: 0.5px solid rgba(245,208,32,0.18); border-bottom: 1.5px solid var(--accent); }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.topnav-btn {
  font-size: 12px; padding: 6px 14px; border-radius: 6px;
  border: 0.5px solid rgba(245,208,32,0.4); color: var(--accent);
  background: rgba(245,208,32,0.12); cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.topnav-btn:hover { background: rgba(245,208,32,0.2); }

/* Topnav inline search (blog-style) */
.topnav-search-inline {
  flex: 1; max-width: 380px; margin: 0 1rem; position: relative;
}
.topnav-search-inline input {
  width: 100%; background: rgba(255,255,255,0.05); border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 7px; padding: 8px 12px 8px 34px; font-size: 13px; color: var(--text);
  font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.15s;
}
.topnav-search-inline input:focus { border-color: rgba(245,208,32,0.45); }
.topnav-search-inline input::placeholder { color: rgba(255,255,255,0.22); }
.tsi-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 15px; color: rgba(255,255,255,0.25); pointer-events: none;
}

/* Blog nav right group */
.nav-right-group { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-right-group .nav-links { display: flex; gap: 4px; }
.nav-signin-btn {
  font-size: 12px; padding: 6px 14px; border-radius: 6px;
  border: 0.5px solid rgba(245,208,32,0.4); color: #f5d020;
  background: rgba(245,208,32,0.12); cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.nav-signin-btn:hover { background: rgba(245,208,32,0.2); }

/* Centered hero (mockup style) */
.wrap { text-align: center; }
.hero { padding: 3rem 0 1.5rem; }
.hero-eyebrow {
  font-size: 11px; letter-spacing: 3px; color: var(--accent);
  text-transform: uppercase; margin-bottom: 0.75rem; font-weight: 500;
}
.hero h1 { font-size: 56px; }
.hero p#hero-desc { color: rgba(255,255,255,0.4); font-size: 14px; max-width: none; margin: 0 auto 1.5rem; }
.search-wrap { max-width: 640px; margin: 0 auto 1.25rem; }
.search-box { margin-top: 0; }

/* Filter pills */
.filter-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.filter-pill {
  font-size: 12px; padding: 5px 12px; border-radius: 20px;
  border: 0.5px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.03); cursor: pointer; transition: all 0.2s;
}
.filter-pill:hover, .filter-pill.active {
  border-color: rgba(245,208,32,0.5); color: var(--accent); background: rgba(245,208,32,0.06);
}

/* Stats bar */
.stats-bar { display: flex; gap: 2rem; justify-content: center; padding: 0.5rem 0 0; font-size: 12px; color: rgba(255,255,255,0.3); flex-wrap: wrap; }
.stats-bar strong { color: rgba(255,255,255,0.65); }

/* Functional filter row — now centered under hero */
.filters { justify-content: center; padding-top: 1rem; border-top: 0.5px solid rgba(255,255,255,0.05); margin-top: 1.25rem; }

/* Section tabs */
.home-tabs { display: flex; gap: 0; justify-content: center; border-bottom: 0.5px solid rgba(255,255,255,0.08); margin: 0.5rem 0 1.25rem; }
.home-tab { font-size: 13px; padding: 10px 16px; cursor: pointer; color: rgba(255,255,255,0.4); border-bottom: 2px solid transparent; transition: all 0.2s; font-weight: 500; }
.home-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.home-tab:hover { color: rgba(255,255,255,0.7); }

/* Results grid left-aligned again */
#results-area {
  text-align: left;
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.15s forwards;
}

/* From the blog */
.home-blog { text-align: left; margin: 2.5rem 0 1rem; }
.home-blog-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 10px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.home-blog-title {
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(255,255,255,0.3); font-weight: 500; font-family: 'DM Mono', monospace;
}
.home-blog-link { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 500; }
.home-blog-link:hover { color: var(--accent-bright); }
.home-blog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-blog-card {
  background: var(--s1); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: border-color 0.2s; text-decoration: none; display: block;
}
.home-blog-card:hover { border-color: rgba(245,208,32,0.25); }
/* Tag color coding like blog */
.hbc-tag { font-size: 9px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.hbc-tag.tag-market { color: #a5b4fc; }
.hbc-tag.tag-price   { color: #f5d020; }
.hbc-tag.tag-guide   { color: #6ee7b7; }
.hbc-tag.tag-tour    { color: #fca5a5; }
.hbc-tag.tag-invest  { color: #fdba74; }
.hbc-tag.tag-new     { color: #f5d020; }
.hbc-title { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; margin-bottom: 5px; }
.hbc-meta { font-size: 10px; color: rgba(255,255,255,0.22); }

/* Bottom mobile nav */
.bottom-nav { display: none; }
@media (max-width: 700px) {
  .home-blog-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 42px; }
  .stats-bar { gap: 1rem; }
  .bottom-nav {
    display: flex; justify-content: space-around; align-items: center;
    padding: 10px 1rem; position: fixed; bottom: 0; left: 0; right: 0;
    border-top: 0.5px solid rgba(255,255,255,0.08); background: rgba(10,10,15,0.98);
    z-index: 95; backdrop-filter: blur(8px);
  }
  .bnav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: rgba(255,255,255,0.35); font-size: 10px; text-decoration: none; }
  .bnav-item.active, .bnav-item:hover { color: var(--accent); }
  .bnav-item .bni { font-size: 18px; }
  .wrap { padding-bottom: 70px; }
}

/* Explorer page — compact hero (no marketing headline) */
.hero-compact { padding: 2rem 0 1rem; }
.hero-compact .search-wrap { margin-top: 0; }

/* ============================================================
   Landing page (index.html) — static marketing page
   ============================================================ */
.wrap.landing { text-align: center; max-width: 860px; }
.landing-hero, .hero.landing-hero {
  padding: 4.5rem 0 3rem; position: relative;
}
.landing-hero::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 640px; height: 340px; max-width: 100%;
  background: radial-gradient(ellipse at center, rgba(245,208,32,0.09) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.landing-hero > * { position: relative; z-index: 1; }
.landing-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 64px; line-height: 0.92;
  letter-spacing: 1px; color: #fff; margin-bottom: 0.6rem;
}
.landing-title em { font-style: normal; color: var(--accent); display: block; }
.landing-sub { font-size: 14px; color: rgba(255,255,255,0.4); margin-bottom: 2rem; }
.landing-search { max-width: 600px; margin: 0 auto 1.25rem; }
.landing-search .search-box { margin-top: 0; }

.landing-quick { font-size: 13px; color: rgba(255,255,255,0.35); display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; align-items: center; }
.landing-quick .lq-label { color: rgba(255,255,255,0.25); letter-spacing: 0.5px; }
.landing-quick a { color: rgba(255,255,255,0.55); text-decoration: none; transition: color 0.15s; }
.landing-quick a:hover { color: var(--accent); }
.landing-quick .lq-all { color: var(--accent); font-weight: 500; }

/* Make the Blog nav link stand out */
.topnav-link-blog {
  color: var(--accent) !important; font-weight: 600;
  border: 0.5px solid rgba(245,208,32,0.4); border-radius: 6px;
  padding: 5px 12px !important; background: rgba(245,208,32,0.08);
}
.topnav-link-blog:hover { background: rgba(245,208,32,0.18); }

.home-blog { text-align: left; margin: 1rem auto 2rem; max-width: 860px; }
.landing-footer { text-align: center; padding: 2rem 0 3rem; border-top: 0.5px solid rgba(255,255,255,0.06); margin-top: 2rem; }
.landing-footer p { font-size: 11px; color: rgba(255,255,255,0.25); line-height: 1.6; max-width: 520px; margin: 0 auto 1rem; }
.landing-footer-links { display: flex; gap: 1.25rem; justify-content: center; font-size: 12px; }
.landing-footer-links a { color: rgba(255,255,255,0.4); text-decoration: none; }
.landing-footer-links a:hover { color: var(--accent); }

@media (max-width: 700px) {
  .landing-title { font-size: 46px; }
  .landing-hero { padding: 3rem 0 2rem; }
}

/* ── Shared nav autocomplete dropdown (index + blog) ── */
.ns-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 120;
  background: #14141c; border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 10px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}
.ns-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-decoration: none; border-bottom: 0.5px solid rgba(255,255,255,0.05); }
.ns-item:hover { background: rgba(245,208,32,0.06); }
.ns-thumb { width: 30px; height: 42px; flex-shrink: 0; border-radius: 4px; background: rgba(255,255,255,0.06) center/cover no-repeat; }
.ns-info { display: flex; flex-direction: column; min-width: 0; }
.ns-name { font-size: 13px; color: var(--text); font-weight: 500; }
.ns-meta { font-size: 11px; color: rgba(255,255,255,0.4); font-family: 'DM Mono', monospace; }
.ns-all { display: block; padding: 10px 12px; font-size: 12px; color: var(--accent); text-decoration: none; text-align: center; font-weight: 500; }
.ns-all:hover { background: rgba(245,208,32,0.06); }
