/* =============================================================================
   BinderByte — iOS 26 liquid glass theme
   Sections:
     1. Tokens (CSS variables)
     2. Reset + base
     3. Animated mesh background
     4. Glass primitive + scroll glint
     5. Header
     6. Stats grid
     7. Panels (incl. collapsible eras)
     8. Sets grid
     9. Form & buttons
     10. Filters
     11. Cards grid (Pokémon cards)
     12. Toast
     13. Type colors
     14. Responsive + a11y
   ============================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --apple-blue: #007AFF;
  --apple-green: #34C759;
  --apple-red: #FF3B30;
  --apple-orange: #FF9500;
  --apple-yellow: #FFCC00;
  --apple-purple: #AF52DE;
  --apple-pink: #FF2D55;
  --apple-teal: #5AC8FA;
  --apple-indigo: #5856D6;

  --poke-yellow: #FFCB05;
  --poke-red: #DC0A2D;

  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-bg-strong: rgba(255, 255, 255, 0.6);
  --glass-bg-subtle: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-highlight: rgba(255, 255, 255, 0.6);

  --text: rgba(0, 0, 0, 0.92);
  --text-2: rgba(0, 0, 0, 0.6);
  --text-3: rgba(0, 0, 0, 0.4);
  --hairline: rgba(0, 0, 0, 0.08);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --apple-ease: cubic-bezier(0.32, 0.72, 0, 1);

  --shadow-glass:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 8px 24px rgba(0, 0, 0, 0.06),
    0 24px 50px -16px rgba(0, 0, 0, 0.10);
  --shadow-lifted:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 16px 36px rgba(0, 0, 0, 0.10),
    0 32px 72px -20px rgba(0, 0, 0, 0.14);
}

/* ---------- 2. Reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Inter, sans-serif;
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #fef3e0;
  letter-spacing: -0.01em;
}

/* ---------- 3. Background — photo wallpaper for showcasing glass refraction ---------- */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('assets/bg-wallpaper.jpg') center/cover no-repeat;
}

/* Pokéball pattern overlay — sits above the colored mesh so the dots stay
   visible even after the glass surfaces blur the backdrop. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><circle cx='60' cy='60' r='22' fill='none' stroke='%23000' stroke-width='1.5' opacity='0.08'/><line x1='38' y1='60' x2='82' y2='60' stroke='%23000' stroke-width='1.5' opacity='0.08'/><circle cx='60' cy='60' r='6' fill='none' stroke='%23000' stroke-width='1.5' opacity='0.08'/></svg>");
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 32px 96px;
}

/* ---------- 4. Glass primitive + scroll glint ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  /* --glass-refract is set by src/glass-refraction.js to url(#filterId)
     where the filter handles the WHOLE pipeline (blur + saturate + lens
     refraction + specular). Chrome ignores url(#x) if mixed with other
     filter functions, so it has to stand alone. When the var is unset
     (Safari/Firefox, or before the filter has been generated) we fall
     back to the original CSS-only blur+saturate. */
  backdrop-filter: var(--glass-refract, blur(40px) saturate(180%));
  -webkit-backdrop-filter: var(--glass-refract, blur(40px) saturate(180%));
  border: 0.5px solid var(--glass-border);
  /* Inner refraction ring — bright top edge + faint bottom edge simulate
     light bending at the glass boundary. Layered on top of the base shadow. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    var(--shadow-glass);
  border-radius: 32px;
  overflow: hidden;
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  /* Pointer-tracked specular highlight layered over the top-edge sheen.
     --mx/--my are set per-element by src/liquid-glass.js (0–100 %). When
     no pointer is hovering, --my defaults to -50 % so the radial sits
     above the surface and the linear gradient alone is visible. */
  background:
    radial-gradient(220px circle at var(--mx, 50%) var(--my, -50%),
      rgba(255, 255, 255, 0.28),
      transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 22%, transparent 78%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
  z-index: 0;
  transition: background-position 0.25s var(--ease-out);
}
.glass > * { position: relative; z-index: 1; }

/* Liquid tint — a conic colored wash that rotates as you scroll, so the
   corners of every glass surface flow through Pokémon-palette hues. */
.glass::after {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  right: -40px;
  bottom: -40px;
  background: conic-gradient(from var(--tint-angle, 0deg) at 50% 50%,
    rgba(255, 203, 5,  0.55)   0deg,
    rgba(255, 100, 30, 0.50)  72deg,
    rgba(255, 45, 85,  0.55) 144deg,
    rgba(175, 82, 222, 0.55) 216deg,
    rgba(0, 122, 255,  0.50) 288deg,
    rgba(255, 203, 5,  0.55) 360deg);
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
  opacity: 0.55;
  filter: blur(16px);
}

.glint-target { --glint: 0.5; }
.glint-target > .glint {
  display: none; /* scroll-driven shine disabled per user preference */
  position: absolute;
  pointer-events: none;
  top: -15%;
  left: calc(var(--glint) * 175% - 45%);
  width: 30%;
  height: 130%;
  transform: skewX(-22deg);
  background: linear-gradient(100deg,
    transparent 25%,
    rgba(255, 255, 255, 0.65) 50%,
    transparent 75%);
  filter: blur(2px);
  z-index: 4;
  border-radius: inherit;
  opacity: 0.85;
  mix-blend-mode: screen;
  will-change: left;
}

/* ---------- 5. Header ---------- */
.header {
  padding: 44px 56px;
  margin-bottom: 22px;
  min-height: 300px;
  display: flex;
  align-items: center;
  border-radius: 40px;
}
.header-inner { max-width: 58%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 6px 12px 6px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 8px rgba(52, 199, 89, 0.6);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.4); }
}

h1 {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 14px;
}
h1 .accent {
  background: linear-gradient(135deg, var(--apple-red) 0%, var(--apple-orange) 50%, var(--poke-yellow) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
}
.header p {
  font-size: 17px;
  color: var(--text-2);
  max-width: 460px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.pikachu-hero {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  height: calc(100% - 48px);
  max-height: 280px;
  width: auto;
  z-index: 5;
  filter: drop-shadow(0 24px 32px rgba(220, 10, 45, 0.25)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
  animation: float 4.5s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes float {
  0%, 100% { transform: translateY(-50%) rotate(-2deg); }
  50%      { transform: translateY(calc(-50% - 12px)) rotate(2.5deg); }
}

/* ---------- 6. Stats grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 22px 24px;
  border-radius: 22px;
  transition: transform 0.4s var(--spring), box-shadow 0.3s var(--ease-out);
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-lifted);
}
.stat-card .icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 4px 10px rgba(0, 0, 0, 0.08);
}
.stat-card .icon svg { width: 18px; height: 18px; }
.stat-card.total .icon       { background: linear-gradient(180deg, #5e9cff, var(--apple-blue));   color: white; }
.stat-card.owned .icon       { background: linear-gradient(180deg, #4ed670, var(--apple-green));  color: white; }
.stat-card.missing .icon     { background: linear-gradient(180deg, #ff5e57, var(--apple-red));    color: white; }
.stat-card.wishlist .icon    { background: linear-gradient(180deg, #ff6b9d, #ff2d78);             color: white; }
.stat-card.value-card .icon  { background: linear-gradient(180deg, #ffd34d, var(--apple-orange)); color: white; }

.stat-card .label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.stat-card .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 7. Panels + collapsible eras ---------- */
.panel {
  padding: 28px 30px;
  margin-bottom: 18px;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}
.panel h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel h2 .emoji {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}
.panel h2 .emoji svg { width: 18px; height: 18px; }

.emoji-ss      { background: linear-gradient(180deg, #ffd34d, var(--apple-orange)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(255,149,0,0.3); }
.emoji-sv      { background: linear-gradient(180deg, #d27aff, var(--apple-purple)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(175,82,222,0.35); }
.emoji-add     { background: linear-gradient(180deg, #5e9cff, var(--apple-blue));   box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(0,122,255,0.3); }
.emoji-vintage { background: linear-gradient(180deg, #ffd34d, #b45309);             box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(180,83,9,0.35); }
.emoji-collection { background: linear-gradient(180deg, #4ed670, var(--apple-green));box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(52,199,89,0.35); }
.emoji-mid     { background: linear-gradient(180deg, #5ec5ff, var(--apple-blue));   box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(0,122,255,0.3); }
.emoji-modern  { background: linear-gradient(180deg, #d27aff, var(--apple-pink));   box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px rgba(255,45,85,0.3); }

.panel-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 4px;
  letter-spacing: -0.005em;
}
.panel-subtitle strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Era trigger button */
.era-trigger {
  display: flex;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: opacity 0.2s var(--ease-out);
}
.era-trigger:hover { opacity: 0.72; }
.era-trigger:active { opacity: 0.55; transition-duration: 0.05s; }

.chevron {
  width: 26px;
  height: 26px;
  color: var(--text-2);
  transition: transform 0.55s var(--apple-ease);
  flex-shrink: 0;
}
.era.collapsed .chevron { transform: rotate(-90deg); }

/* Era panels get the full Liquid Glass refraction like every other .glass
   surface: glass-refraction.js sets --glass-refract on them (full-res when the
   dropdown is short, or its CAPPED path when it's thousands of px tall — see
   that file). The fallback below only applies where refraction is unavailable
   (non-Chromium, or a panel taller than BIG_MAX_WH): a much smaller blur radius
   than the .glass default — GPU cost scales ~kernel-radius², so 14px is ~8×
   cheaper per pixel than blur(40px), which matters on these large surfaces.
   Bump it for a softer frosted fallback; drop it if FPS dips. */
.glass.panel.era {
  backdrop-filter: var(--glass-refract, blur(14px) saturate(160%));
  -webkit-backdrop-filter: var(--glass-refract, blur(14px) saturate(160%));
}

.era-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--apple-ease);
}
.era.collapsed .era-body { grid-template-rows: 0fr; }

.era-body-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 22px;
  transition: opacity 0.4s var(--ease-out), padding-top 0.55s var(--apple-ease), filter 0.4s var(--ease-out);
}
.era.collapsed .era-body-inner {
  opacity: 0;
  padding-top: 0;
  filter: blur(8px);
}

/* Sub-era (one level inside a super-era — e.g. WOTC inside Vintage) */
.sub-era {
  background: rgba(255, 255, 255, 0.28);
  border: 0.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 18px;
  padding: 18px 22px;
  margin-top: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(0, 0, 0, 0.03);
}
.sub-era:first-child { margin-top: 0; }

.sub-era-trigger {
  display: flex;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: opacity 0.2s var(--ease-out);
}
.sub-era-trigger:hover { opacity: 0.72; }
.sub-era-trigger:active { opacity: 0.55; transition-duration: 0.05s; }

.sub-era-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sub-era-meta {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 3px;
  letter-spacing: -0.005em;
}
.sub-era-meta strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sub-era .chevron {
  width: 22px;
  height: 22px;
  color: var(--text-2);
  transition: transform 0.55s var(--apple-ease);
  flex-shrink: 0;
}
.sub-era.collapsed .chevron { transform: rotate(-90deg); }

.sub-era-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--apple-ease);
}
.sub-era.collapsed .sub-era-body { grid-template-rows: 0fr; }

.sub-era-body-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 16px;
  transition: opacity 0.4s var(--ease-out), padding-top 0.55s var(--apple-ease), filter 0.4s var(--ease-out);
}
.sub-era.collapsed .sub-era-body-inner {
  opacity: 0;
  padding-top: 0;
  filter: blur(6px);
}

/* Nested subgroup (e.g. promos inside a sub-era) */
.subgroup {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 0.5px solid var(--hairline);
}
.subgroup-trigger {
  display: flex;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: opacity 0.2s var(--ease-out);
}
.subgroup-trigger:hover { opacity: 0.7; }
.subgroup-trigger:active { opacity: 0.55; transition-duration: 0.05s; }

.subgroup-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.subgroup-icon {
  color: var(--apple-orange);
  font-size: 14px;
  text-shadow: 0 0 8px rgba(255, 149, 0, 0.4);
}
.subgroup-count {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 100px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.subgroup .chevron {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: transform 0.55s var(--apple-ease);
}
.subgroup.collapsed .chevron { transform: rotate(-90deg); }

.subgroup-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--apple-ease);
}
.subgroup.collapsed .subgroup-body { grid-template-rows: 0fr; }

.subgroup-body-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 14px;
  transition: opacity 0.4s var(--ease-out), padding-top 0.55s var(--apple-ease), filter 0.4s var(--ease-out);
}
.subgroup.collapsed .subgroup-body-inner {
  opacity: 0;
  padding-top: 0;
  filter: blur(6px);
}

/* ---------- 8. Sets grid ---------- */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.set-tile {
  /* No backdrop-filter — when all era dropdowns are open there are 100+ tiles
     on screen, each blurring the wallpaper per frame. More opaque background
     keeps the look without the GPU rasterization cost. */
  background: rgba(255, 255, 255, 0.62);
  border: 0.5px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 4px 14px rgba(0, 0, 0, 0.04);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.4s var(--spring), background 0.3s;
  position: relative;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 280px 140px;
}
.set-tile:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.78);
}
.set-tile.has-cards {
  background: rgba(255, 230, 145, 0.62);
  border-color: rgba(255, 203, 5, 0.4);
}
.set-tile.has-cards:hover { background: rgba(255, 230, 145, 0.78); }

.set-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.set-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.set-info {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: -0.005em;
}
.set-owned-line {
  font-size: 12px;
  color: var(--apple-green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 1;
}
.set-owned-line::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apple-green);
}

/* Set completion progress bar — sits under the top header, above the owned
   line. Thin and unobtrusive at 0% so empty sets don't shout; fills with
   apple-green so it visually rhymes with the .set-owned-line dot. */
.set-progress {
  position: relative;
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
  z-index: 1;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.03);
}
.set-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4ad373, var(--apple-green));
  border-radius: 999px;
  transition: width 0.5s var(--apple-ease);
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.35);
}
/* Slight gold tint + softer glow when the set is 100% — gives a small visual
   reward without screaming. */
.set-progress.complete .set-progress-fill {
  background: linear-gradient(90deg, var(--poke-yellow), #ffaa00);
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.45);
}
/* "23/102 · 23%" label under the bar. Tabular numerals so the figures don't
   jitter as counts change; tertiary text so it stays subordinate to the name. */
.set-progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
  position: relative;
  z-index: 1;
}
.set-progress-label.complete {
  color: #9a6a00;
}
/* Complete set tile: subtle gold accent ring + warmer surface, so a finished
   set reads as a small reward at a glance without overpowering the grid. */
.set-tile.complete {
  border-color: rgba(255, 203, 5, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 203, 5, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* Era / sub-era completion rollup, riding inline with the loaded/owned counts
   in the header subtitle. Subtle pill so it stays consistent with the rest of
   the header text. */
.era-rollup {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-2);
}
.era-rollup:not(:empty)::before {
  content: '· ';
  font-weight: 500;
  color: var(--text-3);
}
.set-count {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.set-tile.has-cards .set-count {
  background: var(--poke-yellow);
  color: #4a2f00;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.06);
}
.set-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.set-actions .btn { flex: 1; padding: 9px 14px; font-size: 13px; }

/* Master-set variant of the progress bar — blue gradient so it visually reads
   as a distinct (variant-level) metric vs the green standard-completion bar. */
.set-progress.master .set-progress-fill {
  background: linear-gradient(90deg, #4d9bff, var(--apple-blue));
  box-shadow: 0 0 6px rgba(0, 122, 255, 0.3);
}
/* A 100% master set is necessarily a 100% standard set too, so a complete
   master bar takes the same gold reward as the standard one (the value span
   also gets a ✓ — a non-color cue for the completion state). */
.set-progress.master.complete .set-progress-fill {
  background: linear-gradient(90deg, var(--poke-yellow), #ffaa00);
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.45);
}

/* ---------- Catalog completion summary ---------- */
/* Sits above the loaded-card grid. Shows aggregate standard + master-set
   progress across the loaded sets plus the "Show missing only" toggle. */
.cards-summary {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.cards-summary-metrics {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cards-summary-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.cards-summary-metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.cards-summary-metric-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.cards-summary-toggle {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  border: 0.5px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: all 0.25s var(--ease-out);
}
.cards-summary-toggle:hover { background: rgba(255, 255, 255, 0.75); }
.cards-summary-toggle:focus-visible { outline: 2px solid var(--apple-blue); outline-offset: 2px; }
.cards-summary-toggle.on {
  color: #fff;
  background: var(--apple-blue);
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(0, 122, 255, 0.3);
}

/* ---------- 9. Form & buttons ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
input, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  border-radius: 14px;
  color: var(--text);
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: all 0.25s var(--ease-out);
  letter-spacing: -0.01em;
}
input::placeholder { color: var(--text-3); font-weight: 500; }
input:focus, select:focus {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--apple-blue);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 4px rgba(0, 122, 255, 0.18);
}
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23636363' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 16px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.28s var(--spring), box-shadow 0.2s var(--ease-out), background 0.2s, filter 0.18s var(--ease-out);
  white-space: nowrap;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
  pointer-events: none;
}
.btn:hover:not(:disabled)  { transform: translateY(-1px) scale(1.02); }
.btn:active:not(:disabled) { transform: scale(0.94); filter: brightness(1.08); transition-duration: 0.06s; }
.btn:disabled              { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #ff5e57, var(--apple-red));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 4px 14px rgba(255, 59, 48, 0.35), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 22px rgba(255, 59, 48, 0.5), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-yellow {
  background: linear-gradient(180deg, #ffd84d, var(--apple-orange));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 4px 14px rgba(255, 149, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn-yellow:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 22px rgba(255, 149, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-purple {
  background: linear-gradient(180deg, #d27aff, var(--apple-purple));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 4px 14px rgba(175, 82, 222, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn-purple:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 22px rgba(175, 82, 222, 0.55), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-blue {
  background: linear-gradient(180deg, #5ec5ff, var(--apple-blue));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 4px 14px rgba(0, 122, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn-blue:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 22px rgba(0, 122, 255, 0.55), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--text);
  border: 0.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
}
.btn-glass:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.75);
}

/* ---------- 10. Filters ---------- */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  align-items: center;
}
.search-wrap { flex: 1; min-width: 240px; position: relative; }
.search-wrap input { padding-left: 42px; }
/* My Collection: a shorter search bar (doesn't grow to fill the row) paired
   with the sort dropdown pushed to the right. */
.owned-search-wrap { flex: 0 1 360px; }
.sort-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sort-wrap select { width: auto; min-width: 190px; }
.sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
}
.filter-group {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 14px;
  padding: 4px;
}
.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 10px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.25s var(--ease-out);
  letter-spacing: -0.01em;
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* ---------- 11. Cards grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  /* No backdrop-filter — with 50+ cards on screen each blurring the wallpaper
     was the dominant GPU cost. The more opaque background keeps the frosted
     look without the per-frame GPU rasterization. */
  background: rgba(255, 255, 255, 0.72);
  border: 0.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  position: relative;
  transition: transform 0.4s var(--spring), box-shadow 0.3s var(--ease-out), border-color 0.2s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Skip layout + paint for offscreen cards. intrinsic-size keeps scroll
     position stable while the browser hasn't measured the real card yet. */
  content-visibility: auto;
  contain-intrinsic-size: 240px 460px;
  contain: paint;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 25%);
  pointer-events: none;
  z-index: 1;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 4px rgba(0, 0, 0, 0.04), 0 20px 44px rgba(0, 0, 0, 0.12);
}
.card.owned {
  border-color: rgba(52, 199, 89, 0.55);
  background: rgba(220, 255, 230, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 0 0 1px rgba(52, 199, 89, 0.15), 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(52, 199, 89, 0.1);
}

.card-image-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(0, 0, 0, 0.04) 100%);
  aspect-ratio: 245 / 342;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s var(--ease-out);
}
.card:hover .card-image-wrap img { transform: scale(1.05); }
.card-image-wrap .no-image {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-3);
  padding: 16px;
  text-align: center;
  letter-spacing: -0.02em;
}
.card.unowned .card-image-wrap img { filter: grayscale(0.55) opacity(0.62); transition: filter 0.4s; }
.card.unowned:hover .card-image-wrap img { filter: grayscale(0) opacity(1); }

.card-body { padding: 14px 16px 16px; position: relative; z-index: 2; }

.card-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.06);
}
.card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-set {
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 10px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-top: 0.5px solid var(--hairline);
  margin-bottom: 10px;
}
.card-rarity {
  font-size: 10.5px;
  color: var(--text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.card-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--apple-green);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.card-actions { display: flex; gap: 6px; }

.btn-toggle {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.25s var(--spring);
  letter-spacing: -0.01em;
  border: 0.5px solid;
  position: relative;
  overflow: hidden;
}
.btn-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
  pointer-events: none;
}
.btn-toggle:active { transform: scale(0.95); }

.btn-owned {
  background: linear-gradient(180deg, #4ed670, var(--apple-green));
  color: white;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 6px rgba(52, 199, 89, 0.3);
}
.btn-unowned {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  color: var(--text-2);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn-unowned:hover {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.btn-delete {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  color: var(--text-3);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.25s var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn-delete:hover {
  background: var(--apple-red);
  color: white;
  border-color: var(--apple-red);
}

/* Quantity controls — − [N] +  used in card grids and the detail overlay */
.qty-controls {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: linear-gradient(180deg, #4ed670, var(--apple-green));
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 6px rgba(52, 199, 89, 0.3);
}
.btn-qty {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s var(--ease-out), transform 0.18s var(--spring);
  font-family: inherit;
}
.btn-qty:hover  { background: rgba(255, 255, 255, 0.38); }
.btn-qty:active { transform: scale(0.92); }
.qty-value {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.card-value-sub {
  color: var(--text-2);
  font-weight: 500;
  font-size: 11.5px;
  margin-left: 4px;
}

/* Detail overlay — qty row sits beside the Remove-all button */
.detail-qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-qty-row .qty-controls {
  flex: 0 0 auto;
  min-width: 120px;
}

/* Trade row qty stepper — − / N / + pill that lives between the card meta
   and the price. Plus is disabled at the your-side cap (owned == qty). */
.trade-row-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.6);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 100px;
  padding: 2px 4px;
}
.trade-row-step {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.trade-row-step:not(:disabled):hover {
  background: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
}
.trade-row-step:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.trade-row-step-qty {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 16px;
  text-align: center;
}

.owned-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(180deg, #4ed670, var(--apple-green));
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(52, 199, 89, 0.45), 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Wishlist badge — sits in the same top corner family as owned-badge. When
   a card is both owned and wishlisted, the owned badge wins the top-right
   slot and the wish badge stacks on the top-left. Pink to read as
   "wished/saved" without competing with the owned green. */
.wish-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(180deg, #ff7aa8, #e8336d);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 8px rgba(232, 51, 109, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Heart toggle on every card tile. Floats over the image bottom-right; sits
   inside the .card so it can intercept its own click via the dispatcher's
   closest('[data-action]') resolution (the outer .card has data-action
   open-detail; the inner button has data-action toggle-wishlist and wins). */
.card-wish-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out), background 0.15s;
}
.card-wish-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 2;
  stroke-linejoin: round;
  transition: fill 0.18s, stroke 0.18s;
}
.card:hover .card-wish-btn,
.card-wish-btn:focus-visible,
.card-wish-btn.on {
  opacity: 1;
  transform: scale(1);
}
.card-wish-btn:hover {
  background: rgba(255, 255, 255, 0.98);
}
.card-wish-btn.on svg {
  fill: var(--apple-red, #ff3b30);
  stroke: var(--apple-red, #ff3b30);
}
.card-wish-btn.on {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(232, 51, 109, 0.3);
}

/* Subtle border tint when both owned and wishlisted, so the dual-state is
   readable at a glance. .card.owned already overrides border to green; the
   wishlist hint applies only when wishlisted-but-not-owned. */
.card.wishlisted:not(.owned) {
  border-color: rgba(232, 51, 109, 0.45);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 90px 20px;
  color: var(--text-3);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.empty-state .icon { font-size: 44px; margin-bottom: 14px; display: block; opacity: 0.5; }

/* ---------- 12. Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(140px);
  background: rgba(20, 20, 22, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 14px 22px;
  border-radius: 100px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 36px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: transform 0.5s var(--spring);
  max-width: 90vw;
  letter-spacing: -0.015em;
}
.toast.show { transform: translateX(-50%) translateY(0); }
/* Neutral confirmation / state change. Same dark glass as the base, declared
   explicitly so all three toast states live together in one block. */
.toast.info    { /* inherits .toast base — kept explicit for symmetry */ }
.toast.error   { background: rgba(255, 59, 48, 0.92); }
.toast.success { background: rgba(52, 199, 89, 0.92); }

/* ---------- 13. Type colors ---------- */
.type-fire     { background: rgba(255, 149, 0, 0.18);  color: #c2410c; }
.type-water    { background: rgba(0, 122, 255, 0.18);  color: #1e40af; }
.type-grass    { background: rgba(52, 199, 89, 0.18);  color: #166534; }
.type-electric,
.type-lightning{ background: rgba(255, 204, 0, 0.22);  color: #854d0e; }
.type-psychic  { background: rgba(255, 45, 85, 0.18);  color: #be185d; }
.type-normal   { background: rgba(142, 142, 147, 0.18);color: #475569; }
.type-fighting { background: rgba(255, 59, 48, 0.18);  color: #991b1b; }
.type-dragon   { background: rgba(175, 82, 222, 0.18); color: #5b21b6; }
.type-dark,
.type-darkness { background: rgba(0, 0, 0, 0.12);      color: #1e293b; }
.type-steel,
.type-metal    { background: rgba(142, 142, 147, 0.18);color: #475569; }
.type-fairy    { background: rgba(255, 45, 85, 0.16);  color: #9d174d; }
.type-ghost    { background: rgba(175, 82, 222, 0.18); color: #4c1d95; }
.type-ice      { background: rgba(90, 200, 250, 0.22); color: #155e75; }
.type-bug      { background: rgba(52, 199, 89, 0.18);  color: #3f6212; }
.type-rock     { background: rgba(255, 149, 0, 0.16);  color: #78350f; }
.type-ground   { background: rgba(255, 149, 0, 0.18);  color: #92400e; }
.type-poison   { background: rgba(175, 82, 222, 0.18); color: #6b21a8; }
.type-flying   { background: rgba(88, 86, 214, 0.18);  color: #3730a3; }
.type-colorless{ background: rgba(255, 255, 255, 0.5); color: #475569; }
.type-trainer  { background: rgba(255, 149, 0, 0.2);   color: #9a3412; }
.type-energy   { background: rgba(255, 59, 48, 0.18);  color: #9f1239; }

/* ---------- 14. View tabs + Trade Analyzer ---------- */

/* View switching */
#view-profile, #view-owned, #view-trade-matches, #view-feed { display: none; }
body[data-view="profile"] #view-profile { display: block; }
body[data-view="owned"] #view-owned { display: block; }
/* Trade Matches + Feed are main-nav views (header + tabs stay visible), so they
   follow the same hide-the-others pattern as collection/owned/trade. They default
   to hidden above and only their own data-view reveals them. */
body[data-view="trade-matches"] #view-trade-matches { display: block; }
body[data-view="trade-matches"] #view-collection,
body[data-view="trade-matches"] #view-trade,
body[data-view="trade-matches"] #view-owned,
body[data-view="trade-matches"] #view-profile { display: none; }
body[data-view="feed"] #view-feed { display: block; }
body[data-view="feed"] #view-collection,
body[data-view="feed"] #view-trade,
body[data-view="feed"] #view-owned,
body[data-view="feed"] #view-profile { display: none; }
body[data-view="collection"] #view-trade,
body[data-view="collection"] #view-profile,
body[data-view="collection"] #view-owned { display: none; }
body[data-view="trade"] #view-collection,
body[data-view="trade"] #view-profile,
body[data-view="trade"] #view-owned { display: none; }
body[data-view="profile"] #view-collection,
body[data-view="profile"] #view-trade,
body[data-view="profile"] #view-owned { display: none; }
body[data-view="owned"] #view-collection,
body[data-view="owned"] #view-trade,
body[data-view="owned"] #view-profile { display: none; }

/* Profile search + public profile — full-page views like the profile view.
   Both default to hidden (so every other data-view leaves them off), and only
   their own data-view reveals them. When active they also hide every other
   view container + the header/tabs chrome. */
#view-profile-search, #view-public-profile { display: none; }
body[data-view="profile-search"] #view-profile-search,
body[data-view="public-profile"] #view-public-profile { display: block; }
body[data-view="profile-search"] #view-collection,
body[data-view="profile-search"] #view-owned,
body[data-view="profile-search"] #view-trade,
body[data-view="profile-search"] #view-profile,
body[data-view="profile-search"] #view-public-profile,
body[data-view="public-profile"] #view-collection,
body[data-view="public-profile"] #view-owned,
body[data-view="public-profile"] #view-trade,
body[data-view="public-profile"] #view-profile,
body[data-view="public-profile"] #view-profile-search { display: none; }
body[data-view="profile-search"] .header,
body[data-view="profile-search"] .view-tabs,
body[data-view="public-profile"] .header,
body[data-view="public-profile"] .view-tabs { display: none; }

.view-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 5px;
  margin-bottom: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(0, 0, 0, 0.04);
  width: fit-content;
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 13px;
  padding: 10px 22px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.25s var(--ease-out);
  letter-spacing: -0.01em;
}
.view-tab:hover { color: var(--text); }

.view-tab.active {
  background: linear-gradient(180deg, #5e9cff, var(--apple-blue));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(0, 122, 255, 0.35);
}

/* Trade intro */
.trade-intro {
  padding: 24px 30px;
  margin-bottom: 18px;
}
.trade-intro h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.trade-intro h2 .emoji {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}
.trade-intro h2 .emoji svg { width: 18px; height: 18px; }

/* Trade grid */
.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.trade-side {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
}

.trade-side[data-side="your"] {
  border-top: 3px solid var(--apple-red);
}
.trade-side[data-side="their"] {
  border-top: 3px solid var(--apple-green);
}

.trade-side-header h3 {
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}

/* z-index lifts the wrapper above .trade-cards so the dropdown can be clicked
   and isn't visually overlaid by the empty-state's dashed border below. */
.trade-search-wrap {
  position: relative;
  margin: 16px 0;
  z-index: 10;
}

.trade-search {
  width: 100%;
}

.trade-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lifted);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 50;
  padding: 4px;
}
.trade-suggestions.show { display: block; }

.trade-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}
.trade-suggestion:hover { background: rgba(0, 122, 255, 0.1); }

.trade-suggestion img,
.trade-card-row img {
  width: 38px;
  height: 53px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}
.trade-no-img {
  width: 38px;
  height: 53px;
  background: var(--surface-2, rgba(0,0,0,0.06));
  border-radius: 4px;
  flex-shrink: 0;
}

.trade-row-info {
  flex: 1;
  min-width: 0;
}
.trade-row-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trade-suggestion-owned {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--apple-green);
  color: white;
  padding: 2px 6px;
  border-radius: 100px;
}
.trade-row-meta {
  font-size: 11px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-row-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--apple-green);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.trade-no-results {
  padding: 14px 16px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
/* Footer shown when the variant fanout has more matches than the 12-row
   cap. Non-interactive — nudges the user to refine instead of scrolling. */
.trade-suggestion-more {
  padding: 10px 16px;
  margin-top: 4px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
  cursor: default;
  user-select: none;
}

.trade-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.trade-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 13px;
  font-style: italic;
  border: 1.5px dashed rgba(0, 0, 0, 0.1);
  border-radius: 14px;
}

.trade-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  border: 0.5px solid var(--glass-border);
  transition: transform 0.2s var(--spring);
}
.trade-card-row:hover { transform: translateX(-2px); }

.trade-row-remove {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.6);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.trade-row-remove:hover {
  background: var(--apple-red);
  color: white;
  border-color: var(--apple-red);
}

.trade-cash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.trade-cash-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.trade-cash-input {
  position: relative;
  flex: 1;
  min-width: 0;
}
.trade-cash-currency {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
}
.trade-cash {
  width: 100%;
  background: rgba(255, 255, 255, 0.55);
  border: 0.5px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px 10px 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.trade-cash:focus {
  outline: none;
  border-color: var(--apple-blue);
  background: rgba(255, 255, 255, 0.75);
}
.trade-cash::-webkit-outer-spin-button,
.trade-cash::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.trade-cash { -moz-appearance: textfield; }

.trade-side-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 0.5px solid var(--hairline);
  font-size: 13.5px;
  color: var(--text-2);
}
.trade-side-footer strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trade-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.trade-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.trade-diff-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.trade-diff-value.positive { color: var(--apple-green); }
.trade-diff-value.negative { color: var(--apple-red); }

.trade-diff-label {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}

.trade-buttons {
  display: flex;
  gap: 10px;
}

@media (max-width: 768px) {
  .trade-grid { grid-template-columns: 1fr; }
  .trade-actions { flex-direction: column; align-items: stretch; }
  .trade-buttons { width: 100%; }
  .trade-buttons .btn { flex: 1; }
}

/* ---------- 15. Card Detail Overlay (CardDetailView + PricePanel + Chart) ---------- */

/* Blur the whole layout when the detail overlay is open */
.layout {
  transition: filter 0.45s var(--apple-ease), transform 0.45s var(--apple-ease);
  transform-origin: center top;
}
body[data-detail="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
}

#view-detail {
  position: fixed;
  inset: 0;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}
body[data-detail="open"] #view-detail {
  opacity: 1;
  visibility: visible;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 26, 0.32);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  cursor: pointer;
}

.detail-container {
  position: relative;
  width: min(92vw, 1180px);
  max-height: 90vh;
  margin: 5vh auto;
  overflow-y: auto;
  border-radius: 32px !important;
  padding: 0;
  transform: scale(0.94) translateY(20px);
  transition: transform 0.5s var(--spring);
}
body[data-detail="open"] .detail-container {
  transform: scale(1) translateY(0);
}

.detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s var(--spring), background 0.2s;
}
.detail-close:hover { background: white; transform: scale(1.05); }
.detail-close:active { transform: scale(0.92); }
.detail-close svg { width: 18px; height: 18px; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  padding: 44px;
}

/* ---- CardPreview (left) ---- */
.detail-card-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.detail-card-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 245 / 342;
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.22),
    0 10px 24px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(0,0,0,0.05));
  animation: detail-card-in 0.55s var(--spring);
}

@keyframes detail-card-in {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0);       opacity: 1; }
}

.detail-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.detail-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-3);
  padding: 24px;
  text-align: center;
}

.detail-card-info {
  text-align: center;
  max-width: 420px;
}
.detail-card-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.06);
}
.detail-card-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 8px;
}
.detail-card-meta {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.detail-card-owned-badge,
.detail-card-missing-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail-card-owned-badge {
  background: rgba(52, 199, 89, 0.18);
  color: #166534;
}
.detail-card-missing-badge {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-2);
}
.detail-toggle-owned {
  display: inline-block;
  margin-top: 14px;
  margin-left: 10px;
  padding: 6px 16px;
  font-size: 13px;
}

/* "Add to Wishlist" / "Remove from Wishlist" button inside the card detail
   modal. Pill-shaped to match the owned / missing badges that sit above it.
   Active (on) state flips to the pink wishlist accent. */
.detail-wish-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  margin-left: 10px;
  padding: 6px 14px;
  border-radius: 100px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.detail-wish-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
.detail-wish-btn:hover {
  background: rgba(232, 51, 109, 0.12);
  color: #c41d54;
}
.detail-wish-btn.on {
  background: rgba(232, 51, 109, 0.16);
  color: #c41d54;
}
.detail-wish-btn.on svg {
  fill: #e8336d;
  stroke: #e8336d;
}

/* Variant rows in the card detail view — one row per available printing
   (Normal / Reverse Holo / Holofoil / 1st Edition / etc.) with per-variant
   price and +/- controls. */
.detail-variants {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.detail-variant-row {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
/* Top line of a variant row: label + price on the left, qty/Add on the right.
   (Split out from .detail-variant-row so the opt-in cost line can stack below.) */
.detail-variant-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
/* Owned-variant treatment: subtle green tint + matching border so the user's
   actual holdings visually rise out of the "Add" rows. Rhymes with the
   .detail-card-owned-badge and .set-owned-line palette so the iOS-glass
   green stays consistent everywhere ownership is signaled. */
.detail-variant-row.owned {
  background: rgba(52, 199, 89, 0.10);
  border-color: rgba(52, 199, 89, 0.30);
}
.detail-variant-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.detail-variant-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Tiny green dot before the label on owned rows — same visual vocabulary as
   .set-owned-line::before, so "you own this" is recognized at a glance
   without reading the row. */
.detail-variant-row.owned .detail-variant-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 4px rgba(52, 199, 89, 0.5);
  flex-shrink: 0;
}
.detail-variant-price {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.detail-variant-add {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 100px;
}

/* Opt-in cost-basis line, stacked under an owned variant's main row. A compact
   "Paid $__/ea" field on the left and the per-variant P&L chip on the right. */
.detail-variant-cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}
.variant-cost-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.variant-cost-tag {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.variant-cost-currency { color: var(--text-3); }
.variant-cost-input {
  width: 72px;
  padding: 4px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.variant-cost-input:focus {
  border-color: var(--apple-green, #34c759);
  background: rgba(255, 255, 255, 0.85);
}
.variant-cost-unit { color: var(--text-3); }
.variant-cost-hint {
  font-size: 11px;
  font-style: italic;
  color: var(--text-3);
}
/* Per-variant unrealized P&L chip; green up / red down, matching the chart
   palette used elsewhere. */
.variant-pnl {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.variant-pnl.up   { color: var(--apple-green, #34c759); }
.variant-pnl.down { color: var(--apple-red, #ff3b30); }

/* ── Graded copies (PSA/CGC/BGS/SGC slabs) — detail-view section ──────────── */
.detail-graded {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.detail-graded-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-graded-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
/* "manual value" pill — graded slabs have no price API, so the value is the
   user's own. Flag it so the portfolio never implies API-sourced precision. */
.detail-graded-manual {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 2px 6px;
}
.detail-graded-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.detail-graded-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
}
.graded-slab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.graded-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #5b6470, #2f3540);
  border-radius: 6px;
  padding: 2px 7px;
}
.graded-grade-label {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.graded-field {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text-2);
}
.graded-field-tag { color: var(--text-3); font-weight: 600; }
.graded-field-unit { color: var(--text-3); }
.graded-edit {
  width: 64px;
  padding: 4px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.graded-edit:focus {
  border-color: var(--apple-green, #34c759);
  background: rgba(255, 255, 255, 0.85);
}
.graded-remove {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.graded-remove:hover {
  color: var(--apple-red, #ff3b30);
  background: rgba(255, 59, 48, 0.1);
}
/* Add-slab form */
.detail-graded-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.graded-input {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.graded-input:focus {
  border-color: var(--apple-green, #34c759);
  background: rgba(255, 255, 255, 0.9);
}
.graded-company { min-width: 72px; }
.graded-grade   { width: 64px; }
.graded-qty     { width: 52px; font-variant-numeric: tabular-nums; }
.graded-value,
.graded-cost    { width: 92px; font-variant-numeric: tabular-nums; }
.graded-add-btn { padding: 6px 14px; font-size: 12px; }

/* "◈N" graded count on a tile's owned badge. */
.owned-badge-graded {
  font-weight: 700;
  opacity: 0.95;
}

/* ── Sealed product manager (Profile panel) ──────────────────────────────── */
.sealed-manual-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 2px 6px;
  vertical-align: middle;
}
.sealed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.sealed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
}
.sealed-main { min-width: 140px; flex: 1 1 160px; }
.sealed-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.sealed-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}
.sealed-field {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text-2);
}
.sealed-field-tag { color: var(--text-3); font-weight: 600; }
.sealed-field-unit { color: var(--text-3); }
.sealed-edit {
  width: 70px;
  padding: 4px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.sealed-edit:focus {
  border-color: var(--apple-green, #34c759);
  background: rgba(255, 255, 255, 0.85);
}
.sealed-line-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sealed-remove {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.sealed-remove:hover {
  color: var(--apple-red, #ff3b30);
  background: rgba(255, 59, 48, 0.1);
}
.sealed-empty {
  font-size: 13px;
  color: var(--text-3);
  margin: 4px 0 14px;
}
.sealed-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}
.sealed-input {
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.sealed-input:focus {
  border-color: var(--apple-green, #34c759);
  background: rgba(255, 255, 255, 0.9);
}
.sealed-in-name { flex: 1 1 200px; min-width: 160px; }
.sealed-in-type { min-width: 130px; }
.sealed-in-set  { width: 130px; }
.sealed-in-qty  { width: 60px; font-variant-numeric: tabular-nums; }
.sealed-in-value,
.sealed-in-cost { width: 104px; font-variant-numeric: tabular-nums; }
.sealed-add-btn { padding: 7px 18px; font-size: 13px; }

/* Collection-wide cost-basis / P&L line under the value headline (opt-in). */
.owned-chart-pnl {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.owned-chart-pnl-cost { color: var(--text-2); }
.owned-chart-pnl-sep { color: var(--text-3); }
.owned-chart-pnl.up .owned-chart-pnl-val   { color: var(--apple-green, #34c759); }
.owned-chart-pnl.down .owned-chart-pnl-val { color: var(--apple-red, #ff3b30); }

/* Per-variant breakdown pill row under owned card tiles in the
   Collection / Profile grids. Hidden for single-variant cards (the badge
   already shows the total). */
.card-variant-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.card-variant-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Variant tag inline with trade row / suggestion meta text. */
.trade-row-variant {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 100px;
  background: rgba(0, 122, 255, 0.10);
  color: #0040c1;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
/* Your-side cap status pills. "max" = at cap (neutral cue), "over" = stale
   trade exceeds owned (red, needs attention). Whole row also gets a soft
   red tint in the overdraft case so it's visible at a glance. */
.trade-row-max {
  color: var(--text-2);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.trade-row-over {
  color: var(--apple-red);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.trade-row-overdraft {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.25);
  border-radius: 12px;
}

/* ---- PricePanel (right) ---- */
.detail-price-side,
.owned-chart {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.price-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.price-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.price-current {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Filter context line under the Collection Value headline — only shown when
   the Collection search box is non-empty. Quiet, italic, low-emphasis. */
.owned-chart-match {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  color: var(--text-3);
  letter-spacing: 0.01em;
}

/* "Real value, tracked since …" provenance line under the value-over-time
   chart — quiet, sets the honest-data expectation (no mock walk). Also used for
   the early "come back tomorrow" state before a trend exists. */
.owned-chart-note {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* Footer row: provenance note on the left, "Refresh prices" button on the
   right. */
.owned-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.owned-chart-foot .owned-chart-note { margin-top: 0; }

/* "Refresh prices" — quiet glass pill; re-prices owned sets on demand so the
   chart reflects current market value immediately. */
.owned-chart-reprice {
  margin-top: 4px;
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-2);
  background: var(--glass-bg, rgba(255, 255, 255, 0.5));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.owned-chart-reprice:hover { color: var(--text); transform: translateY(-1px); }
.owned-chart-reprice:active { transform: translateY(0); }
.owned-chart-reprice:disabled { opacity: 0.55; cursor: progress; transform: none; }

.price-change {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.price-change-arrow {
  font-size: 13px;
  font-weight: 700;
}
.price-change-value,
.price-change-pct {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.price-change-pct {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 14px;
}
.price-change-window {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-left: 2px;
}

.price-change.up    { color: var(--apple-green); }
.price-change.up    .price-change-pct { background: rgba(52, 199, 89, 0.15); }
.price-change.down  { color: var(--apple-red);   }
.price-change.down  .price-change-pct { background: rgba(255, 59, 48, 0.15); }
.price-change.up    .price-change-window,
.price-change.down  .price-change-window { color: var(--text-2); }

/* Chart */
.price-chart-wrap {
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.03);
}
.price-chart {
  width: 100%;
  height: 260px;
  display: block;
}

/* Full-bleed collection chart (Collectr style): the curve + area fill run to
   every edge, so the framing card drops its padding/border and clips the fill
   to its rounded corners. Used only by the My Collection value widget. */
.price-chart-wrap--bleed {
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 20px;
}
.price-chart--tall {
  height: 300px;
}

/* Variant picker — sits just under "Market Price", above the big dollar value.
   Mirrors the .price-range-tabs pill style so it reads as part of the same
   panel without competing for attention. Wraps when there are many variants. */
.detail-variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  padding: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.03);
  width: fit-content;
  max-width: 100%;
  align-self: flex-start;
  margin-top: 2px;
}
.detail-variant-tab {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s var(--ease-out);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.detail-variant-tab:hover { color: var(--text); }
.detail-variant-tab.active {
  background: linear-gradient(180deg, #5e9cff, var(--apple-blue));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 8px rgba(0, 122, 255, 0.3);
}

/* Range tabs */
.price-range-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  padding: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.03);
  width: fit-content;
  align-self: flex-start;
}
.price-range-tab {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s var(--ease-out);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.price-range-tab:hover { color: var(--text); }
.price-range-tab.active {
  background: linear-gradient(180deg, #5e9cff, var(--apple-blue));
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 8px rgba(0, 122, 255, 0.3);
}

/* Stats grid */
.price-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.price-stat {
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.price-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.price-stat-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---------- "Find this card" buy-links (detail price panel) ---------- */
/* Deep-links into external marketplace searches. Neutral glass pills so they
   read as a secondary action below the price chart, not a primary CTA. */
.detail-buy {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 0.5px solid var(--glass-border);
}
.detail-buy-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.detail-buy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.buy-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border: 0.5px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.28s var(--spring), box-shadow 0.2s var(--ease-out), background 0.2s;
}
.buy-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 16px rgba(0, 0, 0, 0.12);
}
.buy-link:active { transform: scale(0.96); }
.buy-link svg { width: 15px; height: 15px; opacity: 0.6; }
.buy-link:focus-visible { outline: 2px solid var(--apple-blue); outline-offset: 2px; }

/* Make existing cards in the grid feel clickable */
.card[role="button"] { cursor: pointer; }
.card:focus-visible {
  outline: 2px solid var(--apple-blue);
  outline-offset: 3px;
}

/* Responsive */
@media (max-width: 880px) {
  .detail-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 28px 22px;
  }
  .detail-card-frame { max-width: 280px; }
  .detail-card-name { font-size: 24px; }
  .price-current { font-size: 38px; }
  .price-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-container { width: 96vw; margin: 3vh auto; max-height: 94vh; border-radius: 26px !important; }
}
@media (max-width: 480px) {
  .detail-layout { padding: 22px 16px; }
  .price-current { font-size: 32px; }
}

/* ---------- 17. Auth (circle button + popover + full-screen panel) ---------- */

/* The slot anchors both the circle button and (when logged in) its popover. */
.auth-slot {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 10;
}

/* Liquid Glass refraction is now done via backdrop-filter set per element by
   src/glass-refraction.js. The .glass-refract marker class makes non-.glass
   surfaces (the avatar circle, the profile ⋯ button) eligible for the same
   treatment. The --glass-refract var is set on the element when its filter
   has been built; until then it falls back to a no-op blur(0). */

/* Circle button — appears in the header top-right. */
.auth-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.55);
  backdrop-filter: var(--glass-refract, blur(20px) saturate(180%));
  -webkit-backdrop-filter: var(--glass-refract, blur(20px) saturate(180%));
  color: var(--text, #111);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              box-shadow 0.2s ease;
}
.auth-circle:hover {
  background: rgba(255,255,255,0.9);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 8px 22px rgba(0,0,0,0.14);
}
.auth-circle:active {
  transform: scale(0.95);
}
.auth-circle svg {
  width: 22px;
  height: 22px;
}
.auth-circle.logged-in {
  background: linear-gradient(135deg, #007AFF, #5AC8FA);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
}
.auth-circle.logged-in:hover {
  background: linear-gradient(135deg, #0A84FF, #34C7FF);
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.5);
}

/* When the user has uploaded a profile picture, the circle becomes the photo. */
.auth-circle.has-image {
  background: #eee;
  border-color: transparent;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.auth-circle img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Popover (shown when logged in and the circle is clicked). */
.auth-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform-origin: top right;
  transform: translateY(-6px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.18s ease,
              transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
}
.auth-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.auth-popover-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #111);
  padding: 10px 12px 2px;
  letter-spacing: -0.01em;
}
.auth-popover-email {
  font-size: 12px;
  color: rgba(0,0,0,0.5);
  padding: 4px 12px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 4px;
  word-break: break-all;
}
.auth-popover-name + .auth-popover-email {
  padding-top: 0;
}
.auth-popover-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #FF3B30;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.auth-popover-btn:hover {
  background: rgba(255, 59, 48, 0.1);
}
.auth-popover-btn-neutral {
  color: var(--text, #111);
}
.auth-popover-btn-neutral:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Full-screen fade overlay. */
.auth-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.36s cubic-bezier(0.32, 0.72, 0, 1);
}
body[data-auth-panel="open"] .auth-panel {
  opacity: 1;
  pointer-events: auto;
}

/* Blur and gently shrink the layout behind, like the card detail overlay. */
.layout {
  transition: filter 0.36s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
}
body[data-auth-panel="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
}

/* Page-like card: bigger, more breathing room. */
.auth-panel-inner {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  padding: 44px 40px 36px;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(0.9) translateY(24px);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body[data-auth-panel="open"] .auth-panel-inner {
  transform: scale(1) translateY(0);
}
.auth-panel-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  font-size: 22px;
  line-height: 1;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.15s ease;
}
.auth-panel-close:hover { background: rgba(0,0,0,0.12); }

/* Tabs (Log in / Sign up). */
.auth-panel-tabs {
  display: flex;
  background: rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 6px;
}
.auth-tab {
  flex: 1;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
  border: none;
  background: transparent;
  color: rgba(0,0,0,0.55);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.24s cubic-bezier(0.32, 0.72, 0, 1),
              color 0.2s ease,
              box-shadow 0.2s ease;
}
.auth-tab.active {
  background: #fff;
  color: var(--text, #111);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.auth-tab:hover:not(.active) { color: var(--text, #111); }

.auth-panel-title {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-panel-sub {
  margin: -4px 0 8px;
  font-size: 14px;
  color: rgba(0,0,0,0.6);
  line-height: 1.45;
}
.auth-panel-inner input {
  font: inherit;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.75);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.auth-panel-inner input:focus {
  border-color: #0A84FF;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}
.auth-error {
  min-height: 18px;
  font-size: 13px;
  color: #FF3B30;
}
.auth-submit {
  margin-top: 6px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
}

/* Username field is only shown in signup mode. Smoothly collapses in login. */
.auth-field-signup {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              opacity 0.24s ease,
              margin 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
body[data-auth-mode="signup"] .auth-field-signup {
  max-height: 60px;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .auth-slot {
    top: 18px;
    right: 18px;
  }
  .auth-panel-inner {
    padding: 36px 28px 28px;
  }
}

/* ---------- 18. Profile view ---------- */
body[data-view="profile"] .header,
body[data-view="profile"] .view-tabs { display: none; }

#view-profile {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Profile search + public profile share the profile view's column layout.
   They're display:none until their data-view matches (see "View switching"),
   so this flex rule only takes effect once active. */
body[data-view="profile-search"] #view-profile-search,
body[data-view="public-profile"] #view-public-profile {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.profile-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 8px 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #007AFF;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.profile-back:hover  { background: rgba(0, 122, 255, 0.08); }
.profile-back:active { transform: scale(0.97); }
.profile-back svg    { width: 18px; height: 18px; }

/* 3-dot menu */
.profile-menu-wrap { position: relative; }
.profile-menu-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.6);
  backdrop-filter: var(--glass-refract, blur(20px) saturate(180%));
  -webkit-backdrop-filter: var(--glass-refract, blur(20px) saturate(180%));
  color: var(--text, #111);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.profile-menu-btn:hover  { background: rgba(255,255,255,0.9); transform: scale(1.05); }
.profile-menu-btn:active { transform: scale(0.95); }
.profile-menu-btn svg    { width: 18px; height: 18px; }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform-origin: top right;
  transform: translateY(-6px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.18s ease,
              transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
}
.profile-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.profile-menu-item {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text, #111);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.profile-menu-item:hover { background: rgba(0,0,0,0.06); }
.profile-menu-item-danger { color: #FF3B30; }
.profile-menu-item-danger:hover { background: rgba(255, 59, 48, 0.1); }
/* Hairline between regular options and the danger zone — same visual cue
   as iOS context menus where destructive actions sit below a separator. */
.profile-menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 4px 4px;
}

/* Banner */
.profile-card.profile-card-main { padding: 0; overflow: hidden; }
.profile-card-main > .profile-header,
.profile-card-main > .profile-bio { padding-left: 28px; padding-right: 28px; }
.profile-card-main > .profile-header { padding-top: 28px; padding-bottom: 4px; }
.profile-card-main > .profile-bio { padding-bottom: 28px; }
.profile-card-main.has-banner > .profile-header { padding-top: 0; margin-top: -34px; }

.profile-banner {
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: rgba(0,0,0,0.05);
}

/* Avatar image variant */
.profile-avatar.has-image {
  background: #eee;
  padding: 0;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-card-main.has-banner .profile-avatar {
  border: 4px solid rgba(255,255,255,0.95);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

/* Bio */
.profile-bio {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text, #111);
  white-space: pre-wrap;
  word-break: break-word;
}
.profile-bio-empty {
  color: rgba(0,0,0,0.4);
  font-style: italic;
}

/* Edit-bio modal */
.profile-edit-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 200;
}
body[data-profile-edit="open"] .profile-edit-panel {
  opacity: 1;
  pointer-events: auto;
}
body[data-profile-edit="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
  transition: filter 0.4s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.layout {
  transition: filter 0.4s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.profile-edit-inner {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 36px 28px 24px;
  border-radius: 24px;
  transform: scale(0.94);
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body[data-profile-edit="open"] .profile-edit-inner {
  transform: scale(1);
}
.profile-edit-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  font-size: 20px;
  line-height: 1;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.15s ease;
}
.profile-edit-close:hover { background: rgba(0,0,0,0.12); }
.profile-edit-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.profile-edit-sub {
  margin: 0 0 16px;
  font-size: 14px;
  color: rgba(0,0,0,0.5);
}
.profile-edit-inner textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.7);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.profile-edit-inner textarea:focus {
  border-color: rgba(0, 122, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.profile-edit-counter {
  text-align: right;
  font-size: 12px;
  color: rgba(0,0,0,0.45);
  margin: 6px 2px 14px;
}
.profile-edit-save { width: 100%; }
.profile-card { padding: 28px; }
.profile-header {
  display: flex;
  align-items: center;
  gap: 22px;
}
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #111);
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.profile-avatar.logged-in {
  background: linear-gradient(135deg, #007AFF, #5AC8FA);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.4);
}
.profile-avatar svg { width: 40px; height: 40px; }
.profile-identity { min-width: 0; }
.profile-name {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #111);
  word-break: break-word;
}
.profile-email {
  margin: 0;
  font-size: 14px;
  color: rgba(0,0,0,0.55);
  word-break: break-all;
}
.profile-signin { margin-top: 14px; }

/* Collection-stats dropdown */
.profile-stats-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  margin: 0 0 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text, #111);
  font: inherit;
}
.profile-stats-toggle h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.profile-stats-toggle .panel-subtitle {
  margin-top: 4px;
}
.profile-stats-chevron {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 6px;
  color: rgba(0,0,0,0.4);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.profile-stats-card.open .profile-stats-chevron {
  transform: rotate(180deg);
}

.profile-cards-list {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.profile-cards-list > * {
  min-height: 0;
  overflow: hidden;
}
.profile-stats-card.open .profile-cards-list {
  grid-template-rows: 1fr;
}
.profile-cards-grid {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.profile-cards-empty {
  margin-top: 22px;
  padding: 22px;
  border-top: 1px solid rgba(0,0,0,0.06);
  text-align: center;
  font-size: 14px;
  color: rgba(0,0,0,0.5);
}

/* ---- Profile Wishlist section ---- */
/* Lives below the collection stats panel. Inherits glass-panel padding via
   .profile-card. Header has its own mini stats so users see Wishlist count
   + value without expanding anything. Inline search input only shows when
   there's at least one wishlist card. */
.profile-wishlist-card .panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.profile-wishlist-stats {
  display: flex;
  gap: 14px;
}
.profile-wishlist-stat {
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(232, 51, 109, 0.08);
  border: 0.5px solid rgba(232, 51, 109, 0.18);
  min-width: 96px;
}
.profile-wishlist-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #c41d54;
  margin-bottom: 4px;
}
.profile-wishlist-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.profile-wishlist-search {
  margin-top: 18px;
}
.profile-wishlist-search input {
  width: 100%;
  padding: 11px 16px;
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  font-size: 14px;
  font: inherit;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.profile-wishlist-search input:focus {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(232, 51, 109, 0.4);
}
.profile-wishlist-list {
  margin-top: 18px;
}
.profile-wishlist-grid {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

@media (max-width: 560px) {
  .profile-wishlist-card .panel-header { gap: 12px; }
  .profile-wishlist-stat { min-width: 0; flex: 1; padding: 8px 12px; }
  .profile-wishlist-stat-value { font-size: 18px; }
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.profile-stat {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  border: 0.5px solid var(--glass-border);
}
.profile-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(0,0,0,0.5);
  margin-bottom: 6px;
}
.profile-stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #111);
}

/* ---------- Profile "Closest to completing" panel ---------- */
/* Top in-progress sets, each a name + mini progress bar + owned/total. Mirrors
   the catalog set-progress treatment at a tighter rhythm. */
.completing-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}
.completing-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.completing-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.completing-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.set-progress.completing-progress {
  height: 5px;
}
.profile-placeholder {
  margin-top: 14px;
  padding: 22px;
  border-radius: 16px;
  border: 1px dashed rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.3);
  color: rgba(0,0,0,0.5);
  font-size: 14px;
  text-align: center;
}

/* ---------- Profile "coming soon" panel ---------- */
/* Names the next features that will live on the Profile (Trade History,
   Price Alerts). Muted/dashed treatment so it reads as a preview, not a
   live control. */
.profile-soon-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-soon-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.3);
}
.profile-soon-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text, #111);
}
.profile-soon-desc {
  margin-top: 2px;
  font-size: 13px;
  color: rgba(0,0,0,0.5);
}
.profile-soon-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(0,0,0,0.55);
  background: rgba(0,0,0,0.06);
}

/* ---------- Profile export panel ---------- */
/* CSV (spreadsheet) + JSON (full backup) downloads. Neutral glass buttons so
   they sit calmly among the profile cards. Disabled until the user owns cards. */
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.export-btn {
  flex: 1;
  min-width: 140px;
  gap: 9px;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text, #111);
  background: rgba(255, 255, 255, 0.6);
  border: 0.5px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 2px 8px rgba(0, 0, 0, 0.06);
}
.export-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 16px rgba(0, 0, 0, 0.1);
}
.export-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.export-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Achievements (Profile) ---------- */
/* Collapsible dropdown — header toggles, the grid collapses via the same
   grid-template-rows 1fr→0fr trick the era panels use (CSS-only, no JS height
   measuring). */
.achievements-toggle {
  display: flex;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  user-select: none;
  transition: opacity 0.2s var(--ease-out);
}
.achievements-toggle:hover { opacity: 0.72; }
.achievements-toggle:active { opacity: 0.55; transition-duration: 0.05s; }
.achievements-toggle .chevron {
  color: var(--text-2);
  flex-shrink: 0;
  transition: transform 0.55s var(--apple-ease);
}
.achievements-collapse.collapsed .achievements-toggle .chevron { transform: rotate(-90deg); }

.achievements-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--apple-ease);
}
.achievements-collapse.collapsed .achievements-body { grid-template-rows: 0fr; }

.achievements-body-inner {
  overflow: hidden;
  min-height: 0;
  transition: opacity 0.4s var(--ease-out), filter 0.4s var(--ease-out);
}
.achievements-collapse.collapsed .achievements-body-inner {
  opacity: 0;
  filter: blur(6px);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.25s var(--ease-out), border-color 0.25s var(--ease-out), opacity 0.25s var(--ease-out);
}
/* Earned: green tint matching the owned-variant / set-complete palette. */
.achievement.unlocked {
  background: rgba(52, 199, 89, 0.10);
  border-color: rgba(52, 199, 89, 0.28);
}
/* Locked: dimmed + desaturated so earned ones pop. */
.achievement.locked {
  opacity: 0.5;
  filter: grayscale(0.75);
}
.achievement-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.achievement-info { min-width: 0; }
.achievement-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
}
.achievement-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
}
.achievement-check {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--apple-green, #34c759);
  font-weight: 800;
  font-size: 16px;
}

/* ---------- Trade History (Profile) ---------- */
.trade-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.trade-history-row {
  background: rgba(255, 255, 255, 0.4);
  border: 0.5px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.trade-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.trade-history-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.trade-history-diff {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.trade-history-diff.positive { color: var(--apple-green, #34c759); }
.trade-history-diff.negative { color: var(--apple-red, #ff3b30); }
.trade-history-leg {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}
.trade-history-leg-label {
  flex-shrink: 0;
  width: 38px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.trade-history-leg.gave .trade-history-leg-label { color: var(--apple-red, #ff3b30); }
.trade-history-leg.got  .trade-history-leg-label { color: var(--apple-green, #34c759); }
.trade-history-leg-cards {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-history-leg-val {
  flex-shrink: 0;
  color: var(--text-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.trade-history-more {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 0 2px;
}

/* ---------- Profile search (Find Users) ---------- */
.profile-search-bar {
  position: relative;
  margin-top: 16px;
}
.profile-search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.profile-search-bar input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  font: inherit;
  font-size: 15px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.55);
  color: var(--text, #111);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-search-bar input:focus {
  border-color: rgba(0,122,255,0.55);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.14);
}
.profile-search-results { margin-top: 16px; }
.profile-search-hint {
  padding: 22px;
  border-radius: 16px;
  border: 1px dashed rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.3);
  color: rgba(0,0,0,0.5);
  font-size: 14px;
  text-align: center;
}
.profile-search-error { color: #c0392b; border-color: rgba(192,57,43,0.3); }

.profile-result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.18s;
}
.profile-result-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.profile-result-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.12);
}
.profile-result-avatar.logged-in {
  background: linear-gradient(135deg, #007AFF, #5856D6);
}
.profile-result-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===================== Trade Matches ===================== */
.trade-matches-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}
.trade-match-card { padding: 18px 20px; }
.trade-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.trade-match-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}
.trade-match-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trade-match-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.trade-match-mutual {
  background: rgba(52, 199, 89, 0.16);
  color: var(--apple-green);
}
.trade-match-start { flex-shrink: 0; }
.trade-match-section { margin-top: 16px; }
.trade-match-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
}
.trade-match-count {
  background: rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.trade-matches-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

/* ===================== Activity Feed ===================== */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
}
.feed-actor { flex-shrink: 0; cursor: pointer; }
.feed-row .profile-result-avatar { width: 40px; height: 40px; font-size: 17px; }
.feed-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.feed-icon-set    { background: linear-gradient(180deg, #4ed670, var(--apple-green)); }
.feed-icon-pickup { background: linear-gradient(180deg, #ffd14e, #ff9f0a); }
.feed-body { flex: 1; min-width: 0; }
.feed-copy {
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
}
.feed-copy strong { font-weight: 700; }
.feed-value {
  font-weight: 700;
  color: var(--apple-green);
  white-space: nowrap;
}
.feed-time {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.feed-thumb {
  flex-shrink: 0;
  width: 38px;
  height: 53px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.feed-more {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

.profile-result-info { flex: 1; min-width: 0; }
.profile-result-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text, #111);
}
.profile-result-bio {
  margin-top: 2px;
  font-size: 13px;
  color: rgba(0,0,0,0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-result-stats {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(0,0,0,0.45);
  display: flex;
  gap: 6px;
}
.profile-result-dot { opacity: 0.5; }
.profile-result-view { flex-shrink: 0; }

/* ---------- Public profile previews ---------- */
.profile-preview-more {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(0,0,0,0.45);
  text-align: center;
}
/* Read-only card tiles in public previews aren't clickable — kill the
   button affordance the normal tile carries. */
.card.card-readonly { cursor: default; }

@media (max-width: 480px) {
  .profile-result-card { flex-wrap: wrap; }
  .profile-result-view { width: 100%; }
}

/* ---------- Follow system ---------- */
/* Clickable follower/following count chips. Shown on every profile, near the
   username/bio. */
.profile-follow-counts {
  display: flex;
  gap: 22px;
  margin-top: 10px;
}
.profile-follow-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 2px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  color: var(--text-2);
  transition: opacity 0.15s ease;
}
.profile-follow-stat:hover { opacity: 0.65; }
.profile-follow-num {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #111);
  font-variant-numeric: tabular-nums;
}
.profile-follow-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

/* Follow / Following button — only on other people's profiles + list rows. */
.profile-follow-btn {
  margin-top: 14px;
  min-width: 116px;
}
.profile-follow-btn[disabled] { opacity: 0.6; pointer-events: none; }
/* "Following" state: muted glass; reveal "Unfollow" intent on hover. */
.profile-follow-btn.is-following:hover .profile-follow-btn-label { visibility: hidden; }
.profile-follow-btn.is-following:hover::after {
  content: "Unfollow";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FF3B30;
  font-weight: 600;
}
.profile-follow-btn.is-following { position: relative; }

/* List rows reuse .profile-result-card; the actions cluster holds View +
   Follow side by side. */
.follow-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.follow-row-actions .profile-follow-btn {
  margin-top: 0;
  min-width: 96px;
}

/* Followers / Following modal — same fade + scale pattern as the trade
   confirm + auth panels. */
.follow-list-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1000;
}
body[data-follow-list="open"] .follow-list-panel {
  opacity: 1;
  pointer-events: auto;
}
body[data-follow-list="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
  transition: filter 0.4s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
.follow-list-inner {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 32px 28px 24px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body[data-follow-list="open"] .follow-list-inner {
  transform: scale(1) translateY(0);
}
.follow-list-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  font-size: 22px;
  line-height: 1;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.15s ease;
}
.follow-list-close:hover { background: rgba(0, 0, 0, 0.12); }
.follow-list-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.follow-list-body { display: flex; flex-direction: column; }

@media (max-width: 480px) {
  .profile-header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .profile-avatar { width: 72px; height: 72px; font-size: 30px; }
  .profile-name { font-size: 22px; }
  .profile-follow-counts { gap: 18px; }
  .follow-row-actions { flex-direction: column; width: 100%; }
  .follow-row-actions .btn { width: 100%; }
}

/* ---------- Trade confirm modal ---------- */
/* In-app replacement for the old confirm() dialog. Two-column give/receive
   preview with a net diff and Cancel/Apply buttons. Follows the same fade-in
   + scale-in pattern as the auth and profile-edit panels. */
.trade-confirm-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1000;
}
body[data-trade-confirm="open"] .trade-confirm-panel {
  opacity: 1;
  pointer-events: auto;
}
body[data-trade-confirm="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
  transition: filter 0.4s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.trade-confirm-inner {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 36px 32px 28px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body[data-trade-confirm="open"] .trade-confirm-inner {
  transform: scale(1) translateY(0);
}

.trade-confirm-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  font-size: 22px;
  line-height: 1;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.15s ease;
}
.trade-confirm-close:hover { background: rgba(0, 0, 0, 0.12); }

.trade-confirm-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.trade-confirm-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.trade-confirm-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  border: 0.5px solid var(--glass-border);
}
.trade-confirm-side-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.trade-confirm-side-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.trade-confirm-side-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.trade-confirm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trade-confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  border: 0.5px solid var(--glass-border);
}
.trade-confirm-row-info { flex: 1; min-width: 0; }
.trade-confirm-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trade-confirm-row-qty {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
  font-size: 10.5px;
  font-weight: 700;
}
.trade-confirm-row-meta {
  font-size: 11px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-confirm-row-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--apple-green);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.trade-confirm-cash {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  border: 0.5px dashed rgba(0, 0, 0, 0.08);
}
.trade-confirm-empty {
  padding: 18px 10px;
  text-align: center;
  font-size: 12px;
  font-style: italic;
  color: var(--text-3);
  border: 1px dashed rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}
.trade-confirm-side-total {
  margin-top: 2px;
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.trade-confirm-diff {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid var(--glass-border);
}
.trade-confirm-diff-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.trade-confirm-diff.positive .trade-confirm-diff-value { color: var(--apple-green); }
.trade-confirm-diff.negative .trade-confirm-diff-value { color: var(--apple-red); }
.trade-confirm-diff-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.trade-confirm-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  padding: 0 4px;
}

.trade-confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.trade-confirm-buttons .btn { min-width: 110px; }

@media (max-width: 560px) {
  .trade-confirm-sides { grid-template-columns: 1fr; }
  .trade-confirm-inner { padding: 28px 22px 22px; }
  .trade-confirm-title { font-size: 19px; }
}

/* ---------- 16. Responsive + a11y ---------- */
@media (max-width: 768px) {
  .layout { padding: 20px 16px 70px; }
  .header { padding: 32px 26px; min-height: 240px; border-radius: 28px; }
  .header-inner { max-width: 65%; }
  h1 { font-size: 40px; }
  .header p { font-size: 15px; }
  .pikachu-hero { max-height: 180px; right: 16px; opacity: 0.7; }
  .panel { padding: 22px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
@media (max-width: 480px) {
  h1 { font-size: 34px; }
  .pikachu-hero { display: none; }
  .header-inner { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0.01s !important; }
}

/* ── Confirm modal (App.confirm) ─────────────────────────────────────────── */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--apple-ease);
  z-index: 1100; /* above the follow-list modal (1000) */
}
.confirm-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.confirm-panel {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  padding: 28px 26px 22px;
  border-radius: 26px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-glass);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.42s var(--spring);
}
.confirm-backdrop.open .confirm-panel {
  transform: scale(1) translateY(0);
}
.confirm-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.confirm-message {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-btn {
  padding: 10px 18px;
  border-radius: 14px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.confirm-btn:active { transform: scale(0.96); }
.confirm-cancel {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.confirm-cancel:hover { background: rgba(0, 0, 0, 0.12); }
.confirm-ok {
  background: var(--apple-blue);
  color: #fff;
}
.confirm-ok:hover { filter: brightness(1.05); }
.confirm-ok.danger { background: var(--apple-red); }

/* ── Privacy settings modal (own profile, opened from the ⋯ menu) ─────────── */
.profile-privacy-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--apple-ease);
  z-index: 200;
}
body[data-profile-privacy="open"] .profile-privacy-panel {
  opacity: 1;
  pointer-events: auto;
}
body[data-profile-privacy="open"] .layout {
  filter: blur(14px) saturate(140%);
  transform: scale(0.97);
  pointer-events: none;
  transition: filter 0.4s var(--apple-ease), transform 0.4s var(--apple-ease);
}
.profile-privacy-inner {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 32px 26px 22px;
  border-radius: 24px;
  transform: scale(0.94);
  transition: transform 0.34s var(--spring);
}
body[data-profile-privacy="open"] .profile-privacy-inner {
  transform: scale(1);
}
.profile-privacy-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  font-size: 20px;
  line-height: 1;
  color: var(--text, #111);
  cursor: pointer;
  transition: background 0.15s ease;
}
.profile-privacy-close:hover { background: rgba(0, 0, 0, 0.12); }

/* ── Privacy settings list (rows + iOS-style switches) ────────────────────── */
.privacy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  border-top: 1px solid var(--hairline);
}
.privacy-row:first-child { border-top: none; }
.privacy-row.is-disabled { opacity: 0.45; }
.privacy-text { min-width: 0; }
.privacy-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.privacy-desc {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}
/* iOS-style switch */
.privacy-toggle {
  flex: 0 0 auto;
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 15px;
  border: none;
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  padding: 0;
  transition: background 0.28s var(--apple-ease);
  -webkit-tap-highlight-color: transparent;
}
.privacy-toggle.on { background: var(--apple-green); }
.privacy-toggle:disabled { cursor: default; }
.privacy-toggle .privacy-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.28s var(--spring);
}
.privacy-toggle.on .privacy-knob { transform: translateX(20px); }
.privacy-toggle:focus-visible { outline: 2px solid var(--apple-blue); outline-offset: 2px; }

/* ── Private public-profile state ────────────────────────────────────────── */
.profile-private-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 20px;
}
.profile-private-state svg {
  width: 44px;
  height: 44px;
  color: var(--text-3);
}
.profile-private-state .profile-name { margin: 4px 0 0; }
.profile-cards-private {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-2);
}
