/* ============================================================================
   Wendigo Shop — Warm Parchment Premium Theme (MOBILE-FIRST)
   ----------------------------------------------------------------------------
   Base styles target phones ≤480px. Larger viewports are progressive
   enhancements via @media (min-width: ...). See MTG_SHOP_MOBILE_MIGRATION.md.
   ========================================================================== */

/* Las fuentes se cargan con <link> en index.html: tenerlas también aquí
   suponía dos peticiones bloqueantes con listas de pesos distintas. */

/* ── Design tokens — Wendigo diurno / nocturno ───────────────────────────
   El nocturno (bosque frío, hueso y latón) es la identidad de la marca; el
   diurno es el mismo bosque a la luz del día. Los nombres de token no
   cambian nunca — sólo sus valores — así que toda la hoja vira con ellos.

   `:root` define el modo CLARO completo. Debajo, tres bloques ponen el
   nocturno: la preferencia del sistema, y el interruptor en las dos
   direcciones, de forma que una elección explícita siempre gane.

   Maná y rareza NO cambian con el modo: son colores del juego, no del tema,
   y los símbolos llevan borde y sombra propios para leerse sobre ambos.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  /* Superficies — de la más honda a la más elevada */
  --bg: #f2efe4;          /* día: papel de hueso */
  --bg-dark: #131815;     /* corteza: SIEMPRE oscuro, en los dos modos */
  --bg-card: #fbf9f2;     /* tarjetas y paneles */
  --bg-alt: #e7e2d1;      /* superficie elevada */
  --bg-alt-2: #dad4c0;

  /* Texto */
  --text: #1a231c;        /* tinta de bosque */
  --text-2: #4a574e;
  --text-m: #656e68;

  /* Acento — el latón es el ÚNICO acento de marca */
  --accent: #7d5f28;
  --accent-lt: #9a7734;
  --accent-dk: #5f4820;
  --on-accent: #fbf9f2;   /* tinta sobre latón — se invierte con el modo */
  --gold: #7d5f28;
  --gold-lt: #9a7734;
  --frost: #2c5f55;       /* resalte frío: enlaces y foco */

  --border: rgba(26, 35, 28, .16);
  --border-dk: rgba(26, 35, 28, .30);
  --shadow: 0 2px 12px rgba(26, 35, 28, .10);
  --shadow-lg: 0 18px 40px -18px rgba(26, 35, 28, .30);
  --shadow-drawer: 0 24px 60px rgba(26, 35, 28, .26);

  /* Maná — los cinco colores de Magic */
  --mana-w: #e8dfae;
  --mana-u: #2b7ec1;
  --mana-b: #6e5a72;
  --mana-r: #c8452f;
  --mana-g: #4b8f52;
  --mana-c: #8d8b85;

  /* Rareza — los colores reales del juego */
  --rar-common: #b9b9b9;
  --rar-uncommon: #8b98a5;
  --rar-rare: #c9a227;
  --rar-mythic-1: #d3541f;
  --rar-mythic-2: #b3312a;
  --rar-special: #7e6bb0;
  --rar-bonus: #c0a062;

  /* Semántica — separada del acento */
  --ok: #3a7141;          /* con existencias */
  --warn: #8a5c19;        /* pocas unidades */
  --danger: #a8341f;      /* error, acción destructiva */
  --muted-out: #7d7d7d;   /* agotado */

  /* Type */
  --font-d: Cinzel, Georgia, 'Times New Roman', serif;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-m: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-f: Spectral, Georgia, serif;   /* texto ambiental de la carta */

  /* Radius */
  --r: 10px;
  --r-sm: 6px;
  --r-lg: 14px;

  /* Spacing */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --pad-x: clamp(1rem, 4vw, 1.5rem);

  /* Motion */
  --t: .3s cubic-bezier(.4, 0, .2, 1);

  /* Mobile-first essentials */
  --touch: 44px;
  --header-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Sin elección explícita manda la preferencia del sistema. */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="day"]) {
    /* Wendigo nocturno — sólo los tokens que dependen del tema. */
    --bg: #0b0e0c;
    --bg-card: #131815;
    --bg-alt: #1b241d;
    --bg-alt-2: #243029;

    --text: #e8e2d4;
    --text-2: #a9a294;
    --text-m: #8a8478;

    --accent: #c89a4a;
    --accent-lt: #e0b76a;
    --accent-dk: #8a6a2e;
    --on-accent: #191207;
    --gold: #c89a4a;
    --gold-lt: #e0b76a;
    --frost: #8fb3ab;

    --border: rgba(232, 226, 212, .10);
    --border-dk: rgba(232, 226, 212, .22);
    --shadow: 0 2px 12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 18px 40px -18px rgba(0, 0, 0, .8);
    --shadow-drawer: 0 24px 60px rgba(0, 0, 0, .7);

    --ok: #5f9e63;
    --warn: #c98a2e;
    --danger: #c8452f;
    --muted-out: #6b6b6b;
  }
}

/* Con elección explícita manda el interruptor, en las dos direcciones. */
:root[data-mode="night"] {
  /* Wendigo nocturno — sólo los tokens que dependen del tema. */
  --bg: #0b0e0c;
  --bg-card: #131815;
  --bg-alt: #1b241d;
  --bg-alt-2: #243029;

  --text: #e8e2d4;
  --text-2: #a9a294;
  --text-m: #8a8478;

  --accent: #c89a4a;
  --accent-lt: #e0b76a;
  --accent-dk: #8a6a2e;
  --on-accent: #191207;
  --gold: #c89a4a;
  --gold-lt: #e0b76a;
  --frost: #8fb3ab;

  --border: rgba(232, 226, 212, .10);
  --border-dk: rgba(232, 226, 212, .22);
  --shadow: 0 2px 12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 40px -18px rgba(0, 0, 0, .8);
  --shadow-drawer: 0 24px 60px rgba(0, 0, 0, .7);

  --ok: #5f9e63;
  --warn: #c98a2e;
  --danger: #c8452f;
  --muted-out: #6b6b6b;
}

/* ── Cromo permanentemente oscuro ────────────────────────────────────────
   Cabecera, cajón, pie, el botón flotante del carrito y el de envío siguen
   oscuros también de día: son la barra de marca. En lugar de auditar regla
   por regla lo que va dentro, se les redeclaran los tokens nocturnos en
   local y todos sus descendientes los heredan. De noche este bloque no hace
   nada, porque los valores ya son ésos.
   ───────────────────────────────────────────────────────────────────────── */
.site-header,
.main-nav,
.site-footer,
.cart-fab,
.btn-submit,
.placeholder-slide,
.inventory-table th {
  --bg-card: #131815;
  --bg-alt: #1b241d;
  --bg-alt-2: #243029;
  --text: #e8e2d4;
  --text-2: #a9a294;
  --text-m: #8a8478;
  --accent: #c89a4a;
  --accent-lt: #e0b76a;
  --accent-dk: #8a6a2e;
  --on-accent: #191207;
  --gold: #c89a4a;
  --gold-lt: #e0b76a;
  --frost: #8fb3ab;
  --border: rgba(232, 226, 212, .10);
  --border-dk: rgba(232, 226, 212, .22);
}

/* Interruptor día/noche — vive en el cromo oscuro, así que hereda sus
   tokens y se ve igual en los dos modos. */
.mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  flex: none;
  border-radius: var(--r-sm);
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(200, 168, 78, .2);
  transition: background var(--t), color var(--t);
}

.mode-toggle:hover,
.mode-toggle:focus-visible {
  background: rgba(200, 168, 78, .12);
  color: var(--gold-lt);
  outline: none;
}

.mode-toggle svg {
  transition: transform .45s cubic-bezier(.4, 0, .2, 1);
}

.mode-toggle:hover svg {
  transform: rotate(25deg);
}

@media (prefers-reduced-motion: reduce) {
  .mode-toggle svg,
  .mode-toggle:hover svg {
    transition: none;
    transform: none;
  }
}


/* ── Reset ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
}

body[data-no-scroll] {
  overflow: hidden;
  touch-action: none;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--t);
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  background: none;
  border: none;
  color: inherit;
}

/* Inputs anti-zoom iOS (≥16px) + tap target */
input,
select,
textarea {
  font-family: var(--font);
  font-size: 16px;
}

input,
select {
  min-height: var(--touch);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── HEADER (mobile-first) ───────────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: max(.5rem, var(--safe-top)) var(--pad-x) .5rem;
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-h);
}

.site-header .logo {
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
  flex: 1;
  text-align: center;
}

.site-header .logo a {
  color: var(--gold);
}

/* Hamburger button — visible only on mobile */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border-radius: var(--r-sm);
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(200, 168, 78, .2);
  transition: background var(--t);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgba(200, 168, 78, .12);
  outline: none;
}

/* Main nav — mobile shows as drawer; desktop reveals as inline links */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: min(82vw, 320px);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-dark);
  padding: calc(var(--header-h) + var(--safe-top) + 1rem) 1.25rem calc(1rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transform: translateX(-100%);
  transition: transform var(--t);
  z-index: 110;
  box-shadow: var(--shadow-drawer);
  overflow-y: auto;
}

.main-nav.is-open {
  transform: translateX(0);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  z-index: 105;
}

.nav-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.main-nav a:not(.cart-link) {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  min-height: var(--touch);
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
  border-radius: var(--r-sm);
  letter-spacing: .3px;
}

.main-nav a:not(.cart-link):hover,
.main-nav a:not(.cart-link).active {
  background: rgba(200, 168, 78, .12);
  color: var(--gold);
}

.nav-catalog-link {
  position: relative;
}

/* Cart button — visible always in header on mobile (sits on the right) */
.cart-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-lt) 50%, var(--gold) 100%);
  background-size: 200% 200%;
  background-position: left center;
  color: var(--on-accent) !important;
  padding: 0 .85rem;
  min-height: var(--touch);
  min-width: var(--touch);
  border-radius: 999px;
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .3px;
  transition: all var(--t);
  border: none;
  box-shadow: 0 2px 10px rgba(200, 168, 78, .3), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.cart-link:hover,
.cart-link:focus-visible {
  background-position: right center;
  outline: none;
}

.cart-icon {
  flex-shrink: 0;
  opacity: .9;
}

.cart-link-count {
  font-variant-numeric: tabular-nums;
}

/* Move cart-link OUT of drawer on mobile: hide it inside, keep it in header */
.main-nav .cart-link {
  display: none;
}

/* En móvil el carrito es el botón flotante, que cae más cerca del pulgar.
   El de la cabecera aparece de 768px para arriba (ver el bloque de escritorio).
   Nunca los dos a la vez: eso fue el fallo que había que arreglar. */
.site-header > .cart-link {
  display: none;
}

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-m);
  padding: 2rem var(--pad-x) calc(2rem + var(--safe-bottom));
  text-align: center;
  font-size: .85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: auto;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--gold);
  margin: 0 .5rem;
}

.site-footer a:hover {
  color: var(--gold-lt);
}

/* Sin tope, en una pantalla muy ancha —o con el zoom muy alejado— el contenido
   se estiraba sin límite y las tarjetas crecían con él. 1600px deja sitio de
   sobra a cinco o seis columnas sin que la línea de texto se vuelva ilegible. */
.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
}

/* ════════ LANDING ════════ */
.landing-page {
  display: flex;
  flex-direction: column;
}

/* ── Hero Carousel ──────────────────────────────────────────────────── */
.hero-section {
  padding: 1rem var(--pad-x);
}

.carousel-container {
  width: 100%;
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-lg);
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .6s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  position: relative;
}

.promo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-slide .promo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26, 22, 16, .9) 0%, rgba(26, 22, 16, .4) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  gap: .5rem;
}

.promo-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: .3rem .65rem;
  border-radius: 4px;
  width: fit-content;
}

.promo-overlay h2 {
  font-family: var(--font-d);
  font-size: clamp(1.4rem, 5.5vw, 1.9rem);
  font-weight: 700;
  color: #f4efe1;
  line-height: 1.15;
}

.promo-overlay p {
  font-size: .88rem;
  color: rgba(255, 255, 255, .85);
  max-width: 480px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-promo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0 1.4rem;
  min-height: var(--touch);
  border-radius: var(--r-sm);
  border: 2px solid var(--accent);
  transition: all var(--t);
  width: fit-content;
}

.btn-promo:hover {
  background: transparent;
  color: var(--accent);
}

.placeholder-slide {
  background: linear-gradient(135deg, var(--bg-alt), var(--bg-dark) 50%, var(--bg-alt));
  display: flex;
  align-items: flex-end;
}

.carousel-trigger {
  display: none;
}

/* Carousel dots — tap target ≥24, visible 10px */
.carousel-dots {
  position: absolute;
  bottom: .5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .25rem;
  z-index: 5;
}

.carousel-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.carousel-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  transition: all var(--t);
}

.carousel-dot.active::before {
  background: var(--gold);
  transform: scale(1.25);
}

/* ── Categories (mobile = scroll-snap horizontal) ───────────────────── */
.categories-section {
  display: flex;
  gap: .85rem;
  padding: .5rem var(--pad-x) 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.categories-section::-webkit-scrollbar {
  display: none;
}

.categories-section h2 {
  display: none; /* hidden in horizontal mode */
}

.category-card {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  flex: 0 0 75%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--bg-alt-2) 0%, var(--bg-alt) 50%, var(--bg-alt-2) 100%);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
  scroll-snap-align: start;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-dk);
}

.category-card .cat-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .2);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}

.category-card:hover .cat-overlay {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
}

.category-card h3 {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 700;
  color: #f4efe1;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 2px solid #fff;
  padding: .4rem 1.2rem;
  border-radius: var(--r-sm);
  text-align: center;
}

/* ── Product grid title ─────────────────────────────────────────────── */
.products-section-title {
  font-family: var(--font-d);
  font-size: 1.3rem;
  color: var(--accent);
  margin: 1rem 0 0;
  padding: 0 var(--pad-x);
}

.empty-state-link {
  display: inline-block;
  margin-top: .65rem;
  color: var(--accent);
  font-weight: 700;
  font-size: .92rem;
}

.empty-state-link:hover {
  color: var(--accent-lt);
  text-decoration: underline;
}

/* ════════ CATALOG ════════ */
.catalog-layout {
  display: flex;
  flex-direction: column;
  padding: .75rem var(--pad-x) 1.5rem;
  gap: 1rem;
  width: 100%;
}

/* Mobile sticky filter bar */
.catalog-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: var(--bg);
  padding: .5rem 0;
  display: flex;
  gap: .5rem;
  align-items: center;
}

.catalog-toolbar .search-bar {
  flex: 1;
  margin: 0;
}

.btn-open-filters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: var(--touch);
  padding: 0 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dk);
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  position: relative;
  transition: all var(--t);
}

.btn-open-filters:hover {
  border-color: var(--accent);
}

.btn-open-filters .filters-count {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  padding: .1rem .45rem;
  min-width: 18px;
  text-align: center;
}

/* Sidebar as drawer in mobile */
.catalog-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(90vw, 360px);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 0;
  z-index: 120;
  transform: translateX(100%);
  transition: transform var(--t);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-drawer);
  overflow: hidden;
}

.catalog-sidebar.is-open {
  transform: translateX(0);
}

.filters-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(.75rem, var(--safe-top)) 1.25rem .75rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filters-drawer-head h3 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: var(--accent);
  margin: 0;
}

.filters-drawer-close,
.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border-radius: var(--r-sm);
  background: var(--bg-alt);
  color: var(--text-2);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
}

.filters-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.filters-drawer-foot {
  padding: .75rem 1.25rem calc(.75rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.filter-group {
  margin-bottom: 1.25rem;
}

.filter-group h4 {
  font-size: .78rem;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: .65rem;
}

.filter-group button {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: .65rem .9rem;
  margin-bottom: .35rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--r-sm);
  font-size: .92rem;
  text-align: left;
  transition: all var(--t);
}

.filter-group button:hover,
.filter-group button.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* Mana symbols — bigger on mobile for tap */
.mana-symbols {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}

.mana {
  width: 44px !important;
  height: 44px;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .95rem;
  border: 1px solid rgba(0, 0, 0, .45);
  box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .35), inset 0 2px 3px rgba(255, 255, 255, .18);
  transition: transform var(--t), outline-color var(--t);
  outline: 2px solid transparent;
  outline-offset: 3px;
  padding: 0;
  margin: 0;
}

.mana:hover {
  transform: scale(1.1);
}

/* La plantilla aplica `.active` desde que existe el filtro, pero esta regla
   nunca se escribió: el color seleccionado no se distinguía de los demás. */
.mana.active {
  outline-color: var(--accent);
  transform: scale(1.06);
}

.mana:focus-visible {
  outline-color: var(--frost);
}

.mana.w {
  background: var(--mana-w);
  color: #3a3520;
}

.mana.u {
  background: var(--mana-u);
  color: #f2f8fc;
}

.mana.b {
  background: var(--mana-b);
  color: #efe9f0;
}

.mana.r {
  background: var(--mana-r);
  color: #fff0ea;
}

.mana.g {
  background: var(--mana-g);
  color: #f0fbf1;
}

.filter-group label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  color: var(--text-2);
  font-size: .9rem;
  cursor: pointer;
}

.filter-group label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
}

/* ── Set combobox ───────────────────────────────────────────────────── */
/* Active selection — rendered as a clear pill with prefix "Set:"
   so the user immediately sees WHAT was selected, even if the
   set name is short (3-letter codes etc.). */
.set-badge {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 10px;
  padding: .5rem .55rem .5rem .8rem;
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: .65rem;
  line-height: 1.2;
  min-height: 40px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 3px rgba(0, 0, 0, .12);
}

.set-badge-prefix {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: .85;
}

.set-badge-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--on-accent);
  font-weight: 700;
  letter-spacing: .2px;
}

.set-badge-remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  transition: background var(--t), transform var(--t);
  padding: 0;
}

.set-badge-remove:hover,
.set-badge-remove:focus-visible {
  background: rgba(255, 255, 255, .42);
  transform: scale(1.05);
  outline: none;
}

.set-combo {
  position: relative;
}

.set-combo-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-m);
  pointer-events: none;
  z-index: 1;
}

.set-combo-input {
  width: 100%;
  padding: .6rem .8rem .6rem 36px;
  min-height: var(--touch);
  border: 1px solid var(--border-dk);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none;
}

.set-combo-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 154, 74, .1);
}

.set-combo-input::placeholder {
  color: var(--text-m);
}

.set-combo-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--border-dk);
  color: var(--text-m);
  transition: background var(--t), color var(--t);
  padding: 0;
}

.set-combo-clear:hover {
  background: var(--accent);
  color: var(--on-accent);
}

/* Inline list (no absolute positioning) — avoids clipping inside scrollable drawer body */
.set-dropdown {
  position: relative;
  margin-top: .4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dk);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.set-dropdown-option {
  display: block;
  width: 100%;
  padding: .8rem 1rem;
  min-height: var(--touch);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: .9rem;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  line-height: 1.3;
}

.set-dropdown-option:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.set-dropdown-option.is-active {
  background: rgba(200, 154, 74, .08);
  color: var(--accent);
  font-weight: 600;
}

.set-dropdown-option + .set-dropdown-option {
  border-top: 1px solid var(--border);
}

.set-dropdown-empty {
  padding: .85rem 1rem;
  font-size: .85rem;
  color: var(--text-m);
  font-style: italic;
  text-align: center;
}

.btn-apply-filters {
  width: 100%;
  min-height: var(--touch);
  padding: .85rem;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: .95rem;
  transition: all var(--t);
}

.btn-apply-filters:hover {
  background: var(--accent-lt);
}

.catalog-content {
  flex: 1;
  min-width: 0;
}

.search-bar {
  margin-bottom: 0;
}

.search-bar input {
  width: 100%;
  padding: .65rem 1rem;
  min-height: var(--touch);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  transition: border-color var(--t);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-bar input::placeholder {
  color: var(--text-m);
}

/* ── Product grid ──────────────────────────────────────────────────── */
/* Columnas calculadas, no contadas.
   Antes eran repeat(2|3|4|5, 1fr) por breakpoint, y eso hacía que al ALEJAR el
   zoom las cartas se hicieran MÁS GRANDES: el viewport gana píxeles CSS, sigues
   en el mismo tramo de media query, y las mismas cinco columnas se reparten más
   ancho. Con auto-fill el número de columnas sigue al espacio disponible y la
   carta mantiene su tamaño con cualquier zoom.
   La medida va en rem para que acompañe al tamaño de letra del navegador. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: .75rem;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: all var(--t);
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--border-dk);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.product-card .card-img-wrap {
  position: relative;
  overflow: hidden;
}

.product-card .product-image {
  width: 100%;
  aspect-ratio: 488 / 680;
  object-fit: cover;
  transition: transform var(--t);
}

.product-card:hover .product-image {
  transform: scale(1.03);
}

.placeholder-image {
  width: 100%;
  aspect-ratio: 488 / 680;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  color: var(--text-m);
  font-size: .85rem;
}

.color-dots {
  position: absolute;
  top: .4rem;
  right: .4rem;
  display: flex;
  gap: 3px;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .5);
  box-shadow: inset 0 -1px 3px rgba(0, 0, 0, .4), inset 0 1px 2px rgba(255, 255, 255, .25);
}

.color-dot.W { background: var(--mana-w); }
.color-dot.U { background: var(--mana-u); }
.color-dot.B { background: var(--mana-b); }
.color-dot.R { background: var(--mana-r); }
.color-dot.G { background: var(--mana-g); }
.color-dot.C { background: var(--mana-c); }

.product-info {
  padding: .65rem .65rem .35rem;
}

.product-info h3 {
  margin: 0 0 .3rem;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  font-size: .72rem;
  color: var(--text-m);
  margin-bottom: .4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}

.product-meta .set-code {
  background: var(--bg-alt);
  padding: .1rem .4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: .65rem;
}

.rarity-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 3px;
  text-transform: capitalize;
}

.rarity-badge.mythic {
  background: linear-gradient(100deg, var(--rar-mythic-1), var(--rar-mythic-2));
  color: #fff5ec;
}
.rarity-badge.rare     { background: var(--rar-rare);     color: #100d08; }
.rarity-badge.uncommon { background: var(--rar-uncommon); color: #0f1316; }
.rarity-badge.common   { background: var(--rar-common);   color: #17171a; }
/* Scryfall también devuelve estas dos y antes salían sin fondo. */
.rarity-badge.special  { background: var(--rar-special);  color: #f6f2ff; }
.rarity-badge.bonus    { background: var(--rar-bonus);    color: #171208; }

.finish-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 600;
  padding: .12rem .4rem;
  border-radius: 3px;
  margin-left: .25rem;
}

.finish-badge.foil {
  background: linear-gradient(100deg, #f2e2a8, #a8d8e8, #e8b8d8);
  color: #111;
  font-family: var(--font-m);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.finish-badge.etched {
  background: linear-gradient(100deg, #cfd6d8, #9aa7ad, #cfd6d8);
  color: #111;
  font-family: var(--font-m);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.finish-badge.nonfoil {
  background: var(--bg-alt);
  color: var(--text-m);
}

.product-footer {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 0 .65rem .65rem;
  margin-top: auto;
}

.product-price {
  font-weight: 800;
  font-size: .95rem;
  color: var(--accent);
}

.product-price.is-empty {
  color: var(--text-m);
}

/* Action row inside product footer */
.product-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  width: 100%;
}

.btn-add {
  padding: 0 .85rem;
  min-height: 38px;
  background: var(--bg-card);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: .78rem;
  font-weight: 700;
  transition: all var(--t);
  flex: 1;
}

.btn-add:hover,
.btn-add:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
  outline: none;
}

.btn-add.is-added {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  cursor: default;
}

.qty-selector {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  flex-shrink: 0;
}

.qty-selector button {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.qty-selector span {
  font-size: .9rem;
  min-width: 22px;
  text-align: center;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-m);
  font-size: 1rem;
}

/* ════════ CART FAB ════════ */
.cart-fab {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  right: calc(1rem + var(--safe-right));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.cart-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-lt) 50%, var(--gold) 100%);
  background-size: 200% 200%;
  background-position: left center;
  color: var(--on-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 18px rgba(200, 168, 78, .4),
    0 1px 0 rgba(255, 255, 255, .2) inset;
  transition: all var(--t);
  position: relative;
}

.cart-fab-btn:hover {
  background-position: right center;
  transform: scale(1.05) translateY(-2px);
}

.cart-fab-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--bg-dark);
  color: var(--gold);
  font-size: .68rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.cart-fab-btn.bounce {
  animation: bounce .4s ease;
}

/* ════════ CHECKOUT ════════ */
.checkout-container {
  padding: 1.25rem var(--pad-x) calc(1.5rem + var(--safe-bottom));
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  min-height: 60vh;
}

.checkout-title {
  font-family: var(--font-d);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}

.checkout-subtitle {
  color: var(--text-m);
  font-size: .92rem;
  margin-bottom: 1.5rem;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.checkout-items-section h2 {
  font-family: var(--font-d);
  font-size: 1.15rem;
  margin-bottom: .85rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.cart-item {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 1rem;
  background: var(--bg-card);
  align-items: stretch;
}

.cart-item img {
  width: 64px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.item-details {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: .25rem;
}

.item-variant {
  font-size: .8rem;
  color: var(--text-m);
  margin-bottom: .4rem;
}

.item-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  padding: .25rem .6rem;
  border-radius: 4px;
  font-weight: 600;
}

.item-status.available {
  background: rgba(95, 158, 99, .1);
  color: var(--ok);
}

.item-qty {
  font-size: .82rem;
  color: var(--text-2);
  margin-top: .4rem;
}

.item-price {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-m);
  font-size: 1.2rem;
  transition: color var(--t);
  cursor: pointer;
  min-width: var(--touch);
  min-height: var(--touch);
}

.btn-remove:hover {
  color: var(--danger);
}

.item-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  min-width: 100px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-m);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: .35rem .25rem;
  min-height: 36px;
  transition: color var(--t);
}

.btn-text:hover {
  color: var(--text);
}

.btn-text.active {
  color: var(--accent);
}

.cart-item.saved {
  opacity: .7;
  background: var(--bg-alt);
}

.cart-item.saved .item-price {
  color: var(--text-m);
}

.clickable-image {
  cursor: zoom-in;
  transition: transform var(--t);
}

.clickable-image:hover {
  transform: scale(1.05);
}

/* Image zoom modal */
.image-zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(5px);
  border: none;
  padding: 0;
  cursor: zoom-out;
}

.image-zoom-content {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.image-zoom-content img {
  max-width: 100%;
  max-height: 85dvh;
  object-fit: contain;
  border-radius: var(--r);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .5);
  animation: zoomIn .3s ease-out forwards;
}

.btn-close-zoom {
  position: fixed;
  top: max(1rem, var(--safe-top));
  right: max(1rem, var(--safe-right));
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .4);
  z-index: 10000;
  transition: transform var(--t), background var(--t);
}

.btn-close-zoom:hover {
  transform: scale(1.08);
  background: var(--accent-lt);
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}

.cart-totals {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.cart-totals .row {
  display: flex;
  justify-content: space-between;
  padding: .3rem 0;
  font-size: .9rem;
  color: var(--text-2);
}

.cart-totals .row.total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

.checkout-form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
}

.checkout-form-section h2 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  margin-bottom: .65rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.checkout-form-section .form-notice {
  color: var(--text-m);
  font-size: .85rem;
  line-height: 1.55;
  margin-bottom: 1.15rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: .35rem;
  font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .7rem .9rem;
  min-height: var(--touch);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  transition: border-color var(--t);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 90px;
  resize: vertical;
}

.btn-submit {
  width: 100%;
  padding: .9rem;
  min-height: 52px;
  background: var(--bg-dark);
  color: var(--text);
  border: none;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.btn-submit:hover:not(:disabled) {
  background: var(--bg-alt);
}

.btn-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.form-disclaimer {
  text-align: center;
  font-size: .75rem;
  color: var(--text-m);
  margin-top: .75rem;
  line-height: 1.5;
}

.success-message {
  text-align: center;
  padding: 3rem 1rem;
}

.success-message h2 {
  font-family: var(--font-d);
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: .5rem;
}

.error-alert {
  background: rgba(200, 69, 47, .08);
  color: var(--danger);
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(200, 69, 47, .2);
}

.profile-restored-notice {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(95, 158, 99, .08);
  color: var(--ok);
  border: 1px solid rgba(95, 158, 99, .2);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  padding: .3rem .8rem;
  margin-bottom: .85rem;
}

/* ── Ticket list ────────────────────────────────────────────────────── */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
}

.ticket-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "qty info actions"
    "img info actions";
  gap: .5rem .75rem;
  align-items: center;
  padding: .85rem 0;
  border-bottom: 1px dashed var(--border);
}

.ticket-row.saved-row {
  opacity: .7;
}

.ticket-qty-controls {
  grid-area: qty;
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.ticket-image-container {
  grid-area: img;
}

.ticket-img {
  width: 48px;
  height: 67px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.ticket-img.placeholder {
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  color: var(--text-m);
}

.ticket-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ticket-name {
  font-weight: 600;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.ticket-variant {
  font-size: .76rem;
  color: var(--text-m);
  margin-top: .1rem;
}

.ticket-status {
  font-size: .72rem;
  color: var(--ok);
  font-weight: 600;
  margin-top: .15rem;
}

.ticket-status-saved {
  font-size: .72rem;
  color: var(--text-m);
  margin-top: .15rem;
}

.qty-number {
  font-weight: 700;
  font-size: .9rem;
  min-width: 1.5rem;
  text-align: center;
  line-height: 1;
  color: var(--text);
}

.btn-qty {
  background: var(--bg-card);
  border: 1.5px solid var(--border-dk);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-2);
  transition: all var(--t);
  padding: 0;
  user-select: none;
}

.btn-qty:hover {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.ticket-actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
  flex-shrink: 0;
}

.ticket-price {
  font-weight: 800;
  font-size: .95rem;
  color: var(--text);
}

.ticket-buttons {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ticket-totals {
  border-top: 2px dashed var(--border-dk);
  padding-top: 1rem;
  margin-top: 1rem;
}

.ticket-totals .row {
  display: flex;
  justify-content: space-between;
  margin-bottom: .5rem;
  font-size: .9rem;
  color: var(--text-2);
}

.ticket-totals .total {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: .5rem;
  margin-top: .5rem;
}

.empty-cart-message {
  color: var(--text-m);
  padding: 1rem 0;
  font-style: italic;
  font-size: .9rem;
}

.saved-title {
  margin-top: 2rem;
  font-size: 1rem;
  color: var(--text-m);
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Receipt / success ──────────────────────────────────────────────── */
.checkout-success-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem 0;
  animation: receiptFadeIn .5s ease-out;
}

.receipt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.receipt-header {
  padding: clamp(1.5rem, 5vw, 2.5rem) clamp(1rem, 4vw, 2rem);
  text-align: center;
  background: linear-gradient(to bottom, var(--bg-alt), transparent);
  border-bottom: 1px dashed var(--border);
}

.receipt-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.receipt-header h2 {
  font-family: var(--font-d);
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  color: var(--accent);
  margin-bottom: .5rem;
}

.receipt-subtitle {
  color: var(--text-m);
  font-size: .9rem;
}

.receipt-body {
  padding: clamp(1.25rem, 4vw, 2rem);
}

.receipt-section {
  margin-bottom: 1.75rem;
}

.receipt-section h3 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-m);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.receipt-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.info-item .label {
  font-size: .73rem;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.info-item .value {
  font-weight: 700;
  color: var(--text);
  font-size: .9rem;
}

.receipt-items {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.receipt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px dashed var(--border);
  gap: .85rem;
}

.receipt-item img,
.placeholder-receipt-img {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-alt);
  flex-shrink: 0;
}

.receipt-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.receipt-item-info .name {
  font-weight: 600;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-item-info .variant {
  font-size: .75rem;
  color: var(--text-m);
}

.receipt-item-info .qty {
  font-size: .75rem;
  color: var(--accent);
  font-weight: 700;
}

.receipt-item .price {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.receipt-total {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.receipt-footer {
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--bg-alt);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.wendigo-notice {
  font-style: italic;
  color: var(--text-m);
  font-size: .9rem;
  line-height: 1.6;
}

.btn-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2rem;
  min-height: 48px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  font-weight: 700;
  transition: all var(--t);
  align-self: center;
}

.btn-return:hover {
  background: var(--accent-lt);
  transform: translateY(-2px);
}

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

/* ── Cart toast (mobile = full-width banner) ─────────────────────────── */
.cart-toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(5.5rem + var(--safe-bottom));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
  z-index: 300;
  transform: translateY(80px) scale(.97);
  opacity: 0;
  transition: all .4s cubic-bezier(.175, .885, .32, 1.275);
  pointer-events: none;
}

.cart-toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cart-toast .toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cart-toast.success .toast-icon {
  background: rgba(95, 158, 99, .1);
  color: var(--ok);
}

.cart-toast .toast-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cart-toast .toast-content strong {
  font-size: .9rem;
  color: var(--text);
  margin-bottom: .15rem;
}

.cart-toast .toast-content p {
  font-size: .8rem;
  color: var(--text-m);
  margin: 0;
}

/* ── NPC Pet Mascot ──────────────────────────────────────────────────── */
.npc-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem var(--pad-x);
  margin-top: 1rem;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  border-top: 1px solid var(--border);
}

.npc-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.npc-speech-bubble {
  position: relative;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.55;
  max-width: min(380px, calc(100vw - 2rem));
  text-align: center;
  padding: 1rem 1.25rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: -30px;
  animation: npcBubbleIn .5s ease-out;
}

.npc-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--bg-card);
  filter: drop-shadow(0 1px 0 var(--border));
}

.npc-speech-bubble p { margin: 0; }
.npc-speech-bubble strong { color: var(--accent); }

.npc-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}

.npc-avatar {
  width: clamp(160px, 50vw, 220px);
  height: clamp(160px, 50vw, 220px);
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .15));
  transition: transform .3s ease;
}

.npc-avatar:hover {
  transform: scale(1.06) rotate(-2deg);
}

.npc-name {
  font-family: var(--font-d);
  font-size: .78rem;
  color: var(--text-m);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.npc-response-panel {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.npc-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.npc-form-card h4 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 1rem;
  text-align: center;
}

.npc-field {
  margin-bottom: .9rem;
}

.npc-field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.npc-field input,
.npc-field textarea {
  width: 100%;
  padding: .75rem .9rem;
  min-height: var(--touch);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}

.npc-field input:focus,
.npc-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 226, 212, .1);
}

.npc-field textarea {
  resize: vertical;
  min-height: 90px;
}

.npc-submit-btn {
  width: 100%;
  padding: .9rem;
  min-height: 50px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: 0 2px 8px rgba(232, 226, 212, .25);
}

.npc-submit-btn:hover:not(:disabled) {
  background: var(--accent-lt);
  transform: translateY(-2px);
}

.npc-submit-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.npc-success-card {
  background: var(--bg-card);
  border: 1px solid rgba(95, 158, 99, .25);
  border-radius: var(--r);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  animation: npcBubbleIn .4s ease-out;
}

.npc-success-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: .6rem;
}

.npc-success-card h4 {
  font-family: var(--font-d);
  font-size: 1.15rem;
  color: var(--ok);
  margin-bottom: .4rem;
}

.npc-success-card p {
  font-size: .9rem;
  color: var(--text-2);
  line-height: 1.5;
}

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

/* ════════ PDP (Product Detail) ════════ */
.pdp-container {
  padding: 1rem var(--pad-x) calc(1.5rem + var(--safe-bottom));
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pdp-header {
  margin-bottom: 1rem;
}

.back-link {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  transition: color var(--t);
}

.back-link:hover {
  color: var(--accent);
}

.pdp-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.mtg-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-image-section {
  display: flex;
  justify-content: center;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-image-large {
  max-width: 100%;
  width: 100%;
  max-height: 60svh;
  object-fit: contain;
  border-radius: 4.75% / 3.5%;
}

.placeholder-image-large {
  width: 100%;
  aspect-ratio: 488 / 680;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  color: var(--text-m);
  border-radius: var(--r);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-details-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-details-section h1.product-title {
  font-family: var(--font-d);
  font-size: clamp(1.6rem, 6vw, 2rem);
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 0;
}

.mtg-stats {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.stat-row {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  font-size: .92rem;
  flex-wrap: wrap;
}

.stat-row strong {
  color: var(--text-2);
  min-width: 90px;
}

.stat-row .set-badge {
  background: var(--bg-alt);
  padding: .2rem .6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--border);
  margin: 0;
}

.oracle-text-box {
  background: var(--bg-card);
  padding: 1.25rem 1.25rem 1.25rem 2.25rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  font-size: .92rem;
  line-height: 1.6;
  color: var(--text);
  position: relative;
}

.oracle-text-box::before {
  content: '“';
  position: absolute;
  top: -5px;
  left: 10px;
  font-family: var(--font-d);
  font-size: 3.5rem;
  color: var(--border-dk);
  opacity: .3;
  line-height: 1;
}

.generic-layout {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  text-align: center;
}

.generic-description {
  color: var(--text-2);
  margin-top: 1rem;
  line-height: 1.5;
}

/* ── Inventory (mobile = cards, desktop = table) ─────────────────────── */
.inventory-section {
  margin-top: .5rem;
}

.inventory-section h2 {
  font-family: var(--font-d);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: .5rem;
}

.inventory-table-container {
  width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* MOBILE: render rows as cards using display:block on table parts */
.inventory-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

.inventory-table thead {
  display: none; /* hidden on mobile */
}

.inventory-table tbody,
.inventory-table tr {
  display: block;
}

.inventory-table tr {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.inventory-table tr:last-child {
  border-bottom: none;
}

.inventory-table td {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .35rem 0;
  border: none;
  color: var(--text);
  gap: 1rem;
}

.inventory-table td::before {
  content: attr(data-label);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-m);
  font-weight: 700;
  flex-shrink: 0;
}

.inventory-table td.inventory-action {
  justify-content: flex-end;
  padding-top: .65rem;
  border-top: 1px dashed var(--border);
  margin-top: .35rem;
}

.inventory-table td.inventory-action::before {
  display: none;
}

.condition-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .3rem .6rem;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-2);
  text-transform: capitalize;
  border: 1px solid rgba(0, 0, 0, .05);
}

.condition-badge.near_mint {
  background: rgba(95, 158, 99, .1);
  color: var(--ok);
  border-color: rgba(95, 158, 99, .2);
}

.condition-badge.lightly_played {
  background: rgba(200, 168, 78, .15);
  color: var(--accent-dk);
  border-color: rgba(200, 168, 78, .3);
}

.condition-badge.moderately_played {
  background: rgba(232, 93, 38, .1);
  color: var(--warn);
  border-color: rgba(232, 93, 38, .2);
}

.condition-badge.heavily_played,
.condition-badge.damaged {
  background: rgba(200, 69, 47, .1);
  color: var(--danger);
  border-color: rgba(200, 69, 47, .2);
}

.inventory-table .price {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.05rem;
}

.inventory-action-group {
  display: flex;
  gap: .6rem;
  align-items: center;
}

.btn-add-cart {
  padding: 0 1.1rem;
  min-height: var(--touch);
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: .9rem;
  transition: all var(--t);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(232, 226, 212, .2);
}

.btn-add-cart:hover {
  background: var(--accent-lt);
  transform: translateY(-1px);
}

.out-of-stock {
  background: var(--bg-card);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-m);
  border-radius: var(--r);
  border: 1px dashed var(--border-dk);
  font-size: .95rem;
}

/* ════════════════════════════════════════════════════════════════════════
   ≥ 640px — tablet portrait / large phone landscape
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .site-header {
    padding: max(.75rem, var(--safe-top)) 1.5rem .75rem;
    justify-content: flex-start;
    gap: 1.25rem;
  }

  /* El buscador se come el hueco sobrante y empuja nav, carrito e interruptor
     a la derecha, juntos. Antes space-between los separaba y el carrito
     quedaba flotando en mitad de la barra. */
  .site-header .header-search {
    margin-right: auto;
  }

  /* De aquí en adelante manda el de la cabecera y el flotante desaparece. */
  .site-header > .cart-link {
    display: inline-flex;
  }

  .cart-fab {
    display: none;
  }

  .site-header .logo {
    text-align: left;
    flex: 0 0 auto;
    font-size: 1.25rem;
  }

  .nav-toggle {
    display: none;
  }

  /* Nav goes inline */
  .main-nav {
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    padding: 0;
    transform: none;
    transition: none;
    z-index: auto;
    box-shadow: none;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    overflow: visible;
  }

  .main-nav a:not(.cart-link) {
    padding: .4rem 0;
    min-height: auto;
    font-size: .85rem;
    color: rgba(255, 255, 255, .8);
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
  }

  .main-nav a:not(.cart-link):hover,
  .main-nav a:not(.cart-link).active {
    background: transparent;
  }

  .nav-catalog-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, var(--gold), var(--gold-lt));
    border-radius: 2px;
    transition: width var(--t);
  }

  .nav-catalog-link:hover::after,
  .nav-catalog-link.active::after {
    width: 100%;
  }

  .nav-backdrop {
    display: none;
  }

  .hero-section {
    padding: 1.5rem 2rem;
  }

  .carousel-container {
    aspect-ratio: 16 / 7;
    max-height: 460px;
    border-radius: var(--r-lg);
  }

  .promo-overlay h2 {
    font-size: 2.2rem;
  }

  .carousel-slide .promo-overlay {
    padding: 2rem;
  }

  /* Categorías vuelven a grid 3 cols */
  .categories-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem 2rem;
    overflow: visible;
  }

  .categories-section h2 {
    display: block;
    grid-column: 1 / -1;
    font-family: var(--font-d);
    font-size: 1.4rem;
    color: var(--text);
  }

  .category-card {
    flex: initial;
    aspect-ratio: 16 / 9;
    scroll-snap-align: none;
  }

  .category-card h3 {
    font-size: 1.1rem;
    letter-spacing: 2px;
    padding: .5rem 1.5rem;
  }

  /* Catalog: keep drawer model (sidebar still slides), grid widens */
  .catalog-layout {
    padding: 1rem 2rem 2rem;
  }

  .products-section-title {
    padding: 0 2rem;
    margin: 1rem 0 0;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1rem;
  }

  .checkout-grid {
    grid-template-columns: 1.1fr 1fr;
  }

  .npc-section {
    flex-direction: row;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
  }

  .npc-stage {
    flex-shrink: 0;
  }

  .npc-avatar {
    width: 240px;
    height: 240px;
  }

  .npc-response-panel {
    margin: 0;
    max-width: none;
    flex: 1;
  }

  /* PDP layout side-by-side */
  .mtg-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }

  .card-image-section {
    flex: 0 0 320px;
    position: sticky;
    top: calc(var(--header-h) + 1rem);
  }

  .card-details-section {
    flex: 1;
  }

  /* Inventory table re-enables real table on ≥640px */
  .inventory-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .inventory-table {
    min-width: 520px;
  }

  .inventory-table thead {
    display: table-header-group;
  }

  .inventory-table tbody {
    display: table-row-group;
  }

  .inventory-table tr {
    display: table-row;
    padding: 0;
    border-bottom: 1px solid var(--border);
  }

  .inventory-table tr:hover td {
    background: rgba(232, 226, 212, .02);
  }

  .inventory-table th {
    background: var(--bg-dark);
    color: var(--text-2);
    text-align: left;
    padding: 1rem;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .inventory-table td {
    display: table-cell;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }

  .inventory-table td::before {
    display: none;
  }

  .inventory-table td.inventory-action {
    border-top: 0;
    margin-top: 0;
    padding-top: 1rem;
    justify-content: initial;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   ≥ 1024px — desktop
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .site-header {
    padding: .9rem 3rem;
  }

  .hero-section {
    padding: 2rem 3rem;
  }

  .carousel-container {
    aspect-ratio: 16 / 6;
    max-height: 480px;
  }

  .carousel-slide .promo-overlay {
    padding: 3rem;
  }

  .promo-overlay h2 {
    font-size: 2.6rem;
  }

  .categories-section {
    padding: 2rem 3rem;
    gap: 1.5rem;
  }

  /* Catalog goes from drawer to fixed sidebar */
  .catalog-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-areas:
      "toolbar  toolbar"
      "sidebar  content";
    column-gap: 1.5rem;
    row-gap: 1rem;
    padding: 1.5rem 3rem 2rem;
  }

  .catalog-toolbar {
    grid-area: toolbar;
    position: static;
    background: transparent;
    padding: 0;
  }

  .btn-open-filters {
    display: none; /* sidebar is visible, no need */
  }

  .catalog-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    right: auto;
    height: auto;
    width: 100%;
    max-height: calc(100dvh - var(--header-h) - 2rem);
    transform: none !important;
    box-shadow: none;
    border-left: none;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--bg-card);
    z-index: auto;
  }

  .catalog-content {
    grid-area: content;
    min-width: 0;
  }

  /* Backdrop is irrelevant when sidebar is sticky */
  .catalog-layout > .nav-backdrop {
    display: none;
  }

  .filters-drawer-close,
  .filters-drawer-foot {
    display: none;
  }

  .filters-drawer-head {
    padding: 1rem 1.25rem .5rem;
    border-bottom: none;
  }

  .filters-drawer-body {
    padding: .5rem 1.25rem 1.25rem;
  }

  .products-section-title {
    padding: 0 3rem;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1.25rem;
  }

  .checkout-container {
    padding: 2.5rem 3rem;
  }

  .npc-section {
    padding: 2rem 3rem;
  }

  .npc-avatar {
    width: 280px;
    height: 280px;
  }

  .npc-speech-bubble {
    max-width: 420px;
    font-size: 1rem;
  }

  .pdp-container {
    padding: 2rem 3rem;
  }

  .card-image-section {
    flex: 0 0 380px;
  }

  .card-details-section h1.product-title {
    font-size: 2.4rem;
  }

  /* Cart toast — desktop floats bottom-right */
  .cart-toast {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    max-width: 340px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, .25);
  }
}

/* ════════════════════════════════════════════════════════════════════════
   ≥ 1280px — wide
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  }
}

/* ─── Comprobante: folio ─────────────────────────────────────────────────── */
.receipt-folio {
  margin-top: .35rem;
  font-family: var(--font);
  font-size: .82rem;
  color: var(--text-2);
  letter-spacing: .04em;
}

.receipt-folio b {
  font-weight: 700;
  color: var(--accent-dk);
}

/* Contenedor de la miniatura de cada línea del comprobante. Se usaba en la
   plantilla y no tenía ninguna regla. */
.receipt-image-container {
  flex: 0 0 auto;
  width: 44px;
  height: 60px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-alt);
}

.receipt-image-container img,
.receipt-image-container .ticket-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* La acción destructiva del carrito ("Eliminar") era indistinguible de
   "Guardar": ambas caían en .btn-text sin más. */
.btn-text.delete {
  color: var(--accent-dk);
}

.btn-text.delete:hover {
  color: var(--danger);
  text-decoration: underline;
}

/* Enlaces de navegación de la cabecera: el marcado los usaba y no existía
   ninguna regla, así que sólo heredaban de `.main-nav a`. */
.nav-home-link,
.nav-cart-link {
  white-space: nowrap;
}

/* Bloque de un set dentro del cajón de filtros. */
.set-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* ─── Página no encontrada ───────────────────────────────────────────────── */
.not-found {
  max-width: 32rem;
  margin: 0 auto;
  padding: 3rem var(--pad-x);
  text-align: center;
}

.not-found h1 {
  font-family: var(--font-d);
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: .5rem;
}

.not-found p {
  color: var(--text-2);
  margin-bottom: 1.5rem;
}

.not-found-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   WENDIGO NOCTURNO — piezas nuevas
   Símbolos de maná, brillo foil, esqueletos y cargador. Clases nuevas sin
   colisión, así que el orden en la cascada no importa.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Símbolos de maná ────────────────────────────────────────────────────── */
.mana-pip {
  width: var(--pip-size, 22px);
  height: var(--pip-size, 22px);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex: none;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, .45);
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, .35),
    inset 0 2px 3px rgba(255, 255, 255, .2);
}

.mana-pip svg { width: 62%; height: 62%; display: block; }

.mana-text {
  font-family: var(--font-m);
  font-size: calc(var(--pip-size, 22px) * .52);
  font-weight: 600;
  line-height: 1;
  color: #2a2620;
}

.mana-w { background: var(--mana-w); color: #3a3520; }
.mana-u { background: var(--mana-u); color: #f2f8fc; }
.mana-b { background: var(--mana-b); color: #efe9f0; }
.mana-r { background: var(--mana-r); color: #fff0ea; }
.mana-g { background: var(--mana-g); color: #f0fbf1; }
.mana-c { background: #cfc9bb; color: #2a2620; }

.mana-cost { display: inline-flex; gap: 3px; align-items: center; }

/* ── Brillo foil ─────────────────────────────────────────────────────────── */
/* La posición del puntero llega en --foil-x/--foil-y desde {{foil-shine}}. */
.is-foil { position: relative; isolation: isolate; }

.is-foil::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
  opacity: calc(var(--foil-on, 0) * .85);
  transition: opacity .25s ease;
  mix-blend-mode: screen;
  background:
    radial-gradient(
      120% 120% at var(--foil-x, 50%) var(--foil-y, 50%),
      rgba(255, 240, 200, .45) 0%,
      rgba(140, 220, 255, .35) 28%,
      rgba(255, 170, 220, .30) 46%,
      transparent 68%
    );
}

/* Etched brilla en plata en vez de en arcoíris. */
.is-foil-etched::after {
  background:
    radial-gradient(
      120% 120% at var(--foil-x, 50%) var(--foil-y, 50%),
      rgba(240, 246, 248, .45) 0%,
      rgba(170, 186, 194, .32) 34%,
      transparent 66%
    );
}

/* Sin puntero (táctil o teclado) el brillo late despacio para que se note. */
@media (hover: none) {
  .is-foil::after {
    opacity: .5;
    animation: foil-drift 6s ease-in-out infinite;
  }
}

@keyframes foil-drift {
  0%, 100% { --foil-x: 22%; --foil-y: 26%; }
  50%      { --foil-x: 78%; --foil-y: 74%; }
}

/* ── Esqueletos de carga ─────────────────────────────────────────────────── */
.card-skeleton {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.card-skeleton-art {
  aspect-ratio: 63 / 47;
  background: var(--bg-alt);
  position: relative;
  overflow: hidden;
}

.card-skeleton-art::after,
.card-skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(232, 226, 212, .07) 50%,
    transparent 80%
  );
  animation: skeleton-sweep 1.6s ease-in-out infinite;
}

.card-skeleton-body {
  padding: .7rem .75rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.card-skeleton-line {
  height: 9px;
  border-radius: 3px;
  background: var(--bg-alt);
  position: relative;
  overflow: hidden;
  display: block;
}

@keyframes skeleton-sweep { to { transform: translateX(100%); } }

/* ── Cargador: el reverso de la carta girando ────────────────────────────── */
.wendigo-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  padding: 2.5rem 1rem;
}

.wendigo-loader-card {
  width: 52px;
  height: 73px;
  perspective: 600px;
}

.wendigo-loader-card svg {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: card-flip 2.4s cubic-bezier(.5, 0, .5, 1) infinite;
}

@keyframes card-flip {
  0%, 12%  { transform: rotateY(0deg); }
  50%, 62% { transform: rotateY(180deg); }
  100%     { transform: rotateY(360deg); }
}

.wendigo-loader-label {
  font-family: var(--font-m);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-m);
}

/* ── Existencias, con color semántico separado del acento ────────────────── */
.stock-line {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-m);
  font-size: .68rem;
  color: var(--text-2);
}

.stock-line::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.stock-line.is-ok  { color: var(--ok); }
.stock-line.is-low { color: var(--warn); }
.stock-line.is-out { color: var(--muted-out); }

/* ── Texto ambiental de la carta ─────────────────────────────────────────── */
.flavor-text {
  font-family: var(--font-f);
  font-style: italic;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Foco visible en todo lo interactivo ─────────────────────────────────── */
/* Antes diez elementos anulaban el contorno y sólo cuatro lo sustituían. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--frost);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  .card-skeleton-art::after,
  .card-skeleton-line::after,
  .wendigo-loader-card svg,
  .is-foil::after { animation: none !important; }
  .is-foil::after { opacity: .28; }
}

/* La etiqueta de foil se ancla a la ilustración de la tarjeta. */
.card-foil-tag {
  position: absolute;
  left: .5rem;
  bottom: .5rem;
  margin-left: 0;
  z-index: 3;
}

.product-card .product-meta { align-items: center; gap: .4rem; flex-wrap: wrap; }
.product-card .stock-line { margin-top: .35rem; }
.product-card.has-foil { border-color: rgba(200, 154, 74, .38); }

/* La línea de existencias parte "Casi nueva" cuando la tarjeta es estrecha. */
.product-card .stock-line {
  font-size: .66rem;
  line-height: 1.35;
  align-items: flex-start;
}

.product-card .stock-line::before { margin-top: .3rem; }

/* Los botones de rareza del filtro llevan el color real del juego. */
.filter-group button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
  margin-right: .5rem;
  background: currentColor;
  opacity: .55;
}

.filter-group button { display: flex; align-items: center; }

/* ── Ficha de carta ──────────────────────────────────────────────────────── */
.card-image-frame { position: relative; border-radius: var(--r); overflow: hidden; display: block; }
.card-image-frame img { display: block; width: 100%; height: auto; }

.card-image-foil {
  display: block;
  margin: .6rem auto 0;
  width: fit-content;
  font-size: .6rem;
}

.mtg-stats .stat-row { display: flex; align-items: center; gap: .6rem; }

.legalities { margin-top: 1.1rem; }

.legalities h4 {
  font-family: var(--font-m);
  font-size: .62rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-m);
  margin: 0 0 .55rem;
}

.legality-list { display: flex; flex-wrap: wrap; gap: .4rem; }

.legality {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .74rem;
  padding: .25rem .55rem;
  border-radius: var(--r-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.legality::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--ok);
}

.legality.is-banned { color: var(--text-m); }
.legality.is-banned::before { background: var(--muted-out); }

.finish-plain { font-size: .78rem; color: var(--text-m); }

/* Hueco del hero mientras cargan las promociones. */
.hero-skeleton {
  aspect-ratio: 4 / 3;
  margin: 0 var(--pad-x) 1.5rem;
  border-radius: var(--r-lg);
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
}

.hero-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 20%, rgba(232, 226, 212, .06) 50%, transparent 80%);
  animation: skeleton-sweep 1.8s ease-in-out infinite;
}

@media (min-width: 640px) { .hero-skeleton { aspect-ratio: 16 / 7; max-height: 460px; } }
@media (min-width: 1024px) { .hero-skeleton { aspect-ratio: 16 / 6; } }
@media (prefers-reduced-motion: reduce) { .hero-skeleton::after { animation: none; } }

/* ── Hero: la búsqueda manda ─────────────────────────────────────────────── */


.hero-mana .mana-symbols { display: flex; gap: .5rem; }
.hero-mana .mana { background: none; border: 0; box-shadow: none; padding: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 640px) { }

.card-skeleton-line.is-w78 { width: 78%; }
.card-skeleton-line.is-w46 { width: 46%; }
.card-skeleton-line.is-w60 { width: 60%; }

.mana-pip.is-16 { --pip-size: 16px; }
.mana-pip.is-18 { --pip-size: 18px; }
.mana-pip.is-20 { --pip-size: 20px; }
.mana-pip.is-22 { --pip-size: 22px; }
.mana-pip.is-26 { --pip-size: 26px; }
.mana-pip.is-34 { --pip-size: 34px; }

/* ── Buscador de la cabecera ─────────────────────────────────────────────
   Sustituye al hero que ocupaba la primera pantalla entera y empujaba el
   carrusel fuera de vista. Vive en el cromo oscuro, así que hereda sus tokens.

   En móvil se oculta: el catálogo tiene su propio buscador y aquí compite con
   el logo y el carrito por un ancho que no hay. */
.header-search {
  display: none;
  position: relative;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 26rem;
}

.header-search-icon {
  position: absolute;
  left: .7rem;
  color: var(--text-2);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 2.25rem;
  padding: 0 .7rem 0 2.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-dk);
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  font-family: var(--font);
  font-size: .86rem;
}

.header-search input::placeholder {
  color: var(--text-m);
}

.header-search input:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, .38);
}

/* La búsqueda nativa pinta una X que no encaja con el resto. */
.header-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 768px) {
  .header-search {
    display: flex;
  }
}

/* Imagen de fondo de la tarjeta de categoría. El degradado del contenedor
   sigue siendo el respaldo para las que no tengan imagen. */
.cat-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* El nombre va encima de la foto, así que necesita un velo detrás o se pierde
   sobre las zonas claras del arte. */
.category-card:has(.cat-image) .cat-overlay {
  position: relative;
  z-index: 1;
  background: linear-gradient(0deg, rgba(0, 0, 0, .72), rgba(0, 0, 0, .28));
  border-radius: inherit;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
