/* Shop (/shop/, all locales) and the theme preview pages (/shop/preview-*/).
   Store markup lives in the page source; cards, preview bar and purchase
   modal contents are rendered by /shop/shop.js. Everything reads the design
   tokens, so an equipped or previewed theme recolours the store itself.
   The theme scenes (.theme-scene--<id>) are the one exception: they hard-code
   each theme's own palette (mirrors themes/<id>.css) so every card shows its
   theme whatever theme the page is wearing. */

/* ── Page ───────────────────────────────────────────────────────────── */
.shop-page { padding-block: var(--space-7) var(--space-10); }
@media (min-width: 1080px) { .shop-page { padding-block: var(--space-8) var(--space-12); } }

.shop-page h3 { font-family: var(--font-body); }

/* ── Coin balance (the title lives in the shared page head) ──────────── */
.shop-page .store-coin-bar {
  padding-block-end: var(--space-5);
  border-block-end: 1px solid var(--border);
}
.store-subtitle {
  margin: var(--space-2) 0 0;
  max-inline-size: 60ch;
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.5;
}

.store-coin-bar { display: flex; min-inline-size: 0; }
.coin-balance {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: 56px;
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}
.coin-icon { color: var(--amber); }
.coin-balance .coin-icon { font-size: 1.35rem; }
.coin-amount {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 0.9;
  padding-block-start: 0.12em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.coin-label { color: var(--text-muted); font-size: var(--step--1); font-weight: 500; }

/* Guest notice: replaces the coin balance while logged out */
.guest-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  max-inline-size: 34rem;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--step--1);
  line-height: 1.45;
}
.guest-banner .guest-icon { color: var(--primary); font-size: 1.25rem; }
.guest-banner .guest-text { flex: 1 1 14rem; }
.guest-banner .guest-signin { text-decoration: none; white-space: nowrap; }
.guest-banner .guest-signin.pulse { animation: shop-pulse 0.55s var(--ease) 2; }
@keyframes shop-pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 30%, transparent); } }

/* ── Section jump row ───────────────────────────────────────────────── */
.store-jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-5);
}
.store-jump .chip { text-decoration: none; }
.store-jump .chip i { color: var(--accent); }

/* ── Sections ───────────────────────────────────────────────────────── */
.store-section { margin-block-start: var(--space-9); scroll-margin-block-start: calc(var(--header-stuck) + var(--space-4)); }
.store-section__head { margin-block-end: var(--space-5); }
.store-section-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0;
  font-size: var(--step-3);
}
.store-section-title > i { color: var(--accent); font-size: 0.62em; transform: translateY(-0.12em); }
.store-section-desc {
  margin: var(--space-2) 0 0;
  max-inline-size: 64ch;
  color: var(--text-muted);
}

/* Supporter + redeem sit side by side on wide screens */
@media (min-width: 1080px) {
  .store-pair { display: grid; grid-template-columns: 7fr 5fr; gap: var(--space-6); align-items: start; }
}

/* ── Cosmetic cards (themes, trails) ────────────────────────────────── */
.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15.5rem, 100%), 1fr));
  gap: var(--space-4);
}
.cosmetic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-med) var(--ease);
}
.cosmetic-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.cosmetic-card.equipped { border-color: color-mix(in srgb, var(--success) 60%, var(--border)); }
.cosmetic-card.previewing {
  border-color: var(--primary);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--primary);
}
.cosmetic-swatch {
  position: relative;
  display: grid;
  place-items: center;
  block-size: 8.5rem;
  overflow: hidden;
  border-block-end: 1px solid var(--border);
  isolation: isolate;
}
.cosmetic-grid--trails { grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); }
.cosmetic-grid--trails .cosmetic-swatch { block-size: 6.5rem; }
.swatch-icon {
  font-size: 2.1rem;
  color: #fff;
  filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.5));
  transition: transform var(--dur-med) var(--ease);
}
.cosmetic-card:hover .swatch-icon { transform: scale(1.08); }

.cosmetic-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
}
.cosmetic-body h3 { margin: 0; color: var(--text); font-size: var(--step-0); font-weight: 600; }
.cosmetic-body p {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--step--1);
  line-height: 1.5;
}
.cosmetic-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: auto; }
.cosmetic-actions > .btn, .cosmetic-actions > :is(.glow-btn, .ghost-btn) {
  min-block-size: var(--tap);
  padding-inline: var(--space-4);
  font-size: var(--step--1);
}
.cosmetic-actions .coin-buy-btn, .cosmetic-actions .equip-btn { flex: 1 1 6rem; }
.coin-buy-btn { font-variant-numeric: tabular-nums; }
.coin-buy-btn .coin-icon { color: inherit; }
.try-btn { white-space: nowrap; }
.try-btn.active { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 16%, var(--surface-2)); }
.equipped-label {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--tap);
  color: var(--success);
  font-size: var(--step--1);
  font-weight: 600;
}

/* Phones: themes and trails 2-up so a scroll shows four items, not one.
   The swatch, padding and type tighten; buy and Try stack full width. */
@media (max-width: 599px) {
  .cosmetic-grid,
  .cosmetic-grid--trails { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .cosmetic-swatch { block-size: 6.5rem; }
  .cosmetic-grid--trails .cosmetic-swatch { block-size: 5rem; }
  .cosmetic-grid--trails .swatch-icon { font-size: 1.6rem; }
  .cosmetic-body { padding: var(--space-3); }
  .cosmetic-body h3 { font-size: var(--step--1); line-height: 1.3; overflow-wrap: anywhere; }
  .cosmetic-body p { margin-block-end: var(--space-2); font-size: var(--step--1); line-height: 1.4; }
  .cosmetic-actions { flex-direction: column; gap: var(--space-2); }
  .cosmetic-actions > .btn,
  .cosmetic-actions > :is(.glow-btn, .ghost-btn) { inline-size: 100%; justify-content: center; padding-inline: var(--space-2); }
  .cosmetic-card .cosmetic-actions .coin-buy-btn,
  .cosmetic-card .cosmetic-actions .equip-btn { flex: 0 0 auto; }
  .cosmetic-card .equipped-label { flex: 0 0 auto; min-block-size: 36px; }
  /* the miniature page keeps its proportions in the narrower card */
  .cosmetic-swatch .ts-bar { inset-block-start: 8px; inset-inline: 8px; }
  .cosmetic-swatch .ts-panel { inset-block: 36px 8px; inset-inline: 8px 30%; padding: 8px; gap: 5px; }
}

/* Trail swatches: abstract light, each trail's own colour */
.swatch-none { background: linear-gradient(160deg, var(--surface-2), var(--bg-raised)); }
.swatch-none .swatch-icon { color: var(--text-faint); filter: none; }
.swatch-fire { background: radial-gradient(circle at 50% 85%, rgb(255 110 0 / 0.7), transparent 60%), radial-gradient(circle at 50% 100%, rgb(255 200 0 / 0.6), transparent 42%), linear-gradient(180deg, #200b02, #0d0401); }
.swatch-fire .swatch-icon { color: #ffd27a; }
.swatch-lightning { background: radial-gradient(circle at 62% 28%, rgb(0 240 255 / 0.5), transparent 50%), radial-gradient(circle at 30% 70%, rgb(120 220 255 / 0.3), transparent 45%), linear-gradient(160deg, #06202e, #010810); }
.swatch-lightning .swatch-icon { color: #b8f6ff; }
.swatch-rainbow { background: linear-gradient(100deg, rgb(255 60 60 / 0.45), rgb(255 170 0 / 0.45), rgb(255 240 0 / 0.4), rgb(60 220 120 / 0.4), rgb(40 150 255 / 0.45), rgb(190 80 255 / 0.45)), linear-gradient(180deg, #14141c, #08080d); }
.swatch-sparkle { background: radial-gradient(2px 2px at 28% 35%, rgb(255 215 0 / 0.95), transparent), radial-gradient(1.5px 1.5px at 65% 55%, #fff, transparent), radial-gradient(2px 2px at 80% 28%, rgb(135 206 235 / 0.9), transparent), radial-gradient(1.5px 1.5px at 45% 72%, rgb(255 182 193 / 0.9), transparent), radial-gradient(circle at 50% 50%, rgb(255 215 0 / 0.18), transparent 60%), linear-gradient(160deg, #191227, #0a0712); }
.swatch-sparkle .swatch-icon { color: #ffe08a; }

/* ── Theme scenes: a miniature page in each theme's rebuilt palette ── */
.theme-scene {
  --sc-bg: #07051a; --sc-sky: radial-gradient(ellipse 120% 80% at 50% 0%, #120b2e, #07051a 70%);
  --sc-raised: #0d0a24; --sc-s1: #120e2c; --sc-s2: #1a1540; --sc-border: #2c2558;
  --sc-text: #f2f0ff; --sc-primary: #a78bfa;
  --sc-a1: #00e5f5; --sc-a2: #ff5ccf; --sc-a3: #ffc94a; --sc-a4: #b6ff3b;
  --sc-logo: linear-gradient(100deg, #00e5f5, #ffc94a, #ff5ccf);
  --sc-bar-edge: 1px solid var(--sc-border);
  --sc-r: 6px;
  display: block;
  background: var(--sc-sky);
  background-color: var(--sc-bg);
}
.theme-scene > span { position: absolute; }
.ts-sky { display: block; }
.ts-sky { inset: 0; z-index: -1; }
.ts-bar {
  inset-block-start: 12px;
  inset-inline: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  block-size: 20px;
  padding-inline: 8px;
  border: 1px solid var(--sc-border);
  border-block-end: var(--sc-bar-edge);
  border-radius: var(--sc-r);
  background: var(--sc-raised);
}
.ts-logo { display: block; inline-size: 40%; block-size: 6px; border-radius: 2px; background: var(--sc-logo); }
.ts-chip { display: block; margin-inline-start: auto; inline-size: 22px; block-size: 9px; border: 1px solid var(--sc-border); border-radius: 99px; background: var(--sc-s2); }
.ts-panel {
  inset-block: 44px 12px;
  inset-inline: 12px 36%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--sc-border);
  border-radius: calc(var(--sc-r) + 2px);
  background: var(--sc-s1);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.35);
}
.ts-line { display: block; inline-size: 78%; block-size: 6px; border-radius: 2px; background: var(--sc-text); opacity: 0.9; }
.ts-line--short { inline-size: 52%; opacity: 0.45; }
.ts-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-block-start: auto; }
.ts-btn { display: block; inline-size: 40px; block-size: 14px; border-radius: calc(var(--sc-r) - 1px); background: var(--sc-primary); }
.ts-dots { display: flex; gap: 4px; }
.ts-dots i { display: block; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--sc-a1); }
.ts-dots i:nth-child(2) { background: var(--sc-a2); }
.ts-dots i:nth-child(3) { background: var(--sc-a3); }
.ts-dots i:nth-child(4) { background: var(--sc-a4); }
.theme-scene .ts-sky::before, .theme-scene .ts-sky::after { content: ''; position: absolute; }

/* Default (Deep-Space Arcade): starfield */
.theme-scene--default .ts-sky {
  background:
    radial-gradient(1.5px 1.5px at 72% 30%, #fff, transparent),
    radial-gradient(1px 1px at 84% 62%, rgb(255 255 255 / 0.7), transparent),
    radial-gradient(1.5px 1.5px at 90% 18%, rgb(255 255 255 / 0.8), transparent),
    radial-gradient(1px 1px at 78% 82%, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(1px 1px at 95% 45%, rgb(255 255 255 / 0.55), transparent);
}

/* Wild West: dusk sky, low sun, mesa silhouette, plank header with brass rule */
.theme-scene--wildwest {
  --sc-bg: #1a0f09; --sc-sky: linear-gradient(180deg, #2a1420 0%, #6e2e1e 46%, #c76a2e 64%, #1a0f09 64.5%, #110905 100%);
  --sc-raised: #3b2414; --sc-s1: #2c1b0f; --sc-s2: #382315; --sc-border: #523620;
  --sc-text: #fff3e0; --sc-primary: #ffb347;
  --sc-a1: #6fd8c5; --sc-a2: #f7a0ad; --sc-a3: #ffd166; --sc-a4: #a8dc86;
  --sc-logo: #ffc861;
  --sc-bar-edge: 2px solid #b07a3c;
}
.theme-scene--wildwest .ts-bar { background: repeating-linear-gradient(90deg, #3b2414 0 22px, #33200f 22px 23px); }
.theme-scene--wildwest .ts-sky::before { inset-block-start: 46%; inset-inline-end: 12%; inline-size: 34px; block-size: 34px; border-radius: 50%; background: radial-gradient(circle, #ffd98f, #ff9a3c 60%, transparent 72%); }
.theme-scene--wildwest .ts-sky::after { inset-inline: 55% 0; inset-block: 50% 35.5%; background: #241509; clip-path: polygon(0 100%, 8% 30%, 30% 30%, 36% 0, 58% 0, 64% 40%, 82% 40%, 88% 15%, 100% 15%, 100% 100%); }

/* Ocean Deep: abyss gradient, god rays, a glowing jellyfish */
.theme-scene--ocean {
  --sc-bg: #03121a; --sc-sky: linear-gradient(180deg, #073445 0%, #03121a 55%, #01080d 100%);
  --sc-raised: #06283a; --sc-s1: #07222f; --sc-s2: #0b2c3c; --sc-border: #15435a;
  --sc-text: #e8fcff; --sc-primary: #3ee8d2;
  --sc-a1: #5cd6ff; --sc-a2: #ff99cf; --sc-a3: #ffd36e; --sc-a4: #a6f285;
  --sc-logo: linear-gradient(100deg, #b4fbf2, #3ee8d2 45%, #5cd6ff);
  --sc-bar-edge: 1px solid #1d6a80;
}
.theme-scene--ocean .ts-sky::before { inset: 0; background: repeating-linear-gradient(105deg, transparent 0 18px, rgb(62 232 210 / 0.07) 18px 30px), radial-gradient(ellipse 60% 40% at 70% 0%, rgb(62 232 210 / 0.25), transparent 70%); }
.theme-scene--ocean .ts-sky::after { inset-block-start: 40%; inset-inline-end: 12%; inline-size: 22px; block-size: 16px; border-radius: 50% 50% 30% 30%; background: radial-gradient(circle at 50% 35%, #ffd3ea, #ff99cf 55%, rgb(255 153 207 / 0) 75%); box-shadow: 0 0 18px 4px rgb(255 153 207 / 0.35), 4px 14px 0 -9px #ff99cf, -4px 16px 0 -9px #ff99cf; }

/* Aurora Frost: ribbons across a glacial night, frost at the ground */
.theme-scene--aurora {
  --sc-bg: #050b18; --sc-sky: linear-gradient(180deg, #0b1a33 0%, #050b18 60%, #03060f 100%);
  --sc-raised: #0c1730; --sc-s1: #0d192f; --sc-s2: #13223d; --sc-border: #20345a;
  --sc-text: #eef8ff; --sc-primary: #5ef2c0;
  --sc-a1: #6ee2ff; --sc-a2: #ffa0d8; --sc-a3: #ffd782; --sc-a4: #c8f36e;
  --sc-logo: linear-gradient(100deg, #f2fbff, #6ee2ff 50%, #bba2ff);
  --sc-bar-edge: 2px solid #5ef2c0;
}
.theme-scene--aurora .ts-sky::before { inset: 10% -10% 30% 40%; background: radial-gradient(ellipse 70% 30% at 40% 40%, rgb(94 242 192 / 0.55), transparent 70%), radial-gradient(ellipse 60% 26% at 70% 25%, rgb(187 162 255 / 0.5), transparent 70%); filter: blur(4px); transform: skewY(-12deg); }
.theme-scene--aurora .ts-sky::after { inset-inline: 0; inset-block-end: 0; block-size: 18%; background: linear-gradient(180deg, transparent, rgb(238 248 255 / 0.16)); }

/* Cyberpunk: magenta neon rule with cyan underglow, grid floor */
.theme-scene--cyberpunk {
  --sc-bg: #07060c; --sc-sky: linear-gradient(180deg, #140a26 0%, #07060c 55%, #040308 100%);
  --sc-raised: #0b0912; --sc-s1: #13101f; --sc-s2: #1b172c; --sc-border: #2d2645;
  --sc-text: #f6f3ff; --sc-primary: #ff45b5;
  --sc-a1: #2cf1ff; --sc-a2: #ff5cc4; --sc-a3: #ffe14d; --sc-a4: #adff45;
  --sc-logo: linear-gradient(100deg, #ff45b5, #ff74c8 35%, #2cf1ff);
  --sc-bar-edge: 1px solid #ff45b5;
}
.theme-scene--cyberpunk .ts-bar { box-shadow: 0 1px 0 rgb(44 241 255 / 0.45), 0 6px 14px -6px rgb(255 69 181 / 0.6); }
.theme-scene--cyberpunk .ts-sky::before { inset-inline: -30%; inset-block: 58% -20%; background: repeating-linear-gradient(90deg, rgb(255 69 181 / 0.55) 0 1px, transparent 1px 22px), repeating-linear-gradient(0deg, rgb(44 241 255 / 0.4) 0 1px, transparent 1px 14px); transform: perspective(120px) rotateX(55deg); transform-origin: 50% 0; mask-image: linear-gradient(180deg, transparent, #000 40%); }
.theme-scene--cyberpunk .ts-sky::after { inset-inline: 0; inset-block-start: 58%; block-size: 1px; background: #ff45b5; box-shadow: 0 0 10px 2px rgb(255 69 181 / 0.6); }

/* Retro Arcade: square corners, pixel header strip, CRT scanlines, invader */
.theme-scene--retro {
  --sc-bg: #06050f; --sc-sky: linear-gradient(180deg, #120838 0%, #06050f 55%);
  --sc-raised: #0c0a1d; --sc-s1: #110e27; --sc-s2: #191434; --sc-border: #2e265c;
  --sc-text: #f4f2ff; --sc-primary: #3dff8b;
  --sc-a1: #3df0ff; --sc-a2: #ff6ad5; --sc-a3: #ffe14a; --sc-a4: #b4ff4a;
  --sc-logo: #ffe14a;
  --sc-bar-edge: 3px solid #3df0ff;
  --sc-r: 0px;
}
.theme-scene--retro .ts-logo { box-shadow: 2px 2px 0 #c42a7c; border-radius: 0; }
.theme-scene--retro .ts-dots i { border-radius: 0; }
.theme-scene--retro .ts-sky::before {
  inset-block-start: 52%; inset-inline-end: calc(12% + 15px);
  inline-size: 3px; block-size: 3px; background: transparent;
  box-shadow:
    6px 0 #3dff8b, 24px 0 #3dff8b,
    9px 3px #3dff8b, 21px 3px #3dff8b,
    6px 6px #3dff8b, 9px 6px #3dff8b, 12px 6px #3dff8b, 15px 6px #3dff8b, 18px 6px #3dff8b, 21px 6px #3dff8b, 24px 6px #3dff8b,
    3px 9px #3dff8b, 6px 9px #3dff8b, 12px 9px #3dff8b, 15px 9px #3dff8b, 18px 9px #3dff8b, 24px 9px #3dff8b, 27px 9px #3dff8b,
    0 12px #3dff8b, 3px 12px #3dff8b, 6px 12px #3dff8b, 9px 12px #3dff8b, 12px 12px #3dff8b, 15px 12px #3dff8b, 18px 12px #3dff8b, 21px 12px #3dff8b, 24px 12px #3dff8b, 27px 12px #3dff8b, 30px 12px #3dff8b,
    0 15px #3dff8b, 6px 15px #3dff8b, 24px 15px #3dff8b, 30px 15px #3dff8b,
    9px 18px #3dff8b, 21px 18px #3dff8b;
}
.theme-scene--retro .ts-sky::after { inset: 0; z-index: 3; background: repeating-linear-gradient(0deg, rgb(0 0 0 / 0.28) 0 1px, transparent 1px 3px); pointer-events: none; }

/* Sakura Night: lantern glow, gold hairline, drifting petals */
.theme-scene--sakura {
  --sc-bg: #110a1b; --sc-sky: linear-gradient(180deg, #2a1540 0%, #110a1b 60%, #0b0612 100%);
  --sc-raised: #241436; --sc-s1: #201330; --sc-s2: #2a1a3e; --sc-border: #3c2756;
  --sc-text: #fff4f9; --sc-primary: #ff9fca;
  --sc-a1: #86e3df; --sc-a2: #ff94c6; --sc-a3: #ffcd6b; --sc-a4: #b2eba0;
  --sc-logo: linear-gradient(100deg, #ffd3e7, #ff9fca 50%, #ffcd6b);
  --sc-bar-edge: 1px solid #ffcd6b;
}
.theme-scene--sakura .ts-sky::before { inset-block-start: 38%; inset-inline-end: 13%; inline-size: 16px; block-size: 22px; border-radius: 6px; background: linear-gradient(180deg, #ffcd6b, #ff8f6a); box-shadow: 0 0 22px 8px rgb(255 205 107 / 0.35); }
.theme-scene--sakura .ts-sky::after {
  inset-block-start: 30%; inset-inline-end: 30%;
  inline-size: 6px; block-size: 4px; border-radius: 50% 0; background: #ffb3d4;
  box-shadow: 18px 22px 0 #ff94c6, -6px 40px 0 #ffd3e7, 30px 52px 0 #ff9fca, 8px 66px 0 #ffb3d4;
}

/* ── Badges ─────────────────────────────────────────────────────────── */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: var(--space-3);
}
.catalog-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.catalog-item:hover { border-color: var(--border-strong); }
.catalog-item.equipped { border-color: color-mix(in srgb, var(--success) 60%, var(--border)); }
.catalog-item.is-locked .catalog-thumb { filter: grayscale(1); opacity: 0.6; }
.catalog-item.is-locked .catalog-info h3 { color: var(--text-muted); }
.catalog-thumb {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  inline-size: 48px;
  block-size: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 1.6rem;
  line-height: 1;
}
.catalog-thumb { position: relative; }
.catalog-thumb > .badge-art { inline-size: 32px; block-size: 32px; }
.catalog-thumb > .fa-ban { color: var(--text-faint); font-size: 1.25rem; }
/* Locked earned badge: the art greyed (the card filter) with a small lock key. */
.catalog-lock {
  position: absolute;
  inset-block-end: -6px;
  inset-inline-end: -6px;
  display: grid;
  place-items: center;
  inline-size: 22px;
  block-size: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.65rem;
}
#purchase-preview > .badge-art { inline-size: 56px; block-size: 56px; }
.catalog-info { flex: 1; min-inline-size: 0; }
.catalog-info h3 { margin: 0 0 2px; color: var(--text); font-size: var(--step-0); font-weight: 600; }
.catalog-info p { margin: 0; color: var(--text-muted); font-size: var(--step--1); line-height: 1.45; }
.catalog-actions { display: flex; flex-shrink: 0; flex-direction: column; align-items: stretch; }
.catalog-actions > :is(.btn, .glow-btn, .ghost-btn) { min-block-size: var(--tap); padding-inline: var(--space-4); font-size: var(--step--1); }
.catalog-actions .equipped-label { padding-inline: var(--space-2); }
.catalog-note { max-inline-size: 9rem; color: var(--text-faint); font-size: var(--step--1); line-height: 1.35; text-align: end; }
.shop-divider {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: var(--space-3);
  margin-block: var(--space-4) var(--space-1);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.shop-divider::before { content: ''; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--accent); }
.shop-divider::after { content: ''; flex: 1; block-size: 1px; background: var(--border); }

/* ── Supporter bundle ───────────────────────────────────────────────── */
.supporter-banner {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-block-start: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-1), inset 0 2px 0 var(--accent);
}
@media (min-width: 768px) {
  .supporter-banner { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: var(--space-6); }
  .supporter-includes { grid-column: 1 / -1; grid-row: 2; }
}
.supporter-id { display: flex; align-items: center; gap: var(--space-4); }
.supporter-icon {
  display: grid;
  place-items: center;
  inline-size: 52px;
  block-size: 52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  color: var(--accent);
  font-size: 1.4rem;
}
.supporter-titles { display: flex; flex-direction: column; gap: 2px; }
.supporter-name { color: var(--text); font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 1; text-transform: uppercase; padding-block-start: 0.1em; }
.supporter-price { color: var(--text); font-size: var(--step-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.supporter-includes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.supporter-includes-label { margin-inline-end: var(--space-1); color: var(--text-muted); font-size: var(--step--1); font-weight: 500; }
.supporter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 32px;
  padding-inline: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--step--1);
  white-space: nowrap;
}
.supporter-chip i { color: var(--accent); }
.supporter-banner .support-btn { text-decoration: none; white-space: nowrap; }
.owned-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--tap);
  padding-inline: var(--space-5);
  border: 1px solid color-mix(in srgb, var(--success) 55%, var(--border));
  border-radius: var(--radius-md);
  color: var(--success);
  font-size: var(--step--1);
  font-weight: 600;
}

/* ── Redeem ─────────────────────────────────────────────────────────── */
.redeem-box {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}
@media (min-width: 768px) { .redeem-box { padding: var(--space-6); } }
.redeem-icon { color: var(--accent); font-size: 1.6rem; }
.redeem-box p { margin: var(--space-3) 0 var(--space-4); color: var(--text-muted); font-size: var(--step--1); line-height: 1.55; }
.redeem-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.redeem-row .input { flex: 1 1 12rem; min-inline-size: 0; }
#redeem-input {
  font-family: var(--font-mono);
  font-size: var(--step-1);
  letter-spacing: 0.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#redeem-input::placeholder { color: var(--text-faint); letter-spacing: 0.2em; }
.redeem-row .btn { flex: 0 0 auto; }

.form-msg { min-block-size: 1.4em; margin-block-start: var(--space-3); color: var(--text-muted); font-size: var(--step--1); line-height: 1.45; }
.form-msg:empty { margin-block-start: 0; }
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--success); }
.form-msg.error::before, .form-msg.success::before { font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-inline-end: var(--space-2); }
.form-msg.error::before { content: '\f06a'; }
.form-msg.success::before { content: '\f058'; }

/* ── Live preview bar (rendered by shop.js) ─────────────────────────── */
#preview-bar {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline: var(--gutter);
  z-index: calc(var(--z-overlay) - 10);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  inline-size: min(36rem, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-block-start: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-3);
  animation: modal-rise var(--dur-med) var(--ease);
}
#preview-bar.hidden { display: none; }
#preview-bar .pv-note { color: var(--text-muted); font-size: var(--step--1); text-align: center; }
#preview-bar .pv-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2) var(--space-3); }
#preview-bar .pv-name { display: inline-flex; align-items: center; gap: var(--space-2); margin-inline-end: auto; color: var(--text); font-weight: 600; }
#preview-bar .pv-name i { color: var(--primary); }
#preview-bar :is(.pv-buy, .pv-exit) { min-block-size: var(--tap); padding-inline: var(--space-4); font-size: var(--step--1); }
#preview-bar .pv-buy .coin-icon { color: inherit; }
@media (max-width: 479px) { #preview-bar .pv-name { inline-size: 100%; justify-content: center; margin-inline-end: 0; } }
/* keep the last section clear of the floating bar */
.shop-page:has(~ #preview-bar:not(.hidden)) { padding-block-end: 12rem; }

/* ── Purchase modal ─────────────────────────────────────────────────── */
.purchase-body { display: flex; flex-direction: column; align-items: center; text-align: center; }
.purchase-preview { display: grid; place-items: center; inline-size: 100%; margin-block-end: var(--space-4); font-size: 2.6rem; line-height: 1; }
.purchase-preview .cosmetic-swatch { inline-size: 100%; max-inline-size: 18rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
.purchase-body h3 { margin: 0 0 var(--space-2); }
.purchase-cost { margin: 0; color: var(--text-muted); }
.purchase-cost strong { color: var(--text); font-variant-numeric: tabular-nums; }
.purchase-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-block-start: var(--space-5); inline-size: 100%; }
.purchase-actions .btn { flex: 1 1 8rem; }

/* ── Theme preview pages (/shop/preview-<id>/) ──────────────────────── */
.theme-preview-bar {
  position: sticky;
  inset-block-start: var(--header-stuck);
  z-index: calc(var(--z-header) - 1);
  border-block-end: 1px solid var(--border);
  background: var(--bg-raised);
}
.theme-preview-bar__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding-block: var(--space-2); }
.theme-preview-bar .btn { min-block-size: var(--tap); text-decoration: none; }
.theme-preview-bar .btn i { color: var(--primary); }
:dir(rtl) .theme-preview-bar .fa-arrow-left { transform: scaleX(-1); }
.theme-preview-badge { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--step--1); font-weight: 600; }
.theme-preview-badge i { color: var(--primary); }

.theme-preview { padding-block: var(--space-7) var(--space-10); }
.tp-hero { display: grid; gap: var(--space-5); align-items: end; }
@media (min-width: 1080px) { .tp-hero { grid-template-columns: 7fr 5fr; } }
.tp-hero h1 { margin: 0; text-wrap: balance; }
.tp-lead { margin: var(--space-3) 0 0; max-inline-size: 60ch; color: var(--text-muted); font-size: var(--step-1); line-height: 1.5; }

.tp-level {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}
.tp-level__badge { display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 1; padding-block-start: 0.12em; font-variant-numeric: tabular-nums; }
.tp-level__title { color: var(--text); font-weight: 600; }
.tp-level__coins { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-level__track { grid-column: 1 / -1; block-size: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.tp-level__fill { display: block; inline-size: 64%; block-size: 100%; border-radius: inherit; background: var(--primary); }
.tp-level__xp { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: var(--space-3); color: var(--text-faint); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

.tp-grid { display: grid; gap: var(--space-4); margin-block-start: var(--space-6); }
@media (min-width: 768px) { .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tp-tile--pad { grid-column: 1 / -1; } }
@media (min-width: 1080px) { .tp-grid { grid-template-columns: 1.15fr 1fr 1fr; } .tp-tile--pad { grid-column: auto; } }
.tp-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-block-start-color: var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-1), inset 0 2px 0 var(--accent);
}
@media (min-width: 768px) { .tp-tile { padding: var(--space-5); } }
.tp-tile__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.tp-tile__head h3 { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-family: var(--font-display); font-size: var(--step-1); text-transform: uppercase; }
.tp-tile__head h3 i { color: var(--accent); font-size: 0.7em; }
.tp-tile__meta { white-space: nowrap; color: var(--text-faint); font-size: var(--step--1); font-weight: 600; }

.tp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.tp-stat { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-3) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-raised); min-inline-size: 0; }
.tp-stat__label { color: var(--text-muted); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.04em; text-align: center; overflow-wrap: anywhere; }
.tp-stat__value { color: var(--text); font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 0.9; padding-block-start: 0.1em; font-variant-numeric: tabular-nums; }
.tp-stat__timer { display: flex; align-items: center; gap: var(--space-2); }
.tp-stat__timer > span:not(.tp-stat__value) { display: none; place-items: center; inline-size: 22px; block-size: 22px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-faint); font-size: 0.7rem; }
.tp-pad {
  display: grid;
  place-items: center;
  min-block-size: 12rem;
  padding: var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: radial-gradient(ellipse 80% 60% at 50% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%), var(--bg-raised);
  text-align: center;
  cursor: not-allowed;
}
.tp-pad__count { display: block; color: var(--accent); font-family: var(--font-display); font-size: var(--step-5); font-weight: 600; line-height: 0.8; font-variant-numeric: tabular-nums; }
.tp-pad__unit { display: block; margin-block-start: var(--space-2); color: var(--text-muted); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.08em; }

.tp-rows { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.tp-row { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); min-block-size: 40px; padding-inline: var(--space-2); border-radius: var(--radius-md); font-variant-numeric: tabular-nums; }
.tp-row:nth-child(odd) { background: var(--bg-raised); }
.tp-row__pos { color: var(--text-faint); font-weight: 600; }
.tp-row__name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-row__val { color: var(--text-muted); font-size: var(--step--1); font-weight: 600; }
.tp-rows .tp-row--me { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.tp-row--me .tp-row__pos, .tp-row--me .tp-row__val { color: var(--text); }

.tp-history { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.tp-history li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 var(--space-3); padding-block: var(--space-2); border-block-end: 1px solid var(--border); }
.tp-history li:last-child { border-block-end: 0; }
.tp-history__cps { grid-row: span 2; align-self: center; color: var(--accent); font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-history__meta { color: var(--text); font-size: var(--step--1); }
.tp-history__date { color: var(--text-faint); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

.tp-about { margin-block-start: var(--space-9); }
.tp-about__grid { display: grid; gap: var(--space-6) var(--space-7); }
@media (min-width: 768px) { .tp-about__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tp-about article h3 { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-2); }
.tp-about article h3 i { color: var(--primary); font-size: 0.7em; }
.tp-about article p { margin: 0; max-inline-size: 62ch; color: var(--text-muted); }
.tp-about article strong { color: var(--text); }

.preview-watermark {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline-end: var(--gutter);
  z-index: calc(var(--z-overlay) - 10);
  max-inline-size: calc(100% - 2 * var(--gutter));
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  color: var(--text-muted);
  font-size: var(--step--1);
  font-weight: 500;
}
.preview-watermark a { color: var(--text); text-decoration-color: var(--primary); text-underline-offset: 3px; }
.theme-preview { padding-block-end: calc(var(--space-10) + 3rem); }
@media (min-width: 1080px) { .tp-grid:not(:has(> .tp-tile:nth-child(3))) { grid-template-columns: 7fr 5fr; } }
