/* TH3 COLL3CTIV3 — Premium layer (loaded after app.css).
   Tokens, surfaces, motion primitives, the holographic card engine, and light mode.
   Everything here is progressive: without JS the page is fully usable and visible. */

/* ========== Tokens ========== */
:root {
  /* palette */
  --obsidian: #06060C;
  --midnight: #0B1028;
  --midnight-2: #121a3d;
  --violet: #7C5CFF;
  --violet-2: #A48BFF;
  --cyan: #3EE6F0;
  --gold: #F2C76E;
  --gold-2: #FFE6A8;
  --platinum: #DDE3F0;
  --holo: linear-gradient(115deg, #7C5CFF 0%, #3EE6F0 30%, #9DF2B0 48%, #FFE6A8 62%, #FF8AD8 80%, #7C5CFF 100%);
  --spectrum: linear-gradient(100deg, #6B5BFF 0%, #8C5CFF 45%, #3EE6F0 110%);
  --spectrum-soft: linear-gradient(100deg, rgba(107, 91, 255, .9), rgba(140, 92, 255, .9) 50%, rgba(62, 230, 240, .85));
  --gold-grad: linear-gradient(120deg, #B8862F 0%, #F2C76E 30%, #FFF1C9 50%, #E2AE4F 72%, #9C6C1E 100%);

  --bg: var(--obsidian);
  --bg-2: var(--midnight);
  --text: #F5F6FB;
  --text-2: #C7CAE0;
  --muted: #9A9FBF;
  --link: #A9C4FF;
  --glass: linear-gradient(160deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .025) 60%);
  --glass-strong: linear-gradient(160deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .045) 70%);
  --glass-edge: rgba(255, 255, 255, .11);
  --glass-edge-hi: rgba(255, 255, 255, .24);
  --glow: 0 10px 34px -10px rgba(124, 92, 255, .8);

  /* elevation */
  --e1: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 24px -16px rgba(0, 0, 0, .8);
  --e2: inset 0 1px 0 rgba(255, 255, 255, .12), 0 24px 60px -28px rgba(0, 0, 0, .85);
  --e3: inset 0 1px 0 rgba(255, 255, 255, .14), 0 40px 90px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .04);

  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-cine: cubic-bezier(.16, 1, .3, 1);
  --d1: 120ms; --d2: 220ms; --d3: 420ms; --d4: 700ms; --d5: 1100ms;
}

body {
  background:
    radial-gradient(55rem 38rem at 88% -12%, rgba(124, 92, 255, .30), transparent 62%),
    radial-gradient(44rem 32rem at -12% 18%, rgba(62, 230, 240, .12), transparent 60%),
    radial-gradient(40rem 26rem at 55% 108%, rgba(242, 199, 110, .08), transparent 60%),
    linear-gradient(180deg, var(--midnight) 0%, var(--obsidian) 45%);
  background-attachment: fixed;
}
/* ambient light that drifts with scroll (set by motion.js) */
.ambient { position: fixed; inset: -20vh -10vw; z-index: -1; pointer-events: none;
  background: radial-gradient(38rem 28rem at calc(20% + var(--amb, 0) * 50%) calc(30% + var(--amb, 0) * 30%), rgba(124, 92, 255, .14), transparent 65%);
  transition: background-position var(--d4) var(--ease-out); }

h1, h2 { letter-spacing: -.035em; }
h2 { font-size: clamp(1.7rem, 4.6vw, 2.4rem); }
::selection { background: rgba(124, 92, 255, .5); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ========== Header: frosted glass + active indicator ========== */
.site-header {
  background: linear-gradient(160deg, rgba(14, 18, 44, .66), rgba(8, 9, 24, .52));
  border-color: rgba(255, 255, 255, .1);
  transition: box-shadow var(--d3) var(--ease-out), background var(--d3) var(--ease-out);
}
.scrolled .site-header { box-shadow: var(--e3); background: linear-gradient(160deg, rgba(14, 18, 44, .84), rgba(8, 9, 24, .74)); }
.top-nav a { position: relative; }
.top-nav a:not(.top-cta)::after {
  content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .28rem; height: 2px; border-radius: 2px;
  background: var(--spectrum); transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform var(--d3) var(--ease-cine), opacity var(--d2);
}
.top-nav a:not(.top-cta):hover::after { transform: scaleX(.4); opacity: .6; }
.top-nav a[aria-current="page"]:not(.top-cta) { color: var(--text); }
.top-nav .top-cta[aria-current="page"] { color: #1d1405; box-shadow: 0 0 0 2px rgba(242, 199, 110, .45), 0 8px 28px -10px rgba(242, 199, 110, .8); }
.top-nav a[aria-current="page"]::after { transform: scaleX(1); opacity: 1; box-shadow: 0 0 12px rgba(62, 230, 240, .7); }
.top-nav .top-cta { background: var(--gold-grad); color: #1d1405; box-shadow: 0 8px 28px -10px rgba(242, 199, 110, .8), inset 0 1px 0 rgba(255, 255, 255, .6); }
.top-nav .top-cta:hover { background: var(--gold-grad); filter: brightness(1.06); }
.nav-item { transition: color var(--d2), background var(--d2), transform var(--d2) var(--ease-spring); }
.nav-item:active { transform: scale(.94); }
.nav-item[aria-current="page"] { background: linear-gradient(160deg, rgba(124, 92, 255, .45), rgba(62, 230, 240, .16)); }

.theme-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .05); color: var(--text-2);
  cursor: pointer; transition: background var(--d2), transform var(--d2) var(--ease-spring);
}
.theme-toggle:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { width: 18px; height: 18px; }
.header-end { display: flex; align-items: center; gap: var(--s2); }

/* ========== Buttons: light sweep + spring ========== */
.btn { position: relative; overflow: hidden; isolation: isolate;
  transition: transform var(--d2) var(--ease-spring), box-shadow var(--d3) var(--ease-out), filter var(--d2); }
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn:hover::after { transform: translateX(120%); transition: transform var(--d4) var(--ease-cine); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn-ghost::after { background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .14) 50%, transparent 65%); }
.btn-gold { background: var(--gold-grad); color: #1d1405; box-shadow: 0 12px 36px -12px rgba(242, 199, 110, .85), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-gold:hover { box-shadow: 0 16px 44px -12px rgba(242, 199, 110, 1), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-blue { background: linear-gradient(100deg, #3557D6, #5B43D6); }
.btn-lg { min-height: 54px; padding-inline: 1.6rem; font-size: 1.05rem; }

/* ========== Surfaces ========== */
.grad-border { position: relative; }
.grad-border::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .35), rgba(124, 92, 255, .25) 30%, rgba(255, 255, 255, .04) 55%, rgba(62, 230, 240, .3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.panel, .console-panel { transition: box-shadow var(--d3) var(--ease-out), border-color var(--d3); }
.skeleton { position: relative; overflow: hidden; border-radius: var(--r-ctl); background: rgba(255, 255, 255, .06); min-height: 1em; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .09), transparent); animation: sk 1.4s var(--ease-out) infinite; }
@keyframes sk { to { transform: translateX(100%); } }

/* ========== Motion primitives ========== */
/* Hidden only once JS has confirmed it will reveal them. */
.js-motion [data-reveal] { opacity: 0; transform: translate3d(0, 22px, 0); }
.js-motion [data-reveal="left"] { transform: translate3d(-28px, 0, 0); }
.js-motion [data-reveal="right"] { transform: translate3d(28px, 0, 0); }
.js-motion [data-reveal="scale"] { transform: scale(.94); }
.js-motion [data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity var(--d4) var(--ease-cine), transform var(--d5) var(--ease-cine);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.lite.js-motion [data-reveal] { opacity: 1; transform: none; }

/* headline entrance */
.js-motion .rise > * { display: inline-block; opacity: 0; transform: translate3d(0, .6em, 0); filter: blur(6px);
  animation: rise var(--d5) var(--ease-cine) forwards; animation-delay: calc(120ms + var(--i, 0) * 90ms); }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
.lite .rise > * { animation: none; opacity: 1; transform: none; filter: none; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom-nav-h) + 28px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; padding: .7rem 1.1rem; border-radius: var(--r-pill);
  background: rgba(14, 18, 44, .92); border: 1px solid var(--glass-edge-hi); box-shadow: var(--e3); font-weight: 600; font-size: .92rem;
  transition: transform var(--d3) var(--ease-spring), opacity var(--d2); pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--s4);
  background: rgba(3, 4, 12, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity var(--d3) var(--ease-out); }
.modal.open { opacity: 1; }
.modal-body { transform: scale(.94); transition: transform var(--d3) var(--ease-spring); max-width: 100%; }
.modal.open .modal-body { transform: none; }

/* ========== Holographic card engine ========== */
.hcard {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; --hyp: 0; --flip: 0deg; --lift: 0px;
  --edge: rgba(255, 255, 255, .16);
  position: relative; width: var(--w, 220px); aspect-ratio: 5 / 7; perspective: 900px;
  border-radius: 6% / 4.3%; touch-action: pan-y; -webkit-tap-highlight-color: transparent;
  outline-offset: 6px;
}
.hcard-inner {
  position: absolute; inset: 0; border-radius: inherit; transform-style: preserve-3d;
  transform: translate3d(0, var(--lift), 0) rotateX(var(--rx)) rotateY(calc(var(--ry) + var(--flip)));
  transition: transform var(--d3) var(--ease-out);
  will-change: transform;
}
.hcard.active .hcard-inner { transition: transform 80ms linear; }
.hcard.flipping .hcard-inner { transition: transform var(--d4) var(--ease-cine); }
.hcard-face {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: 0 0 0 1px var(--edge), 0 calc(18px + var(--hyp) * 20px) calc(40px + var(--hyp) * 30px) -18px rgba(0, 0, 0, .85),
    0 0 calc(var(--hyp) * 40px) calc(var(--hyp) * -10px) var(--glowc, transparent);
  transition: box-shadow var(--d3) var(--ease-out);
}
.hcard-back { transform: rotateY(180deg); }
.hcard-front img { width: 100%; height: 100%; object-fit: cover; }
/* glare: follows pointer */
.hcard-glare { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: calc(.35 + var(--hyp) * .55);
  background: radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, .85) 0%, rgba(255, 255, 255, .25) 22%, rgba(0, 0, 0, .45) 90%); }
/* foil: rarity-gated */
.hcard-foil { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: color-dodge; }

.hcard[data-rarity="uncommon"] { --edge: rgba(62, 230, 240, .45); --glowc: rgba(62, 230, 240, .55); }
.hcard[data-rarity="rare"] { --edge: rgba(242, 199, 110, .7); --glowc: rgba(242, 199, 110, .5); }
.hcard[data-rarity="rare"] .hcard-front::before { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 3px; pointer-events: none;
  background: var(--gold-grad); background-size: 200% 200%; background-position: var(--mx) var(--my);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.hcard[data-rarity="ultra"] { --edge: rgba(164, 139, 255, .7); --glowc: rgba(124, 92, 255, .7); }
.hcard[data-rarity="ultra"] .hcard-foil { opacity: calc(.28 + var(--hyp) * .45);
  background: repeating-linear-gradient(115deg, rgba(255, 0, 132, .5) 0%, rgba(252, 164, 0, .5) 6%, rgba(255, 255, 0, .45) 12%, rgba(0, 255, 138, .45) 18%, rgba(0, 207, 255, .5) 24%, rgba(204, 76, 250, .5) 30%, rgba(255, 0, 132, .5) 36%);
  background-size: 300% 300%; background-position: calc(var(--mx) * 1.5) calc(var(--my) * 1.5);
  -webkit-mask: linear-gradient(transparent, #000 40%, #000 70%, transparent); mask: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.hcard[data-rarity="secret"] { --edge: rgba(255, 230, 168, .85); --glowc: rgba(255, 180, 240, .75); }
.hcard[data-rarity="secret"] .hcard-foil { opacity: calc(.3 + var(--hyp) * .35);
  /* iridescent rainbow that slides with the pointer, plus a bright hotspot under the finger */
  background:
    radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 32%),
    repeating-linear-gradient(125deg, #ff7ad9 0%, #ffd36e 7%, #8affc1 14%, #6ee7ff 21%, #a58bff 28%, #ff7ad9 35%);
  background-size: 100% 100%, 400% 400%;
  background-position: center, var(--mx) var(--my); }
/* scattered glitter (not a grid): a few fixed sparkles that brighten as the card tilts */
.hcard[data-rarity="secret"] .hcard-front::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  opacity: calc(.15 + var(--hyp) * .85); mix-blend-mode: screen;
  background:
    radial-gradient(circle at 14% 18%, #fff 0 1.1px, transparent 2.4px), radial-gradient(circle at 71% 9%, #fff 0 1.4px, transparent 2.8px),
    radial-gradient(circle at 86% 34%, #fff 0 1px, transparent 2.2px), radial-gradient(circle at 33% 41%, #fff 0 1.3px, transparent 2.6px),
    radial-gradient(circle at 58% 57%, #fff 0 1px, transparent 2.2px), radial-gradient(circle at 21% 72%, #fff 0 1.5px, transparent 3px),
    radial-gradient(circle at 79% 77%, #fff 0 1.1px, transparent 2.4px), radial-gradient(circle at 47% 88%, #fff 0 1.2px, transparent 2.5px),
    radial-gradient(circle at 9% 47%, #fff 0 .9px, transparent 2px), radial-gradient(circle at 92% 61%, #fff 0 1px, transparent 2.2px); }
@media (prefers-reduced-motion: no-preference) {
  .hcard[data-rarity="ultra"]:not(.active) .hcard-foil { animation: foil-drift 6s ease-in-out infinite alternate; }
  .hcard[data-rarity="secret"]:not(.active) .hcard-foil { animation: foil-drift-2 6s ease-in-out infinite alternate; }
}
@keyframes foil-drift { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
@keyframes foil-drift-2 { from { background-position: center, 0% 30%; } to { background-position: center, 100% 70%; } }
.hcard:focus-visible { outline: 2px solid var(--cyan); }
.lite .hcard-inner { transition: none; }
.lite .hcard-foil { animation: none !important; }

/* Rarivelle original artwork (no third-party characters or logos) */
.cc-art { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 7% 7% 6%; color: #fff;
  background: var(--art-bg, linear-gradient(160deg, #1b2050, #0b0f26)); }
.cc-art .cc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-family: var(--font-display); font-weight: 700; font-size: calc(var(--w, 220px) * .068); letter-spacing: -.01em; }
.cc-art .cc-top small { font-family: var(--font-body); font-weight: 600; font-size: .72em; opacity: .75; }
.cc-art .cc-window { position: relative; flex: 1; margin: 5% 0; border-radius: 4%; overflow: hidden;
  background: var(--art-window, radial-gradient(circle at 50% 40%, #7C5CFF, #1b1f4a 70%)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), inset 0 -30px 50px -20px rgba(0, 0, 0, .5); }
.cc-art .cc-window svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cc-art .cc-meta { font-size: calc(var(--w, 220px) * .05); line-height: 1.35; opacity: .9; }
.cc-art .cc-meta b { font-family: var(--font-display); }
.cc-art .cc-foot { display: flex; justify-content: space-between; font-size: calc(var(--w, 220px) * .042); opacity: .7; margin-top: 4%; }
.cc-back { position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(124, 92, 255, .55), transparent 55%), repeating-linear-gradient(45deg, #0d1130 0 10px, #10163a 10px 20px); }
.cc-back img { width: 46%; height: auto; filter: drop-shadow(0 8px 24px rgba(124, 92, 255, .8)); }
.cc-back::after { content: ""; position: absolute; inset: 5%; border-radius: 4%; border: 1px solid rgba(242, 199, 110, .45); }

/* art themes */
.art-aurora { --art-bg: linear-gradient(160deg, #20184f, #0b0f26 70%); --art-window: radial-gradient(120% 90% at 30% 20%, #3EE6F0 0%, #7C5CFF 40%, #1a1240 80%); }
.art-ember { --art-bg: linear-gradient(160deg, #3a1630, #120a1d 70%); --art-window: radial-gradient(120% 90% at 60% 30%, #FFC36E 0%, #FF5C8A 40%, #2b0f2e 85%); }
.art-tide { --art-bg: linear-gradient(160deg, #0f2a44, #08121f 70%); --art-window: radial-gradient(120% 90% at 50% 80%, #6EF0C8 0%, #2F8CFF 45%, #0b1838 85%); }
.art-gold { --art-bg: linear-gradient(160deg, #3a2a10, #120d05 70%); --art-window: radial-gradient(120% 90% at 50% 30%, #FFF1C9 0%, #F2C76E 30%, #7a4f12 75%); }
.art-prism { --art-bg: linear-gradient(160deg, #2b1050, #0a0718 70%); --art-window: conic-gradient(from 200deg at 50% 55%, #FF7AD9, #FFD36E, #8AFFC1, #6EE7FF, #A58BFF, #FF7AD9); }
.art-stone { --art-bg: linear-gradient(160deg, #24283a, #0e1018 70%); --art-window: radial-gradient(120% 90% at 40% 30%, #B9C2DA 0%, #5B6584 45%, #171b2b 85%); }

/* rarity label */
.rarity-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--glass-edge-hi); color: var(--text-2); background: rgba(255, 255, 255, .05); }
.rarity-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #9A9FBF); }
.rarity-pill[data-r="uncommon"] { --dot: var(--cyan); }
.rarity-pill[data-r="rare"] { --dot: var(--gold); }
.rarity-pill[data-r="ultra"] { --dot: var(--violet-2); }
.rarity-pill[data-r="secret"] { --dot: #FF9BE3; background: linear-gradient(100deg, rgba(255, 155, 227, .14), rgba(110, 231, 255, .12)); }

/* ========== Cinematic hero ========== */
.hero-x { position: relative; overflow: clip; isolation: isolate; padding: clamp(2.5rem, 8vw, 5rem) 0 var(--s6); }
.hero-x .hero-inner { align-items: center; }
.hero-x h1 { font-size: clamp(2.6rem, 10vw, 4.9rem); line-height: .98; max-width: 12ch; }
.hero-x h1 .gradient-text, .hero-x h1 .holo-line .gradient-text { background: var(--holo); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }
@media (prefers-reduced-motion: no-preference) { .hero-x h1 .gradient-text, .hero-x h1 .holo-line .gradient-text { animation: holo-text 9s ease-in-out infinite alternate; } }
@keyframes holo-text { to { background-position: 100% 0; } }
.hstage { position: relative; height: clamp(340px, 88vw, 520px); perspective: 1200px; }
.hstage-layer { position: absolute; inset: 0; transform: translate3d(calc(var(--px, 0) * var(--depth, 0) * 1px), calc(var(--py, 0) * var(--depth, 0) * 1px), 0); transition: transform var(--d4) var(--ease-out); }
.hstage .float { position: absolute; }
.hstage .float.c1 { left: 50%; top: 50%; --w: clamp(170px, 46vw, 240px); margin: calc(var(--w) * -.7) 0 0 calc(var(--w) * -.5); z-index: 3; }
.hstage .float.c2 { left: 8%; top: 18%; --w: clamp(120px, 32vw, 170px); z-index: 2; }
.hstage .float.c3 { right: 6%; top: 30%; --w: clamp(120px, 32vw, 170px); z-index: 2; }
.hstage .float .bob { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  .hstage .float .bob { animation: bob var(--dur, 7s) ease-in-out infinite alternate; }
  .hstage .float.c1 .bob { --dur: 8s; --r0: -2deg; --r1: 3deg; }
  .hstage .float.c2 .bob { --dur: 6.5s; --r0: -14deg; --r1: -8deg; animation-delay: -2s; }
  .hstage .float.c3 .bob { --dur: 7.4s; --r0: 9deg; --r1: 15deg; animation-delay: -4s; }
  .hstage .float.c1 .hcard:not(.active) .hcard-inner { animation: slow-turn 14s ease-in-out infinite alternate; }
}
.hstage .float.c2 .bob { transform: rotate(-11deg); }
.hstage .float.c3 .bob { transform: rotate(12deg); }
@keyframes bob { from { transform: translate3d(0, -8px, 0) rotate(var(--r0, 0deg)); } to { transform: translate3d(0, 10px, 0) rotate(var(--r1, 0deg)); } }
@keyframes slow-turn { from { transform: rotateY(-14deg) rotateX(4deg); } to { transform: rotateY(14deg) rotateX(-3deg); } }
.hstage .chip-card { position: absolute; z-index: 4; padding: .65rem .85rem; border-radius: 16px; min-width: 9.5rem;
  background: linear-gradient(160deg, rgba(20, 24, 56, .82), rgba(10, 12, 30, .72)); border: 1px solid var(--glass-edge-hi);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--e3); }
.hstage .chip-card .k { font-size: .7rem; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.hstage .chip-card .v { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hstage .chip-card .tag { font-size: .62rem; padding: 0 6px; border-radius: var(--r-pill); border: 1px solid var(--glass-edge-hi); }
.hstage .chip-card.k1 { left: 0; bottom: 8%; }
.hstage .chip-card.k2 { right: 0; top: 4%; }
.pos { color: var(--pos); }
/* particles */
.particles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.particles i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: 0; box-shadow: 0 0 8px 1px rgba(164, 139, 255, .9); }
@media (prefers-reduced-motion: no-preference) {
  .particles i { animation: drift var(--t, 9s) linear infinite; animation-delay: var(--dl, 0s); }
}
@keyframes drift { 0% { opacity: 0; transform: translate3d(0, 20px, 0); } 15% { opacity: .9; } 85% { opacity: .6; } 100% { opacity: 0; transform: translate3d(var(--dx, 10px), -160px, 0); } }
.lite .particles { display: none; }
/* light beam behind stage */
.hstage::before { content: ""; position: absolute; left: 50%; top: 50%; width: 120%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(124, 92, 255, .38), rgba(62, 230, 240, .1) 55%, transparent 72%); z-index: 0; pointer-events: none; }
@media (min-width: 900px) {
  .hero-x .hero-inner { grid-template-columns: 1.05fr 1fr; gap: var(--s7); }
}

/* stats strip */
.stats-x { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s5); }
@media (min-width: 900px) { .stats-x { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats-x > div { padding: var(--s4); border-radius: var(--r-card); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--e1); }
.stats-x b { display: block; font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #C9CCE6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats-x span { color: var(--text-2); font-size: .9rem; }

/* engine teaser */
.engine { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 900px) { .engine { grid-template-columns: 1fr 1.1fr; } }
.engine-cards { display: flex; justify-content: center; gap: clamp(.5rem, 2.5vw, 1.2rem); }
.engine-cards .hcard { --w: min(calc((100vw - 64px) / 3), 175px); }
@media (min-width: 900px) { .engine-cards .hcard { --w: clamp(130px, 13vw, 175px); } }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-bottom: var(--s3); }

/* ========== Stations refresh ========== */
.station { background: linear-gradient(165deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02) 60%); transition: transform var(--d3) var(--ease-out), box-shadow var(--d3), border-color var(--d3); }
.station:hover { box-shadow: var(--e3), 0 24px 70px -30px rgba(124, 92, 255, .9); }
.st-grade { --accent: linear-gradient(135deg, #5B7CFF, #7C5CFF); }
.st-trade { --accent: linear-gradient(135deg, #3EE6F0, #5B7CFF); }
.st-vault { --accent: linear-gradient(135deg, #7C5CFF, #C77BFF); }
.st-creator { --accent: linear-gradient(135deg, #2FD8A8, #3EE6F0); }
.st-premium { --accent: var(--gold-grad); }
.st-premium .station-art { color: #2a1c05; }

/* ========== Premium plans ========== */
.plans { gap: var(--s4); }
.plan { position: relative; transition: transform var(--d3) var(--ease-spring), box-shadow var(--d3) var(--ease-out); }
.plan:hover { transform: translateY(-4px); box-shadow: var(--e3); }
.plan::before { content: ""; position: absolute; inset: 0; height: auto; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .03) 45%, rgba(62, 230, 240, .25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.plan.plus::before { background: linear-gradient(140deg, #DDE3F0, rgba(221, 227, 240, .1) 45%, #A9B6D6); }
.plan.pro { background: linear-gradient(165deg, rgba(242, 199, 110, .14), rgba(255, 255, 255, .03) 55%); }
.plan.pro::before { padding: 1.5px; background: var(--gold-grad); background-size: 200% 200%; }
@media (prefers-reduced-motion: no-preference) { .plan.pro::before { animation: gold-shift 6s ease-in-out infinite alternate; } }
@keyframes gold-shift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.plan-badge { position: absolute; top: -12px; right: 18px; padding: 3px 12px; border-radius: var(--r-pill); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: var(--gold-grad); color: #2a1c05; box-shadow: 0 8px 20px -8px rgba(242, 199, 110, .9); }
.plan.pro .price { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan.plus .price { background: linear-gradient(120deg, #fff, #B8C3DE 60%, #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan li::marker { color: var(--cyan); }
.plan.pro li::marker { color: var(--gold); }

.plan .price small { color: var(--muted); -webkit-text-fill-color: var(--muted); }

/* compare table */
.compare { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: var(--s5); font-size: .92rem; }
.compare th, .compare td { padding: .7rem .6rem; text-align: center; border-bottom: 1px solid var(--hairline); }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare thead th { font-family: var(--font-display); font-size: .95rem; position: sticky; top: 0; }
.compare .yes { color: var(--pos); font-weight: 700; }
.compare .no { color: var(--muted); }
.compare-wrap { overflow-x: auto; border-radius: var(--r-card); background: var(--glass); border: 1px solid var(--glass-edge); padding: var(--s3) var(--s4); }

/* ========== Showcase (pack demo) ========== */
.demo-banner { display: flex; gap: var(--s2); align-items: flex-start; font-size: .9rem; padding: var(--s3) var(--s4); border-radius: var(--r-ctl);
  background: rgba(62, 230, 240, .08); border: 1px solid rgba(62, 230, 240, .35); color: var(--text); }
.pack-stage { position: relative; min-height: clamp(420px, 110vw, 560px); display: grid; place-items: center; perspective: 1200px; margin-top: var(--s5); }
.pack { position: relative; width: clamp(180px, 48vw, 240px); aspect-ratio: 5 / 7.6; border: 0; padding: 0; cursor: pointer; border-radius: 14px; color: #fff;
  background: linear-gradient(160deg, #241a5c, #0d0f2b 70%); box-shadow: 0 30px 80px -30px rgba(124, 92, 255, .9), inset 0 0 0 1px rgba(255, 255, 255, .18);
  transform-style: preserve-3d; transition: transform var(--d3) var(--ease-spring), box-shadow var(--d3); overflow: hidden; }
.pack:hover { transform: translateY(-6px) rotateX(6deg); }
.pack:active { transform: scale(.97); }
.pack .pack-foil { position: absolute; inset: 0; background: var(--holo); background-size: 300% 300%; mix-blend-mode: overlay; opacity: .55; }
@media (prefers-reduced-motion: no-preference) { .pack .pack-foil { animation: foil-drift 5s ease-in-out infinite alternate; } .pack:not(.opening) { animation: pack-breathe 3.6s ease-in-out infinite; } }
@keyframes pack-breathe { 50% { box-shadow: 0 36px 100px -30px rgba(62, 230, 240, .7), inset 0 0 0 1px rgba(255, 255, 255, .25); } }
.pack .pack-label { position: absolute; inset: auto 0 12% 0; text-align: center; font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; font-size: 1.25rem; }
.pack .pack-label small { display: block; font-family: var(--font-body); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.pack .pack-mark { position: absolute; top: 16%; left: 50%; width: 42%; transform: translateX(-50%); filter: drop-shadow(0 8px 20px rgba(124, 92, 255, .9)); }
.pack .pack-tear { position: absolute; left: 0; right: 0; top: 0; height: 14%; background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .05)); border-bottom: 1px dashed rgba(255, 255, 255, .5); transform-origin: left bottom; }
.pack.opening { animation: pack-shake 420ms var(--ease-out) 2; }
.pack.opened .pack-tear { transform: rotate(-24deg) translate(-8px, -30px); opacity: 0; transition: transform var(--d4) var(--ease-cine), opacity var(--d4); }
.pack.opened { transform: translateY(60%) scale(.9); opacity: 0; transition: transform var(--d4) var(--ease-cine) 200ms, opacity var(--d3) 300ms; }
@keyframes pack-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2.5deg) scale(1.02); } 75% { transform: rotate(2.5deg) scale(1.02); } }
.pack-stage > * { grid-area: 1 / 1; }
.pack-stage.revealed { min-height: 0; padding: var(--s4) 0; }
.pack-stage.revealed .pack { display: none; }
.reveal-row { position: relative; z-index: 2; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 12px; pointer-events: none; }
.reveal-row:empty { display: none; }
.reveal-row .slot { pointer-events: auto; transition: transform var(--d4) var(--ease-cine), opacity var(--d3); }
.reveal-row .slot .hcard { --w: min(calc((100vw - 72px) / 3), 112px); cursor: pointer; }
@media (min-width: 640px) { .reveal-row { flex-wrap: nowrap; gap: 14px; } .reveal-row .slot .hcard { --w: clamp(120px, 15vw, 190px); } }
.slot.waiting { opacity: 0; transform: translateY(40px) scale(.8); }
.burst { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.burst i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 12px var(--c, #fff);
  animation: burst 900ms var(--ease-cine) forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--bx), var(--by)) scale(.2); opacity: 0; } }
.slot.big-hit .hcard { animation: hit 900ms var(--ease-spring); }
@keyframes hit { 0% { transform: scale(.6); filter: brightness(2.2); } 60% { transform: scale(1.08); } 100% { transform: none; filter: none; } }
.demo-controls { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; align-items: center; margin-top: var(--s4); }
.demo-controls .check { font-size: .9rem; }
.inspect .hcard { --w: min(78vw, 340px); }
.inspect-actions { display: flex; gap: var(--s3); justify-content: center; margin-top: var(--s4); flex-wrap: wrap; }
.result-list { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-top: var(--s4); min-height: 2rem; }

/* ========== Creator page polish ========== */
.creator-hero .ref-card { position: relative; padding: var(--s5); border-radius: var(--r-card); overflow: hidden;
  background: linear-gradient(150deg, rgba(47, 216, 168, .16), rgba(124, 92, 255, .14) 50%, rgba(255, 255, 255, .03)); border: 1px solid var(--glass-edge-hi); box-shadow: var(--e3); }
.ref-card .ref-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; padding: .6rem .8rem; border-radius: var(--r-ctl); background: rgba(0, 0, 0, .3); border: 1px dashed var(--glass-edge-hi); display: block; margin: var(--s3) 0; overflow-wrap: anywhere; }

/* ========== Light mode ========== */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F5FB; --bg-2: #EAEBFA;
  --text: #121531; --text-2: #3D4166; --muted: #636892; --link: #4A3FD9;
  --glass: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .7) 60%);
  --glass-strong: linear-gradient(160deg, #fff, rgba(255, 255, 255, .85));
  --glass-edge: rgba(20, 24, 70, .1); --glass-edge-hi: rgba(20, 24, 70, .18); --hairline: rgba(20, 24, 70, .08);
  --ink-well: rgba(255, 255, 255, .8);
  --pos: #0D8A55; --neg: #C2304E; --warn: #8A5A00; --gold: #8A5A00; --cyan: #076A73; --violet-2: #5B43D6;
  --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 18px 40px -26px rgba(30, 30, 90, .35);
  --e1: 0 10px 24px -18px rgba(30, 30, 90, .35); --e2: 0 20px 50px -28px rgba(30, 30, 90, .4); --e3: 0 30px 70px -30px rgba(30, 30, 90, .45);
}
:root[data-theme="light"] body { background:
    radial-gradient(55rem 38rem at 88% -12%, rgba(124, 92, 255, .16), transparent 62%),
    radial-gradient(44rem 32rem at -12% 18%, rgba(62, 230, 240, .14), transparent 60%),
    linear-gradient(180deg, #EEF0FC, #F7F7FC 45%); }
:root[data-theme="light"] .site-header, :root[data-theme="light"].scrolled .site-header { background: rgba(255, 255, 255, .78); }
:root[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, .88); }
:root[data-theme="light"] .nav-item[aria-current="page"] { background: linear-gradient(160deg, #6B5BFF, #4A3FD9); }
:root[data-theme="light"] .nav-item[aria-current="page"], :root[data-theme="light"] .btn, :root[data-theme="light"] .top-nav .top-cta { color: #fff; }
:root[data-theme="light"] .top-nav .top-cta, :root[data-theme="light"] .btn-gold { color: #2a1c05; }
:root[data-theme="light"] .btn-ghost { background: rgba(255, 255, 255, .7); color: var(--text); }
:root[data-theme="light"] .top-nav a:hover, :root[data-theme="light"] .theme-toggle { background: rgba(20, 24, 70, .05); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fff; color: var(--text); border-color: rgba(20, 24, 70, .2); }
:root[data-theme="light"] .stats-x b { background: linear-gradient(180deg, #121531, #3D4166); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="light"] .hstage .chip-card { background: rgba(255, 255, 255, .86); }
:root[data-theme="light"] .station-art, :root[data-theme="light"] .drop svg { color: #fff; }
:root[data-theme="light"] .ref-card .ref-link { background: rgba(255, 255, 255, .7); }
:root[data-theme="light"] .toast { background: rgba(255, 255, 255, .95); color: var(--text); }
:root[data-theme="light"] .plan.plus .price { background: linear-gradient(120deg, #5a6488, #121531); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="light"] .ambient { opacity: .5; }
:root[data-theme="light"] .site-footer { background: rgba(255, 255, 255, .6); }
:root[data-theme="light"] details.more summary, :root[data-theme="light"] .side-table tr.is-cur th { color: var(--link); }
:root[data-theme="light"] input::placeholder, :root[data-theme="light"] textarea::placeholder { color: #666B90; }
:root[data-theme="light"] .legal-banner { background: rgba(242, 199, 110, .16); }
:root[data-theme="light"] .legal-body mark.ph { background: rgba(242, 199, 110, .28); }
:root[data-theme="light"] .chip.pri-high { color: #9B1F8F; } :root[data-theme="light"] .chip.pri-medium { color: #4A3FD9; }
:root[data-theme="light"] .demo-banner { background: rgba(10, 127, 138, .08); }
/* cards are physical objects: they keep their own dark print in light mode */
:root[data-theme="light"] .hcard, :root[data-theme="light"] .pack { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .btn:hover::after { transition: none; }
}
@media (min-width: 900px) { .site-header .top-nav { margin-left: auto; } }

.rise .holo-line { display: block; }
.ref-card .tag { font-size: .62rem; padding: 0 6px; border-radius: var(--r-pill); border: 1px solid var(--glass-edge-hi); letter-spacing: 0; text-transform: none; color: var(--text-2); margin-left: 6px; }
.creator-hero .page-head { align-items: center; }
.creator-hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); }
.creator-hero .wrap.page-head { padding-left: var(--s4); padding-right: var(--s4); }
@media (min-width: 700px) { .creator-hero .wrap.page-head { padding-left: var(--s6); padding-right: var(--s6); } }
.result-list .rarity-pill { text-transform: none; letter-spacing: 0; font-size: .8rem; }

/* ========== Account deletion ========== */
.delete-acct { margin-top: var(--s4); }
.delete-acct summary { cursor: pointer; color: var(--neg); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.btn-danger { background: linear-gradient(100deg, #B4233F, #8E1B33); color: #fff; }

/* ========== Native app shell (Capacitor) ========== */
.native body { -webkit-touch-callout: none; overscroll-behavior-y: none; }
.native .site-header { top: calc(var(--s3) + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))); }
.native body { padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); }
.native .btn, .native .nav-item, .native .station { -webkit-user-select: none; user-select: none; }
.native .site-footer .footer-links a[href^="mailto"] { white-space: nowrap; }
.iap-bar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin: var(--s4) 0; }

/* ========== Visual Vault: gallery, binder, card photos, detail dialog ========== */
.btn-sm { min-height: 40px; padding: .4rem .9rem; font-size: .88rem; }
.btn.danger, .btn-ghost.danger { color: #ff9aa8; border-color: rgba(255, 120, 140, .35); }
.vault-viewbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin: 0 0 var(--s3); }
.seg-btn { min-height: 40px; padding: .4rem 1rem; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .12); color: var(--text); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.seg-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.vfilters { margin: 0 0 var(--s3); border: 1px solid var(--glass-edge); border-radius: 14px; background: rgba(255, 255, 255, .03); }
.vfilters > summary { min-height: 44px; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); font-weight: 700; cursor: pointer; }
.vfilters[open] > summary { border-bottom: 1px solid var(--hairline); }
.vfilters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s3); padding: var(--s3) var(--s4) 0; }
@media (min-width: 760px) { .vfilters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vfilters .lab-actions { padding: var(--s2) var(--s4) var(--s3); justify-content: space-between; }
.v-totals { margin: 0 0 var(--s3); color: var(--text-2); font-size: var(--step--1); }
.v-totals b { color: var(--text); }
.photo-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: 12px; border: 1px solid rgba(56, 211, 245, .3); background: rgba(56, 211, 245, .07); font-size: var(--step--1); }
.undo-bar { position: sticky; bottom: calc(var(--bottom-nav-h, 0px) + 12px); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s3) 0; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-radius: 14px; background: #171436; border: 1px solid var(--glass-edge); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .7); }
.fx-note { margin-top: var(--s4); }

/* gallery */
.vgallery { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4) var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .vgallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .vgallery { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s5) var(--s4); } }
.gtile { min-width: 0; content-visibility: auto; contain-intrinsic-size: 220px 380px; }
.gtile-btn { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 12px; -webkit-tap-highlight-color: transparent; }
.gtile-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.gtile-meta { display: grid; gap: 2px; padding: var(--s2) 2px 0; min-width: 0; }
.gname { font-size: .95rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gchips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.gchips .rarity-pill { font-size: .62rem; }
.gval { font-size: .82rem; font-weight: 700; }
.gval.est { color: var(--text-2); font-weight: 600; }
.gval.none { color: var(--muted); font-weight: 600; }
.pc-badge { justify-self: start; margin-top: 2px; font-size: .7rem; font-weight: 600; color: var(--cyan); }
.pc-badge.bad { color: #ffb4a8; }
.pc-fav, .pc-qty { position: absolute; z-index: 5; top: 7px; padding: 1px 7px; border-radius: var(--r-pill); font-size: .72rem; font-weight: 800; background: rgba(7, 6, 26, .78); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); pointer-events: none; }
.pc-fav { left: 7px; color: var(--gold); }
.pc-qty { right: 7px; }

/* the card itself: photo first, effects as separate layers on top */
.pcard { --w: 100%; display: block; width: 100%; aspect-ratio: 63 / 88; border-radius: 4.5% / 3.3%; }
.pcard .hcard-inner, .pcard .hcard-face { display: block; }
.pcard .hcard-face { background: #0c0a24; }
.pcard .hcard-front { container-type: inline-size; }
.pcard-big .pc-empty-name { font-size: 1.5rem; }
.pcard .pc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: linear-gradient(110deg, #121034 30%, #1b1846 50%, #121034 70%); background-size: 200% 100%; }
.pcard-big .pc-img { object-fit: contain; background: #08071c; }
@media (prefers-reduced-motion: no-preference) { .pcard .pc-img:not([src]) { animation: pc-loading 1.4s linear infinite; } }
@keyframes pc-loading { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pc-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 10%; text-align: left;
  background: radial-gradient(circle at 70% 18%, rgba(139, 92, 246, .38), transparent 55%), radial-gradient(circle at 15% 85%, rgba(56, 211, 245, .2), transparent 50%), repeating-linear-gradient(45deg, #0f0d2e 0 10px, #121036 10px 20px); }
.pc-empty::before { content: ""; position: absolute; inset: 7%; border-radius: 4%; border: 1px dashed rgba(255, 255, 255, .22); }
.pc-empty-name { font-family: var(--font-display, inherit); font-weight: 700; font-size: clamp(.78rem, 9cqi, 1.3rem); line-height: 1.15; color: #fff; overflow-wrap: anywhere; }
.pc-empty-meta { font-size: .72rem; color: var(--text-2); }
.pc-empty-note { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); }
/* ordinary cards stay calm: a soft glare only while pointed at */
.pcard .hcard-glare { opacity: calc(var(--hyp) * .45); }
.pcard.active .hcard-glare { opacity: calc(.12 + var(--hyp) * .5); }
/* rarity → edge and glow only (never foil) */
.pcard[data-tier="uncommon"] { --edge: rgba(56, 211, 245, .45); --glowc: rgba(56, 211, 245, .45); }
.pcard[data-tier="rare"] { --edge: rgba(255, 210, 122, .65); --glowc: rgba(255, 210, 122, .45); }
.pcard[data-tier="ultra"] { --edge: rgba(164, 139, 255, .75); --glowc: rgba(124, 92, 255, .6); }
.pcard[data-tier="secret"] { --edge: rgba(255, 230, 168, .9); --glowc: rgba(255, 180, 240, .65); }
.pcard[data-tier="ultra"] .hcard-face, .pcard[data-tier="secret"] .hcard-face { box-shadow: 0 0 0 1.5px var(--edge), 0 calc(14px + var(--hyp) * 18px) calc(30px + var(--hyp) * 26px) -18px rgba(0, 0, 0, .85), 0 0 calc(10px + var(--hyp) * 34px) calc(-6px + var(--hyp) * -6px) var(--glowc); }
/* finish → foil light (only when a holo/foil finish is saved). Kept faint so art, text and wear stay visible. */
.pcard[data-foil] .hcard-foil { mix-blend-mode: color-dodge; opacity: calc(.08 + var(--hyp) * .32);
  background: repeating-linear-gradient(115deg, rgba(255, 0, 132, .45) 0%, rgba(252, 164, 0, .45) 6%, rgba(255, 255, 0, .4) 12%, rgba(0, 255, 138, .4) 18%, rgba(0, 207, 255, .45) 24%, rgba(204, 76, 250, .45) 30%, rgba(255, 0, 132, .45) 36%);
  background-size: 300% 300%; background-position: calc(var(--mx) * 1.5) calc(var(--my) * 1.5); }
.pcard[data-foil="refractor"] .hcard-foil { background: conic-gradient(from calc(var(--hyp) * 180deg) at var(--mx) var(--my), #ff7ad9, #ffd36e, #8affc1, #6ee7ff, #a58bff, #ff7ad9); opacity: calc(.06 + var(--hyp) * .28); }
/* reverse holo: shimmer around the edges, the middle stays clear */
.pcard[data-foil="reverse"] .hcard-foil { -webkit-mask: radial-gradient(ellipse 62% 55% at 50% 45%, transparent 60%, #000 75%); mask: radial-gradient(ellipse 62% 55% at 50% 45%, transparent 60%, #000 75%); }
/* secret rare with a foil finish: a few sparkles that brighten as it tilts */
.pcard[data-tier="secret"][data-foil] .hcard-front::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: calc(var(--hyp) * .8); mix-blend-mode: screen;
  background: radial-gradient(circle at 14% 18%, #fff 0 1px, transparent 2.2px), radial-gradient(circle at 71% 9%, #fff 0 1.2px, transparent 2.6px), radial-gradient(circle at 86% 34%, #fff 0 1px, transparent 2.2px), radial-gradient(circle at 21% 72%, #fff 0 1.3px, transparent 2.8px), radial-gradient(circle at 79% 77%, #fff 0 1px, transparent 2.2px), radial-gradient(circle at 47% 88%, #fff 0 1.1px, transparent 2.4px); }
/* idle drift only for foil cards that are on screen */
@media (prefers-reduced-motion: no-preference) {
  .pcard[data-foil].inview:not(.active) .hcard-foil { animation: foil-drift 7s ease-in-out infinite alternate; }
}
.fx-off .pcard .hcard-foil, .fx-off .pcard .hcard-glare, .fx-off .pcard .hcard-front::after { display: none; }
.fx-off .pcard .hcard-inner { transform: none !important; }
.lite .pcard .hcard-foil { animation: none !important; }
@media (hover: hover) and (pointer: fine) { .gtile-btn:hover .pcard { --lift: -4px; } }

/* binder */
.binder-book { max-width: 860px; margin-inline: auto; padding: var(--s3); border-radius: 18px; background: linear-gradient(160deg, #1a1540, #0e0c28); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 20px 40px -24px rgba(0, 0, 0, .8); }
.binder-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); padding: 0 var(--s1) var(--s3); }
.binder-page { list-style: none; margin: 0; padding: var(--s2); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); border-radius: 12px; background: rgba(0, 0, 0, .25); }
@media (min-width: 700px) { .binder-page { gap: var(--s4); padding: var(--s4); } .binder-book { padding: var(--s5); } }
.slot { min-width: 0; padding: 5px; border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 10px 18px -12px rgba(255, 255, 255, .25); }
.slot .gtile-meta { padding-top: 6px; }
.slot .gchips, .slot .pc-badge { display: none; }
@media (max-width: 520px) { .slot .gsub { display: none; } .slot .gname { font-size: .74rem; } }
.slot.empty .sleeve { display: block; aspect-ratio: 63 / 88; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, .14); }
.binder-nav { display: flex; justify-content: space-between; gap: var(--s2); padding-top: var(--s3); }

/* card detail */
dialog.sheet.card-dialog { width: min(980px, calc(100vw - 16px)); padding: 0; }
.cd-head { position: sticky; top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); background: inherit; border-bottom: 1px solid var(--hairline); }
.cd-head h2 { margin: 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-body { display: grid; gap: var(--s5); padding: var(--s4); }
@media (min-width: 820px) { .cd-body { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } .cd-view { position: sticky; top: 64px; } }
.cd-stage { display: grid; place-items: center; }
.cd-stage .pcard { width: min(100%, 360px); }
.cd-zoom { width: 100%; height: min(70vh, 560px); overflow: auto; border-radius: 12px; background: #08071c; cursor: grab; touch-action: pan-x pan-y; overscroll-behavior: contain; }
.cd-zoom img { display: block; width: 220%; max-width: none; height: auto; }
.cd-photo-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin-top: var(--s3); }
.cd-facts { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.cd-facts > div { display: grid; grid-template-columns: 8.5rem 1fr; gap: var(--s3); padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.cd-facts dt { color: var(--muted); font-size: var(--step--1); }
.cd-facts dd { margin: 0; overflow-wrap: anywhere; }
.cd-notes { white-space: pre-wrap; padding: var(--s3); border-radius: 12px; background: rgba(255, 255, 255, .04); }
.cd-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); margin: var(--s4) 0; }
.cd-box { display: grid; gap: 2px; padding: var(--s3); border-radius: 12px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .03); }
.cd-box .k { font-size: .78rem; color: var(--muted); font-weight: 600; }
.cd-box b { font-size: 1.2rem; }
.cd-box b.muted { color: var(--muted); font-size: 1rem; }
.cd-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet.card-dialog[open] { animation: cd-in var(--d3, 260ms) var(--ease-out, ease-out); }
  @keyframes cd-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
}

/* scan review photo + crop editor */
.scan-photo { display: flex; gap: var(--s3); align-items: flex-start; margin: var(--s2) 0; }
.scan-photo img, .scan-photo-off { width: 96px; height: auto; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--glass-edge); flex: none; }
.scan-photo-off { display: grid; place-items: center; font-size: .7rem; color: var(--muted); background: rgba(255, 255, 255, .04); }
.scan-photo-actions { display: grid; gap: var(--s2); justify-items: start; }
dialog.sheet.crop-dialog { width: min(760px, calc(100vw - 16px)); }
.crop-stage { position: relative; display: grid; place-items: center; margin: var(--s3) 0; user-select: none; -webkit-user-select: none; }
.crop-stage canvas { max-width: 100%; border-radius: 6px; }
.crop-box { position: absolute; box-sizing: border-box; border: 2px solid var(--cyan); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); cursor: move; touch-action: none; }
.crop-stage { overflow: hidden; padding: 14px; }
.crop-box:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.crop-h { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--cyan); border: 3px solid #07061A; }
.crop-h[data-h="nw"] { left: -13px; top: -13px; cursor: nwse-resize; }
.crop-h[data-h="ne"] { right: -13px; top: -13px; cursor: nesw-resize; }
.crop-h[data-h="sw"] { left: -13px; bottom: -13px; cursor: nesw-resize; }
.crop-h[data-h="se"] { right: -13px; bottom: -13px; cursor: nwse-resize; }
.crop-tools [aria-pressed="true"] { background: rgba(56, 211, 245, .15); border-color: var(--cyan); }

/* ========== Vault: collection-first layout ========== */
.vault-page { padding-top: var(--s4); }
.vault-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s3); }
.vh-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s3); }
.vault-head h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 0; }
.vh-actions { display: flex; gap: var(--s2); }
@media (max-width: 559px) { .vh-actions { width: 100%; } .vh-actions .btn { flex: 1; } }
.save-state { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 12px 2px 10px; border-radius: var(--r-pill); border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .04); color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.save-state[data-state="synced"]::before { background: #6ee7a8; }
.save-state[data-state="syncing"]::before { background: var(--cyan); }
.save-state[data-state="offline"]::before, .save-state[data-state="conflict"]::before { background: var(--gold); }
.save-state[data-state="failed"]::before, .save-state[data-state="blocked"]::before { background: #ff8b8b; }
.save-state[data-state="failed"], .save-state[data-state="blocked"] { color: #ffb4a8; border-color: rgba(255, 139, 139, .4); }
.save-state:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.vault-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: var(--s3) 0 var(--s1); }
.vault-summary > div { padding: var(--s2) var(--s3); border-radius: 12px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, .025); min-width: 0; }
.vault-summary dt { font-size: .72rem; font-weight: 600; color: var(--muted); }
.vault-summary dd { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vault-summary dd.pos { color: #6ee7a8; } .vault-summary dd.neg { color: #ff9aa8; }
@media (max-width: 559px) { .vault-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vault-coverage { margin: 0 0 var(--s3); font-size: .78rem; }
.sync-status { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: 12px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .03); }
.sync-status.bad { border-color: rgba(255, 139, 139, .4); }
.sync-status.warn { border-color: rgba(255, 210, 122, .45); }
.sync-status p { margin: 0 0 var(--s2); }
.save-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: 12px; border: 1px solid rgba(255, 210, 122, .35); background: rgba(255, 210, 122, .06); font-size: var(--step--1); }
.save-invite p { margin: 0; }
.save-invite .lab-actions { margin: 0; }
#cards .vault-toolbar { margin-bottom: var(--s2); }
.v-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 var(--s3); }
.filter-chip { min-height: 32px; cursor: pointer; font: inherit; font-size: .78rem; }
.vault-empty { text-align: left; padding: var(--s5); border-radius: 16px; border: 1px dashed var(--glass-edge); }
.vault-empty .lab-actions { flex-wrap: wrap; }
.gtile.just-saved .gtile-btn, .slot .gtile.just-saved .gtile-btn, .vcard.just-saved { box-shadow: 0 0 0 2px var(--gold), 0 0 28px -4px rgba(255, 210, 122, .7); border-radius: 12px; }
@media (prefers-reduced-motion: no-preference) { .gtile.just-saved .pcard { animation: just-saved 900ms var(--ease-out, ease-out); } }
@keyframes just-saved { from { transform: translateY(10px) scale(.96); opacity: .4; } }
.gval small { font-size: .66rem; font-weight: 600; color: var(--muted); }
.gval.ex { color: var(--gold); }
.undo-bar { position: sticky; }

/* collection tools */
.vault-tools { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--hairline); }
.tools-h { font-size: 1.05rem; margin-bottom: var(--s2); }
.tool-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tool-tab { flex: none; min-height: 40px; padding: .4rem 1rem; border-radius: var(--r-pill); border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .03); color: var(--text-2); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; }
.tool-tab[aria-expanded="true"] { background: rgba(255, 210, 122, .12); border-color: rgba(255, 210, 122, .5); color: var(--text); }
.tool-tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tool-panel { margin-top: var(--s4); }

/* sheets: dialogs on desktop, full screen on phones */
dialog.sheet.vsheet { width: min(720px, calc(100vw - 16px)); padding: 0; }
.vsheet-head { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); background: inherit; border-bottom: 1px solid var(--hairline); }
.vsheet-head h2 { margin: 0; font-size: 1.15rem; }
.vsheet-body { padding: var(--s4); }
.sheet-actions { position: sticky; bottom: 0; z-index: 4; margin: var(--s3) calc(-1 * var(--s4)) 0; padding: var(--s3) var(--s4); background: inherit; border-top: 1px solid var(--hairline); }
dialog.vsheet .sheet-actions, dialog.vsheet .vsheet-head { background: var(--bg-2, #141826); }
:root[data-theme="light"] dialog.vsheet .sheet-actions, :root[data-theme="light"] dialog.vsheet .vsheet-head { background: #fff; }
@media (max-width: 640px) {
  dialog.sheet.vsheet, dialog.sheet.card-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
}
.quick-add .add-more { margin: var(--s2) 0; border: 1px solid var(--hairline); border-radius: 12px; padding: 0 var(--s3); }
.quick-add .add-more > summary { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); font-weight: 700; cursor: pointer; }
.quick-add .add-more[open] { padding-bottom: var(--s3); }
.scan-summary:empty { display: none; }
.cd-noback { margin: 0; align-self: center; }
#cards .vault-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); }
#cards .vault-toolbar select { width: auto; min-width: 0; }
@media (max-width: 559px) {
  .vault-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .vault-summary > div { padding: 6px 8px; border-radius: 10px; }
  .vault-summary dt { font-size: .62rem; }
  .vault-summary dd { font-size: .9rem; }
  .vault-head { margin-bottom: var(--s2); }
  .vh-actions .btn { min-height: 44px; padding-block: .5rem; }
  .vault-viewbar .seg-btn { padding-inline: .8rem; }
}
.vault-viewbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s2); }
.vault-viewbar .vfilters { flex: 1 1 140px; margin: 0; }
.vault-viewbar .vfilters[open] { flex-basis: 100%; order: 3; }
.vault-viewbar .vfilters > summary { min-height: 44px; }
.vault-summary[hidden], .vault-controls[hidden] { display: none; }
@media (max-width: 559px) {
  .vault-viewbar .seg-btn { min-height: 40px; padding: .35rem .7rem; font-size: .88rem; }
  .vault-viewbar .vfilters { flex-basis: 100px; }
  .vault-coverage { font-size: .74rem; }
}
@media (max-width: 640px) { .cd-stage .pcard { width: min(68vw, 280px); } .cd-body { gap: var(--s4); } }

/* ================= Rarivelle Market ================= */
/* Listing photos are always shown plain: no rarity glow, foil or tilt on anything for sale. */
.mk-page { padding-bottom: 48px; }
.mk-narrow { max-width: 760px; }
.mk-back { margin: 12px 0 0; font-size: .9rem; }
.mk-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 12px 0 16px; }
.mk-head h1 { margin: 4px 0 0; }
.mk-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-mode { margin: 0 0 14px; }
.mk-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }
.mk-search input, .mk-search select { min-height: 44px; }
.mk-grid { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.mk-tile { position: relative; border: 1px solid var(--glass-edge); border-radius: var(--rv-r); background: var(--glass); overflow: hidden; transition: border-color var(--rv-d) var(--rv-ease), transform var(--rv-d) var(--rv-ease); }
.mk-tile:hover { border-color: var(--glass-edge-hi); transform: translateY(-2px); }
.mk-tile.sold { opacity: .72; }
.mk-tile-link { display: block; color: inherit; text-decoration: none; }
.mk-tile-link:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: var(--rv-r); }
.mk-img { position: relative; display: block; aspect-ratio: 63 / 88; background: var(--bg-2); }
.mk-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mk-noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: .8rem; }
.mk-noimg.sm { width: 60px; height: 84px; border-radius: 6px; background: var(--bg-2); }
.mk-flag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: rgba(16, 19, 27, .85); color: var(--rv-ivory); }
.mk-meta { display: grid; gap: 2px; padding: 10px 12px 12px; font-size: .84rem; }
.mk-name { font-size: .95rem; line-height: 1.25; }
.mk-sub, .mk-seller { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.mk-cond { color: var(--text-2); }
.mk-price { margin-top: 4px; font-variant-numeric: tabular-nums; }
.mk-price b { font-family: var(--font-display); font-size: 1.1rem; }
.mk-price small { color: var(--muted); }
.mk-fav { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--glass-edge); background: rgba(16, 19, 27, .7); color: var(--gold); font-size: 1.1rem; cursor: pointer; }
.mk-fav[aria-pressed="true"] { background: var(--gold); color: var(--rv-obsidian); }
.mk-state { text-align: center; padding: 32px 16px; border: 1px dashed var(--glass-edge); border-radius: var(--rv-r); margin: 16px 0; }
.mk-state .btn { margin-top: 8px; }
.mk-foot { margin-top: 24px; }
.mk-skel { aspect-ratio: 63 / 110; border-radius: var(--rv-r); background: linear-gradient(90deg, var(--bg-2), var(--hairline), var(--bg-2)); background-size: 200% 100%; animation: mk-shimmer 1.4s linear infinite; }
@keyframes mk-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .mk-skel { animation: none; } .mk-tile, .mk-tile:hover { transform: none; transition: none; } }

/* listing detail */
.ml-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .ml-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.ml-main { display: block; width: 100%; padding: 0; border: 1px solid var(--glass-edge); border-radius: var(--rv-r); background: var(--bg-2); cursor: zoom-in; overflow: hidden; }
.ml-main img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; }
.ml-thumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 10px 0; }
.ml-thumbs button { display: grid; gap: 2px; justify-items: center; padding: 4px; border: 1px solid var(--glass-edge); border-radius: 8px; background: none; color: var(--muted); font-size: .7rem; cursor: pointer; min-width: 44px; }
.ml-thumbs button[aria-pressed="true"] { border-color: var(--gold); color: var(--text); }
.ml-thumbs img { width: 60px; height: 84px; object-fit: contain; }
.ml-info h1 { margin: 4px 0; overflow-wrap: anywhere; }
.ml-info h2 { font-size: 1rem; margin: 20px 0 6px; }
.ml-ident { color: var(--text-2); margin: 0; }
.ml-buy { margin: 16px 0; padding: 16px; }
.ml-price b { font-family: var(--font-display); font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.ml-price span { color: var(--muted); }
.ml-buy-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 4px; }
.ml-buy-form .btn { min-width: 160px; }
.ml-text { white-space: pre-line; overflow-wrap: anywhere; }
.ml-seller { padding: 12px 16px; }
.ml-zoom { overflow: auto; max-height: 75vh; touch-action: pan-x pan-y pinch-zoom; }
.ml-zoom img { max-width: none; width: auto; height: auto; }
.mk-reviews { list-style: none; padding: 0; display: grid; gap: 10px; }
.mk-reviews li { padding: 10px 12px; border: 1px solid var(--glass-edge); border-radius: 10px; }
.mk-reviews b { color: var(--gold); letter-spacing: .05em; }

/* sell flow */
.mk-step { margin: 16px 0; padding: 18px; }
.mk-step h2 { margin-top: 0; font-size: 1.1rem; }
.mk-cols { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.mk-form { display: grid; gap: 10px; }
.mk-form textarea, .mk-form input, .mk-form select { width: 100%; }
.mk-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.mk-inline .field { margin: 0; }
.mk-photos { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; }
.mk-photos li { display: grid; gap: 4px; justify-items: center; font-size: .78rem; color: var(--muted); }
.mk-photos img { width: 90px; height: 126px; object-fit: contain; background: var(--bg-2); border-radius: 6px; border: 1px solid var(--glass-edge); }
.mk-photo-tools { display: flex; gap: 4px; }
.mk-radio { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; }
.mk-radio input { margin-top: 4px; }
.mk-check { display: flex; gap: 8px; align-items: center; }
.mk-problems { margin: 4px 0 12px; padding-left: 20px; color: var(--text-2); }
.mk-ready { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--glass-edge); }
.mk-ready.ok { border-color: rgba(134, 183, 190, .5); }
.mk-ready.wait { border-color: var(--glass-edge-hi); }
.mk-money { display: grid; gap: 4px; margin: 8px 0; }
.mk-money > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
.mk-money dt { color: var(--text-2); }
.mk-money dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.mk-money .total dt, .mk-money .total dd { color: var(--text); font-weight: 700; }
.co-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px; margin-bottom: 14px; }
.co-item img { width: 90px; height: auto; border-radius: 6px; flex: none; }

/* dashboards and orders */
.mk-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--hairline); margin-bottom: 12px; }
.mk-tabs a { padding: 10px 14px; white-space: nowrap; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; min-height: 44px; }
.mk-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--gold); }
.mo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.mo-row a { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--glass-edge); border-radius: 12px; color: inherit; text-decoration: none; }
.mo-row a:hover { border-color: var(--glass-edge-hi); }
.mo-row img { width: 60px; height: 84px; object-fit: contain; background: var(--bg-2); border-radius: 6px; }
.mo-row span { display: grid; gap: 2px; min-width: 0; }
.mo-row small { color: var(--muted); overflow-wrap: anywhere; }
.mo-amt { text-align: right; font-variant-numeric: tabular-nums; }
.mo-order { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .mo-order { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); } }
.mo-title { font-size: 1.3rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.mo-photos { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.mo-photos img { width: 64px; height: 90px; object-fit: contain; background: var(--bg-2); border-radius: 6px; }
.mo-main h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.mo-main > .panel, .mo-main > details, .mo-side > .panel, .mo-side > details { padding: 14px 16px; margin: 12px 0; }
.mo-timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--hairline); }
.mo-timeline li { padding: 4px 0 8px 14px; position: relative; }
.mo-timeline li::before { content: ''; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.mo-timeline time { color: var(--muted); font-size: .8rem; display: block; }
.mo-msgs { list-style: none; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.mo-msgs li { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--glass-edge); max-width: 90%; }
.mo-msgs li.mine { justify-self: end; border-color: var(--glass-edge-hi); }
.mo-msgs time { color: var(--muted); font-size: .75rem; }
.mo-msgs p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.mo-cases { list-style: none; padding: 0; }
.mo-cases > li { padding: 10px 12px; border: 1px solid var(--glass-edge); border-radius: 10px; margin-bottom: 8px; }
.mk-stars { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; }
.mk-stars label { display: inline-flex; gap: 4px; align-items: center; min-height: 44px; }
address { font-style: normal; line-height: 1.5; }
@media (max-width: 640px) {
  .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mk-search { grid-template-columns: 1fr; }
  .co-item { flex-direction: column; }
  .mo-row a { grid-template-columns: 48px minmax(0, 1fr); }
  .mo-row img, .mo-row .mk-noimg.sm { width: 48px; height: 67px; }
  .mo-amt { grid-column: 2; text-align: left; }
}
/* Native-feeling page changes: a short cross-fade between pages (browsers that support cross-document
   view transitions); off when the person prefers reduced motion. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
.native { -webkit-tap-highlight-color: transparent; }
.native dialog.sheet { margin-bottom: calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
