/* ============================================================
   MEMETIC — visual design
   Aesthetic: modern TCG. Space Grotesk drives the UI/HUD,
   Bowlby One handles display/stat numbers (cards). Calm
   midnight palette with azure (player) / crimson (AI) accents.
   Layout: single-viewport, no scroll. The battlefield uses a
   CSS grid sized to the available height; the only scrollable
   surface is the battle log inside the sidebar.
   ============================================================ */

:root {
  /* Backdrop — deep midnight blue, no neon-arcade pink */
  --bg-0: #08101f;
  --bg-1: #0f1a30;
  --bg-2: #18253f;
  --surface-0: rgba(255, 255, 255, 0.04);
  --surface-1: rgba(255, 255, 255, 0.07);
  --surface-2: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  /* Player vs AI accents — azure vs crimson, easier on the eyes than neon cyan/pink */
  --player: #3b82f6;
  --player-bright: #60a5fa;
  --player-soft: rgba(59, 130, 246, 0.18);
  --ai: #ef4444;
  --ai-bright: #f87171;
  --ai-soft: rgba(239, 68, 68, 0.18);
  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  /* EL DORSO DE CARTA. Uno solo para todo el juego: la mano del rival, el mazo, el
     reverso del volteo, el sobre y el robo. Su gemelo en JS es `CARD_BACK_SRC`. */
  /* BOTON DE ACCION DE UN MODAL. Dos numeros para todos: el aire que deja a CADA lado
     (ademas del relleno del modal, para que no llegue a los bordes) y su altura.
     Estaban a ojo en cada sitio: 35 px de alto y pegado al borde en el modal de
     carta, 44 y a 33 px en el de compra. */
  --modal-btn-inset: clamp(14px, 3.2vw, 44px);
  --modal-btn-h: 44px;
  --card-back: url('../card_templates/card_images/card_back_01.png');
  --gold: #f5c14a;
  --gold-bright: #fde68a;
  --energy: #fbbf24;
  /* Embossed gold button relief — shared by the wallet, action and HUD icon
     buttons so they stay identical. Face = top-lit gradient; edge = deep amber.
     relief = raised (top highlight + bottom inner shadow + drop shadow);
     hover = lifted + gold glow + brighter highlight; press = pushed IN (inverted
     bevel: inner shadow on top, faint highlight at the bottom). */
  --gold-edge: #b8821e;
  --gold-face: linear-gradient(180deg, #ffe8a3 0%, var(--gold-bright) 48%, var(--gold) 100%);
  --gold-relief:
    0 3px 5px rgba(0,0,0,0.35),
    inset 0 2px 1px rgba(255,255,255,0.65),
    inset 0 -3px 5px rgba(150,96,16,0.5);
  --gold-relief-hover:
    0 6px 13px rgba(0,0,0,0.4),
    0 0 14px rgba(245,193,74,0.5),
    inset 0 2px 1px rgba(255,255,255,0.85),
    inset 0 -3px 5px rgba(150,96,16,0.5);
  --gold-relief-press:
    0 1px 2px rgba(0,0,0,0.3),
    inset 0 3px 6px rgba(120,74,8,0.6),
    inset 0 -1px 0 rgba(255,255,255,0.3);
  /* GEMS — el azul de la casa, UNA sola vez. Sale del banner GET GEMS de la cabecera, que
     es la pieza de gems mas grande de la tienda; los tramos de recarga y los botones que
     GASTAN gemas lo reusan para que las tres cosas se lean como la misma moneda. El relieve
     no se declara aqui: es el del kit (--gv-*), el mismo que llevan las demas chapas. */
  --gem-face: linear-gradient(180deg, #2a5da8 0%, #16386e 52%, #0f2751 100%);
  --gem-face-hover: linear-gradient(180deg, #3a71c4 0%, #1c4585 52%, #133165 100%);
  --gem-glow: rgba(79, 162, 255, 0.45);
  --gem-text: #dbeeff;
  /* Text */
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  /* Card type accents (used in pills/log) */
  --hero: #f5c14a;
  --spell: #60a5fa;
  --trap: #4ade80;
  /* Legacy aliases kept so existing rules don't break while we migrate */
  --neon-cyan: var(--player-bright);
  --neon-pink: var(--ai-bright);
  --neon-green: var(--success);
  --neon-yellow: var(--energy);
  --neon-red: var(--danger);
  --neon-purple: #a78bfa;
  /* Typography */
  --font-display: 'Bowlby One', 'Space Grotesk', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  /* Motion — strong custom curves (the built-in CSS easings are too weak). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Unified width for every centre card reveal (summon / draw / spell / trap) —
     an intermediate between the old spell/trap and hero/draw sizes. */
  --reveal-w: clamp(188px, 44vw, 264px);
  /* Consistent HUD counter typography (energy / deck / graveyard counts share
     one "big number" size; their labels share one small size). */
  --hud-num: 17px;
  --hud-label: 10px;
  /* Safe-area insets (notches / home indicators) default to 0 off-device. */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* Standard UI icon size — matches the navbar icons; the minimum for any
     coin/pack/HUD icon. Scales down on smaller screens like the navbar does. */
  --icon-min: 50px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 100%, rgba(37, 99, 235, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 60%, #04060d 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}
/* Soft inner vignette gives the play surface a deep, contained feel without
   the CRT/scanline shtick. */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; height: 100vh; height: 100dvh; }

/* ── Sin selección de texto ni arrastre nativo de imágenes en TODA la UI ──────
   El juego se pilota con Pointer Events: un doble clic dejaba marcado en azul el
   texto de cartas/HUD/botones, y cualquier <img> se podía arrancar como "ghost"
   de un drag HTML5 nativo en mitad de un arrastre de carta. Se corta una sola vez
   aquí en lugar de repartir user-select:none / draggable="false" por elemento.
   Los campos de texto (nombre de perfil, buscador, nombre de mazo, login) conservan
   su selección; `.selectable` es la vía de escape si algún día hay que copiar algo.
   `-webkit-user-drag` no existe en Firefox → el preventDefault de 'dragstart' en
   index.html cubre el resto de navegadores. */
body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;   /* sin menú "guardar imagen" al mantener pulsado */
}
input, textarea, select, [contenteditable], .selectable {
  -webkit-user-select: text; user-select: text;
}
img, a { -webkit-user-drag: none; }

/* Damage-preview HP (shown on a targeted hero while aiming an attack or a damaging
   spell) — gently grows/shrinks the digits so it reads as a temporary what-if value. */
.tpl-stat-preview { display: inline-block; animation: hpPreviewPulse 0.7s var(--ease-in-out) infinite; }
@keyframes hpPreviewPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }

/* ── Scrollbars — themed to match the gold-on-midnight UI (no default chrome). ── */
* { scrollbar-width: thin; scrollbar-color: var(--gold) rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(8, 11, 20, 0.45); border-radius: 999px; }
::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold), #b9881c);
  border: 2px solid rgba(8, 11, 20, 0.55);
  background-clip: padding-box;
}
@media (hover: hover) and (pointer: fine) { ::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); background-clip: padding-box; } }
::-webkit-scrollbar-corner { background: transparent; }

/* ============== AMBIENT BACKGROUND FX ============== */
/* Sits behind the (translucent) menu screens. Decorative + pointer-transparent. */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }

/* Slow 2-tone blue loop — keeps the dark essence while adding gentle life. */
.bg-fx-base {
  position: absolute; inset: -25%;
  background:
    radial-gradient(42% 38% at 28% 22%, rgba(59, 130, 246, 0.22), transparent 62%),
    radial-gradient(46% 40% at 76% 78%, rgba(96, 165, 250, 0.16), transparent 64%);
  animation: bgBaseLoop 26s var(--ease-in-out) infinite alternate;
  will-change: transform;
}
@keyframes bgBaseLoop {
  from { transform: translate3d(-2%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.09); }
}

/* Diagonal grid of the game's swirl, tinted light blue, drifting slowly.
   The PNG is alpha-masked (dark spiral -> opaque) so the gradient fill tints it. */
/* Pattern + stars share this layer. Static diagonal orientation (no spinning)
   plus a slow diagonal pan loop. The translate delta is a whole number of mask
   tiles (120px) so the swirl grid loops seamlessly; the stars ride along with
   the exact same motion. */
/* Sized from the rotation, not from a flat `inset:-30%`: a rect rotated by A
   only still covers the viewport if it measures at least
   (W*cosA + H*sinA) x (W*sinA + H*cosA). At 18deg a 160%x160% box falls short on
   panoramic screens (21:9 needs ~169% of the height, 32:9 ~205%), which is where
   the pattern showed a hard diagonal cut in the corners. cos18=.9511, sin18=.3090;
   the +260px slack absorbs the +-60px drift. Centred, so the slack is symmetric. */
.bg-fx-grid {
  position: absolute; top: 50%; left: 50%;
  width:  calc(95.11vw + 30.90vh + 260px);
  height: calc(30.90vw + 95.11vh + 260px);
  transform: translate(-50%, -50%) rotate(18deg) translate(60px, 60px);
  animation: bgGridDrift 150s linear infinite;
  will-change: transform;
}
@keyframes bgGridDrift {
  from { transform: translate(-50%, -50%) rotate(18deg) translate(60px, 60px); }
  to   { transform: translate(-50%, -50%) rotate(18deg) translate(-60px, -60px); }
}
.bg-fx-pattern {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #eaf4ff, #bcdcf8); /* lighter blue tint */
  /* The light-blue gradient is alpha-masked by a tileable spiral so it reads as a
     drifting grid of swirls. `swirl-mask-soft.png` is `swirl-mask.png` (kept, sharp)
     with its alpha feathered (gaussian sigma 3 on the 256px tile, wrapped so it still
     tiles) — the hard-edged one stamped the spirals onto the background instead of
     letting them breathe. A CSS `filter: blur()` can NOT do this: filters run before
     masking, so the mask edge stays hard however much you blur the fill. */
  -webkit-mask-image: url("../icons/swirl-mask-soft.png"); mask-image: url("../icons/swirl-mask-soft.png");
  -webkit-mask-size: 120px 120px; mask-size: 120px 120px;
  -webkit-mask-repeat: repeat; mask-repeat: repeat;
  opacity: 0.05;   /* whisper-soft: the grid should be felt, not read */
}

/* ============== APP SHELL / NAVIGATION ============== */
/* Left sidebar on desktop; flips to a bottom bar on tablet/phone (media query
   further down). The nav is DOM order HOME→SETTINGS so it reads top→bottom on
   the sidebar and left→right on the bottom bar. */
.app-shell {
  display: flex;
  height: 100vh; height: 100dvh;
  overflow: hidden;
}
.app-nav {
  flex: 0 0 auto;
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 10px;
  padding-top: max(16px, var(--safe-t));
  /* Opaque base (dark) under the subtle sheen so the background grid never
     shows through the navbar. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    linear-gradient(180deg, #0f1a30, #0a1322);
  border-right: 1px solid var(--border-soft);
  z-index: 5;
}
/* La version, pequena y apagada al pie de la barra lateral. En la barra inferior (tablet/movil)
   no hay sitio: se oculta (ver la media query de 1024px). */
.nav-version {
  margin-top: auto; padding-top: 10px; text-align: center;
  font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); opacity: 0.8; user-select: none; pointer-events: none;
}
.app-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.app-content > * { flex: 1 1 auto; min-height: 0; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 12px 6px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background .18s var(--ease-out), border-color .18s var(--ease-out),
              color .18s var(--ease-out), transform .12s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) { .nav-item:hover { color: var(--text); } }
@media (hover: hover) and (pointer: fine) { .nav-item:not(.active):hover .nav-icon { transform: scale(1.07); } }
.nav-item:active { transform: scale(0.95); }
/* Selected tab: no box / outer rectangle — just a bigger, glowing icon. */
.nav-item.active { color: var(--text); }
/* Wrapper carries the click pop (composes with the icon's own scale). */
.nav-icon-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; will-change: transform; }
.nav-icon-wrap.pop { animation: navPop 0.42s var(--ease-out); }
/* Fluid bounce in place — dip, overshoot, settle. transform-origin stays center
   so the icon never leaves its spot. */
@keyframes navPop {
  0%   { transform: scale(1); }
  28%  { transform: scale(0.86); }
  58%  { transform: scale(1.14); }
  80%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.nav-icon {
  width: 74px; height: 74px;
  object-fit: contain;
  /* Scale from the center so the selected icon grows in place (same position). */
  transform-origin: center center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
  transition: filter .18s var(--ease-out), transform .2s var(--ease-out);
}
/* The selected tab's icon is clearly larger than the rest, with a soft light-blue glow. */
.nav-item.active .nav-icon {
  transform: scale(1.35);
  filter: drop-shadow(0 0 7px rgba(147,197,253,0.4)) drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* StartScreen and the in-duel game-shell live inside the menu shell now — fill
   the content area instead of forcing full viewport height (which would slip
   under / behind the nav). */
.app-content .start-screen { height: 100%; padding-top: clamp(18px, 4.4vh, 40px); padding-bottom: clamp(18px, 4.4vh, 40px); }
.app-content .game-shell { height: 100%; }

/* Empty-state for tabs we haven't built yet. */
.tab-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.tab-placeholder-icon {
  width: 84px; height: 84px;
  object-fit: contain;
  opacity: 0.9;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.55));
}
.tab-placeholder h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 44px);
  margin: 0;
  letter-spacing: 0.04em;
  color: var(--text);
}
.tab-placeholder p {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* ============== SETTINGS ============== */
.settings-screen {
  height: 100%;
  overflow-y: auto;
  padding: 22px clamp(14px, 3vw, 34px) 40px;
  padding-top: max(22px, var(--safe-t));
}
.settings-panel {
  max-width: 640px;
  margin: 0 auto;
}
.settings-group { display: flex; flex-direction: column; gap: 10px; }
.settings-group-title {
  font-family: var(--font-ui); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; color: var(--text-muted); text-transform: uppercase;
  margin-bottom: 2px;
}
.setting-row {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; color: var(--text);
  transition: background .15s, border-color .15s;
  font: inherit; appearance: none; width: 100%;
}
@media (hover: hover) and (pointer: fine) { .setting-row:hover { background: var(--surface-1); border-color: var(--border-strong); } }
/* La marca de la fila (AJUSTES > CUENTA: Google, Discord, wallet). Va ANTES del texto y no
   encoge: la fila ya reparte el hueco con `flex` y el dibujo tiene que medir siempre igual, o
   la columna de iconos deja de leerse como columna. */
.setting-ico { flex: 0 0 auto; width: 22px; height: 22px; object-fit: contain; }
.setting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.setting-label { font-family: var(--font-ui); font-weight: 700; font-size: 15px; }
/* Fila de CAMPO DE DUELO: la MINIATURA del tablero elegido y, debajo, un desplegable con
   el resto.
   El menú FLOTA (posición absoluta): abrirlo no debe estirar la fila ni empujar los
   ajustes de abajo. Los otros desplegables de la app (.filter-dd / .cl-dd) van en flujo
   porque viven dentro de hojas con `overflow`; éste no — su único antepasado con
   overflow es `.settings-screen`, que SCROLLEA, así que un menú absoluto ni se recorta ni
   se pierde: como mucho alarga el carril.
   OJO con el nombre: `.field-row` ya existe (la fila de slots del tablero), de ahi `board-`. */
.board-row { cursor: default; }
.board-dd { position: relative; flex: 0 0 auto; width: 200px; max-width: 55%; display: flex; flex-direction: column; gap: 8px; }
.board-thumb {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px;
  background: var(--surface-1) center / cover no-repeat;
  /* Contorno de tinta, como el resto de piezas del kit (antes iba con 1px del borde
     genérico y desentonaba justo al lado de una `.setting-row` de 3px). */
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}
/* PREVISUALIZACIÓN DEL CAMPO: la miniatura con sus TRASTOS encima (ver FieldPreview en
   game.js). Necesita ser el contenedor de las tres capas de elementos, recortarlas a sus
   esquinas redondeadas y, sobre todo, pintar el cuadro al MISMO tamaño que el duelo:
   allí no es `cover`, es lo que publica `bgGeoOf` — con `cover` los trastos caerían
   desplazados. `--bg-size` lo publica el componente al medirse. */
.board-preview {
  position: relative;
  overflow: hidden;
  /* CENTRADO y sin repetir, que es lo que da por hecho la geometría: `bgGeoIn` devuelve
     `ox = (w - rw) / 2`, o sea el mismo encuadre que `background-position: center`. Sin
     esto el dibujo se pintaba desde la ESQUINA (y además en mosaico), así que los trastos
     —que sí van centrados— caían desplazados justo esos `ox`/`oy` px… y el desfase CAMBIA
     al redimensionar, que es por lo que la escena entera se movía con la ventana. */
  background-position: center;
  background-repeat: no-repeat;
  background-size: var(--bg-size, cover);
}
/* QUIETA: es una foto, no una partida. Los elementos traen sus animaciones de fábrica
   (la antorcha crepita, el conejo salta), así que se apagan en todo lo que cuelgue. */
.board-preview.is-still,
.board-preview.is-still *,
.board-preview.is-still *::before,
.board-preview.is-still *::after { animation: none !important; transition: none !important; }
.board-dd-head {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text);
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  transition: transform .1s var(--ease-out), background .15s, border-color .15s, color .15s;
}
@media (hover: hover) and (pointer: fine) { .board-dd-head:hover { border-color: var(--border-strong); } }
.board-dd-head:active { transform: scale(0.99); }
.board-row.open .board-dd-head { border-color: var(--player); color: var(--player-bright); }
.board-dd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-dd-caret {
  flex: none; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid currentColor; opacity: .75;
  transition: transform .2s var(--ease-out);
}
.board-row.open .board-dd-caret { transform: rotate(180deg); }
.board-dd-menu {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 4px; padding: 7px;
  /* OPACO. Flotando sobre las filas de abajo, la superficie translúcida de serie
     (`--surface-0` es un 4% de blanco) las dejaba ver a través. */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), var(--bg-2);
  border-radius: 14px;
  max-height: 264px; overflow-y: auto;
  animation: filterDdOpen 140ms var(--ease-out);
}
.board-dd-opt {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  background: none; border: none; color: var(--text-dim);
  padding: 6px 8px 6px 6px; border-radius: 9px; cursor: pointer;
  transition: background .12s, color .12s;
}
@media (hover: hover) and (pointer: fine) { .board-dd-opt:hover { background: var(--surface-1); color: var(--text); } }
.board-dd-opt.on { background: var(--player-soft); color: var(--player-bright); }
.board-dd-opt .board-thumb { flex: none; width: 72px; border-radius: 8px; border-width: 2px; box-shadow: none; }
/* En la LISTA el nombre puede partirse: la cabecera es una línea con puntos suspensivos
   porque ahí no hay alternativa, pero en el menú un "Bitcoin Forest" recortado a
   "Bitcoin…" no deja elegir. En un móvil de 430 px la chapa mide 173 y el nombre no cabe
   de una tirada, así que ahí además encoge la miniatura. */
.board-dd-opt .board-dd-name { white-space: normal; overflow: visible; line-height: 1.25; }
@media (max-width: 620px) {
  .board-dd-opt .board-thumb { width: 54px; }
}
/* El desplegable del CLIMA reusa el del campo, pero va sin miniatura: sin ella el sangrado
   izquierdo de más (el hueco donde iría) deja las opciones descentradas. */
.weather-row .board-dd-opt { padding: 8px 10px; }
.setting-desc { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); }
/* ON/OFF toggle drawn in CSS, in the cartoon language of the rest of the UI: ink outline,
   sunken track, gold fill when on (same gold as the active tab / segmented option) and a
   cream knob with its light and shadow bands. Everything scales from `--tg-h`. */
.setting-toggle {
  --tg-h: 30px;
  --tg-bw: var(--gv-bw, 3px);
  --tg-gap: 3px;                                    /* track showing all round the knob */
  --tg-knob: calc(var(--tg-h) - 2 * var(--tg-bw) - 2 * var(--tg-gap));
  flex: 0 0 auto; position: relative; box-sizing: border-box;
  width: calc(var(--tg-h) * 1.94); height: var(--tg-h);
  border: var(--tg-bw) solid var(--gv-ink, #070f1d); border-radius: 999px;
  /* No inset shadow band on top: it painted the gap above the knob black, so the knob
     looked glued to the outline. */
  background: #16264a;
  overflow: hidden;
  transition: transform .12s var(--ease-out);
}
/* The gold fill is its own layer so it can FADE: a gradient background does not transition. */
.setting-toggle::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, var(--gold-bright, #fde68a), var(--gold, #f5c14a));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 0 rgba(140, 84, 0, 0.35);
  opacity: 0;
  transition: opacity .18s ease;
}
.setting-toggle-knob {
  position: absolute; top: var(--tg-gap); left: var(--tg-gap);
  width: var(--tg-knob); height: var(--tg-knob); border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #d5dbe8);
  /* No ink ring of its own: the knob floats clear of the track's outline. */
  box-shadow:
    0 1px 2px rgba(7, 15, 29, 0.45),
    /* A rim of EQUAL width all round. A bottom-only shadow band read as the ball touching the
       outline on top and floating clear of it underneath. */
    inset 0 0 0 2px rgba(20, 30, 60, 0.24);
  transition: transform .22s var(--ease-out);
}
.setting-row.on .setting-toggle::before { opacity: 1; }
.setting-row.on .setting-toggle-knob {
  transform: translateX(calc(var(--tg-h) * 1.94 - 2 * var(--tg-bw) - 2 * var(--tg-gap) - var(--tg-knob)));
}
.setting-row:active .setting-toggle { transform: scale(0.94); }
@media (prefers-reduced-motion: reduce) {
  .setting-toggle, .setting-toggle::before, .setting-toggle-knob { transition: none; }
}

/* Fila de ELECCION entre opciones con nombre (ChoiceRow): a la derecha, un segmentado.
   `cursor: default` en la fila como en `.volume-row`: aqui lo que se pulsa son los botones
   de dentro, no la fila entera — un `:hover` que invite a pulsar el hueco enganaria. */
.choice-row { cursor: default; }
.setting-seg {
  /* Same build as `.setting-toggle` next to it: ink outline, navy track, 3px of track
     showing round the active pill. */
  flex: 0 0 auto; display: inline-flex; gap: 3px; padding: 3px;
  background: #16264a;
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); border-radius: 999px;
}
.setting-seg-opt {
  font: inherit; font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  letter-spacing: 0.02em; color: var(--text-dim);
  background: transparent; border: 0; border-radius: 999px;
  padding: 6px 16px; cursor: pointer; appearance: none;
  text-transform: uppercase;
  transition: background .15s, color .15s, transform .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .setting-seg-opt:hover { color: var(--text); } }
/* La opcion ACTIVA se lee por el oro del tema, que es como se marca lo seleccionado en el
   resto de la UI (pestanas, filtros del constructor). */
.setting-seg-opt.on {
  color: #1b1408;
  background: linear-gradient(180deg, var(--gold-bright, #f6d67a), var(--gold, #d9a53a));
  box-shadow:
    inset 0 2px 0 var(--gv-hi-gold, rgba(255, 255, 255, 0.42)),
    inset 0 -3px 0 var(--gv-sh-gold, rgba(84, 47, 0, 0.4));
}
@media (hover: hover) and (pointer: fine) { .setting-seg-opt.on:hover { color: #1b1408; } }
.setting-seg-opt:active { transform: scale(0.95); }
.setting-seg-opt:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

/* ---- Volume controls (AUDIO group): icon · label · slider · value ---- */
.volume-row { cursor: default; }
.volume-row .setting-text { flex: 0 1 auto; }
.volume-icon { flex: 0 0 auto; width: 26px; height: 26px; object-fit: contain; opacity: 0.95; }
.volume-value {
  flex: 0 0 auto; min-width: 20px; text-align: center;
  font-family: var(--font-ui); font-weight: 800; font-size: 14px;
  color: var(--gold-bright); font-variant-numeric: tabular-nums;
}
.volume-slider {
  flex: 1 1 120px; min-width: 80px; max-width: 300px; margin: 0;
  -webkit-appearance: none; appearance: none;
  height: 8px; border-radius: 999px; background: transparent; cursor: pointer;
}
/* WebKit: paint the filled portion gold up to --pct, the rest a faint surface. */
.volume-slider::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg,
    var(--gold) 0%, var(--gold-bright) var(--pct, 50%),
    rgba(255, 255, 255, 0.12) var(--pct, 50%), rgba(255, 255, 255, 0.12) 100%);
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform .12s var(--ease-out);
}
.volume-slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.volume-slider:focus-visible { outline: none; }
.volume-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(245, 193, 74, 0.35); }
/* Firefox track / progress / thumb. */
.volume-slider::-moz-range-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.volume-slider::-moz-range-progress { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }
.volume-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gold); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ---- Settings TABS (ACCOUNT · AUDIO · GAME SETTINGS) ----
   Reuses the MISSIONS segmented control (.mission-tabs / .mission-tab); this only
   sets it apart from the panel title and lets it wrap on a narrow phone. */
/* (0,2,0) a proposito: `.mission-tabs` vive ~9000 lineas mas abajo y su `margin: 4px 0 6px`
   gana por POSICION a cualquier regla de misma especificidad escrita aqui arriba. */
.settings-screen .settings-tabs { display: flex; flex-wrap: wrap; margin: 4px 0 clamp(22px, 3.2vh, 34px); }
.settings-screen .settings-tabs .mission-tab { padding: 9px 16px; font-size: 12px; }

/* ---- ACCOUNT tab ----
   Read-only "label · value" row, and the taller rows that carry an action button
   or the password fields (those stack on a narrow screen, see the media query). */
.info-row { cursor: default; }
@media (hover: hover) and (pointer: fine) { .info-row:hover { background: var(--surface-0); border-color: var(--border-soft); } }
.setting-value {
  flex: 0 1 auto; min-width: 0; text-align: right;
  font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--gold-bright);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-row-block { cursor: default; align-items: center; }
@media (hover: hover) and (pointer: fine) { .account-row-block:hover { background: var(--surface-0); border-color: var(--border-soft); } }
.settings-btn { flex: 0 0 auto; font-size: 13px; padding: 10px 16px; min-height: 40px; }
.settings-btn.danger { color: var(--ai-bright); border-color: rgba(239, 68, 68, 0.45); background: linear-gradient(180deg, rgba(239,68,68,0.14), rgba(239,68,68,0.05)); }
@media (hover: hover) and (pointer: fine) { .settings-btn.danger:hover:not(:disabled) { border-color: var(--ai); background: linear-gradient(180deg, rgba(239,68,68,0.24), rgba(239,68,68,0.10)); box-shadow: 0 6px 16px -6px rgba(239,68,68,0.5); } }
.settings-pw-fields { display: flex; gap: 8px; flex-wrap: wrap; }

/* CHANGE PASSWORD fold. La SUPERFICIE es el envoltorio, no la cabecera: asi abierto y
   cerrado son la MISMA pieza (una fila que crece), con un solo contorno y un solo relieve.
   La cabecera es un boton transparente dentro — deliberadamente SIN `.setting-row`, para no
   pelearse con el `:hover` y el retrofit de esa clase, que van por especificidad/posicion.
   Mismos numeros que `.settings-screen .setting-row`: 3px de tinta, radio 14, bandas 4/-8. */
.settings-fold {
  display: flex; flex-direction: column;
  background: var(--surface-0);
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); border-radius: 14px;
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,0.13)),
              inset 0 calc(-1 * var(--gv-sh-h, 8px)) 0 var(--gv-sh, rgba(0,0,0,0.34));
  transition: background .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .settings-fold:not(.open):hover { background: var(--surface-1); } }
.settings-fold-head {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 17px 20px; text-align: left; cursor: pointer;
  background: none; border: 0; color: var(--text); font: inherit; appearance: none;
}
.settings-fold-arrow {
  flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 9px; background: rgba(245, 193, 74, 0.12);
  border: 2px solid var(--gv-ink, #070f1d); color: var(--gold-bright);
  font-size: 12px; line-height: 1;
  transition: transform .18s var(--ease-out), background .15s;
}
@media (hover: hover) and (pointer: fine) { .settings-fold-head:hover .settings-fold-arrow { background: rgba(245, 193, 74, 0.26); } }
.settings-fold.open .settings-fold-arrow { transform: rotate(180deg); }
/* El cuerpo no es otra caja: cuelga dentro de la misma superficie, separado por una linea
   de tinta (la banda de sombra de la cabecera muere justo encima). */
.settings-fold-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 20px 18px;
  border-top: 2px solid rgba(0, 0, 0, 0.38);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.05);
}
.settings-fold-body .settings-btn { align-self: flex-start; margin-top: 4px; }
.settings-fold-body .settings-msg { margin-top: 2px; }
/* Campo de texto en el MISMO idioma cartoon que las filas: contorno de tinta y relieve
   HUNDIDO (banda oscura arriba), que es como el retrofit marca un carril/hueco. No lleva
   `.login-input`: esa clase vive ~9000 lineas mas abajo y ganaba por posicion, asi que sus
   1px + radio 11 pisaban en silencio todo lo que se escribiera aqui.
   El `flex: 1 1 190px` SOLO dentro de la fila de dos campos: en el contenedor en COLUMNA ese
   basis se aplica a la ALTURA y el campo suelto se estira. (190 y no 150 para que en un movil
   de 430 px los dos campos envuelvan y se apilen en vez de recortarse el placeholder.) */
.settings-input {
  width: 100%; flex: 0 0 auto; min-width: 0;
  padding: 12px 14px; border-radius: 12px;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px; color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.38), inset 0 -2px 0 rgba(255, 255, 255, 0.05);
  transition: border-color .15s, box-shadow .15s;
}
.settings-input::placeholder { color: var(--text-muted); font-weight: 500; }
.settings-input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.38), inset 0 -2px 0 rgba(255, 255, 255, 0.05),
              0 0 0 3px rgba(245, 193, 74, 0.22);
}
.settings-pw-fields .settings-input { flex: 1 1 190px; width: auto; }
.settings-msg {
  margin-top: 2px; padding: 11px 14px; border-radius: 12px;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px;
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.1), inset 0 -4px 0 rgba(0, 0, 0, 0.28);
}
.settings-msg.err { background: rgba(239, 68, 68, 0.2); color: #fecaca; }
.settings-msg.ok { background: rgba(34, 197, 94, 0.2); color: #bbf7d0; }

/* Settings TAB (menu): roomier rows + slightly larger text & icons. Scoped to
   .settings-screen so the compact in-duel settings modal keeps the base sizing. */
.settings-screen .settings-group { gap: 12px; }
.settings-screen .settings-group + .settings-group { margin-top: 24px; }
/* ---- AJUSTES EN DOS COLUMNAS ----
   A partir de 900 px el panel se ensancha y sus GRUPOS se reparten en dos columnas. Va con
   `grid` y no con `columns` (multi-columna) por dos motivos: multi-columna PARTE un grupo por
   la mitad si no cabe —hay que ir pidiendo `break-inside: avoid` bloque a bloque— y ademas
   fragmenta la caja, que es donde se tuercen los menus absolutos como el del campo de duelo.
   Con grid, cada grupo es una celda entera y no se parte nunca.
   `align-items: start` para que cada grupo mida lo suyo: sin el, los dos de una fila se
   estiran al mas alto y las filas de dentro se separan solas.
   Y el `margin-top` que separaba grupos apilados se apaga aqui: en la rejilla ese hueco lo
   pone el `gap`, y sumados dejaban las dos columnas descuadradas entre si. */
@media (min-width: 900px) {
  .settings-screen .settings-panel { max-width: 1080px; }
  .settings-screen .settings-body {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 24px; align-items: start;
  }
  .settings-screen .settings-body .settings-group + .settings-group { margin-top: 0; }
  /* EL GRUPO ALTO ocupa DOS filas de su columna. Sin esto, la rejilla mete a cada grupo en
     una fila y la fila la estira el mas alto: los grupos cortos de la izquierda quedaban
     separados por un hueco del tamano del grupo largo, y el ultimo (SESSION, el de salir)
     aterrizaba al fondo, lejos de todo. Con el span, la columna corta se apila seguida.
     Va por CLASE y no por `nth-child` para que se lea en el JSX por que ese grupo es
     especial; si algun dia deja de serlo, se quita la clase y la rejilla vuelve al reparto
     de siempre sin romper nada. */
  .settings-screen .settings-body > .settings-group.is-tall { grid-row: span 2; }
  /* UN SOLO GRUPO (los tabs de AUDIO y GAME SETTINGS traen uno solo): repartir GRUPOS no
     hace nada ahi — el unico ocuparia la celda izquierda y la derecha se quedaria vacia, que
     es peor que no partir nada. Cuando solo hay uno, lo que se reparte son sus FILAS: el
     grupo pasa a ocupar el ancho entero y se convierte el mismo en la rejilla de dos.
     Su titulo cruza las dos columnas, que si no se quedaria de cabecera de la izquierda. */
  .settings-screen .settings-body > .settings-group:only-child {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px; align-items: start;
  }
  .settings-screen .settings-body > .settings-group:only-child > .settings-group-title {
    grid-column: 1 / -1;
  }
  /* …SALVO el grupo marcado como ANCHO (GAME SETTINGS). Ahi la pieza principal es la vista
     previa del mapa, y repartir sus filas en dos columnas la dejaba en un sello al lado de una
     lista de interruptores. Una sola columna, a lo ancho del panel. */
  .settings-screen .settings-body > .settings-group.is-wide:only-child {
    /* UNA columna flex y no `block`: en bloque el `gap` deja de valer (solo existe en
       flex/grid) y las filas se quedaban pegadas unas a otras.
       Y el `gap` se REPITE aqui a proposito: la regla de arriba —la del grupo unico— lo fija
       en `12px 24px` con mas peso (0,3,0) que cualquier `.settings-social` suelto, asi que sin
       esto el hueco lo seguia mandando ella. */
    /* Y `align-items: stretch` porque la regla de arriba lo deja en `start` (lo necesita la
       rejilla de dos columnas): en una columna flex eso encoge a cada hijo a su contenido, y
       la cabecera de SOCIAL se quedaba de 366 px con su texto "centrado" dentro — o sea,
       pegado a la izquierda. Las filas no lo delataban porque llevan `width: 100%`. */
    display: flex; flex-direction: column; gap: 12px; align-items: stretch;
  }
  /* SOCIAL respira mas que una lista de ajustes: es una invitacion, no un panel de mandos.
     Con la MISMA forma de selector que la de arriba mas su clase, para ganarle sin `!important`. */
  .settings-screen .settings-body > .settings-group.is-wide.settings-social:only-child {
    gap: 20px;
  }
}
/* EL NOMBRE, editable desde AJUSTES: campo + boton en la misma fila. El campo cede y el
   boton no (`flex: 0 0 auto`), que es lo que mantiene el boton legible cuando la columna se
   estrecha — al reves, el boton se comeria el campo. En movil la fila entera se apila sola
   (ver `.account-row-block` en el bloque de <=620px). */
.settings-name-edit { flex: 0 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
/* EL ATAJO AL PANEL DE ADMIN, al lado del boton de guardar el nombre. Es un <a> pintado como
   los botones del juego: hay que devolverle la caja y el centrado que un enlace no trae. */
.settings-admin-btn {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; white-space: nowrap; letter-spacing: 0.06em;
}
.settings-name-input { flex: 1 1 auto; min-width: 0; width: 190px; max-width: 100%; }
/* ===== AJUSTES DEL MAPA (GAME SETTINGS) =====
   La vista previa manda y los dos mandos van debajo: se mira primero y se elige despues. Antes
   la unica vista previa era el sello de 200 px de dentro del desplegable, y el campo se elegia
   casi a ciegas. */
/* ===== SOCIAL =====
   Dos filas y una cabecera: la pestaña no es una lista de ajustes, es una invitacion. Por eso
   respira mas que el resto (18 px entre piezas contra los 10 de un grupo normal) — pegadas se
   leian como dos ajustes mas. */
/* (0,2,0) a proposito: `.settings-screen .settings-group` fija el hueco del grupo, y una
   regla de una sola clase no le gana. */
.settings-screen .settings-social { gap: 20px; }
.social-head { text-align: center; margin: 6px 0 4px; }
.social-title {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(24px, 3vw, 34px); letter-spacing: 0.02em; color: var(--gold-bright);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 24px rgba(245, 193, 74, 0.28);
}
.social-sub {
  margin: 8px auto 0; max-width: 46ch;
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5; color: var(--text-muted);
}
/* La fila entera es el enlace, asi que tiene que COMPORTARSE como uno: cursor de mano, sin
   subrayado (el rotulo ya lo dice) y el mismo realce al pasar por encima que cualquier fila
   pulsable. */
.social-row { text-decoration: none; color: inherit; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .social-row:hover { background: var(--surface-1); border-color: var(--gold-edge); } }
/* El "boton" es un <span>: hereda la pinta del kit pero no la pulsacion (quien navega es el
   <a>). Sin `pointer-events` propios, el clic cae en el enlace igual. */
.social-go { pointer-events: none; }
/* ===== PROMO CODE =====
   Misma cabecera que SOCIAL; debajo, campo + boton en una fila centrada (el campo cede). */
.promo-form { display: flex; gap: 10px; width: min(100%, 460px); margin-inline: auto; }
.promo-input {
  flex: 1 1 auto; min-width: 0; width: auto; text-align: center;
  font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
}
.promo-msg { width: min(100%, 460px); margin-inline: auto; text-align: center; }
.promo-packs { margin-top: 6px; }
.settings-map { display: flex; flex-direction: column; gap: 10px; }
/* La PROPORCION es la del tablero de verdad (~1.9), no un 16/9 cualquiera: lo que se enseña
   aqui tiene que encuadrar como lo que se va a jugar. Y el ancho se topa contra el ALTO de la
   ventana para que la vista previa no se coma la pantalla en un monitor ancho — con
   `aspect-ratio`, limitar el ancho es limitar el alto. */
.map-preview {
  position: relative; width: min(100%, calc(44vh * 1.9)); margin-inline: auto;
  aspect-ratio: 1.9; border-radius: 14px; overflow: hidden;
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.8);
}
/* El paisaje ACOMPAÑA AL CIELO con las mismas dos señales que en el duelo: se apaga con el
   cielo cubierto y se aclara de golpe con el fogonazo. (Las sombras de los trastos ya lo hacen
   solas: `.battlefield-props.is-shadows` lee `--wx-overcast`, y aqui lo hereda.) */
.map-preview-art {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0;
  filter: brightness(calc(1 - 0.22 * var(--wx-overcast, 0) + 0.3 * var(--wx-flash, 0)));
}
/* La lluvia va FUERA de `.board-preview`: esa lleva `is-still`, que apaga toda animacion y
   transicion de lo que tenga dentro — el cielo se habria quedado congelado. */
.map-preview-wx { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
/* Y el fogonazo en su propia capa, por encima de la lluvia. */
.map-preview-flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
/* Los dos desplegables del mapa, mas anchos que los de una fila normal: son los mandos de la
   pieza, no un ajuste suelto de la lista. */
.settings-map .board-dd { width: 260px; }
@media (max-width: 620px) { .settings-map .board-dd { width: 100%; max-width: none; } }
.settings-screen .settings-group-title { font-size: 12px; margin-bottom: 6px; }
.settings-screen .setting-row { gap: 16px; padding: 17px 20px; border-radius: 14px; }
.settings-screen .setting-label { font-size: 17px; }
.settings-screen .setting-desc { font-size: 13.5px; }
.settings-screen .setting-toggle { --tg-h: 34px; }
.settings-screen .board-dd { width: 288px; gap: 10px; }
.settings-screen .board-dd-head { font-size: 14px; padding: 10px 13px; }
.settings-screen .volume-icon { width: 32px; height: 32px; }
.settings-screen .volume-value { min-width: 24px; font-size: 16px; }
.settings-screen .volume-slider::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -6px; }
.settings-screen .volume-slider::-moz-range-thumb { width: 20px; height: 20px; }
/* Narrow: the action rows (button on the right) stack, so neither the label nor the
   button gets squeezed. The password inputs already wrap on their own. */
@media (max-width: 620px) {
  .account-row-block { flex-direction: column; align-items: stretch; gap: 12px; }
  .settings-btn { width: 100%; }
  .settings-fold-head { flex-direction: row; align-items: center; }
  .settings-fold-body .settings-btn { align-self: stretch; }
  .info-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .setting-value { text-align: left; max-width: 100%; }
}

/* Tablet / phone: nav becomes a fixed-height bottom bar. */
@media (max-width: 1024px) {
  .app-shell { flex-direction: column; }
  .app-nav {
    order: 2;
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 4px;
    padding: 6px 8px;
    padding-bottom: max(6px, var(--safe-b));
    border-right: none;
    border-top: 1px solid var(--border-soft);
  }
  .app-content { order: 1; }
  .nav-version { display: none; }
  .nav-item { flex: 1 1 0; padding: 9px 2px 7px; gap: 7px; border-radius: 12px; }
  .nav-icon { width: 52px; height: 52px; }
  .nav-label { font-size: 10px; letter-spacing: 0.03em; }
  :root { --icon-min: 40px; }
}
@media (max-width: 380px) {
  .nav-label { font-size: 9px; }
  .nav-icon { width: 46px; height: 46px; }
  :root { --icon-min: 34px; }
}

/* ── Force PORTRAIT for the menu shell on touch devices held in landscape.
   Every menu screen (home, decks, builder, collection, shop, settings, duel
   lobby) lives in .app-shell and is rotated to read upright in portrait. The
   battle HUD (.game-shell) and the post-duel result (rendered inside it) are
   deliberately NOT matched here, so they keep the real device orientation. ── */
@media (orientation: landscape) and (pointer: coarse) and (hover: none) {
  html, body { overflow: hidden; }
  .app-shell {
    position: absolute;
    top: 100vh; left: 0;
    width: 100vh;            /* portrait width  = device's short side */
    height: 100vw;           /* portrait height = device's long side  */
    transform-origin: left top;
    transform: rotate(-90deg);
    /* Force the portrait (bottom-nav) layout regardless of the physical width. */
    flex-direction: column;
  }
  .app-shell .app-nav {
    order: 2; width: 100%; flex-direction: row;
    justify-content: space-around; align-items: stretch; gap: 4px;
    padding: 6px 8px; padding-bottom: max(6px, var(--safe-b));
    border-right: none; border-top: 1px solid var(--border-soft);
  }
  .app-shell .app-content { order: 1; min-height: 0; }
  .app-shell .nav-item { flex: 1 1 0; padding: 9px 2px 7px; gap: 7px; border-radius: 12px; }
  .app-shell .nav-icon { width: 52px; height: 52px; }
  .app-shell .nav-label { font-size: 10px; letter-spacing: 0.03em; }
}

/* ============== DRAG & DROP (play cards from hand) ============== */
/* A vertical drag lifts the card to play it; a horizontal swipe still scrolls
   the hand (pan-x lets the browser keep horizontal panning, hands us the rest). */
.card.in-hand { touch-action: pan-x; }

/* Source card fades while its ghost rides the pointer. */
/* The faded original (the ghost follows the pointer) must not intercept the
   drop hit-test — the player spell row sits right under the hand, so a dragged
   card / its neighbours would otherwise block the drop onto the slots beneath. */
.card.dragging { opacity: 0.26; pointer-events: none; }

/* The floating card that follows the pointer during a drag. */
.drag-ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 320;
  width: 116px;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.6));
}
/* Inner node carries the live 3D tilt, written per-frame from the drag velocity
   in JS (rotateX/rotateY/rotateZ). Pivots about its centre like a real card. */
.drag-ghost-tilt {
  width: 100%;
  transform-origin: center center;
  transform: scale(1.04);
  will-change: transform;
}
.drag-ghost-tilt .card { width: 100%; height: auto; }

/* Attack targeting arrow (field hero → enemy hero). Follows the pointer; turns
   red and locks on when hovering a valid enemy. */
/* ===== Stylised Hearthstone-style target arrow =====
   A full-screen fixed SVG layer holding ONE tapered, curved path (.ta-arrow) that
   arrowFrame() rebuilds each frame (no layout reflow). Narrow at the origin, it
   widens into the arrowhead and curves with a small spring. Normal = warm gold
   gradient + glow; flips to red while hovering a valid target (.arrow--targeting).
   The theme lives in custom props so the gradient stops + glow cross-fade. */
.target-arrow {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 250; overflow: visible;
  --ta-c1: #ffe6a0;                       /* light yellow — tail */
  --ta-c2: #f3920f;                       /* amber — toward the tip */
  --ta-hi: rgba(255, 255, 255, 0.92);     /* travelling highlight */
  --ta-glow: rgba(245, 178, 60, 0.92);
  --ta-glow2: rgba(243, 140, 22, 0.55);
}
.target-arrow.arrow--targeting {
  --ta-c1: #ff9f8a;                       /* light red */
  --ta-c2: #b3120f;                       /* deep red */
  --ta-hi: rgba(255, 226, 220, 0.95);
  --ta-glow: rgba(236, 56, 46, 0.95);
  --ta-glow2: rgba(178, 20, 20, 0.6);
}
/* Spell targeting: the same arrow in an electric-blue theme, matching the spell
   cards. Brightens to a vivid cyan-blue when locked onto a valid hero. */
.target-arrow.arrow--spell {
  --ta-c1: #bfe9ff;                       /* pale ice-blue — tail */
  --ta-c2: #1ea0ff;                       /* electric blue — toward the tip */
  --ta-hi: rgba(255, 255, 255, 0.95);
  --ta-glow: rgba(56, 170, 255, 0.92);
  --ta-glow2: rgba(20, 110, 230, 0.55);
}
.target-arrow.arrow--spell.arrow--targeting {
  --ta-c1: #d8f4ff;
  --ta-c2: #00bfff;                       /* vivid electric blue lock-on */
  --ta-hi: rgba(255, 255, 255, 0.98);
  --ta-glow: rgba(86, 200, 255, 1);
  --ta-glow2: rgba(30, 140, 255, 0.7);
}
.ta-arrow {
  will-change: d, filter;
  /* Glow hugs the single rendered silhouette → reads as one solid unit. */
  filter: drop-shadow(0 0 4px var(--ta-glow)) drop-shadow(0 0 12px var(--ta-glow2));
  transition: filter .18s ease;
}
.ta-stop-1  { stop-color: var(--ta-c1); transition: stop-color .18s ease; }
.ta-stop-2  { stop-color: var(--ta-c2); transition: stop-color .18s ease; }
.ta-stop-hi { stop-color: var(--ta-hi); stop-opacity: 0.85; transition: stop-color .18s ease; }

/* The hero you're dragging from lifts slightly while the attack drag is live. */
.slot.attacking-source { z-index: 6; }
.slot.attacking-source .card { transform: translateY(-4px) scale(1.03); filter: brightness(1.08); }

/* Valid drop slots LIGHT UP (owner 2026-11-05: at rest a slot has no outline at all; only while a
   card is held do the ones it can go to glow, with a moving light, never a flat or dashed line).
   `.slot-glow` (SlotGlow, game.js) traces the card's footprint: a halo that breathes + a thin
   ring with a beam of light running round it (a conic gradient spinning under a ring mask).
   Only opacity / transform move, so it stays on the compositor while the card is dragged.
   Colour by role: blue = mine to place, red = an enemy to hit / a spell to replace, gold = a
   tribute. The slot under the pointer lifts and burns brighter. */
.slot, .spell-slot { --sg-c: var(--player); --sg-hi: var(--player-bright); }
.slot.drop-ai, .spell-slot.drop-replace { --sg-c: var(--ai); --sg-hi: var(--ai-bright); }
.slot.drop-sacrifice { --sg-c: var(--gold); --sg-hi: var(--gold-bright); }
.slot-glow {
  position: absolute;
  inset: calc(-1 * var(--card-bleed, 3.5%) - 2px);
  border-radius: 9% / 6.2%;   /* the same round corner on both axes of an 11:16 card */
  pointer-events: none;
  box-shadow: 0 0 14px 1px var(--sg-c), inset 0 0 16px -4px var(--sg-c);
  animation: slotGlowBreathe 1.5s ease-in-out infinite alternate;
}
.slot-glow-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  overflow: hidden;
  background: var(--sg-c);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.slot-glow-ring::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(transparent 0deg 90deg, var(--sg-hi) 150deg, #fff 175deg, transparent 184deg 270deg, var(--sg-hi) 330deg, #fff 355deg, transparent 360deg);
  animation: slotGlowSpin 2.4s linear infinite;
}
.slot.drop-active, .spell-slot.drop-active { transform: translateY(-2px); }
.drop-active > .slot-glow {
  animation: none;
  box-shadow: 0 0 22px 3px var(--sg-c), inset 0 0 26px -2px var(--sg-c);
  background: radial-gradient(closest-side, transparent 55%, color-mix(in srgb, var(--sg-c) 22%, transparent));
}
.drop-active > .slot-glow > .slot-glow-ring { padding: 3px; background: var(--sg-hi); }
.drop-active > .slot-glow > .slot-glow-ring::before { animation-duration: 1.1s; }
/* the label of a lit empty slot reads as part of the light */
.slot.empty.drop-valid > .slot-hint, .spell-slot.empty.drop-valid > .slot-hint { opacity: 0.9; text-shadow: 0 0 8px var(--sg-c); }
/* ...and only there: at rest the caption (HERO / SPECIAL) is hidden like the outline (owner, same day). */
.slot.empty:not(.drop-valid) > .slot-hint, .spell-slot.empty:not(.drop-valid) > .slot-hint { opacity: 0; }
.slot.empty > .slot-hint, .spell-slot.empty > .slot-hint { transition: opacity .18s ease; }
@keyframes slotGlowBreathe { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes slotGlowSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .slot-glow { animation: none; }
  .slot-glow-ring::before { animation: none; }
}

/* Proof of Sacrifice: the moment you grab a special-summonable hero, EVERY tributable
   own hero invites the drop with the GOLDEN glow above (no dim/danger look). The hero
   stays fully lit (full opacity, no desaturation). */
.slot.drop-valid.drop-sacrifice:not(.empty) .card { opacity: 1; filter: none; }
/* The summon icon shown over EVERY tribute target — spins slowly counter-clockwise.
   Non-hovered tributes show it a touch smaller/softer; the active one is full + bright. */
.sacrifice-summon-icon {
  position: absolute;
  left: 50%; top: 50%;
  width: 46%;
  pointer-events: none;
  z-index: 25;
  opacity: 0.82;
  filter: drop-shadow(0 0 8px rgba(245, 193, 74, 0.75)) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
  animation: summonSpinCcw 5s linear infinite;
}
.sacrifice-summon-icon.active {
  width: 56%;
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(253, 230, 138, 0.95)) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
}
@keyframes summonSpinCcw {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Whole own-field zone lights up for non-targeted spell. */
.field-row.own-drop-valid { border-radius: 14px; box-shadow: inset 0 0 0 2px var(--player-soft); }
.field-row.own-drop-active { box-shadow: inset 0 0 0 2px var(--player-bright), inset 0 0 32px var(--player-soft); }

/* Hand hero highlighted as an ICO (own_hand_hero) target. */
.card.in-hand.drop-valid  { outline: 2px dashed var(--spell); outline-offset: 2px; }
.card.in-hand.drop-active { outline: 3px solid var(--spell); outline-offset: 2px; transform: translateY(-10px); }

/* Enlarged-card modal opened by tapping/clicking a card. */
.card-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.66);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  animation: cardModalIn 160ms var(--ease-out);
}
.card-modal .card.preview {
  cursor: default;
  /* 50% larger than the default 320×448, capped so it always fits the viewport */
  width: min(480px, 90vw, 64vh);
  height: auto;
  aspect-ratio: 5 / 7;
}
@keyframes cardModalIn { from { opacity: 0; } to { opacity: 1; } }
/* LA PAREJA: una carta y la FICHA que invoca, a su derecha (ver ZoomCards en game.js). Las
   dos se achican para que quepan las dos — el tope por `vw` es lo que las salva en un movil,
   donde la de arriba sola se llevaba el 90 % del ancho. `nowrap` a proposito: envueltas
   ocuparian dos alturas de carta y se saldrian por abajo, que es peor que verlas pequenas. */
.card-modal .zoom-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 30px);
  flex-wrap: nowrap;
}
.card-modal .zoom-pair .card.preview { width: min(420px, 43vw, 56vh); }
/* La acompanante va con su rotulo encima, y el rotulo NO ocupa sitio: va en `absolute` sobre
   el hueco de arriba para que las dos cartas queden a la misma altura. */
.card-modal .zoom-mate { position: relative; display: flex; }
.card-modal .zoom-mate-label {
  position: absolute; left: 0; right: 0; bottom: 100%;
  margin-bottom: 0.5em;
  text-align: center;
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: clamp(9px, 1.1vw, 13px);
  letter-spacing: 0.14em;
  color: #e9d5ff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  pointer-events: none;
}

/* ============== HOME (Profile / Decks / Collection) ============== */
.home-screen {
  height: 100%;
  overflow-y: auto;
  padding: clamp(22px, 3vh, 44px) clamp(14px, 3vw, 48px) clamp(40px, 5vh, 64px);
  padding-top: max(clamp(22px, 3vh, 44px), var(--safe-t));
}
/* Responsive: fill wide screens (was capped at 1200px → tiny on PC) and let
   widgets grow. Columns scale up so the content reads larger on desktop. */
.home-grid {
  display: grid;
  gap: clamp(16px, 1.6vw, 34px);
  grid-template-columns: repeat(auto-fit, minmax(clamp(320px, 27vw, 560px), 1fr));
  max-width: min(2040px, 95vw);
  margin: 0 auto;
  align-items: start;
}
.home-widget {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--border-soft);
  border-radius: clamp(16px, 1.4vw, 26px);
  padding: clamp(18px, 1.9vw, 38px);
  backdrop-filter: blur(6px);
  min-height: clamp(200px, 24vh, 320px);
  display: flex; flex-direction: column;
}
.widget-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: clamp(14px, 1.4vw, 26px); }
.widget-head h3 {
  margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(16px, 1.5vw, 28px);
  letter-spacing: 0.03em; color: var(--gold-bright);
}
.widget-title-icon { display: inline-flex; align-items: center; gap: clamp(9px, 0.8vw, 14px); }
.widget-title-icon img { width: clamp(44px, 3.4vw, 72px); height: clamp(44px, 3.4vw, 72px); object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
.widget-action {
  background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text);
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.9vw, 14px); letter-spacing: 0.06em;
  padding: clamp(6px, 0.7vw, 11px) clamp(10px, 1vw, 16px); border-radius: 9px; cursor: pointer; transition: background .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .widget-action:hover { background: var(--surface-2); border-color: var(--border-strong); } }

/* --- Profile --- */
.profile-body { display: flex; gap: clamp(16px, 1.6vw, 26px); align-items: center; }
.avatar-disc {
  position: relative; flex: 0 0 auto;
  width: clamp(78px, 5.8vw, 132px); height: clamp(78px, 5.8vw, 132px); border-radius: var(--av-radius, 22%);
  border: 2px solid var(--av, var(--player));
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.14), rgba(0,0,0,0.32));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s var(--ease-out);
  box-shadow: 0 6px 18px -6px var(--av, var(--player));
}
@media (hover: hover) and (pointer: fine) { .avatar-disc:hover { transform: scale(1.05); } }
.avatar-emoji {
  width: 100%; height: 100%;
  border-radius: var(--av-radius, 22%);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.avatar-emoji img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit {
  position: absolute; right: -2px; bottom: -2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  font-size: 11px; display: flex; align-items: center; justify-content: center; color: var(--text-dim);
}
.profile-info { flex: 1; min-width: 0; }
.name-display {
  background: none; border: none; color: var(--text); cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(19px, 1.6vw, 30px); padding: 0;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
}
.name-display .edit-pencil { font-size: 12px; color: var(--text-muted); }
.name-input {
  font-family: var(--font-ui); font-weight: 700; font-size: 18px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 8px;
  color: var(--text); padding: 4px 8px; width: 100%; max-width: 180px;
}
.level-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.level-badge {
  font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.06em;
  background: var(--player-soft); color: var(--player-bright); border: 1px solid var(--player);
  padding: 3px 8px; border-radius: 7px;
}
.xp-text { font-size: 11px; color: var(--text-dim); }
.xp-bar { height: 9px; border-radius: 999px; background: rgba(0,0,0,0.35); overflow: hidden; border: 1px solid var(--border-soft); }
.xp-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width .3s var(--ease-out); }
.avatar-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px;
  border-top: 1px solid var(--border-soft); padding-top: 14px;
}
.avatar-opt {
  aspect-ratio: 1; border-radius: var(--av-radius, 22%); cursor: pointer;
  border: 2px solid transparent; background: rgba(255,255,255,0.05);
  overflow: hidden; padding: 0;
  display: flex; align-items: center; justify-content: center; transition: transform .12s, border-color .15s;
}
.avatar-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: hover) and (pointer: fine) { .avatar-opt:hover { transform: scale(1.08); } }
.avatar-opt.sel { border-color: var(--av); box-shadow: inset 0 0 0 2px var(--av); background: rgba(255,255,255,0.10); }

/* --- Decks --- */
.widget-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--text-dim); }
.widget-empty p { margin: 0; font-size: 14px; }
.hint-sm { font-size: 11px; color: var(--text-muted); letter-spacing: 0.02em; }
.deck-list { display: flex; flex-direction: column; gap: clamp(8px, 0.9vw, 14px); }
/* Each deck is a single clickable box; the delete button lives inside it. */
.deck-row {
  display: flex; flex-direction: column; gap: clamp(8px, 0.9vw, 12px);
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: clamp(11px, 1vw, 16px) clamp(13px, 1.1vw, 18px); cursor: pointer; color: var(--text);
  transition: background .15s, border-color .15s; text-align: left;
}
@media (hover: hover) and (pointer: fine) { .deck-row:hover { background: var(--surface-1); border-color: var(--border-strong); } }
.deck-row-top { display: flex; align-items: center; gap: 10px; }
.deck-name { flex: 1; min-width: 0; font-family: var(--font-ui); font-weight: 700; font-size: clamp(14px, 1.2vw, 18px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-count { font-size: clamp(12px, 1vw, 14px); font-weight: 600; white-space: nowrap; }
.deck-count.ok { color: var(--success); }
.deck-count.bad { color: var(--warning); }
.deck-del {
  flex: 0 0 auto; width: clamp(30px, 2.6vw, 38px); height: clamp(30px, 2.6vw, 38px);
  border-radius: 9px; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--border-soft); font-size: 15px; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .deck-del:hover { background: var(--ai-soft); border-color: var(--ai); } }
/* Featured cards shown beside each deck name (doubled size for visibility). */
.deck-feat { display: flex; gap: clamp(8px, 0.8vw, 14px); }
.deck-feat-card { width: clamp(80px, 8vw, 120px); flex: 0 0 auto; }
.deck-feat-card .card { width: 100%; height: auto; }

/* --- Collection widget --- */
.collection-stats { display: flex; gap: clamp(22px, 3vw, 44px); margin-bottom: clamp(14px, 1.6vw, 22px); }
.collection-stats .stat { display: flex; flex-direction: column; }
.collection-stats .stat b { font-family: var(--font-ui); font-size: clamp(24px, 2.6vw, 36px); color: var(--text); }
.collection-stats .stat span { font-size: clamp(11px, 0.9vw, 13px); color: var(--text-dim); letter-spacing: 0.03em; }
/* Collections list — one progress bar per obtainable set (Genesis for now). */
.collection-sets { display: flex; flex-direction: column; gap: 10px; }
.cset-title { font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; color: var(--text-dim); text-transform: uppercase; }
.cset-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: clamp(10px, 1vw, 14px) clamp(12px, 1.1vw, 16px); cursor: pointer;
  transition: background .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .cset-row:hover { background: var(--surface-1); border-color: var(--border-strong); } }
.cset-icon { width: clamp(36px, 3.2vw, 52px); height: auto; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }
.cset-body { flex: 1; min-width: 0; }
.cset-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.cset-name { font-family: var(--font-ui); font-weight: 700; font-size: clamp(13px, 1.1vw, 17px); color: var(--text); }
.cset-count { font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.95vw, 14px); color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.cset-bar { height: clamp(9px, 0.9vw, 12px); border-radius: 999px; background: rgba(0,0,0,0.35); border: 1px solid var(--border-soft); overflow: hidden; }
.cset-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width .3s var(--ease-out); }

/* ============================================================
   HOME — command-center redesign
   ============================================================ */
/* Fits the whole home in one viewport — no page scroll. Fixed-height flex column;
   the hero row absorbs slack, everything else is compact and vh-scaled so short
   screens shrink instead of scrolling. */
.home2 {
  height: 100%; min-height: 0; overflow: hidden; width: 100%;
  max-width: min(1680px, 100%); margin: 0 auto;
  padding: max(clamp(8px,1.4vh,18px), var(--safe-t)) clamp(12px,3vw,44px) clamp(10px,1.6vh,20px);
  display: flex; flex-direction: column; gap: clamp(8px,1.3vh,16px);
}
/* El fondo PROPIO del HOME: el bosque bitcoin, a pantalla completa, en lugar de la
   rejilla de espirales del resto del menu (`.bg-fx`, que sigue en las demas pestañas).
   Va en un `::before` FIJO y no en `.home2`: la pantalla se limita a 1680 px, asi que
   pintarlo en la caja dejaria dos franjas de rejilla a los lados en monitores anchos.
   Mismo truco que `.bg-fx` — `fixed` + `z-index: -1` — y por eso queda POR ENCIMA de el
   (mismo plano, y este va despues en el DOM) y POR DEBAJO del rail de navegacion, que es
   opaco y tiene su propio z-index. El velo oscuro es lo que mantiene legibles el texto
   claro y los paneles de cristal sobre un dibujo tan luminoso. */
.home2::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 12, 26, 0.58), rgba(6, 12, 26, 0.76)),
    url('../UI/home_bg.jpg') center / cover no-repeat;
}
/* El CRISTAL del home. Sobre la rejilla oscura del resto del menu bastaba un velo
   plano; sobre el BOSQUE no. Un velo oscurece el dibujo pero conserva todos sus bordes,
   asi que las ramas y el rio se seguian leyendo DENTRO del panel y competian con el
   texto (medido: el slot de mazo vacio quitaba 6 puntos de luminancia y CERO textura
   respecto al fondo crudo). El cuerpo lo pone el DESENFOQUE, no la opacidad — la misma
   receta que las chapas de los contadores (`--counter-*`) — y por eso el tinte BAJA al
   anadir el blur: desenfoque sobre la opacidad de antes sale mas turbio, no mas limpio.
   El `saturate` deja pasar el verde del bosque, que es lo que integra el panel con el
   fondo en vez de recortarlo contra el. */
:root {
  --home-glass-face:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 70%),
    linear-gradient(180deg, rgba(24,40,68,0.70), rgba(13,23,42,0.74));
  /* Variante apagada para los HUECOS (slots de mazo libres): misma superficie, menos
     luz, porque siguen teniendo que leerse como hueco y no como pieza llena. */
  --home-glass-face-dim:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0) 70%),
    linear-gradient(180deg, rgba(11,20,38,0.76), rgba(4,9,18,0.80));
  --home-glass-blur: blur(18px) saturate(1.2);
}
/* Shared gold-edged glass panel for the hero, banner and tiles. */
.home2-panel {
  position: relative; overflow: hidden;
  background: var(--home-glass-face);
  -webkit-backdrop-filter: var(--home-glass-blur);
  backdrop-filter: var(--home-glass-blur);
  border: 1px solid var(--border-strong); border-radius: clamp(16px,1.4vw,22px);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.07);
}
.home2-kicker { font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px,0.8vw,12px); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }

/* --- Resource bar --- */
.home2-bar {
  flex: 0 0 auto;
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: clamp(12px,1.4vh,20px) clamp(18px,1.8vw,30px);
  background: var(--home-glass-face);
  -webkit-backdrop-filter: var(--home-glass-blur);
  backdrop-filter: var(--home-glass-blur);
  border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: 0 12px 30px -14px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.06);
}
.home2-id { display: flex; align-items: center; gap: clamp(13px,1.3vw,22px); min-width: 0; }
/* Avatar: sin aro — retrato cuadrado con esquinas redondeadas (como los PNG). */
.home2-avatar {
  position: relative; flex: 0 0 auto; width: clamp(64px,5.2vw,94px); height: clamp(64px,5.2vw,94px); border-radius: var(--av-radius, 22%);
  border: none; padding: 0; cursor: pointer; overflow: visible;
  transition: transform .15s var(--ease-out);
}
/* Inner clip so the portrait fills the frame edge-to-edge (full-bleed square PNGs). */
.home2-avatar-face { position: absolute; inset: 0; border-radius: var(--av-radius, 22%); overflow: hidden; background: radial-gradient(circle at 50% 34%, rgba(120,150,190,0.45), rgba(6,12,24,0.6)); }
.home2-avatar-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: hover) and (pointer: fine) { .home2-avatar:hover { transform: translateY(-1px) scale(1.04); } }
/* HOME: contorno de tinta + aro dorado (como el modal de EXP) y el retrato un poco más a la izquierda. */
.home2-avatar { margin-left: calc(-1 * clamp(6px, 0.8vw, 14px)); }
.home2-avatar .home2-avatar-face { box-shadow: 0 0 0 2px var(--gv-ink, #070f1d), 0 0 0 4px var(--gold-edge, #c9962f), 0 4px 10px 2px rgba(0,0,0,0.55); }
/* El lápiz va CENTRADO sobre el retrato, sin contenedor, y solo asoma en hover. */
.home2-avatar-edit { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; font-size: clamp(20px,1.7vw,30px); color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.8); opacity: 0; transition: opacity .15s; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .home2-avatar:hover .home2-avatar-edit { opacity: 0.75; } }
.home2-id-info { min-width: 0; display: flex; flex-direction: column; gap: clamp(6px,0.7vh,10px); }
.home2-nameline { display: flex; align-items: center; gap: clamp(8px,0.8vw,14px); min-width: 0; }
/* El nivel es TEXTO (sin píldora): tipografía de títulos, en oro. */
.home2-lvl-pill { flex: 0 0 auto; font-family: var(--font-display); font-weight: 400; font-size: clamp(13px,1.15vw,20px); letter-spacing: 0.02em; color: var(--gold-bright); white-space: nowrap; line-height: 1.15; text-shadow: 0 2px 6px rgba(0,0,0,0.45); }
.home2-name { background: none; border: none; color: var(--text); cursor: pointer; font-family: var(--font-ui); font-weight: 800; font-size: clamp(19px,1.7vw,30px); letter-spacing: 0.01em; padding: 0; display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.home2-name-pencil { font-size: 13px; color: var(--text-muted); opacity: 0; transition: opacity .15s; }
/* El lapiz de HOME (icons/edit_pencil.png, 2026-10-24): un icono a color en lugar del glifo; mide en `em` del hueco. */
.edit-ico { width: 1.2em; height: 1.2em; display: block; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)); pointer-events: none; }
.home2-name-pencil .edit-ico { display: inline-block; vertical-align: -0.2em; }
.home2-deck-edit .edit-ico { margin: auto; }
@media (hover: hover) and (pointer: fine) { .home2-name:hover .home2-name-pencil { opacity: 1; } }
/* TOUCH (owner 2026-11-06): no hover to show them, so the edit pencils stay on for a finger, beside
   the name and on a deck tile. (The avatar's, centred over the face, stays out: see the phone block.) */
@media (hover: none) {
  .home2-name-pencil { opacity: 1; }
  .home2-deck-edit { opacity: 0.75; }
}
.home2-name-input { font-family: var(--font-ui); font-weight: 800; font-size: clamp(19px,1.7vw,28px); background: var(--surface-1); border: 1px solid var(--gold-edge); border-radius: 9px; color: var(--text); padding: 3px 10px; width: 220px; max-width: 60vw; }

/* ---- ID PUBLICO DE LA CUENTA (PlayerCode) — el widget del HOME y AJUSTES > CUENTA ----
   Es un BOTON entero y no un texto con un icono al lado: lo unico que se hace con un ID es
   copiarlo, asi que el area de pulsacion es todo el chip. En reposo se lee como un dato
   (superficie hundida, letra apagada); al pasar por encima se enciende en oro, que es lo que
   dice "esto se puede tocar". El acuse de copiado NO mueve nada de sitio —solo cambia el
   glifo y el color— porque un chip que crece al pulsarlo empuja el nombre y el nivel. */
.player-code {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-radius: 10px; cursor: pointer;
  /* Superficie HUNDIDA con filo dorado: la misma lectura que un campo de datos del juego, no
     la de un boton. Lo que invita a pulsarlo es el icono de copiar, no el relieve. */
  background: linear-gradient(180deg, rgba(0,0,0,.34), rgba(0,0,0,.18));
  border: 1px solid rgba(245, 193, 74, .32);
  box-shadow: inset 0 1px 0 rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.04);
  color: var(--gold-bright);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
@media (hover: hover) and (pointer: fine) {
  .player-code:hover {
    border-color: var(--gold); background: linear-gradient(180deg, rgba(245,193,74,.16), rgba(245,193,74,.06));
    box-shadow: inset 0 1px 0 rgba(0,0,0,.4), 0 0 0 1px rgba(245,193,74,.18);
  }
}
.player-code.copied { border-color: var(--gold); background: linear-gradient(180deg, rgba(245,193,74,.22), rgba(245,193,74,.08)); }
/* (Aqui vivia `.player-code-tag`, el rotulo "ID" dentro de la chapa. Se fue porque la fila de
   AJUSTES ya se llama "Player ID": dentro era decir lo mismo dos veces en la misma linea.) */
/* EL CODIGO, en tipografia de TITULOS: es un identificador, no una frase, y asi se distingue
   de todo lo demas de la fila. El alfabeto evita 0/O y 1/I/L a proposito (se dicta en voz alta
   y se copia a mano de una captura); el espaciado ancho remata esa intencion separando los
   simbolos para leerlos de uno en uno. */
.player-code-val {
  font-family: var(--font-title), var(--font-ui); font-size: 17px; font-weight: 400;
  letter-spacing: 0.13em; line-height: 1.1; color: var(--gold-bright);
  text-shadow: 0 1px 0 rgba(0,0,0,.55);
}
.player-code-ico { display: inline-flex; color: var(--gold); }
.player-code.copied .player-code-ico { color: var(--gold-bright); }
@media (hover: hover) and (pointer: fine) { .player-code:hover .player-code-ico { color: var(--gold-bright); } }
.player-code-ico svg {
  width: 17px; height: 17px; display: block;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
/* En el HOME va sin rotulo y una pizca mas pequeno: ahi el vecino es el nombre a 30 px y el
   ID no debe competir con el — pero sigue siendo legible de un vistazo, que es para lo que
   esta. */
.player-code.compact { padding: 5px 10px; gap: 7px; }
.player-code.compact .player-code-val { font-size: 15px; letter-spacing: 0.11em; }
.player-code.compact .player-code-ico svg { width: 15px; height: 15px; }
/* Y por debajo de 600 px, FUERA del HOME. MEDIDO con el nombre mas largo que admite el campo
   (18 caracteres): la fila del nombre no crece, y como el chip no encoge (`flex: 0 0 auto`)
   el unico que cede es el NOMBRE — a 500 px se queda en 10 px y a 430 desaparece y el chip se
   monta encima del monedero. Es el mismo trato que ya recibe `.home2-xp-text` en esta barra:
   lo que no cabe se va, y el ID sigue estando en AJUSTES > CUENTA, que es donde se va a
   buscar cuando hay que darlo. */
@media (max-width: 600px) {
  .player-code.compact { display: none; }
}
.home2-xprow { display: flex; align-items: center; gap: 10px; }
/* Barra de EXP: mismo lenguaje que la del flow de recompensas (`.rf-xp-bar` / `.xp-fill` en
   fx-effects.css) — raíl hundido con contorno de tinta y relleno AZUL de punta RECTA (la
   izquierda la redondea el clip del raíl). Una sola lectura de "experiencia" en todo el juego. */
.home2-xp { width: clamp(120px,16vw,300px); height: clamp(17px,2.2vh,24px); border-radius: 999px; background: rgba(0,0,0,0.35); border: 2px solid var(--gv-ink); overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,0.6); }
.home2-xp-fill { position: relative; height: 100%; border-radius: 0; background: linear-gradient(180deg, #cdefff 0%, #86d2ff 46%, #4fb0f0 100%); box-shadow: inset 0 2px 0 rgba(255,255,255,0.55), inset 0 -3px 6px rgba(30,110,190,0.4); transition: width .3s var(--ease-out); }
.home2-xp-text { font-family: var(--font-ui); font-weight: 800; font-size: clamp(12px,1vw,15px); color: var(--gold-bright); white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.home2-wallet { display: flex; align-items: center; gap: clamp(8px,0.9vw,14px); }
/* Monedero: solo icono + cifra (sin contorno ni fondo). */
.home2-coin {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: none; border: none; border-radius: 13px; padding: clamp(4px,0.5vh,7px) clamp(4px,0.4vw,7px);
  transition: transform .12s, filter .18s;
}
.home2-coin img { width: clamp(26px,2vw,34px); height: clamp(26px,2vw,34px); object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); }
.home2-coin b { font-family: var(--font-display); font-weight: 400; font-size: clamp(16px,1.35vw,22px); color: var(--gold-bright); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
@media (hover: hover) and (pointer: fine) { .home2-coin:hover { transform: translateY(-1px); filter: brightness(1.12) drop-shadow(0 0 10px rgba(245,193,74,0.4)); } }


/* --- Hero row: play | (banner + quick tiles). Grows to fill the free vertical space,
   but the deck strip below books its room FIRST (it is the section this page is for). --- */
.home2-hero { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: 1.16fr 1fr; gap: clamp(12px,1.4vw,24px); }
/* Right column of the hero: the set banner takes the slack, the tiles sit under it. */
.home2-side { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: clamp(10px,1.1vh,16px); }
.home2-play { position: relative; height: 100%; min-height: 0; display: flex; align-items: center; gap: clamp(12px,1.5vw,26px); padding: clamp(12px,1.6vh,26px) clamp(14px,1.6vw,28px); padding-left: clamp(24px,3vw,54px); }
.home2-play-glow { position: absolute; inset: 0; background: radial-gradient(120% 90% at 30% 45%, rgba(245,193,74,0.17), transparent 62%); pointer-events: none; }
/* Featured cards fanned; the deck's PRIMARY card (feat[0]) sits in the MIDDLE, on top. */
.home2-play-cards { --fanx: 30%; --fanrot: 8deg; --fanw: 62%; position: relative; z-index: 1; flex: 0 0 auto; width: min(clamp(150px,30vh,340px), 42%); height: clamp(128px,26vh,290px); }
.home2-play-card { position: absolute; top: 50%; left: 50%; width: var(--fanw); z-index: 1; transform: translate(-50%,-50%) rotate(calc((var(--i) - 1) * var(--fanrot))) translateX(calc((var(--i) - 1) * var(--fanx))); transition: transform .28s var(--ease-out); }
.home2-play-card:nth-child(2) { z-index: 2; }
.home2-play-card .card { width: 100%; height: auto; display: block; }
@media (hover: hover) and (pointer: fine) { .home2-play:hover .home2-play-card { transform: translate(-50%,-50%) rotate(calc((var(--i) - 1) * var(--fanrot))) translateX(calc((var(--i) - 1) * var(--fanx))) translateY(-5px) scale(1.02); } }
/* the locked Starter Deck: its 3D box turning (DeckBox, deckbox.css), with a soft yellow glow */
/* `.db-fx-host` (deckbox.css) sets position:relative + overflow:hidden: beat both, or the box is 0 px tall */
/* it takes the pointer (hover pauses its turn); the 3D scene inside stays inert (deckbox.css) */
.home2-play-box, .home2-play-box.db-fx-host { position: absolute; inset: -6% -4% -10%; overflow: visible; pointer-events: auto;
  filter: drop-shadow(0 0 6px rgba(255, 214, 102, 0.55)) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45)); }
.home2-play-cards-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; opacity: 0.4; }
.home2-play-cards-empty img { width: 50%; }
.home2-play-info { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.home2-play-deck { font-family: var(--font-display); font-weight: 400; font-size: clamp(20px,2.2vw,34px); color: var(--text); letter-spacing: 0.02em; line-height: 1.05; }
.home2-play-meta { font-family: var(--font-ui); font-weight: 700; font-size: clamp(12px,1vw,15px); }
.home2-play-meta.ok { color: var(--success); }
.home2-play-meta.bad { color: var(--warning); }
/* The line under PLAY while the Starter Deck is still unearned ("Complete the tutorial to
   get your starter deck."). Quiet on purpose: the panel already shouts START TUTORIAL, so
   this only has to say why. */
.home2-play-hint {
  font-family: var(--font-body, "Space Grotesk", system-ui, sans-serif);
  font-weight: 500; font-size: clamp(11px, 0.92vw, 14px); line-height: 1.35;
  color: var(--gold-bright, #fde68a); max-width: 30ch;
  margin-top: 8px;   /* a little air under the PLAY button */
}
/* LA CAJA DE LAS DOS LLAMADAS A LA ACCIÓN DEL HOME (PLAY y la chapa SHOP del banner).
   Tienen que medir lo MISMO y viven en contenedores distintos, así que la medida se
   declara una vez aquí y las dos la leen: por construcción no pueden separarse.
   Los números salen de lo que PLAY ya medía — sus propios `clamp` de relleno y cuerpo,
   más dos constantes medidas sobre el render en Lilita One:
     · 1.146 = alto de la caja de línea / tamaño de fuente
     · 3.107 = ancho de "▶ PLAY" (con su hueco de 10px aparte) / tamaño de fuente
   Comprobado a 13 anchos entre 360 y 1920: PLAY sale igual que antes al píxel. */
:root {
  --home-cta-pad-y: clamp(10px, 1vw, 15px);
  --home-cta-pad-x: clamp(22px, 2.2vw, 40px);
  --home-cta-font: clamp(18px, 1.7vw, 27px);
  --home-cta-h: calc(2 * var(--home-cta-pad-y) + 1.146 * var(--home-cta-font));
  --home-cta-w: calc(2 * var(--home-cta-pad-x) + 10px + 3.107 * var(--home-cta-font));
}
.home2-play-btn {
  position: relative; isolation: isolate;
  margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  width: var(--home-cta-w); height: var(--home-cta-h);
  font-family: var(--font-display); font-weight: 400; font-size: var(--home-cta-font); letter-spacing: 0.06em; color: #3a2705;
  background: var(--gold-face); border: none; border-radius: 14px; padding: 0;
  box-shadow: var(--gold-relief); transition: transform .12s, box-shadow .18s;
}
@media (hover: hover) and (pointer: fine) { .home2-play-btn:hover { transform: translateY(-2px); box-shadow: var(--gold-relief-hover); } }
.home2-play-btn:active { transform: translateY(1px); box-shadow: var(--gold-relief-press); }
.home2-play-tri { font-size: 0.78em; }

/* EL CARTEL DE NOVEDADES. La caja es la de siempre — una casilla de la rejilla del hero —
   y lo que cambia cada 20 s es lo de DENTRO: las novedades van APILADAS aqui (`.home2-slide`,
   absolutas) y se funden entre si. Por eso el banner no declara fondo propio: cada novedad
   trae el suyo. */
.home2-banner {
  display: block; text-align: left; padding: 0; flex: 1 1 auto; height: auto; min-height: 0;
  background: linear-gradient(180deg, rgba(32,48,80,0.72), rgba(10,18,34,0.86));
  /* El arte de la novedad tapa el fondo entero, asi que el desenfoque que hereda de
     `.home2-panel` no se veria: seria un blur del tamano del banner por frame para nada. */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* Una novedad. Todas ocupan el MISMO hueco y solo se ve la activa.
   `visibility` ademas de `opacity` para que la apagada no reciba el raton ni salga en el
   orden de lectura; se retrasa hasta que acaba el fundido para no cortarlo.
   LA ACTIVA VA EN FLUJO y las demas absolutas encima, no todas absolutas: en pantalla
   ancha el banner es una casilla de rejilla y su alto lo pone la fila, pero en la TIRA
   compacta (<=900) el alto sale del CONTENIDO — con todas absolutas no habria contenido
   que lo diera y la tira se quedaba en su `min-height`, con el titulo cortado. Las dos
   novedades tienen las mismas lineas ahi (el precio se esconde), asi que al rotar no hay
   salto de alto. */
.home2-slide {
  /* Cada novedad es SU boton (el envoltorio es un div), asi que aqui va tambien el reseteo
     de chapa: el marco y el fondo los pone `.home2-panel` / la regla de cada novedad. */
  position: absolute; inset: 0; display: block;
  /* `width: 100%` NO sobra: un `<button>` se dimensiona a su CONTENIDO aunque sea
     `display: block`, asi que la novedad activa (que va en flujo) se encogia a la mitad del
     cartel y su fondo dejaba el resto al aire. */
  width: 100%;
  margin: 0; padding: 0; border: 0; border-radius: inherit;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; visibility: hidden;
  transition: opacity .7s ease, visibility 0s linear .7s;
}
/* `height` y no `min-height`: el texto de dentro se centra con `height: 100%`, y un
   porcentaje solo resuelve contra una altura DEFINIDA — con `min-height` la de la
   diapositiva sigue siendo `auto` y el rotulo se iba arriba del todo. Y `height: 100%`
   sirve para los dos casos: contra la casilla de rejilla (alto definido) llena el banner, y
   en la tira compacta, cuyo alto es `auto`, se resuelve a `auto` y manda el contenido. */
.home2-slide.on {
  position: relative; inset: auto; height: 100%;
  opacity: 1; visibility: visible; transition: opacity .7s ease, visibility 0s;
}
/* El fondo de cada una. El del lote es el MISMO bosque bitcoin de su ficha en la tienda:
   las dos caras de la misma oferta tienen que reconocerse. El velo plano es relleno, no
   ilustracion — el titulo dorado y el arte tienen que seguir mandando. */
.home2-slide.is-set {
  background:
    linear-gradient(90deg, rgba(4,11,24,0.74), rgba(4,11,24,0.5) 58%, rgba(4,11,24,0.56)),
    url("../UI/AOTW_bg.jpg") center / cover no-repeat;
}
.home2-slide.is-genesis {
  background:
    linear-gradient(90deg, rgba(4,11,24,0.74), rgba(4,11,24,0.5) 58%, rgba(4,11,24,0.56)),
    url("../UI/satoshi_banner.jpg") center / cover no-repeat;
}
.home2-slide.is-bundle {
  background:
    linear-gradient(90deg, rgba(6,10,20,0.80), rgba(6,10,20,0.52) 58%, rgba(6,10,20,0.58)),
    url("../UI/bitcoin_forest.jpg") center 58% / cover no-repeat;
}
/* LA SKIN CYBERPUNK LARRY (sustituye al lote cuando caduca su oferta): su propia ciudad neon
   (recorte reducido de `leverage_larry_cyber_bg.jpg`) y un halo verde lima, el de sus neones. */
.home2-slide.is-cyber {
  background:
    linear-gradient(90deg, rgba(6,10,20,0.84), rgba(6,10,20,0.5) 58%, rgba(6,10,20,0.5)),
    url("../UI/cyber_larry_banner.jpg") center 40% / cover no-repeat;
}
/* LOS EMOJIS DE LARRY: sin ilustracion de fondo, un degradado en el verde del lote. */
.home2-slide.is-emojis {
  background:
    radial-gradient(70% 110% at 76% 50%, rgba(126,217,87,0.30), transparent 62%),
    linear-gradient(135deg, #10301f 0%, #0a1a14 55%, #06101a 100%);
}
.home2-banner-glow { position: absolute; inset: 0; display: block; background: radial-gradient(90% 120% at 82% 50%, rgba(96,165,250,0.20), transparent 55%); }
/* El halo del lote va en oro, que es su color en la tienda. */
.home2-slide.is-bundle .home2-banner-glow { background: radial-gradient(90% 120% at 78% 52%, rgba(245,193,74,0.20), transparent 55%); }
/* Right-side art stack: the chase card peeks out from BEHIND the pack. */
.home2-banner-media { position: absolute; inset: 0 0 0 auto; display: block; width: 52%; z-index: 1; pointer-events: none; }
.home2-banner-card { position: absolute; z-index: 1; right: 42%; top: 62%; transform: translateY(-50%) rotate(-8deg); width: 52%; filter: drop-shadow(-8px 14px 22px rgba(0,0,0,0.62)); }
.home2-banner-card .card { width: 100%; height: auto; display: block; }
.home2-slide.is-cyber .home2-banner-glow { background: radial-gradient(90% 120% at 78% 52%, rgba(126,255,120,0.18), transparent 55%); }
/* Rotulos en VERDE NEON (los de sus neones), y NEW SKIN late. */
.home2-slide.is-cyber .home2-banner-title { color: #8dff6a; text-shadow: 0 0 10px rgba(110,255,90,0.75), 0 0 26px rgba(70,255,90,0.45), 0 2px 8px rgba(0,0,0,0.6); }
.home2-slide.is-cyber .home2-kicker { color: #8dff6a; text-shadow: 0 0 8px rgba(110,255,90,0.8); animation: cyberKickerPulse 1.4s ease-in-out infinite; transform-origin: left center; }
@keyframes cyberKickerPulse {
  0%, 100% { opacity: 0.75; transform: scale(1); text-shadow: 0 0 6px rgba(110,255,90,0.55); }
  50%      { opacity: 1;    transform: scale(1.08); text-shadow: 0 0 14px rgba(140,255,110,1), 0 0 28px rgba(80,255,90,0.7); }
}
@media (prefers-reduced-motion: reduce) { .home2-slide.is-cyber .home2-kicker { animation: none; } }
.home2-slide.is-emojis .home2-banner-glow { background: none; }
/* La figura de Cyberpunk Larry (apoyada en el borde de abajo: el recorte llega a la cadera) y,
   a su derecha, la carta con la skin. */
.home2-banner-figure { position: absolute; z-index: 1; bottom: -16%; left: -11%; height: 114%; aspect-ratio: 675 / 720; pointer-events: none; }
.home2-banner-figure > img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 18px rgba(110,255,90,0.28)) drop-shadow(0 12px 22px rgba(0,0,0,0.6)); }
/* Capas sobre la figura recortadas con las mascaras de la skin (mismo marco, 675x720). */
.cyber-fig-blade, .cyber-fig-shoulder {
  position: absolute; inset: 0;
  -webkit-mask: var(--m) center / 100% 100% no-repeat; mask: var(--m) center / 100% 100% no-repeat;
}
/* EL REFLEJO DE LA ESPADA: una franja de luz lima que la recorre de la punta a la empuñadura
   cada ~6 s y el resto del tiempo no se ve. */
.cyber-fig-blade {
  --m: url("../UI/cyber_larry_blade_mask.png");
  background: linear-gradient(100deg, transparent 42%, rgba(210,255,170,0.95) 49%, rgba(150,255,110,0.9) 51%, transparent 58%) no-repeat;
  background-size: 300% 100%; background-position: 100% 0;
  mix-blend-mode: screen;
  animation: cyberBladeGlint 6s ease-in-out infinite;
}
@keyframes cyberBladeGlint {
  0%, 68%  { background-position: 100% 0; }
  86%, 100% { background-position: 0% 0; }
}
/* EL FOCO DEL HOMBRO: late suave (el verde se aviva y se apaga) con un halo detras. */
.cyber-fig-shoulder {
  --m: url("../UI/cyber_larry_shoulder_mask.png");
  background: radial-gradient(circle at 27% 27%, #eaffc4 0%, #9dff63 9%, #4fe03a 18%);
  mix-blend-mode: screen; opacity: 0.25;
  animation: cyberShoulderPulse 2.4s ease-in-out infinite;
}
@keyframes cyberShoulderPulse { 0%, 100% { opacity: 0.18; } 50% { opacity: 0.6; } }
.cyber-fig-halo {
  position: absolute; left: 26.8%; top: 27.5%; width: 26%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; background: radial-gradient(circle, rgba(150,255,100,0.55) 0%, rgba(90,255,80,0.18) 42%, transparent 70%);
  mix-blend-mode: screen; opacity: 0.4;
  animation: cyberShoulderPulse 2.4s ease-in-out infinite;
}
/* CHISPAS: puntitos verdes que salen del foco y se apagan, cada uno con su rumbo y su retraso. */
.cyber-fig-sparks { position: absolute; left: 26.8%; top: 27.5%; width: 0; height: 0; }
.cyber-fig-sparks i {
  position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%;
  background: #d8ffb0; box-shadow: 0 0 6px 1px rgba(120,255,90,0.9);
  opacity: 0;
  --dx: calc((var(--k) - 3) * 9px); --dy: calc(-26px - var(--k) * 4px);
  animation: cyberSpark 2.8s ease-out infinite; animation-delay: calc(var(--k) * -0.4s);
}
.cyber-fig-sparks i:nth-child(odd) { width: 3px; height: 3px; }
@keyframes cyberSpark {
  0%   { opacity: 0; transform: translate(0, 0) scale(1); }
  15%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .cyber-fig-blade, .cyber-fig-shoulder, .cyber-fig-halo, .cyber-fig-sparks i { animation: none; }
  .cyber-fig-sparks { display: none; }
}
.home2-banner-card.is-skin { right: 6%; top: 52%; width: 44%; z-index: 2; transform: translateY(-50%) rotate(5deg); }
/* NITIDEZ EN REPOSO: plana, la carta se pinta dentro de la capa girada del cartel y sale BORROSA
   (se afilaba solo al inclinarla). Con la misma transformacion 3D de la inclinacion (casi nula)
   se rasteriza aparte y queda igual de nitida quieta que inclinada (medido, 2026-10-30).
   `clearFoilTilt` borra el estilo en linea y vuelve a esta regla. */
.home2-banner-card.is-skin .card { transform: perspective(1300px) rotateY(0.01deg); }
.home2-slide.is-emojis .home2-banner-media { display: flex; align-items: center; justify-content: center; }
.home2-slide.is-emojis .emoji-bundle-art { position: relative; z-index: 1; width: 82%; }
/* La linea de la novedad (lo que trae), bajo el titulo. */
.home2-banner-line { font-family: var(--font-body, inherit); font-weight: 700; font-size: clamp(13px, 1.05vw, 17px); line-height: 1.25; color: rgba(235, 242, 255, 0.88); text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
/* EL ABANICO DEL LOTE: su carta delante y los dos sobres que trae abiertos por detras —
   lo que se compra, en una imagen. Los sobres van girados al reves que la carta, que es lo
   que los hace leer como "lo que hay detras" y no como piezas sueltas (la misma receta que
   el banner del lote en la tienda). */
/* LA COMPOSICION DEL LOTE es LA MISMA pieza que la de su ficha en la tienda (`BundleCompo`,
   mismas clases): sobres a los lados, carta en el centro, impacto abajo a la izquierda,
   dorso abajo a la derecha, y el contorno sutil iluminado que trae `.bundle-compo`. Aqui
   solo se cambia lo que MIDE.
   Y se mide por ALTURA: en la tienda el ancho lo pone su columna, pero el cartel es una
   casilla de rejilla que cambia de proporcion con la ventana, y en % del ANCHO la carta se
   sale por abajo en cuanto la casilla se achata. Con el `aspect-ratio` puesto al mismo
   alto/ancho que tiene en la tienda (324x356, medido), todos los porcentajes de dentro —los
   sobres, el impacto, el dorso— caen donde caen alli. */
.home2-banner-media .bundle-compo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  height: 74%; width: auto; aspect-ratio: 324 / 356;
}
/* SIN la coreografia de entrada. Es de la ficha de la tienda, que se REMONTA cada vez que
   se elige el lote y por eso puede permitirsela; aqui la composicion se monta UNA vez, con
   el cartel de la coleccion puesto, asi que el pop se reproduciria donde nadie lo ve y lo
   unico que quedaria de el es un `backwards` colgando de un subarbol invisible.
   OJO: el `transform` de las pilas (su centrado) NO es de la animacion, es su regla normal,
   asi que apagar la animacion no las mueve de sitio. */
.home2-banner-media .bundle-card,
.home2-banner-media .bundle-compo-stack,
.home2-banner-media .bundle-compo-fx,
.home2-banner-media .bundle-compo-burst,
.home2-banner-media .bundle-compo-back { animation: none; }
/* La carta ocupa la misma fraccion del conjunto que en la tienda (0,756 medido). */
.home2-banner-media .bundle-card { width: 75.6%; height: auto; }
/* LOS SOBRES, mas grandes y con el abanico MAS ABIERTO que en la tienda. Es la unica pieza
   que se aparta a proposito de la colocacion de alli, y el motivo es la forma del sitio: la
   ficha de la tienda es una columna estrecha y alta, donde un abanico abierto se sale; el
   cartel del home es apaisado y ancho, y con la apertura de la tienda los sobres quedaban
   casi enteros detras de la carta — pequenos y escondidos. */
.home2-banner-media .bundle-compo-stack { width: 50%; --fan-a0: 15deg; --fan-step: 7.5deg; }
/* Y el abanico abierto necesita SITIO: en la novedad del lote la caja del arte se lleva un
   64% del cartel (contra el 52% de la otra) y el rotulo se queda en un 40%, que ademas parte
   "Welcome Pack" en dos lineas en las pantallas anchas. Sin esto, el titulo cabia en una sola
   linea a 1920 y se metia encima del primer sobre. */
.home2-slide.is-bundle .home2-banner-media { width: 64%; }
.home2-slide.is-bundle .home2-banner-text { max-width: 40%; }
/* La transicion es lo que hace SUAVE la vuelta a plano al sacar el raton; `applyFoilTilt`
   ya se encarga del `will-change` (solo mientras se mueve, para que quieta pinte nitida). */
.home2-banner-media .bundle-card .card { transition: transform .18s var(--ease-out); }
/* En la tienda el impacto y el dorso van en `clamp(..., vw, ...)` porque su columna es
   estrecha; aqui se piden en % del conjunto, que es lo que los deja en la misma proporcion
   que alli (0,445 y 0,576 medidos) escale como escale el cartel. */
.home2-banner-media .bundle-compo-fx-wrap { width: 44.5%; }
.home2-banner-media .bundle-compo-back { width: 41%; }
/* LAS RAYAS, centradas en la CARTA. La capa se ancla a la caja del arte —donde vive la
   composicion, centrada— y el degradado nace en su propio 50/50, asi que el punto de fuga
   cae en el centro de la carta sin tener que calcularlo. `inset` negativo para que, siendo
   hija de esa caja, cubra el cartel entero; lo recorta el `overflow` del panel. */
.home2-banner-rays {
  position: absolute; inset: -150%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(from calc(-4deg + var(--raysAngle)) at 50% 50%,
    rgba(255, 214, 112, 0.13) 0deg 5deg,
    rgba(255, 214, 112, 0) 5deg 11.5deg);
}
/* LOS CONTROLES: dicen cuantas novedades hay, cual se ve, y CAMBIAN de una a otra al
   pulsarlos. Son botones de verdad — por eso el envoltorio del cartel es un `<div>` y no un
   `<button>`. Centrados abajo, que es donde se buscan en un carrusel. La chapa oscura de
   detras es lo que los separa de un fondo ilustrado: sueltos sobre el arte no se veian. */
.home2-banner-dots {
  position: absolute; z-index: 4; display: flex; align-items: center; gap: 7px;
  left: 50%; transform: translateX(-50%); bottom: clamp(10px, 1.2vw, 18px);
  padding: clamp(5px, 0.5vw, 8px) clamp(8px, 0.8vw, 12px);
  border-radius: 999px;
  background: rgba(6, 11, 22, 0.42);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  border: 1px solid rgba(3, 7, 15, 0.5);
}
/* La zona de pulsacion es MAYOR que el punto: el punto mide 8 px y eso no se acierta con el
   dedo. El `::before` es la diana (28 px), el fondo del propio boton es la marca. */
.home2-banner-dot {
  position: relative; flex: 0 0 auto;
  width: 9px; height: 9px; padding: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(3, 7, 15, 0.55);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .3s ease, width .35s var(--ease-out);
}
.home2-banner-dot::before { content: ''; position: absolute; inset: -10px; border-radius: 999px; }
.home2-banner-dot.on { width: 24px; background: var(--gold-bright); }
@media (hover: hover) and (pointer: fine) {
  .home2-banner-dot:not(.on):hover { background: rgba(255, 255, 255, 0.72); }
}
.home2-banner-dot:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.home2-banner-art { position: absolute; z-index: 2; right: -7%; top: 50%; transform: translateY(-50%) rotate(6deg); height: 120%; max-width: 74%; object-fit: contain; filter: drop-shadow(0 14px 26px rgba(0,0,0,0.6)); pointer-events: none; transition: transform .3s var(--ease-out); }
.home2-banner-text { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: clamp(18px,2vw,32px); max-width: 48%; height: 100%; justify-content: center; }
.home2-banner-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(20px,2.1vw,32px); color: var(--gold-bright); line-height: 1.06; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
/* La llamada a la acción SÍ lleva chapa: el banner entero sigue siendo el `<button>`
   (se puede pulsar donde sea), pero sin un marco el icono + la palabra flotaban sueltos
   sobre una ilustración y no se leían como algo pulsable. La chapa es la del resto de la
   UI — transparente de verdad (el cuerpo lo pone el DESENFOQUE, no la opacidad), contorno
   de tinta y las dos bandas planas de relieve; los mismos tokens que los contadores.
   Es un `<span>`, no un `<button>`: un botón dentro de otro es HTML inválido. El sonido
   de pulsación/hover lo pone el UIKit, que la tiene en su lista de botones (index.html).
   La flecha se fue con el marco: la chapa ya dice que se puede pulsar. */
.home2-banner-cta {
  align-self: flex-start;
  margin-top: clamp(4px, 0.6vh, 10px);
  /* El `gap` es casi cero A PROPOSITO: `icons/nav/shop.png` trae un 19% de transparencia
     por cada lado (48 px de margen en un lienzo de 256, medido sobre el alfa), asi que el
     hueco visible entre el dibujo y la palabra ya lo pone el propio PNG. Con un gap normal
     el icono se leia suelto, sin relacion con el texto. */
  display: inline-flex; align-items: center;
  /* Misma letra que el botón PLAY. Ojo: PLAY declara `var(--font-display)` (Bowlby One)
     y NO es lo que se ve — el retrofit del kit cartoon, ~9500 líneas más abajo, le pisa
     la familia con Lilita One. Se copia la pila de allí, que es la que manda. El COLOR sí
     se queda como estaba: el de PLAY es un marrón oscuro que funciona sobre su chapa de
     oro y aquí, sobre cristal oscuro, no se leería. */
  font-family: 'Lilita One', 'Bowlby One', var(--font-display), sans-serif; font-weight: 400;
  font-size: clamp(15px, 1.5vw, 23px); letter-spacing: 0.04em;
  color: var(--player-bright); text-shadow: 0 2px 8px rgba(0,0,0,0.55);
  /* La MISMA caja que PLAY (ver `--home-cta-*` arriba). El contenido se centra dentro:
     cabe de sobra a todos los anchos (a 1440 mide 112 de los 149 que hay). */
  width: var(--home-cta-w); height: var(--home-cta-h);
  justify-content: center;
  /* Sin relleno: la chapa lleva SOLO la palabra y se centra en su caja. El relleno que
     habia a la derecha compensaba el lienzo transparente del icono, que ya no esta. */
  padding: 0;
  /* Radio 14 y no una píldora: es el de todas las chapas pulsables del kit
     (`.settings-fold`, `.settings-msg`…) y a esta altura un 999px se abomba. */
  border-radius: 14px;
  border: 2px solid var(--gv-ink, #070f1d);
  background: var(--counter-face);
  -webkit-backdrop-filter: var(--counter-blur);
  backdrop-filter: var(--counter-blur);
  box-shadow: var(--counter-relief);
  transition: transform .18s var(--ease-out), box-shadow .18s ease;
}
@media (hover: hover) and (pointer: fine) { .home2-banner:hover .home2-banner-art { transform: translateY(-50%) rotate(4deg) scale(1.03); } }
/* La chapa se levanta un pelo al pasar por encima y se hunde al pulsar — el mismo
   gesto que los botones del kit, hecho con el relieve que ya tiene. */
@media (hover: hover) and (pointer: fine) {
  .home2-banner:hover .home2-banner-cta {
    transform: translateY(-1px);
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.3),
      inset 0 -4px 0 rgba(0, 0, 0, 0.3),
      0 7px 14px -7px rgba(0, 0, 0, 0.75);
  }
}
.home2-banner:active .home2-banner-cta {
  transform: translateY(1px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    0 2px 6px -4px rgba(0, 0, 0, 0.7);
}

/* --- Quick tiles --- */
.home2-tiles { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(10px,1.1vw,18px); }
.home2-tile { display: flex; flex-direction: row; align-items: center; gap: clamp(9px,0.9vw,16px); cursor: pointer; text-align: left; padding: clamp(10px,1.3vh,18px) clamp(12px,1.2vw,20px); min-height: clamp(72px,11vh,150px); transition: transform .14s var(--ease-out), box-shadow .18s, border-color .15s; }
.home2-tile-text { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(2px,0.4vh,5px); min-width: 0; }
@media (hover: hover) and (pointer: fine) { .home2-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 22px 44px -20px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255,255,255,0.1); } }
.home2-tile-icon-wrap { flex: 0 0 auto; width: clamp(48px,5.6vh,86px); height: clamp(48px,5.6vh,86px); display: flex; align-items: center; justify-content: center; }
.home2-tile-icon { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); }
.home2-tile-label { font-family: var(--font-ui); font-weight: 800; font-size: clamp(11px,0.95vw,14px); letter-spacing: 0.06em; color: var(--text); text-transform: uppercase; }
.home2-tile-value { font-family: var(--font-display); font-weight: 400; font-size: clamp(18px,1.7vw,26px); color: var(--gold-bright); font-variant-numeric: tabular-nums; line-height: 1; }
.home2-tile-sub { font-family: var(--font-ui); font-weight: 600; font-size: 11px; color: var(--text-dim); }

/* --- Deck strip --- */
.home2-decks { flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; gap: clamp(6px,0.9vh,12px); }
.home2-section-head { display: flex; align-items: center; gap: clamp(9px,1vw,15px); }
/* El titulo y el contador son el UNICO texto del home que se apoya directamente en la
   ilustracion, sin panel debajo: sobre las rocas y la hierba el dorado se perdia. Se
   quedan al aire a proposito (nada de chapa) y lo que los despega es la sombra: un
   desplazamiento corto de tinta, como el contorno del kit cartoon, mas un halo difuso
   que apaga el dibujo justo detras de las letras. */
.home2-section-title { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 400; font-size: clamp(16px,1.5vw,26px); color: var(--gold-bright); text-shadow: 0 2px 0 rgba(7,15,29,0.55), 0 4px 14px rgba(0,0,0,0.75); }
.home2-section-title img { width: clamp(30px,2.6vw,46px); height: clamp(30px,2.6vw,46px); object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
/* Slots usados / totales, junto al título. */
.home2-deck-slots { flex: 0 0 auto; font-family: var(--font-display); font-weight: 400; font-size: clamp(13px,1.15vw,20px); color: var(--text-dim); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(7,15,29,0.55), 0 4px 14px rgba(0,0,0,0.75); }
/* Paginacion de la tira de mazos (5 por pagina): arriba a la DERECHA de la cabecera. Mismos botones que
   el paginador de Referrals (.friend-icon-btn), un poco mas pequenos. */
.home2-deck-pager { margin-left: auto; display: flex; align-items: center; gap: clamp(6px,0.6vw,10px); }
.home2-deck-pager-btn.friend-icon-btn { width: clamp(30px,2.4vw,38px); height: clamp(30px,2.4vw,38px); font-family: var(--font-display); font-size: clamp(19px,1.5vw,24px); line-height: 1; color: var(--gold-bright); padding-bottom: 3px; }
.home2-deck-pager-btn.friend-icon-btn:disabled { opacity: 0.35; cursor: default; }
.home2-deck-pager-n { min-width: 46px; text-align: center; font-family: var(--font-display); font-size: clamp(13px,1.15vw,20px); color: var(--text-dim); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(7,15,29,0.55), 0 4px 14px rgba(0,0,0,0.75); }
/* Icon-only "new deck" button, sitting right next to the DECKS title. */
.home2-new-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 12px; padding: clamp(4px,0.4vw,6px); width: clamp(38px,3.1vw,50px); height: clamp(38px,3.1vw,50px); transition: background .15s, border-color .15s, transform .12s, box-shadow .18s; }
.home2-new-btn img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45)); }
@media (hover: hover) and (pointer: fine) { .home2-new-btn:hover { background: var(--surface-2); border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 0 12px rgba(245,193,74,0.25); } }
.home2-deck-strip { display: flex; align-items: stretch; gap: clamp(10px,1.1vw,18px); overflow-x: auto; overflow-y: hidden; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
/* --fanx scales with the tile so the 3-card fan always clears its edges. */
/* Los slots son 5 fijos, así que se ENCOGEN para caber en la fila (el ancho de antes es su
   tope) y solo se scrollea cuando ni al mínimo caben — antes el 5º quedaba siempre cortado. */
.home2-deck { --fanx: clamp(22px,4.3vh,54px); position: relative; flex: 1 1 clamp(200px,32vh,390px); width: auto; min-width: 176px; max-width: clamp(200px,32vh,390px); scroll-snap-align: start; display: flex; flex-direction: column; gap: clamp(6px,0.9vh,12px); padding: clamp(10px,1vw,16px); cursor: pointer; text-align: left; background: var(--home-glass-face); -webkit-backdrop-filter: var(--home-glass-blur); backdrop-filter: var(--home-glass-blur); border: 1px solid var(--border-strong); border-radius: 16px; transition: transform .15s var(--ease-out), border-color .15s; }
@media (hover: hover) and (pointer: fine) { .home2-deck:hover { transform: translateY(-3px); border-color: var(--gold); } }
.home2-deck-cards { position: relative; height: clamp(92px,22vh,270px); display: flex; align-items: center; justify-content: center; }
.home2-deck-card { position: absolute; width: clamp(72px,16vh,196px); z-index: 1; transform: rotate(calc((var(--i) - 1) * 9deg)) translateX(calc((var(--i) - 1) * var(--fanx))); }
.home2-deck-card:nth-child(2) { z-index: 2; }
.home2-deck-card .card { width: 100%; height: auto; }
.home2-deck-cards-empty { opacity: 0.35; } .home2-deck-cards-empty img { width: clamp(54px,8vh,88px); }
/* A still DECK BOX (DeckBoxView): the 3D box centred and scaled to its host */
.dbv { position: relative; perspective: 1400px; perspective-origin: 50% 40%; }
.dbv-scale { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.dbv-scale .db-box { left: 0; top: 0; }
/* HOME/DECKS: the deck's BOX by default; on hover it steps aside and the 3 featured cards fan out
   (the middle one is the primary; 2 and 3 open outwards from behind it). Leaving brings the box back. */
.home2-deck-box { position: absolute; inset: 2% 0; z-index: 3; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.45)); transition: opacity .18s var(--ease-out), transform .22s var(--ease-out); }
.home2-deck-cards.has-box .home2-deck-card { opacity: 0; transform: rotate(0deg) translateX(0) scale(0.9);
  transition: opacity .16s var(--ease-out), transform .32s cubic-bezier(.2,.9,.3,1.25); }
@media (hover: hover) and (pointer: fine) {
  .home2-deck:hover .home2-deck-cards.has-box .home2-deck-card { opacity: 1;
    transform: rotate(calc((var(--i) - 1) * 9deg)) translateX(calc((var(--i) - 1) * var(--fanx))); }
}
@media (hover: hover) and (pointer: fine) { .home2-deck:hover .home2-deck-box { opacity: 0; transform: scale(0.88); } }
.home2-deck-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; }
.home2-deck-name { font-family: var(--font-ui); font-weight: 800; font-size: clamp(15px,1.7vh,19px); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home2-deck-count { font-family: var(--font-ui); font-weight: 700; font-size: clamp(12px,1.35vh,15px); }
.home2-deck-count.ok { color: var(--success); }
.home2-deck-count.bad { color: var(--warning); }
/* Lapiz suelto, sin chapa ni marco: solo el glifo monocromo (como el del avatar). */
.home2-deck-edit { position: absolute; top: 10px; right: 10px; z-index: 3; width: 30px; height: 30px; background: none; border: 0; box-shadow: none; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.8); cursor: pointer; font-size: 17px; line-height: 1; opacity: 0; transition: opacity .15s; }
@media (hover: hover) and (pointer: fine) { .home2-deck:hover .home2-deck-edit { opacity: 0.75; } }
/* (0,4,0): el selector del tile ya es (0,3,0), un `.home2-deck-edit:hover` suelto pierde. */
@media (hover: hover) and (pointer: fine) { .home2-deck:hover .home2-deck-edit:hover { opacity: 1; } }
.home2-deck-add { border-style: dashed; color: var(--text-dim); }
/* el alto lo da el esqueleto invisible de un mazo lleno (DeckTileSizer); el icono + NEW van centrados encima */
.home2-deck-sizer { display: flex; flex-direction: column; gap: inherit; visibility: hidden; pointer-events: none; }
.home2-deck-add-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) and (pointer: fine) { .home2-deck-add:hover { color: var(--gold-bright); } }
/* Slot libre más allá del botón NEW: solo el hueco, sin acción. El contorno de `.home2-deck`
   es tinta (casi negro) y sobre el fondo oscuro no se leería, así que aquí va punteado y en
   un azul apagado; el `box-shadow` en relieve del bloque `--gv-*` también se anula.
   OJO: eso ULTIMO ya no es cierto — el bloque `--gv-*` vive al FINAL del fichero y gana
   por orden (misma especificidad, 0-1-0), asi que el borde y el relieve que se aplican hoy
   son los suyos y estas dos lineas son letra muerta. Lo unico vivo aqui es el fondo.
   El hueco NO es una superficie: vuelve al velo translucido de siempre (0.3) y renuncia
   al desenfoque que `.home2-deck` pone para las piezas llenas. El cristal apagado lo
   convertia en una pieza mas, y un slot libre tiene que dejar ver el fondo. */
.home2-deck-empty {
  cursor: default;
  background: rgba(6,12,24,0.3);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 2px dashed rgba(150,180,225,0.3);
  box-shadow: inset 0 0 22px rgba(0,0,0,0.35);
}
@media (hover: hover) and (pointer: fine) { .home2-deck-empty:hover { transform: none; border-color: rgba(150,180,225,0.3); } }
.home2-deck-add-icon { width: clamp(40px,6.5vh,74px); height: clamp(40px,6.5vh,74px); object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); opacity: 0.9; transition: opacity .15s, transform .15s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .home2-deck-add:hover .home2-deck-add-icon { opacity: 1; transform: translateY(-2px); } }
.home2-deck-add-label { font-family: var(--font-ui); font-weight: 800; font-size: clamp(13px,1.5vh,17px); letter-spacing: 0.06em; }

/* --- Motion: staggered entrance + idle polish (fill-mode `backwards` so the
   settled state reverts to the element's own styles → hover transforms still work) --- */
@keyframes home2Rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes home2Breathe {
  0%, 100% { box-shadow: 0 0 11px 0 rgba(245,193,74,0.32); opacity: 0.75; }
  50%      { box-shadow: 0 0 26px 6px rgba(245,193,74,0.68); opacity: 1; }
}
@keyframes home2XpShine { 0% { background-position: 185% 0; } 55%, 100% { background-position: -85% 0; } }
.home2-bar   { animation: home2Rise 0.5s var(--ease-out) 0.03s backwards; }
.home2-hero  { animation: home2Rise 0.55s var(--ease-out) 0.10s backwards; }
.home2-decks { animation: home2Rise 0.5s var(--ease-out) 0.22s backwards; }
/* Breathing gold halo behind PLAY (own layer → doesn't touch the button's box-shadow/hover). */
.home2-play-btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  animation: home2Breathe 2.6s var(--ease-in-out) infinite;
}
/* Slow light sweep across the XP fill. */
.home2-xp-fill::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 34%, rgba(220,245,255,0.6) 50%, transparent 66%);
  background-size: 200% 100%; animation: home2XpShine 4.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .home2-bar, .home2-hero, .home2-decks { animation: none; opacity: 1; transform: none; }
  .home2-play-btn::before, .home2-xp-fill::before { animation: none; }
}

@media (max-width: 900px) {
  .home2 { gap: clamp(8px,1.2vh,14px); }
  /* Hero stacks: PLAY grows to fill, banner becomes a compact promo strip. */
  .home2-hero { display: flex; flex-direction: column; gap: 10px; }
  /* PLAY never shrinks below its content (stays fully visible); decks absorb slack. */
  .home2-play { flex: 1 0 auto; height: auto; padding: clamp(10px,1.4vh,20px) clamp(12px,3vw,20px); padding-left: clamp(16px,4.5vw,30px); }
  .home2-play-cards { --fanx: 26%; --fanw: 66%; width: min(clamp(116px,19vh,220px), 44%); height: clamp(76px,14vh,170px); }
  .home2-play-info { gap: 5px; }
  .home2-banner { flex: 0 0 auto; height: auto; min-height: clamp(58px,9vh,98px); }
  .home2-banner-art { height: 130%; }
  .home2-banner-card { display: none; } /* compact strip — pack only */
  /* Lo mismo para el lote: en la tira caben los SOBRES y nada mas. La carta, la estampa de
     impacto y el dorso se van — a 120 px de alto no se leen, solo hacen ruido y se pelean
     con los controles del carrusel. Y el PRECIO tambien, para que las dos novedades tengan
     las mismas lineas y el alto de la tira no cambie al rotar (aqui el alto sale del
     contenido, no de la rejilla). */
  .home2-banner-media .bundle-card,
  .home2-banner-media .bundle-compo-fx-wrap,
  .home2-banner-media .bundle-compo-back,
  .home2-banner-rays { display: none; }
  /* Solo quedan los dos montones de sobres. Se miden por ALTURA (como el sobre del otro
     cartel, que tambien se sale un poco por arriba y por abajo): en % del ancho, en una tira
     de 130 px de alto los sobres salen mas altos que ella y se pierde medio abanico. */
  .home2-banner-media .bundle-compo { height: 100%; aspect-ratio: auto; width: 100%; }
  .home2-banner-media .bundle-compo-stack { height: 118%; width: auto; }
  .home2-banner-media { width: 40%; }
  .home2-banner-art { max-width: 100%; }
  .home2-banner-text { max-width: 62%; }
  /* Reserva DOS lineas aunque use una. Los titulos de las novedades no miden lo mismo
     ("Welcome Pack" cabe en una linea, "Awakening of the Whales" no) y aqui el alto de la
     tira lo pone el contenido: sin esto la tira pegaba un salto de 19 px al rotar. */
  .home2-banner-title { font-size: clamp(15px,4.2vw,22px); line-height: 1.05; min-height: 2.1em; }
  .home2-banner-text { gap: 3px; padding: 9px 14px; }
  .home2-banner-line { display: none; }
  .home2-banner-figure { left: 0; height: 112%; bottom: -14%; }
  .home2-slide.is-cyber .home2-banner-card.is-skin { display: block; right: 6%; width: auto; height: 124%; top: 50%; }
  .home2-slide.is-emojis .emoji-bundle-art { width: auto; height: 96%; aspect-ratio: 1.5; }
  .home2-slide.is-cyber .home2-banner-card.is-skin .card { height: 100%; width: auto; }
  /* Side column becomes the compact promo strip + the two tiles, both fixed height. */
  .home2-side { flex: 0 0 auto; gap: 8px; }
  .home2-tiles { gap: 8px; }
  .home2-tile { justify-content: center; gap: 10px; padding: clamp(7px,1vh,14px) 10px; min-height: clamp(58px,8vh,104px); }
  .home2-tile-icon-wrap { width: clamp(30px,4vh,48px); height: clamp(30px,4vh,48px); }
  /* Decks: shrink-only (never grow) so the hero keeps priority and PLAY stays full. */
  .home2-decks { flex: 0 1 auto; min-height: 0; gap: 5px; }
  .home2-section-title { font-size: clamp(15px,4vw,22px); }
  .home2-section-title img { width: clamp(26px,6vw,40px); height: clamp(26px,6vw,40px); }
  .home2-deck { --fanx: clamp(14px,2.4vh,26px); width: clamp(152px,46vw,208px); padding: 9px; gap: 6px; }
  .home2-deck-cards { height: clamp(44px,7.4vh,104px); }
  .home2-deck-card { width: clamp(40px,6.4vh,84px); }
}
@media (max-width: 560px) {
  .home2 { padding-left: 10px; padding-right: 10px; }
  /* One-line resource bar (no wrap): identity shrinks, wallet stays compact. */
  .home2-bar { flex-wrap: nowrap; gap: 8px; padding: 6px 10px; }
  .home2-id { flex: 1 1 auto; min-width: 0; gap: 12px; }
  .home2-id-info { min-width: 0; gap: 5px; }
  .home2-name { font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home2-avatar { width: 40px; height: 40px; }
  .home2-avatar-edit { display: none; }   /* sin hover en táctil, el lápiz sobra */
  .home2-nameline { gap: 8px; }
  .home2-lvl-pill { font-size: 12px; }
  .home2-xp { width: clamp(52px,14vw,100px); height: 14px; }
  .home2-xp-text { display: none; }
  .home2-wallet { flex: 0 0 auto; gap: 6px; }
  .home2-coin { padding: 2px 4px; gap: 5px; }
  .home2-coin img { width: 19px; height: 19px; }
  .home2-coin b { font-size: 13px; }
  .home2-banner-text { max-width: 64%; }
  .home2-tile-label { font-size: 10px; letter-spacing: 0.03em; }
  .home2-tile-value { font-size: clamp(15px,4.6vw,22px); }
  /* Compress the PLAY info column so the leader card + button fit small phones. */
  .home2-play-info { gap: 4px; }
  .home2-play-deck { font-size: clamp(17px,4.6vw,24px); }
  .home2-play-meta { font-size: 11px; }
  /* En móvil se mueve la CAJA COMPARTIDA, no el relleno de PLAY: si solo cambiara PLAY,
     la chapa SHOP se quedaría con la medida de escritorio y dejarían de ser iguales. */
  :root { --home-cta-pad-y: 7px; --home-cta-pad-x: 18px; --home-cta-font: clamp(15px,4.2vw,20px); }
  /* Portrait is width-constrained, so the deck fan scales on vw here, not vh. */
  .home2-deck { --fanx: clamp(14px,4.5vw,26px); width: clamp(152px,50vw,220px); }
  .home2-deck-cards { height: clamp(44px,23vw,120px); }
  .home2-deck-card { width: clamp(40px,19vw,96px); }
}

/* --- Builder + collection overlays --- */
.builder-overlay {
  position: fixed; inset: 0; z-index: 260;
  background: rgba(2, 4, 10, 0.7); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: cardModalIn 160ms var(--ease-out);
}
.builder {
  width: min(980px, 100%); height: min(88vh, 920px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(24,37,63,0.97), rgba(8,16,31,0.98));
  border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); overflow: hidden;
}
.builder-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
}
.builder-title { margin: 0; font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.1em; color: var(--gold-bright); font-size: 16px; }
.deck-name-input {
  flex: 1; min-width: 140px; font-family: var(--font-ui); font-weight: 700; font-size: 16px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 9px;
  color: var(--text); padding: 8px 12px;
}
.builder-count { font-family: var(--font-ui); font-weight: 700; font-size: 13px; white-space: nowrap; color: var(--text-dim); }
.builder-count.ok { color: var(--success); }
.builder-count.bad { color: var(--warning); }
.builder-actions { display: flex; gap: 8px; }
.builder-filters { display: flex; gap: 8px; padding: 12px 16px 4px; flex-wrap: wrap; }
.filter-chip {
  font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.05em;
  background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text-dim);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.filter-chip.sel { background: var(--player-soft); border-color: var(--player); color: var(--player-bright); }
.builder-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 20px; }
.builder-pool { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pool-card { display: flex; flex-direction: column; gap: 6px; }
.pool-card-art { position: relative; cursor: pointer; transition: transform .12s; }
@media (hover: hover) and (pointer: fine) { .pool-card-art:hover { transform: translateY(-3px); } }
.pool-card-art .card { width: 100%; height: auto; }
.pool-card.in-deck .pool-card-art .card { outline: 2px solid var(--success); outline-offset: 1px; border-radius: 10px; }
.in-deck-badge, .owned-badge {
  position: absolute; top: 5px; right: 5px; z-index: 2;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; color: #06210f;
  background: var(--success); box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.owned-badge { background: var(--gold); color: #2a1c02; }
.pool-card-ctrls {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 9px; padding: 4px 6px;
}
.pool-card-ctrls button {
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1;
  background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text);
}
.pool-card-ctrls button:disabled { opacity: 0.35; cursor: default; }
.pool-card-ctrls span { font-family: var(--font-ui); font-weight: 700; font-size: 13px; color: var(--text-dim); }

@media (max-width: 560px) {
  .builder { height: 92vh; }
  .builder-pool { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 9px; }
  .home-screen { padding-left: 12px; padding-right: 12px; }
  .avatar-disc { width: 66px; height: 66px; }
  .avatar-emoji { font-size: 34px; }
}

/* ============================================================
   DECK BUILDER + COLLECTION — full-screen, mobile-first
   ============================================================ */
.db-screen, .cs-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 50% at 50% 0%, rgba(59,130,246,0.08), transparent 60%),
    transparent;
}

/* ---- Shared header ---- */
.db-header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; padding-top: max(10px, var(--safe-t));
  border-bottom: 1px solid var(--border-soft);
  background: rgba(8,14,26,0.6);
  backdrop-filter: blur(8px);
}
.db-back {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 0; padding-bottom: 4px;
  background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text);
  cursor: pointer; transition: transform .12s var(--ease-out), background .15s, border-color .15s;
}
.db-back:active { transform: scale(0.94); }
.db-back img { width: 24px; height: 24px; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .db-back:hover { background: var(--surface-2); border-color: var(--border-strong); } }
.db-name {
  flex: 1; min-width: 0;
  font-family: var(--font-ui); font-weight: 700; font-size: 16px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--text); padding: 9px 12px; outline: none;
  transition: border-color .15s;
}
.db-name:focus { border-color: var(--player); }
.db-save { flex: 0 0 auto; padding: 9px 18px; font-size: 14px; }
.db-del {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 0;
  background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text-dim);
  cursor: pointer; transition: transform .12s var(--ease-out), background .15s, border-color .15s, color .15s;
}
.db-del:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .db-del:hover { background: var(--ai-soft); border-color: var(--ai); color: var(--ai-bright); } }
.cs-title {
  flex: 1; margin: 0; font-family: var(--font-display); letter-spacing: 0.04em;
  font-size: clamp(18px, 4vw, 26px); color: var(--gold-bright);
}
.cs-count { flex: 0 0 auto; font-family: var(--font-ui); font-weight: 700; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---- Collection: controls row (search/filter + Regular/Foil toggle) ---- */
.cs-controls {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 2px; flex-wrap: wrap;
}
.cs-controls .filter-bar { flex: 1 1 220px; }
.cs-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-soft);
  border-radius: 11px; padding: 3px;
}
.cs-toggle-btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.06em;
  padding: 7px 16px; border-radius: 8px;
  color: var(--text-dim); background: transparent;
  transition: color .15s, background .15s, box-shadow .15s;
}
.cs-toggle-btn.on { color: #2a1c02; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
/* The FOIL tab, when active, wears a pastel iridescent fill to echo the finish. */
.cs-toggle-btn.cs-foil.on { color: #1a1030; background: linear-gradient(115deg, #fbd0e8, #fde9b0, #c9f5d8, #c5e8ff, #e3d2ff); }
/* PROMO es un foil, así que su chapa también es iridiscente; arranca en ORO para que no
   se confunda con la de FOIL, que arranca en rosa. */
.cs-toggle-btn.cs-promo.on { color: #2a1c02; background: linear-gradient(115deg, #ffd98a, #fff0b8 28%, #c9f5d8 56%, #c5e8ff 80%, #e3d2ff); }
@media (hover: hover) and (pointer: fine) { .cs-toggle-btn:not(.on):hover { color: var(--text); } }

/* ---- Collection: per-set sections (the whole body scrolls as one) ---- */
.cs-screen .cs-body { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cs-set { margin-bottom: 2px; }
.cs-set-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 2px;
}
.cs-set-name {
  font-family: var(--font-display); font-size: clamp(13px, 1.4vw, 17px);
  letter-spacing: 0.04em; color: var(--gold-bright);
}
.cs-set-count { font-family: var(--font-ui); font-weight: 800; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cs-set .db-grid { flex: none; overflow: visible; min-height: 0; padding-top: 4px; padding-bottom: 12px; }

/* ---- Collection: empty (not-yet-obtained) slot ---- */
/* LA CARTA QUE AUN NO TIENES. Se ve entera pero en GRIS y apagada: asi se reconoce cual es
   —a eso se viene a la coleccion— sin que se confunda ni un segundo con una que ya es tuya.
   `grayscale` + `brightness` y no solo opacidad: bajar la opacidad la mezcla con el fondo y la
   ensucia; el gris la deja limpia y a la vez inequivocamente apagada.
   Va en el CONTENEDOR y no en `.card` para que arrastre tambien a la chapa del codigo. */
.cs-locked { cursor: default; }
.cs-locked .card {
  filter: grayscale(1) brightness(0.62) contrast(0.96);
  /* Sin el realce al pasar por encima que llevan las cartas pulsables: no lo es. */
  pointer-events: none;
}
/* (El codigo de edicion —SD-001, GEN-014...— ya no es una chapa en la esquina: lo pinta la
   propia plantilla DENTRO de la carta, en el hueco del texto. Ver la prop `slotCode`.) */

/* ---- Builder zones ---- */
.db-deck {
  flex: 0 0 38%; min-height: 158px;
  display: flex; flex-direction: column;
  border-bottom: 2px solid var(--border-soft);
  transition: background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.db-collection, .cs-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  transition: background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.cs-body { overflow: hidden; }
.db-section-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 9px 14px 5px;
}
/* DECK / COLLECTION: rotulos de TITULO, la misma receta que el "WHAT YOU GET" de la tienda
   (display del juego en oro claro). Un punto mas pequenos que aquel: aqui son la cabecera de
   una seccion que comparte fila con el boton y el contador, no el titulo de un panel. */
.db-section-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(12px, 1vw, 16px); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 12px rgba(245, 193, 74, 0.3);
}
/* COLLECTION minimizable: flecha CENTRADA en la cabecera (a la altura del titulo). Abierta
   apunta abajo (bajar la coleccion); minimizada, la seccion queda en una barra inferior con
   solo la cabecera, el mazo se queda todo el alto y la flecha apunta arriba para reabrirla. */
.db-collection > .db-section-head { position: relative; }
.db-coll-toggle {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 28px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-1); border: 1px solid var(--border-soft);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.db-coll-toggle > span {
  width: 10px; height: 10px; margin-top: -5px;
  border: solid var(--gold-bright); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  transition: transform .2s var(--ease-out), margin .2s var(--ease-out);
}
.db-collection.minimized .db-coll-toggle > span { transform: rotate(-135deg); margin-top: 5px; }
.db-coll-toggle:active { transform: translate(-50%, -50%) scale(0.94); }
@media (hover: hover) and (pointer: fine) { .db-coll-toggle:hover { background: var(--surface-2); border-color: var(--border-strong); } }
/* Transicion suave: se anima el REPARTO del espacio libre (flex-grow) entre mazo y coleccion.
   Con los dos grow sumando 1 en todo momento, el mazo crece exactamente lo que la coleccion
   pierde, asi que la coleccion BAJA (y sube al reabrir) de forma continua. Abierta el reparto es
   el de siempre (mazo 38%/34% fijo, coleccion el resto); minimizada la coleccion se queda en su
   min-height = alto medido de la cabecera (--coll-head-h), que es la barra inferior. El contenido
   sigue montado y se recorta; al terminar de bajar se oculta (visibility) para que no reciba foco. */
.db-deck { flex-grow: 0; transition: flex-grow .34s var(--ease-out), background .18s var(--ease-out), box-shadow .18s var(--ease-out); }
.db-deck.expanded { flex-grow: 1; }
.db-collection {
  flex-basis: 0; overflow: hidden;
  min-height: var(--coll-head-h, 40px);
  transition: flex-grow .34s var(--ease-out), background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.db-collection.minimized { flex-grow: 0; background: rgba(8,14,26,0.6); }
.db-collection > :not(.db-section-head) { transition: visibility 0s; }
.db-collection.minimized > :not(.db-section-head):not(.db-drop-banner) { visibility: hidden; transition: visibility 0s .34s; }
@media (prefers-reduced-motion: reduce) {
  .db-deck, .db-collection { transition-duration: 0s; }
}
.db-count { font-family: var(--font-display); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.db-count.ok { color: var(--success); }
.db-count.bad { color: var(--warning); }

/* ---- Card grids ---- */
.db-grid {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; align-content: start; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  padding: 6px 12px 18px;
  touch-action: pan-y;
}
.db-card {
  position: relative;
  touch-action: pan-y;
  transition: opacity .15s var(--ease-out), transform .12s var(--ease-out);
  /* Stop the iOS long-press callout / text-selection from hijacking the grab. */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.db-card .card, .db-card img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.db-card .card { width: 100%; }
.db-card.dragging { opacity: 0.35; }
.db-card.in-deck .card { outline: 2px solid var(--success); outline-offset: 1px; border-radius: 11px; }
.db-card.maxed .card { filter: grayscale(0.45) brightness(0.66); }
@media (hover: hover) and (pointer: fine) {
  .db-card:not(.dragging):hover { transform: translateY(-3px); }
}
.db-badge {
  position: absolute; top: 5px; right: 5px; z-index: 3; pointer-events: none;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.55);
}
.db-badge.count { background: var(--success); color: #06210f; }
.db-badge.owned { background: var(--gold); color: #2a1c02; }
/* Slot-number badge (top-left) on a card already picked as a signature card. */
.db-badge.feat { left: 5px; right: auto; background: var(--gold); color: #2a1c02; }
/* (Aqui vivia `.db-card-cfg`: la chapa REDONDA con un engranaje en la esquina inferior
   derecha de cada carta del mazo, que anunciaba "tocame para abrir el loadout". Se quito por
   innecesaria. Era puramente decorativa — `pointer-events: none` y `aria-hidden` —, asi que
   la pulsacion sigue igual: la abre el propio manejador de la carta, no la chapa.) */

/* ---- Card loadout config modal (tap a deck card) ---- */
.cl-overlay {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(2,4,10,0.62); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: filterFade 160ms ease-out;
}
.cl-modal {
  width: min(900px, 96vw); max-height: 94vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(24,37,63,0.98), rgba(8,16,31,0.99));
  border: 1px solid var(--border-strong); border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); padding: 16px 18px max(16px, var(--safe-b));
  animation: cardModalIn 180ms var(--ease-out);
}
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cl-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(18px,2vw,26px); color: var(--gold-bright); }
.cl-close { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text-dim); cursor: pointer; font-size: 15px; }
@media (hover: hover) and (pointer: fine) { .cl-close:hover { background: var(--ai-soft); border-color: var(--ai); color: var(--ai-bright); } }
.cl-body { display: flex; gap: 28px; overflow-y: auto; align-items: flex-start; padding: 8px 6px 4px; }
/* Bigger detail card: grab & drag it to tilt (see .grabbing). perspective lets the
   rotateX/rotateY lean (set inline by applyFoilTilt) read as real 3D. The generous
   padding is a BUFFER: box-sizing is border-box (global), so it insets the card from
   this box's edges by 26px — enough that the 3D lean stays inside .cl-preview and
   never pokes past .cl-body, which would otherwise flash scrollbars mid-tilt. */
.cl-preview { flex: 0 0 auto; width: clamp(252px, 44%, 372px); padding: 26px; perspective: 1300px; touch-action: none; }
.cl-preview .card { width: 100%; height: auto; cursor: grab; transition: transform 0.12s ease-out; will-change: transform; }
.cl-preview.grabbing { cursor: grabbing; }
.cl-preview.grabbing .card { cursor: grabbing; transition: transform 0.06s linear; }
.cl-opts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cl-group-title { font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 9px; }
/* Effect-section header: label on the left, its own PLAY PREVIEW button on the right. */
.cl-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.cl-group-head .cl-group-title { margin-bottom: 0; }
.cl-group-head .ui-btn.cl-sim { margin-top: 0; min-height: 34px; width: 188px; justify-content: center; padding: 4px 12px 4px 8px; font-size: 12px; }
.cl-group-head .cl-sim-ico { width: 22px; height: 22px; }
.cl-choices { display: flex; flex-wrap: wrap; gap: 8px; }
/* the skin brings this effect (Hillbilly Chad): fixed, a short note under the only chip */
.cl-skin-note { margin-top: 6px; font-size: 12px; opacity: .7; }
.cl-choice {
  font-family: var(--font-ui); font-weight: 700; font-size: 12px;
  background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text-dim);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.cl-choice.on { background: var(--player-soft); border-color: var(--player); color: var(--player-bright); }
/* Un efecto ESPECIAL (el que no es de fábrica de ninguna carta) se marca en oro, el mismo
   idioma que su etiqueta del inventario. Sólo el CONTORNO y la letra: elegido sigue siendo
   azul, para que "cuál llevo puesto" y "cuál es especial" no compitan por el mismo color. */
.cl-choice.special { border-color: rgba(245, 193, 74, 0.55); color: var(--gold-bright); }
.cl-choice.special.on { border-color: var(--gold); }
.cl-choice:disabled { opacity: 0.55; cursor: default; }
.cl-note { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
/* Voice dropdown (single-select) */
.cl-dd { position: relative; }
.cl-dd-head { width: 100%; max-width: 280px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--font-ui); font-weight: 700; font-size: 13px; background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text); padding: 9px 13px; border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
@media (hover: hover) and (pointer: fine) { .cl-dd-head:hover { border-color: var(--border-strong); } }
.cl-dd.open .cl-dd-head { border-color: var(--player); }
.cl-dd-caret { flex: none; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; opacity: 0.7; transition: transform .2s; }
.cl-dd.open .cl-dd-caret { transform: rotate(180deg); }
/* In-flow (not absolute) so the modal body's overflow can't clip it. */
.cl-dd-menu { margin-top: 6px; width: 100%; max-width: 280px; display: flex; flex-direction: column; gap: 3px; padding: 6px; background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px; animation: filterDdOpen 140ms var(--ease-out); }
/* Each voice row is SPLIT: the label picks the line, the round button auditions it
   without picking. The highlight lives on the ROW so both halves share it. */
.cl-dd-opt-row { display: flex; align-items: center; gap: 4px; padding-right: 5px; border-radius: 8px; transition: background .12s; }
@media (hover: hover) and (pointer: fine) { .cl-dd-opt-row:hover { background: var(--surface-1); } }
@media (hover: hover) and (pointer: fine) { .cl-dd-opt-row:hover .cl-dd-opt { color: var(--text); } }
.cl-dd-opt-row.on { background: var(--player-soft); }
.cl-dd-opt-row.on .cl-dd-opt { color: var(--player-bright); }
.cl-dd-opt { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; text-align: left; font-family: var(--font-ui); font-weight: 700; font-size: 13px; background: none; border: none; color: var(--text-dim); padding: 9px 11px; border-radius: 8px; cursor: pointer; transition: color .12s; }
.cl-dd-play-btn {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  font-size: 9px; line-height: 1; color: var(--gold-bright); cursor: pointer;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-soft); border-radius: 50%;
  transition: background .12s, border-color .12s, transform .08s, color .12s;
}
@media (hover: hover) and (pointer: fine) { .cl-dd-play-btn:hover { background: rgba(245, 193, 74, 0.16); border-color: var(--gold-edge); } }
.cl-dd-play-btn:active { transform: scale(0.92); }
/* While that line is sounding. */
.cl-dd-play-btn.on { color: #1a1305; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); border-color: var(--gold-edge); animation: clVoicePulse 1s ease-in-out infinite; }
@keyframes clVoicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 193, 74, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(245, 193, 74, 0); }
}
/* DONE cierra el modal: es una chapa, no una barra. Antes salia de restarle el inset al
   ancho del modal, asi que en uno ancho (CUSTOMIZE DECK son 860 px) se leia como una franja.
   Ahora se centra y el ancho lo manda un `min-width` — la altura sigue siendo el token
   compartido, para que mida lo mismo que el resto de botones de modal. */
.cl-done {
  align-self: center; width: auto; min-width: clamp(150px, 20vw, 230px);
  margin: 16px 0 0; min-height: var(--modal-btn-h);
  padding: 0 26px; border-radius: 12px; font-size: 15px;
}
/* Impact FX layer — ABOVE the modal (fixed, escapes the board's overflow) so the
   attack burst lands over the cards. Descendant selector beats `.impact-fx-layer`. */
.cl-overlay .cl-fx-layer { position: fixed; inset: 0; z-index: 1600; pointer-events: none; overflow: visible; }
@keyframes clHit { 0% { transform: translate(0,0); } 14% { transform: translate(-5px,3px) rotate(-1.2deg); } 34% { transform: translate(4px,-2px) rotate(1.1deg); } 56% { transform: translate(-2px,1px); } 100% { transform: translate(0,0); } }
/* Effect PREVIEW button (SimPreviewBtn): the game's gold button (`ui-btn ui-btn-gold`), a bit
   smaller than a CTA, with the icon of what it previews (attack / summon / spell / trap). */
.ui-btn.cl-sim { margin-top: 10px; min-height: 38px; padding: 6px 16px 6px 10px; font-size: 13px; gap: 8px; }
.cl-sim-ico { width: 26px; height: 26px; object-fit: contain; flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.45)); }
.cl-sim-tri { font-size: 0.85em; }

/* ---- Attack-simulation sub-view (real-duel proportions) ---- */
.cl-modal.sim { width: min(1140px, 97vw); max-height: 96vh; }
.cl-sim-view { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.cl-sim-view .cl-head { margin-bottom: 2px; }
.cl-sim-view .cl-title { font-size: clamp(16px,1.7vw,24px); }
/* Tambien por ICONO (ver `.start-back`). Es la cabecera de un modal, asi que hereda la
   superficie del kit y queda a juego con la ✖ del otro extremo de la misma fila. */
.cl-back {
  flex: 0 0 auto; cursor: pointer; padding: 0;
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-1); border: 1px solid var(--border-soft);
  transition: transform .12s var(--ease-out), background .15s, border-color .15s;
}
.cl-back img { width: 22px; height: 22px; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .cl-back:hover { background: var(--surface-2); border-color: var(--border-strong); } }
.cl-back:active { transform: scale(0.94); }
/* Two hero rows pulled toward the centre (like the real .duel-stage); the heroes are
   large 11:16 field cards filling their band — a real face-off, not floating cards. */
.cl-sim-board {
  position: relative; border-radius: 16px; overflow: hidden;
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  /* Con la PROPORCIÓN del cuadro (la publica el simulador en `--sim-ar`) la geometría de
     `bgGeoOf` sale la misma que en una partida; con un alto fijo el zoom se disparaba y
     sólo se veía una esquina del mapa. Y el relleno son los márgenes de la ARENA, para que
     las filas caigan sobre el suelo y no sobre la piedra. */
  /* Con un tope de alto MÍNIMO: en un móvil el modal es estrecho y con la proporción del
     cuadro a secas el tablero salía de 149 px y las cartas de 24. El mínimo hace que el
     mapa se amplíe y recorte — que es EXACTAMENTE lo que hace el tablero de verdad en un
     teléfono, porque `bgGeoOf` amplía hasta que la arena conserva su altura útil. */
  width: 100%; aspect-ratio: var(--sim-ar, 2.357); height: auto;
  /* El tope de alto es un guardia para pantallas BAJAS, no una talla: a 62vh mordía ya a
     900 px de alto —el tablero medía 558 en vez de sus 578— y entonces su tamaño pasaba a
     depender del viewport, que es justo lo que hace que las cosas se muevan al agrandar la
     ventana. A 72vh sólo entra cuando de verdad no cabe. */
  min-height: clamp(240px, 38vh, 340px); max-height: 72vh;
  /* El hueco entre las dos filas va en el GRID, no en el relleno de cada fila: con
     `container-type: size` el `100cqh` de la fila NO incluye su relleno, así que una carta
     a tope de alto más el relleno se salía del carril y asomaba por encima de la arena. */
  /* El hueco (y el carril de la fila, más abajo) se miden contra el alto de la ARENA
     —`--arena-h`, que publica el simulador al medirse— y no contra el viewport. Dos
     motivos: con `vh` la carta cambiaba de tamaño al agrandar la ventana aunque el
     tablero midiera lo mismo (el modal tiene tope de ancho), y las proporciones que hay
     que copiar son las del duelo, que están tomadas contra la arena. MEDIDO allí a
     1440x900: arena 616 px, dos filas de 293 y 16 de hueco → 2,6 % de hueco y 1,7 % de
     carril a cada lado, que es lo que deja la carta al 44 % del alto de la arena. */
  display: grid; grid-template-rows: 1fr 1fr; row-gap: clamp(4px, calc(var(--arena-h, 320px) * 0.026), 16px);
  padding: var(--arena-t, 8%) var(--arena-r, 6%) var(--arena-b, 8%) var(--arena-l, 6%);
}
/* EL MAPA es el campo de duelo ACTIVO, con sus trastos quietos (FieldPreview). Antes era
   un JPG suelto clavado aquí que ya no se usaba en ninguna partida. Va al fondo del todo:
   las filas van a z 2/3 y la capa de efectos de detrás, a z 1. */
.cl-sim-bg {
  position: absolute; inset: 0; z-index: 0; border-radius: 0; border: 0;
  box-shadow: inset 0 0 0 100vmax rgba(0, 0, 0, 0.18);   /* el mismo velo que tenía */
}
.cl-sim-row { position: relative; z-index: 2; display: flex; justify-content: center; min-height: 0; width: 100%;
  /* `container-type: size` para que el hueco de la carta se mida contra la FILA, igual
     que en el tablero de verdad (ver `.duel-row`). */
  container-type: size; }
/* Un respiro vertical: las chapas de estadística sobresalen de la caja de la carta, y a
   tope de alto se montaban sobre el raíl de piedra de la arena. En px y no en %, que un
   `padding` en porcentaje se resuelve contra el ANCHO también en el eje vertical. */
.cl-sim-row { padding-block: clamp(3px, calc(var(--arena-h, 320px) * 0.017), 12px); }
.cl-sim-row.enemy  { align-items: flex-end; }
.cl-sim-row.player { align-items: flex-start; z-index: 3; } /* attacker charges over the enemy */
/* LA MISMA cuenta que `.slot` en el tablero: el mayor rectángulo 11:16 que cabe en un
   tercio del ancho de la fila y en su alto. Antes era `height: 100%`, y por eso la carta
   salía más grande que en una partida y descolocada respecto al mapa. */
.cl-sim-slot {
  position: relative; perspective: 900px; aspect-ratio: 11 / 16;
  width: min((100cqw - 2 * var(--col-gap, 10px)) / 3, 100cqh * 11 / 16, 300px);
  height: auto; max-height: 100%;
}
.cl-sim-card { width: 100%; height: 100%; }
.cl-sim-card .card { width: 100%; height: 100%; }
.cl-sim-card.hit { animation: clHit 420ms var(--ease-out); }
/* Behind the cards (z-index 1 < rows 2/3) so a lunging attacker passes OVER it. */
.cl-sim-vs { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 1; pointer-events: none; font-family: var(--font-display); color: var(--gold-bright); opacity: 0.9; font-size: clamp(18px,2vw,30px); text-shadow: 0 2px 8px rgba(0,0,0,0.9); }
.cl-sim-dmg { position: absolute; top: 30%; left: 50%; z-index: 6; pointer-events: none; font-family: var(--font-display); font-weight: 400; font-size: clamp(30px,4.5vw,52px); color: #ff5a5a; text-shadow: 0 2px 8px #000, 0 0 3px #000; animation: clDmg 1100ms var(--ease-out) forwards; }
@keyframes clDmg { 0% { opacity: 0; transform: translate(-50%,6px) scale(0.7); } 20% { opacity: 1; transform: translate(-50%,-4px) scale(1.12); } 100% { opacity: 0; transform: translate(-50%,-40px) scale(1); } }
.cl-sim-label { text-align: center; margin: 2px 0 0; }
/* Variante de impacto SECUNDARIA (la activa de Bitcoin Whale con Whale Dump): su botón + la nota de a quién vale. */
.cl-sim-variant { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.cl-sim-variant .cl-choice { display: inline-flex; align-items: center; gap: 6px; }
.cl-sim-variant-note { font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; color: var(--gold-bright); opacity: 0.85; }
.cl-sim-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cl-sim-replay {
  margin: 2px var(--modal-btn-inset) 0; width: auto; min-height: var(--modal-btn-h);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border-radius: 12px; font-size: 15px;
}
/* Attack / Summon tabs in the sim header */
.cl-sim-tabs { display: inline-flex; gap: 4px; background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 999px; padding: 3px; }
.cl-sim-tab { font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.04em; color: var(--text-dim); background: none; border: none; border-radius: 999px; padding: 6px 16px; cursor: pointer; transition: background .15s, color .15s; }
.cl-sim-tab.on { background: var(--player-soft); color: var(--player-bright); }
/* Summon mode: the hero lands into the player's central slot (empty enemy row above)
   with the SAME FX as the live board — gold sparks + halo + bubbles / gold-glitch. */
.cl-sim-card.summon-land { animation: clSummonLand 640ms var(--ease-out); }
@keyframes clSummonLand { 0% { opacity: 0; transform: scale(0.5) translateY(26px); } 55% { opacity: 1; transform: scale(1.08) translateY(-5px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

@media (max-width: 520px) { .cl-body { flex-direction: column; align-items: center; } .cl-preview { width: min(240px, 66vw); } .cl-opts { width: 100%; } }
/* Per-card finish selector on a deck card: tap to cycle normal → foil among the
   finishes the player actually owns. Only shown when a card has at least one premium
   finish owned (otherwise there's nothing to choose). */
/* Finish wordmark over a deck card (was a "minted chip" with the finish gradient; the
   art says FOIL on its own now). Same spot, no ring and no gloss. */
/* `.db-card` in the selector so this beats the shared `.finish-label` height: that rule
   lives further down the file, and with equal specificity the last one would win. */
.db-card .db-finish-label {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); z-index: 4;
  height: 15px;
  /* The pastel wordmark lands on the card's own gold/cream frame, so it needs a dark
     backing. It CANNOT be a background gradient: whatever the gradient's shape, it is
     clipped by the element BOX, and that straight cut reads as a rectangle around the
     halo. Stacked drop-shadows follow the ART'S ALPHA instead — the shading hugs the
     letters and the star, and there is no contour to see. */
  filter:
    drop-shadow(0 0 1.5px rgba(4, 8, 17, 0.95))
    drop-shadow(0 1px 2px rgba(4, 8, 17, 0.9))
    drop-shadow(0 0 6px rgba(4, 8, 17, 0.72));
}
.db-finish {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 4;
  pointer-events: auto; cursor: pointer;
  font-family: var(--font-ui); font-weight: 800; font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px 3.5px; border-radius: 999px; border: 0;
  /* Premium "minted chip": wears the card's actual finish gradient (the SAME
     metals as the collection's Foil toggle tab) under a glossy top
     sheen, wrapped in a dark ink ring with a colour-matched halo + bottom inner
     shade for volume — reads as a struck medal, not a flat outline-pill. Per-finish
     classes set the metal (--fin-grad), the halo (--fin-glow) and ink-on-metal text. */
  --fin-grad: linear-gradient(115deg, #fbd0e8, #fde9b0, #c9f5d8, #c5e8ff, #e3d2ff);
  --fin-glow: rgba(170, 214, 255, 0.6);
  color: #1a1030;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 48%),
    var(--fin-grad);
  box-shadow:
    0 0 0 1.5px rgba(18, 11, 6, 0.92),        /* dark ink outline */
    0 2px 5px rgba(0, 0, 0, 0.5),             /* drop shadow (lifts off the art) */
    0 0 8px var(--fin-glow),                  /* colour-matched halo */
    inset 0 1px 0 rgba(255, 255, 255, 0.75),  /* top gloss highlight */
    inset 0 -2px 3px rgba(0, 0, 0, 0.22);     /* bottom inner shade (volume) */
  transition: transform .1s var(--ease-out), box-shadow .15s, filter .15s;
}
.db-finish:active { transform: translateX(-50%) scale(0.94); }
.db-finish.fin-foil   { --fin-grad: linear-gradient(115deg, #fbd0e8, #fde9b0, #c9f5d8, #c5e8ff, #e3d2ff); --fin-glow: rgba(170, 214, 255, 0.6); color: #1a1030; }
/* Hovering the card brightens its finish chip + flares the halo (premium feel). */
@media (hover: hover) and (pointer: fine) {
  .db-card:not(.dragging):hover .db-finish {
    filter: brightness(1.07) saturate(1.06);
    box-shadow:
      0 0 0 1.5px rgba(18, 11, 6, 0.92),
      0 3px 7px rgba(0, 0, 0, 0.55),
      0 0 13px var(--fin-glow),
      inset 0 1px 0 rgba(255, 255, 255, 0.85),
      inset 0 -2px 3px rgba(0, 0, 0, 0.22);
  }
}
/* Static variant label: each owned finish is its own tile now, so the label just
   identifies the variant (it must NOT block the card's drag/tap). */
.db-finish.is-label { pointer-events: none; cursor: default; }
/* CUSTOMIZE DECK — el UNICO boton de la cabecera del mazo: abre el modal que unifica las
   signature cards y el dorso. Es un `.btn primary` y nada mas, para que lleve EXACTAMENTE
   la misma chapa que SAVE y que el resto de botones del juego (el retrofit del UI KIT, al
   final de este fichero, le pone el 9-slice ambar con su brillo). Aqui solo van las medidas:
   vive en una cabecera de seccion, asi que es un punto mas bajo y estrecho que SAVE, y el
   `min-height` cuadra con el `--gb-h: 38px` que el retrofit usa para calcular el grosor del
   contorno. */
.db-customize-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; min-height: 38px; line-height: 1;
  font-size: clamp(11px, 0.95vw, 14px);
}
/* La rejilla del selector: cada dorso ENTERO (es lo que se elige) con su nombre debajo. */
.db-back-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.db-back-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: clamp(74px, 8vw, 96px); padding: 8px 6px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px;
  color: var(--text-dim); font-family: var(--font-ui); font-weight: 700; font-size: 11px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.db-back-opt img { width: 100%; height: auto; display: block; }
@media (hover: hover) and (pointer: fine) { .db-back-opt:hover { border-color: var(--gold); } }
.db-back-opt.on { background: var(--player-soft); border-color: var(--player); color: var(--player-bright); }
/* DECK BOX: the options are the boxes themselves (DeckBoxView), the preview the chosen one */
.db-box-opt-view { width: 100%; aspect-ratio: 3 / 4; }
.dc-box-preview { display: flex; align-items: center; justify-content: center; }
.dc-box-view { width: 100%; aspect-ratio: 4 / 5; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55)); }
/* inventory: the box stands in the square art tile; its preview spins it big */
.inv-item-art.is-box { background: rgba(0, 0, 0, 0.42); }
.inv-item-art .inv-item-box { position: absolute; inset: 8%; }
/* the preview modal is bigger and nothing clips the turning box (.cl-body scrolls = clips) */
.inv-box-modal { width: min(1000px, 96vw); }
.inv-box-body { justify-content: center; overflow: visible; padding: 3vh 6px; }
/* the item preview shows the box, not a deck: no card list on its back */
.inv-box-spin .db-list { display: none; }
.inv-box-spin, .inv-box-spin.db-fx-host { position: relative; width: min(560px, 86vw); height: min(620px, 68vh); overflow: visible;
  filter: drop-shadow(0 0 6px rgba(255, 214, 102, 0.55)) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45)); }
.db-back-help { margin: 0; font-family: var(--font-ui); font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
/* Los 3 huecos de las SIGNATURE CARDS. Vivian en un panel propio que oscurecia la coleccion;
   hoy son la primera pestana del modal CUSTOMIZE DECK y las medidas valen igual. */
.db-feat-slots { display: flex; gap: clamp(12px, 1.8vw, 28px); justify-content: center; }
.db-feat-slot {
  position: relative; width: clamp(84px, 9vw, 130px); aspect-ratio: 11 / 16;
  border: 2px dashed var(--border-strong); border-radius: 12px;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.db-feat-slot.filled { border-style: solid; border-color: var(--gold); cursor: grab; touch-action: manipulation; }
.db-feat-slot.filled:active { cursor: grabbing; }
/* ARRASTRE: mientras hay una carta agarrada, todos los huecos que pueden recibirla se
   insinuan y el que esta bajo el puntero se enciende del todo. El de ORIGEN se apaga, que es
   lo que dice "esta carta la llevas tu en la mano". */
.db-feat-slot.drop-ok { border-color: color-mix(in srgb, var(--gold) 60%, transparent); background: rgba(245, 193, 74, 0.06); }
.db-feat-slot.drop-over {
  border-style: solid; border-color: var(--gold-bright); background: rgba(245, 193, 74, 0.16);
  transform: translateY(-3px); box-shadow: 0 10px 26px -8px rgba(245, 193, 74, 0.65);
}
.db-feat-slot.dragging { opacity: 0.32; }
.db-feat-num {
  position: absolute; top: -11px; left: -11px; z-index: 2;
  width: 27px; height: 27px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: #2a1c02; font-family: var(--font-display); font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.db-feat-slot-card { width: 100%; height: 100%; }
.db-feat-slot-card .card { width: 100%; height: auto; }
.db-feat-slot-empty { font-family: var(--font-ui); font-size: 11px; color: var(--text-dim); }
.db-feat-help { font-size: clamp(11px, 1vw, 13px); color: var(--text-dim); text-align: center; line-height: 1.4; }

/* ---- CUSTOMIZE DECK modal (signature cards + deck back) ----
   Se monta sobre `cl-overlay` > `cl-modal`, la chapa compartida de los modales del juego,
   asi que el retrofit cartoon (contorno de tinta + bandas) le entra por herencia y aqui
   solo van las dos pestanas y la rejilla de cartas del mazo. */
.dc-modal { width: min(860px, 96vw); }
/* Las dos pestanas son el mando segmentado COMPARTIDO (`.mission-tabs` / `.mission-tab`, el
   de SETTINGS e INVENTORY, con su contorno de tinta y su relieve hundido en el retrofit).
   Aqui solo va el SITIO que ocupa dentro del modal: `.cl-modal` es una columna flex, y ahi
   un `inline-flex` se blockifica y el `stretch` lo estiraria de lado a lado — que es
   justo lo que hacian las pestanas propias que habia antes. `align-self` es lo que lo
   impide, y CENTRADAS porque en un modal la tira es su propia fila (en SETTINGS o
   INVENTORY va a la izquierda porque alli comparte columna con el contenido de debajo).
   (0,2,0) como en SETTINGS y en INVENTARIO, y por el mismo motivo: `.mission-tabs` se
   define ~8800 lineas MAS ABAJO, y su `align-self: flex-start` y su `margin: 4px 0 6px`
   le ganan por POSICION a una regla de una sola clase escrita aqui arriba. */
.dc-modal .dc-tabs { align-self: center; flex-wrap: wrap; justify-content: center; margin: 0 0 14px; }
.dc-tabs .mission-tab:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
/* La pestana de destacadas APILA (huecos, ayuda, rejilla). La del dorso sigue siendo la de
   siempre, a dos columnas, y por eso conserva el `.cl-body` a secas. El `align-items` hay
   que devolverlo a `stretch`: en columna, el `flex-start` que trae `.cl-body` encogeria
   cada bloque a su ancho de contenido. */
/* Y el que hace scroll es la REJILLA, no el cuerpo: los 3 huecos son el destino del
   arrastre, asi que tienen que seguir en pantalla por larga que sea la lista de cartas. */
.dc-body { flex-direction: column; align-items: stretch; gap: 14px; overflow: hidden; }
.dc-pick-title { margin: 4px 0 0; }
/* Las cartas DEL MAZO, que es de donde salen las destacadas: un clic mete o saca, y un
   arrastre las lleva al hueco que se quiera. */
.dc-pick {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; align-content: start; gap: 10px; padding: 4px 2px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.dc-pick-card {
  position: relative; padding: 0; border: 0; background: none; cursor: grab;
  border-radius: 11px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), opacity .15s;
}
.dc-pick-card:active { cursor: grabbing; }
/* La carta no puede ser el objetivo del clic: el boton es quien lo recibe. */
.dc-pick-card .card { width: 100%; height: auto; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .dc-pick-card:hover { transform: translateY(-3px); } }
.dc-pick-card.on .card { outline: 2px solid var(--gold); outline-offset: 1px; border-radius: 11px; }
/* Con los 3 huecos llenos, lo que NO esta elegido se apaga: solo se puede quitar. */
.dc-pick-card:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.dc-pick-card:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
/* La que se lleva el puntero se apaga: el fantasma es quien la representa ahora. Va DESPUES
   del `:hover` — misma especificidad, y con el puntero encima el hover seguiria ganando. */
.dc-pick-card.dragging { opacity: 0.32; transform: none; }
.db-empty {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 96px; padding: 18px;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px; color: var(--text-muted);
  border: 1.5px dashed var(--border-strong); border-radius: 14px;
}

/* ---- Drop-zone feedback ---- */
.db-deck.drop-target { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--success) 60%, transparent); }
.db-deck.drop-over { background: rgba(34,197,94,0.10); box-shadow: inset 0 0 0 2px var(--success); }
.db-collection.drop-target { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 55%, transparent); }
.db-collection.drop-over { background: rgba(239,68,68,0.08); box-shadow: inset 0 0 0 2px var(--danger); }
.db-drop-banner {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.06em;
  padding: 7px 16px; border-radius: 999px; color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  animation: dropBannerIn 140ms var(--ease-out);
}
.db-deck { position: relative; }
.db-collection { position: relative; }
.db-drop-banner.add { background: var(--success); color: #06210f; }
.db-drop-banner.remove { background: var(--danger); }
@keyframes dropBannerIn { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Drag ghost (follows the pointer) ---- */
.db-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000;
  width: clamp(96px, 26vw, 128px);
  pointer-events: none; will-change: transform;
  filter: drop-shadow(0 16px 26px rgba(0,0,0,0.6));
  opacity: 0.96;
}

/* ---- Filter bar (search + filter button) ---- */
.filter-bar { flex: 0 0 auto; display: flex; gap: 8px; padding: 4px 12px 8px; }
/* El campo de busqueda es la CAJA (`.filter-search`), no el `<input>` de dentro, que va
   transparente. Iba con 1px porque el retrofit cartoon del final del fichero dejo fuera los
   `input` a proposito — pero su vecino `.filter-btn` SI esta en el retrofit, asi que uno
   tenia contorno de tinta y el otro no. Mismo idioma: 2px de tinta y relieve HUNDIDO. */
.filter-search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.34);
  border: 2px solid var(--gv-ink, #070f1d); border-radius: 12px;
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.38), inset 0 -2px 0 rgba(255, 255, 255, 0.05);
  padding: 0 12px; transition: border-color .15s, box-shadow .15s;
}
.filter-search:focus-within {
  border-color: var(--gold);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.38), inset 0 -2px 0 rgba(255, 255, 255, 0.05),
              0 0 0 3px rgba(245, 193, 74, 0.22);
}
.filter-search:focus-within .filter-search-icon { stroke: var(--gold-bright); }
.filter-search-icon { flex: 0 0 auto; width: 16px; height: 16px; stroke: var(--text-muted); fill: none; stroke-width: 2; stroke-linecap: round; }
.filter-search-input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-ui); font-weight: 600; font-size: 14px; padding: 10px 0;
}
.filter-search-input::placeholder { color: var(--text-muted); }
.filter-search-clear {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--gv-ink, #070f1d);
  background: var(--surface-2); color: var(--text-dim); font-size: 11px; line-height: 1;
  transition: background .15s, color .15s;
}
@media (hover: hover) and (pointer: fine) { .filter-search-clear:hover { background: var(--surface-1); color: var(--text); } }
.filter-btn {
  flex: 0 0 auto; position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-1); border: 1px solid var(--border-soft); color: var(--text);
  border-radius: 11px; padding: 0 14px; cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  transition: transform .12s var(--ease-out), background .15s, border-color .15s, color .15s;
}
.filter-btn:active { transform: scale(0.97); }
.filter-btn.active { border-color: var(--player); color: var(--player-bright); background: var(--player-soft); }
.filter-btn-icon { width: 28px; height: 28px; object-fit: contain; }
.filter-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--player); color: #04101f; font-family: var(--font-display); font-size: 11px;
}

/* ---- Filter bottom sheet ---- */
.filter-sheet-overlay {
  position: fixed; inset: 0; z-index: 1400; /* above the collection-odds modal (1300) */
  background: rgba(2, 4, 10, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: filterFade 160ms ease-out;
}
@keyframes filterFade { from { opacity: 0; } to { opacity: 1; } }
.filter-sheet {
  width: min(560px, 100%); max-height: 82vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(24,37,63,0.98), rgba(8,16,31,0.99));
  border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 8px 16px max(18px, var(--safe-b));
  box-shadow: 0 -24px 70px rgba(0,0,0,0.55);
  animation: filterSheetUp 300ms var(--ease-drawer);
}
@keyframes filterSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.filter-sheet-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 12px; }
.filter-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filter-sheet-head h3 { margin: 0; font-family: var(--font-ui); font-weight: 800; letter-spacing: 0.08em; font-size: 15px; color: var(--gold-bright); }
.filter-clear { background: none; border: none; color: var(--text-dim); font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; cursor: pointer; padding: 4px 6px; }
.filter-clear:active { transform: scale(0.96); }
.filter-sheet-body { overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.filter-group-title { font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 9px; }
.filter-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-opt {
  font-family: var(--font-ui); font-weight: 700; font-size: 12px;
  background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text-dim);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: transform .1s var(--ease-out), background .15s, border-color .15s, color .15s;
}
.filter-opt:active { transform: scale(0.96); }
.filter-opt.on { background: var(--player-soft); border-color: var(--player); color: var(--player-bright); }
.filter-opt.rar.on { background: color-mix(in srgb, var(--rar) 18%, transparent); border-color: var(--rar); color: var(--rar); }
/* Filtro de ACABADO: cada píldora encendida lleva el color de su acabado, los mismos
   que la tira de pestañas de COLLECTION (`.cs-toggle-btn.cs-foil/.cs-promo`),
   para que se reconozcan de una pantalla a otra. NORMAL se queda con el azul de serie. */
.filter-opt.fin.fin-foil.on   { background: rgba(201, 245, 216, 0.16); border-color: #c9f5d8; color: #d9f7e6; }
.filter-opt.fin.fin-promo.on  { background: rgba(255, 217, 138, 0.16); border-color: #ffd98a; color: #ffe6b4; }

/* Class / Collection filters render as a compact expandable dropdown (multi-select). */
.filter-dropdown { position: relative; width: 100%; }
.filter-dd-head {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  background: var(--surface-0); border: 1px solid var(--border-soft); color: var(--text-dim);
  padding: 11px 14px; border-radius: 12px; cursor: pointer;
  transition: transform .1s var(--ease-out), background .15s, border-color .15s, color .15s;
}
.filter-dd-head:active { transform: scale(0.99); }
.filter-dd-head.has-sel { background: var(--player-soft); border-color: var(--player); color: var(--player-bright); }
.filter-dropdown.open .filter-dd-head { border-color: var(--player); }
.filter-dd-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-dd-caret {
  flex: none; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid currentColor; opacity: .75;
  transition: transform .2s var(--ease-out);
}
.filter-dropdown.open .filter-dd-caret { transform: rotate(180deg); }
.filter-dd-menu {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 6px; padding: 6px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 12px;
  max-height: 240px; overflow-y: auto;
  animation: filterDdOpen 140ms var(--ease-out);
}
@keyframes filterDdOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.filter-dd-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  background: none; border: none; color: var(--text-dim);
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background .12s, color .12s;
}
.filter-dd-opt:active { transform: scale(0.98); }
.filter-dd-opt.on { color: var(--player-bright); background: var(--player-soft); }
.filter-dd-label { flex: 1; }
.filter-dd-box {
  flex: none; width: 17px; height: 17px; border-radius: 5px; position: relative;
  border: 1.5px solid var(--border-strong); background: var(--surface-1);
  transition: background .12s, border-color .12s;
}
.filter-dd-opt.on .filter-dd-box { background: var(--player); border-color: var(--player); }
.filter-dd-opt.on .filter-dd-box::after {
  content: ''; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.filter-done {
  margin: 16px var(--modal-btn-inset) 0; width: auto; min-height: var(--modal-btn-h);
  padding: 0 18px; border-radius: 12px; font-size: 15px;
}

/* Larger screens: bigger cards, deck takes a touch less vertical space */
@media (min-width: 720px) {
  .db-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; padding: 10px 18px 22px; }
  .db-deck { flex-basis: 34%; }
  .db-section-head { padding: 12px 18px 6px; }
  .filter-bar { padding: 4px 18px 10px; }
}
/* Wide desktops: roomier still so each card reads clearly. */
@media (min-width: 1200px) {
  .db-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 18px; }
}

/* ============== START SCREEN ============== */
/* --duel-col = el ancho de las cuatro listas del tab de DUELO (modos, cabecera de subvista,
   mazos y lecciones). Estaban las cuatro clavadas a 640px, que en una pantalla ancha dejaba la
   pestaña ocupando un tercio del hueco y se leía pequeña. Ahora sale de aquí y crece con la
   pantalla, sin bajar nunca de lo que medía antes. */
.start-screen {
  --duel-col: clamp(640px, 52vw, 880px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  height: 100%;
  padding: 30px 18px 44px;
  padding-top: max(30px, var(--safe-t));
  padding-bottom: max(30px, var(--safe-b));
  text-align: center;
  overflow-y: auto;
}
.title {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1.05;
  background: linear-gradient(180deg, #fde68a 0%, #f5c14a 45%, #b8861a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  margin: 0 0 14px;
  letter-spacing: 0.04em;
}
/* El lobby de DUEL cabe en UNA pantalla, sin scroll: sus medidas salen de `min(vw, vh)`, asi
   que en una ventana baja (1280x720, 1366x768) encogen con el alto en vez de desbordar. A
   1920x1080 mandan los topes de siempre y no cambia nada. */
.start-screen > .title:not(.sub) { font-size: clamp(40px, min(7vw, 9vh), 88px); margin-bottom: clamp(6px, 1.4vh, 14px); }
.subtitle {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.deck-pick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 360px));
  gap: 24px;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
}
.deck-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1.5px solid var(--border-soft);
  border-radius: 18px;
  padding: 32px 26px;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(6px);
}
.deck-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--accent, var(--player)) 0%, transparent 65%);
  opacity: 0.12; pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .deck-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent, var(--player));
    box-shadow: 0 18px 44px -12px var(--accent, var(--player)), 0 0 0 1px var(--accent, var(--player));
  }
}
.deck-card h3 {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--accent, var(--player));
  letter-spacing: 0.02em;
}
.deck-card p {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0 0 18px;
}
.deck-preview {
  display: flex; gap: 8px; justify-content: center; font-size: 32px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}
.deck-card:active { transform: translateY(-2px) scale(0.99); }

/* ---- Duel deck picker (saved decks + presets) ---- */
.start-section { width: 100%; max-width: 760px; margin: 24px auto 0; text-align: left; }
.start-section-title {
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 11px; padding-left: 2px;
}
.start-no-decks {
  font-family: var(--font-body); font-size: 13px; color: var(--text-muted); line-height: 1.5;
  padding: 16px; border: 1.5px dashed var(--border-strong); border-radius: 14px; text-align: center;
}
.start-deck-list { display: flex; flex-direction: column; gap: 10px; }
.start-deck {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
  border: 1px solid var(--border-soft); border-radius: 14px; padding: 13px 16px; cursor: pointer;
  transition: transform .12s var(--ease-out), border-color .15s, box-shadow .15s, background .15s;
}
.start-deck:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) {
  .start-deck:not(.disabled):hover { transform: translateY(-2px); border-color: var(--player); box-shadow: 0 10px 26px -14px var(--player); }
}
.start-deck.disabled { opacity: 0.5; cursor: not-allowed; }
/* Featured cards on the left so decks are recognizable in the duel lobby too. */
.start-deck-feat { display: flex; gap: 6px; flex: 0 0 auto; }
.start-deck-feat-card { width: clamp(46px, 11vw, 64px); flex: 0 0 auto; }
.start-deck-feat-card .card { width: 100%; height: auto; }
.start-deck-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.start-deck-name { font-family: var(--font-ui); font-weight: 800; font-size: 16px; }
.start-deck-meta { font-family: var(--font-ui); font-size: 12px; color: var(--text-dim); }
.start-deck-emojis { font-size: 18px; margin-top: 3px; line-height: 1; }
.start-deck-go { flex: 0 0 auto; font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: var(--player-bright); white-space: nowrap; }
.start-deck-warn { flex: 0 0 auto; font-family: var(--font-ui); font-weight: 700; font-size: 11px; color: var(--warning); white-space: nowrap; text-align: right; }
.start-section .deck-pick { max-width: 760px; }
@media (min-width: 720px) {
  .start-section .deck-pick { grid-template-columns: repeat(2, minmax(0, 360px)); }
}

/* ============== GAME SHELL — viewport-fit ============== */
/* The duel shell is now a single full-viewport stage: the new HUD lives INSIDE
   the battlefield (corners, rails, divider) rather than in a topbar/dock, so the
   board can fill the whole screen (landscape-first). */
.game-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* ── Custom cursors (PC only). The hand-drawn cursor set is no longer duel-only:
   it runs across the WHOLE app (home, shop, collection, deck builder, missions,
   settings, modals…). The base rule is !important so no element's own cursor
   (pointer / zoom-in / not-allowed / crosshair…) ever leaks a system cursor. It
   hangs off `body.app-cursor` (set in index.html) so the labs that share this
   stylesheet (fx-lab.html, victory-rewards.html) keep their native cursors.
   Layered overrides: grab hand over anything you can drag or tilt, fist while
   holding one, sword while an attack is armed. Cursor PNGs are 32px (large cursors
   are rejected by the OS → system fallback; 32px renders reliably). ── */
@media (hover: hover) and (pointer: fine) {
  /* Base: pointing finger everywhere, overriding any element-set cursor. */
  body.app-cursor, body.app-cursor * { cursor: url('../icons/cursor.png?v=2') 11 4, pointer !important; }

  /* Click "pop": while the mouse is held down the finger shrinks a little, then
     springs back on release. */
  body.app-cursor *:active { cursor: url('../icons/cursor_press.png?v=1') 8 3, pointer !important; }

  /* The ONE place a native cursor stays: text entry (player name, card search, deck
     name, login). A pointing finger over an editable field reads as "not editable",
     and there is no hand-drawn caret to put there. */
  body.app-cursor input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]):not([type="color"]),
  body.app-cursor textarea,
  body.app-cursor [contenteditable="true"] { cursor: text !important; }

  /* Hover a draggable card (when NOT mid-drag) → open "grab" hand. */
  .battlefield:not(.dragging-card) .hand-fan.side-player .card,
  .battlefield:not(.dragging-card) .hand-fan.side-player .card *,
  .battlefield:not(.dragging-card) .duel-row-player .slot .card,
  .battlefield:not(.dragging-card) .duel-row-player .slot .card * {
    cursor: url('../icons/cursor_grab.png?v=2') 16 4, grab !important;
  }

  /* The same open hand outside the duel, over the surfaces you grab & tilt: the zoom
     inspector, the pack-summary inspect card and the deck loadout preview. */
  .card-modal .card.preview, .card-modal .card.foil-card,
  .card-modal.po-inspect .card,
  .cl-preview .card {
    cursor: url('../icons/cursor_grab.png?v=2') 16 4, grab !important;
  }

  /* The LEVEL REWARDS rail has no scrollbar — it is dragged sideways, so it gets the
     same open hand, closing into a fist while it moves. The CLAIM button inside it is a
     real button and keeps the finger (press-pop included). */
  .missions-screen .lvr-rail, .missions-screen .lvr-rail * {
    cursor: url('../icons/cursor_grab.png?v=2') 16 4, grab !important;
  }
  .missions-screen .lvr-rail.is-dragging, .missions-screen .lvr-rail.is-dragging * {
    cursor: url('../icons/cursor_fist.png?v=3') 13 13, grabbing !important;
  }
  .missions-screen .lvr-rail .lvr-btn { cursor: url('../icons/cursor.png?v=2') 11 4, pointer !important; }
  .missions-screen .lvr-rail .lvr-btn:active { cursor: url('../icons/cursor_press.png?v=1') 8 3, pointer !important; }

  /* Holding a card → closed fist across the whole board (grab rule is excluded
     during the drag via :not, so no conflict). The fist is rendered a bit smaller
     than the other cursors to reinforce the "holding" feel. */
  .battlefield.dragging-card, .battlefield.dragging-card * {
    cursor: url('../icons/cursor_fist.png?v=3') 13 13, grabbing !important;
  }

  /* …and while actually tilting one of the app's preview cards. */
  .card-modal.po-inspect.grabbing, .card-modal.po-inspect.grabbing .card,
  .cl-preview.grabbing, .cl-preview.grabbing .card {
    cursor: url('../icons/cursor_fist.png?v=3') 13 13, grabbing !important;
  }

  /* Selecting / dragging a hero to attack another → a sword cursor while the attack
     arrow is up (hotspot at the blade tip). Placed AFTER the base/:active rules so it
     wins on source order during the attack. */
  .battlefield.attacking, .battlefield.attacking * {
    cursor: url('../icons/cursor_sword.png?v=1') 24 3, crosshair !important;
  }

  /* Dragging a Proof-of-Sacrifice hero over a tribute keeps the "holding" fist —
     the summon indicator is now the spinning summon.png over the tribute (see
     .sacrifice-summon-icon), so no static swirl cursor competes with it. */
}

/* ============== TOP BAR / HUD ============== */
/* Slim title bar — the CPU/player identity now lives in the mirrored battlefield
   bars, so the topbar just carries the DUEL title. */
.topbar {
  grid-column: 1 / -1;
  display: flex; justify-content: center; align-items: center;
  padding: 2px 10px;
  background: linear-gradient(180deg, rgba(8, 11, 20, 0.34) 0%, transparent 100%);
  font-family: var(--font-ui);
  min-height: 0;
}
.topbar .brand {
  font-family: var(--font-display);
  font-size: 18px;
  background: linear-gradient(180deg, #fde68a 0%, #f5c14a 60%, #b8861a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.06em;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
/* Left HUD group: the player's avatar + name sit at the far left of the topbar. */
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hud-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hud-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  background: radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--av, #60a5fa) 38%, #171a24) 0%, #131620 82%);
  border: 2px solid color-mix(in srgb, var(--av, #60a5fa) 70%, transparent);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex: none;
}
.hud-name {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--player-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 120px;
}
/* CPU variant in the topbar: red team accent + the helmet artwork inside. */
.hud-avatar-cpu {
  background: radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--ai) 34%, #1a1216) 0%, #16121a 82%);
  border-color: color-mix(in srgb, var(--ai) 70%, transparent);
  padding: 3px;
}
.hud-avatar-cpu img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)); }
.hud-name-cpu { color: var(--ai-bright); }
.turn-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.turn-pill.player {
  background: var(--player-soft);
  color: var(--player-bright);
  border: 1px solid rgba(96, 165, 250, 0.45);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.15);
}
.turn-pill.ai {
  background: var(--ai-soft);
  color: var(--ai-bright);
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.15);
}

/* ============== ENERGY METER ============== */
/* Deboxed HUD: just the bolt icon and the "cur/max" count floating over the
   battlefield (the orbs were dropped). The active player's meter glows on its
   icon; at turn start it pulses light-blue while the number climbs to max. */
.energy-meter {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-ui);
}
/* Active player's meter glows on its icon — the same light-blue halo for both
   sides (player and CPU), never gold. */
.energy-meter.active .em-icon {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55))
          drop-shadow(0 0 10px rgba(125, 211, 252, 0.9));
}
/* Turn-start recharge: the bolt pulses a soft light-blue while the number
   climbs from the leftover energy up to max. Overrides the active glow. */
.energy-meter.recharging .em-icon {
  animation: energyRechargePulse 0.85s var(--ease-in-out) infinite;
}
@keyframes energyRechargePulse {
  0%, 100% { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 7px rgba(125, 211, 252, 0.55)); }
  50%      { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 18px rgba(125, 211, 252, 1)); }
}
.energy-meter.recharging .em-count b { color: #7dd3fc; transition: color .2s ease; }

.em-icon {
  width: clamp(46px, 4.8vw, 60px);
  height: clamp(46px, 4.8vw, 60px);
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 5px rgba(125, 211, 252, 0.5));
}

.em-count {
  font-family: var(--font-display);
  font-size: calc(var(--hud-num) * 0.78);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
  letter-spacing: 0.02em;
}
.em-count b { color: var(--energy); font-size: var(--hud-num); }
.energy-meter.player .em-count b { color: var(--player-bright); }
.energy-meter.ai .em-count b     { color: var(--ai-bright); }
.em-sep { color: var(--text-dim); margin: 0 2px; opacity: 0.6; }

/* ============== STAR METER (victories) ============== */
/* 3 star slots beside each player's name; one gold star per win. Empty slots
   show a dim star socket; the freshly-won star pops with a subtle sparkle. */
.star-meter { display: inline-flex; align-items: center; gap: 5px; }
.star-slot {
  position: relative;
  width: clamp(27px, 2.9vw, 36px);
  height: clamp(27px, 2.9vw, 36px);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.star-slot img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
/* Empty socket: a faint, drained star so the 3 slots always read. */
.star-slot.empty img {
  filter: grayscale(1) brightness(0.42);
  opacity: 0.34;
}
.star-slot.filled img {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 5px rgba(245, 193, 74, 0.55));
}
/* Held star (Impermanent Loss): won but not counted until that side's next turn. A see-through
   gold star that breathes, so it reads as "almost yours". */
.star-slot.held img { opacity: 0.5; animation: starHeld 1600ms ease-in-out infinite; }
@keyframes starHeld {
  0%, 100% { opacity: 0.35; transform: scale(0.88); }
  50%      { opacity: 0.7;  transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .star-slot.held img { animation: none; } }
/* Pop + sparkle on the newly-won star (mirrors the coin target pop). */
.star-slot.just-won img { animation: starWinPop 900ms var(--ease-out); }
@keyframes starWinPop {
  0%   { transform: scale(0.2) rotate(-20deg); filter: brightness(2.4) drop-shadow(0 0 0 rgba(245,193,74,0)); }
  40%  { transform: scale(1.5) rotate(8deg);  filter: brightness(1.8) drop-shadow(0 0 12px rgba(245,193,74,0.95)); }
  65%  { transform: scale(0.92) rotate(-3deg); }
  100% { transform: scale(1) rotate(0);       filter: brightness(1) drop-shadow(0 0 5px rgba(245,193,74,0.55)); }
}
/* Sparkle: a quick expanding flash behind the star. */
.star-spark {
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 246, 214, 0.95) 0%, rgba(245, 193, 74, 0.5) 35%, transparent 70%);
  animation: starSpark 700ms var(--ease-out) forwards;
}
@keyframes starSpark {
  0%   { opacity: 0; transform: scale(0.2); }
  35%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.7); }
}

.btn {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid rgba(96, 165, 250, 0.55);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.15), rgba(59, 130, 246, 0.08));
  color: var(--player-bright);
  cursor: pointer;
  border-radius: 10px;
  transition: transform .14s var(--ease-out), background .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.28), rgba(59, 130, 246, 0.15));
    border-color: var(--player-bright);
    box-shadow: 0 6px 18px -4px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}
/* Instant, tactile press feedback — the UI must feel like it heard the tap. */
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:focus-visible {
  outline: 2px solid var(--player-bright);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.danger {
  border-color: rgba(248, 113, 113, 0.55);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.15), rgba(239, 68, 68, 0.08));
  color: var(--ai-bright);
}
@media (hover: hover) and (pointer: fine) {
  .btn.danger:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(248, 113, 113, 0.28), rgba(239, 68, 68, 0.15));
    border-color: var(--ai-bright);
    box-shadow: 0 6px 18px -4px rgba(239, 68, 68, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}
.btn.primary {
  border-color: rgba(245, 193, 74, 0.6);
  background: linear-gradient(180deg, rgba(253, 230, 138, 0.20), rgba(245, 193, 74, 0.10));
  color: var(--gold-bright);
}
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(253, 230, 138, 0.32), rgba(245, 193, 74, 0.18));
    border-color: var(--gold-bright);
    box-shadow: 0 6px 18px -4px rgba(245, 193, 74, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}

/* ============================================================
   SHARED UI SYSTEM — one button / menu language across the app.
   Built on the embossed gold-relief tokens (--gold-*) already used by the
   wallet-connect, duel action (END TURN) and HUD icon buttons, so every new
   surface (shop, modals, filters) reads as the same family. Adopt incrementally:
     · buttons → `ui-btn ui-btn-gold` (primary) | `ui-btn ui-btn-ghost` (secondary)
     · icon button → `ui-btn-icon`
     · menus / info groups → `ui-panel`
     · modals → `ui-modal-overlay` > `ui-modal`
     · filters → `ui-seg` (group) > `ui-chip` (+ `.on`, `.rar`)
   ============================================================ */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 14px; letter-spacing: 0.04em;
  line-height: 1; text-align: center; text-decoration: none; white-space: nowrap;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  min-height: 44px; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out),
              filter .12s var(--ease-out), background .15s ease, border-color .15s ease, color .15s ease;
}
.ui-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

/* Primary gold (filled, dark text) — same recipe as wallet-connect / END TURN. */
.ui-btn-gold {
  color: #2a1c00; border-color: var(--gold-edge);
  background: var(--gold-face); box-shadow: var(--gold-relief);
}
@media (hover: hover) and (pointer: fine) { .ui-btn-gold:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); box-shadow: var(--gold-relief-hover); } }
.ui-btn-gold:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.96); box-shadow: var(--gold-relief-press); }
.ui-btn-gold:disabled { box-shadow: var(--gold-relief); }

/* Secondary ghost (outlined gold-on-dark) — non-primary actions next to a gold CTA. */
.ui-btn-ghost {
  color: var(--gold-bright); border-color: rgba(245,193,74,0.45);
  background: linear-gradient(180deg, rgba(245,193,74,0.12), rgba(245,193,74,0.05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 8px rgba(0,0,0,0.30);
}
@media (hover: hover) and (pointer: fine) {
  .ui-btn-ghost:hover:not(:disabled) {
    transform: translateY(-2px); border-color: var(--gold-bright);
    background: linear-gradient(180deg, rgba(245,193,74,0.22), rgba(245,193,74,0.10));
    box-shadow: 0 6px 16px -6px rgba(245,193,74,0.5), inset 0 1px 0 rgba(255,255,255,0.12);
  }
}
.ui-btn-ghost:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.97); }
.ui-btn-ghost img { width: 18px; height: 18px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }

/* Square gold icon button — same relief as the HUD icon boxes. */
.ui-btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-height: 40px; padding: 0; flex-shrink: 0;
  border-radius: 11px; border: 1px solid var(--gold-edge);
  background: var(--gold-face); box-shadow: var(--gold-relief);
  color: #2a1c00; font-family: var(--font-display); font-size: 16px; line-height: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), filter .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .ui-btn-icon:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: var(--gold-relief-hover); } }
.ui-btn-icon:active { transform: translateY(1px); filter: brightness(0.96); box-shadow: var(--gold-relief-press); }
.ui-btn-icon:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.ui-btn-icon img { width: 60%; height: 60%; object-fit: contain; }

/* Panel surface for menus / info groups. */
.ui-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border-soft); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Modal scaffold — strong scrim + centred dark panel. */
.ui-modal-overlay {
  position: fixed; inset: 0; z-index: 1300;
  display: flex; align-items: center; justify-content: center; padding: clamp(10px, 3vw, 28px);
  background: rgba(4, 7, 16, 0.74); backdrop-filter: blur(6px);
  animation: uiOverlayIn 180ms var(--ease-out);
}
@keyframes uiOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.ui-modal {
  width: min(960px, 100%); max-height: 90vh; max-height: 90dvh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(24,33,56,0.97), rgba(10,15,28,0.98));
  border: 1px solid var(--border-strong); border-radius: 20px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden; animation: uiModalIn 220ms var(--ease-out);
}
@keyframes uiModalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ui-overlay-in, .ui-modal-overlay, .ui-modal { animation: none; }
}

/* Segmented filter group + toggle chips. */
.ui-seg { display: flex; flex-wrap: wrap; gap: 7px; }
.ui-chip {
  font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
  padding: 8px 13px; min-height: 36px; border-radius: 999px; cursor: pointer;
  color: var(--text-dim); background: var(--surface-0); border: 1px solid var(--border-soft);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .ui-chip:hover { color: var(--text); border-color: var(--border-strong); } }
.ui-chip:active { transform: scale(0.96); }
.ui-chip:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.ui-chip.on { color: #2a1c00; border-color: var(--gold-edge); background: var(--gold-face); box-shadow: var(--gold-relief); }
.ui-chip.rar.on { color: var(--rar); border-color: var(--rar); background: color-mix(in srgb, var(--rar) 18%, transparent); box-shadow: none; }

/* ============== BATTLEFIELD ============== */
/* The battlefield is the whole stage: a positioning context that holds the
   absolutely-placed HUD (corners, rails, action, divider) plus the centred
   .duel-stage with the two rows + hands. See the "NEW DUEL HUD" section. */
.battlefield {
  position: relative;
  width: 100%;
  height: 100%;
  /* El arte mide 3168x1344 (ratio 2.357, o sea 21:9). Antes habia un tope de ancho
     (max(1320px, 240vh)) para que en un 32:9 el HUD no se fuera a los extremos, pero
     en cuanto la ventana pasaba de 2.4:1 (un 21:9 con la barra del navegador ya lo
     hace) quedaban bandas a los lados con el fondo del menu. Regla del usuario
     (2026-09-23): el cuadro llena SIEMPRE la pantalla entera, sin espejos ni bandas;
     en pantallas mas anchas que el arte, `cover` lo amplia y recorta un poco arriba
     y abajo. */
  max-width: none;
  margin-inline: auto;
  /* Battleground art fills the stage; the subtle vignette glow sits on top. The
     top black layer is the optional "Battlefield dimming" filter (--bg-darken,
     0 by default) — it darkens ONLY the background, never the cards/HUD above it.
     QUE cuadro se pinta lo decide el campo elegido en AJUSTES: JS publica `--bg-art`
     sobre .battlefield (ver duel-field.js / fieldIdOf en game.js) y el url de aqui es
     solo el respaldo, el campo de fabrica, por si nadie lo ha publicado todavia. */
  background:
    linear-gradient(rgba(0, 0, 0, var(--bg-darken, 0)), rgba(0, 0, 0, var(--bg-darken, 0))),
    radial-gradient(ellipse 70% 50% at center, rgba(255, 255, 255, 0.02), transparent 72%),
    var(--bg-art, url('../UI/forest_custom_bg.jpg')) center no-repeat;
  /* El dibujo NO va a `cover`: va al tamano que publica `--bg-size` desde JS (ver
     bgGeoOf en game.js), que es `cover` o el zoom que haga falta para que la arena
     conserve su altura util — lo que sea mayor. `cover` es el respaldo por si el
     JS no ha medido todavia. Solo se le da tamano a la CAPA DEL CUADRO; las dos
     de arriba son degradados y siguen a `auto`. */
  background-size: auto, auto, var(--bg-size, cover);
  overflow: hidden;
  /* CRITICAL for touch: disable browser pan/zoom for any gesture that starts on
     the board so every touch becomes a Pointer Event (taps, holds, drags). Without
     this, real mobile browsers claim the gesture and fire pointercancel, so taps
     and card drags silently fail. The hand's "swipe to scroll" is handled in JS. */
  touch-action: none;
  overscroll-behavior: contain;
}

/* ===== Battleground fire/torch ambient animation =====
   Soft, looping warm glow laid over the torches + corner braziers painted into
   the background. Positioned in JS (see BattlefieldFx) to track the cover-cropped
   image; `screen` blend brightens the painted flame so it crackles/breathes.
   Decorative only — behind the cards (z1) and inert to pointer input. */
.battlefield-fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.fire-fx {
  position: absolute;
  transform: translate(-50%, -50%); /* centre on the measured fire point */
}

/* ===== Elementos interactivos del escenario (field-elements.js) =====
   Los trastos que el campo lleva puestos — el muñeco de nieve del Christmas
   Battleground —, colocados en JS sobre el cuadro recortado igual que los fuegos.
   La CAPA es inerte y el elemento también: solo sus piezas tocables reactivan el
   puntero (`.fe-hit`), así que tocar el CUERPO del muñeco atraviesa y suelta el
   tap de nieve del campo, que es lo que tiene que pasar. */
.battlefield-props {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  /* (Aquí iba un `filter: brightness(calc(1 - var(--bg-darken, 0)))` para el "Battlefield
     dimming" de AJUSTES. El ajuste se retiró y `--bg-darken` ya nadie lo publica, así que valía
     siempre brightness(1): no cambiaba nada y aun así cada capa de pantalla completa con filtro se
     componía aparte en cada fotograma. Fuera, 2026-11-04.) */
}
.battlefield-props .fe-host { position: absolute; }
/* La capa de DELANTE: por encima de la escena del duelo (z 10, las cartas) y por debajo del HUD
   (z 40). La piden los elementos con `front` en field-elements.js — hoy, la carpa koi, cuyo salto
   quedaba tapado por los dorsos. Comparte todo lo demás con la capa normal, oscurecido incluido. */
.battlefield-props.is-front { z-index: 12; }
/* Y la de las SOMBRAS, por DEBAJO de todos los elementos (que van en z 1) y por debajo de los
   fuegos: una sombra oscurece el fondo del cuadro, nunca a otro trasto ni el resplandor de una
   antorcha. */
.battlefield-props.is-shadows {
  z-index: 0;
  /* Y ACOMPAÑAN AL CIELO (los publica WeatherLayer sobre .battlefield, ver game.js):
     `--wx-overcast` con lluvia o tormenta —un cielo cubierto no hace sombra dura, así que se
     ablandan— y `--wx-flash` mientras dura un relámpago, que las devuelve de golpe y MÁS
     marcadas que con sol. Ese contraste es lo que hace que el fogonazo se lea como una luz de
     verdad y no como un parpadeo de la pantalla. Sin tiempo, los dos valen 0 y esto es 1. */
  opacity: calc(1 - 0.5 * var(--wx-overcast, 0) + 0.5 * var(--wx-flash, 0));
}
/* Con el fogonazo la sombra se oscurece por encima de lo normal, que es justo lo que hace una luz
   dura. Solo con TORMENTA (WeatherLayer pone `data-wx="storm"` en .battlefield): el resto del
   tiempo este filtro valía brightness(1) y obligaba a componer la capa aparte en cada fotograma. */
.battlefield[data-wx="storm"] .battlefield-props.is-shadows {
  filter: brightness(calc(1 - 0.4 * var(--wx-flash, 0)));
}

/* ===== El TIEMPO (FX.snowfall) =====
   Por delante del paisaje, de los fuegos y de los trastos (z 2) y por detrás de las cartas
   (la escena va en z 10): la nieve cruza entre el jugador y el decorado sin taparle el tablero.
   Se apaga con el mismo mando que el fondo, igual que los elementos — nieve a plena luz sobre un
   cuadro atenuado se leería como si flotara por delante de la pantalla. */
.battlefield-weather {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  /* (Su `filter: brightness(--bg-darken)` se fue con el ajuste de atenuado: ver .battlefield-props.) */
}

/* ===== EL FOGONAZO del relámpago (FX.rainfall en modo tormenta) =====
   Aparte de `.battlefield-weather` y no dentro: aquélla va en z 2 y crea su propio apilamiento,
   así que un hijo suyo no puede pintarse por encima de las cartas. Y tiene que poder: un rayo es
   luz del cielo e ilumina TAMBIÉN lo que hay sobre el tablero — si sólo aclarara el paisaje, se
   leería como un fallo de la pantalla y no como un relámpago.
   z 30: por encima de la escena del duelo (z 10) y de la capa de delante (z 12), por debajo del
   HUD (z 40). El marcador, los botones y el registro son interfaz, no están bajo la tormenta, y
   blanquearlos sólo estorbaría para leerlos.
   Inerte y VACÍA mientras no hay tormenta: el <div> siempre está, el fogonazo lo mete el efecto. */
.battlefield-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.fire-fx .fire-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  mix-blend-mode: screen;
  will-change: opacity, transform;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 234, 165, 0.85) 0%,
    rgba(255, 178, 72, 0.55) 30%,
    rgba(255, 120, 32, 0.26) 55%,
    rgba(255, 92, 22, 0) 74%);
  animation: fireFlicker var(--fdur, 2s) ease-in-out infinite;
  animation-delay: var(--fdelay, 0s);
}
/* Torch flames lean a touch taller and reach upward. */
.fire-fx.fire-torch .fire-glow {
  background: radial-gradient(ellipse 58% 72% at 50% 44%,
    rgba(255, 240, 175, 0.9) 0%,
    rgba(255, 184, 76, 0.6) 30%,
    rgba(255, 120, 30, 0.28) 56%,
    rgba(255, 92, 22, 0) 76%);
}
/* Irregular steps mimic a crackling flame rather than a smooth pulse. */
@keyframes fireFlicker {
  0%   { opacity: .58; transform: scale(.95); }
  15%  { opacity: .86; transform: scale(1.02); }
  30%  { opacity: .68; transform: scale(.985); }
  45%  { opacity: 1;   transform: scale(1.06); }
  60%  { opacity: .78; transform: scale(1.0); }
  78%  { opacity: .92; transform: scale(1.04); }
  100% { opacity: .58; transform: scale(.95); }
}
/* ===== PAVESAS (las chispas que sueltan los fuegos) =====
   Cada fuego escupe de vez en cuando una chispita que sube, deriva y se apaga. NO es
   continuo: la animación ocupa solo el primer 12 % de su ciclo y el 88 % restante lo
   pasa invisible — ese hueco ES el intervalo.
   Para que los intervalos no coincidan, la desincronización va en DOS capas: el ciclo y
   la fase salen del `:nth-child` del FUEGO y cada chispa los multiplica por lo suyo
   (×1 / ×1.26 / ×0.79). Salen 18 periodos distintos, separados como mínimo un 3.2 %
   entre sí y sin relaciones 1:1 ni 1:2 (que son las únicas que el ojo lee como "van
   juntas"): dos chispas que por azar salgan a la vez se separan en menos de 25 s. Los
   números NO son a ojo — están buscados con esa condición; si se tocan, hay que volver
   a comprobarla o el efecto se vuelve un metrónomo.
   El calibre y el recorrido van en FRACCIONES de `--fsize` (el lado del fuego, que lo
   publica BattlefieldFx en px) para que escalen con el cuadro igual que el resplandor. */
.fire-embers { position: absolute; inset: 0; overflow: visible; }
.fire-embers i {
  position: absolute;
  left: calc(50% + var(--fsize, 84px) * var(--ex, 0));
  top: 42%;                                                  /* nace en el cuerpo de la llama */
  width: calc(var(--fsize, 84px) * var(--es, 0.032));
  height: calc(var(--fsize, 84px) * var(--es, 0.032));
  margin: calc(var(--fsize, 84px) * var(--es, 0.032) / -2);   /* centrada en su punto */
  border-radius: 50%;
  background: radial-gradient(circle,
    #fff4c6 0%, #ffb347 42%, rgba(255, 122, 28, 0.5) 70%, rgba(255, 110, 25, 0) 100%);
  opacity: 0;
  will-change: transform, opacity;
  --edx: calc(var(--fsize, 84px) * var(--exd, 0));
  --edy: calc(var(--fsize, 84px) * var(--ey, 0.72) * -1);
  animation: fireEmber calc(var(--ecyc, 12s) * var(--em, 1)) linear
             calc(var(--ephase, 0s) + var(--esd, 0s)) infinite;
}
/* Las tres chispas de un fuego: periodo, arranque, sitio, deriva, altura y calibre. */
.fire-embers i:nth-child(1) { --em: 1;    --esd: 0s;    --ex: -0.05; --exd: -0.13; --ey: 0.74; --es: 0.033; }
.fire-embers i:nth-child(2) { --em: 1.26; --esd: -3.4s; --ex:  0.06; --exd:  0.11; --ey: 0.66; --es: 0.028; }
.fire-embers i:nth-child(3) { --em: 0.79; --esd: -6.9s; --ex:  0.01; --exd:  0.05; --ey: 0.84; --es: 0.036; }
/* Y el ciclo/fase de CADA fuego, en el orden en que los pinta BattlefieldFx. Las fases
   son negativas: cada uno entra ya empezado, no los seis a la vez desde cero. */
.battlefield-fx .fire-fx:nth-child(1) { --ecyc: 11.1s; --ephase:  -3.6s; }
.battlefield-fx .fire-fx:nth-child(2) { --ecyc: 12.5s; --ephase:  -5.2s; }
.battlefield-fx .fire-fx:nth-child(3) { --ecyc: 12.9s; --ephase:  -9.1s; }
.battlefield-fx .fire-fx:nth-child(4) { --ecyc: 13.4s; --ephase:  -3.2s; }
.battlefield-fx .fire-fx:nth-child(5) { --ecyc: 14.6s; --ephase:  -7.3s; }
.battlefield-fx .fire-fx:nth-child(6) { --ecyc: 15.1s; --ephase: -11.4s; }
/* Salta, sube FRENANDO (la distancia corre más que el tiempo al principio) y se apaga,
   todo dentro del primer 12 %; el resto del ciclo se queda quieta y a opacidad 0. */
@keyframes fireEmber {
  0%    { opacity: 0;  transform: translate(0, 0) scale(.45); }
  1.5%  { opacity: .9; transform: translate(calc(var(--edx) * .18), calc(var(--edy) * .18)) scale(1); }
  6.5%  { opacity: .6; transform: translate(calc(var(--edx) * .62), calc(var(--edy) * .62)) scale(.78); }
  12%   { opacity: 0;  transform: translate(var(--edx), var(--edy)) scale(.34); }
  100%  { opacity: 0;  transform: translate(var(--edx), var(--edy)) scale(.34); }
}
@media (prefers-reduced-motion: reduce) {
  .fire-fx .fire-glow { animation: none; opacity: .82; }
  .fire-embers { display: none; }   /* la pavesa es puro movimiento: sin él no queda nada */
}
.side-label {
  font-family: var(--font-ui); font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 6px;
}
.side-label .stats {
  display: flex; gap: 14px;
  font-family: var(--font-body); font-weight: 500; font-size: 13px; color: var(--text);
}
.side-label .stats span b { color: var(--gold); font-weight: 700; }

/* Hand rows — single line, no wrap. Cards overlap slightly if hand fills up. */
.hand-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: nowrap;
  padding: 2px 8px;
  min-height: 0;
  min-width: 0;
}
.hand-row .card.in-hand {
  width: clamp(78px, 7.5vw, 110px);
  height: auto;
  aspect-ratio: 11 / 16;
}

/* ============== HAND FAN (abanico) ============== */
/* The player's hand is an overlapping arc. Cards are absolutely positioned and
   transformed (translate + rotate, computed in JS from the live width) so the
   whole hand always fits without scrolling. The band only shows the top ~2/3 of
   each card — the bottom third drops below and is clipped by the battlefield,
   while a held/hovered card grows upward into the open space above. */
.hand-fan {
  position: relative;
  width: 100%;
  height: clamp(40px, 5.2vh, 56px);
  margin-top: auto;
  min-height: 0;
  min-width: 0;
}
.hand-fan-slot {
  position: absolute;
  left: 50%;
  bottom: 0;
  /* translateX(-50%) centres; translateY(28%) drops the bottom third out of
     view; the per-card translate/rotate (appended inline) builds the arc. */
  transform-origin: bottom center;
  transition: transform .18s var(--ease-out);
  will-change: transform;
  /* The slot is only a positioning box: it is TALLER/WIDER than the card it holds
     and it sits above the board (inline z-index 10+, and .hand-fan is not a
     stacking context). Left interactive, its transparent margin swallowed clicks
     aimed at whatever pokes into that band from the field — which is exactly how
     the Bitcoin Whale's ACTIVATE icon (it overhangs the card's bottom edge) ended
     up dead on its lower third. Only the card itself should be a hit target;
     :hover still reaches this element through its hovered child. */
  pointer-events: none;
}
.hand-fan-slot > * { pointer-events: auto; }
.hand-fan-slot .card.in-hand {
  width: 100%;
  height: auto;
  aspect-ratio: 11 / 16;
  /* Drop the bottom third below the play area so only the top ~2/3 of each card
     reads — the cards sit low and don't eat the field. The clipped third tucks
     behind the player bar (z-40, above the hand). */
  transform: translateY(30%);
}
/* Desktop hover: a modest lift to show the card sits under the cursor. Only with a real
   hover: on touch `:hover` STICKS after a tap, and this (0,3,1) rule beat the
   `.card.in-hand:hover { transform: none }` reset of `@media (hover: none)`, so the
   tapped card stayed lifted over the board until you touched something else. */
@media (hover: hover) {
  .hand-fan-slot .card.in-hand:hover {
    transform: translateY(-12%) scale(1.12);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.72);
    z-index: 5;
  }
}
/* …and a HIT-AREA extension under it, or that lift flickers. The card is its own
   hover target, and the lift moves it UP by 42% of its own height (30% → -12%):
   the bottom 36% of the RESTING box is then outside the LIFTED box, so a pointer
   there hovers the card, the card jumps out from under it, :hover drops, the card
   falls back onto the pointer — a ~12Hz oscillation, and via the z-index rule below
   the neighbouring cards flicker with it. Most of that band is off-screen, but 5-9px
   of it always lands on the bottom edge of the viewport, on the centre card(s).
   36% (of the card, pre-scale) is what the lift abandons: 0.44H + 1.12·0.36H = 0.84H
   ≥ the 0.80H the resting box reached. It is a hit target only — no paint — and while
   the card rests it sits entirely below the viewport, so it swallows nothing. */
.hand-fan-slot .card.in-hand::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 36%;
}
/* Press-and-hold: the card grows noticeably bigger and rises clear of the hand
   (its neighbours are shoved aside in JS) so it can be read comfortably. */
.hand-fan-slot .card.in-hand.raised {
  transform: translateY(-34%) scale(1.46);
  box-shadow: 0 26px 48px rgba(0, 0, 0, 0.78);
  z-index: 6;
}
/* Lift the whole slot above its neighbours while hovered (touch raises bump the
   slot's z-index inline instead). Scoped to the PLAYER hand — the rival hand must
   NOT jump on top of its neighbours (see the enemy-hand-back hover below). */
@media (hover: hover) and (pointer: fine) { .hand-fan-slot:not(.enemy):hover { z-index: 70 !important; } }
/* While the reveal is playing, the hand copy stays fully hidden. The reveal
   card shrinks onto this exact slot and HOLDS there, so when the reveal layer is
   removed the real card simply takes its place — a clean swap, no fade. */
.hand-fan-slot.reveal-pending { opacity: 0; }

/* ---- Enemy hand: a big inverted fan of face-down backs at the very top,
   mirroring the player's hand. Cards hang DOWN from the top edge: the top
   third lifts off-screen (clipped by the battlefield) so the bottom ~2/3
   shows — the vertical mirror of the player's band. ---- */
.hand-fan.side-ai {
  height: clamp(26px, 3.4vh, 42px);
  margin-top: 0;
  margin-bottom: auto;
}
.hand-fan.side-ai .hand-fan-slot {
  top: 0;
  bottom: auto;
  transform-origin: top center;
  /* The slot's box is card-height at the top edge, but the back is lifted up 46% (mostly
     off-screen). So the slot's hit box hangs BELOW the visible card — over the pond — and used
     to both eat water-taps there and lift the card on hover from below it. Make the slot itself
     transparent to the pointer; only the visible back (below) opts back in. This tightens the
     rival hand to exactly its visible cards: bare water around/below them stays tappable, and a
     back only lifts when hovered EXACTLY on the card. */
  pointer-events: none;
}
.enemy-hand-back {
  width: 100%;
  aspect-ratio: 11 / 16;
  /* El MISMO dorso que en todas partes (ver --card-back). */
  background: var(--card-back) center / contain no-repeat;   /* entero: `cover` cortaba el borde */
  display: block;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  user-select: none;
  pointer-events: auto;   /* the visible back captures the pointer (its slot doesn't — see above) */
  /* Lift most of the card off the top edge so it only peeks a little and never
     eats into the field. */
  transform: translateY(-46%);
  transition: transform .2s ease-in-out;
}
/* Hovering a rival hand card makes it protrude slightly DOWN into view (instead of jumping on
   top of its neighbours) — a smooth ease-in-out slide. Keyed off the BACK itself (not the slot),
   so it only reacts when the cursor is exactly over the visible card. */
@media (hover: hover) and (pointer: fine) { .enemy-hand-back:hover { transform: translateY(-30%); } }

/* ============== DRAW REVEAL (centre flip) ============== */
/* A fresh draw flies from the deck to the centre, flips face-up, holds, then
   shrinks straight into its EXACT hand slot. The outer node carries the path
   (translate+scale, driven by JS phases + a CSS transition); the inner node
   does the 3D flip so the card back shows first, then the real face. */
.draw-reveal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.draw-reveal-card {
  position: absolute;
  width: var(--reveal-w);
  aspect-ratio: 11 / 16;
  perspective: 1300px;
  will-change: transform, opacity;
}
/* Opening deal: face-up cards glide deck→hand (no centre zoom). Same layer/size
   base as the draw reveal so the deck/slot scale math lines up. */
.opening-draw-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.opening-draw-card {
  position: absolute;
  width: var(--reveal-w);
  aspect-ratio: 11 / 16;
  /* `perspective` porque ahora la carta del reparto tambien se VOLTEA (sale boca abajo del
     mazo): sin el, el giro sale plano en vez de en 3D. */
  perspective: 1300px;
  will-change: transform, opacity;
}
.opening-draw-card .card { width: 100%; height: 100%; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.62); }
.drc-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.drc-flip.do-flip { animation: drcFlip 380ms ease both; }
/* a discard leaving the player's hand: face-up from the first frame, no flip (DiscardFlyCard) */
.drc-flip.is-front { transform: rotateY(180deg); }
.drc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
}
/* las caras a ±grosor/2: entre ellas va el canto (CardThick, que escribe --card-thick en .drc-flip) */
.drc-back { transform: translateZ(calc(var(--card-thick, 0px) / 2)); }
.drc-front { transform: rotateY(180deg) translateZ(calc(var(--card-thick, 0px) / 2)); }
/* card backs are shown WHOLE (`contain`): the back PNG is wider than the 11:16 box and `cover` cut its silver rim */
.drc-back img { width: 100%; height: 100%; object-fit: contain; display: block; }
.drc-front .card { width: 100%; height: 100%; }
.drc-front .card,
.draw-reveal-card .card { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7); }

@keyframes drcFlip {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(180deg); }
}

/* ---- CPU draw glide: a face-down back travels from the CPU deck into its
   nearest hand slot. Same fixed, centred stage as the player reveal but it never
   flips (the enemy hand is always hidden), so it's a single moving back. ---- */
.ai-draw-layer {
  position: fixed;
  inset: 0;
  z-index: 115;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-draw-card {
  position: absolute;
  width: var(--reveal-w);
  aspect-ratio: 11 / 16;
  will-change: transform, opacity;
}
.ai-draw-back {
  width: 100%;
  height: 100%;
  background: var(--card-back) center / contain no-repeat;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.62));
}

/* CPU plays a card from hand → board slot (normal summon / permanent spell): a
   face-up card glides in like a draw, instead of the centred reveal. */
.ai-play-layer {
  position: fixed;
  inset: 0;
  z-index: 121;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-play-card {
  position: absolute;
  width: var(--reveal-w);
  aspect-ratio: 11 / 16;
  will-change: transform, opacity;
}
.ai-play-card .card { width: 100%; height: 100%; box-shadow: 0 22px 54px rgba(0, 0, 0, 0.66); }
/* Hide the spell-slot card while its hand→slot fly is in flight. */
.spell-slot.fly-hide .card { opacity: 0; }

/* ============== SUMMON REVEAL (centre → slot) ============== */
/* A played hero pops up big at screen centre, holds for a beat, then shrinks
   into its slot. The outer card carries the fly (translate+scale, set inline);
   the inner element plays the entrance pop so the two never fight. */
.summon-reveal-layer {
  position: fixed;
  inset: 0;
  z-index: 121;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.summon-reveal-card {
  position: absolute;
  width: var(--reveal-w);
  aspect-ratio: 11 / 16;
  transition: transform 0.36s cubic-bezier(0.45, 0.05, 0.2, 1);
}
.src-pop {
  width: 100%; height: 100%;
  animation: summonPop 0.34s var(--ease-out) both;
}
.src-pop .card { width: 100%; height: 100%; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); }
@keyframes summonPop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* The field copy waits invisible until the reveal lands on the slot. Kill the
   summon pop-in (the reveal IS the entrance) so it can't flash the card early. */
.slot.summon-pending .card { opacity: 0; }
.slot.summon-pending .card.summoning { animation: none; }

/* ============== COIN FLIP (who moves first, before the opening deal) ============== */
/* A real 3D coin: two faces pushed apart by --coin-t and a rim of flat segments closing
   the cylinder (see CoinFlipOverlay). Three nested boxes so each motion stays simple:
   .coin-lift = the parabola (+ it grows as it comes up towards the camera),
   .coin-tilt = a hook for a fixed lean (none today: the coin faces the camera head-on),
   .coin-spin = the turns. NONE of the three may take opacity/filter: either one flattens
   preserve-3d and the rim would paint over the faces. */
.coin-flip {
  --coin-d: clamp(104px, 27vh, 210px);           /* diameter */
  --coin-t: calc(var(--coin-d) * 0.105);         /* thickness */
  --coin-rise: 23vh;                             /* apex of the toss */
  --coin-tint: 96, 165, 250;                     /* heads = the player's blue */
  position: fixed;
  inset: 0;
  z-index: 133;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 46%, rgba(10, 14, 32, 0.62) 0%, rgba(3, 5, 12, 0.88) 78%);
  animation: coinDimIn 320ms ease both;
  touch-action: none;
}
.coin-flip.is-tails { --coin-tint: 248, 113, 113; }   /* tails = the CPU's red */
.coin-flip.ph-out { animation: coinDimOut var(--coin-out, 320ms) ease both; }
@keyframes coinDimIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes coinDimOut { from { opacity: 1; } to { opacity: 0; } }

.coin-title {
  position: absolute;
  top: 9vh; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(20px, 4.4vh, 40px);
  letter-spacing: 0.08em;
  color: #fff3cf;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 22px rgba(245, 193, 74, 0.55);
  transition: opacity 260ms ease;
}
/* Only while the coin waits: at the apex it climbs right through this line. */
.coin-flip:not(.ph-intro) .coin-title { opacity: 0; }

.coin-stage {
  position: relative;
  width: var(--coin-d);
  height: var(--coin-d);
  margin-top: 5vh;                               /* rest spot below centre: the apex clears the title */
  perspective: calc(var(--coin-d) * 4.2);
  perspective-origin: 50% 50%;
}
.coin-lift, .coin-tilt, .coin-spin {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.coin-lift { animation: coinPopIn var(--coin-intro) cubic-bezier(0.3, 1.3, 0.5, 1) both; will-change: transform; }
/* FRONTAL (23-09-2026): sin inclinacion — la moneda da la cara a la camara y voltea sobre el eje
   horizontal; el canto se ve solo cuando pasa de perfil. Antes: rotateZ(-7deg) rotateY(-19deg). */
.coin-tilt { transform: none; }
.coin-spin { will-change: transform; }
.coin-flip:not(.ph-intro) .coin-lift {
  animation: coinLift var(--coin-flight) linear both,
             coinHop var(--coin-settle) ease-out var(--coin-flight) forwards;
}
.coin-flip:not(.ph-intro) .coin-spin {
  animation: coinSpin var(--coin-flight) cubic-bezier(0.25, 0.5, 0.4, 1) forwards,
             coinWobble var(--coin-settle) ease-out var(--coin-flight) forwards;
}
/* Pops in, then DIPS: the thumb loading up before the flick. */
@keyframes coinPopIn {
  0%   { transform: translateY(0) scale(0); }
  50%  { transform: translateY(0) scale(1); }
  72%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(calc(var(--coin-d) * 0.09)) scale(0.97); }
}
/* A parabola is two quadratics: ease-out-quad going up, ease-in-quad coming down. */
@keyframes coinLift {
  0%   { transform: translateY(calc(var(--coin-d) * 0.09)) scale(0.97); animation-timing-function: cubic-bezier(0.5, 1, 0.89, 1); }
  50%  { transform: translateY(calc(var(--coin-rise) * -1)) scale(1.26); animation-timing-function: cubic-bezier(0.11, 0, 0.5, 0); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes coinHop {
  0%   { transform: translateY(0) scale(1); animation-timing-function: cubic-bezier(0.5, 1, 0.89, 1); }
  38%  { transform: translateY(calc(var(--coin-d) * -0.11)) scale(1.03); animation-timing-function: cubic-bezier(0.11, 0, 0.5, 0); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes coinSpin {
  from { transform: rotateX(0deg); }
  to   { transform: rotateX(var(--coin-end)); }
}
@keyframes coinWobble {
  0%   { transform: rotateX(var(--coin-end)); }
  30%  { transform: rotateX(calc(var(--coin-end) - 16deg)); }
  62%  { transform: rotateX(calc(var(--coin-end) + 7deg)); }
  100% { transform: rotateX(var(--coin-end)); }
}

.coin-face, .coin-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
}
.coin-face { backface-visibility: hidden; background: #e39427; }
.coin-face.heads { transform: translateZ(calc(var(--coin-t) / 2)); }
.coin-face.tails { transform: rotateX(180deg) translateZ(calc(var(--coin-t) / 2)); }
/* heads.png is the whole coin, off-centre in a padded 192px canvas, WITH a ~6px black outline
   (coin box 9..177 x 14..185, inner edge of the outline 15..171 x 20..180). NO black border
   (23-09-2026): scale it so a 153px circle INSIDE the outline (x 16.5..169.5, y 23.5..176.5)
   fills the disc — the outline falls outside and `overflow: hidden` clips it. */
.coin-face.heads img {
  position: absolute;
  width: 125.5%;
  left: -10.78%;
  top: -15.36%;
  max-width: none;
}
/* tails.png is only the emblem (crossed swords), so the disc under it is drawn here with
   the same rings as heads.png (bright rim, dark groove, orange field) — minus its black outline.
   Ring widths MEASURED on heads.png as framed above (radius 76.5px): bright rim ~16% of the
   radius, groove ~7% — so both faces show the same rim (it used to be ~24%, visibly thicker). */
.coin-face.tails {
  background:
    radial-gradient(circle closest-side, transparent 0 76.5%, #a85f02 77% 83.5%, #fbc131 84% 100%),
    radial-gradient(circle at 38% 30%, #f0a63a 0%, #e39427 46%, #cf7d17 100%);
}
.coin-face.tails img {
  position: absolute;
  width: 74%;
  left: 13%;
  top: 13%;
  max-width: none;
  filter: drop-shadow(0 2px 0 rgba(90, 44, 0, 0.55));
}
/* A fixed glare across whichever face is up. */
.coin-face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(128deg, rgba(255, 255, 255, 0.34) 8%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 70%, rgba(120, 50, 0, 0.22) 100%);
  pointer-events: none;
}
/* Solid middle, so nothing shows through the hairline joints of the rim. */
.coin-core { inset: 1.5%; background: #8a4a02; }
/* One flat segment of the rim: stood up on the circumference and turned to face outwards.
   Alternating shades = a reeded edge, which is also what makes the spin READ on the rim. */
.coin-edge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--coin-d) * 0.0672);           /* pi / 48 segments, plus a sliver of overlap */
  height: var(--coin-t);
  margin-left: calc(var(--coin-d) * -0.0336);
  margin-top: calc(var(--coin-t) / -2);
  transform: rotateZ(var(--a)) translateY(calc(var(--coin-d) * -0.4985)) rotateX(90deg);
  background: linear-gradient(to bottom, #f3b02c 0 26%, #d98a1c 26% 74%, #a55e06 74% 100%);
  backface-visibility: hidden;
}
.coin-edge:nth-of-type(even) {
  background: linear-gradient(to bottom, #d0851a 0 26%, #b06a0c 26% 74%, #834703 74% 100%);
}

/* Ground shadow under the resting spot: shrinks and fades as the coin climbs. */
.coin-shadow {
  position: absolute;
  left: 5%; right: 5%;
  top: 104%;
  height: 17%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0) 70%);
  animation: coinDimIn var(--coin-intro) ease both;
}
.coin-flip:not(.ph-intro) .coin-shadow { animation: coinShadow var(--coin-flight) linear both; }
@keyframes coinShadow {
  0%   { transform: scale(1); opacity: 1; animation-timing-function: cubic-bezier(0.5, 1, 0.89, 1); }
  50%  { transform: scale(0.42); opacity: 0.28; animation-timing-function: cubic-bezier(0.11, 0, 0.5, 0); }
  100% { transform: scale(1); opacity: 1; }
}
/* The catch: a ring of the winner's colour bursts out from behind the coin. */
.coin-burst {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle closest-side, rgba(var(--coin-tint), 0) 52%, rgba(var(--coin-tint), 0.85) 70%, rgba(255, 255, 255, 0.9) 76%, rgba(var(--coin-tint), 0.5) 84%, rgba(var(--coin-tint), 0) 100%);
}
.coin-flip.ph-result .coin-burst, .coin-flip.ph-out .coin-burst { animation: coinBurst 620ms cubic-bezier(0.15, 0.8, 0.3, 1) both; }
@keyframes coinBurst {
  0%   { transform: scale(0.7); opacity: 0.95; }
  100% { transform: scale(2.3); opacity: 0; }
}

.coin-caption {
  position: absolute;
  left: 0; right: 0;
  top: calc(50% + var(--coin-d) * 0.5 + 8.5vh);
  display: grid;
  justify-items: center;
  text-align: center;
}
.coin-caption > * { grid-area: 1 / 1; }
.coin-legend {
  display: flex;
  gap: clamp(18px, 4vw, 56px);
  font-family: var(--font-display);
  font-size: clamp(13px, 2.7vh, 22px);
  letter-spacing: 0.05em;
  transition: opacity 200ms ease;
}
.coin-legend span { display: inline-flex; align-items: center; gap: 0.5em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.coin-legend img { width: 1.9em; height: 1.9em; object-fit: contain; }
.coin-legend .you { color: #cfe3ff; }
.coin-legend .cpu { color: #ffd3d3; }
.coin-flip.ph-result .coin-legend, .coin-flip.ph-out .coin-legend { opacity: 0; }
.coin-result {
  display: grid;
  gap: 0.5vh;
  font-family: var(--font-display);
  line-height: 1;
  opacity: 0;
}
.coin-result b {
  font-weight: 400;
  font-size: clamp(30px, 8.4vh, 78px);
  color: #fff7e0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 28px rgba(253, 224, 138, 0.95), 0 0 72px rgba(245, 193, 74, 0.6);
}
.coin-result span {
  font-size: clamp(15px, 3.6vh, 32px);
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(var(--coin-tint), 0.95), 0 0 44px rgba(var(--coin-tint), 0.6);
}
.coin-flip.ph-result .coin-result, .coin-flip.ph-out .coin-result { animation: coinResultIn 420ms cubic-bezier(0.2, 1, 0.3, 1) both; }
@keyframes coinResultIn {
  0%   { opacity: 0; transform: scale(1.6); filter: blur(10px); }
  55%  { opacity: 1; transform: scale(0.95); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .coin-result, .coin-burst { animation-duration: 1ms !important; }
}

/* ============== TURN BANNER (turn-change announcement) ============== */
/* Dims the screen and flashes "YOUR TURN" / "ENEMY'S TURN" in the centre, then
   exits. The dim overlay fades in/out; the text uses one of 3 swappable motion
   styles (set via TURN_BANNER_STYLE → .tb-style-1/2/3). */
.turn-banner {
  position: fixed;
  inset: 0;
  z-index: 132;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: turnBannerDim var(--tb-dur, 1400ms) ease both;
}
@keyframes turnBannerDim {
  0%   { background: rgba(4, 6, 14, 0); }
  16%  { background: rgba(4, 6, 14, 0.5); }
  58%  { background: rgba(4, 6, 14, 0.5); }
  100% { background: rgba(4, 6, 14, 0); }
}
.turn-banner-text {
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 110px);
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  will-change: transform, opacity, filter;
}
.turn-banner.player .turn-banner-text {
  color: #e8f1ff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 26px rgba(96, 165, 250, 0.9), 0 0 64px rgba(59, 130, 246, 0.55);
}
.turn-banner.ai .turn-banner-text {
  color: #ffecec;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 26px rgba(248, 113, 113, 0.9), 0 0 64px rgba(239, 68, 68, 0.55);
}
/* Duel outcome flash (YOU WIN / YOU LOSE) — gold for the win, red for the loss. */
.turn-banner.win .turn-banner-text {
  color: #fff7e0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 28px rgba(253, 224, 138, 0.95), 0 0 72px rgba(245, 193, 74, 0.6);
}
.turn-banner.lose .turn-banner-text {
  color: #ffe3e3;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 28px rgba(248, 113, 113, 0.95), 0 0 72px rgba(220, 38, 38, 0.6);
}
/* DRAW: ni oro ni rojo — plata fria, que es lo que dice "no gana nadie". */
.turn-banner.draw .turn-banner-text {
  color: #eef4ff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 28px rgba(203, 219, 245, 0.9), 0 0 72px rgba(120, 149, 200, 0.55);
}

/* ---- Option 1 · Impact slam (default): blasts in big + blurred, snaps to
   size with a tiny overshoot, then punches out expanding + blurring. ---- */
.turn-banner.tb-style-1 .turn-banner-text { animation: tbImpact var(--tb-dur, 1400ms) cubic-bezier(0.2, 1, 0.3, 1) both; }
@keyframes tbImpact {
  0%   { opacity: 0; transform: scale(1.75); filter: blur(16px); }
  9%   { opacity: 1; }
  18%  { transform: scale(0.92); filter: blur(0); }
  26%  { transform: scale(1); }
  60%  { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.22); filter: blur(8px); }
}

/* ---- Option 2 · Swipe slide: slides in from the left with a skew, straightens
   and holds, then swipes out to the right. ---- */
.turn-banner.tb-style-2 .turn-banner-text { animation: tbSwipe var(--tb-dur, 1400ms) cubic-bezier(0.2, 0.85, 0.25, 1) both; }
@keyframes tbSwipe {
  0%   { opacity: 0; transform: translateX(-72%) skewX(-15deg); }
  20%  { opacity: 1; transform: translateX(0) skewX(0deg); }
  58%  { opacity: 1; transform: translateX(0) skewX(0deg); }
  100% { opacity: 0; transform: translateX(72%) skewX(12deg); }
}

/* ---- Option 3 · Rise & settle: rises from below with wide letter-spacing that
   tightens, holds, then drifts up + expands as it fades. ---- */
.turn-banner.tb-style-3 .turn-banner-text { animation: tbRise var(--tb-dur, 1400ms) cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes tbRise {
  0%   { opacity: 0; transform: translateY(48px) scale(0.96); letter-spacing: 0.5em; }
  24%  { opacity: 1; transform: translateY(0) scale(1);      letter-spacing: 0.02em; }
  58%  { opacity: 1; transform: translateY(0) scale(1);      letter-spacing: 0.02em; }
  100% { opacity: 0; transform: translateY(-30px) scale(1.05); letter-spacing: 0.16em; }
}

/* ---- CPU trap announcement: a centred banner (big trap icon + text) slams in
   before the trap card reveals — same impact-slam feel as the turn banner. ---- */
.trap-banner {
  position: fixed;
  inset: 0;
  z-index: 133;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: trapBannerDim var(--trb-dur, 1500ms) ease both;
}
@keyframes trapBannerDim {
  0%   { background: rgba(6, 4, 14, 0); }
  16%  { background: rgba(6, 4, 14, 0.55); }
  60%  { background: rgba(6, 4, 14, 0.55); }
  100% { background: rgba(6, 4, 14, 0); }
}
.trap-banner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  will-change: transform, opacity, filter;
  animation: trapBannerSlam var(--trb-dur, 1500ms) cubic-bezier(0.2, 1, 0.3, 1) both;
}
.trap-banner-icon {
  width: clamp(96px, 18vw, 188px);
  height: auto;
  animation: trapBannerGlow 1s ease-in-out 0.2s infinite alternate;
}
/* Enemy SPELL announcement — same slam banner as CPU traps, with a BLUE pulse (spell = blue). */
.spell-banner .trap-banner-icon { animation: spellBannerGlow 1s ease-in-out 0.2s infinite alternate; }
@keyframes spellBannerGlow {
  0%   { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(96, 165, 250, 0.7)); }
  100% { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 36px rgba(130, 195, 255, 0.98)); }
}
@keyframes trapBannerGlow {
  0%   { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(167, 139, 250, 0.7)); }
  100% { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 38px rgba(167, 139, 250, 1)); }
}
.trap-banner-text {
  font-family: var(--font-display);
  font-size: clamp(26px, 6vw, 62px);
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  color: #f3e9ff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 24px rgba(167, 139, 250, 0.9), 0 0 60px rgba(139, 92, 246, 0.55);
}
@keyframes trapBannerSlam {
  0%   { opacity: 0; transform: scale(1.6); filter: blur(14px); }
  10%  { opacity: 1; }
  20%  { transform: scale(0.94); filter: blur(0); }
  28%  { transform: scale(1); }
  62%  { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.18); filter: blur(7px); }
}

/* Field rows: 3 fixed slots. Inside a flex .field-area they get a preferred
   width of 720px but can shrink — never grow past it. */
.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  justify-content: center;
  padding: 2px;
  min-height: 0;
  flex: 0 1 510px;
  min-width: 0;
  /* A size container so each slot can pick the largest 11:16 box that fits
     BOTH its column width and the row height (see .slot sizing below). */
  container-type: size;
  --col-gap: 7px;
}
.field-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8px;
}
.divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--border-strong) 30%, var(--border-strong) 70%, transparent);
  opacity: 0.6;
}

/* The spell row overlaps the hand (tight vertical space). To stay VISIBLE it
   paints on top (z-index), but it must NOT steal the pointer-downs that begin a
   hand-card drag — so the slots are non-interactive until a drag is underway,
   at which point the hand cards go quiet and the slots become drop targets. */
.battlefield.dragging-card .hand-fan-slot { pointer-events: none; }
.battlefield.dragging-card .spell-slot { pointer-events: auto; }
/* Bridge asking where the taken hero lands: a free special cell takes the click (empty spell slots ignore the pointer otherwise). */
.spell-slot.pickable, .slot.empty.drop-valid { pointer-events: auto; cursor: pointer; }

/* ============== BATTLE GRID (per side: hero row + spell row) ============== */
/* One 5-column × 2-row block. EVERY cell — deck, the 3 hero slots, the 3 spell
   slots, graveyard — is the same 11:16 box, so all slots line up in clean
   columns. The block is centred + compact (no wasted width) and packed toward
   the centre divider so both players' hero rows hug the middle. */
.battle-grid {
  --bgap: clamp(9px, 1.3vw, 16px);
  display: grid;
  grid-template-columns: repeat(5, auto);
  grid-template-rows: repeat(2, auto);
  gap: var(--bgap);
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  container-type: size;
}
/* Hero row hugs the divider: the CPU's is its bottom grid row, the player's its
   top one — pack each block toward the centre. */
.battle-grid-ai { align-content: end; }
/* Raise the player's field HUD off the hand — without this the spell row sits
   ~3px above the hand cards. Padding (not margin) because the grid is height:100%. */
.battle-grid-player {
  align-content: start;
  box-sizing: border-box;
  padding-bottom: clamp(16px, 2.6vh, 30px);
}

.battle-grid > .slot,
.battle-grid > .spell-slot,
.battle-grid > .deck-slot,
.battle-grid > .graveyard-slot,
.battle-grid > .bg-corner {
  aspect-ratio: 11 / 16;
  /* Largest 11:16 box that fits BOTH 5 columns and 2 rows of this container. */
  width: min((100cqw - 4 * var(--bgap)) / 5, ((100cqh - var(--bgap)) / 2) * 11 / 16, 150px);
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
}
/* deck / graveyard drop their full-height sizing and match a slot box here. */
.battle-grid > .deck-slot,
.battle-grid > .graveyard-slot { padding: 2px 2px 16px; }
.bg-corner { visibility: hidden; pointer-events: none; }

/* ============== SPELL ROW (3 spell-card slots per side) ============== */
/* A separate battlefield row aligned (centred, same max-width) with the hero
   field-row so each spell slot sits directly under/over a hero slot. Smaller
   than hero slots — they hold Permanent spells (and flash Instant ones). */
.spell-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
  max-width: 510px;
  margin: 0 auto;
  padding: 0 2px;
  align-items: center;
  justify-items: center;
  min-height: 0;
  /* Paint above the fanned hand cards so the slots (and resident Permanents)
     stay visible; the whole row is non-interactive at rest (pointer-downs reach
     the hand beneath) and only its slots wake up mid-drag. A held/raised hand
     card (z-index 60) still wins. */
  position: relative;
  z-index: 20;
  pointer-events: none;
}
.spell-slot {
  aspect-ratio: 11 / 16;
  height: clamp(44px, 7vh, 66px);
  width: auto;
  max-width: 100%;
  /* Non-interactive at rest so a pointer-down lands on the hand card beneath;
     re-enabled only mid-drag (see .dragging-card .spell-slot). */
  pointer-events: none;
  /* No outline at rest (owner 2026-11-05): a slot only shows when a held card can go there
     (`.slot-glow`). The border stays, transparent, for the resident spell states below. */
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
/* Bold like the HERO label, and both hints sit at 50% so they read as a hint on the sand
   rather than as content. */
.spell-slot.empty .slot-hint { color: #fff; opacity: 0.5; font-weight: 700; font-size: 12px; letter-spacing: 0.1em; }
/* A Permanent spell in residence gets a soft "enchant" glow. */
.spell-slot.permanent {
  border-style: solid;
  border-color: rgba(168, 130, 255, 0.55);
  box-shadow: 0 0 14px rgba(140, 90, 230, 0.30), inset 0 0 10px rgba(140, 90, 230, 0.12);
}
.spell-row-ai .spell-slot.permanent { border-color: rgba(248, 150, 113, 0.5); box-shadow: 0 0 14px rgba(230, 110, 90, 0.28); }
/* A Temporary spell (e.g. Bull Run) gets an amber "hourglass" glow + a turns-left badge. */
.spell-slot.temporary {
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.30), inset 0 0 10px rgba(245, 158, 11, 0.12);
}
.spell-row-ai .spell-slot.temporary { border-color: rgba(248, 180, 90, 0.6); box-shadow: 0 0 14px rgba(230, 150, 60, 0.30); }
.temp-turns {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, sans-serif);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: #2a1c00;
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b);
  border: 2px solid rgba(120, 72, 0, 0.85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 6;
}
/* The card sitting in a spell slot fills it (it's already a spell card face).
   Empty slots stay non-interactive (pointer-events:none on .spell-slot, so a
   hand-card drag still passes through), but a RESIDENT card opts back into
   pointer events so it can be tapped/clicked to inspect its full detail — and
   peeked on hover. The card only overlaps the very top sliver of the hand cards
   beneath it, which keep most of their grab area exposed below the spell row. */
/* Same overflow as a hero in play, so both rows read at the same scale. */
.spell-slot .card { position: absolute; inset: calc(-1 * var(--card-bleed, 3.5%)); width: auto; height: auto; pointer-events: auto; cursor: zoom-in; }
/* Drop feedback while dragging a spell card over a free player spell slot: the animated
   `.slot-glow` (see "Valid drop slots LIGHT UP"). Dropping a permanent over an occupied
   permanent slot → REPLACE: the old card is destroyed, so that glow is DANGER red. */
/* This slot is holding an Instant spell that's waiting for its target. */
.spell-slot.pending-target { border-style: solid; border-color: var(--gold); box-shadow: 0 0 16px rgba(245, 193, 74, 0.45); }

/* ============== SLOT ============== */
.slot {
  /* No outline at rest: see `.spell-slot` and "Valid drop slots LIGHT UP". */
  border: 1.5px solid transparent;
  border-radius: 14px;
  min-height: 0;
  /* Sized to the in-play card's exact 11:16 footprint. We pick the largest box
     that fits both the column width and the row height, so the slot never
     stretches taller than a card (no more elongated slots on narrow screens). */
  aspect-ratio: 11 / 16;
  width: min((100cqw - 2 * var(--col-gap)) / 3, 100cqh * 11 / 16, 300px);
  height: auto;
  max-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
  overflow: visible;
  background: rgba(255, 255, 255, 0.015);
  /* Depth for the attack-lunge: the child .card's rotateX renders in real 3D
     (a forward pitch) instead of a flat vertical squash. Harmless at rest. */
  perspective: 900px;
}
/* A hero standing in one of the two flanking SPECIAL slots (the cells shared with
   spells). Same slot in every way — only the resting border is tinted with the spell
   slot's violet so the shared cell stays recognisable at a glance. Kept first so the
   drop/target/attacker states below still win. */
.slot.special { border-color: rgba(168, 130, 255, 0.42); }
/* The HP bar now lives inside the card (see `.card > .hp-bar`) so it appears on
   every small hero card — board, gallery, graveyard, etc. — not just the field. */
.slot.empty .slot-hint {
  color: #fff;
  font-family: var(--font-ui); font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.5;
}
.slot.target-attack {
  border-color: var(--ai);
  border-style: solid;
  background: rgba(239, 68, 68, 0.06);
  box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.18), 0 0 18px rgba(239, 68, 68, 0.25);
  cursor: crosshair;
}
.slot.target-spell {
  border-color: var(--success);
  border-style: solid;
  background: rgba(34, 197, 94, 0.06);
  box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.18), 0 0 18px rgba(34, 197, 94, 0.25);
  cursor: pointer;
}
.slot.attacker-selected .card {
  outline: 2.5px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 28px rgba(245, 193, 74, 0.65);
}

/* ============== CARD ============== */
/* Paper-TCG visual matching the user's reference: thick colored frame
   with dark inner+outer strokes, light gradient inner panel (lighter top,
   darker bottom), name pill in the header, tilted 3D bolt for the cost
   protruding from the top-right corner, large outlined stat icons with
   a chunky display number font, and an italic effect panel + edition
   footer that appear only in preview.
     hero  → gold/cream
     spell → cyan/blue
     trap  → green/teal
   `.compact` (default for hand/field) hides effect + footer per the rule
   that small cards show only name + image + stats. */
.card {
  width: clamp(96px, 9.5vw, 134px);
  aspect-ratio: 11 / 16;
  position: relative;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
  /* Accent (divider / pill / glow) + type color — set inline per card. */
  --accent: #f0b73a;
  --type-color: #f0b73a;
}
@media (hover: hover) and (pointer: fine) {
  .card.in-hand:hover {
    transform: translateY(-12px) scale(1.06);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.7);
    z-index: 5;
  }
}

/* ---- METALLIC FRAME: a thin neutral metal border (CardMaker "Full Art").
   The frame is just padding around the art window — rarity/type are read from
   the type pill + accent divider, not from the border color. ---- */
.card-inner {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 4px;
  box-sizing: border-box;
  background: linear-gradient(150deg, #4a5165 0%, #262b3b 46%, #10131c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 0 0 2px rgba(0, 0, 0, 0.45);
}

/* ---- ART WINDOW: clips the full-bleed art and stacks every overlay ---- */
.card-window {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 38%, #2b3142 0%, #171a24 70%, #0e1018 100%);
}

/* ---- FULL-BLEED ART (z:0) + legibility scrims ---- */
.card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.card-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.card-scrim {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.card-scrim-top {
  top: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
}
.card-scrim-bot {
  bottom: 0;
  height: 60%;
  background: linear-gradient(180deg,
    rgba(8, 9, 14, 0) 0%,
    rgba(8, 9, 14, 0.82) 42%,
    rgba(8, 9, 14, 0.97) 100%);
}
/* Compact cards (hand/field) lean on a deeper bottom scrim for legibility. */
.card.compact .card-scrim-bot { height: 70%; }

/* ---- OVERLAY LAYERS ---- */
.card-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px;
}
.badge-spacer { display: block; }
.card-spacer {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
}
.card-bottom {
  position: relative;
  z-index: 2;
  padding: 0 7px 7px;
  display: flex;
  flex-direction: column;
}

/* ---- CLASS / FACTION STAMP (top-left), tinted by the card accent ---- */
.class-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--badge), rgba(0, 0, 0, 0.5));
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 8px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 2px 4px rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

/* ---- ENERGY COST (top-right): bolt icon + heavy number beside it ---- */
.energy-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
}
/* Glossy 3D gem tinted by the card type (--type-color): a white top-left
   highlight + dark bottom shade over the base colour, with inner light/shadow
   and a drop shadow — same lit/shaded look as the icon artwork. */
.energy-gem {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(30px, 3.4vw, 40px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 50% 122%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 60%),
    var(--type-color, #f0b73a);
  border: 1.5px solid rgba(0, 0, 0, 0.42);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.6),
    inset 0 -3px 6px rgba(0, 0, 0, 0.42),
    0 3px 5px rgba(0, 0, 0, 0.55);
}
/* Specular shine highlight near the top */
.energy-gem::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 22%;
  width: 46%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.energy-gem-num {
  position: relative;
  z-index: 1;
  font-family: 'Bowlby One', 'Arial Black', sans-serif;
  font-size: clamp(14px, 1.7vw, 19px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 2px #11151f;
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.6);
}

/* ---- TITLE ROW: name (serif) + type pill ---- */
.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}
/* Names get a fixed width and wrap to (at most) two lines instead of truncating
   to "Smart M…". The second line ellipsises only if a name is truly huge. */
.card-name {
  flex: 1;
  min-width: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 700;
  font-size: clamp(10px, 1.15vw, 13px);
  color: #fff;
  line-height: 1.08;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}
.type-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--type-color), rgba(0, 0, 0, 0.4));
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 0.4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

/* ---- ACCENT DIVIDER under the name ---- */
.card-divider {
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin-bottom: 6px;
}

/* ---- DESCRIPTION (preview only) ---- */
.card-desc {
  color: #cfd4e0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  line-height: 1.38;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.card-passive {
  color: var(--accent);
  font-style: italic;
  font-weight: 600;
}

/* ---- STATS ROW: big cartoon icons with the value overlaid (heroes) ---- */
.card-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
}
.stat-badge {
  position: relative;
  width: clamp(26px, 3.2vw, 38px);
  height: clamp(26px, 3.2vw, 38px);
  flex: none;
}
.stat-badge-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.stat-badge-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bowlby One', 'Arial Black', sans-serif;
  font-size: clamp(11px, 1.35vw, 15px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 2px #11151f;
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
}

/* ---- EDITION FOOTER (preview only) ---- */
.card-edition {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 8px;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.edition-id { font-weight: 800; letter-spacing: 0.6px; }

/* ---- SMALL CARDS: name (top), hero atk/def in the bottom corners ---- */
/* Heroes need a stronger bottom scrim so the corner stats stay legible. */
.card.compact .card-scrim-bot { height: 56%; }
/* atk (left) + def (right) pinned to the bottom corners, over the art. */
.card-corners {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 5px 6px;
  pointer-events: none;
}

/* ---- PREVIEW (detail): CardMaker "Full Art" board, scaled to fit (5:7) ---- */
.card.preview {
  width: 320px;
  height: 448px;
  cursor: default;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.72), 0 0 36px rgba(0, 0, 0, 0.35);
}
/* Hero cards (hand / field / detail) are painted on the `hero_card_template_common.png`
   template, which carries its own ornate silhouette + drop-shadow (transparent
   corners). Drop the generic card chrome so it doesn't halo a rounded rectangle
   behind the painted frame. */
.card.tpl-host {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
@media (hover: hover) and (pointer: fine) { .card.tpl-host.in-hand:hover { box-shadow: none; } }

/* ---- RARITY FLOURISHES on the painted template ---- */
/* RARE: the name's letters get an animated silver sheen, and a soft silver
   highlight sweeps left→right across the metal frame every few seconds. */
.tpl-name-rare {
  background-image: linear-gradient(90deg, #9aa5b6 0%, #c6cedb 25%, #ffffff 50%, #c6cedb 75%, #9aa5b6 100%);
  background-size: 200% 100%;
  background-repeat: repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  /* uniform dark halo around the letters (no offset) for legibility on the light banner */
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 3px rgba(0, 0, 0, 0.6));
  animation: tplNameSilver 12s linear infinite;
}
/* Seamless loop: the gradient tiles horizontally (both edges are #5f6b7d), so
   shifting by exactly one tile (200%) lands on an identical frame — no jump. */
@keyframes tplNameSilver {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
/* Masked to the frame PNG's alpha, so the sweep only rides the metal (never the
   art window or the transparent corners). A thin diagonal band translates across
   then waits off-screen for the rest of the cycle. */
.tpl-shine {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.tpl-shine::before {
  content: ''; position: absolute; top: -25%; bottom: -25%; left: 0; width: 26%;
  background: linear-gradient(100deg, transparent 0%, rgba(244, 248, 255, 0.0) 8%, rgba(244, 248, 255, 0.4) 50%, rgba(244, 248, 255, 0) 92%, transparent 100%);
  transform: translateX(-200%) skewX(-14deg);
  animation: tplShineSweep 9s linear infinite;
  mix-blend-mode: screen;
}
@keyframes tplShineSweep {
  /* the timing-function on this keyframe drives the visible sweep (0→22%) so it
     eases in AND out within the sweep itself, not just across the whole cycle.
     A longer sweep window makes that ease-in-out clearly readable. */
  0%   { transform: translateX(-200%) skewX(-14deg); animation-timing-function: ease-in-out; }
  22%  { transform: translateX(560%) skewX(-14deg); }
  100% { transform: translateX(560%) skewX(-14deg); }
}

/* RARE / SUPER RARE: tint only the central top diamond (the rarity "mark") on the
   normal frame. `mix-blend-mode: color` recolours the gem's facets while keeping
   their shine. The mask (set inline, one per template size) is a pixel-perfect
   flood-fill trace of the crystal facets, so the tint hugs the gem exactly on both
   sides — the gem is drawn slightly off-centre, not a symmetric rhombus. */
.tpl-center-gem {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  mix-blend-mode: color;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.tpl-center-gem.rare  { background: #2f7dff; }
/* SUPER (2026-10-08): the SAME recipe as the ENERGY crystal (`.tpl-gem-spell`: a conic of
   animated gradient tones that turns around the gem, `color` blend so the facets keep their
   shine, same 5 s turn), but PURPLE with touches of BLUE. The conic is centred ON the gem
   (50% 8%), so every wedge reaches it: with two narrow blue wedges on opposite sides the gem
   is never one single colour, whatever the angle. `.super-depth` (a sibling, since a pseudo
   would be flattened into this `color` group) still multiplies a little violet to deepen it,
   but lightly, or it would bury the blue. */
.tpl-center-gem.super {
  background: conic-gradient(from var(--gemAngle) at 50% 8%, #a03cff 0deg, #bd6bff 55deg, #8f2cff 95deg, #4f9bff 124deg, #4f9bff 152deg, #6f66ff 176deg, #a849ff 205deg, #c37bff 250deg, #9233ff 282deg, #5fb4ff 308deg, #5fb4ff 332deg, #7d5cff 348deg, #a03cff 360deg);
  animation: tplGemSpell 5s linear infinite;
}
.tpl-center-gem.super-depth {
  mix-blend-mode: multiply;
  background: conic-gradient(from var(--gemAngle) at 50% 8%,
    #b98cff, #d9c2ff, #a878ff, #cdb0ff, #b98cff);
  animation: tplGemSpell 11s linear infinite reverse, tplSuperDepth 3.4s ease-in-out infinite alternate;
}
@keyframes tplSuperDepth { from { opacity: 0.12; } to { opacity: 0.3; } }
/* COMMON: white source through the `color` blend = no hue/saturation, so the gem
   reads neutral white/silver on every type (hero/spell/trap), matching the hero. */
.tpl-center-gem.common { background: #ffffff; }
/* ULTRA: the central rarity crystal is GOLD and animated (the rest of the frame stays
   normal). `color` blend keeps the gem's facets/shine; the warm-gold gradient drifts so
   the gem shimmers, and the frame's shine sweep crosses it for a live reflection. */
.tpl-center-gem.ultra {
  background: linear-gradient(110deg, #b5824a 0%, #e9c879 28%, #ffe9a6 50%, #e9c879 72%, #b5824a 100%);
  background-size: 200% 100%;
  animation: tplGoldShift 4s linear infinite;
}
/* ULTRA (new look): an animated IRIDESCENT gem — a vivid pastel conic that slowly
   turns (like a diamond). `color` blend (inherited) recolours the gem/pearl's facets
   while keeping their shine, so it reads iridescent on the bright glass. `--iriX/--iriY`
   place the conic centre on the gem so the rainbow radiates from it. Used for BOTH the
   central rarity gem and the left HP medallion. */
.tpl-center-gem.iri {
  background: conic-gradient(from var(--iriAngle) at var(--iriX, 50%) var(--iriY, 8%),
    #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  animation: tplGemIri 12s linear infinite;
}

/* SUPER RARE: a grayscale frame turned gold by an animated tint, plus a gold
   shine and tiny twinkling stars — a unique golden feel. */
.tpl-name-super {
  /* white letters with a SUBTLE iridescent "foil" sheen that sweeps across them
     (band tints kept very close to white so the colour is just a whisper) */
  background-image: linear-gradient(100deg,
    #ffffff 0%, #ffffff 40%,
    #ffeef6 44%, #eef3ff 47%, #eefff9 50%, #fffbee 53%, #f5eeff 56%,
    #ffffff 60%, #ffffff 100%);
  background-size: 200% 100%;
  background-repeat: repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  /* strong dark halo so the white letters pop on the gold banner */
  filter: drop-shadow(0 0 1.5px rgba(10, 6, 0, 1)) drop-shadow(0 0 3.5px rgba(6, 3, 0, 0.92));
  animation: tplNameSilver 5s linear infinite;
}
/* ULTRA RARE name (normal + foil finishes): a LIGHT-gold gradient that drifts across
   the letters. Dark halo so the pale-gold reads on the normal silver banner. */
.tpl-name-ultra {
  background-image: linear-gradient(100deg,
    #fff4cf 0%, #ffe9a6 22%, #f7d77a 38%, #fff6d8 50%, #f7d77a 62%, #ffe9a6 78%, #fff4cf 100%);
  background-size: 200% 100%;
  background-repeat: repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 1px 1.5px rgba(54, 32, 0, 0.95)) drop-shadow(0 0 3px rgba(34, 20, 0, 0.7));
  animation: tplNameGold 5s linear infinite;
}
@keyframes tplNameGold { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
/* Animated gold tint — masked to the frame PNG, recolors the grayscale metal to
   gold (keeps its metallic shading) while the saturation bands drift. */
.tpl-gold {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  /* `color` blend keeps the frame's BRIGHTNESS (multiply came out too dark). The trick
     to avoid the OLIVE/GREEN is the HUE: a yellowish gold (hue ~46) laid over mid grays
     by `color` reads olive, so the gradient is kept firmly AMBER/orange (hue ~36-40) —
     warm at every luminance, never green — and a light warm multiply pass below mops up
     any residual olive in the mids without dulling the metal. */
  background-image: linear-gradient(110deg, #ab7430 0%, #d6a449 22%, #f3d184 40%, #ddac4f 50%, #f3d184 60%, #d6a449 78%, #ab7430 100%);
  background-size: 200% 100%;
  background-repeat: repeat;
  mix-blend-mode: color;
  opacity: 0.9;
}
/* Warm SCREEN lift: brightens the gold a notch (luminance the `color` blend can't add
   on its own). Screen of a warm pale gold stays warm → it lifts without any green. */
.tpl-gold::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, #ffe6b8 0%, #fff3d6 42%, #ffe6b8 100%);
  background-size: 200% 100%; background-repeat: repeat;
  mix-blend-mode: screen; opacity: 0.18;
}
/* Light WARM multiply: mops up any residual olive in the mid metal toward amber. Kept
   low so it warms without darkening (the screen lift above keeps it bright). */
.tpl-gold::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, #7c5018 0%, #c79338 50%, #7c5018 100%);
  background-size: 200% 100%; background-repeat: repeat;
  mix-blend-mode: multiply; opacity: 0.10;
}
@keyframes tplGoldShift {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
/* ULTRA: animated pastel-iridescent frame tint — a conic pastel spectrum (many
   hues at once, like a diamond) slowly turning, masked to the frame. Reuses the
   medallion's `tplGemIri` angle animation (each element keeps its own --iriAngle). */
.tpl-iri-frame {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  /* vivid (but still iridescent, not neon) so the high rarity reads colourful */
  background: conic-gradient(from var(--iriAngle) at 50% 48%,
    #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  mix-blend-mode: color;
  opacity: 1;
  animation: tplGemIri 16s linear infinite;
}
/* A second saturation pass so the colour reads even where the metal is light/dark. */
.tpl-iri-frame::after {
  content: ''; position: absolute; inset: 0;
  background: inherit;
  mix-blend-mode: overlay; opacity: 0.45;
  animation: tplGemIri 16s linear infinite;
}
/* White shine band (ultra) — same soft multi-stop falloff but all white. */
.tpl-shine-white::before {
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 10%,
    rgba(255, 255, 255, 0.20) 33%,
    rgba(255, 255, 255, 0.48) 50%,
    rgba(255, 255, 255, 0.24) 67%,
    rgba(255, 255, 255, 0) 90%,
    transparent 100%);
}
/* Gold variant of the rare shine band — softer and made of several gold tones
   (warm amber → pale gold → deep gold) instead of one flat highlight. */
.tpl-shine-gold::before {
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(255, 228, 158, 0) 10%,
    rgba(255, 222, 150, 0.15) 33%,
    rgba(255, 244, 208, 0.36) 50%,
    rgba(247, 205, 132, 0.19) 67%,
    rgba(255, 228, 158, 0) 90%,
    transparent 100%);
}
/* GOLDEN FOIL — a specular gold glare that TRACKS the card's tilt. Masked to the frame
   PNG so it rides only the metal. Its centre follows --foil-x/--foil-y (set by the zoom
   inspector / pack tilt) and its brightness scales with --foil-m (tilt magnitude): at
   rest it's a soft centred sheen, and as you incline the card it slides across the gold
   and flares — like real metal catching the light. Complements the ambient auto-sweep. */
.tpl-gold-glare {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  background: radial-gradient(44% 38% at
      calc(50% + var(--foil-x, 0) * 42%) calc(50% + var(--foil-y, 0) * 42%),
    rgba(255, 253, 240, 0.95) 0%, rgba(255, 238, 180, 0.40) 32%, rgba(255, 230, 160, 0) 64%);
  mix-blend-mode: screen;
  opacity: calc(0.3 + var(--foil-m, 0) * 0.62);
  will-change: background, opacity;
}
/* Tiny twinkling stars — white-cored, with a coloured halo (gold default, or a
   per-star pastel hue via --c on ultra). */
.tpl-sparkles { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tpl-spark {
  position: absolute; display: block;
  background: radial-gradient(circle, #fffdf6 0%, var(--c, #ffd86a) 45%, transparent 72%);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  opacity: 0; transform: scale(0.3) rotate(-20deg);
  filter: drop-shadow(0 0 2px rgba(255, 240, 210, 0.8));
  animation: tplSparkle 3.4s ease-in-out infinite;
}
@keyframes tplSparkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(-25deg); }
  50%      { opacity: 0.92; transform: scale(1) rotate(20deg); }
}
/* Bright flashes at random points across the whole card (not masked): each
   fades in + scales up + spins a little, then fades out and rests, before JS
   moves it to a new random spot. The long invisible tail keeps them subtle. */
.tpl-flashes { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.tpl-flash {
  position: absolute; display: block;
  background: radial-gradient(circle, #fffefa 0%, var(--c, #fff1c6) 42%, transparent 72%);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  opacity: 0;
  filter: drop-shadow(0 0 3px rgba(255, 245, 225, 0.9));
  animation-name: tplFlash;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
@keyframes tplFlash {
  0%   { opacity: 0; transform: scale(0.2) rotate(-45deg); }
  11%  { opacity: 1; transform: scale(1) rotate(0deg); }      /* faded in, scaled up, turned */
  24%  { opacity: 0; transform: scale(1.15) rotate(35deg); }  /* flash out */
  100% { opacity: 0; transform: scale(0.2) rotate(-45deg); }  /* rest (invisible) */
}

/* Subtle water bubbles rising inside the art window (clipped to it). Each starts
   below the window from a random x and floats up while fading in then out; --rise
   (window height + margin, board px) carries it past the top so it scales. */
.art-bubbles { position: absolute; inset: 0; overflow: hidden; z-index: 2; pointer-events: none; }
.art-bubble {
  position: absolute; top: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgba(255,255,255,0.7), rgba(205,233,255,0.16) 56%, rgba(255,255,255,0) 74%);
  box-shadow: inset 0 0 2px rgba(255,255,255,0.5);
  opacity: 0;
  animation-name: artBubbleRise;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
@keyframes artBubbleRise {
  0%   { transform: translate(-50%, 0) scale(0.5);                          opacity: 0; }
  16%  { opacity: var(--maxop, 0.4); }
  80%  { opacity: calc(var(--maxop, 0.4) * 0.6); }
  100% { transform: translate(-50%, calc(var(--rise, 280px) * -1)) scale(1.05); opacity: 0; }
}

/* ============================================================
   CIELO NOCTURNO DIBUJADO — el fondo de To The Moon (ver `NightSky` en game.js)
   ------------------------------------------------------------
   Dos capas dentro de la ventana de arte: el degradado del cielo y el campo de estrellas.
   El recorte del cohete va encima, montado despues en el DOM.
   El FOIL no anade estrellas: cambia los TONOS del cielo, enciende el parpadeo de las que
   ya hay y monta las fugaces. Todo lo que se anima es `opacity`/`transform`, que es lo que
   el compositor puede llevar solo.
   ============================================================ */
.night-sky { position: absolute; inset: 0; overflow: hidden; }
.night-sky-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 92% at 24% 16%, rgba(52,72,146,0.55) 0%, rgba(52,72,146,0) 62%),
    radial-gradient(96% 82% at 76% 74%, rgba(26,76,104,0.42) 0%, rgba(26,76,104,0) 60%),
    linear-gradient(172deg, #0c1a40 0%, #070e26 56%, #04081a 100%);
}
/* Los tonos del FOIL: la misma construccion, otra paleta (violeta + verde azulado, con un
   tercer foco rosa que la de serie no tiene). Y ademas DERIVA: el `hue-rotate` de ida y
   vuelta hace que el cielo no se quede nunca en el mismo color. */
.night-sky.is-foil .night-sky-bg {
  background:
    radial-gradient(118% 92% at 28% 22%, rgba(116,66,176,0.58) 0%, rgba(116,66,176,0) 64%),
    radial-gradient(98% 84% at 74% 72%, rgba(26,124,126,0.44) 0%, rgba(26,124,126,0) 62%),
    radial-gradient(72% 62% at 62% 18%, rgba(198,88,170,0.24) 0%, rgba(198,88,170,0) 70%),
    linear-gradient(168deg, #1a1046 0%, #0b1234 52%, #060620 100%);
  animation: skyDrift 30s ease-in-out infinite alternate;
}
/* Una estrella. El tinte llega como `color` (en linea) para que el punto Y su halo sean del
   mismo color sin repetirlo dos veces. `--op` es su brillo en reposo. */
.sky-star {
  position: absolute; transform: translate(-50%, -50%);
  background: currentColor; border-radius: 50%;
  box-shadow: 0 0 3px currentColor;
  opacity: var(--op, 0.8);
}
/* Las grandes son de CUATRO PUNTAS, no circulos: es lo que las separa del polvo de fondo. */
.sky-star.is-spark {
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 0 4px currentColor);
  clip-path: polygon(50% 0%, 57% 43%, 100% 50%, 57% 57%, 50% 100%, 43% 57%, 0% 50%, 43% 43%);
}
/* Se ENCIENDEN Y SE APAGAN, no laten: la caida es corta y la vuelta tambien, y el resto del
   ciclo la estrella esta puesta. Cada una trae su duracion y su retardo NEGATIVO desde
   game.js, asi que arrancan a mitad de camino y nunca coinciden. */
.night-sky.is-foil .sky-star {
  animation-name: skyTwinkle;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes skyTwinkle {
  0%, 44%   { opacity: var(--op, 0.8); transform: translate(-50%, -50%) scale(1); }
  52%, 58%  { opacity: calc(var(--op, 0.8) * 0.05); transform: translate(-50%, -50%) scale(0.6); }
  68%, 100% { opacity: var(--op, 0.8); transform: translate(-50%, -50%) scale(1); }
}
/* La FUGAZ: un trazo con la cabeza brillante y la cola desvanecida. Gira sobre su extremo
   izquierdo y viaja POR SU PROPIO EJE (el `rotate` va antes que el `translateX`), asi que el
   angulo de la raya y el de su recorrido son el mismo — que es lo que la hace leerse como
   algo que cae y no como una barra que se desliza de lado. */
.sky-shoot {
  position: absolute; height: 2px; transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(196,222,255,0.55) 58%, #ffffff 100%);
  border-radius: 2px;
  filter: drop-shadow(0 0 4px rgba(178,214,255,0.9));
  opacity: 0;
  animation-name: skyShoot;
  animation-timing-function: cubic-bezier(0.32, 0, 0.2, 1);
  animation-iteration-count: infinite;
}
/* El destello ocupa el ultimo 14% del ciclo y el resto del tiempo la raya esta quieta e
   invisible fuera de cuadro: por eso pasan "de vez en cuando" y no en bucle continuo. */
@keyframes skyShoot {
  0%, 86% { opacity: 0; transform: rotate(var(--ang, 24deg)) translateX(-25%) scaleX(0.35); }
  89%     { opacity: 1; }
  98%     { opacity: 0.85; }
  100%    { opacity: 0; transform: rotate(var(--ang, 24deg)) translateX(165%) scaleX(1); }
}
@keyframes skyDrift {
  from { filter: hue-rotate(0deg) saturate(1); }
  to   { filter: hue-rotate(34deg) saturate(1.22); }
}
/* Un cielo que parpadea es exactamente lo que pide esta consulta: quieto, pero completo. */
@media (prefers-reduced-motion: reduce) {
  .night-sky.is-foil .night-sky-bg,
  .night-sky.is-foil .sky-star,
  .sky-shoot { animation: none; }
  .sky-shoot { opacity: 0; }
}

/* ============================================================
   FUD — el fondo de TERROR MANGA (`mangaLines` en cards.js, `MangaLines` en game.js)
   Degradado morado + rayas verticales colgando del borde de arriba, cada una de su largo.
   La copia FOIL las pone a CAER.
   Cada raya es UN solo elemento (no una columna con su trazo dentro): el recorte lo hace
   `.manga-lines` con su `overflow:hidden`, asi que la raya puede salirse por abajo y volver
   a entrar por arriba sin envoltorio extra — y todo lo que se anima es `transform`, que se
   lleva el compositor solo.
   ============================================================ */
.manga-lines { position: absolute; inset: 0; overflow: hidden; }
.manga-lines-bg {
  position: absolute; inset: 0;
  background:
    /* el halo de abajo es lo que despega al personaje de la trama */
    radial-gradient(86% 62% at 50% 88%, rgba(192,132,252,0.32) 0%, rgba(192,132,252,0) 64%),
    linear-gradient(180deg, #17052c 0%, #3b0f6b 32%, #6d28d9 60%, #350d63 84%, #12041f 100%);
}
/* Una raya: cuelga del borde de arriba y se desvanece hacia abajo, como un trazo de tinta
   que se levanta del papel. El largo (`--len`) y la carga (`--op`) los trae cada una desde
   game.js; sin esa diferencia de largos esto se lee como un codigo de barras. */
.manga-line {
  position: absolute; top: 0;
  height: var(--len, 40%);
  /* La mayor parte de la raya va A PLENA CARGA y solo la PUNTA se desvanece: es como acaba
     un trazo de pluma. Con la caida repartida por todo el largo cada raya parecia una
     sombra difusa en vez de tinta. */
  background: linear-gradient(180deg,
    rgba(7,1,16, var(--op, 0.8)) 0%,
    rgba(7,1,16, var(--op, 0.8)) 62%,
    rgba(7,1,16, calc(var(--op, 0.8) * 0.45)) 86%,
    rgba(7,1,16, 0) 100%);
}
/* FOIL: la raya SE DIBUJA. No viaja — se queda clavada al borde de arriba y BAJA SU PUNTA,
   que es un `scaleY` con el origen arriba: la parte de arriba nunca se despega. Pasada la
   mitad del ciclo se desvanece y vuelve a empezar, asi que el bucle no necesita que la raya
   salga de cuadro. Cada una trae su duracion y su retardo NEGATIVO desde game.js, asi que
   arrancan a mitad de camino y ninguna se dibuja al compas de otra. */
.manga-lines.is-foil .manga-line {
  transform-origin: top center;
  animation-name: mangaDraw;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
/* El 6 % inicial es solo para que el reinicio no sea un POP: la raya nace de largo cero, asi
   que sin esa entrada aparece de golpe. Crece sin parar durante todo el ciclo; lo que cambia
   a mitad es que empieza a irse. */
@keyframes mangaDraw {
  0%   { transform: scaleY(0);    opacity: 0; }
  6%   { opacity: 1; }
  50%  { opacity: 1; }
  100% { transform: scaleY(1);    opacity: 0; }
}
/* Quieto, pero completo: las rayas se quedan colgando donde las dibuja el reposo. */
@media (prefers-reduced-motion: reduce) {
  .manga-lines.is-foil .manga-line { animation: none; }
}

/* ---- Canvas "Matrix" rain + CSS glitch layer (hero art window, between bg and
   character). The rain itself is drawn on <canvas> (.mr-base) for performance;
   .mr-glitch is a live copy sliced into displaced horizontal bands during glitch
   bursts (driven from JS). The CSS here is the "global glitch" pass:
   · chromatic aberration = red/cyan RGB split via animated drop-shadow (the
     <canvas> equivalent of the requested red/cyan text-shadow), and
   · random opacity flickers. Both snap with step-end for a digital, glitchy feel. */
.matrix-rain { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* NOTE: no permanent compositor promotion on .matrix-rain anywhere. A permanent `will-change`/
   `translateZ(0)` layer renders SOFT while the card sits still (blurry flat, crisp only when tilted).
   The pack-reveal card is now FLAT & un-promoted when frontal (see .po-card-rise / .po-card, gated to
   .tilting), so the rAF canvas just region-repaints on the main layer — the card stays crisp face-on. */
.mr-base, .mr-glitch { position: absolute; inset: 0; width: 100%; height: 100%; }
.mr-base {
  animation: mrAberration 5.1s step-end infinite, mrFlicker 6.7s step-end infinite;
}
.mr-glitch {
  opacity: 0;            /* shown only mid-burst; JS sets clip-path/transform/filter */
  will-change: clip-path, transform, opacity, filter;
}
/* Chromatic aberration: subtle red/cyan split most of the time, brief stronger
   spikes — like a CRT/decode shimmer. */
@keyframes mrAberration {
  0%, 46%, 54%, 100% { filter: drop-shadow(0.5px 0 0 rgba(255, 40, 90, 0.45)) drop-shadow(-0.5px 0 0 rgba(0, 230, 255, 0.45)); }
  48% { filter: drop-shadow(1.4px 0 0 rgba(255, 40, 90, 0.7)) drop-shadow(-1.4px 0 0 rgba(0, 230, 255, 0.7)); }
  50% { filter: drop-shadow(2.3px 0 0 rgba(255, 40, 90, 0.85)) drop-shadow(-2.3px 0 0 rgba(0, 230, 255, 0.85)); }
  52% { filter: drop-shadow(1px 0 0 rgba(255, 40, 90, 0.6)) drop-shadow(-1px 0 0 rgba(0, 230, 255, 0.6)); }
}
@keyframes mrFlicker {
  0%, 42%, 46%, 76%, 80%, 100% { opacity: 1; }
  44% { opacity: 0.82; }
  78% { opacity: 0.64; }
  90% { opacity: 0.9; }
}

/* One-shot bubble burst on summon: faint translucent bubbles well up from under
   the card's centre and scatter outward in every direction, then fade — like a
   cushion of air pushed aside as the card is set on the sea floor. This layer is
   rendered BEFORE the card so it paints BEHIND it (no z-index): each bubble is
   hidden under the card until it clears an edge. overflow:visible so they leave
   the slot; plays once when the card lands. */
.summon-bubbles { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.summon-bubble {
  position: absolute;
  border-radius: 50%;
  /* mostly see-through, just a bright rim + a small specular highlight */
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5) 0%, rgba(220,242,255,0.07) 42%, rgba(255,255,255,0) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22), inset 2px 2px 3px rgba(255,255,255,0.22);
  opacity: 0;
  /* One pass that squashes the bubble along its travel direction (--ang) as it is
     squeezed out, lets surface tension wobble it back to round, holds it, then
     BURSTS: it swells for a frame and vanishes in one step — a pop, not a fade.
     The per-bubble ease (--ease) front-loads the launch (fast out, slow drift);
     duration + delay (inline) make each one pop at its own moment. */
  animation-name: summonBubblePop;
  animation-timing-function: var(--ease, cubic-bezier(0.08, 0.84, 0.16, 1));
  animation-fill-mode: forwards;
  animation-iteration-count: 1;
  will-change: transform, opacity;
}
@keyframes summonBubblePop {
  /* x = local axis along travel (rotated by --ang) → scale(x, y) stretches in the
     direction of motion when x > y. translate uses fractions of --dx/--dy so most
     of the distance is covered early (squeezed out fast). */
  0%   { opacity: 0;                transform: translate(-50%, -50%) rotate(var(--ang, 0deg)) scale(0.28, 0.28); }
  6%   { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px) * 0.42), calc(-50% + var(--dy, 0px) * 0.42)) rotate(var(--ang, 0deg)) scale(1.85, 0.5); }   /* stretched droplet */
  15%  { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px) * 0.74), calc(-50% + var(--dy, 0px) * 0.74)) rotate(var(--ang, 0deg)) scale(0.8, 1.2); }      /* surface-tension overshoot */
  26%  { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px) * 0.9), calc(-50% + var(--dy, 0px) * 0.9))  rotate(var(--ang, 0deg)) scale(1.06, 0.95); }     /* settle */
  38%  { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) rotate(var(--ang, 0deg)) scale(1, 1); }                        /* round, settled */
  /* Once it stops it drifts gently UP toward the surface (−rise) before bursting. */
  93%  { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px) - var(--rise, 0px))) rotate(var(--ang, 0deg)) scale(var(--pop, 1.05), var(--pop, 1.05)); } /* risen + gentle swell */
  97%  { opacity: var(--maxop, 0.4); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px) - var(--rise, 0px))) rotate(var(--ang, 0deg)) scale(calc(var(--pop, 1.05) * 1.45), calc(var(--pop, 1.05) * 1.45)); } /* burst — thin film stretches */
  97.6%{ opacity: 0;                transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px) - var(--rise, 0px))) rotate(var(--ang, 0deg)) scale(calc(var(--pop, 1.05) * 1.5), calc(var(--pop, 1.05) * 1.5)); } /* popped — gone in one frame */
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .summon-bubble, .summon-spark, .summon-glow, .spell-rune-ring, .spell-rune-part { display: none; }
}

/* Per-gem treatments on super-rare cards (each masked to a single gem). */
/* Medallion: soft pastel iridescence — a full pastel spectrum (many hues at
   once, like a diamond's fire) swirling slowly over the silver facets. */
@property --iriAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.tpl-gem-iri {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  background: conic-gradient(from var(--iriAngle) at var(--gemCx, 15.5%) var(--gemCy, 11.5%),
    #ffd6ec, #d6e6ff, #d6fff1, #fff6d6, #ffe0c2, #ffd6ec, #ecd6ff, #d6f3ff, #ffd6ec);
  mix-blend-mode: overlay;
  opacity: 0.9;
  animation: tplGemIri 10s linear infinite;
}
@keyframes tplGemIri { to { --iriAngle: 360deg; } }
/* Crystal: the common crystal's violet/blue, swirling like inner spell. */
@property --gemAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.tpl-gem-spell {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  background: conic-gradient(from var(--gemAngle) at var(--cryCx, 84.9%) var(--cryCy, 11.5%), #7b5cff, #4fd0ff, #b06bff, #6b9bff, #c77bff, #7b5cff);
  mix-blend-mode: color;
  opacity: 0.95;
  animation: tplGemSpell 5s linear infinite;
}
@keyframes tplGemSpell { to { --gemAngle: 360deg; } }

/* The full-art board lays itself out at native 420×588 and is scaled (by JS)
   to fill this fitter — guaranteeing the CardMaker layout at any size. */
.fullart-fit { position: absolute; inset: 0; }
.fullart-board {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  /* SIN `will-change: transform`. La carta se compone a tamaño de PLANTILLA (880 px de
     ancho en un héroe) y se reduce con un `scale` de ~0,18: si además se promociona a
     capa propia, Chrome la rasteriza UNA vez a la resolución de esa capa y luego sólo
     estira la textura — la carta se ve BORROSA en reposo y se afila sola en cuanto una
     animación fuerza a repintarla. Aquí el `scale` no se anima nunca (sólo cambia al
     redimensionar), así que la pista no ahorraba nada y costaba nitidez. Cuanto más
     grande se pinta la carta, más se notaba: saltó al acercar la vista del simulador. */
}

/* ============ FOIL (iridescent holographic finish) ============ */
/* Rendered inside a card's art window (so it's clipped to the window and sits under
   the painted frame). The base layer is a soft pastel rainbow that drifts on its own
   (ambient shimmer); a brighter glare band + a hue shift track the card's tilt via
   --foil-x / --foil-y (set by the pack-reveal tilt and the zoom inspector). The
   soft-light blend keeps the underlying art fully readable — it's just an adornment. */
/* EL ARCOÍRIS DEL FOIL, EN UN SOLO SITIO. Lo leen `.foil-fx` (la ventana del arte) y
   `.promo-holo-ink` (el holograma de la skin promo). Tienen que ser el MISMO degradado,
   el mismo tamaño, la misma deriva y el mismo giro de matiz: si no, al inclinar la carta
   el holograma enseña un color y el foil que tiene detrás otro. */
:root {
  --foil-iris: linear-gradient(115deg,
    hsl(330 90% 70%), hsl(45 95% 68%), hsl(155 85% 64%),
    hsl(195 95% 66%), hsl(265 90% 72%), hsl(330 90% 70%));
  --foil-iris-size: 240% 240%;
}
/* EL GIRO DE MATIZ NO PUEDE DECLARARSE EN `:root`, y estuvo ahi sin hacer nada.
   Un `var()` dentro del valor de una custom property se sustituye EN EL ELEMENTO DONDE SE
   DECLARA, no donde se usa. `--foil-x` lo pone `applyFoilTilt` sobre la `.card`, asi que en
   `:root` no existe: caia al 0 de reserva y lo que heredaba todo el mundo era un
   `hue-rotate(0deg)` fijo — comprobado leyendo el `filter` computado de un `.foil-fx` con la
   carta ladeada. O sea que el foil driftaba pero NUNCA viraba con el angulo, que es justo lo
   que estos comentarios llevan prometiendo. Declarado sobre QUIEN LO USA, `--foil-x` se
   resuelve por herencia desde la carta y el matiz vuelve a girar. Sigue en un solo sitio,
   que era el motivo de la variable. */
.foil-fx, .foil-frame-fx, .promo-holo-ink, .sat-holo-btc.is-iris span {
  --foil-iris-hue: hue-rotate(calc(var(--foil-x, 0) * 55deg));
}

/* FOIL — "Option 2B": an iridescent overlay tint that drifts, plus a sweeping shine
   band. `.foil-fx` lives INSIDE the art window (so it only touches the image, never
   the frame) and carries NO z-index — the templates place it in DOM order so it sits
   behind the character on two-image cards (or over the whole illustration on single-
   image cards). `.foil-frame-fx` (FULL FOIL / "Option 2") repeats the same finish over
   the frame, masked to the frame silhouette. Both read the tilt vars --foil-x/--foil-y. */
/* QUIETO EN REPOSO (dueño, 2026-10-17, "como el de Hillbilly Chad" del preview del evento): el
   arcoíris ya NO deriva solo; el degradado se desplaza con la inclinación (--foil-x/--foil-y,
   -1..1) y se enciende con ella (--foil-m: 0.45 en plano -> 0.8 inclinada). Carta quieta = foil
   quieto. Solo el iridiscente de fondo: hologramas (.promo-holo-ink, sigue con foilDrift), luces
   (.foil-light-*) y destellos propios de cada carta no cambian. */
.foil-fx, .foil-frame-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  background: var(--foil-iris);
  background-size: var(--foil-iris-size);
  background-position: calc((var(--foil-x, 0) * 0.5 + 0.5) * 100%) calc((var(--foil-y, 0) * 0.5 + 0.5) * 100%);
  mix-blend-mode: overlay;
  opacity: calc(0.45 + var(--foil-m, 0) * 0.35);
  filter: saturate(1.3) var(--foil-iris-hue);
}
/* El BRILLO que sigue al punto de inclinación (el `.t-glare` del preview): blanco suave donde
   "da la luz", nada en plano. */
.foil-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at calc((var(--foil-x, 0) * 0.5 + 0.5) * 100%) calc((var(--foil-y, 0) * 0.5 + 0.5) * 100%),
    rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 38%);
  mix-blend-mode: soft-light;
  opacity: var(--foil-m, 0);
}
@keyframes foilDrift {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}
/* The white shine band that sweeps across with the tilt. */
.foil-fx-sheen {
  position: absolute;
  inset: -45%;
  background: linear-gradient(105deg,
    transparent 44%,
    rgba(255, 255, 255, 0.5) 49.5%,
    rgba(255, 255, 255, 0.12) 52.5%,
    transparent 57%);
  mix-blend-mode: screen;
  opacity: calc(0.3 + var(--foil-m, 0) * 0.5);
  transform: translateX(calc(var(--foil-x, 0) * 60%));
  transition: transform 0.08s linear;
}
/* FULL FOIL frame layer (unused by any card yet): masked to the frame PNG, sits above
   the frame. The mask image is set inline per card; border-radius reset (it follows
   the mask, not the art window's rounded corners). */
.foil-frame-fx {
  z-index: 2;
  border-radius: 0;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
@media (prefers-reduced-motion: reduce) {
  .foil-fx, .foil-frame-fx { animation: none; }
}

/* FOIL Satoshi: a big ₿ watermark centred in the effect panel (behind the text). It is a
   GOLD HOLOGRAM — dim while the card is flat, it flares gold as the card is TILTED:
   opacity rides --foil-m (tilt magnitude, set by the zoom inspector + the pack-reveal tilt) and the
   bright specular band sweeps across the glyph with --foil-x. Purely cosmetic (pointer-events:none). */
.sat-holo-btc {
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  /* Base 0.5 → clearly visible even FLAT; rises to full as the card is tilted (--foil-m). */
  opacity: calc(0.5 + var(--foil-m, 0) * 0.5);
  transition: opacity 0.12s linear;
}
.sat-holo-btc span {
  font: 900 190px/1 "Segoe UI", "Arial", sans-serif;
  /* metallic-gold gradient: lighter-gold edges (no dark brown) → a bright pale-gold specular core the tilt slides */
  background-image: linear-gradient(105deg,
    #cc9a44 0%, #e2b866 16%, #ffe6a0 38%, #fffdf0 50%, #ffe6a0 62%, #e2b866 84%, #cc9a44 100%);
  background-size: 260% 100%;
  background-position: calc(50% - var(--foil-x, 0) * 55%) 50%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 1px 1px rgba(120, 80, 10, 0.4)) drop-shadow(0 0 12px rgba(255, 208, 108, 0.4));
  transition: background-position 0.08s linear;
}
/* Bitcoin Whale FOIL: el mismo ₿ pero IRIDISCENTE. Dos capas recortadas al glifo: la banda
   especular blanca que cruza con --foil-x encima, y debajo el arcoíris del foil (--foil-iris)
   con su misma deriva y su mismo giro de matiz, para que vire a la vez que la ventana del arte. */
.sat-holo-btc.is-iris span {
  background-image:
    linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.85) 48%, rgba(255, 255, 255, 0.25) 55%, transparent 64%),
    var(--foil-iris);
  background-size: 260% 100%, var(--foil-iris-size);
  background-position: calc(50% - var(--foil-x, 0) * 70%) 50%, 0% 0%;
  animation: satIrisDrift 7s linear infinite;
  filter: saturate(1.3) var(--foil-iris-hue) drop-shadow(0 1px 1px rgba(40, 30, 90, 0.35)) drop-shadow(0 0 12px rgba(190, 160, 255, 0.4));
}
/* foilDrift, pero solo sobre la capa del arcoíris: la banda especular sigue a la inclinación. */
@keyframes satIrisDrift {
  0%   { background-position: calc(50% - var(--foil-x, 0) * 70%) 50%, 0% 0%; }
  50%  { background-position: calc(50% - var(--foil-x, 0) * 70%) 50%, 100% 100%; }
  100% { background-position: calc(50% - var(--foil-x, 0) * 70%) 50%, 0% 0%; }
}
@media (prefers-reduced-motion: reduce) {
  .sat-holo-btc.is-iris span { animation: none; }
}

/* WHITEPAPER — el pergamino encendido por sus propias runas.
   LOS COLORES NO SON INVENTADOS: salen de medir la tinta del dibujo, agrupada por matiz.
   El promedio da cian #9ce2f5 en los rodillos, azul #6380ba en el cuerpo del texto y
   violeta #7e549f en los remates. Aqui se usan aclarados, porque lo que se pinta es LUZ
   y no tinta: un halo con el color exacto de la tinta sale apagado sobre el muro oscuro.

   Dos piezas y DOS movimientos distintos, a proposito:
     .wp-art    el HALO del contorno. Es un `drop-shadow`, que sigue el alfa del PNG, asi
                que abraza la silueta del pergamino y no su caja. Fijo en la copia de
                serie; solo LATE (`--wp-pulse`) cuando la copia es FOIL (`.is-foil`).
     .wp-runes  las LETRAS. Misma caja y mismo encuadre que el dibujo, recortadas por la
                mascara que se genero del propio arte. Aqui NO hay latido: lo que se mueve
                es el DEGRADADO, que corre por los glifos y los va cambiando de color
                (`--wp-flow`). `screen` para que solo ACLAREN donde ya hay runa y no
                ensucien el pergamino. Solo en la foil. */
:root {
  --wp-rune-cyan: #b9ecff;
  --wp-rune-blue: #8fb0ff;
  --wp-rune-violet: #b788e0;
  --wp-pulse: 2.6s;   /* el latido del contorno */
  --wp-flow: 7s;      /* lo que tarda el color en dar una vuelta por las letras */
}
.wp-art {
  filter: drop-shadow(0 0 3px rgba(143, 176, 255, 0.55)) drop-shadow(0 0 11px rgba(183, 136, 224, 0.34));
}
.wp-art.is-foil { animation: wpEdgePulse var(--wp-pulse) ease-in-out infinite; }
@keyframes wpEdgePulse {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(143, 176, 255, 0.5))  drop-shadow(0 0 9px rgba(183, 136, 224, 0.32)); }
  50%      { filter: drop-shadow(0 0 7px rgba(185, 236, 255, 0.95)) drop-shadow(0 0 22px rgba(183, 136, 224, 0.7)); }
}
.wp-runes {
  pointer-events: none;
  /* DOS PERIODOS del ciclo cian -> azul -> violeta metidos en la imagen, y la imagen al
     doble de ancho que la caja. Eso es lo que hace que el bucle no se note: al llevar el
     `background-position` de 0% a 100% la imagen se desplaza EXACTAMENTE el ancho de la
     caja, que aqui es justo un periodo, asi que el fotograma final es identico al primero.

     LOS TONOS SON LOS DE LA TINTA, PERO SUBIDOS DE CROMA. Con el color medido tal cual
     (#9ce2f5 / #6380ba / #7e549f) las runas salian planas: `screen` sobre la tinta oscura
     devuelve casi el color de la capa, y tres pasteles vecinos apenas se distinguen entre
     si. Mismos MATICES (193° / 220° / 278°), mucha mas saturacion. */
  background-image: linear-gradient(112deg,
    #2fd9ff 0%, #4d7bff 12.5%, #a84dff 25%, #4d7bff 37.5%,
    #2fd9ff 50%, #4d7bff 62.5%, #a84dff 75%, #4d7bff 87.5%, #2fd9ff 100%);
  background-size: 200% 100%;
  mix-blend-mode: screen;
  /* `saturate` ANTES de que la capa se mezcle: es lo que separa el cian del violeta cuando
     el `screen` los aclara. Los dos `drop-shadow` van DESPUES de la mascara, asi que siguen
     la forma de cada glifo — uno ceñido para el filo y otro abierto para el halo. */
  filter: blur(0.4px) saturate(1.7) brightness(1.4)
          drop-shadow(0 0 3px rgba(120, 200, 255, 0.9))
          drop-shadow(0 0 10px rgba(150, 110, 255, 0.65));
  /* `linear`: el color tiene que recorrer las letras a paso constante. Con una curva de
     entrada/salida se pararia en los extremos y volveria a leerse como un latido. */
  animation: wpRuneFlow var(--wp-flow) linear infinite;
}
/* EL DESTELLO que cruza las letras. Va aparte del degradado de color porque son dos cosas:
   una da el TONO y la otra el BRILLO, y sin esta segunda las runas cambian de color pero no
   parecen encenderse. Es un hijo, asi que la mascara del padre tambien lo recorta; y como el
   padre ya tiene `filter` y `mix-blend-mode` (o sea, contexto de apilamiento propio), este
   `screen` se mezcla DENTRO del grupo — aclara el degradado, no la carta.
   DOS bandas en la imagen por el mismo motivo que dos periodos arriba: al desplazarse un
   ancho de caja, la que sale por la derecha deja a la siguiente en su sitio exacto.
   A doble velocidad (`/ 2`): dos pasadas por vuelta de color, y sigue cerrando en 7 s. */
.wp-runes::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(102deg,
    rgba(255, 255, 255, 0) 14%, rgba(255, 255, 255, 0.95) 25%, rgba(255, 255, 255, 0) 36%,
    rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, 0.95) 75%, rgba(255, 255, 255, 0) 86%);
  background-size: 200% 100%;
  mix-blend-mode: screen;
  animation: wpRuneFlow calc(var(--wp-flow) / 2) linear infinite;
}
@keyframes wpRuneFlow {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .wp-art.is-foil, .wp-runes { animation: none; }
}

/* `foilGlow` en cartas de hechizo (Soft Fork): el contorno dorado del `artGlow` de Satoshi,
   solo en la copia foil. En los heroes va como `filter` en linea (HeroTemplateCard). */
.foil-gold-glow { filter: drop-shadow(0 0 4px rgba(245,193,74,0.7)) drop-shadow(0 0 16px rgba(247,147,26,0.48)); }

/* HARD FORK (foil) — aura verde + DESCARGA ELECTRICA que recorre el tenedor.
     .fork-aura      halo verde SUAVE pegado a la silueta (`drop-shadow` sigue el alfa del
                     PNG); solo respira, lento. Nada de parpadeo: el movimiento es la descarga.
     .fork-zap       el padre: filtro SVG `#forkZapFx` (turbulencia que salta de semilla cada
                     50 ms y desplaza los filamentos -> zigzag que chisporrotea) + un filo verde
                     muy ceñido. POCA luz a proposito: lo que tiene que leerse es el rayo, no el
                     brillo (la version de banda blanca con halo ancho parecia una bombilla).
     .fork-zap-band  recorte por la silueta del dibujo (mascara en linea, desde game.js).
     .fork-zap-bolt  FILAMENTOS finos paralelos al eje del tenedor (gradiente a 45deg = rayas
                     a 135deg, el eje cabeza arriba-izq -> dientes abajo-dcha), vistos solo
                     por una VENTANA diagonal que viaja (mascara a 200 %: de 112 % a -12 %
                     entra por la cabeza, sale por los dientes y descansa). Se probaron rayos
                     que CRUZAN el tenedor y el usuario prefirio estos. */
:root { --fork-pulse: 3.2s; --fork-zap: 4.5s; }  /* 1.2 s de viaje + 3.3 s de pausa */
.fork-aura {
  filter: drop-shadow(0 0 2px rgba(120, 255, 170, 0.5)) drop-shadow(0 0 8px rgba(40, 220, 120, 0.3));
  animation: forkAuraBreathe var(--fork-pulse) ease-in-out infinite;
}
@keyframes forkAuraBreathe {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(120, 255, 170, 0.45)) drop-shadow(0 0 7px rgba(40, 220, 120, 0.25)); }
  50%      { filter: drop-shadow(0 0 3px rgba(140, 255, 185, 0.65)) drop-shadow(0 0 11px rgba(40, 230, 120, 0.4)); }
}
.fork-zap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: url(#forkZapFx) drop-shadow(0 0 2px rgba(80, 255, 150, 1)) drop-shadow(0 0 5px rgba(40, 230, 120, 0.45));
}
.fork-zap-band { position: absolute; inset: 0; }
.fork-zap-bolt {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg,
    rgba(0, 0, 0, 0) 0 8px,
    rgba(200, 255, 220, 1) 8px 10.5px,
    rgba(0, 0, 0, 0) 10.5px 17px,
    rgba(90, 255, 160, 0.85) 17px 18.8px,
    rgba(0, 0, 0, 0) 18.8px 26px);
  -webkit-mask-image: linear-gradient(135deg, transparent 45%, #000 48%, #000 51.5%, transparent 54.5%);
          mask-image: linear-gradient(135deg, transparent 45%, #000 48%, #000 51.5%, transparent 54.5%);
  -webkit-mask-size: 200% 200%; mask-size: 200% 200%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: forkZapRun var(--fork-zap) linear infinite;
}
@keyframes forkZapRun {
  0%           { -webkit-mask-position: 112% 112%; mask-position: 112% 112%; }
  26%          { -webkit-mask-position: -12% -12%; mask-position: -12% -12%; }
  26.01%, 100% { -webkit-mask-position: -12% -12%; mask-position: -12% -12%; }
}
@media (prefers-reduced-motion: reduce) {
  .fork-aura, .fork-zap-bolt { animation: none; }
  .fork-zap { display: none; }
}

/* BUY THE DIP (foil) — resplandor DORADO que late desde el FONDO DEL POZO (`pitGlow`).
   Tres capas de luz en `screen` sobre el dibujo, ancladas abajo en el centro del pozo (52 % /
   100 % de la ventana de arte: con el encuadre `cover · center 60%` el fondo cae ahí):
     .dip-glow          el FOCO: caliente y concentrado, casi blanco en el centro.
     .dip-glow::after   la luz que TREPA por las paredes, ancha, y late a destiempo del foco
                        para que el pulso respire en vez de encenderse y apagarse de golpe.
     .dip-glow::before  RAYOS que salen del fondo (cuñas de un `conic-gradient` con el vértice
                        en el pozo), fundidos hacia arriba con una máscara radial y oscilando
                        despacio a los lados.
   Medido (27-09-2026): la primera versión, sólo foco pequeño, subía el pozo 5-17 niveles y
   las paredes nada — el fondo del pozo ya es amarillo casi blanco y `screen` sobre algo claro
   apenas se nota. Por eso la luz tiene que llegar a las PAREDES, que es donde se ve.
   La luz se APAGA antes del borde del precipicio (~55 % desde abajo): si llega arriba lava a
   la rata y al goblin.
   Sólo en la copia FOIL y sin skin (ver SpellTemplateCard): pertenece a ESTE dibujo. */
:root { --dip-pulse: 2.6s; }
.dip-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 46% 40% at 52% 100%,
    rgba(255, 252, 220, 1) 0%, rgba(255, 214, 90, 0.85) 32%, rgba(255, 176, 40, 0.35) 65%, rgba(255, 160, 20, 0) 100%);
  transform-origin: 52% 100%;
  animation: dipGlowCore var(--dip-pulse) ease-in-out infinite;
}
.dip-glow::after,
.dip-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  transform-origin: 52% 100%;
}
.dip-glow::after {
  background: radial-gradient(ellipse 85% 68% at 52% 100%,
    rgba(255, 200, 80, 0.7) 0%, rgba(255, 176, 50, 0.38) 45%, rgba(255, 160, 30, 0) 100%);
  animation: dipGlowRise var(--dip-pulse) ease-in-out infinite;
  animation-delay: calc(var(--dip-pulse) * -0.35);
}
.dip-glow::before {
  background: repeating-conic-gradient(from -52deg at 52% 100%,
    rgba(255, 236, 150, 0) 0deg, rgba(255, 236, 150, 0.55) 3deg, rgba(255, 236, 150, 0) 7deg,
    rgba(255, 236, 150, 0) 13deg);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 52% 100%, #000 10%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
          mask-image: radial-gradient(ellipse 70% 70% at 52% 100%, #000 10%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
  animation: dipGlowRays calc(var(--dip-pulse) * 3) ease-in-out infinite;
}
@keyframes dipGlowCore {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50%      { opacity: 1;    transform: scale(1.12); }
}
@keyframes dipGlowRise {
  0%, 100% { opacity: 0.3; transform: scaleY(0.85); }
  50%      { opacity: 1;   transform: scaleY(1.1); }
}
@keyframes dipGlowRays {
  0%, 100% { opacity: 0.35; transform: rotate(-4deg); }
  50%      { opacity: 0.9;  transform: rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
  .dip-glow, .dip-glow::after, .dip-glow::before { animation: none; opacity: 0.75; }
}

/* `foilLights` (foil) — las LUCES del dibujo encendidas. Una capa por tipo de luz, recortada
   por una mascara sacada del propio arte (tools/make-light-masks.py); el HALO va horneado en
   la mascara, asi que aqui no hay `blur` ni `drop-shadow`: solo color en `screen` y opacidad.
     .foil-light-gold   el ORO (monedas, herrajes del cofre): un degradado calido que corre y,
                        encima, un DESTELLO blanco que lo cruza (mismo bucle sin costura que
                        `.wp-runes`: dos periodos en una imagen al doble de ancho).
     .foil-light-green  la MAGIA que sale del cofre y trepa por las raices: late.
     .foil-light-mist   la luz palida de detras del arbol y las chispas: respira despacio y a
                        destiempo de la verde, para que la escena no parpadee entera a la vez. */
:root { --fl-pulse: 3s; --fl-flow: 6s; }
.foil-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.foil-light-gold {
  background-image: linear-gradient(112deg,
    #ff7a00 0%, #ffa51e 12.5%, #ffe08a 25%, #ffa51e 37.5%,
    #ff7a00 50%, #ffa51e 62.5%, #ffe08a 75%, #ffa51e 87.5%, #ff7a00 100%);
  background-size: 200% 100%;
  /* `hard-light` y no `screen`: el iridiscente del foil pasa por encima del dibujo y, cuando
     toca en verde, `screen` dejaba las monedas amarillo limon. `hard-light` con naranja sube
     el rojo y BAJA el azul, asi que el oro sigue siendo oro pase el tono que pase. */
  mix-blend-mode: hard-light;
  opacity: 0.8;
  animation: wpRuneFlow var(--fl-flow) linear infinite;
}
.foil-light-gold::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(102deg,
    rgba(255, 255, 255, 0) 16%, rgba(255, 255, 255, 0.95) 25%, rgba(255, 255, 255, 0) 34%,
    rgba(255, 255, 255, 0) 66%, rgba(255, 255, 255, 0.95) 75%, rgba(255, 255, 255, 0) 84%);
  background-size: 200% 100%;
  mix-blend-mode: screen;
  animation: wpRuneFlow calc(var(--fl-flow) / 2) linear infinite;
}
.foil-light-green {
  background: radial-gradient(ellipse 70% 60% at 50% 66%, #b6ffc4 0%, #4dff8a 45%, #1fd66a 100%);
  animation: foilLightPulse var(--fl-pulse) ease-in-out infinite;
}
/* .foil-light-fuse  lo que ILUMINA la mecha de Pump Goblin (la chispa, la lente de las gafas, los
   brillos de la bomba): un latido naranja, la receta de la magia verde en ambar. */
.foil-light-fuse {
  background: radial-gradient(ellipse 70% 60% at 30% 45%, #fff1c2 0%, #ffb02e 45%, #ff6a00 100%);
  animation: foilLightPulse var(--fl-pulse) ease-in-out infinite;
}
/* .foil-light-bolt  el RAYO que corre entre las cartas de Flash Loan y sus chispas amarillas: un
   resplandor electrico amarillo que respira y, de vez en cuando, chisporrotea (dos golpes rapidos). */
.foil-light-bolt {
  background: radial-gradient(ellipse 80% 70% at 55% 50%, #fff6c8 0%, #ffd84a 45%, #ffb21e 100%);
  animation: foilLightBolt 4.2s linear infinite;
}
@keyframes foilLightBolt {
  0%, 100% { opacity: 0.4; }
  30%      { opacity: 0.62; }
  58%      { opacity: 0.45; }
  60%      { opacity: 0.9; }
  61.5%    { opacity: 0.35; }
  63%      { opacity: 0.85; }
  66%      { opacity: 0.5; }
  85%      { opacity: 0.6; }
}
/* .foil-light-thread  el HILO dorado magico de Impermanent Loss (del dedo del ninja a la mano del
                      fantasma) y la yema que lo lanza: un resplandor de oro que late, con un
                      destello blanco cada pocos latidos (el halo va horneado en la mascara).
   .foil-light-ghost   el FANTASMA de la misma carta: brilla en SUS colores (menta y turquesa) y
                      respira despacio, a destiempo del hilo. */
.foil-light-thread {
  background: radial-gradient(ellipse 70% 60% at 50% 55%, #fff6cf 0%, #ffd54f 45%, #ffad1a 100%);
  animation: foilLightThread 3.2s ease-in-out infinite;
}
@keyframes foilLightThread {
  0%, 100% { opacity: 0.5; }
  40%      { opacity: 0.85; }
  47%      { opacity: 1; filter: brightness(1.35); }
  54%      { opacity: 0.8; }
}
.foil-light-ghost {
  background: radial-gradient(ellipse 80% 70% at 50% 35%, #e6fff9 0%, #9ff5df 40%, #4fdcc6 100%);
  animation: foilLightGhost 4.8s ease-in-out infinite;
  animation-delay: -1.6s;
}
@keyframes foilLightGhost {
  0%, 100% { opacity: 0.18; }
  50%      { opacity: 0.5; }
}
/* .foil-light-neon-green / -neon-red  los NEONES de Testnet Dummie (ojo, visor, tiras; anillos de la
   diana, antena): un resplandor suave y fijo y, una vez por ciclo, un parpadeo de tubo fluorescente.
   Cada neon lleva su `--fl-phase` (0..1, de la carta): su parpadeo cae en SU tramo del ciclo, y como
   el parpadeo dura el 6 % y las fases van de sexto en sexto, nunca parpadean dos a la vez. */
:root { --fl-neon-cycle: 12s; }
.foil-light-neon-green, .foil-light-neon-red {
  opacity: 0.55;
  animation: foilNeonFlicker var(--fl-neon-cycle) linear infinite;
  animation-delay: calc(var(--fl-neon-cycle) * var(--fl-phase, 0) * -1);
}
/* saturated, almost no white: under screen a pale core washed the red target to pink */
.foil-light-neon-green { background: radial-gradient(circle at 50% 40%, #9dffab 0%, #3dff6a 50%, #12c845 100%); }
.foil-light-neon-red { background: radial-gradient(circle at 50% 45%, #ff5a4a 0%, #ff1e2e 50%, #c80c1a 100%); }
@keyframes foilNeonFlicker {
  0%, 6.5%, 100% { opacity: 0.55; }
  0.8%  { opacity: 0.08; }
  1.6%  { opacity: 0.62; }
  2.2%  { opacity: 0.12; }
  3.4%  { opacity: 0.18; }
  4.2%  { opacity: 0.7; }
  5.2%  { opacity: 0.3; }
}
/* .foil-light-buy  el boton BUY de la skin de Buy the Dip: un latido verde SUTIL (pedido del
   usuario), mas bajo que la magia verde de Beta Tester. */
.foil-light-buy {
  background: radial-gradient(ellipse 30% 14% at 58% 75%, #e6ffe9 0%, #6dff9b 55%, #22e06e 100%);
  animation: foilLightBuy 2.4s ease-in-out infinite;
}
@keyframes foilLightBuy {
  0%, 100% { opacity: 0.12; }
  50%      { opacity: 0.6; }
}
.foil-light-mist {
  background: radial-gradient(ellipse 80% 70% at 50% 22%, #f2fff6 0%, #bfeee0 55%, #8fd6d0 100%);
  animation: foilLightBreathe calc(var(--fl-pulse) * 2) ease-in-out infinite;
  animation-delay: calc(var(--fl-pulse) * -0.8);
}
/* .foil-light-flow-<color>  LIQUIDO y HUMO de color (los tubos de ensayo de Beta Tester): la receta
   del oro (degradado que corre + destello blanco que lo cruza) en verde / rojo / naranja. En
   `screen`: aqui la luz va sobre el recorte del personaje y sobre humo translucido, y tiene que
   sumar color, no sustituirlo. */
.foil-light-flow-green, .foil-light-flow-red, .foil-light-flow-orange {
  background-size: 200% 100%;
  opacity: 0.85;
  animation: wpRuneFlow var(--fl-flow) linear infinite;
}
.foil-light-flow-green {
  background-image: linear-gradient(112deg,
    #19c23e 0%, #5dff6e 12.5%, #e2ffb0 25%, #5dff6e 37.5%,
    #19c23e 50%, #5dff6e 62.5%, #e2ffb0 75%, #5dff6e 87.5%, #19c23e 100%);
}
.foil-light-flow-red {
  background-image: linear-gradient(112deg,
    #e01b2f 0%, #ff5a4d 12.5%, #ffc2a8 25%, #ff5a4d 37.5%,
    #e01b2f 50%, #ff5a4d 62.5%, #ffc2a8 75%, #ff5a4d 87.5%, #e01b2f 100%);
}
.foil-light-flow-orange {
  background-image: linear-gradient(112deg,
    #ff7a00 0%, #ffa51e 12.5%, #ffe08a 25%, #ffa51e 37.5%,
    #ff7a00 50%, #ffa51e 62.5%, #ffe08a 75%, #ffa51e 87.5%, #ff7a00 100%);
}
.foil-light-flow-green::after, .foil-light-flow-red::after, .foil-light-flow-orange::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(102deg,
    rgba(255, 255, 255, 0) 18%, rgba(255, 255, 255, 0.8) 25%, rgba(255, 255, 255, 0) 32%,
    rgba(255, 255, 255, 0) 68%, rgba(255, 255, 255, 0.8) 75%, rgba(255, 255, 255, 0) 82%);
  background-size: 200% 100%;
  mix-blend-mode: screen;
  animation: wpRuneFlow calc(var(--fl-flow) / 2) linear infinite;
}
/* .foil-light-glint  un REFLEJO suave que cruza una pieza pulida (la moneda de Shilling) y
   descansa fuera de ella: una sola banda blanca estrecha, sin tinte de color. El recorrido
   (-30% -> 75%) lleva el centro de la banda del 18% al 60% del ancho del arte, y la moneda
   ocupa del 27% al 49%: la banda entra y sale ENTERA, no se queda rozando el canto. Otra carta
   ajusta el recorrido con `from` / `to` en su entrada de `foilLights` (--fl-glint-from / -to). */
.foil-light-glint {
  background: linear-gradient(108deg,
    rgba(255, 255, 255, 0) 43%, rgba(255, 255, 255, 0.85) 50%, rgba(255, 255, 255, 0) 57%) no-repeat;
  background-size: 60% 100%;
  background-position: var(--fl-glint-from, -30%) 0;
  opacity: 0.5;
  animation: foilLightGlint 4.5s ease-in-out infinite;
}
/* .foil-light-blade  el REFLEJO RAPIDO de una hoja (la espada de Leverage Larry): una banda blanca
   perpendicular a la hoja (56deg = la hoja sube a ~34 grados) que la recorre de la guarda a la punta
   en un golpe (~0,4 s) y descansa fuera. El recorrido 0% -> 175% cubre la hoja entera (del 40% al
   80% del ancho del arte) y deja la banda FUERA de la punta al descansar; otra carta lo ajusta con `from` / `to`. */
.foil-light-blade {
  background: linear-gradient(56deg,
    rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0.7) 44%, rgba(255, 255, 255, 1) 48%,
    rgba(255, 255, 255, 1) 52%, rgba(255, 255, 255, 0.7) 56%, rgba(255, 255, 255, 0) 66%) no-repeat;
  background-size: 60% 100%;
  background-position: var(--fl-glint-from, 0%) 0;
  animation: foilLightBlade 3.2s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}
/* .foil-light-red      los RAYOS rojos de HODL: un resplandor rojo que late (halo horneado en la
                        mascara). `screen`: suma luz sobre el rojo pintado y sobre el cielo de alrededor.
   .foil-light-red-rim  el mismo rojo cayendo SOBRE el personaje, muy tenue y a destiempo: respira
                        en vez de latir. `soft-light` para tenir el dibujo sin lavarlo. */
.foil-light-red {
  background: radial-gradient(ellipse 60% 60% at 38% 50%, #ffd0c0 0%, #ff4a36 38%, #ff1c1c 100%);
  animation: foilLightRed 2.4s ease-in-out infinite;
}
@keyframes foilLightRed {
  0%, 100% { opacity: 0.22; }
  50%      { opacity: 0.85; }
}
/* .foil-light-red-steady  Market Crash: the lightning and the red energy round the falling candles. The same
                          red light, but STEADY (owner 2026-10-26: no pulse). */
.foil-light-red-steady {
  background: radial-gradient(ellipse 60% 60% at 38% 50%, #ffd0c0 0%, #ff4a36 38%, #ff1c1c 100%);
  opacity: 0.6;
}
/* .foil-light-red-slow  las luces rojas del robot de Shilling (ojo + antena): el mismo resplandor,
                         pero un latido LENTO, de piloto encendido. */
.foil-light-red-slow {
  background: radial-gradient(circle at 50% 50%, #ffd6cc 0%, #ff3a2a 45%, #ff1414 100%);
  animation: foilLightRedSlow 5s ease-in-out infinite;
}
@keyframes foilLightRedSlow {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 1; }
}
/* .foil-light-laser  Chinese Spy: the red security lasers. A SUBTLE glow of their own red (owner
                      2026-11-12), halo baked in the mask; a slow, shallow breath, never a pulse. */
.foil-light-laser {
  background: radial-gradient(circle at 50% 50%, #ffc4bc 0%, #ff4438 45%, #ff1a1a 100%);
  animation: foilLightLaser 4.6s ease-in-out infinite;
}
@keyframes foilLightLaser {
  0%, 100% { opacity: 0.32; }
  50%      { opacity: 0.6; }
}
/* .foil-light-gold-pulse  Whale Tracker: la punta del catalejo, las monedas y el farol. Un resplandor
                           dorado que late (el halo va horneado en la mascara).
   .foil-light-moon        su luna: un halo de su propio color, palido y frio, que respira despacio. */
.foil-light-gold-pulse {
  background: radial-gradient(circle at 50% 50%, #fff4c2 0%, #ffd25a 45%, #ffae22 100%);
  animation: foilLightGoldPulse 3.2s ease-in-out infinite;
}
@keyframes foilLightGoldPulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.95; }
}
/* .foil-light-spark  Exploit: the burst under the dagger, the runes and the sparks. The PALE YELLOW of
                      the art itself (#fdefa1 / #fbeb97 measured), not the orange-gold of the coins. */
.foil-light-spark {
  background: radial-gradient(circle at 50% 50%, #fffbe6 0%, #fdefa1 45%, #f7da72 100%);
  animation: foilLightGoldPulse 3.2s ease-in-out infinite;
}
.foil-light-moon {
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #e4f6ff 45%, #b9e2f6 100%);
  animation: foilLightMoon 6s ease-in-out infinite;
}
@keyframes foilLightMoon {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.85; }
}
.foil-light-red-rim {
  background: #ff3324;
  mix-blend-mode: soft-light;
  animation: foilLightRedRim 2.4s ease-in-out infinite;
}
@keyframes foilLightRedRim {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.75; }
}
/* .foil-light-screen  la PANTALLA encendida de un ordenador (Whales Chat): un resplandor frio y SUTIL
                       que respira, con un leve parpadeo de monitor; el halo va cocido en la mascara. */
.foil-light-screen {
  background: radial-gradient(ellipse 70% 60% at 54% 40%, #f4fdff 0%, #c8f1ff 45%, #8fd8ff 100%);
  animation: foilLightScreen 3.6s ease-in-out infinite;
}
@keyframes foilLightScreen {
  0%, 100% { opacity: 0.14; }
  46%      { opacity: 0.34; }
  50%      { opacity: 0.27; }
  54%      { opacity: 0.34; }
}
/* .foil-light-life-beam  la LUZ que cae de arriba en Proof of Life y su charco en el suelo: un
                          resplandor SUTIL de los colores del dibujo (verde en el haz, amarillo en
                          el suelo) que respira despacio.
   .foil-light-life-orb   el ORBE de energia del cubo: nucleo amarillo, borde verde, y un pulso
                          de DOS tiempos (latido) para que parezca vivo; a destiempo del haz. */
.foil-light-life-beam {
  background: linear-gradient(180deg, #6dffb0 0%, #8dff8a 45%, #e6ff6a 78%, #fff27a 100%);
  animation: foilLightLifeBeam 4.4s ease-in-out infinite;
}
@keyframes foilLightLifeBeam {
  0%, 100% { opacity: 0.1; }
  50%      { opacity: 0.34; }
}
.foil-light-life-orb {
  background: radial-gradient(circle at 52% 51%, #ffffd0 0%, #f4ff6a 9%, #a6ff5c 17%, #4dff8a 27%, #2fe08a 100%);
  animation: foilLightLifeOrb 2.2s ease-in-out infinite;
}
@keyframes foilLightLifeOrb {
  0%, 100% { opacity: 0.3; }
  14%      { opacity: 0.95; }
  30%      { opacity: 0.5; }
  44%      { opacity: 0.82; }
  70%      { opacity: 0.34; }
}
/* .foil-light-cyan      la MAGIA celeste de Smart Contract Audit (rayo del dedo, halo de la carta,
                         pupilas, llamas de las velas): late, con el halo horneado en la mascara.
   .foil-light-cyan-rim  el mismo celeste en el CONTORNO del personaje: mas tenue y a destiempo. */
.foil-light-cyan {
  background: #7ff6ff;
  animation: foilLightCyan 2.6s ease-in-out infinite;
}
@keyframes foilLightCyan {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.9; }
}
/* .foil-light-blue  the BLUE arrow and its half of the magic circle (Swap): the green one's pulse,
   half a beat late, so the two lights take turns. */
.foil-light-blue {
  background: radial-gradient(ellipse 70% 60% at 62% 60%, #e2f2ff 0%, #8fc8ff 45%, #4f9dff 100%);
  animation: foilLightPulse var(--fl-pulse) ease-in-out infinite;
  animation-delay: calc(var(--fl-pulse) * -0.5);
}
/* .foil-light-violet  the PURPLE magic of Permabear Shaman (the skull's eye, its crystals, the
   lightning): a storm FLICKER rather than a smooth pulse, off-beat from the blue (`cyan`) layer. */
.foil-light-violet {
  /* `hard-light` and a SATURATED violet, like the gold: `screen` with a pale lilac washed the
     skull's eye to white and could not pull the foil's cyan back to purple. */
  background: radial-gradient(ellipse 60% 50% at 55% 15%, #c47dff 0%, #9b4dff 45%, #7a2cff 100%);
  mix-blend-mode: hard-light;
  animation: foilLightViolet 3.4s ease-in-out infinite;
  animation-delay: -1.3s;
}
@keyframes foilLightViolet {
  /* never below ~0.6: the purple has to read as LIT on every frame, the flicker only adds to it */
  0%, 100% { opacity: 0.6; }
  38%      { opacity: 1; }
  42%      { opacity: 0.7; }
  47%      { opacity: 1; }
  70%      { opacity: 0.65; }
}
/* .foil-light-violet-glow  the lilac OUTLINE of Shadowban's hero: a purple glow that breathes around him,
   slow and even (the void pulling at him), never off. Saturated violet so the foil's cyan/green can't
   wash it pale. */
.foil-light-violet-glow {
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #e2b8ff 0%, #b15cff 45%, #8a2be2 100%);
  mix-blend-mode: screen;
  animation: foilLightVioletGlow 3.6s ease-in-out infinite;
}
@keyframes foilLightVioletGlow {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.95; }
}
/* .foil-light-aura  DeFish's AURA: the cyan-mint glow round the fish, lit in its own colours (cyan to mint,
   a touch of turquoise), breathing slow and never off. Saturated, so the foil's tints can't wash it white. */
.foil-light-aura {
  background: radial-gradient(ellipse 75% 65% at 55% 40%, #b8fff2 0%, #4ff0e0 40%, #3fd9ff 70%, #6dffb0 100%);
  mix-blend-mode: screen;
  animation: foilLightAura 3.2s ease-in-out infinite;
}
@keyframes foilLightAura {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
/* CYBERPUNK LARRY (skin, 2026-10-24): his painted lime neons lit in their own green.
   .foil-light-neon-lime   the katana's blade and the shoulder lens: a glow with a SLIGHT pulse
   .foil-light-implant     the implant lines under the eyes: a steady glow, no pulse
   .foil-light-aura-green  a SUBTLE green aura just outside his outline, breathing slowly */
.foil-light-neon-lime {
  background: radial-gradient(ellipse 80% 70% at 50% 55%, #e9ffb0 0%, #a8ff3c 45%, #52e01e 100%);
  animation: foilLightNeonPulse 2.6s ease-in-out infinite;
}
@keyframes foilLightNeonPulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 0.88; }
}
.foil-light-implant {
  background: radial-gradient(circle at 50% 40%, #f0ffc0 0%, #b6ff4a 50%, #6be22a 100%);
  opacity: 0.75;
}
.foil-light-aura-green {
  background: radial-gradient(ellipse 70% 75% at 50% 50%, #c8ffb0 0%, #7dff5a 45%, #3ed35a 100%);
  animation: foilLightAuraGreen 4.2s ease-in-out infinite;
}
@keyframes foilLightAuraGreen {
  0%, 100% { opacity: 0.22; }
  50%      { opacity: 0.4; }
}
/* .foil-light-bridge  the BRIDGE of light (Bridge): a glow in the bridge's own gradient, magenta
   where it leaves the island (48% down the art) to cyan at the front edge. It pulses. */
.foil-light-bridge {
  background: linear-gradient(180deg, #ff58e0 46%, #d77bff 60%, #8fd8ff 76%, #62f6ff 100%);
  animation: foilLightPulse var(--fl-pulse) ease-in-out infinite;
}
.foil-light-cyan-rim {
  background: #6feaff;
  animation: foilLightCyanRim 2.6s ease-in-out infinite;
  animation-delay: -0.9s;
}
@keyframes foilLightCyanRim {
  0%, 100% { opacity: 0.12; }
  50%      { opacity: 0.6; }
}
/* .foil-light-sunlit  a SUBTLE glow on Plankton Peasant's blue body only (the mask leaves the
   tunic, hat and fork out): pale aqua, a little brighter at the head, breathing slowly. */
.foil-light-sunlit {
  background: radial-gradient(ellipse 55% 60% at 74% 30%, #effffb 0%, #bff8ee 45%, #8fe9dc 100%);
  animation: foilLightSunlit 4s ease-in-out infinite;
}
@keyframes foilLightSunlit {
  0%, 100% { opacity: 0.08; }
  50%      { opacity: 0.26; }
}
/* .foil-light-lamp  la LUZ de una lampara encendida (los faroles de De-Risk): calor que TITILA
   como una llama, sin banda que corra. El halo ancho va horneado en la mascara; en `screen`,
   porque aqui la luz se suma a la pared oscura de detras. */
.foil-light-lamp {
  background: #ffc45a;
  animation: foilLightLamp 3.4s ease-in-out infinite;
}
@keyframes foilLightLamp {
  0%, 100% { opacity: 0.42; }
  18%      { opacity: 0.8; }
  31%      { opacity: 0.58; }
  47%      { opacity: 0.9; }
  63%      { opacity: 0.5; }
  80%      { opacity: 0.74; }
}
/* .foil-light-ember  las partes NARANJAS de Hillbilly Chad (luna de cosecha, calabaza, ventanas del
   granero): un resplandor naranja que corre y RELUCE con un destello claro que lo cruza. `hard-light`
   como el oro: sube el rojo y baja el azul, así sigue siendo naranja pase el tono del foil que pase. */
.foil-light-ember {
  background-image: linear-gradient(112deg,
    #ff5a00 0%, #ff8a1e 12.5%, #ffc06b 25%, #ff8a1e 37.5%,
    #ff5a00 50%, #ff8a1e 62.5%, #ffc06b 75%, #ff8a1e 87.5%, #ff5a00 100%);
  background-size: 200% 100%;
  mix-blend-mode: hard-light;
  opacity: 0.5;
  /* lento y sutil (dueño, 2026-10-18): antes 6 s / 3 s / 3.9 s */
  animation: wpRuneFlow calc(var(--fl-flow) * 2.5) linear infinite, foilLightEmber calc(var(--fl-pulse) * 2.6) ease-in-out infinite;
}
.foil-light-ember::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(102deg,
    rgba(255, 236, 200, 0) 16%, rgba(255, 240, 210, 0.4) 25%, rgba(255, 236, 200, 0) 34%,
    rgba(255, 236, 200, 0) 66%, rgba(255, 240, 210, 0.4) 75%, rgba(255, 236, 200, 0) 84%);
  background-size: 200% 100%;
  mix-blend-mode: screen;
  animation: wpRuneFlow calc(var(--fl-flow) * 1.5) linear infinite;
}
@keyframes foilLightEmber {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.62; }
}
/* .foil-light-gold-glow  un RESPLANDOR dorado suave sobre el oro (Diamond Hands): sin banda que
   corra ni destello, solo calor que respira. `hard-light` por lo mismo que el oro de arriba. */
.foil-light-gold-glow {
  background: radial-gradient(ellipse 90% 70% at 50% 80%, #ffe9a0 0%, #ffc23a 50%, #ff9a1c 100%);
  mix-blend-mode: hard-light;
  animation: foilLightGlow calc(var(--fl-pulse) * 1.2) ease-in-out infinite;
}
@keyframes foilLightGlow {
  0%, 100% { opacity: 0.16; }
  50%      { opacity: 0.44; }
}
/* .foil-light-diamond  el BRILLO de una pieza de diamante (los puños de Diamond Hands): hielo
   blanco-azulado que late, con una banda clara que lo cruza despacio. */
.foil-light-diamond {
  background-image: linear-gradient(112deg,
    #bfe9ff 0%, #ffffff 12.5%, #d9c9ff 25%, #ffffff 37.5%,
    #bfe9ff 50%, #ffffff 62.5%, #d9c9ff 75%, #ffffff 87.5%, #bfe9ff 100%);
  background-size: 200% 100%;
  animation: wpRuneFlow var(--fl-flow) linear infinite, foilLightDiamond var(--fl-pulse) ease-in-out infinite;
}
@keyframes foilLightDiamond {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 0.8; }
}
/* .foil-spark  un DESTELLO de cuatro puntas que titila (`foilSparks`): nace, gira un poco y se
   apaga, y pasa casi todo el ciclo apagado para que sean sutiles. Cada uno lleva su retardo. */
.foil-spark {
  position: absolute;
  width: var(--sp, 16px); height: var(--sp, 16px);
  margin: calc(var(--sp, 16px) / -2) 0 0 calc(var(--sp, 16px) / -2);
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 50% 7% at 50% 50%, #fff 0%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(ellipse 7% 50% at 50% 50%, #fff 0%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95) 0%, rgba(200, 235, 255, 0.5) 16%, rgba(200, 235, 255, 0) 34%);
  opacity: 0;
  transform: scale(0.2) rotate(0deg);
  animation: foilSpark 4.2s ease-in-out infinite;
}
@keyframes foilSpark {
  0%, 62%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  74%           { opacity: 1; transform: scale(1) rotate(22deg); }
  86%           { opacity: 0; transform: scale(0.35) rotate(45deg); }
}
@keyframes foilLightBlade {
  0%        { background-position: var(--fl-glint-from, 0%) 0; }
  13%, 100% { background-position: var(--fl-glint-to, 175%) 0; }
}
@keyframes foilLightGlint {
  0%        { background-position: var(--fl-glint-from, -30%) 0; }
  45%, 100% { background-position: var(--fl-glint-to, 75%) 0; }
}
@keyframes foilLightPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.95; }
}
@keyframes foilLightBreathe {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) {
  .foil-light, .foil-light-gold::after, .foil-light[class*="foil-light-flow-"]::after { animation: none; }
  .foil-light-green { opacity: 0.6; }
  .foil-light-buy { opacity: 0.35; }
  .foil-light-mist { opacity: 0.4; }
  .foil-light-glint { background-position: var(--fl-glint-from, 15%) 0; opacity: 0.3; }
  .foil-light-blade { background-position: 70% 0; opacity: 0.25; }
  .foil-light-lamp { opacity: 0.6; }
  .foil-light-cyan { opacity: 0.55; }
  .foil-light-blue { opacity: 0.6; }
  .foil-light-bridge { opacity: 0.6; }
  .foil-light-violet { opacity: 0.75; }
  .foil-light-violet-glow { opacity: 0.7; }
  .foil-light-aura { opacity: 0.75; }
  .foil-light-neon-lime { opacity: 0.75; }
  .foil-light-aura-green { opacity: 0.3; }
  .foil-light-cyan-rim { opacity: 0.35; }
  .foil-light-life-beam { opacity: 0.22; }
  .foil-light-screen { opacity: 0.22; }
  .foil-light-life-orb { opacity: 0.6; }
  .foil-light-red { opacity: 0.55; }
  .foil-light-red-rim { opacity: 0.5; }
  .foil-light-gold-glow { opacity: 0.3; }
  .foil-light-ember { opacity: 0.5; }
  .foil-light-ember::after { animation: none; opacity: 0; }
  .foil-light-fuse { opacity: 0.6; }
  .foil-light-sunlit { opacity: 0.16; }
  .foil-light-diamond { opacity: 0.5; }
  .foil-light-thread { opacity: 0.75; }
  .foil-light-ghost { opacity: 0.32; }
  .foil-spark { animation: none; opacity: 0; }
}

/* PROMO skin: the card's own art stamped as an iridescent HOLOGRAM in the effect panel,
   behind the description. Two masked layers share the SVG (which ships as one flat black
   path, so the colour is all ours):
     .promo-holo-ink    el cuerpo del holograma — el arcoíris del foil, que se desplaza
                        con la inclinación y cambia de matiz igual que `.foil-fx`
     .promo-holo-glare  la banda especular blanca que lo cruza al inclinar
   Pedido explícito: "se visualiza al inclinarse". Así que en PLANO la opacidad base es
   casi cero (0.07 — sólo un relieve fantasma que insinúa que hay algo) y sube a 1 con
   `--foil-m`, la magnitud de inclinación que escribe `applyFoilTilt`. */
.promo-holo {
  pointer-events: none;
  /* `--holo-rest` (skin `holoRest`): lo que se ve en plano; por defecto 0.07 */
  opacity: calc(var(--holo-rest, 0.07) + var(--foil-m, 0) * (1 - var(--holo-rest, 0.07)));
  /* LA MEZCLA VA AQUÍ, no en los hijos: este elemento es `position:absolute; z-index:2`,
     o sea un contexto de apilamiento, y un `mix-blend-mode` en sus hijos sólo se mezcla
     DENTRO del grupo — nunca llega a la carta. (Probadas hard-light/multiply/normal/
     overlay en los hijos: las cuatro salían idénticas, que es el síntoma.)
     `multiply` sobre el panel de efecto, que es claro: el holograma se comporta como
     tinta impresa en la cartulina, que es lo que hace un estampado foil de verdad. Y el
     destello blanco, que sí se mezcla dentro del grupo, lo BORRA a su paso (blanco
     multiplicado deja el fondo intacto) — de ahí que lea como un reflejo. */
  mix-blend-mode: multiply;
  /* Un grado de más: recto del todo parecía un sello de imprenta mal puesto. */
  transform: rotate(4deg);
  transition: opacity 0.12s linear;
}
.promo-holo-ink,
.promo-holo-glare {
  position: absolute; inset: 0;
  /* `auto 116%` y no `contain`: el dibujo ocupa el 84% del alto de su lienzo de 2400x2400
     (medido con getBBox), así que con `contain` se quedaba pequeño dentro de la caja. Al
     116% el dibujo llena el alto justo. No recorta nada: sólo mide el 68% de ancho, así
     que lo que se sale del lienzo por los lados es vacío. */
  -webkit-mask-size: auto 116%; mask-size: auto 116%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
/* El mismo arcoíris pastel que `.foil-fx`, con su mismo giro de matiz por inclinación:
   un promo ES un foil, así que las dos piezas tienen que virar juntas. */
.promo-holo-ink {
  background: var(--foil-iris);
  background-size: var(--foil-iris-size);
  /* MISMA deriva y MISMO giro de matiz que `.foil-fx`: así, al inclinar, el holograma y
     el foil que tiene detrás enseñan el mismo color. Antes esta capa movía además el
     `background-position` con la inclinación y llevaba `saturate(1.6)` + 100deg de giro:
     eso la desincronizaba del foil y, sobre todo, SATURABA hasta recortar los canales —
     de ahí los cortes duros de color entre franjas. Con la saturación del foil (1.3) la
     interpolación vuelve a verse continua. */
  animation: foilDrift 7s linear infinite;
  filter: saturate(1.3) var(--foil-iris-hue);
}
/* La banda especular: cruza el dibujo siguiendo el eje X de la inclinación. `screen`
   sobre la tinta para que sólo aclare donde ya hay holograma. */
.promo-holo-glare {
  background: linear-gradient(105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.85) 48%,
    rgba(255, 255, 255, 0.25) 55%,
    transparent 64%);
  background-size: 260% 100%;
  background-position: calc(50% - var(--foil-x, 0) * 70%) 50%;
  mix-blend-mode: screen;
  opacity: calc(0.25 + var(--foil-m, 0) * 0.75);
  transition: background-position 0.08s linear, opacity 0.12s linear;
}
@media (prefers-reduced-motion: reduce) {
  .promo-holo-ink, .promo-holo-glare { transition: none; animation: none; }
}
/* FOIL COPY: el mismo holograma con la ETIQUETA FOIL de mascara (FoilLabelHolo). Mas SUTIL que
   el de la skin: casi nada en plano y como mucho un 55 % al inclinar. `contain` porque el PNG
   de la etiqueta llena su lienzo (el 116 % es para el SVG de la promo, que tiene aire). */
.promo-holo.foil-label-holo {
  opacity: calc(0.06 + var(--foil-m, 0) * 0.49);
  /* Recta: el giro de 4deg es del sello de la promo; en la etiqueta FOIL se veia torcida. */
  transform: none;
}
.foil-label-holo .promo-holo-ink,
.foil-label-holo .promo-holo-glare { -webkit-mask-size: contain; mask-size: contain; }
/* FIRST EDITION: el logo de la primera edicion (FirstEditionHolo, UI/first_edition_mono.svg).
   En una copia FOIL ocupa el sitio de la etiqueta FOIL con la misma tinta iridiscente, un
   punto mas presente porque es lo que distingue la tirada. En una copia NORMAL (`is-plain`)
   va SIN color: tinta gris azulada, y visible tambien en plano, porque una carta normal no se
   inclina y a 0.06 no se veria nunca. */
.promo-holo.first-holo {
  opacity: calc(0.14 + var(--foil-m, 0) * 0.6);
  transform: none;
}
.first-holo .promo-holo-ink,
.first-holo .promo-holo-glare { -webkit-mask-size: contain; mask-size: contain; }
/* En pequeño junto al nombre (cartas con holograma propio): por encima de la cinta y mas
   presente, que a ese tamaño el sello tenue no se lee. */
.promo-holo.first-holo.is-side { z-index: 4 !important; opacity: calc(0.45 + var(--foil-m, 0) * 0.5); }
.promo-holo.first-holo.is-plain { opacity: calc(0.3 + var(--foil-m, 0) * 0.2); }
/* MINIATURA (rejillas): sin animacion y mas presente. */
.promo-holo.first-holo.is-still { opacity: 0.5; }
.promo-holo.first-holo.is-still.is-plain { opacity: 0.42; }
.promo-holo.first-holo.is-still.is-side { opacity: 0.7; }
.first-holo.is-still .promo-holo-ink { animation: none; }
.first-holo.is-plain .promo-holo-ink {
  background: linear-gradient(135deg, #56677c, #8695a8 50%, #56677c);
  animation: none; filter: none;
}

/* El filtro de EDICION (All / Normal / First Edition) de coleccion, mazos y market. */
.edition-filter {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: 999px; background: rgba(0, 0, 0, 0.28);
}
.edition-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 0; border-radius: 999px;
  background: transparent; color: rgba(255, 255, 255, 0.72);
  font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.edition-filter-btn img { width: 18px; height: 18px; display: block; }
@media (hover: hover) and (pointer: fine) { .edition-filter-btn:hover { color: #fff; } }
.edition-filter-btn.on { background: rgba(255, 255, 255, 0.16); color: #fff; }
.edition-filter-btn.is-first.on { background: #2f5b8c; }
@media (max-width: 560px) {
  .edition-filter-btn { padding: 6px 9px; font-size: 12px; }
}
/* Buscador + filtro de edicion en la misma fila (selector del market, editor de mazos). */
.mkt-picker-head, .db-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mkt-picker-head .mkt-picker-search { flex: 1 1 180px; }
.db-filter-row > :first-child { flex: 1 1 260px; min-width: 0; }
.db-filter-row .edition-filter { margin-right: 16px; }
/* TIENDA: el stock que queda bajo el nombre del sobre, y la chapa sobre el pedestal. */
/* La pildora lleva el trato del resto de chapas de la app (el de `.wallet-chip`): contorno de
   tinta, las dos bandas planas de relieve y la cifra en la fuente de rotulo. El margen de abajo
   la despega del boton VIEW COLLECTION, que el `gap` de `.store-stage` dejaba pegado. */
.store-stock {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 6px 0 clamp(6px, 1.1vh, 12px);
  padding: 6px 16px; border-radius: 999px;
  background: #17233b; color: #fff;
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3);
  font-family: var(--font-display); font-weight: 400; font-variant-numeric: tabular-nums;
  font-size: 15px; line-height: 1.15; letter-spacing: 0.03em; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}
.store-stock img { width: 22px; height: 22px; display: block; }
.store-stock.is-first { background: #24476e; }
.store-stock.is-out { background: #7a1f24; letter-spacing: 0.08em; }
.store-soldout-note { margin: 8px 0 0; text-align: center; font-size: 13px; opacity: 0.85; }
/* FIRST EDITION en la tienda: logo grande en ORO de una sola tinta (UI/first_edition_gold.svg:
   el mismo trazado que el de color, con sus cinco tonos pasados a la escala del oro del
   juego), el rotulo debajo y las unidades que quedan. */
.store-first { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.2vh, 12px); margin: 8px 0 clamp(6px, 1.1vh, 12px); }
.store-first-mark { display: flex; align-items: center; justify-content: center; gap: 10px; }
.store-first-label {
  font-size: 17px; font-weight: 900; letter-spacing: 0.14em; line-height: 1;
  color: var(--gold-bright, #ffd45e); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}
.store-first .store-stock { margin: 0; }
@media (max-width: 560px) {
  .store-first-label { font-size: 15px; }
}
/* El selector de EDICION de la tienda (First Edition / Normal): el desplegable del market,
   a todo el ancho del panel de compra, encima de la cantidad. */
.store-edition { width: 100%; }
.store-edition .mkt-dd { display: block; width: 100%; }
.store-edition .mkt-dd-head { width: 100%; }
.store-edition .cosm-filter-caret { margin-left: auto; }
.store-edition .mkt-dd-menu { left: 0; right: 0; }
.store-edition.is-busy { pointer-events: none; opacity: 0.6; }
.qty-opt:disabled { opacity: 0.4; cursor: not-allowed; }
/* "1st Edition" en el nombre de un sobre first edition del inventario, en el oro del juego. */
.first-gold { color: var(--gold); white-space: nowrap; }

/* SKIN PROMO · EL PERSONAJE CAMBIA AL INCLINAR. Dos imágenes superpuestas en el mismo
   encuadre y con las opacidades complementarias: un fundido cruzado que manda el eje
   HORIZONTAL de la inclinación, que es lo pedido ("hacia los laterales") — de ahí que lea
   `--foil-x` y no `--foil-m`, que también sube al inclinar arriba y abajo.
   El valor absoluto de --foil-x (que va de -1 a 1) se saca con `max(x, -x)`: `abs()` en CSS
   es demasiado nuevo para darlo por hecho, y `max()` está en todas partes.
   El 0.18 es una zona muerta —un temblor del ratón no debe fantasmear el dibujo— y el 2.1,
   la ganancia: a partir de ahí el cambio se completa sobre |x| ≈ 0.66, antes del extremo,
   para que el esqueleto se vea entero un rato y no sólo en el último grado.
   No hacen falta topes: `opacity` recorta sola lo que se salga de 0..1. */
/* `--skel-t` es la orden de "ensena el esqueleto", de 0 a 1. Sale de la inclinacion, y
   `--promo-skel` la fuerza a 1 desde JS mientras la carta encaja un golpe en el duelo
   (ver PROMO_SKEL_HIT_MS en game.js). Sin topes: `opacity` recorta sola fuera de 0..1, y
   por eso las dos capas se combinan con `max`/`min` en vez de sumar. */
.promo-art-alt, .promo-art-fade {
  --skel-t: calc((max(var(--foil-x, 0), -1 * var(--foil-x, 0)) - 0.18) * 2.1);
}
.promo-art-alt  { opacity: max(var(--skel-t), var(--promo-skel, 0)); }
/* El original DENTRO de la zona enmascarada (cara y manos): se apaga a la vez que el
   esqueleto se enciende. Complementaria. */
.promo-art-fade { opacity: min(calc(1 - var(--skel-t)), calc(1 - var(--promo-skel, 0))); }
/* `.promo-art-base` es la variante SIN máscara: ahí se apaga el dibujo entero. Con
   máscara ese papel lo hace `.promo-art-fade`, y el cuerpo (`.promo-art-cut`) se queda
   quieto y opaco — si se desvaneciera, a media inclinación el personaje entero se
   volvería translúcido y se vería el fondo a través de él. */
.promo-art-base { opacity: calc(1 - (max(var(--foil-x, 0), -1 * var(--foil-x, 0)) - 0.18) * 2.1); }
.promo-art-alt, .promo-art-base, .promo-art-fade { transition: opacity .12s linear; }
@media (prefers-reduced-motion: reduce) {
  .promo-art-alt, .promo-art-base, .promo-art-fade { transition: none; }
}

/* Zoom inspector: the card tilts toward the pointer (transform set imperatively by
   applyFoilTilt) so a foil's iridescent sheen shifts as you angle it. Smooth the lean
   and ease back when the pointer leaves; the cursor hints it's interactive.
   Scoped to ANY card, not just foils: the shop's drop-rate modal passes `anyCard`, so a
   plain card leans too and would otherwise snap instead of easing. */
.card-modal .card {
  transition: transform 0.12s ease-out;
  /* will-change is toggled ON only WHILE tilting (applyFoilTilt) and cleared on leave
     (clearFoilTilt). Keeping it permanently promotes the card to a composited layer that
     Chromium renders slightly SOFT while it sits still frontal — the "blurry when flat,
     sharp when I move it" bug. Off when flat → painted directly → crisp. */
}
.card-modal .card.preview, .card-modal .card.foil-card { cursor: grab; }

/* ---- STATES ---- */
.card.unaffordable {
  filter: grayscale(0.35) brightness(0.85);
  cursor: not-allowed;
}
.card.unaffordable .energy-badge {
  animation: gemDenied 1.6s ease-in-out infinite;
}
@keyframes gemDenied {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 77, 77, 0.55)); }
  50%      { filter: drop-shadow(0 0 11px rgba(255, 77, 77, 1)); }
}
@media (hover: hover) and (pointer: fine) { .card.unaffordable.in-hand:hover { filter: grayscale(0.15) brightness(0.92); } }

/* ---- DRAW ANIMATION: card flies from the deck zone into the hand ---- */
/* Direction depends on side: player draws from their deck (right side,
   above the hand) and AI draws from their deck (right side, below their
   hand). We invert the Y component for AI. The animation uses cubic-bezier
   for a spring-like settle (overshoot then back) per the motion guidelines. */
.card.drawing-in,
.card-back.drawing-in {
  animation: cardDrawIn 700ms cubic-bezier(0.34, 1.3, 0.55, 1) both;
  z-index: 40;
  pointer-events: none;
}
.card.drawing-in.draw-from-player,
.card-back.drawing-in.draw-from-player {
  animation-name: cardDrawInPlayer;
}
.card.drawing-in.draw-from-ai,
.card-back.drawing-in.draw-from-ai {
  animation-name: cardDrawInAi;
}
@keyframes cardDrawInPlayer {
  0%   { transform: translate(40vw, -32vh) rotate(-22deg) scale(0.5); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}
@keyframes cardDrawInAi {
  0%   { transform: translate(40vw, 32vh) rotate(22deg) scale(0.5); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
}
/* Mobile: the big deck→hand fly-in lands outside the scrollable hand-row and
   gets clipped, so the card instead rises up into the hand from below. */
@keyframes cardDrawInMobile {
  0%   { transform: translateY(115%) scale(0.55) rotate(-7deg); opacity: 0; }
  45%  { opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

/* ---- Field card fills its slot exactly (slot is the sizing authority) ---- */
/* A card in play is drawn slightly LARGER than its cell: the slot keeps the grid (and its
   dashed outline sits under the card anyway), while the artwork reads bigger. Done with
   `inset`, not `transform` — the lunge/recoil animations own the card's transform. */
.slot .card {
  position: absolute;
  inset: calc(-1 * var(--card-bleed, 3.5%));
  height: auto;
  width: auto;
  cursor: pointer;
}
/* Field cards have more room than hand cards, so scale the stats up
   proportionally (the art image already fills its container automatically). */
.slot .card .stat-badge      { width: clamp(34px, 4vw, 46px); height: clamp(34px, 4vw, 46px); }
.slot .card .stat-badge-num  { font-size: clamp(15px, 1.8vw, 20px); }
.slot .card .energy-gem { width: clamp(34px, 3.6vw, 44px); }
.slot .card .energy-gem-num { font-size: clamp(16px, 1.8vw, 21px); }
/* Cards on the field show only their art + stats — no name (and so no top scrim). */
.slot .card .card-name,
.spell-slot .card .card-name { display: none; }
.slot .card .card-top,
.spell-slot .card .card-top { display: none; }
.slot .card .card-scrim-top,
.spell-slot .card .card-scrim-top { display: none; }
.slot .card.dead {
  opacity: 0.3;
  filter: grayscale(0.8);
}

/* Life bar (shown UNDER small hero cards) with the remaining HP centred on it. */
.hp-bar {
  position: relative;
  height: 15px;
  background: rgba(0,0,0,0.72);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.hp-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-yellow));
  transition: width .35s ease;
}
.hp-bar.low .fill { background: linear-gradient(90deg, var(--neon-yellow), var(--neon-red)); }
.hp-bar.critical .fill { background: var(--neon-red); animation: pulseHp 1s infinite; }
@keyframes pulseHp { 50% { opacity: 0.5; } }
.hp-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.95), 0 0 3px rgba(0,0,0,0.85);
  pointer-events: none;
}

/* Hang the bar just below the card (out of flow) so the card box is unchanged. */
.card > .hp-bar {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 86%;
  z-index: 6;
}

/* STUN — el efecto en bucle del laboratorio (FX.stun) sobre el héroe PARALIZADO.
   Sustituye al antiguo badge de texto: la propia animación dice STUN. Se coloca
   sobre la CABEZA de la carta (tercio superior), no centrado en ella, y el JS mide
   esta caja para dimensionar la órbita — de ahí que tenga alto propio. */
.stun-fx {
  position: absolute; left: 0; right: 0; top: 4%; height: 46%;
  z-index: 5; pointer-events: none;
}

/* ============== KEYWORD GLOSSARY (hover panel beside a card) ============== */
/* Sólo PANEL: la pastilla en reposo se quitó — la palabra clave ya sale en negrita en el texto de la
   carta, y la etiqueta permanente competía con él y se leía como parte de la ilustración. */
/* Lives INSIDE the card template (.fullart-board), so every length here is in BOARD px
   and the board's own transform:scale() shrinks it with the card. The anchor spans the
   card's width → `left: 100%` is exactly the card's right edge. */
.kw-anchor { position: absolute; height: 0; z-index: 6; pointer-events: none; }
.kw-panel {
  position: absolute;
  /* DETACHED from the card, not clipped to it. The painted frame stops ~50 board px
     short of the board's edge (the template PNG's transparent margin), so `left: 100%`
     alone would already leave a gap — this adds the air that makes it read as a label
     standing BESIDE the card rather than one stuck to its border. */
  left: 100%; margin-left: 10px;
  transition: opacity .16s ease, transform .22s cubic-bezier(.22, 1, .36, 1);
}
.kw-panel {
  width: 540px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 26px 32px 28px;
  border-radius: 26px;
  background: linear-gradient(180deg, #1b2439 0%, #0c1220 100%);
  border: 4px solid var(--gold);
  box-shadow: 0 18px 40px rgba(0,0,0,0.62), 0 0 0 2px rgba(0,0,0,0.4);
  opacity: 0; transform: translateX(-26px) scale(0.94); transform-origin: left center;
}
.kw-panel-title {
  font-family: 'Lilita One', 'Space Grotesk', sans-serif; font-weight: 400;
  font-size: 44px; letter-spacing: 1px; color: var(--gold-bright);
  text-shadow: 0 3px 0 rgba(0,0,0,0.45);
}
.kw-panel-desc {
  font-family: 'Nunito', 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 30px; line-height: 1.34; color: #d7dfef;
}
/* one rule per paragraph (a blank line in the keyword text), with air between them */
.kw-panel-p { display: block; }
.kw-panel-p + .kw-panel-p { margin-top: 0.55em; }
/* Open on hover — and ALWAYS open in the duel's hover peek, which is pointer-events:none
   (it only exists BECAUSE the card is being hovered, so :hover can never fire there). */
.card-preview-overlay .kw-panel { opacity: 1; transform: translateX(0) scale(1); }
@media (hover: hover) and (pointer: fine) { .card:hover .kw-panel { opacity: 1; transform: translateX(0) scale(1); } }

/* The right-hand peek already sits against the screen edge, so there it opens INWARDS
   (mirrored) instead of off-screen. */
.card-preview-overlay.right .kw-panel {
  left: auto; right: 100%; margin-left: 0; margin-right: 10px;
  transform-origin: right center;
}
/* Several panels (a skill + counter tips) STACK in a column beside the card, each as tall as its
   own text: the column carries the side offset, the panels sit in flow inside it. */
.kw-stack {
  position: absolute; top: 0; left: 100%; margin-left: 10px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
}
.kw-stack .kw-panel,
.card-preview-overlay.right .kw-stack .kw-panel { position: relative; left: auto; right: auto; margin: 0; }
.card-preview-overlay.right .kw-stack { left: auto; right: 100%; margin-left: 0; margin-right: 10px; align-items: flex-end; }

/* ---- BUFF / DEBUFF panel (2026-10-27): the hero's stat changes and where each came from. On the
   card's LEFT (`.buff-stack`); in the duel's hover peek (against a screen edge) the copy inside the
   keyword column shows instead. Hover opens it like the keyword panels; the click zoom keeps it open. */
.buff-stack {
  position: absolute; top: 0; right: 100%; margin-right: 10px;
  display: flex; flex-direction: column; align-items: flex-end;
}
.buff-stack .kw-panel { position: relative; left: auto; margin: 0; transform: translateX(26px) scale(0.94); transform-origin: right center; }
.card-modal .buff-stack .kw-panel { opacity: 1; transform: translateX(0) scale(1); }
@media (hover: hover) and (pointer: fine) { .card:hover .buff-stack .kw-panel { opacity: 1; transform: translateX(0) scale(1); } }
.buff-in-kw { display: none !important; }
.card-preview-overlay .buff-stack { display: none; }
.card-preview-overlay .buff-in-kw { display: flex !important; }
/* IN A ZOOM the panels are NOT inside the card (it tilts, they never do): ZoomKwLayer paints them in a
   flat copy of the card's box + board laid over it (see KeywordTag). `is-hover` = the card is hovered. */
.kw-zoom { position: absolute; z-index: 6; pointer-events: none; }
.kw-zoom-board { position: absolute; left: 50%; top: 50%; transform-origin: center center; }
.kw-zoom.is-hover .kw-panel { opacity: 1; transform: translateX(0) scale(1); }
/* TOUCH (owner 2026-11-06): a finger has no hover to open them, so in every card zoom the keyword /
   counter panels are simply open (the duel's long-press peek already showed them that way). */
@media (hover: none) {
  .card-modal .kw-panel { opacity: 1; transform: translateX(0) scale(1); }
}
/* Portrait phone: the zoomed card takes ~90 % of the width, there is no room beside it. The column
   goes ABOVE the card (owner 2026-11-06), as wide as it (lengths in the anchor's hero-board px: the
   card's top is KW_TAG_TOP 296 px above the anchor, so `bottom: 296 + 24` leaves 24 px of air), and a
   card that carries panels is shown smaller and LOWER, at the foot of the zoom, so they fit over it. */
@media (hover: none) and (max-width: 560px) {
  .card-modal .kw-stack { left: 0; right: 0; top: auto; bottom: 320px; margin-left: 0; align-items: stretch; gap: 18px; }
  .card-modal .kw-stack .kw-panel { width: auto; padding: 22px 30px 24px; transform-origin: center bottom; }
  .card-modal .kw-panel-desc { font-size: 36px; }
  .card-modal:has(.kw-stack > .kw-panel:not(.buff-in-kw)) { align-items: flex-end; padding-bottom: 13vh; }
  .card-modal:has(.kw-stack > .kw-panel:not(.buff-in-kw)) .card.preview { width: min(480px, 78vw, 36vh); }
}
.buff-panel .kw-panel-desc { display: flex; flex-direction: column; gap: 12px; }
.buff-row { display: flex; flex-direction: column; gap: 2px; }
.buff-nums { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.buff-num { font-family: 'Lilita One', 'Space Grotesk', sans-serif; font-weight: 400; font-size: 34px; letter-spacing: 0.5px; }
.buff-num.up { color: #4ade80; }
.buff-num.down { color: #f87171; }
.buff-note { font-style: normal; font-size: 24px; color: #9fb0cf; }
.buff-src { font-size: 28px; color: #d7dfef; }

/* A keyword NAMED in the printed effect line ("it gains no-KYC"). The panel beside the
   card explains it; here it just has to read as a TERM and not as prose, so it's the same
   ink one weight heavier (the effect text itself is already 600). */
.tpl-kw { font-weight: 900; }

/* ============== BTC COUNTERS (Bitcoin Whale) ============== */
/* Both of these live INSIDE the card template (.fullart-board), so every length is
   in BOARD px — the board's own transform:scale() shrinks them with the card and
   they stay pinned to their template landmarks at any card size. */

/* The stack readout, a full-width centred strip just above the name banner. Hidden
   at rest; revealed on hover (to check it whenever) and, briefly, whenever a
   counter is gained (`.showing`, driven by the coin-drop sequence in BtcCounter).
   The one hover NOT gated behind `(hover: hover)` (2026-11-06): on a finger the tap that
   selects the card leaves it hovered, and showing its BTC then is a feature. */
.btc-counter {
  /* El tamano de la moneda va aqui y NO en cada regla: lo usan el icono en reposo y la
     moneda que CAE, y si dejan de medir lo mismo el aterrizaje se nota — la que cae se
     fundiria en un icono de otro tamano. */
  --btc-icon: 1.62em;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;   /* purely a readout — never eats a card tap/drag */
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease;
}
.slot:hover .btc-counter,
.spell-slot:hover .btc-counter,   /* Proof of Work's BTC, on a spell in its slot */
.btc-counter.showing,
/* La carta ampliada del hover NO cuelga de un `.slot`, así que su contador nunca se
   revelaría por el `:hover` de arriba: aquí se muestra siempre. Es una lectura, y si el
   jugador se ha parado a ampliar la carta es justo lo que quiere ver. */
.card-preview-overlay .btc-counter {
  opacity: 1;
  visibility: visible;
}
/* SIN CHAPA, como el contador de FORK y por el mismo motivo: enmarcar el dibujo de una
   moneda dentro de una pastilla con borde lo hacia leer como una pegatina pegada encima de
   la carta. La legibilidad la da un HALO oscuro sin borde visible, y va en el `filter` del
   CHIP —no en cada hijo— para que cubra a la vez la moneda y la cifra. */
.btc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.14em;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 0.06em 0.14em rgba(0, 0, 0, 0.9)) drop-shadow(0 0 0.5em rgba(0, 0, 0, 0.75));
}
/* The chip's coin slot doubles as the falling coin's positioning context, so the
   coin lands exactly on the icon no matter how wide the number makes the chip. */
.btc-chip-slot {
  position: relative;
  display: inline-flex;
  line-height: 0;
}
.btc-chip-icon {
  width: var(--btc-icon);
  height: auto;
  display: block;
  /* la sombra propia se va: ahora la pone el halo del chip, que cubre tambien la cifra */
}
/* Format is fixed by design: <coin icon> x<n>, the number with a soft shadow. */
.btc-count {
  display: inline-block;
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: 1.05em;
  line-height: 1;
  color: #ffd479;
  letter-spacing: 0.03em;
  /* la sombra propia SE QUEDA ademas del halo del chip: sin la chapa detras, la cifra clara
     necesita su propio contorno para leerse sobre un arte claro */
  text-shadow: 0 0.07em 0.1em rgba(0, 0, 0, 0.95), 0 0 0.22em rgba(0, 0, 0, 0.8);
  /* Re-keyed on every landing (React key = flash) → the pop replays on impact. */
  animation: btcCountPop 420ms var(--ease-out, cubic-bezier(0.2, 0.8, 0.3, 1));
}
@keyframes btcCountPop {
  0%   { transform: scale(1);    color: #ffd479; }
  30%  { transform: scale(1.5);  color: #fff6dc; }
  100% { transform: scale(1);    color: #ffd479; }
}
/* The coin that falls from above the CARD straight into the chip's icon. It starts
   ~9.6em up — which, at the counter's board font size, clears the card's top edge —
   and lands on `top:0`, i.e. exactly over the icon it's a child of. Nothing up the
   tree clips (.card / .fullart-fit / .fullart-board are all overflow:visible), so
   the start is really off-card. NOTE: this offset is in `em`, so it tracks the
   counter's size — re-check it if the counter's `size` changes.
   `--btc-drop` must match BTC_COIN_FALL_MS in game.js. */
.btc-coin-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--btc-icon);
  height: auto;
  filter: drop-shadow(0 0.1em 0.16em rgba(0, 0, 0, 0.65));
  animation: btcCoinDrop var(--btc-drop, 420ms) cubic-bezier(0.5, 0, 0.85, 0.55) both;
}
@keyframes btcCoinDrop {
  0%   { transform: translateY(-9.6em) scale(1.25); opacity: 0; }
  16%  { opacity: 1; }
  88%  { transform: translateY(0) scale(1); opacity: 1; }
  /* a hair of squash on impact, then it merges into the chip's icon */
  100% { transform: translateY(0) scale(1.1, 0.86); opacity: 1; }
}

/* ---- Forkhydra's FORK stack: reuses .btc-counter/.btc-chip/.btc-count wholesale
   (position, hover reveal, number pop) and only overrides the skin, so the two
   counters can never drift apart in layout. Two deliberate differences from BTC:
     · SIN CHAPA: no pill, no border. The icon is an illustrated head, and framing a
       drawing inside a bordered badge makes it read as a sticker pasted on the card.
       Legibility comes from a soft dark halo behind it, which has no visible edge.
     · MÁS GRANDE: an illustration needs more pixels than a flat glyph to read.
   --fork-split must match FORK_SPLIT_MS in game.js. ---- */
.fork-chip {
  background: none;
  border: 0;
  padding: 0;
  gap: 0.1em;
  /* halo, no border: readable over any art without drawing a box */
  filter: drop-shadow(0 0.06em 0.14em rgba(0, 0, 0, 0.85)) drop-shadow(0 0 0.5em rgba(0, 0, 0, 0.7));
  box-shadow: none;
}
.fork-chip-icon {
  width: 1.95em; height: 1.95em; display: block;
  object-fit: contain;
}
.fork-count { color: #eafff9; }
/* The ghost head that peels off the glyph when a FORK is gained: same icon, cloned
   on top of the chip's own, splitting away and fading. */
.fork-split {
  position: absolute; left: 0; top: 0; line-height: 0;
  animation: forkSplit var(--fork-split, 460ms) cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.fork-split .fork-chip-icon { filter: brightness(1.6) saturate(.4); }
@keyframes forkSplit {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 0.95; }
  60%  { opacity: 0.7; }
  100% { transform: translate(0.9em, -0.7em) rotate(26deg) scale(1.35); opacity: 0; }
}
/* The number pop is .btc-count's, but recoloured to the teal palette. */
.fork-count { animation-name: forkCountPop; }
@keyframes forkCountPop {
  0%   { transform: scale(1);    color: #eafff9; }
  30%  { transform: scale(1.5);  color: #ffffff; }
  100% { transform: scale(1);    color: #eafff9; }
}

/* ---- Wenlord's WEN stack: third skin over .btc-counter/.btc-chip/.btc-count, so the
   three counters can never drift apart in layout. Its own two notes:
     · NO HAY ICONO. La ficha ES la palabra: "WEN" en la tipografia del juego, con el
       mismo halo oscuro sin chapa que usan los otros dos (encuadrar texto en una pastilla
       lo volvia una etiqueta pegada encima del dibujo).
     · El gesto de ganancia es un SELLO: la palabra entra grande y girada y se asienta.
   --wen-stamp must match WEN_STAMP_MS in game.js. ---- */
.wen-chip {
  background: none;
  border: 0;
  padding: 0;
  gap: 0.16em;
  filter: drop-shadow(0 0.06em 0.14em rgba(0, 0, 0, 0.9)) drop-shadow(0 0 0.5em rgba(0, 0, 0, 0.75));
  box-shadow: none;
}
/* La palabra, a la altura de la moneda del contador de BTC (--btc-icon) para que los tres
   contadores ocupen la misma banda. El rosa es el `accent` de Wenlord. */
.wen-word {
  display: inline-block;
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: 1.12em;
  line-height: 1;
  letter-spacing: 0.06em;
  color: #ffb3e6;
  text-shadow: 0 0.07em 0.1em rgba(0, 0, 0, 0.95), 0 0 0.22em rgba(0, 0, 0, 0.8);
}
.wen-count { color: #ffe3f7; }
/* El sello: una copia de la palabra encima de la propia, que cae girada y se desvanece. */
.wen-stamp {
  position: absolute; left: 0; top: 0;
  display: inline-block;
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: 1.12em;
  line-height: 1;
  letter-spacing: 0.06em;
  color: #ffffff;
  animation: wenStamp var(--wen-stamp, 420ms) cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes wenStamp {
  0%   { transform: rotate(-14deg) scale(2.1); opacity: 0; }
  35%  { transform: rotate(-5deg)  scale(1.25); opacity: 0.95; }
  100% { transform: rotate(0deg)   scale(1);   opacity: 0; }
}
/* Ethereum Whale: el mismo sello, pero con el diamante de Ethereum en vez de la palabra. El
   icono es alto y estrecho: se mide por la ALTURA (la de la moneda de BTC) para no crecer. */
.eth-counter .btc-chip-icon { width: auto; height: var(--btc-icon); }
.eth-counter .wen-count { color: #e6ebff; }
/* SHA-256 Sentinel: la palabra HASH en el verde de sus luces. */
.hash-counter .wen-word { color: #7dff8a; }
.hash-counter .wen-count { color: #e3ffe6; }
/* Yield Farming: the word YIELD in the card's lime accent. */
.yield-counter .wen-word { color: #bef264; }
.yield-counter .wen-count { color: #f2ffd9; }
/* El pop de la cifra es el de .btc-count, recoloreado al rosa de la carta. */
.wen-count { animation-name: wenCountPop; }
@keyframes wenCountPop {
  0%   { transform: scale(1);    color: #ffe3f7; }
  30%  { transform: scale(1.5);  color: #ffffff; }
  100% { transform: scale(1);    color: #ffe3f7; }
}

/* The activated ability's affordance ("tap here"), centred ON the class label in
   the clear gap between the ATK swords and the DEF shield. Only mounted while the
   ability can fire. Subtle pulsing BLUE halo so it reads as "actionable". */
.ability-activate {
  position: absolute;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  line-height: 0;
  cursor: pointer;
  z-index: 7;
  pointer-events: auto;
  animation: abilityReadyPulse 1.6s ease-in-out infinite;
}
.ability-activate img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
/* Armed (waiting for you to pick the enemy hero): hold it lit, no pulse. */
.ability-activate.armed {
  animation: none;
  transform: scale(1.08);
  filter: drop-shadow(0 0 12px rgba(140, 200, 255, 1)) drop-shadow(0 0 26px rgba(56, 130, 246, 0.95))
          drop-shadow(0 0 46px rgba(40, 110, 240, 0.7));
}
/* The icon breathes WITH its halo. The sprite is anchored low enough (see the `cy`
   nudge in HeroTemplateCard) that the scale peak still clears the HP bar above. */
@keyframes abilityReadyPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(130, 195, 255, 0.7))  drop-shadow(0 0 15px rgba(56, 130, 246, 0.5))
            drop-shadow(0 0 28px rgba(40, 110, 240, 0.3));
  }
  50% {
    transform: scale(1.07);
    filter: drop-shadow(0 0 13px rgba(165, 220, 255, 1))   drop-shadow(0 0 30px rgba(56, 130, 246, 0.9))
            drop-shadow(0 0 52px rgba(40, 110, 240, 0.6));
  }
}
/* On a SPELL in its slot (Hard Fork's ACTIVE): centred at the foot of the card, hanging
   a little below it like the hero one does. Width-based so it scales with the slot. */
.spell-slot .ability-activate.spell-ability {
  left: 31%;
  width: 38%;
  aspect-ratio: 1;
  bottom: -12%;
  z-index: 8;
}
/* Two ACTIVEs on one spell (Proof of Work at 10 BTC: summon the whale / move its BTC): the pair
   side by side under the card, the summon on the left. */
.spell-slot .ability-activate.spell-ability.pair-left  { left: 9%;  width: 36%; }
.spell-slot .ability-activate.spell-ability.pair-right { left: 55%; width: 36%; }
@media (prefers-reduced-motion: reduce) {
  .ability-activate { animation: none; }
  .btc-count { animation: none; }
  .btc-coin-drop { animation-duration: 1ms; }
  .fork-count { animation: none; }
  .fork-split { animation-duration: 1ms; }
  .wen-count { animation: none; }
  .wen-stamp { animation-duration: 1ms; }
}

/* ---- Targeting an activated ability: dim the board, light up the targets ----
   No arrow: you click the enemy hero you want. Everything goes behind a veil
   except the enemy row, which is lifted above it — so the pickable heroes are the
   only lit things on screen. The veil is inert (pointer-events:none) so the click
   still lands on the slot underneath it. */
.ability-dim,
.ability-dim-outer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(4, 6, 14, 0.58);
  animation: abilityDimIn .18s ease both;
}
/* Inner veil: dims the stage's own contents (rows, hands, divider). */
.ability-dim { z-index: 30; }
/* Outer veil: dims everything that paints ABOVE the stage — scenery, rails
   (z 25), action bar (z 35), HUD corners (z 40). Measured, not guessed. */
.ability-dim-outer { z-index: 60; }
/* …and the stage rides above the outer veil, so its own inner veil decides what's
   lit in there. The action bar comes along so CANCEL stays readable. */
.battlefield.ability-targeting .duel-stage  { z-index: 70; }
.battlefield.ability-targeting .duel-action { z-index: 75; }
@keyframes abilityDimIn { from { background: rgba(4, 6, 14, 0); } }
/* `.duel-row` sets container-type: inline-size, which implies layout containment
   and therefore makes each row its own stacking context — so the row has to be
   raised as a whole; a z-index on the slot alone could never clear the veil. */
.duel-row.ability-lit { z-index: 40; }
/* Inside the lit row, only living heroes are targets: everything else (empty
   slots, the spell slots) stays dark so the eye goes to the cards. */
.duel-row.ability-lit > .spell-slot:not(.ability-armed),
.duel-row.ability-lit > .slot.empty { filter: brightness(0.42); }
.duel-row.ability-lit > .slot.target-attack { animation: abilityTargetPulse 1.15s ease-in-out infinite; }
/* Plankton Peasant aims at its OWN row: the other heroes go dark like the empty cells, and a
   Proof of Work it can feed stays lit and pulses like a target hero. */
.duel-row-player.ability-lit > .slot:not(.target-attack):not(.ability-armed) { filter: brightness(0.42); }
.duel-row.ability-lit > .spell-slot.target-attack { filter: none; cursor: pointer; animation: abilityTargetPulse 1.15s ease-in-out infinite; }
@keyframes abilityTargetPulse {
  0%, 100% { box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.18), 0 0 18px rgba(239, 68, 68, 0.3); }
  50%      { box-shadow: inset 0 0 34px rgba(239, 68, 68, 0.3),  0 0 30px rgba(239, 68, 68, 0.65); }
}
@media (prefers-reduced-motion: reduce) {
  .ability-dim { animation: none; }
  .duel-row.ability-lit > .slot.target-attack { animation: none; }
}

/* ============== ANIMATIONS ============== */
/* Hero attack lunge — one chained @keyframes on the .card (TRANSFORM only):
   1) ELEVACIÓN  — the card lifts off the field staying flat: translateY up +
      scale 1.08. ease-out.
   2) EMBESTIDA   — it charges fast into the measured centre of the target
      (translate --atk-dx/--atk-dy, fed by the attackFx effect), scale easing back
      to 1, while it pitches forward on X (rotateX --atk-tilt — top edge dips like a
      spear tip; the parent .slot carries `perspective` so this reads as real 3D). ease-in.
   3) IMPACTO     — a small overshoot past the centre + slight squash sells the hit,
      then it returns to its slot.
   Measured per attack so it lands on whichever enemy was struck.
   The lift SHADOW is animated separately (heroLungeShadow) as a `drop-shadow` on
   the VISIBLE template (`.fullart-fit`), NOT a box-shadow on `.card`: hero cards
   are PNG templates letterboxed inside a larger, square-cornered `.card` box
   (`.card.tpl-host { box-shadow:none; border-radius:0 }`), so a box-shadow there
   detaches from the real card edge. drop-shadow follows the template's alpha →
   the shadow hugs the actual visible silhouette. */
@keyframes heroLunge {
  0% {
    transform: translate(0, 0) rotateZ(0deg) rotateX(0deg) scale(1);
    animation-timing-function: cubic-bezier(0.25, 0.85, 0.35, 1);   /* lift: ease-out */
  }
  26% {
    /* ELEVACIÓN — higher lift off the field (flat, still facing forward) */
    transform: translate(0, -46px) rotateZ(0deg) rotateX(0deg) scale(1.15);
    /* charge: a touch quicker (ends at 55%) and EASE-OUT — decelerates into the
       impact (slowest right as it lands) instead of accelerating. */
    animation-timing-function: cubic-bezier(0.16, 0.72, 0.32, 1);
  }
  55% {
    /* EMBESTIDA — charge to the target's centre, TURN to face it (rotateZ
       --atk-face) + an exaggerated forward pitch (rotateX --atk-tilt) */
    transform: translate(calc(var(--atk-dx, 0px) * 0.9), calc(var(--atk-dy, 0px) * 0.9))
               rotateZ(var(--atk-face, 0deg)) rotateX(var(--atk-tilt, 0deg)) scale(1);
    animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1);
  }
  63% {
    /* micro-overshoot past the centre + squash → dry hit */
    transform: translate(calc(var(--atk-dx, 0px) * 0.98), calc(var(--atk-dy, 0px) * 0.98))
               rotateZ(var(--atk-face, 0deg)) rotateX(calc(var(--atk-tilt, 0deg) * 0.7)) scale(0.965);
    animation-timing-function: cubic-bezier(0.4, 0, 0.3, 1);        /* return */
  }
  100% {
    transform: translate(0, 0) rotateZ(0deg) rotateX(0deg) scale(1);
  }
}
/* Lift shadow — grows & blurs more as the card rises higher (levitation), shrinks
   back as it charges down to the field plane. drop-shadow hugs the visible card. */
@keyframes heroLungeShadow {
  0%   { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
  26%  { filter: drop-shadow(0 38px 56px rgba(0, 0, 0, 0.6)); }    /* lift peak (higher) */
  55%  { filter: drop-shadow(0 9px 16px rgba(0, 0, 0, 0.5)); }
  63%  { filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.5)); }
  100% { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
}
.card.lunging {
  animation: heroLunge var(--atk-dur, 600ms) both;
  transform-origin: center center;
  will-change: transform;
}
.card.lunging .fullart-fit {
  animation: heroLungeShadow var(--atk-dur, 600ms) both;
  will-change: filter;
}
.slot.lunging-source { z-index: 40; } /* charge renders above sibling slots */

/* CHAINSAW swing (Hillbilly Chad skin, impact `chainsaw`; SAW_LUNGE_MS / SAW_HIT_MS / sawLungeOf in
   game.js): the attacker IS the saw. It lifts, flies to the target's upper corner (--saw-x0/y0, from
   the target's centre) leaning into the swing (--saw-rz0) and, from the hit (35.4%), SWEEPS down the
   cut in one fluid move (--saw-x1/y1, turning to --saw-rz1) for the cut's 480 ms (to 72.3%), follows
   through a hair and goes home. Same transform list in every keyframe. */
@keyframes heroSaw {
  0% {
    transform: translate(0, 0) rotateZ(0deg) rotateX(0deg) scale(1);
    animation-timing-function: cubic-bezier(0.25, 0.85, 0.35, 1);
  }
  16% {
    transform: translate(0, -46px) rotateZ(0deg) rotateX(0deg) scale(1.15);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  33% {
    transform: translate(calc(var(--atk-dx, 0px) + var(--saw-x0, 0px)), calc(var(--atk-dy, 0px) + var(--saw-y0, 0px)))
               rotateZ(var(--saw-rz0, 0deg)) rotateX(0deg) scale(1.06);
    animation-timing-function: linear;
  }
  35.4% {
    transform: translate(calc(var(--atk-dx, 0px) + var(--saw-x0, 0px)), calc(var(--atk-dy, 0px) + var(--saw-y0, 0px)))
               rotateZ(var(--saw-rz0, 0deg)) rotateX(0deg) scale(1.06);
    animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);       /* = the cut tip's ease in-out (FX `follow`) */
  }
  72.3% {
    transform: translate(calc(var(--atk-dx, 0px) + var(--saw-x1, 0px)), calc(var(--atk-dy, 0px) + var(--saw-y1, 0px)))
               rotateZ(var(--saw-rz1, 0deg)) rotateX(0deg) scale(1.02);
    animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1);
  }
  77% {
    transform: translate(calc(var(--atk-dx, 0px) + var(--saw-x1, 0px) * 1.25), calc(var(--atk-dy, 0px) + var(--saw-y1, 0px) * 1.25 + 8px))
               rotateZ(calc(var(--saw-rz1, 0deg) * 1.15)) rotateX(0deg) scale(1);
    animation-timing-function: cubic-bezier(0.4, 0, 0.3, 1);
  }
  100% {
    transform: translate(0, 0) rotateZ(0deg) rotateX(0deg) scale(1);
  }
}
.card.lunging.saw-lunging { animation-name: heroSaw; }

/* TOXIC SLASH (Hopium Addict, impact `toxicSlash`; TOX_* / toxLungeOf in game.js): first it INHALES in
   its cell (swells and glows green while FX.inhaleSmoke swirls into the mask, to 57.9% = TOX_INHALE_MS of
   TOX_LUNGE_MS), then flies to the start of the cut (--tox-x0/y0, turned --tox-rz, 71.6%), RIDES the cut
   across the target (--tox-x1/y1, 81.1%) and goes home. Retune the % with the ms. */
@keyframes heroTox {
  0%    { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; animation-timing-function: ease-in; }
  50%   { transform: translate(0, 0) rotateZ(0deg) scale(1.05); filter: brightness(1.15) drop-shadow(0 0 14px #6dff5a); }
  57.9% { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; animation-timing-function: cubic-bezier(.5, 0, .6, 1); }
  71.6% { transform: translate(var(--tox-x0, 0px), var(--tox-y0, 0px)) rotateZ(var(--tox-rz, 0deg)) scale(1.04); filter: none; animation-timing-function: cubic-bezier(.3, 0, .7, 1); }
  81.1% { transform: translate(var(--tox-x1, 0px), var(--tox-y1, 0px)) rotateZ(var(--tox-rz, 0deg)) scale(1.04); filter: none; animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  100%  { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; }
}
.card.lunging.tox-lunging { animation-name: heroTox; }
/* GREEN RAMPAGE (Bullserker, impact `bullSmash`; BULL_* / bullLungeOf in game.js = FX.TUNE.bullSmash): while FX.bullCharge
   wraps it in its green aura it BACKS OFF trembling (--bull-bx/by, to 53.73% = windMs 720 of BULL_LUNGE_MS 1340), RUSHES
   straight in until it stands in front of the target (--bull-go x --atk-dx/dy, 60.45% = the hit), holds the blow and goes
   home. Generated from the ms: retune both together. Same transform list in every keyframe. */
@keyframes heroBull {
  0%     { transform: translate(0, 0) rotateZ(0deg) scale(1); }
  6.40%  { transform: translate(calc(var(--bull-bx, 0px) * 0.25), calc(var(--bull-by, 0px) * 0.25)) rotateZ(-1.2deg) scale(.97); }
  12.79% { transform: translate(calc(var(--bull-bx, 0px) * 0.5), calc(var(--bull-by, 0px) * 0.5)) rotateZ(1.2deg) scale(.97); }
  19.19% { transform: translate(calc(var(--bull-bx, 0px) * 0.75), calc(var(--bull-by, 0px) * 0.75)) rotateZ(-1.2deg) scale(.97); }
  25.59% { transform: translate(calc(var(--bull-bx, 0px) * 1), calc(var(--bull-by, 0px) * 1)) rotateZ(1.2deg) scale(.97); }
  31.98% { transform: translate(calc(var(--bull-bx, 0px) * 1), calc(var(--bull-by, 0px) * 1)) rotateZ(-1.2deg) scale(.97); }
  38.38% { transform: translate(calc(var(--bull-bx, 0px) * 1), calc(var(--bull-by, 0px) * 1)) rotateZ(1.2deg) scale(.97); }
  44.78% { transform: translate(calc(var(--bull-bx, 0px) * 1), calc(var(--bull-by, 0px) * 1)) rotateZ(-1.2deg) scale(.97); }
  51.17% { transform: translate(calc(var(--bull-bx, 0px) * 1), calc(var(--bull-by, 0px) * 1)) rotateZ(1.2deg) scale(.97); }
  53.73% { transform: translate(var(--bull-bx, 0px), var(--bull-by, 0px)) rotateZ(0deg) scale(.97); animation-timing-function: cubic-bezier(.6, 0, 1, .7); }
  60.45% { transform: translate(calc(var(--atk-dx, 0px) * var(--bull-go, .8)), calc(var(--atk-dy, 0px) * var(--bull-go, .8))) rotateZ(0deg) scale(1.06); }
  68.66% { transform: translate(calc(var(--atk-dx, 0px) * var(--bull-go, .8) * .96), calc(var(--atk-dy, 0px) * var(--bull-go, .8) * .96)) rotateZ(0deg) scale(1.02); animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  100%   { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.bull-lunging { animation-name: heroBull; z-index: 40; }
/* WATER SLASH (Swing Dolphin, impact `waterSlash`; WSL_* in game.js = FX.TUNE.waterSlash): the same ride as heroTox
   (toxLungeOf), but it first CHARGES WITH WATER in its cell (swells and glows cyan while FX.waterSlashWindup's
   bubbles rise, to 40.3% = windMs 520 of WSL_LUNGE_MS 1290), flies to the start of the cut (58.9%), rides it (72.1%)
   and goes home. Retune the % with the ms. */
@keyframes heroWsl {
  0%    { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; animation-timing-function: ease-in; }
  34.3% { transform: translate(0, 0) rotateZ(0deg) scale(1.04); filter: brightness(1.12) drop-shadow(0 0 14px #5cc8ff); }
  40.3% { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; animation-timing-function: cubic-bezier(.5, 0, .6, 1); }
  58.9% { transform: translate(var(--tox-x0, 0px), var(--tox-y0, 0px)) rotateZ(var(--tox-rz, 0deg)) scale(1.04); filter: none; animation-timing-function: cubic-bezier(.3, 0, .7, 1); }
  72.1% { transform: translate(var(--tox-x1, 0px), var(--tox-y1, 0px)) rotateZ(var(--tox-rz, 0deg)) scale(1.04); filter: none; animation-timing-function: cubic-bezier(.3, .6, .4, 1); }
  100%  { transform: translate(0, 0) rotateZ(0deg) scale(1); filter: none; }
}
.card.lunging.tox-lunging.wsl-lunging { animation-name: heroWsl; }

/* LEVERAGE SLASH (Leverage Larry, impact `levSlash`; LEV_* / levLungeOf in game.js): crouches (10.9% =
   LEV_CROUCH_MS of LEV_LUNGE_MS 1200 = 9.17%), JUMPS toward the camera above the start of the cut with the sword drawn
   back (--lev-x0/y0, --lev-back, 30.83%), HANGS in the air (55.83%: LEV_HANG_MS 300 since 2026-10-23), DIVES down
   the cut turned with it (--lev-x1/y1, --lev-rz, 68.33%; the hit is at 45% of the dive) and goes home. Retune the % with the ms. */
@keyframes heroLev {
  0%    { transform: translate(0, 0) rotateZ(0deg) scale(1); animation-timing-function: ease-out; }
  9.17% { transform: translate(0, 6px) rotateZ(0deg) scale(1.04, 0.9); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  30.83% { transform: translate(var(--lev-x0, 0px), var(--lev-y0, 0px)) rotateZ(var(--lev-back, 0deg)) scale(1.38); animation-timing-function: ease-in-out; }
  55.83% { transform: translate(var(--lev-x0, 0px), calc(var(--lev-y0, 0px) - 12px)) rotateZ(var(--lev-back, 0deg)) scale(1.42); animation-timing-function: cubic-bezier(.6, 0, .9, .4); }
  68.33% { transform: translate(var(--lev-x1, 0px), var(--lev-y1, 0px)) rotateZ(var(--lev-rz, 0deg)) scale(1.05); animation-timing-function: cubic-bezier(.25, .8, .3, 1); }
  100%  { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.lev-lunging { animation-name: heroLev; z-index: 40; }
/* Leverage Slash vs HODL (game.js LEV_SH_*: 110 / 260 / 300 hang / 120 dive / 200 bounce / 380 back = 1370 ms):
   the dive stops where the blade meets the dome (--lev-x1/y1) and the card bounces back (--lev-x2/y2). */
@keyframes heroLevShield {
  0%     { transform: translate(0, 0) rotateZ(0deg) scale(1); animation-timing-function: ease-out; }
  8.03%  { transform: translate(0, 6px) rotateZ(0deg) scale(1.04, 0.9); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  27.01% { transform: translate(var(--lev-x0, 0px), var(--lev-y0, 0px)) rotateZ(var(--lev-back, 0deg)) scale(1.38); animation-timing-function: ease-in-out; }
  48.91% { transform: translate(var(--lev-x0, 0px), calc(var(--lev-y0, 0px) - 12px)) rotateZ(var(--lev-back, 0deg)) scale(1.42); animation-timing-function: cubic-bezier(.6, 0, .9, .4); }
  57.66% { transform: translate(var(--lev-x1, 0px), var(--lev-y1, 0px)) rotateZ(var(--lev-rz, 0deg)) scale(1.2); animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  72.26% { transform: translate(var(--lev-x2, 0px), var(--lev-y2, 0px)) rotateZ(var(--lev-rr, 0deg)) scale(1.3); animation-timing-function: cubic-bezier(.4, 0, .3, 1); }
  100%   { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.lev-lunging.lev-shield { animation-name: heroLevShield; }
/* LARRY SLASH (Liquidated Larry, impact `larrySlash`; LAR_* / larryLungeOf in game.js): Leverage Slash's cut
   WITHOUT the jump. Flat to the start of the cut (--lar-x0/y0, turned a little --lar-rz, 28.81% = LAR_TO_MS of
   LAR_LUNGE_MS 1180), rides the cut (--lar-x1/y1, 52.54%) and goes home, soft curves. Retune the % with the ms. */
@keyframes heroLarry {
  0%     { transform: translate(0, 0) rotateZ(0deg) scale(1); animation-timing-function: cubic-bezier(.45, .05, .55, .95); }
  28.81% { transform: translate(var(--lar-x0, 0px), var(--lar-y0, 0px)) rotateZ(var(--lar-rz, 0deg)) scale(1.05); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  52.54% { transform: translate(var(--lar-x1, 0px), var(--lar-y1, 0px)) rotateZ(var(--lar-rz, 0deg)) scale(1.03); animation-timing-function: cubic-bezier(.35, 0, .25, 1); }
  100%   { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.lar-lunging { animation-name: heroLarry; z-index: 40; }
/* vs HODL (LAR_SH_*: 340 / 196 / 180 bounce / 560 back = 1276 ms): stops where the blade meets the dome, bounces. */
@keyframes heroLarryShield {
  0%     { transform: translate(0, 0) rotateZ(0deg) scale(1); animation-timing-function: cubic-bezier(.45, .05, .55, .95); }
  26.65% { transform: translate(var(--lar-x0, 0px), var(--lar-y0, 0px)) rotateZ(var(--lar-rz, 0deg)) scale(1.05); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  42.01% { transform: translate(var(--lar-x1, 0px), var(--lar-y1, 0px)) rotateZ(var(--lar-rz, 0deg)) scale(1.06); animation-timing-function: cubic-bezier(.2, .6, .35, 1); }
  56.11% { transform: translate(var(--lar-x2, 0px), var(--lar-y2, 0px)) rotateZ(var(--lar-rr, 0deg)) scale(1.04); animation-timing-function: cubic-bezier(.4, 0, .3, 1); }
  100%   { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.lar-lunging.lar-shield { animation-name: heroLarryShield; }
/* CYBERPUNK LARRY (skin.cyberLarry; CY_* / CB_* / cyberLungeOf in game.js, tuned in impact-effects.html).
   NEON DOUBLE SLASH (impact `cyberSlash`, CY_LUNGE_MS 1460): Leverage Slash's jump (crouch 7.53%, above the start of
   the diagonal --cy-x0/y0 25.34%, hangs until 44.52%), DIVES down the diagonal (--cy-x1/y1, 54.79%; the hit at 45% of
   the dive), comes back to the centre's height on that side (--cy-x2/y2, 59.59%) and SWEEPS across backwards
   (--cy-x3/y3, 71.23%; the horizontal cut at mid-sweep), then home. Retune the % with the ms. */
@keyframes heroCyber {
  0%     { transform: translate(0, 0) rotateZ(0deg) scale(1); animation-timing-function: ease-out; }
  7.53%  { transform: translate(0, 6px) rotateZ(0deg) scale(1.04, 0.9); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  25.34% { transform: translate(var(--cy-x0, 0px), var(--cy-y0, 0px)) rotateZ(var(--cy-back, 0deg)) scale(1.38); animation-timing-function: ease-in-out; }
  44.52% { transform: translate(var(--cy-x0, 0px), calc(var(--cy-y0, 0px) - 12px)) rotateZ(var(--cy-back, 0deg)) scale(1.42); animation-timing-function: cubic-bezier(.6, 0, .9, .4); }
  54.79% { transform: translate(var(--cy-x1, 0px), var(--cy-y1, 0px)) rotateZ(var(--cy-rz, 0deg)) scale(1.05); animation-timing-function: cubic-bezier(.3, .8, .4, 1); }
  59.59% { transform: translate(var(--cy-x2, 0px), var(--cy-y2, 0px)) rotateZ(var(--cy-sw, 0deg)) scale(1.12); animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  71.23% { transform: translate(var(--cy-x3, 0px), var(--cy-y3, 0px)) rotateZ(var(--cy-end, 0deg)) scale(1.08); animation-timing-function: cubic-bezier(.4, 0, .3, 1); }
  100%   { transform: translate(0, 0) rotateZ(0deg) scale(1); }
}
.card.lunging.cy-lunging { animation-name: heroCyber; z-index: 40; }
/* GLITCH BLINK SPLIT (impact `cyberSplit`, the blow that KILLS; CB_LUNGE_MS 3110): glitches out in its cell (8.36%),
   is gone, JUMPS beside the target (--cb-x/y) and glitches in there (12.22-19.94%), waits there while it sheathes (the
   cut, at CB_HIT_MS = 46.95%), glitches out again (83.92-92.28%) and back in its cell. Jumps = steps(1, end). */
@keyframes heroCyberBlink {
  0%     { transform: translate(0, 0) scale(1); opacity: 1; filter: none; animation-timing-function: steps(1, end); }
  2.5%   { transform: translate(-6px, 0) scale(1); opacity: 1; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  4.5%   { transform: translate(5px, 0) scale(1); opacity: .7; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: steps(1, end); }
  6.5%   { transform: translate(-3px, 0) scale(1); opacity: .4; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: linear; }
  8.36%  { transform: translate(0, 0) scale(1); opacity: 0; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  12.22% { transform: translate(var(--cb-x, 0px), var(--cb-y, 0px)) scale(1.12); opacity: 0; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: steps(1, end); }
  14%    { transform: translate(calc(var(--cb-x, 0px) + 6px), var(--cb-y, 0px)) scale(1.12); opacity: .5; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  16%    { transform: translate(calc(var(--cb-x, 0px) - 5px), var(--cb-y, 0px)) scale(1.12); opacity: .9; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: steps(1, end); }
  18%    { transform: translate(calc(var(--cb-x, 0px) + 3px), var(--cb-y, 0px)) scale(1.12); opacity: .6; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: linear; }
  19.94% { transform: translate(var(--cb-x, 0px), var(--cb-y, 0px)) scale(1.12); opacity: 1; filter: none; }
  83.92% { transform: translate(var(--cb-x, 0px), var(--cb-y, 0px)) scale(1.12); opacity: 1; filter: none; animation-timing-function: steps(1, end); }
  86%    { transform: translate(calc(var(--cb-x, 0px) - 6px), var(--cb-y, 0px)) scale(1.12); opacity: .7; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  88%    { transform: translate(calc(var(--cb-x, 0px) + 4px), var(--cb-y, 0px)) scale(1.12); opacity: .4; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: linear; }
  92.28% { transform: translate(var(--cb-x, 0px), var(--cb-y, 0px)) scale(1.1); opacity: 0; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  92.4%  { transform: translate(0, 0) scale(1); opacity: 0; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: steps(1, end); }
  95%    { transform: translate(5px, 0) scale(1); opacity: .6; filter: drop-shadow(-4px 0 0 rgba(61,242,255,.9)) drop-shadow(4px 0 0 rgba(255,40,180,.7)) brightness(1.3); animation-timing-function: steps(1, end); }
  97%    { transform: translate(-3px, 0) scale(1); opacity: .9; filter: drop-shadow(4px 0 0 rgba(10,255,157,.9)) drop-shadow(-3px 0 0 rgba(255,40,180,.6)) brightness(1.5); animation-timing-function: linear; }
  100%   { transform: translate(0, 0) scale(1); opacity: 1; filter: none; }
}
.card.lunging.cb-lunging { animation-name: heroCyberBlink; z-index: 40; }

/* RANGED swing (Genesis Beam / Glitch Beam — RANGED_IMPACT_FX in game.js): the card
   does NOT leave its slot. It lifts a hair, TREMBLES while it absorbs energy (the
   particles are ImpactFX.charge) and glows in the beam's colour (--beam-c), and at the
   RELEASE (68% = RANGED_CHARGE_MS / RANGED_MS — retune both together) it kicks back away
   from its target (--atk-dx/dy, same measured vector as the lunge) with a harder shake. */
@keyframes heroBeam {
  0%   { transform: translate(0, 0) scale(1); }
  8%   { transform: translate(0, -5px) scale(1.04); }
  14%  { transform: translate(-1px, -5px) scale(1.04); }
  18%  { transform: translate(1px, -6px) scale(1.04); }
  22%  { transform: translate(-1px, -4px) scale(1.045); }
  26%  { transform: translate(1.5px, -5px) scale(1.045); }
  30%  { transform: translate(-1.5px, -6px) scale(1.045); }
  34%  { transform: translate(1.5px, -4px) scale(1.05); }
  38%  { transform: translate(-2px, -5px) scale(1.05); }
  42%  { transform: translate(2px, -6px) scale(1.05); }
  46%  { transform: translate(-2px, -4px) scale(1.055); }
  50%  { transform: translate(2px, -5px) scale(1.055); }
  54%  { transform: translate(-2.5px, -6px) scale(1.06); }
  58%  { transform: translate(2.5px, -4px) scale(1.06); }
  62%  { transform: translate(-2.5px, -5px) scale(1.065); }
  66%  { transform: translate(2.5px, -6px) scale(1.07); }
  68%  { transform: translate(calc(var(--atk-dx, 0px) * -0.06 - 7px), calc(var(--atk-dy, 0px) * -0.06 + 3px)) rotate(-3deg) scale(1.1); }
  72%  { transform: translate(calc(var(--atk-dx, 0px) * -0.05 + 7px), calc(var(--atk-dy, 0px) * -0.05 - 3px)) rotate(3deg) scale(1.08); }
  77%  { transform: translate(calc(var(--atk-dx, 0px) * -0.03 - 5px), calc(var(--atk-dy, 0px) * -0.03 + 2px)) rotate(-2deg) scale(1.05); }
  82%  { transform: translate(4px, -1px) rotate(1.5deg) scale(1.03); }
  88%  { transform: translate(-2px, 0) rotate(-.5deg) scale(1.01); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes heroBeamGlow {
  0%   { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
  30%  { filter: drop-shadow(0 0 8px var(--beam-c, #ffd766)) drop-shadow(0 0 16px var(--beam-c, #ffd766)) brightness(1.06); }
  60%  { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 16px var(--beam-c, #ffd766)) drop-shadow(0 0 34px var(--beam-c, #ffd766)) brightness(1.2); }
  68%  { filter: drop-shadow(0 0 22px #fff) drop-shadow(0 0 44px var(--beam-c, #ffd766)) brightness(1.6); }
  84%  { filter: drop-shadow(0 0 10px var(--beam-c, #ffd766)) brightness(1.1); }
  100% { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
}
/* THROWN impact (F*CK FIAT, see THROW_IMPACT_FX in game.js): no charge, no glow. The card just
   jabs toward the target as the projectile leaves (14 % = RANGED_CHARGE_OF) and settles back. */
@keyframes heroThrow {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  14%  { transform: translate(calc(var(--atk-dx, 0px) * 0.07), calc(var(--atk-dy, 0px) * 0.07)) rotate(4deg) scale(1.06); }
  40%  { transform: translate(calc(var(--atk-dx, 0px) * -0.02), calc(var(--atk-dy, 0px) * -0.02)) rotate(-1.5deg) scale(1.01); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
.card.fx-throwing {
  animation: heroThrow var(--throw-dur, 420ms) cubic-bezier(0.3, 0.8, 0.3, 1) both;
  transform-origin: center center;
  will-change: transform;
}
.card.beam-charging {
  animation: heroBeam var(--beam-dur, 1400ms) linear both;
  transform-origin: center center;
  will-change: transform;
}
.card.beam-charging .fullart-fit {
  animation: heroBeamGlow var(--beam-dur, 1400ms) ease-in-out both;
  will-change: filter;
}

/* ============== IMPACT FX (hit effects over the struck card) ==============
   Particle effects (DOM/SVG) spawned by ImpactFX.play() over the card that was
   hit. One animation set per effect "class": simple / water / glitch(+gold).
   Ported from impact-effects.html (the standalone playground). */
/* Sits inside the battlefield, ABOVE the struck defender card but BELOW the
   lunging attacker (slot z-index 40), so the burst reads as being between them. */
.impact-fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: visible; }
/* Same layer, UNDER the cards: summon effects emerge from behind the card that landed
   (an attack bursts on top of the struck one). z-index 0 + first in the DOM — `.slot` is
   position:relative with z-index auto, so at equal z the painting order is tree order. */
.impact-fx-layer.behind { z-index: 0; }
.impact-fx-layer > * { position: absolute; will-change: transform, opacity; }
/* HODL shield: a hit painted ON the dome lives one level down (clip > tilted plane > nodes), so the
   nodes need the layer's own placement rule too (see ImpactFX.play, `opts.shield`). */
.imp-shield-plane > * { position: absolute; will-change: transform, opacity; }

/* Flat ARTWORK laid over an impact (ImpactFX.sprite) — Liquidated Larry's skull on his
   parting shot. Sits above the particles of the same layer (they're z-auto, this is z 2)
   and is anchored by its centre on the struck card, so the translate(-50%,-50%) has to be
   repeated in EVERY keyframe or the pop would fling it off-centre. */
.impact-sprite {
  height: auto; z-index: 2; pointer-events: none;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6));
}
@keyframes impactSpritePop {
  0%   { transform: translate(-50%,-50%) scale(0.25) rotate(-14deg); opacity: 0; }
  16%  { transform: translate(-50%,-56%) scale(1.18) rotate(4deg);   opacity: 1; }
  30%  { transform: translate(-50%,-52%) scale(0.98) rotate(-2deg);  opacity: 1; }
  62%  { transform: translate(-50%,-62%) scale(1.02) rotate(1deg);   opacity: 1; }
  100% { transform: translate(-50%,-96%) scale(0.86) rotate(-3deg);  opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes impactSpritePop {
    0%   { transform: translate(-50%,-50%) scale(1); opacity: 0; }
    18%  { transform: translate(-50%,-50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
  }
}

/* — simple — */
@keyframes impCoreFlash { 0% { transform: translate(-50%,-50%) scale(.3); opacity:.95 } 100% { transform: translate(-50%,-50%) scale(2.4); opacity:0 } }
@keyframes impSplat {
  0%   { transform: translate(-50%,-50%) scale(0) rotate(var(--r0,0deg)); opacity:0 }
  16%  { transform: translate(-50%,-50%) scale(1.16) rotate(calc(var(--r0,0deg) + 6deg)); opacity:1 }
  50%  { transform: translate(-50%,-50%) scale(.98) rotate(var(--r0,0deg)); opacity:1 }
  100% { transform: translate(-50%,-50%) scale(1.1) rotate(calc(var(--r0,0deg) - 4deg)); opacity:0 }
}
@keyframes impSoftRing { 0% { transform: translate(-50%,-50%) scale(.2); opacity:.9 } 100% { transform: translate(-50%,-50%) scale(2.2); opacity:0 } }
@keyframes impSparkWrap { from { transform: translate(-50%,-50%) rotate(var(--a0)) } to { transform: translate(-50%,-50%) rotate(calc(var(--a0) + var(--curve,0deg))) } }
@keyframes impSparkStreak {
  0%   { transform: translateX(6px) scaleX(.25) scaleY(1); opacity:0 }
  14%  { opacity:1 }
  52%  { transform: translateX(calc(var(--d) * .66)) scaleX(1.25) scaleY(.92); opacity:1 }
  100% { transform: translateX(var(--d)) scaleX(.12) scaleY(.4); opacity:0 }
}
.imp-streak { height: var(--th,5px); border-radius: 999px; transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, var(--c,#ffd766) 55%, #fff 100%);
  filter: drop-shadow(0 0 5px var(--g, rgba(255,200,90,.8))); }
@keyframes impEmberFly {
  0%   { transform: translate(-50%,-50%) translate(0,0) scale(.6); opacity:0 } 14% { opacity:1 }
  100% { transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(var(--es,.5)); opacity:0 }
}
.imp-ember { border-radius: 50%; }

/* — water cyclone — */
@keyframes impWaterCyclone {
  0%   { transform: translate(-50%,-50%) rotate(0) scale(.2) scaleY(.78); opacity:0 }
  18%  { transform: translate(-50%,-50%) rotate(210deg) scale(1.0) scaleY(.82); opacity:1 }
  62%  { transform: translate(-50%,-50%) rotate(560deg) scale(1.16) scaleY(.86); opacity:1 }
  100% { transform: translate(-50%,-50%) rotate(980deg) scale(1.5) scaleY(.9); opacity:0 }
}
@keyframes impWaterRing { 0% { transform: translate(-50%,-50%) scale(.25) scaleY(.7); opacity:1 } 100% { transform: translate(-50%,-50%) scale(2.3) scaleY(.7); opacity:0 } }
@keyframes impSpinWrap { from { transform: translate(-50%,-50%) rotate(var(--a0)) } to { transform: translate(-50%,-50%) rotate(calc(var(--a0) + var(--spin))) } }
@keyframes impSpinChild {
  0%   { transform: translateX(6px) scale(.3); opacity:0 } 16% { opacity:1 } 70% { opacity:1 }
  100% { transform: translateX(var(--d)) scale(var(--es,.8)) rotate(var(--rot,0deg)); opacity:0 }
}
@keyframes impBubbleUp {
  0%   { transform: translate(-50%,-50%) translate(0,0) scale(.2); opacity:0 } 20% { opacity:1 }
  100% { transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(var(--es,.9)); opacity:0 }
}
/* Torbellino de agua giratorio: gira y al final COLAPSA a 0 (cambia de forma, no fade de salida;
   el de entrada sí). Los brazos, además, CHURNEAN (morph SMIL dentro del SVG). */
@keyframes impWaterChurn {
  0%   { transform: translate(-50%,-50%) rotate(0)      scale(.2)   scaleY(.78); opacity:0 }
  16%  { opacity:1 }
  18%  { transform: translate(-50%,-50%) rotate(210deg) scale(1)    scaleY(.82); opacity:1 }
  62%  { transform: translate(-50%,-50%) rotate(560deg) scale(1.16) scaleY(.86); opacity:1 }
  100% { transform: translate(-50%,-50%) rotate(900deg) scale(0)    scaleY(.5);  opacity:1 }
}
.imp-drop { border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff, #aef0ff 32%, #4fc3f7 78%); filter: drop-shadow(0 0 5px rgba(90,200,255,.7)); }
.imp-foam { border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff, #d6f4ff 60%, #7fd0ff); filter: drop-shadow(0 0 3px rgba(120,220,255,.6)); }

/* — beam CHARGE (ImpactFX.charge: Genesis Beam / Glitch Beam wind-up, over the attacker) —
   Everything travels INWARD: from (--tx,--ty) to the centre of the card. */
.imp-beam-core { border-radius: 50%; mix-blend-mode: screen; }
@keyframes impBeamCore {
  0%   { transform: translate(-50%,-50%) scale(.15); opacity: 0 }
  25%  { opacity: .55 }
  90%  { transform: translate(-50%,-50%) scale(1.05); opacity: .95 }
  100% { transform: translate(-50%,-50%) scale(.6); opacity: 0 }
}
/* Whale Dump's charge cyclone: grows like the core AND spins, speeding up toward the
   release (same turning direction as the impact's impWaterChurn). Run with linear timing —
   the acceleration is in the keyframe spacing. */
@keyframes impBeamCyclone {
  0%   { transform: translate(-50%,-50%) rotate(0deg)    scale(.15); opacity: 0 }
  25%  { transform: translate(-50%,-50%) rotate(140deg)  scale(.4);  opacity: .6 }
  50%  { transform: translate(-50%,-50%) rotate(380deg)  scale(.65); opacity: .8 }
  75%  { transform: translate(-50%,-50%) rotate(720deg)  scale(.88); opacity: .9 }
  90%  { transform: translate(-50%,-50%) rotate(990deg)  scale(1.05); opacity: .95 }
  100% { transform: translate(-50%,-50%) rotate(1200deg) scale(.6);  opacity: 0 }
}
@keyframes impBeamIn {
  0%   { transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(1.1); opacity: 0 }
  25%  { opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(0,0) scale(.2); opacity: 0 }
}
.imp-beam-streak { height: 3px; border-radius: 999px; transform-origin: 0 50%; mix-blend-mode: screen; }
@keyframes impBeamStreakIn {
  0%   { transform: translate(var(--tx),var(--ty)) rotate(var(--rot)) scaleX(.3); opacity: 0 }
  30%  { opacity: 1 }
  100% { transform: translate(0,0) rotate(var(--rot)) scaleX(1); opacity: 0 }
}
@keyframes impBeamRingIn {
  0%   { transform: translate(-50%,-50%) scale(1); opacity: 0 }
  30%  { opacity: .85 }
  100% { transform: translate(-50%,-50%) scale(.12); opacity: 0 }
}

/* — glitch (neon + gold) — */
@keyframes impGlFlash { 0% { transform: translate(-50%,-50%) scale(.3); opacity:1 } 100% { transform: translate(-50%,-50%) scale(2.6); opacity:0 } }
@keyframes impGlRing {
  0%   { transform: translate(-50%,-50%) scale(.2); opacity:0 } 14% { opacity:1 }
  40%  { transform: translate(-50%,-50%) scale(1.1); } 70% { transform: translate(-50%,-50%) scale(1.05); opacity:.9 }
  100% { transform: translate(-50%,-50%) scale(1.9); opacity:0 }
}
@keyframes impGlSlice {
  0%,100% { opacity:0 }
  8%   { transform: translate(-50%,-50%) translateX(var(--o1)); opacity:.92 }
  24%  { transform: translate(-50%,-50%) translateX(var(--o2)); opacity:.55 }
  40%  { transform: translate(-50%,-50%) translateX(var(--o3)); opacity:.95 }
  56%  { transform: translate(-50%,-50%) translateX(var(--o1)); opacity:.4 }
  72%  { transform: translate(-50%,-50%) translateX(var(--o2)); opacity:.85 }
  88%  { transform: translate(-50%,-50%) translateX(0); opacity:.25 }
}
@keyframes impGlFly { 0% { transform: translate(-50%,-50%) translate(0,0) scale(.5) } 100% { transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(var(--es,.9)) } }
@keyframes impGlFlick { 0%,18%,40%,70%,100% { opacity:1 } 12%,30%,55%,82% { opacity:0 } 95% { opacity:0 } }
@keyframes impGlScan { 0% { transform: translate(-50%,-130%); opacity:0 } 12% { opacity:.85 } 90% { opacity:.6 } 100% { transform: translate(-50%,130%); opacity:0 } }
.imp-gblock { border-radius: 1px; }
.imp-gglyph { font-family: 'Share Tech Mono', ui-monospace, monospace; font-weight: 700; line-height: 1; text-shadow: 0 0 6px currentColor, 0 0 2px currentColor; }
.imp-gscan { height: 3px; border-radius: 2px; }
/* — GENESIS RAY (Genesis Beam's shot, ImpactFX genesisRay; authored in impact-effects.html) —
   .imp-ray is a sizeless anchor rotated to the shot (its +x = toward the target); --L = length,
   --k = card scale (the playground's px are for a 188 px card). */
.impact-fx-layer > .imp-ray { width: 0; height: 0; transform-origin: 0 0; }
.imp-ray > div { position: absolute; }
.imp-ray-halo, .imp-ray-body, .imp-ray-core { left: 0; top: 0; width: var(--L); transform-origin: 0 50%; transform: translateY(-50%) scale(0,.6);
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent 100%); mask-image: linear-gradient(90deg, #000 88%, transparent 100%); }
.imp-ray-halo { height: calc(100px * var(--k)); background: linear-gradient(180deg, rgba(245,193,74,0), rgba(255,215,102,.55) 35%, rgba(255,243,176,.7) 50%, rgba(255,215,102,.55) 65%, rgba(245,193,74,0));
  clip-path: polygon(0 38%, 100% 0, 100% 100%, 0 62%); filter: blur(6px); mix-blend-mode: screen; }
.imp-ray-body { height: calc(52px * var(--k)); background: linear-gradient(180deg, rgba(245,193,74,0) 0%, #f5c14a 18%, #ffe9a8 36%, #fffbe8 50%, #ffe9a8 64%, #f5c14a 82%, rgba(245,193,74,0) 100%);
  clip-path: polygon(0 36%, 8% 30%, 100% 4%, 100% 96%, 8% 70%, 0 64%); filter: drop-shadow(0 0 10px #ffd766); animation: impRayJit 90ms steps(1) infinite; }
.imp-ray-core { height: calc(10px * var(--k)); background: linear-gradient(90deg, #fff 0%, #fff 85%, rgba(255,255,255,.6)); border-radius: 6px; box-shadow: 0 0 10px #fff, 0 0 22px #fff2c4; }
@keyframes impRayJit { 0% { margin-top: 0 } 33% { margin-top: -2px } 66% { margin-top: 2px } }
.imp-ray-streak { border-radius: 3px; opacity: 0; background: linear-gradient(90deg, rgba(255,243,176,0), #fff3b0 40%, #fff 80%, rgba(255,255,255,0));
  box-shadow: 0 0 6px #ffd766; animation-name: impRayStreak; animation-timing-function: cubic-bezier(.3,.6,.4,1); animation-fill-mode: forwards; }
@keyframes impRayStreak { 0% { transform: translateX(-40%); opacity: 0 } 25% { opacity: 1 } 100% { transform: translateX(60%); opacity: 0 } }
.imp-ray-slice { opacity: 0; background: linear-gradient(90deg, rgba(255,215,102,0), rgba(255,236,160,.85) 20%, rgba(255,215,102,.8) 80%, rgba(255,215,102,0));
  mix-blend-mode: screen; animation: impRaySlice 360ms step-end forwards; }
@keyframes impRaySlice { 0% { opacity: .95; transform: translate(0,0) } 20% { transform: translate(var(--o1),-3px) } 40% { opacity: .5; transform: translate(var(--o2),2px) }
  60% { opacity: .9; transform: translate(var(--o1),0) } 80% { opacity: .3 } 100% { opacity: 0 } }
.imp-ray-bits { opacity: 0; white-space: nowrap; font-family: 'Share Tech Mono', ui-monospace, monospace; font-weight: 700; line-height: 1; letter-spacing: 1px;
  color: #ffdf7a; -webkit-text-stroke: .8px #6a4610; paint-order: stroke; text-shadow: 0 0 6px #ffd766; animation: impRayBits 380ms step-end forwards; }
@keyframes impRayBits { 0%,30%,60% { opacity: 1 } 15%,45%,80%,100% { opacity: 0 } }
.imp-ray-swirl { mix-blend-mode: screen; opacity: 0; }
.impact-fx-layer > .imp-ray-tip { width: 0; height: 0; opacity: 0; }
.imp-ray-tip > div { position: absolute; left: 0; top: 0; transform: translate(-50%,-50%); border-radius: 50%; }
.imp-ray-tip-glow { width: calc(90px * var(--k)); height: calc(150px * var(--k)); background: radial-gradient(ellipse, #fff 0%, #fff2c4 22%, rgba(255,215,102,.75) 45%, rgba(245,193,74,0) 70%); mix-blend-mode: screen; filter: blur(3px); }
.imp-ray-tip-core { width: calc(34px * var(--k)); height: calc(34px * var(--k)); background: radial-gradient(circle, #fff 45%, rgba(255,255,255,0) 72%); box-shadow: 0 0 18px #fff, 0 0 36px #ffd766; }
.imp-ray-spark { border-radius: 3px; background: linear-gradient(90deg, rgba(255,215,102,0), #fff3b0 55%, #fff); box-shadow: 0 0 6px #ffd766; opacity: 0; }
@keyframes impRaySpark { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(var(--r)) scaleX(.4) }
  100% { opacity: 0; transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) rotate(var(--r)) scaleX(1) } }
/* — WATER JET (Whale Dump / BTC Splash shot, ImpactFX waterJet; authored in impact-effects.html) —
   Same anchor contract as .imp-ray. The SPIN = oblique stripes running along it (.imp-wjet-twist)
   + spiral rings travelling down it (.imp-wjet-ring). */
.impact-fx-layer > .imp-wjet { width: 0; height: 0; transform-origin: 0 0; }
.imp-wjet > div { position: absolute; }
.imp-wjet-body, .imp-wjet-twist, .imp-wjet-shine { left: 0; top: 0; width: var(--L); transform-origin: 0 50%; transform: translateY(-50%) scale(0,.5);
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%); mask-image: linear-gradient(90deg, #000 86%, transparent 100%); }
.imp-wjet-body { height: calc(46px * var(--k)); border-radius: calc(23px * var(--k)); clip-path: polygon(0 34%, 10% 22%, 100% 0, 100% 100%, 10% 78%, 0 66%);
  background: linear-gradient(180deg, #1f7fd0 0%, #3ea2f2 22%, #9fdbff 44%, #3ea2f2 64%, #2a8de0 86%, #1f7fd0 100%); filter: drop-shadow(0 0 8px rgba(79,195,247,.8)); }
.imp-wjet-twist { height: calc(46px * var(--k)); clip-path: polygon(0 34%, 10% 22%, 100% 0, 100% 100%, 10% 78%, 0 66%);
  background: repeating-linear-gradient(118deg, rgba(255,255,255,0) 0 10px, rgba(214,244,255,.85) 10px 15px, rgba(255,255,255,0) 15px 26px);
  animation: impWjetSpin 180ms linear infinite; }
@keyframes impWjetSpin { from { background-position: 0 0 } to { background-position: 59px 0 } }
.imp-wjet-shine { height: calc(5px * var(--k)); margin-top: calc(-10px * var(--k)); border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.2), #fff 30%, #fff 80%, rgba(255,255,255,0)); }
.imp-wjet-ring { left: 0; top: 0; width: calc(12px * var(--k)); height: var(--h); border-radius: 50%; border: 3px solid #d6f4ff; border-left-color: transparent;
  box-shadow: 0 0 6px rgba(120,225,255,.8); opacity: 0; transform: translate(-50%,-50%); animation: impWjetRing 300ms cubic-bezier(.4,0,.8,1) forwards; }
@keyframes impWjetRing { 0% { opacity: 0; transform: translate(-50%,-50%) translateX(0) scaleY(.5) } 15% { opacity: 1 }
  100% { opacity: 0; transform: translate(-50%,-50%) translateX(var(--L)) scaleY(1.2) } }
.imp-wdrop { border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; opacity: 0; transform: translate(-50%,-50%);
  background: radial-gradient(circle at 35% 30%, #fff 0 22%, #9fdbff 24% 45%, #3ea2f2 50%); box-shadow: 0 0 5px rgba(79,195,247,.7); }
@keyframes impWDropFly { 0% { opacity: 1; transform: translate(-50%,-50%) scale(.4) } 25% { opacity: 1; transform: translate(-50%,-50%) translate(calc(var(--tx)*.5),calc(var(--ty)*.3)) scale(1) }
  100% { opacity: 0; transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(.6) } }
.imp-wjet-tip-glow { width: calc(80px * var(--k)); height: calc(140px * var(--k)); background: radial-gradient(ellipse, #fff 0%, #d6f4ff 25%, rgba(79,195,247,.7) 50%, rgba(79,195,247,0) 72%); filter: blur(2px); }

/* — pulverize (hero KO → crumbles into debris + dust) — */
/* ---- BITE (Forkhydra): fauces que se cierran de golpe sobre la carta golpeada ----
   Portadas de impact-effects.html. Cerrado == `translateY(0)`: cada mandibula se coloca ya
   en su sitio final y la animacion solo anade la apertura (`--gap`), asi no hay que
   compensar media caja del SVG. El "clac" esta en el EASING POR FOTOGRAMA: del 0 % al 62 %
   es un solo movimiento continuo que acelera y remata con rebote (el elemento va a
   `linear` para no pisarlo). El 62 % tiene que cuadrar con BITE_SNAP en game.js. */
@keyframes impBiteUpper {
  0%   { opacity:0; transform:translate(-50%,-50%) translateY(calc(-1.65 * var(--gap))) scale(1.2) rotate(-4deg);
         animation-timing-function:cubic-bezier(.34,.06,.72,.5); }
  10%  { opacity:1; }
  62%  { transform:translate(-50%,-50%) translateY(0) scale(1) rotate(0deg);
         animation-timing-function:cubic-bezier(.2,1.7,.45,1); }
  69%  { transform:translate(-50%,-50%) translateY(5px) scale(.985) rotate(.8deg); }
  79%  { opacity:1; transform:translate(-50%,-50%) translateY(0) scale(1) rotate(0deg);
         animation-timing-function:cubic-bezier(.4,0,.7,.5); }
  100% { opacity:0; transform:translate(-50%,-50%) translateY(calc(-1.4 * var(--gap))) scale(1.12) rotate(-4deg); }
}
@keyframes impBiteLower {
  0%   { opacity:0; transform:translate(-50%,-50%) translateY(calc(1.65 * var(--gap))) scale(1.2) rotate(4deg);
         animation-timing-function:cubic-bezier(.34,.06,.72,.5); }
  10%  { opacity:1; }
  62%  { transform:translate(-50%,-50%) translateY(0) scale(1) rotate(0deg);
         animation-timing-function:cubic-bezier(.2,1.7,.45,1); }
  69%  { transform:translate(-50%,-50%) translateY(-5px) scale(.985) rotate(-.8deg); }
  79%  { opacity:1; transform:translate(-50%,-50%) translateY(0) scale(1) rotate(0deg);
         animation-timing-function:cubic-bezier(.4,0,.7,.5); }
  100% { opacity:0; transform:translate(-50%,-50%) translateY(calc(1.4 * var(--gap))) scale(1.12) rotate(-4deg); }
}
/* Fauces: la oscuridad del interior de la boca. Sin encias es lo unico que situa los
   dientes dentro de algo; se cierra con ellos (a partir del chasquido no hay boca). */
@keyframes impBiteMaw {
  0%   { opacity:0; transform:translate(-50%,-50%) scale(.35) scaleY(.5); }
  22%  { opacity:.92; }
  56%  { opacity:.9;  transform:translate(-50%,-50%) scale(1) scaleY(1); }
  64%  { opacity:.55; transform:translate(-50%,-50%) scale(.9) scaleY(.14); }
  100% { opacity:0;   transform:translate(-50%,-50%) scale(.8) scaleY(.06); }
}
/* Fogonazo plano y muy corto: tapa el cruce de los dientes, que es donde mas canta. */
@keyframes impBiteFlash {
  0%   { opacity:0; transform:translate(-50%,-50%) scaleX(.25) scaleY(.5); }
  18%  { opacity:1; }
  100% { opacity:0; transform:translate(-50%,-50%) scaleX(1.5) scaleY(.16); }
}
/* Migas de carta que saltan por los lados de la boca al morder. */
@keyframes impBiteCrumb {
  0%   { opacity:0; transform:translate(-50%,-50%) translate(0,0) rotate(0) scale(.5); }
  12%  { opacity:1; }
  100% { opacity:0; transform:translate(-50%,-50%) translate(var(--tx),var(--ty)) rotate(var(--r)) scale(var(--es,.7)); }
}

@keyframes impPulvFly {
  0%   { transform: translate(-50%,-50%) rotate(0) scale(1); opacity: 0 }
  10%  { opacity: 1 }
  62%  { opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(var(--tx,0px), var(--ty,0px)) rotate(var(--rot,0deg)) scale(var(--es,.3)); opacity: 0 }
}
.imp-debris { box-shadow: 0 0 4px rgba(255,245,225,.6), inset 0 1px 1px rgba(255,255,255,.5); }

/* ── Katana / zarpazo / cisne negro (afinados en impact-effects.html; ver ImpactFX) ── */
/* El TAJO se DIBUJA a lo largo con un clip-path que avanza en el eje del propio huso (el
   wrapper ya va girado al angulo del corte), aguanta un instante y se va AFINANDO
   (scaleY->0): desaparece cambiando de forma, la opacidad solo remata. Los insets
   verticales son NEGATIVOS para que el halo/glow que sobresale de la caja no se recorte
   (clip-path recorta a la caja aunque el SVG tenga overflow:visible). */
@keyframes impKatanaCut {
  0%   { clip-path: inset(-60% 100% -60% 0); transform: scaleY(1);   opacity: 1 }
  22%  { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(1);   opacity: 1 }
  50%  { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(.9);  opacity: 1 }
  82%  { opacity: .85 }
  100% { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(.04); opacity: 0 }
}
@keyframes impClawCut {
  0%   { clip-path: inset(-60% 100% -60% 0); transform: scaleY(1);   opacity: 1 }
  16%  { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(1);   opacity: 1 }
  60%  { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(.94); opacity: 1 }
  86%  { opacity: .8 }
  100% { clip-path: inset(-60% 0 -60% 0);    transform: scaleY(.06); opacity: 0 }
}
/* ── Chain Lash (The Dev, ImpactFX `chainWhip`) ── cada eslabón aparece de golpe con un
   rebote (el látigo viaja del mango a la punta) y se deshace en humo hacia ARRIBA; el humo
   etéreo se dibuja a lo largo (dash) y se apaga; los glifos salen del restallido y flotan. */
@keyframes impCwLinkIn  { 0% { transform: scale(.2); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
@keyframes impCwLinkOut { 0% { transform: scale(1); opacity: 1 } 100% { transform: translateY(-14px) scale(.55); opacity: 0 } }
@keyframes impCwWisp {
  0%   { stroke-dashoffset: 1; opacity: .9 }
  22%  { stroke-dashoffset: 0; opacity: 1 }
  100% { stroke-dashoffset: 0; opacity: 0 }
}
@keyframes impCwFlash { 0% { transform: translate(-50%,-50%) scale(.3); opacity: 1 } 100% { transform: translate(-50%,-50%) scale(1.25); opacity: 0 } }
@keyframes impCwRing  { 0% { transform: translate(-50%,-50%) scale(.25); opacity: 1 } 100% { transform: translate(-50%,-50%) scale(1.6); opacity: 0 } }
@keyframes impCwShard {
  0%   { transform: translate(-50%,-50%) translate(0,0) rotate(0); opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(var(--tx), var(--ty)) rotate(var(--r)); opacity: 0 }
}
@keyframes impCwGlyph {
  0%   { transform: translate(-50%,-50%) translate(0,0) rotate(0) scale(.4); opacity: 0 }
  15%  { opacity: 1 }
  70%  { opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(var(--tx), var(--ty)) rotate(var(--r)) scale(1); opacity: 0 }
}
/* La PLUMA la LANZA el wrapper desde el centro (frenazo fuerte y CAIDA al final: la parte
   vertical del vuelo llega tarde, como la gravedad) y la pluma de dentro va de costado y
   casi quieta mientras la empuja el golpe -el doblez lo pone un morph SMIL dentro del SVG-
   y, cuando frena (~45 %), se MECE hasta morir encogiendose. */
@keyframes impFeatherFly {
  0%   { transform: translate(-50%,-50%) translate(0,0); opacity: 0 }
  7%   { opacity: 1 }
  45%  { transform: translate(-50%,-50%) translate(calc(var(--ox) * .8), calc(var(--oy) * .8 + var(--fall) * .15)); opacity: 1 }
  80%  { opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(var(--ox), calc(var(--oy) + var(--fall))); opacity: 0 }
}
@keyframes impFeatherRock {
  0%   { transform: rotate(calc(var(--r0) - var(--sw) * .3)) scale(.5) }
  12%  { transform: rotate(var(--r0)) scale(1.05) }
  45%  { transform: rotate(calc(var(--r0) + var(--sw) * .25)) scale(1) }
  64%  { transform: rotate(calc(var(--r0) - var(--sw) * .8)) scale(.98) }
  84%  { transform: rotate(calc(var(--r0) + var(--sw) * .7)) scale(.9) }
  100% { transform: rotate(calc(var(--r0) - var(--sw) * .3)) scale(.7) }
}

/* ── StatusFX (buff/debuff/heal over a card — see StatusFX in game.js) ── */
/* high-z layer for effects that must sit OVER the centred card-showcase (z122): negate */
.status-fx-top { position: fixed; inset: 0; pointer-events: none; z-index: 140; overflow: visible; }
.status-fx-top > * { position: absolute; will-change: transform, opacity; }
@keyframes sfxGlow { 0% { opacity: 0 } 25% { opacity: 1 } 70% { opacity: .8 } 100% { opacity: 0 } }
@keyframes sfxBuffIcon {
  0% { transform: translate(-50%,-50%) scale(0) rotate(-8deg); opacity: 0 }
  20% { transform: translate(-50%,-50%) scale(1.22) rotate(4deg); opacity: 1 }
  38% { transform: translate(-50%,-50%) scale(1) rotate(0); opacity: 1 }
  74% { transform: translate(-50%,-58%) scale(1); opacity: 1 }
  100% { transform: translate(-50%,-74%) scale(.9); opacity: 0 }
}
@keyframes sfxHealHeart {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 0 }
  16% { transform: translate(-50%,-50%) scale(1.2); opacity: 1 }
  30% { transform: translate(-50%,-50%) scale(.94) }
  44% { transform: translate(-50%,-50%) scale(1.1) }
  62% { transform: translate(-50%,-55%) scale(1); opacity: 1 }
  100% { transform: translate(-50%,-80%) scale(.86); opacity: 0 }
}
@keyframes sfxArrowRise {
  0% { transform: translate(-50%,-50%) translateY(0) scale(.55); opacity: 0 }
  18% { transform: translate(-50%,-50%) translateY(calc(var(--rise,80px)*-.2)) scale(1); opacity: 1 }
  100% { transform: translate(-50%,-50%) translateY(calc(var(--rise,80px)*-1)) scale(.85); opacity: 0 }
}
@keyframes sfxHealRise {
  0% { transform: translate(-50%,-50%) translate(0,0) scale(.4); opacity: 0 }
  22% { opacity: 1 }
  100% { transform: translate(-50%,-50%) translate(var(--dx,0px), calc(var(--rise,60px)*-1)) scale(.7); opacity: 0 }
}
@keyframes sfxSpeedLine {
  0% { transform: translate(-50%,-50%) translateY(0) scaleY(.5); opacity: 0 }
  30% { opacity: .85 }
  100% { transform: translate(-50%,-50%) translateY(calc(var(--rise,60px)*-1)) scaleY(1); opacity: 0 }
}
@keyframes sfxCrackBlink {
  0% { opacity: 0 } 6% { opacity: 1 } 14% { opacity: .15 } 22% { opacity: 1 } 34% { opacity: .4 }
  46% { opacity: 1 } 60% { opacity: .45 } 74% { opacity: 1 } 90% { opacity: .7 } 100% { opacity: 0 }
}
@keyframes sfxChainSlam {
  0% { transform: translate(-50%,-50%) scale(1.6) rotate(-6deg); opacity: 0 }
  12% { transform: translate(-50%,-50%) scale(.92) rotate(2deg); opacity: 1 }
  24% { transform: translate(-50%,-50%) scale(1.05) rotate(0) }
  34% { transform: translate(-50%,-50%) scale(1) }
  82% { opacity: 1 }
  100% { transform: translate(-50%,-50%) scale(.98); opacity: 0 }
}
/* Cartoon smoke puff: grows, drifts and disperses. Drives the no-KYC vanish/return
   (StatusFX 'hide'); ported from the impact-effects.html playground. */
@keyframes sfxSmokePop {
  0% { transform: translate(-50%,-50%) translate(0,0) scale(.32) rotate(0); opacity: 0 }
  16% { opacity: .96; transform: translate(-50%,-50%) translate(calc(var(--tx,0px)*.32), calc(var(--ty,0px)*.32)) scale(.92) rotate(var(--r,16deg)) }
  58% { opacity: .9; transform: translate(-50%,-50%) translate(calc(var(--tx,0px)*.72), calc(var(--ty,0px)*.72)) scale(1.24) rotate(calc((var(--r,16deg) + var(--r2,36deg))*.5)) }
  100% { transform: translate(-50%,-50%) translate(var(--tx,0px), var(--ty,0px)) scale(1.5) rotate(var(--r2,36deg)); opacity: 0 }
}

/* ── no-KYC (Shillobi, the Undoxxed): the hidden hero on the board ──
   Faded, desaturated and slightly out of focus — "still there, but nobody can see
   it". EVERYTHING goes in `filter` on purpose: the base .card rule already
   transitions filter, so the vanish and the return ease instead of snapping, and no
   second transition/animation declaration can fight the lunge or the dying keyframes.
   The theatrical half (the smoke) is StatusFX 'hide'. */
.card.hero-hidden { filter: grayscale(0.7) brightness(0.62) opacity(0.55) blur(0.6px); }
/* SILENCED (Shadowban): the hero stays in full view and fully playable, only washed out, so it
   reads as "switched off" next to its neighbours. In `filter` for the same reason as above. */
.card.hero-silenced { filter: grayscale(0.6) brightness(0.9); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.card.hit { animation: shake 400ms ease-out; }

.card.dying { animation: die 800ms forwards; }
/* EL FANTASMA de un hueco: la carta que acaba de caer, terminando su animación de muerte
   (ver `deathGhosts` en game.js). Ocupa el hueco como lo ocupaba la carta, pero es INERTE —
   el hueco ya está libre para el motor, y un fantasma que se pudiera tocar dejaría clicar a
   un muerto o bloquearía el drop de la siguiente invocación. */
.slot-ghost { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
@keyframes die {
  0%   { opacity: 1; transform: scale(1); filter: brightness(1); }
  50%  { opacity: 1; transform: scale(1.1) rotate(4deg); filter: brightness(2) saturate(2); }
  100% { opacity: 0; transform: scale(0) rotate(20deg); filter: blur(8px); }
}

/* damage popup */
.dmg-pop {
  position: absolute; left: 50%; top: 30%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 24px;
  color: #fca5a5;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 14px rgba(239, 68, 68, 0.5);
  pointer-events: none;
  z-index: 30;
  animation: floatUp 1200ms both;   /* `both`: an animation-delay (staggered popups) holds it invisible (0% keyframe) until its turn */
  letter-spacing: 0.02em;
}
.dmg-pop.heal { color: #86efac; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 14px rgba(34, 197, 94, 0.5); }
.dmg-pop.buff { color: var(--gold-bright); font-size: 16px; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 12px rgba(245, 193, 74, 0.55); }
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -10px) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(1); }
}

/* ============== "ATACÓ" indicator (hero exhausted) ============== */
.card.done-attack {
  filter: grayscale(0.55) brightness(0.78);
  opacity: 0.85;
}
@media (hover: hover) and (pointer: fine) {
  .card.done-attack:hover {
    filter: grayscale(0.2) brightness(0.95);
    opacity: 1;
  }
}
.done-attack-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 11px;
  background: rgba(8, 16, 31, 0.88);
  color: #cbd5e1;
  border: 1.5px solid #64748b;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  z-index: 4;
  pointer-events: none;
  white-space: nowrap;
}

/* ============== HOVER PREVIEW OVERLAY (LATERAL, centered with breathing room) ============== */
/* Position: max() picks the larger of (a) safety minimum and (b) the offset that
   horizontally centers the card inside the lateral zone outside the 720px field-row.
   Math: lateral_center = (3W + 720) / 4  →  right_offset = (W - 720)/4 - cardHalf  →  25% - 305px */
.card-preview-overlay {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 80;
  pointer-events: none;
  animation: previewIn 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card-preview-overlay.right { right: max(24px, calc(25% - 330px)); }
.card-preview-overlay.left  { left:  max(24px, calc(25% - 330px)); }
@keyframes previewIn {
  from { opacity: 0; transform: translateY(-50%) scale(0.88); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}
/* Hand-card peek: floats centred just above the player's hand (instead of off to
   a side). Height-capped so it always fits the viewport, even on short landscape. */
.card-preview-overlay.center {
  left: 50%;
  right: auto;
  top: auto;
  bottom: clamp(80px, 15vh, 152px);
  transform: translateX(-50%);
  animation: previewInCenter 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card-preview-overlay.center .card.preview {
  height: min(62vh, 430px);
  width: auto;
  aspect-ratio: 5 / 7;
}
@keyframes previewInCenter {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.9); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============== CARD SHOWCASE (spell / trap reveal) ============== */
.card-showcase {
  position: fixed;
  inset: 0;
  z-index: 122;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: showcaseIn 340ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* The reveal is centred for every activation (hero / spell / trap). The side
   classes are still set by JS but no longer offset the card. */
.card-showcase.right, .card-showcase.left { left: 0; right: 0; }
.card-showcase-label {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(8, 16, 31, 0.92);
  color: var(--gold-bright);
  border: 1.5px solid rgba(245, 193, 74, 0.6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.card-showcase.kind-trap .card-showcase-label {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.6);
}
.card-showcase .card.preview {
  /* Same centre-reveal width as the summon/draw cards; the detail card uses the
     CardMaker 5:7 ratio so the full-art board fills it without letterboxing. */
  width: var(--reveal-w);
  height: auto;
  aspect-ratio: 5 / 7;
  animation: showcaseFloat 1.4s ease-in-out infinite alternate;
}
@keyframes showcaseIn {
  0%   { opacity: 0; transform: scale(0.45) rotate(-8deg); }
  55%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
/* SPELL SHOT (Whale Dump / Genesis Beam, see SPELL_SHOT_FX in game.js): after the reveal the
   card slides to the LEFT at mid-height, centred on the midpoint between the rival's deck and
   the arena's left edge (`--spell-shot-x`, measured by the App) and shrinks (shot-aim), charges there like a ranged
   hero (shot-charge: the same heroBeam tremble + glow, release kick at 68 %) and fires
   (shot-fired). Its exit leaves from where it stands, not from the centre.
   Moved with `translate` / `scale`, not `transform`: the phone rules (max-width 820 px,
   max-height 520 px) centre the reveal with `transform: none !important`, which kept the
   card firing from the middle of the screen. `--spell-shot-scale` is smaller on a phone. */
.card-showcase.shooting {
  translate: calc(var(--spell-shot-x, 12vw) - 50vw) 0;
  scale: var(--spell-shot-scale, 0.62);
  transition: translate 400ms cubic-bezier(0.3, 0.9, 0.3, 1), scale 400ms cubic-bezier(0.3, 0.9, 0.3, 1);
}
.card-showcase.shooting .card-showcase-label { opacity: 0; transition: opacity 160ms; }
.card-showcase.shot-charge .card.preview,
.card-showcase.shot-fired .card.preview {
  animation: heroBeam var(--beam-dur, 1400ms) linear both, heroBeamGlow var(--beam-dur, 1400ms) ease-in-out both;
}
/* !important: the same phone rules also set `animation: none !important` on the reveal */
.card-showcase.shooting.exiting {
  animation: showcaseShotOut 300ms cubic-bezier(0.55, 0, 0.68, 0.35) forwards !important;
}
@keyframes showcaseShotOut {
  0%   { opacity: 1; }
  100% { opacity: 0; translate: calc(var(--spell-shot-x, 12vw) - 50vw) -10px; scale: calc(var(--spell-shot-scale, 0.62) * 0.65); }
}
/* Exit: the card lifts + shrinks away, clearing the board right before its
   deferred effect (popups / HP changes) resolves underneath. */
.card-showcase.exiting {
  animation: showcaseOut 300ms cubic-bezier(0.55, 0, 0.68, 0.35) forwards;
}
/* A negated spell (counter-trap) doesn't shrink away — it's cut out INSTANTLY (no
   size change) on the same beat as the green crack/negate FX. Overrides the shrink.
   Only for a lone reveal; the PAIRED layout cuts just its negated column (below). */
.card-showcase.cut:not(.paired), .card-showcase.cut.exiting:not(.paired) {
  animation: none !important;
  transition: none !important;
  opacity: 0 !important;
  transform: none !important;
}

/* ---- Counter-trap pair: the trap (LEFT) and the card it negated (RIGHT), shown
   together at the centre of the duel field so the cancel reads at a glance. ---- */
.card-showcase-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(12px, 3.4vw, 36px);
}
.cs-pair-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
/* Two cards must share the width, so size them by HEIGHT (the 5:7 ratio gives the
   width) — that keeps the pair inside the viewport at any board size. */
.card-showcase.paired .card.preview {
  width: auto;
  height: min(46vh, 330px);
  aspect-ratio: 5 / 7;
}
.card-showcase-label.negated {
  color: #7dffa0;
  border-color: rgba(57, 255, 90, 0.6);
}
/* The negated card dies WITH the effect, not before it. It starts on the same beat as
   the negate FX and mirrors sfxChainSlam exactly — same duration (--negate-fx-dur, set
   from JS), same 82%→100% fade window, and the same easing StatusFX gives its nodes
   (see node() in game.js) — so the card and the chains reach zero on the same frame.
   The trap card is untouched and exits with the normal showcase animation. */
.card-showcase.paired.cut .cs-pair-negated {
  animation: negateVanish var(--negate-fx-dur, 1300ms) cubic-bezier(.18, .9, .3, 1) forwards;
}
@keyframes negateVanish {
  0%, 82% { opacity: 1; }
  100%    { opacity: 0; }
}
@keyframes showcaseOut {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.62) translateY(-26px); }
}
/* Spell/trap reveals use ornate, transparent-cornered template cards, so the
   old rectangular box-shadow glow framed a box that didn't match the silhouette
   (the "brillo exterior" bug). The glow is removed entirely; the reveal stays
   alive with a gentle vertical float, and the template art carries its own
   silhouette-hugging drop-shadow for depth. */
@keyframes showcaseFloat {
  from { transform: translateY(2px); }
  to   { transform: translateY(-5px); }
}

/* ============== SPELL ACTIVATION — RUNIC CIRCLE ============== */
/* When a spell LANDS in its board slot, a glowing sigil arc sweeps in behind the
   card while random particles twinkle around it. Rendered inside the SpellSlot
   (before the card, so it paints behind), centred on the slot — on the field,
   not at the centre showcase. */
.spell-rune-fx { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
/* Rotating arc of light, masked to a thin ring band (silhouette-agnostic). */
.spell-rune-ring {
  position: absolute; left: 50%; top: 50%;
  width: 168%; aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(0.6);
  border-radius: 50%; mix-blend-mode: screen; opacity: 0;
  background: conic-gradient(from 0deg,
    rgba(96, 165, 250, 0) 0deg, rgba(147, 197, 253, 0.75) 40deg, rgba(96, 165, 250, 0) 90deg,
    rgba(96, 165, 250, 0) 180deg, rgba(147, 197, 253, 0.6) 220deg, rgba(96, 165, 250, 0) 270deg,
    rgba(96, 165, 250, 0) 360deg);
  -webkit-mask: radial-gradient(closest-side, transparent 60%, #000 63%, #000 73%, transparent 76%);
          mask: radial-gradient(closest-side, transparent 60%, #000 63%, #000 73%, transparent 76%);
  animation: spellRune 700ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes spellRune {
  0%   { opacity: 0;    transform: translate(-50%, -50%) rotate(-70deg) scale(0.55); }
  34%  { opacity: 0.95; transform: translate(-50%, -50%) rotate(30deg)  scale(1); }
  100% { opacity: 0;    transform: translate(-50%, -50%) rotate(90deg)  scale(1.12); }
}
/* Random particles that titilate around the sigil. left/top (% of the slot) are
   set inline so they scale to the board card; `both` fill so a delayed particle
   holds its 0% frame, not its base style. */
.spell-rune-part {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(closest-side, #fff, rgba(147, 197, 253, 0.9) 40%, rgba(96, 165, 250, 0) 75%);
  box-shadow: 0 0 5px rgba(147, 197, 253, 0.85); opacity: 0;
  transform: translate(-50%, -50%);
  animation: spellRunePart 760ms ease-out both;
}
@keyframes spellRunePart {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.25); }
  28%  { opacity: 1; }
  68%  { opacity: 1; transform: translate(-50%, -50%) translateY(-5px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-12px) scale(0.5); }
}

/* (Old per-class preview overrides removed — the new card structure
   defines `.card.preview` sizing inside the CARD section above.) */

/* ============== SUMMON ANIMATION (sparks + glow) ============== */
/* The hero arrives by shrinking from the centre reveal into its slot; on landing
   it only plays a subtle settle (no brightness flash) while a soft gold glow and
   a random spark burst accompany it. The glow + sparks are DOM elements rendered
   BEHIND the card (see SummonSparks), so they paint behind it and never fight the
   ornate template silhouette. */
@keyframes summonSettle {
  0%   { opacity: 0; transform: scale(1.035); }
  45%  { opacity: 1; transform: scale(1.006); }
  100% { opacity: 1; transform: scale(1); }
}
.card.summoning {
  animation: summonSettle 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* SummonSparks layer: a soft gold halo that blooms + fades, plus a burst of
   randomised gold sparks that fan out along curved paths and twinkle. Rendered
   before the card so the whole layer sits behind it. */
/* Sparks paint IN FRONT of the card (rendered after it) so they fan out over and
   past the card edges instead of being hidden behind an opaque card. */
.summon-sparks { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 6; }
/* The soft halo paints BEHIND the card (rendered before it) — a glow around the edges. */
.summon-glow {
  position: absolute; left: 50%; top: 50%; width: 162%; height: 162%;
  transform: translate(-50%, -50%) scale(0.62);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(245, 193, 74, 0.58), rgba(245, 193, 74, 0.16) 55%, rgba(245, 193, 74, 0) 72%);
  mix-blend-mode: screen; filter: blur(3px); opacity: 0;
  animation: summonGlow 540ms ease-out both;
}
@keyframes summonGlow {
  0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.6); }
  40%  { opacity: 0.62; transform: translate(-50%, -50%) scale(1.04); }
  100% { opacity: 0;    transform: translate(-50%, -50%) scale(1.3); }
}
.summon-spark {
  position: absolute; border-radius: 50%;   /* left/top set inline (% of the slot box) */
  background: radial-gradient(closest-side, #fff, var(--gold-bright, #fde68a) 42%, rgba(245, 193, 74, 0) 78%);
  box-shadow: 0 0 9px rgba(253, 230, 138, 0.95);
  opacity: 0; transform: translate(-50%, -50%);
  /* per-spark --dx/--dy (outward), --mx/--my (lateral bow → curved path); duration
     + delay set inline. `both` so a delayed spark holds its 0% frame, not its base
     (a delayed spark with `forwards` would sit visible at centre until it starts).
     It stays bright through the fly-OUT (fades only in the last quarter) so the
     sparks read clearly against the board, not just while over the card. */
  animation: summonSpark 620ms cubic-bezier(0.16, 0.7, 0.24, 1) both;
}
@keyframes summonSpark {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); filter: brightness(1); }
  14%  { opacity: 1; }
  55%  { transform: translate(calc(-50% + var(--dx, 0px) * 0.62 + var(--mx, 0px)), calc(-50% + var(--dy, 0px) * 0.62 + var(--my, 0px))) scale(1.05); filter: brightness(1.7); }
  76%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.7); filter: brightness(1); }
}

/* (Old size-specific overrides for stat-block/stat-label removed —
   the new card structure handles compact vs preview via .compact class.) */

/* ============== SIDEBAR (log + actions) ============== */
.sidebar {
  display: flex; flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; flex-direction: column;
  min-height: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.30);
}
.panel h4 {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  margin: 0 0 10px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.log {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(14px, 1.05vw, 18px);
  line-height: 1.45;
  min-height: 0;
}
.log-entry {
  padding: clamp(8px, 0.8vw, 12px) clamp(6px, 0.6vw, 10px) clamp(8px, 0.8vw, 12px) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  grid-template-columns: clamp(30px, 2.4vw, 40px) 1fr;
  gap: clamp(9px, 0.8vw, 14px);
  align-items: start;
  line-height: 1.4;
}
.log-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(30px, 2.4vw, 40px);
  height: clamp(30px, 2.4vw, 40px);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-size: clamp(14px, 1.1vw, 18px);
  flex-shrink: 0;
}
.log-icon img { width: 84%; height: 84%; object-fit: contain; display: block; }
.log-text { min-width: 0; word-break: break-word; }
.log-entry.player b { color: var(--player-bright); font-weight: 600; }
.log-entry.ai b     { color: var(--ai-bright); font-weight: 600; }
.log-entry.system   { color: var(--text-dim); font-style: italic; font-size: clamp(13px, 0.95vw, 16px); }
.log-entry.system .log-icon { background: rgba(148, 163, 184, 0.12); }
.log-entry.damage   { color: #fca5a5; }
.log-entry.damage .log-icon { background: rgba(239, 68, 68, 0.16); }
.log-entry.heal     { color: #86efac; }
.log-entry.heal .log-icon { background: rgba(34, 197, 94, 0.16); }
.log-entry.player .log-icon { background: rgba(59, 130, 246, 0.16); }
.log-entry.ai .log-icon     { background: rgba(239, 68, 68, 0.16); }

.action-bar {
  display: flex; flex-direction: column; gap: 6px;
}
.hint {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--gold-bright);
  padding: 9px 12px;
  border: 1px solid rgba(245, 193, 74, 0.45);
  background: rgba(245, 193, 74, 0.08);
  border-radius: 8px;
  text-align: center;
  line-height: 1.4;
}

/* ---- Topbar tools (log icon + restart) ---- */
.topbar-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 10px;
  cursor: pointer; padding: 5px; color: var(--text);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); } }
.icon-btn:active { transform: scale(0.93); }
.log-btn img { width: 36px; height: 36px; object-fit: contain; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }

/* ---- Mirrored HUD bars (CPU top / player bottom): one identical nameplate
   holding avatar + name + stars + energy, vertically mirrored. ---- */
.bar-row {
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-height: 0;
  /* The bars sit ABOVE the fanned hand cards so a card never bleeds over them. */
  position: relative;
  z-index: 40;
}
/* Breathing room between each life bar and the adjacent hand/field so the bar
   doesn't read as glued to the cards. */
.bar-row-ai { margin-bottom: 4px; }
.bar-row-player { margin-top: 4px; }
.player-bar {
  position: relative;            /* positioning context for the centred stars */
  display: flex;
  align-items: center;
  width: 100%;                   /* full display width */
  gap: clamp(8px, 1vw, 14px);
  padding: 5px 18px 5px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  /* Dense "liquid glass": a heavy frosted blur + a mostly-opaque tinted base so
     whatever sits behind the bar is no longer clearly readable. */
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
/* Energy is pushed to the far right; avatar + name stay on the left. */
.player-bar .energy-meter { margin-left: auto; }
/* Stars sit dead-centre in the bar regardless of the side content. */
.player-bar .star-meter { position: absolute; left: 50%; transform: translateX(-50%); }
.player-bar.pb-ai {
  background: linear-gradient(180deg, rgba(40, 16, 20, 0.7), rgba(22, 13, 16, 0.66));
  border-color: rgba(248, 113, 113, 0.38);
}
.player-bar.pb-player {
  background: linear-gradient(180deg, rgba(16, 28, 52, 0.7), rgba(12, 16, 26, 0.66));
  border-color: rgba(96, 165, 250, 0.38);
}
/* Borderless avatar — the artwork fills the whole circle. */
.pb-avatar {
  width: clamp(42px, 4.1vw, 52px);
  height: clamp(42px, 4.1vw, 52px);
  border-radius: var(--av-radius, 22%);
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  flex: none;
  overflow: hidden;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
}
.pb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-name {
  font-family: var(--font-ui); font-weight: 700;
  font-size: clamp(14px, 1.6vw, 19px);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.pb-ai .pb-name     { color: var(--ai-bright); }
.pb-player .pb-name { color: var(--player-bright); }

/* ---- Player nameplate (round avatar + name) — identifies the opponent ---- */
.player-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: none;
}
.pt-avatar {
  width: clamp(46px, 5.2vw, 62px);
  height: clamp(46px, 5.2vw, 62px);
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 36%, #2b3142 0%, #171a24 78%);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.player-tag.ai .pt-avatar { border: 2px solid rgba(248, 113, 113, 0.6); }
.player-tag.player .pt-avatar { border: 2px solid rgba(96, 165, 250, 0.6); }
.pt-avatar img {
  width: 84%; height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.pt-name {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}
.player-tag.ai .pt-name { color: var(--ai-bright); }
.player-tag.player .pt-name { color: var(--player-bright); }

/* ---- Bottom action dock — restart (left) · actions (centre) · log (right) ---- */
.action-dock {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.5vw, 16px);
  padding: 4px 8px;
  padding-bottom: max(4px, var(--safe-b));
  min-height: 0;
}
.action-dock-center { display: flex; justify-content: center; min-width: 0; }
.action-dock-center .action-bar { width: 100%; max-width: 460px; gap: 8px; }
.action-dock .action-bar { width: 100%; max-width: 460px; gap: 8px; }
/* The side buttons sit at the same height as the action button (48px). */
.action-dock .dock-side-btn {
  width: 48px; height: 48px;
  flex: none;
  padding: 7px;
  border-radius: 12px;
}
.action-dock .dock-side-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.action-dock .restart-btn img { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
/* The dock's primary slot keeps ONE fixed footprint: a button and a message
   occupy the exact same box (same width, height, padding and 1px border), so
   the layout never resizes when it swaps between showing a button or text. */
.action-dock .btn,
.action-dock .hint {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.3;
  border-radius: 12px;
  text-align: center;
}
/* A message drops the frame/background (the border stays 1px but transparent
   so the box height matches a button) — so it reads as plain text and can't
   be mistaken for a tappable button. */
.action-dock .hint {
  border-color: transparent;
  background: none;
}

/* The dock doubles as the turn indicator: while the rival plays, it shows a
   pulsing "ENEMY'S TURN" instead of an inert disabled END TURN. */
.btn.enemy-turn {
  border-color: rgba(248, 113, 113, 0.55);
  /* Strong frosted dark base under the red tint so the text reads over the busy
     battlefield behind it (a faint translucent red was hard to read). */
  background:
    linear-gradient(180deg, rgba(248, 113, 113, 0.22), rgba(239, 68, 68, 0.12)),
    rgba(8, 11, 20, 0.85);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--ai-bright);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  animation: enemyTurnPulse 1.8s var(--ease-in-out) infinite;
}
.btn.enemy-turn:disabled { opacity: 1; cursor: default; }
@keyframes enemyTurnPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
  50%      { box-shadow: 0 2px 16px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
}

/* ============== GAME OVER ============== */
/* Full-screen victory / defeat page (not a modal). */
.gameover {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  overflow: hidden;
  background:
    radial-gradient(ellipse 72% 58% at 50% 40%, rgba(245, 193, 74, 0.18), transparent 62%),
    linear-gradient(180deg, #0b1426 0%, #060a14 68%, #04060d 100%);
  animation: gameoverFadeIn 0.45s var(--ease-out) both;
}
.gameover.lose {
  background:
    radial-gradient(ellipse 72% 58% at 50% 40%, rgba(239, 68, 68, 0.16), transparent 62%),
    linear-gradient(180deg, #160c14 0%, #0a0710 68%, #04060d 100%);
}
/* EMPATE: el mismo fondo pero en acero, sin el oro de la victoria ni el rojo de la derrota. */
.gameover.draw {
  background:
    radial-gradient(ellipse 72% 58% at 50% 40%, rgba(148, 178, 224, 0.15), transparent 62%),
    linear-gradient(180deg, #0c1220 0%, #070b14 68%, #04060d 100%);
}
@keyframes gameoverFadeIn { from { opacity: 0; } to { opacity: 1; } }
/* Victoria con CORTINILLA (FX.victoryIntro variantes 7..12, ver GameOverScreen): el tablero se
   queda a la vista hasta que la cortinilla lo tapa (~460ms de su barrido) y solo entonces se funde
   este fondo. Sin el retraso el duelo se desvanecía primero y la cortinilla barría una pantalla ya
   vacía: el corte quedaba al descubierto y el barrido parecía llegar tarde. */
.gameover.wipe-intro { animation-delay: 460ms; animation-duration: 160ms; }
/* The duel under a game-over screen that already covers it (GameOverScreen adds the class when its
   fade-in ends): not painted, so its layers free their GPU memory for the victory and the rewards. */
html.duel-covered .battlefield { visibility: hidden; }

.gameover-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px 24px;
  padding-top: max(40px, var(--safe-t));
  overflow-y: auto;
}
.gameover-screen .reward-box { max-width: min(440px, 92vw); }
.gameover-victory-icon {
  display: block; width: clamp(120px, 22vw, 184px); height: auto; margin: 0 auto 6px;
  filter: drop-shadow(0 10px 28px rgba(245, 193, 74, 0.6));
  animation: victoryPop 0.5s var(--ease-out) backwards;
}
@keyframes victoryPop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
.gameover-screen h2 {
  font-family: var(--font-display);
  font-size: clamp(48px, 11vw, 92px);
  margin: 0 0 12px;
  letter-spacing: 0.04em;
  animation: victoryPop 0.5s var(--ease-out) 0.08s backwards;
}
.gameover-screen h2.win {
  background: linear-gradient(180deg, #fde68a 0%, #f5c14a 60%, #b8861a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 16px rgba(245, 193, 74, 0.55));
}
.gameover-screen h2.lose {
  background: linear-gradient(180deg, #fca5a5 0%, var(--ai) 60%, #7f1d1d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 16px rgba(239, 68, 68, 0.5));
}
.gameover-screen h2.draw {
  background: linear-gradient(180deg, #f1f6ff 0%, #b8c9e6 60%, #5d7397 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 16px rgba(148, 178, 224, 0.45));
}
.gameover-screen p {
  font-family: var(--font-body); font-weight: 500;
  font-size: clamp(15px, 2.2vw, 19px);
  color: var(--text-dim); margin: 0 0 6px; line-height: 1.5;
}
.gameover-actions { margin-top: 26px; }
.gameover-btn { padding: 16px 44px; font-size: 16px; border-radius: 14px; letter-spacing: 0.1em; }

/* Temporary gold counter (top-right) that the reward coins fly into. */
.gold-hud {
  position: fixed; top: max(18px, var(--safe-t)); right: 20px;
  z-index: 520;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 18px 9px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(46, 35, 12, 0.96), rgba(22, 15, 4, 0.96));
  border: 1px solid rgba(245, 193, 74, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 22px rgba(245, 193, 74, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: goldHudIn 0.5s var(--ease-out) both;
}
.gold-hud img { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.gold-hud-num {
  font-family: var(--font-display); font-size: 24px;
  color: var(--gold-bright); font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  display: inline-block; will-change: transform;
}
.gold-hud-num.coin-pop { animation: coinTargetPop 240ms var(--ease-out); }
.gold-hud.gone { animation: goldHudOut 0.5s var(--ease-out) forwards; }
@keyframes goldHudIn  { from { opacity: 0; transform: translateX(44px) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes goldHudOut { from { opacity: 1; transform: translateX(0) scale(1); } to { opacity: 0; transform: translateX(44px) scale(0.9); } }

/* ============== FIELD AREA (graveyard · hero slots · deck) ============== */
/* Symmetric: the graveyard sits to the LEFT of the hero slots and the deck to
   the RIGHT — equal columns either side of the centred field-row. */
.field-area {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(4px, 0.6vw, 9px);
  min-height: 0;
  width: 100%;
  padding: 0 6px;
}
.side-zones {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 0;
  /* Wide enough to hold a deck/graveyard now sized to the full hero-slot height. */
  width: clamp(104px, 11vw, 150px);
}

/* ============== ZONE SLOT (deck + graveyard share base styling) ============== */
/* Fixed clamp() height, width derived from 11:16 aspect-ratio — visually echoes
   a card/hero slot at smaller scale. Two slots stack vertically without
   competing for percentage-based space. */
.zone-slot {
  height: clamp(82px, 10vh, 108px);
  aspect-ratio: 11 / 16;
  width: auto;
  flex-shrink: 0;
  border: 1.5px solid var(--border-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.25));
  display: flex;
  flex-direction: column;
  padding: 5px;
  gap: 3px;
  position: relative;
  overflow: hidden;
  font-family: var(--font-ui); font-weight: 700;
  color: var(--text);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.zone-slot[data-empty="true"] { opacity: 0.45; }
.zone-slot.side-player { border-color: rgba(96, 165, 250, 0.35); }
.zone-slot.side-ai     { border-color: rgba(248, 113, 113, 0.35); }

.zone-art {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.zone-empty-mark {
  font-size: clamp(18px, 3vh, 26px);
  opacity: 0.5;
  color: var(--text-dim);
}
.zone-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 4px 1px;
  border-top: 1px solid var(--border-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.zone-label { color: var(--text-dim); font-weight: 700; font-size: var(--hud-label); letter-spacing: 0.1em; }
.zone-count {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: var(--hud-num);
  font-variant-numeric: tabular-nums;
}
/* (per-side count colours removed — the deck/GY count is now gold for both sides) */

/* ----- Deck slot: stack of card backs ----- */
.deck-stack {
  position: relative;
  width: 70%;
  height: 90%;
  max-width: 60px;
  max-height: 78px;
}
.deck-stack-layer {
  position: absolute;
  border-radius: 6px;
  background: linear-gradient(160deg, #1e2a47 0%, #0f1729 100%);
  border: 1.5px solid rgba(96, 165, 250, 0.30);
  box-shadow: 0 2px 5px rgba(0,0,0,0.55);
}
.deck-stack-layer.l1 { inset: 0 4px 6px 0; z-index: 3; }
.deck-stack-layer.l2 { inset: 2px 2px 4px 2px; z-index: 2; opacity: 0.85; }
.deck-stack-layer.l3 { inset: 4px 0 2px 4px; z-index: 1; opacity: 0.7; }
.zone-slot.side-player .deck-stack-layer { border-color: rgba(96, 165, 250, 0.45); }
.zone-slot.side-ai     .deck-stack-layer { border-color: rgba(248, 113, 113, 0.45); }
/* Deck art icon (replaces the abstract card-back stack). Fills the (large,
   frameless) deck slot — no small caps. */
.deck-stack-img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 3px 7px rgba(0,0,0,0.6));
  transition: transform .15s ease, filter .15s ease;
}

/* ----- Deck + graveyard: deboxed, enlarged, equal-sized — big icon + count.
   Both are sized the same so they "square up" visually in the side column. ----- */
.deck-slot,
.graveyard-slot {
  border: none;
  background: none;
  box-shadow: none;
  overflow: visible;     /* let the draw-hand animate below the deck */
  padding: 2px 2px 18px; /* bottom room for the floating label */
  /* Match the hero-slot height so deck · slots · graveyard line up as one row
     (top & bottom edges aligned), not a small icon floating mid-height. */
  height: 100%;
  max-height: 100%;
}
/* Label + count float BELOW the icon (absolute) so the long "GRAVEYARD" text
   can't widen the slot — deck and graveyard keep identical (aspect) widths. */
.deck-slot .zone-footer,
.graveyard-slot .zone-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-top: none;
  justify-content: center;
  gap: 5px;
  font-size: 10px;
  white-space: nowrap;
  padding: 0;
}
.deck-slot .zone-count,
.graveyard-slot .zone-count { font-size: var(--hud-num); }

/* ----- Deck slot: "must draw" state — the beckoning hand below does the work,
   so no box/pulse on the (now frameless) deck. ----- */
.deck-slot.can-draw {
  cursor: pointer;
  appearance: none;
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  box-shadow: none;
  animation: none;
  touch-action: none;    /* let the drag-down-to-draw gesture work on touch */
}
@media (hover: hover) and (pointer: fine) {
  .deck-slot.can-draw:hover .deck-stack-img {
    transform: scale(1.05);
    filter: drop-shadow(0 5px 11px rgba(0, 0, 0, 0.7));
  }
}
.deck-slot.can-draw:active { transform: scale(0.97); }

/* Beckoning hand that says "draw a card": it emerges from the lower half of the
   deck and slides straight down (the drag-down-to-draw gesture), then repeats. */
.deck-draw-hand {
  position: absolute;
  left: 50%;
  top: 52%;              /* anchored in the lower half of the deck */
  width: clamp(50px, 6.5vh, 78px);
  height: auto;
  pointer-events: none;
  z-index: 6;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.7));
  animation: drawHandLoop 1.4s var(--ease-in-out) infinite;
}
@keyframes drawHandLoop {
  0%   { transform: translate(-50%, -28%); opacity: 0; }
  22%  { transform: translate(-50%, 0%);   opacity: 1; }
  68%  { transform: translate(-50%, 95%);  opacity: 1; }
  100% { transform: translate(-50%, 145%); opacity: 0; }
}

/* While dragging a draw, the deck's top card is "lifted" (dimmed) and a card-back
   ghost (positioned in JS at the pointer) follows the cursor/finger. */
.deck-slot.dragging .deck-stack-img { opacity: 0.32; }
.deck-drag-ghost {
  position: fixed;
  z-index: 250;
  width: clamp(86px, 11vw, 128px);
  height: auto;
  transform: translate(-50%, -50%) rotate(-5deg);
  pointer-events: none;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.6));
  will-change: left, top;
}

/* ----- Graveyard slot: clickable, single tombstone icon (mirrors the deck) ----- */
.graveyard-slot {
  cursor: pointer;
  appearance: none;
  font: inherit;
  color: inherit;
}
.graveyard-slot:disabled { cursor: not-allowed; }
.grave-img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.6));
  transition: transform .15s ease, filter .15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .graveyard-slot:not(:disabled):hover .grave-img {
    transform: scale(1.05);
    filter: drop-shadow(0 5px 11px rgba(0, 0, 0, 0.7));
  }
}
.graveyard-slot:not(:disabled):active .grave-img { transform: scale(0.97); }
.graveyard-slot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ============== GRAVEYARD MODAL ============== */
.grave-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: radial-gradient(ellipse at center, rgba(50, 10, 50, 0.55) 0%, rgba(2, 2, 12, 0.92) 60%);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: graveFadeIn 180ms ease-out;
}
@keyframes graveFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* The modal IS the graveyard scene: the night-hill painting (`UI/graveyard_bg.jpg`)
   fills the box at `cover`, anchored a little above centre so the moon stays in the
   header band and the lit graves land under the card grid. A vertical veil darkens
   only the top (title) and bottom (last row) so the middle keeps the painting's own
   light. `min-height` keeps a real landscape visible when the pile is empty or short.
   Ink border + relief bands come from the cartoon retrofit further down. */
.grave-modal {
  width: min(1120px, 100%);
  max-height: 92vh;
  min-height: min(680px, 92vh);
  background:
    linear-gradient(180deg, rgba(5, 9, 20, 0.58) 0%, rgba(5, 9, 20, 0.16) 24%, rgba(5, 9, 20, 0.22) 62%, rgba(5, 9, 20, 0.66) 100%),
    url('../UI/graveyard_bg.jpg') center 42% / cover no-repeat,
    #0a1020;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: graveScaleIn 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes graveScaleIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.grave-modal-player { border-color: rgba(96, 165, 250, 0.45); }
.grave-modal-ai     { border-color: rgba(248, 113, 113, 0.45); }

.grave-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  /* Over the painting: a dark strip that fades downward, so the title reads and the
     sky/moon still show through behind it. */
  background: linear-gradient(180deg, rgba(3, 6, 14, 0.55), rgba(3, 6, 14, 0.3));
}
.grave-title {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.grave-title-icon {
  width: clamp(44px, 3.8vw, 60px);
  height: clamp(44px, 3.8vw, 60px);
  object-fit: contain;
  opacity: 0.95;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.grave-title h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.6);
}
.grave-modal-player .grave-title h2 { color: var(--player-bright); }
.grave-modal-ai .grave-title h2     { color: var(--ai-bright); }

.grave-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-ui); font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.grave-close img { width: 21px; height: 21px; object-fit: contain; }
@media (hover: hover) and (pointer: fine) {
  .grave-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: var(--ai-bright);
    color: var(--ai-bright);
    transform: scale(1.05);
  }
}
.grave-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.grave-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(3, 6, 14, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-dim);
}
.grave-stat,
.grave-stat-total {
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.72);
  border: 1px solid var(--border-soft);
}
.grave-stat b { font-family: var(--font-display); font-size: 15px; }
.grave-stat[data-kind="ko"] b        { color: var(--ai-bright); }
.grave-stat[data-kind="played"] b    { color: #a78bfa; }
.grave-stat[data-kind="discarded"] b { color: var(--energy); }
.grave-stat-total {
  margin-left: auto;
  border-color: rgba(245, 193, 74, 0.4);
}
.grave-stat-total b { color: var(--gold-bright); font-family: var(--font-display); font-size: 15px; }

.grave-body {
  padding: 18px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.grave-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  gap: 12px;
  padding: 40px 0;
  color: var(--text-dim);
}
.grave-empty span { font-size: 48px; opacity: 0.6; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7)); }
.grave-empty p {
  font-family: var(--font-body); font-size: 20px; margin: 0;
  color: var(--text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8), 0 0 14px rgba(0, 0, 0, 0.7);
}

.grave-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px 14px;
  justify-items: center;
}
.grave-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  cursor: zoom-in;
  animation: graveCardIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.grave-card-wrap:focus-visible {
  outline: 2px solid var(--gold-bright, #f5c14a);
  outline-offset: 3px;
  border-radius: 10px;
}
@keyframes graveCardIn {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.grave-card-wrap .card {
  width: 140px;
  cursor: zoom-in;
  /* The drop-shadow grounds the card on the painted dirt instead of floating over it. */
  filter: grayscale(0.25) brightness(0.92) drop-shadow(0 8px 8px rgba(0, 0, 0, 0.6));
  transition: filter .15s ease, transform .15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .grave-card-wrap:hover .card {
    filter: grayscale(0) brightness(1.05) drop-shadow(0 12px 10px rgba(0, 0, 0, 0.65));
    transform: translateY(-2px);
  }
}
.grave-card-wrap.reason-ko .card {
  filter: grayscale(0.45) brightness(0.78) drop-shadow(0 8px 8px rgba(0, 0, 0, 0.6));
}
.grave-card-wrap.reason-ko .card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(255, 30, 30, 0.18) 100%);
  pointer-events: none;
}
/* Plain text label under each card — no box, border or background. */
.grave-card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  text-align: center;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  /* Labels sit straight on the painting: ink shadow keeps them legible over grass/dirt. */
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.7);
}
.grave-tag {
  letter-spacing: 0.03em;
  color: var(--text);
  line-height: 1.2;
}
.grave-tag.tag-ko        { color: #fca5a5; }
.grave-tag.tag-played    { color: #c4b5fd; }
.grave-tag.tag-discarded { color: var(--energy); }
.grave-tag.tag-sacrifice { color: #ff8db0; }
.grave-tag.tag-negated   { color: #9fb3c8; }
.grave-tag.tag-destroyed { color: #fca5a5; }
.grave-turn {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ============== TRAP CARD IN HAND (dimmed — reactive only) ============== */
/* Dimming is the only cue now — the floating "REACTIVA" / "LÍMITE" tags that
   used to sit over hand cards have been removed. */
.card.dimmed {
  opacity: 0.78;
  filter: saturate(0.85);
  position: relative;
}
@media (hover: hover) and (pointer: fine) { .card.dimmed.in-hand:hover { opacity: 1; } }

/* Blocked: hero unable to be summoned right now (limit reached) */
.card.blocked {
  opacity: 0.55;
  filter: grayscale(0.6) brightness(0.8);
  cursor: not-allowed;
}
@media (hover: hover) and (pointer: fine) { .card.blocked.in-hand:hover { opacity: 0.75; transform: translateY(-4px) scale(1.02); } }

/* ============== REACTION MODAL v2 (drag a trap from the hand) ============== */
/* Non-blocking: the overlay/dim don't capture pointer events, so the real hand at
   the bottom stays usable; the dim fades out over the hand so it isn't darkened. */
.rx-overlay {
  position: fixed; inset: 0; z-index: 1100; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: clamp(8px, 2.5vh, 30px);
}
.rx-dim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8,6,16,0.62) 0%, rgba(8,6,16,0.5) 52%, rgba(8,6,16,0) 80%);
  animation: cardModalIn 200ms ease;
}
.rx-panel {
  position: relative; z-index: 2; pointer-events: auto;
  width: min(620px, 94vw);
  display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 1.6vh, 18px);
  padding: clamp(14px, 2vh, 22px) clamp(16px, 2.4vw, 26px);
  border-radius: 20px; border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(28,22,46,0.97), rgba(12,10,24,0.98));
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: cardModalIn 220ms var(--ease-out);
}
.rx-panel.urgent { border-color: var(--danger); box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 22px rgba(239,68,68,0.5); }
/* MINIMISE (see ReactionPopup): a small round button in the panel's corner folds the panel away
   so the board can be read; the window stays on screen as its timer bar, docked at the top,
   with a button to bring the panel back. The moves themselves (shrink out, pop in, the bar
   travelling) are played from JS with a soft bounce; here is only the resting state. */
.rx-min, .rx-restore {
  display: grid; place-items: center; padding: 0; cursor: pointer; pointer-events: auto;
  border-radius: 999px; border: 2px solid var(--gv-ink, #070f1d);
  background: linear-gradient(180deg, rgba(60, 52, 92, 0.96), rgba(30, 24, 52, 0.98));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 3px 0 rgba(0, 0, 0, 0.4);
  transition: transform .14s var(--ease-out), filter .14s ease;
}
@media (hover: hover) and (pointer: fine) { .rx-min:hover, .rx-restore:hover { transform: translateY(-1px); filter: brightness(1.18); } }
.rx-min:active, .rx-restore:active { transform: translateY(1px); filter: brightness(0.94); }
.rx-min:focus-visible, .rx-restore:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.rx-min svg, .rx-restore svg { fill: none; stroke: var(--gold-bright); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.rx-min {
  position: absolute; top: clamp(8px, 1.2vh, 12px); right: clamp(8px, 1vw, 12px); z-index: 3;
  width: clamp(28px, 2.6vw, 34px); height: clamp(28px, 2.6vw, 34px);
}
.rx-min svg { width: 62%; height: 62%; }
.rx-restore { flex: none; gap: 2px; grid-auto-flow: column; height: clamp(30px, 3.2vw, 38px); padding: 0 10px 0 8px; }
.rx-restore img { width: clamp(18px, 1.9vw, 24px); height: auto; display: block; }
.rx-restore svg { width: clamp(16px, 1.6vw, 20px); height: clamp(16px, 1.6vw, 20px); }
.rx-overlay.is-min .rx-panel { display: none; }
.rx-overlay.is-min .rx-dim { opacity: 0; }
.rx-dim { transition: opacity .25s ease; }
.rx-overlay.is-min .rx-timer { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .rx-min, .rx-restore, .rx-dim { transition: none; } }
.rx-title { display: flex; align-items: center; gap: 10px; text-align: center; }
/* trap_card.png trae ~20 % de lienzo vacio por cada lado: a 28-40 px el dibujo se quedaba en 22-30 px, mas
   pequeno que el titulo. Mas grande, y con margen negativo para que la cabecera no crezca por ese aire. */
.rx-title { gap: 4px; }
.rx-title-icon { width: clamp(52px, 5.6vw, 76px); height: auto; margin: -12px -6px -12px -10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.rx-title h2 { margin: 0; font-family: var(--font-display); font-size: clamp(15px, 2.1vw, 23px); color: var(--gold-bright); letter-spacing: 0.02em; }

.rx-attack { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1.2vw, 16px); }
.rx-card { position: relative; }
.rx-card .card { width: clamp(94px, 12vw, 132px); }
.rx-mid { display: flex; flex-direction: column; align-items: center; gap: 5px; width: clamp(64px, 7.6vw, 94px); }
.rx-swords { width: clamp(40px, 5vw, 60px); height: auto; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6)); }
.rx-arrow { display: flex; gap: 3px; }
.rx-arrow span {
  width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  border-left: 11px solid var(--danger); filter: drop-shadow(0 0 5px rgba(239,68,68,0.85));
  animation: rxArrow 1.05s var(--ease-in-out) infinite;
}
.rx-arrow span:nth-child(2) { animation-delay: 0.16s; }
.rx-arrow span:nth-child(3) { animation-delay: 0.32s; }
@keyframes rxArrow { 0%,100% { opacity: 0.22; transform: translateX(-3px); } 50% { opacity: 1; transform: translateX(4px); } }
.rx-card-tag {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px, 1.1vw, 13px); letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none;
}
.rx-card-tag.recoil { color: #fff; background: rgba(239,68,68,0.92); box-shadow: 0 0 10px rgba(239,68,68,0.6); }
/* Damage read-out between the two clashing cards: the HP your hero is left with if you
   PASS, and — once a trap sits in the slot — the HP it's left with if you ACTIVATE it.
   Red is the same preview red the card medallions use (TplStat's #ff4d4d). */
.rx-calc { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; margin-top: 3px; font-family: var(--font-ui); }
.rx-calc-label {
  font-weight: 800; font-size: clamp(8px, 0.82vw, 10px); letter-spacing: 0.06em;
  line-height: 1.1; white-space: nowrap; color: var(--text-muted);
}
.rx-calc-label.trap { color: var(--success); }
.rx-calc-val {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-family: var(--font-display); line-height: 1; color: #ff4d4d;
  font-size: clamp(17px, 2.1vw, 25px);
  text-shadow: 0 0 9px rgba(255,77,77,0.45), 0 2px 3px rgba(0,0,0,0.8);
}
.rx-calc-val .rx-calc-unit { font-family: var(--font-ui); font-weight: 800; font-size: 0.42em; opacity: 0.75; }
/* With a trap in the slot the baseline is only the reference → small, dimmed, struck out,
   so the eye lands on the outcome the trap actually buys. */
.rx-calc.has-trap .rx-calc-val.base { font-size: clamp(13px, 1.5vw, 17px); color: rgba(255,120,120,0.5); text-shadow: none; text-decoration: line-through; }
.rx-calc.has-trap .rx-calc-val.base .rx-calc-unit { opacity: 0.6; }
.rx-calc-sep { width: 0; height: 0; margin: 1px 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--success); }
.rx-calc-val.trap { animation: hpPreviewPulse 0.7s var(--ease-in-out) infinite; }
.rx-card-tag.blocked { color: #06371b; background: rgba(52,211,153,0.95); box-shadow: 0 0 10px rgba(52,211,153,0.6); }
.rx-spell { display: flex; justify-content: center; }
.rx-spell .card { width: clamp(110px, 14vw, 150px); }
.rx-spell-aura { position: absolute; inset: -14%; border-radius: 18px; background: radial-gradient(ellipse at 50% 50%, rgba(167,139,250,0.4), transparent 70%); filter: blur(8px); animation: rxTrapGlow 1.6s ease-in-out infinite; }
/* Buy the Dip reaction: the destroyed hero + a short prompt. */
.rx-dip { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.4vw, 14px); }
.rx-dip-text { margin: 0; max-width: 30ch; text-align: center; font-family: var(--font-ui); font-weight: 700; font-size: clamp(12px, 1.1vw, 14px); color: var(--text-dim); }
.rx-dip .rx-card .card { filter: grayscale(0.5) brightness(0.7); }
/* Phishing reaction: the enemy hand is hidden, so the cards at stake are BACKS, fanned. */
/* Liquidation: the hero at stake is still ALIVE, so it is shown in full colour (the Dip greys its dead one). */
.rx-liq .rx-card .card { filter: none; }
.rx-phish-backs { position: relative; display: flex; justify-content: center; padding-top: 6px; }
.rx-phish-back { width: clamp(84px, 10.5vw, 116px); aspect-ratio: 11 / 16; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.6)); }
.rx-phish-back + .rx-phish-back { margin-left: clamp(-58px, -5.2vw, -42px); transform: rotate(7deg) translateY(4px); }
.rx-phish-back:first-child:not(:only-of-type) { transform: rotate(-7deg) translateY(4px); }

.rx-slot {
  position: relative; width: clamp(116px, 15vw, 158px); aspect-ratio: 5 / 7;
  border-radius: 14px; border: 2px dashed color-mix(in srgb, var(--success) 65%, transparent);
  background: rgba(34,197,94,0.06); display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.rx-slot.over { border-color: var(--success); background: rgba(34,197,94,0.2); box-shadow: 0 0 20px rgba(34,197,94,0.55); transform: scale(1.05); }
.rx-slot.filled { border-style: solid; border-color: color-mix(in srgb, var(--success) 55%, transparent); background: transparent; }
.rx-slot-hint { font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 1.1vw, 14px); color: var(--success); text-align: center; padding: 10px; opacity: 0.9; }
.rx-slot-card { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.rx-slot-card .card { width: 100%; }
.rx-slot-clear { position: absolute; top: -9px; right: -9px; width: 28px; height: 28px; border-radius: 50%; background: rgba(20,16,30,0.95); border: 1px solid var(--border-strong); display: grid; place-items: center; cursor: pointer; z-index: 4; }
.rx-slot-clear img { width: 56%; height: 56%; object-fit: contain; }
.rx-actions { display: flex; gap: 12px; }
.rx-actions .ui-btn { padding: 11px 28px; font-size: 14px; }

/* timer below the panel: wide bar + hourglass that does a circular shake every 2s.
   pointer-events:none so it never intercepts a trap dragged from a hand whose
   (few/centered) cards sit under the bar — it's a non-interactive readout. */
.rx-timer {
  position: relative; z-index: 2; pointer-events: none; margin-top: clamp(8px, 1.4vh, 16px);
  display: flex; align-items: center; gap: 12px; width: min(620px, 94vw);
  padding: 8px 16px; border-radius: 999px; background: rgba(12,10,24,0.92); border: 1px solid var(--border-strong);
}
.rx-timer-icon { width: clamp(26px, 3vw, 36px); height: auto; transform-origin: 50% 50%; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); animation: rxHourglass 2s var(--ease-in-out) infinite; }
.rx-timer-bar { flex: 1; height: clamp(12px, 1.4vh, 18px); border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.rx-timer-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width 0.1s linear; }
.rx-timer.urgent .rx-timer-fill { background: linear-gradient(90deg, var(--danger), var(--ai-bright)); }
.rx-timer-text { font-family: var(--font-display); font-size: clamp(15px, 1.6vw, 20px); color: var(--gold-bright); min-width: 2.4em; text-align: center; font-variant-numeric: tabular-nums; }
.rx-timer.urgent .rx-timer-text { color: var(--ai-bright); }
@keyframes rxHourglass {
  0%, 64% { transform: rotate(0deg); }
  70% { transform: rotate(-16deg); } 76% { transform: rotate(14deg); }
  82% { transform: rotate(-10deg); } 88% { transform: rotate(8deg); }
  94% { transform: rotate(-4deg); } 100% { transform: rotate(0deg); }
}

/* the trap being dragged from the hand → modal slot */
.reaction-drag-ghost { position: fixed; left: 0; top: 0; z-index: 1300; pointer-events: none; width: clamp(108px, 13vw, 146px); will-change: transform; filter: drop-shadow(0 18px 30px rgba(0,0,0,0.6)); }
.reaction-drag-ghost .card { width: 100%; }
/* playable traps in the hand: lifted + pulsing green aura; the rest goes inert */
.hand-fan-slot.react-trap { transition: transform 0.22s var(--ease-out); }
.hand-fan-slot.react-trap .card.in-hand { cursor: grab; }
.hand-fan-slot.react-dim { filter: grayscale(0.55) brightness(0.55); pointer-events: none; }
.react-trap-glow {
  position: absolute; inset: -12%; z-index: -1; border-radius: 18px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(52,211,153,0.6), rgba(34,197,94,0.28) 45%, rgba(34,197,94,0) 72%);
  filter: blur(7px); animation: rxTrapGlow 1.4s ease-in-out infinite;
}
@keyframes rxTrapGlow { 0%,100% { opacity: 0.5; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.08); } }

/* ============== REACTION POPUP (legacy, unused) ============== */
.reaction-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: radial-gradient(ellipse at center, rgba(255, 63, 164, 0.18) 0%, rgba(2, 2, 12, 0.88) 60%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: reactionFadeIn 200ms ease-out;
}
@keyframes reactionFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.reaction-box {
  width: 100%;
  max-width: 760px;
  background: linear-gradient(180deg, rgba(24, 37, 63, 0.97) 0%, rgba(8, 16, 31, 0.97) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(8px);
}
.reaction-box.kind-attack { border-color: rgba(248, 113, 113, 0.45); }
.reaction-box.kind-spell  { border-color: rgba(167, 139, 250, 0.45); }
.reaction-timer {
  height: 8px;
  background: rgba(0, 0, 0, 0.55);
  position: relative;
}
.reaction-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--ai) 100%);
  transition: width 80ms linear;
}
.reaction-timer-text {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.reaction-box.urgent .reaction-timer-fill {
  animation: timerUrgent 0.5s ease-in-out infinite alternate;
}
@keyframes timerUrgent {
  from { filter: brightness(1); }
  to   { filter: brightness(1.4); }
}
.reaction-header {
  padding: 20px 26px 14px;
  text-align: center;
}
.reaction-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 13px 6px 9px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.18);
  color: var(--ai-bright);
  border: 1px solid rgba(248, 113, 113, 0.45);
  margin-bottom: 12px;
}
.reaction-tag-icon { width: 22px; height: 22px; object-fit: contain; }
.reaction-tag.tag-attack {
  background: rgba(239, 68, 68, 0.18);
  color: var(--ai-bright);
  border-color: rgba(248, 113, 113, 0.45);
}
.reaction-tag.tag-spell {
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.5);
}
.reaction-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: 0.02em;
}
.reaction-context {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--gold-bright);
  margin: 0;
  line-height: 1.2;
}
/* ============== REACTION STAGE (visual trigger) ============== */
/* The stage shows WHAT triggered the reaction so the defender can size up
   the threat at a glance. Attack stage = attacker → strike → defender.
   Spell stage = single card with aura. Mini Card components are reused,
   sized down here so three of them fit inside the modal width. */
.reaction-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 18px 14px;
  animation: stageIn 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes stageIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.reaction-stage.attack-stage { gap: 8px; }
.reaction-stage.spell-stage  { padding-top: 12px; padding-bottom: 18px; }

.stage-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.stage-card-wrap.stage-solo { gap: 10px; }

.stage-card-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 7.5px;
  letter-spacing: 1.4px;
  padding: 4px 8px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  white-space: nowrap;
}
.stage-card-label .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.attacker-dot { background: var(--neon-red); box-shadow: 0 0 6px var(--neon-red); }
.defender-dot { background: var(--neon-cyan); box-shadow: 0 0 6px var(--neon-cyan); }
.spell-dot    { background: var(--neon-purple); box-shadow: 0 0 6px var(--neon-purple); }
.stage-card-label.attacker { color: var(--neon-red); border-color: rgba(255, 77, 77, 0.45); }
.stage-card-label.defender { color: var(--neon-cyan); border-color: rgba(0, 229, 255, 0.45); }
.stage-card-label.spell    { color: var(--neon-purple); border-color: rgba(179, 136, 255, 0.55); }

.stage-card {
  position: relative;
  /* Reset cursor — these are display-only previews */
}
.stage-card .card {
  width: 128px !important;
  height: auto !important;
  aspect-ratio: 11 / 16;
  cursor: default !important;
  flex-shrink: 0;
  transform-origin: center;
}
.stage-card.stage-attacker .card {
  animation: attackerLoom 1.6s ease-in-out infinite alternate;
  box-shadow:
    0 6px 20px rgba(0,0,0,0.6),
    0 0 18px rgba(255, 77, 77, 0.45),
    inset 0 0 0 1px rgba(255, 77, 77, 0.35);
}
.stage-card.stage-defender .card {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.6),
    0 0 14px rgba(0, 229, 255, 0.35),
    inset 0 0 0 1px rgba(0, 229, 255, 0.3);
}
.stage-card.stage-spell .card {
  position: relative;
  z-index: 1;
  box-shadow:
    0 6px 24px rgba(0,0,0,0.65),
    0 0 24px rgba(179, 136, 255, 0.55),
    inset 0 0 0 1px rgba(179, 136, 255, 0.4);
}
@keyframes attackerLoom {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-2px) scale(1.02); }
}

.stage-stat {
  font-family: var(--font-ui); font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.stage-stat b { color: #fff; font-family: var(--font-display); font-size: 14px; margin-left: 2px; }

/* ---- Strike between attacker and defender ---- */
.stage-arrow {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 76px;
  padding: 0 4px;
}
.stage-arrow .strike-line {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 77, 77, 0.7) 20%,
    rgba(255, 77, 77, 1) 50%,
    rgba(255, 77, 77, 0.7) 80%,
    transparent 100%);
  box-shadow: 0 0 8px rgba(255, 77, 77, 0.65);
  position: relative;
}
.stage-arrow .strike-line::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 8px solid var(--neon-red);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  filter: drop-shadow(0 0 4px var(--neon-red));
}
.stage-arrow .strike-icon {
  font-size: 22px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-red), 0 0 12px var(--neon-yellow);
  animation: strikePulse 0.9s ease-in-out infinite alternate;
}
@keyframes strikePulse {
  from { transform: scale(1) rotate(-6deg); filter: brightness(1.0); }
  to   { transform: scale(1.18) rotate(6deg); filter: brightness(1.5); }
}
.stage-arrow .strike-glow {
  position: absolute;
  inset: -6px;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, rgba(255, 77, 77, 0.25) 0%, transparent 70%);
  animation: strikeBreath 1.4s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes strikeBreath {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}
.stage-arrow .strike-damage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(8, 16, 31, 0.85);
  border: 1.5px solid rgba(248, 113, 113, 0.5);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
  font-family: var(--font-ui); font-weight: 700;
  margin-top: 3px;
}
.stage-arrow .dmg-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stage-arrow .dmg-value {
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
}
.stage-arrow .dmg-lethal {
  margin-top: 3px;
  font-size: 7.5px;
  letter-spacing: 1.4px;
  padding: 2px 5px;
  border-radius: 2px;
  background: var(--neon-red);
  color: #2a0000;
  animation: lethalFlash 0.6s ease-in-out infinite alternate;
}
@keyframes lethalFlash {
  from { box-shadow: 0 0 0 transparent; transform: scale(1); }
  to   { box-shadow: 0 0 10px var(--neon-yellow); transform: scale(1.05); }
}
.stage-arrow.lethal .strike-icon {
  color: #fff;
  text-shadow: 0 0 10px var(--neon-red), 0 0 18px var(--neon-yellow);
}

/* ---- Spell aura around the casted card ---- */
.spell-aura {
  position: absolute;
  inset: -22px;
  border-radius: 18px;
  background: radial-gradient(ellipse at center, rgba(179, 136, 255, 0.55) 0%, rgba(179, 136, 255, 0.15) 40%, transparent 75%);
  animation: spellBreath 1.4s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}
@keyframes spellBreath {
  from { opacity: 0.6; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1.04); }
}

/* ---- Section header above the trap grid ---- */
.reaction-traps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 26px 0;
  border-top: 1px solid var(--border-soft);
  margin-top: 6px;
}
.reaction-traps-title {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.reaction-traps-icon { width: 22px; height: 22px; object-fit: contain; }
.reaction-traps-hint {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-dim);
}

.reaction-traps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 12px 24px 14px;
}
.reaction-trap {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015));
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 14px 12px;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  font-family: var(--font-ui);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  min-height: 144px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.reaction-trap-cost {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(160deg, #ffd60a 0%, #b8860b 100%);
  border: 1.5px solid #fff6c4;
  color: #1a1100;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 10px;
  box-shadow: 0 0 10px rgba(255, 214, 10, 0.6), 0 2px 4px rgba(0,0,0,0.4);
}
.reaction-trap-cost .cost-icon { font-size: 11px; line-height: 1; }
.reaction-trap-cost .cost-value { font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) {
  .reaction-trap:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--gold-bright);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 18px rgba(245, 193, 74, 0.35);
  }
}
.reaction-trap:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.reaction-trap-emoji {
  font-size: 40px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}
.reaction-trap-name {
  font-family: var(--font-ui); font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #fff;
}
.reaction-trap-desc {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.35);
  padding: 7px 10px;
  border-radius: 6px;
  width: 100%;
}
.reaction-skip {
  display: block;
  margin: 6px auto 18px;
  min-width: 200px;
}

/* ============== RESPONSIVE ============== */
/* The battlefield is a single centred column at every width now (topbar ·
   battlefield · action dock), so no column-count changes are needed here. */
@media (max-height: 700px) {
  /* Squeeze the detail card on short viewports so it fits inside the hover zone
     without scrolling. The board scales itself to fit (5:7 ratio kept). */
  .card.preview { width: 260px; height: 364px; }
}

/* ============================================================
   MOBILE-FIRST UX  —  bottom action bar, log drawer, touch polish
   New chrome (.mobile-bar / .log-drawer) is hidden on desktop and
   activated in the ≤820px block. Applies Emil Kowalski's craft rules:
   custom easing, :active press feedback, hover gating, dvh, reduced motion.
   ============================================================ */
.card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* Stop iOS long-press (image callout / text selection) from hijacking the
     in-game hold/peek and drag gestures. */
  -webkit-touch-callout: none;
  user-select: none; -webkit-user-select: none;
}
/* Field heroes: the battlefield doesn't scroll, so disable native pan/zoom on
   them entirely — our pointer handlers fully own tap / hold / drag-to-attack. */
.slot .card { touch-action: none; }

/* ---- Battle-log drawer (bottom sheet) — all screen sizes, opened from the
   topbar log icon. Slides up over the board; scrim taps close it. ---- */
.log-drawer { display: block; position: fixed; inset: 0; z-index: 240; pointer-events: none; }
.log-drawer-scrim {
  position: absolute; inset: 0;
  border: 0; padding: 0; margin: 0;
  background: rgba(2, 4, 10, 0.55);
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
  cursor: pointer;
}
.log-drawer-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: min(720px, 96vw); margin: 0 auto;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(24, 37, 63, 0.98), rgba(8, 16, 31, 0.98));
  border: 1px solid var(--border-strong); border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.6);
  padding: 10px clamp(14px, 1.6vw, 26px) calc(clamp(16px, 1.6vw, 24px) + var(--safe-b));
  transform: translateY(100%);
  transition: transform 360ms var(--ease-drawer);
  backdrop-filter: blur(10px);
}
.log-drawer.open { pointer-events: auto; }
.log-drawer.open .log-drawer-scrim { opacity: 1; }
.log-drawer.open .log-drawer-sheet { transform: translateY(0); }
.log-drawer-handle {
  width: 38px; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  margin: 2px auto 8px; flex: 0 0 auto;
}
.log-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: clamp(6px, 0.8vw, 12px); flex: 0 0 auto;
}
.log-drawer-head h4 {
  font-family: var(--font-ui); font-weight: 700;
  font-size: clamp(13px, 1.15vw, 18px); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); margin: 0;
}
.drawer-close {
  width: clamp(40px, 3vw, 48px); height: clamp(40px, 3vw, 48px); border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .14s var(--ease-out), background .15s ease;
}
.drawer-close img { width: clamp(20px, 1.9vw, 26px); height: clamp(20px, 1.9vw, 26px); object-fit: contain; }
.drawer-close:active { transform: scale(0.94); }
.log-drawer .log {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* Flat chrome surfaces get a subtle press response (cards animate on their own) */
.deck-card, .graveyard-slot, .reaction-trap, .zone-slot, .drawer-close, .grave-close {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.deck-card:active,
.reaction-trap:active,
.graveyard-slot:not(:disabled):active { transform: scale(0.98); }

/* On touch, :hover sticks after a tap — neutralize lift/shadow hovers so a
   tapped element doesn't stay raised. Feedback comes from :active instead. */
@media (hover: none) {
  .btn:hover:not(:disabled),
  .deck-card:hover,
  .graveyard-slot:not(:disabled):hover,
  .reaction-trap:hover,
  .grave-card-wrap:hover .card {
    transform: none;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  }
  .card.in-hand:hover { transform: none; }
}

/* ---------------- PHONE / NARROW (≤ 820px) ---------------- */
@media (max-width: 820px) {
  body { overflow: hidden; }

  /* The duel shell stays a full-bleed stage on phones too (HUD lives inside the
     battlefield). Landscape is enforced via the .rotate-gate. */
  .sidebar { display: none; }

  /* ---- Topbar: compact single row ---- */
  .topbar { padding: 7px 10px; gap: 8px; border-radius: 12px; }
  /* The CPU nameplate + stars identify the screen — drop the decorative brand on
     phones so the row stays a single tidy line. */
  .topbar .brand { display: none; }
  .hud-avatar { width: 34px; height: 34px; font-size: 18px; }
  .hud-name { font-size: 12px; max-width: 84px; }
  .turn-pill { padding: 6px 10px; font-size: 10px; letter-spacing: 0.08em; }
  .kill-counters { gap: 6px; }
  .kill-meter { padding: 4px 8px; gap: 5px; }
  .km-label { font-size: 9px; letter-spacing: 0.05em; }
  .km-count b { font-size: 15px; }
  .tombs { display: none; }              /* keep the X/3 number; drop pips to save width */
  .topbar .btn { padding: 9px 12px; font-size: 11px; }

  /* ---- Battlefield: tighter, fills the middle row ---- */
  .battlefield { padding: 8px 6px; gap: 4px; border-radius: 14px; }
  /* Spell rows: compact on phones; keep them aligned with the hero columns. */
  .spell-row { max-width: 100%; gap: 6px; padding: 0; }
  .spell-slot { height: clamp(40px, 6vh, 56px); border-radius: 8px; }
  .spell-slot.empty .slot-hint { font-size: 7px; letter-spacing: 0.06em; }
  .side-label { font-size: 10px; padding: 0 2px; }
  .side-label .stats { font-size: 11px; gap: 8px; }
  .field-center { min-height: 8px; }

  /* AI hand backs: small, never dominate */
  .hand-row.opponent { padding: 0 6px; }
  .hand-row.opponent .card-back { width: 24px; height: 35px; font-size: 13px; border-radius: 5px; }

  /* Field area: drop the symmetry spacer; shrink the deck/grave column.
     Column width must be ≥ the zone-slot's aspect-derived width (h × 11/16)
     or the slots clip against the battlefield's overflow:hidden. */
  .field-area { gap: 5px; padding: 0; }
  /* Narrower side columns so the 3 hero slots get more width (= bigger slots),
     while still fitting a deck/graveyard sized to match the slot height. */
  .side-zones { width: 80px; gap: 6px; }
  .side-zones-spacer { display: none; }
  .zone-slot { height: clamp(48px, 8vh, 70px); padding: 3px; border-radius: 9px; }
  /* Deck + graveyard sized to the hero-slot height so deck · slots · graveyard
     line up as one centred row (matches the desktop layout). */
  .deck-slot, .graveyard-slot { height: clamp(92px, 12vh, 108px); padding: 2px 2px 16px; }
  .deck-slot .zone-footer, .graveyard-slot .zone-footer { font-size: 9px; }
  .deck-slot .zone-count, .graveyard-slot .zone-count { font-size: 12px; }
  .deck-draw-hand { width: clamp(44px, 11vw, 60px); }
  .deck-drag-ghost { width: clamp(78px, 24vw, 104px); }
  .zone-footer { font-size: 7px; padding: 2px 2px 0; }
  .zone-label { letter-spacing: 0.03em; }
  .zone-count { font-size: 9px; }
  /* Centre the slots vertically in the (tall) field row so they sit at the same
     height as the centred deck/graveyard — one aligned row, not slots floating
     up top with the deck/grave lower down. */
  .field-row { gap: 6px; flex: 1 1 auto; padding: 2px; --col-gap: 6px; align-items: center; }
  /* Player row mirrors the mobile field-area: no left spacer, the energy column
     matches the 92px deck/graveyard column on the right, avatar at the far left. */
  .side-label-player { gap: 5px; padding: 0; justify-content: flex-start; }
  .side-label-player .sl-col-left { width: auto; }
  .side-label-player .sl-col-right { width: 92px; }
  .side-label-player .sl-mid { flex: 1 1 auto; }
  .slot { border-radius: 10px; gap: 3px; }
  /* HP bar lives inside the card now; keep it compact on phones. */
  .slot .card > .hp-bar { width: 86%; height: 13px; bottom: -7px; }
  .slot .card > .hp-bar .hp-num { font-size: 9px; }
  .slot.empty .slot-hint { font-size: 8px; letter-spacing: 0.06em; }

  /* Field cards fill the slot width (slot height gives them room). Names are
     hidden on the field (see base rules) — only art + stats + HP bar show. */
  .slot .card { height: auto; width: 100%; }
  .slot .card .stat-badge { width: clamp(24px, 6.6vw, 36px); height: clamp(24px, 6.6vw, 36px); }
  .slot .card .stat-badge-num { font-size: clamp(11px, 3.2vw, 17px); }
  .slot .card .energy-gem { width: clamp(26px, 6vw, 36px); }
  .slot .card .energy-gem-num { font-size: clamp(13px, 3.4vw, 18px); }

  /* ---- Player hand: horizontal scroll + snap, bigger touch targets ---- */
  .hand-row {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    gap: 8px;
    padding: 4px 8px 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
  }
  .hand-row::-webkit-scrollbar { display: none; }
  .hand-row .card.in-hand {
    width: clamp(92px, 27vw, 120px);
    scroll-snap-align: center;
  }
  /* The off-screen fly-in is clipped by the scroll container here, so the drawn
     card rises into the hand from below (out of the clipped edge) instead. */
  .card.drawing-in.draw-from-player { animation-name: cardDrawInMobile; }

  /* ---- Card peek (long-press) & showcase: flex-centered with a scrim.
     Center via flexbox (not transform) so the entrance animation lives on the
     inner card and never fights the position — a clean, origin-correct pop.
     The HAND peek (.center) is excluded: it floats above the hand instead. ---- */
  .card-preview-overlay:not(.center),
  .card-showcase {
    position: fixed;
    inset: 0;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    transform: none !important;
    animation: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 130;
  }
  .card-showcase { flex-direction: column; gap: 10px; z-index: 135; }
  .card-preview-overlay:not(.center)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 10, 0.62);
    backdrop-filter: blur(2px);
  }
  .card-preview-overlay:not(.center) .card.preview,
  .card-showcase .card.preview {
    animation: peekInCenter 180ms var(--ease-out);
  }
  /* Detail card uses CardMaker's 5:7 ratio so the full-art board fills it. */
  .card.preview { width: min(82vw, 320px); height: auto; aspect-ratio: 5 / 7; }
  .card-showcase .card.preview { aspect-ratio: 5 / 7; }
  /* Hand peek on mobile: keep it centred above the hand, height-capped to fit. */
  .card-preview-overlay.center { z-index: 130; }
  .card-preview-overlay.center .card.preview { width: auto; height: min(58vh, 360px); }
}

@keyframes peekInCenter {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Extra squeeze for small phones */
@media (max-width: 420px) {
  .topbar .brand { display: none; }
  .hand-row .card.in-hand { width: clamp(88px, 30vw, 112px); }
}

/* ============== WALLET (coins / packs) ============== */
.wallet-row { display: flex; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 5px 11px 5px 7px; font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text);
}
.wallet-chip b { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.wallet-icon { width: var(--icon-min); height: var(--icon-min); object-fit: contain; display: block; }
/* The swirl coin (icons/coin_reward.png) paints edge-to-edge: its opaque pixels fill
   ~90% of the PNG, while the icons --icon-min was tuned for (pack art, the old coin
   pile) fill ~55-65%. At the same box it therefore renders ~1.4x bigger and swallows
   the number, so the coin gets its own box (0.72 ~= 0.65/0.90 undoes the difference).
   The reward-flow chip is excluded: it sets its own 48px in fx-effects.css, already
   tuned against THIS coin in fx-lab, and this selector would otherwise outrank it. */
.wallet-chip.coins:not(.rf-coin-chip) .wallet-icon { width: calc(var(--icon-min) * 0.72); height: calc(var(--icon-min) * 0.72); }
.wallet-chip.coins b { color: var(--gold-bright); }
.wallet-chip.big { font-size: 17px; padding: 7px 14px 7px 9px; }

/* ---- Crypto wallet login ---- */
.wallet-login { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.wallet-connect {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 14px; letter-spacing: 0.04em;
  color: #2a1c00; text-decoration: none; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--gold-edge);
  background: var(--gold-face);
  box-shadow: var(--gold-relief);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), filter .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .wallet-connect:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: var(--gold-relief-hover); } }
.wallet-connect:active { transform: translateY(1px); filter: brightness(0.96); box-shadow: var(--gold-relief-press); }
.wallet-connect:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: var(--gold-relief); filter: none; }
.wallet-addr {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px; color: var(--gold-bright);
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 6px 12px; font-variant-numeric: tabular-nums;
}
.wallet-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 6px #3ddc84; flex-shrink: 0; }
.wallet-disconnect {
  font-family: var(--font-ui); font-weight: 600; font-size: 12px; color: var(--text-dim, #b9c0cc);
  background: transparent; border: none; cursor: pointer; padding: 4px 6px; border-radius: 8px;
  text-decoration: underline; text-underline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) { .wallet-disconnect:hover { color: var(--text); } }
.wallet-error { flex-basis: 100%; font-family: var(--font-ui); font-size: 12px; color: #ff7a7a; }

/* ============== SHOP ============== */
.shop-screen {
  /* El aire lateral, en una variable: el inventario se lo suma al hueco que centra su
     contenido y la rejilla de cosméticos se lo descuenta para sacar su barra de scroll al
     borde de la pantalla. El mismo número suelto en tres sitios se desincroniza al primer
     retoque. */
  --shop-pad-x: clamp(14px, 4vw, 72px);
  height: 100%; overflow-y: auto; overflow-x: hidden;
  padding: clamp(22px, 3vh, 40px) var(--shop-pad-x) clamp(40px, 5vh, 72px);
  padding-top: max(clamp(22px, 3vh, 40px), var(--safe-t));
  /* Fill wide PC screens — a hard 1100px cap left everything tiny on desktop. */
  max-width: min(1560px, 94vw); margin: 0 auto;
  /* As a flex child, allow shrinking to the viewport so the grids below can't
     force the screen wider than the device (which overflow-x would then clip). */
  min-width: 0; width: 100%;
}
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: clamp(20px, 2.4vw, 36px); }
/* Back arrow shown in the Inventory header when it's opened from Home. */
.shop-back-icon {
  flex: 0 0 auto; width: clamp(40px, 3.4vw, 52px); height: clamp(40px, 3.4vw, 52px);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface-0);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .15s ease, border-color .15s ease, transform .12s var(--ease-out);
}
.shop-back-icon img { width: 56%; height: 56%; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .shop-back-icon:hover { background: var(--surface-1); border-color: var(--border-strong); } }
.shop-back-icon:active { transform: scale(0.95); }
.shop-back-icon:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.shop-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.shop-head-icon { width: clamp(42px, 6vw, 74px); height: clamp(42px, 6vw, 74px); object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.45)); }
.shop-head h2 {
  margin: 0; font-family: var(--font-display); font-size: clamp(26px, 4vw, 50px);
  letter-spacing: 0.04em; color: var(--gold-bright);
}
/* Wallet pops whenever coins are spent so the cost lands with feedback. */
.wallet-chip.big.flash { animation: walletFlash 0.6s var(--ease-out); }
@keyframes walletFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245,193,74,0); }
  28% { transform: scale(1.14); box-shadow: 0 0 0 5px rgba(245,193,74,0.30); border-color: var(--gold-bright); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245,193,74,0); }
}
.shop-section-title {
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted); margin: 26px 0 14px; padding-left: 2px;
  display: flex; align-items: center; gap: 12px;
}
.shop-section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.inv-count { font-family: var(--font-display); font-size: clamp(17px, 1.4vw, 22px); letter-spacing: 0.02em; text-transform: none; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.shop-empty {
  font-family: var(--font-body); font-size: 13px; color: var(--text-muted); line-height: 1.5;
  padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: 14px; text-align: center;
}
/* Inventory = una estantería de sobres. Las tarjetas ya no son "mini" de verdad:
   el sobre es el objeto que el jugador viene a ver, así que manda él y la columna
   se dimensiona a su alrededor. */
.shop-inv-grid {
  display: grid; gap: clamp(18px, 1.9vw, 32px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(160px, 18.5vw, 274px)), 1fr));
  align-items: stretch;
}

.shop-card {
  position: relative; isolation: isolate;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--border-soft); border-radius: 18px; padding: 22px 18px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  backdrop-filter: blur(6px);
  transform: perspective(820px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.18s var(--ease-out), box-shadow 0.25s ease, border-color 0.25s ease;
  animation: shopCardIn 0.34s var(--ease-out) backwards;
}
@keyframes shopCardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; } }
/* Ambient rarity glow bleeding from behind the card. */
.shop-card::before {
  content: ''; position: absolute; inset: -16px; z-index: -1; border-radius: 28px;
  background: radial-gradient(52% 48% at 50% 38%, color-mix(in srgb, var(--accent, #4ea3ff) 42%, transparent), transparent 72%);
  filter: blur(14px); opacity: 0.42; transition: opacity 0.25s ease;
}
/* Hover affordances only on real pointer devices (avoid touch false-positives). */
@media (hover: hover) and (pointer: fine) {
  .shop-card.buy:hover {
    box-shadow: 0 18px 44px -16px color-mix(in srgb, var(--accent, #4ea3ff) 60%, transparent),
                0 6px 18px rgba(0,0,0,0.4);
    border-color: color-mix(in srgb, var(--accent, #4ea3ff) 45%, var(--border-strong));
  }
  .shop-card.buy:hover::before { opacity: 0.85; }
  .shop-card.buy:hover .shop-pack-art img { transform: scale(1.07); }
  .shop-card.rare:hover { border-color: transparent; }
}

.shop-pack-art { position: relative; width: clamp(120px, 9vw, 176px); height: clamp(120px, 9vw, 176px); display: flex; align-items: center; justify-content: center; }
.shop-pack-art img {
  width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.55));
  transition: transform 0.25s var(--ease-out);
}
.shop-card.buy .shop-pack-art { animation: packFloat 3.2s var(--ease-in-out) infinite; }
@keyframes packFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* 3D tilt is scoped to the PACK ART only (the panel stays still). The idle float is
   disabled on the storefront stage so the cursor-driven transform sticks. */
.store-stage .shop-pack-art {
  animation: none;
  transform: perspective(680px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.16s var(--ease-out);
  will-change: transform;
}
/* A LOT is one flat plane of overlapping copies — rotating it slides the packs through
   each other instead of reading as one object, so the tilt is off for the row. */
.store-stage .shop-pack-art.no-tilt { transform: none; will-change: auto; }

/* Contador de copias: un DISCO, no una píldora. Ancho y alto fijos e iguales (nada
   de `min-width`, que es lo que lo estiraba en cuanto la cifra tenía dos dígitos);
   con `tabular-nums` a este diámetro caben tres. El relieve es el de una moneda del
   kit: luz arriba a la izquierda, banda clara interior y sombra plana abajo. */
.owned-packs-badge {
  --badge-d: 26px;
  position: absolute; right: 2px; top: 2px;
  /* La chapa CRECE con la cifra en vez de apretarla contra el contorno: `min-width` (no
     `width`) más un anillo de aire a los lados. Con una sola cifra sigue siendo un
     círculo exacto —min-width = alto—; con dos deja de tocar la tinta. El radio pasa de
     `50%` a `999px` porque un 50 % sobre una caja más ancha que alta da una ELIPSE. */
  min-width: var(--badge-d); height: var(--badge-d); padding: 0 0.42em;
  border-radius: 999px; color: #1a1206;
  background:
    radial-gradient(68% 62% at 34% 26%, #ffeeb5, rgba(255,238,181,0) 62%),
    linear-gradient(180deg, #ffd873, var(--gold) 46%, #cf8d1e);
  font-family: var(--font-display); font-size: 14px; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.55),
    inset 0 -3px 0 rgba(122,72,10,0.35),
    0 3px 8px rgba(0,0,0,0.55);
}
.shop-card h3 { margin: 4px 0 0; font-family: var(--font-ui); font-weight: 800; font-size: clamp(19px, 1.5vw, 27px); letter-spacing: 0.03em; }
.shop-desc { margin: 0; font-size: clamp(13px, 1vw, 16px); color: var(--text-dim); line-height: 1.5; max-width: clamp(240px, 24vw, 360px); }

/* Premium "PREMIUM" pill on the rare pack. */
.shop-ribbon {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  font-family: var(--font-ui); font-weight: 800; font-size: 9.5px; letter-spacing: 0.14em;
  padding: 4px 9px; border-radius: 999px; color: #1a0a18;
  background: linear-gradient(100deg, #ffd76b, #ff9d2e 45%, #ff45c8);
  box-shadow: 0 3px 10px -2px rgba(255,69,200,0.6);
}
/* Holographic sheen sweeping across the rare card, clipped to its rounded box. */
.foil { position: absolute; inset: 0; z-index: 2; border-radius: 18px; overflow: hidden; pointer-events: none; }
.foil::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.16) 48%, rgba(255,255,255,0.04) 53%, transparent 60%);
  transform: translateX(-130%); animation: foilSweep 4.6s var(--ease-in-out) infinite;
}
@keyframes foilSweep { 0%, 58% { transform: translateX(-130%); } 82%, 100% { transform: translateX(130%); } }
/* Animated aurora border replaces the old static rainbow frame. */
.shop-card.rare {
  border: 1.5px solid transparent;
  /* Opaque dark fill (padding-box) masks the aurora gradient (border-box) so it
     only shows in the 1.5px ring — otherwise it floods the whole card. */
  background:
    linear-gradient(180deg, rgba(24,33,56,0.92), rgba(14,21,40,0.95)) padding-box,
    linear-gradient(90deg, #4ea3ff, #b06bff, #ff9d2e, #ff45c8, #4ea3ff) border-box;
  background-size: 100% 100%, 220% 100%;
  background-repeat: no-repeat, repeat;
  animation: shopCardIn 0.34s var(--ease-out) backwards, auroraBorder 7s linear infinite;
}
@keyframes auroraBorder { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 220% 0; } }
.shop-card.rare h3 {
  background: linear-gradient(90deg, #4ea3ff, #b06bff, #ff9d2e, #ff45c8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- Lucky Pack: GOLD treatment (the guaranteed Super-Rare+ pack from Buy-10). ---- */
.shop-ribbon.lucky {
  left: 12px; right: auto;   /* left, so it clears the count badge (top-right) */
  background: linear-gradient(100deg, #fff0b0, #ffce5a 45%, #ff9d2e);
  box-shadow: 0 3px 10px -2px rgba(255,180,60,0.65); color: #2a1a04;
}
.shop-card.lucky {
  border: 1.5px solid transparent;
  background:
    linear-gradient(180deg, rgba(46,37,14,0.92), rgba(28,22,9,0.95)) padding-box,
    linear-gradient(90deg, #ffe082, #ffb300, #ffd76b, #ff9d2e, #ffe082) border-box;
  background-size: 100% 100%, 220% 100%;
  background-repeat: no-repeat, repeat;
  animation: shopCardIn 0.34s var(--ease-out) backwards, auroraBorder 7s linear infinite;
}
.shop-card.lucky h3 {
  background: linear-gradient(90deg, #ffe082, #ffb300, #ff9d2e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.buy-free.lucky {
  color: #2a1a04; background: linear-gradient(180deg, #ffe082, #ffb300);
  border-color: #8a5a12; box-shadow: 0 3px 9px -2px rgba(255,180,60,0.7);
}
/* The stage shows the full portrait pack ART (not the square icon) and it's the hero of
   the screen, so it's sized off the SHORTER axis too — otherwise a wide-but-short laptop
   window blows it past the fold. */
/* Los TOPES suben (330->420 de ancho) ahora que la tienda usa todo el dispositivo: en un
   monitor grande el escaparate pasa a medir ~1230 px y el sobre se quedaba diminuto en
   medio de un descampado. Solo cambia ARRIBA — los terminos en vw/vh siguen mandando por
   debajo de 2100 px de ancho, asi que en un portatil el sobre mide exactamente lo que medía.
   La proporcion se mantiene: 420/594 = 330/466. */
.store-stage .shop-pack-art.detail-art {
  width: clamp(160px, min(19vw, 33vh), 420px);
  height: clamp(226px, min(27vw, 47vh), 594px);
}

/* "What you get": fixed slots first, THEN the special-card odds bar — so the bar
   below can't be mistaken for whole-pack pull odds. */
.pack-contents { width: 100%; max-width: min(360px, 100%); display: flex; flex-direction: column; gap: clamp(8px, 0.9vw, 12px); margin: clamp(6px, 0.8vw, 12px) 0 2px; }
/* WHAT YOU GET: el MISMO rotulo de titulo que el panel del Welcome Pack (`.bundle-title`),
   que vende justo al lado — display del juego en oro claro. El espaciado entre letras baja
   de 0.12em a 0.05em por lo mismo que alli: Bowlby One ya es muy ancha de por si. */
.pack-contents-label {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(13px, 1.05vw, 17px); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 12px rgba(245, 193, 74, 0.3);
}
.pack-slots { display: flex; flex-wrap: wrap; gap: 7px; }
.pack-slot {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.9vw, 14px); color: var(--text-dim);
  padding: 5px 11px 5px 9px; border-radius: 999px;
  background: var(--surface-0); border: 1px solid color-mix(in srgb, var(--rar) 30%, var(--border-soft));
}
.pack-slot::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--rar); box-shadow: 0 0 7px -1px var(--rar); flex-shrink: 0; }
.pack-slot b { font-family: var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.pack-slot.special::after { content: '★'; font-size: 0.9em; margin-left: 1px; }
/* ---- Las probabilidades de la 5a carta, colgando de la pastilla "Special" ----
   Vivian en una linea bajo los botones de compra. Ahora son un tooltip de la pastilla que
   YA nombra esa carta, que es donde el jugador las busca. El envoltorio es quien recibe el
   hover / el foco / el tap: la pastilla se pinta con `background-clip: text` y no puede
   llevar hijos visibles. */
.pack-slot-wrap { position: relative; display: inline-flex; cursor: help; }
.pack-slot-wrap:focus { outline: none; }
.pack-slot-wrap:focus-visible .pack-slot { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.pack-odds-tip {
  /* ABAJO y no arriba: hacia arriba se salia por el techo del panel y se leia como un
     globo suelto sobre el fondo. Aqui se queda dentro de la ficha y la flechita apunta a la
     pastilla. Tapa el selector de cantidad mientras esta abierto, que es lo que hace un
     tooltip. */
  position: absolute; top: calc(100% + 9px); left: 50%;
  z-index: 30; pointer-events: none;
  min-width: 158px;
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px 12px 10px;
  border-radius: 12px; border: 2px solid var(--gv-ink);
  background: linear-gradient(180deg, #1b2439 0%, #0c1220 100%);
  box-shadow: 0 14px 30px -8px rgba(0, 0, 0, 0.72), inset 0 2px 0 rgba(255, 255, 255, 0.07);
  opacity: 0; transform: translate(-50%, -5px) scale(0.96); transform-origin: top center;
  transition: opacity .14s ease, transform .18s var(--ease-out);
}
/* La flechita que lo ata a la pastilla: un cuadrado girado, con el mismo borde de tinta. */
.pack-odds-tip::after {
  content: ""; position: absolute; bottom: 100%; left: 50%;
  width: 10px; height: 10px; margin: 0 0 -7px -5px;
  background: #1b2439; border-left: 2px solid var(--gv-ink); border-top: 2px solid var(--gv-ink);
  transform: rotate(45deg);
}
.pack-odds-tip-title {
  font-family: var(--font-ui); font-weight: 700; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
}
/* Una fila por rareza, el % alineado a la derecha en cifras de ancho fijo para que la
   columna no baile entre sobres. */
.pack-odds-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  font-family: var(--font-ui); font-size: 12.5px; line-height: 1.15;
}
.pack-odds-name { color: var(--rar, #c9b48a); font-weight: 700; }
.pack-odds-pct { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
/* Abre con el puntero, con el teclado y con el tap (`.tip-open`, el estado de React): en
   tactil no hay hover NI foco, y estas cifras tienen que poder verse en cualquier pantalla. */
.pack-slot-wrap:focus-visible .pack-odds-tip,
.pack-slot-wrap.tip-open .pack-odds-tip { opacity: 1; transform: translate(-50%, 0) scale(1); }
/* El hover, SOLO con raton. Tras un tap el navegador deja el elemento en `:hover` hasta que
   tocas en otro sitio, asi que sin esta reja el segundo tap quitaba `.tip-open` y el tooltip
   se quedaba abierto igual: el boton parecia no cerrarse. */
@media (hover: hover) and (pointer: fine) {
  .pack-slot-wrap:hover .pack-odds-tip { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .pack-odds-tip { transition: none; } }

/* ---- Iridescent top prize ------------------------------------------------------------
   The Special slot and the best rarity in the odds (Ultra Rare) used to be flat orange,
   which reads as a warning colour rather than as the chase. They now shimmer through the
   spectrum. Deliberately VERY slow (`--irid-t`): it should be noticed on a second look,
   never compete with the pack art for attention.

   What makes it read as a soft sheen rather than a rainbow flag — all three matter:
   - The stops WALK the hue wheel in order (sky -> periwinkle -> lilac -> orchid -> rose ->
     peach -> cream -> lime -> mint -> back to sky). Every neighbour is an adjacent hue, so
     no transition is a jump. An earlier 5-stop version hopped blue -> violet -> gold ->
     pink -> teal and every stop landed as a hard colour change.
   - Low chroma, high lightness. These are pastels; the hue travels but the brightness
     barely moves, which is what keeps the shift from catching the eye.
   - ONE cycle per tile, and the tile is 200% of the element, so only HALF the wheel is
     ever spread across the text — about four adjacent hues, not nine. Density was the
     real offender: a full spectrum inside a 60px pill is a rainbow, not a sheen.
   - `background-position: P%` shifts by (P/100)x(W - tileW), so with a 200% tile the pair
     0% -> 200% travels exactly one tile and the loop is seamless. Other pairs snap once
     per cycle.
   The pill keeps its filled surface because `background-clip` is a per-layer list: layer 1
   (the spectrum) is clipped to the TEXT, layer 2 (the fill) to the padding box, so one
   element carries both. Only `background-position` animates -> compositor-friendly.
   `.best` is the top rarity of THAT pack's special slot, so this follows the chase card
   rather than being hard-wired to ultra. */
:root {
  --irid-t: 38s;
  --irid: linear-gradient(100deg,
    #a8d8ff 0%, #bcccff 11.1%, #d2c3fc 22.2%, #e9c1f0 33.3%, #ffc6dc 44.4%,
    #ffd3c0 55.5%, #f6e3b3 66.6%, #d8edb8 77.7%, #b2ecd6 88.8%, #a8d8ff 100%);
}
@keyframes shopIridescent {
  from { background-position: 0% 50%, 0 0; }
  to   { background-position: 200% 50%, 0 0; }
}
@keyframes shopIridescentSolid {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}
.pack-slot.special {
  color: transparent;
  border-color: rgba(255,255,255,0.34);
  background-image: var(--irid), linear-gradient(180deg, rgba(255,255,255,0.11), rgba(255,255,255,0.035));
  background-size: 200% 100%, auto;
  background-repeat: repeat, no-repeat;
  -webkit-background-clip: text, padding-box;
  background-clip: text, padding-box;
  animation: shopIridescent var(--irid-t) linear infinite;
}
.pack-slot.special b { color: inherit; }
.pack-slot.special::before {   /* the leading dot goes iridescent too */
  background-image: var(--irid);
  background-size: 200% 100%;
  box-shadow: 0 0 8px -1px rgba(255,255,255,0.55);
  animation: shopIridescentSolid var(--irid-t) linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .pack-slot.special, .pack-slot.special::before { animation: none; }
}

.shop-card .btn, .shop-card .ui-btn { margin-top: auto; }
.shop-buy-btn, .shop-open-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; font-size: 15px; }
.btn-coin { width: var(--icon-min); height: var(--icon-min); object-fit: contain; }

/* ============================================================================
   INVENTARIO · OBJETOS (skins, voces, efectos de impacto y de invocación)
   Cinco familias en pestañas. Las pestañas son el MISMO mando segmentado que las de
   SETTINGS (`.mission-tabs` / `.mission-tab`, con su contorno de tinta y el relieve
   de oro en la activa) para no inventar un mando nuevo. Sin cuenta encima: la del
   grupo abierto ya va en la chapa `.inv-count` de debajo.
   ============================================================================ */
/* LA BARRA DE SCROLL, AL BORDE DERECHO DE LA PANTALLA. Quien desplaza el inventario es
   `.shop-screen`, que estaba capado a `min(1560px, 94vw)` y centrado: en un monitor grande
   su barra caía a media pantalla, con un palmo de fondo muerto a la derecha. Ahora la caja
   que desplaza ocupa TODO el ancho y el tope se muda al PADDING — el contenido se ve en la
   misma banda centrada de siempre y lo único que se va al borde es la barra.
   La cuenta es la mitad del sobrante (0 en cuanto la pantalla es más estrecha que el tope,
   que es cuando no hay nada que centrar) más el aire lateral de siempre. */
.shop-screen.inventory-screen {
  max-width: none;
  padding-inline: calc(var(--shop-pad-x) + max(0px, (100% - min(1560px, 94vw)) / 2));
}

/* (0,2,0) como en SETTINGS y por el mismo motivo: `.mission-tabs` se define ~3200 líneas
   MÁS ABAJO, y su `margin: 4px 0 6px` le ganaría por posición a una regla de una clase
   escrita aquí. `flex-wrap` para que las cinco quepan en un móvil. */
.inventory-screen .inv-tabs { flex-wrap: wrap; margin: 18px 0 4px; }

.inv-item-grid {
  /* El hueco y el ANCHO DESEADO de columna, como variables: la tienda sólo cambia el
     segundo (`--inv-col`) y hereda todo lo demás, incluida la regla de las 3 columnas. */
  --inv-gap: clamp(12px, 1.2vw, 18px);
  --inv-col: clamp(408px, 31vw, 520px);
  display: grid; gap: var(--inv-gap); margin-top: clamp(14px, 1.6vh, 22px);
  /* En móvil manda el ancho deseado: si no cabe, una columna y punto. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--inv-col)), 1fr));
}
/* En PC, TRES COLUMNAS COMO MÍNIMO. `auto-fill` por sí solo no sabe decir eso — sólo divide
   por un ancho —, así que la pista se toma como el MENOR entre el ancho deseado y un tercio
   exacto del hueco: cuando el deseado no cabe tres veces, la pista ES un tercio y caben
   justo tres; cuando cabe de sobra, entran cuatro o más. Sin `calc` a mano: el `min()`
   resuelve las dos cuentas.
   1025 px es el mismo corte con el que la app pasa a la barra inferior de móvil. */
@media (min-width: 1025px) {
  .inv-item-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(var(--inv-col), (100% - var(--inv-gap) * 2) / 3), 1fr));
  }
}
/* La ficha: la carta dueña del efecto a la izquierda, el texto a la derecha. Contorno de
   tinta y relieve, como el resto de superficies del kit (ver el retrofit al final). */
.inv-item {
  display: flex; gap: clamp(12px, 1.1vw, 16px); align-items: stretch;
  padding: clamp(11px, 1vw, 15px);
  /* ALTO DEFINIDO, y es lo que hace posible el icono cuadrado a toda altura. Con el alto
     dictado por el TEXTO la cuenta es circular —el icono es tan ancho como alto es la
     ficha, y el texto se parte según el ancho que le deje el icono—: medido, Chrome la
     resolvía con un icono de 516 px y el texto aplastado a 0. Fijando el alto, el icono
     sale de él y ya no realimenta nada. El texto se recorta (ver los `line-clamp` de
     abajo) en vez de estirar la ficha. (Hubo una segunda razón, aparte de la circular:
     el paginador de la tienda medía UNA ficha y multiplicaba, así que necesitaba filas
     uniformes. Ese paginador ya no existe —la rejilla desplaza—, pero la circular sigue
     en pie y el alto fijo se queda.)
     Por eso "que se vea todo" se resuelve dando SITIO (más alto y más ancho) y no
     dejando crecer la ficha. Las tres cifras están MEDIDAS con el objeto de texto más
     largo del catálogo (Paris Penthouse) en las siete anchuras a las que cambia el
     número de columnas: el SUELO importa tanto como el techo, porque en un portatil de
     1366 caben tres columnas estrechas y es ahí donde el texto va más justo. */
  height: clamp(252px, 17.5vw, 300px);
  /* Contenedor de consulta para que el icono pueda TOPARSE con el ancho de ESTA ficha
     (`cqw`) y no comerse el texto en las columnas estrechas. Es `inline-size`: sólo el
     ancho, que es el que pone la rejilla. */
  container-type: inline-size;
  /* LA ALTURA DE LAS DOS ACCIONES de la ficha (preview y compra). Vive aqui, en la ficha, y
     no en la fila de compra, porque la leen LAS DOS COLUMNAS: el preview esta en la del
     dibujo y el precio en el pie del texto, y tienen que medir lo mismo para leerse como una
     sola fila. Sigue midiendose en `cqw` —contra el ancho de ESTA ficha— aunque se declare
     aqui: un `var()` resuelve sus unidades donde se USA, no donde se escribe. */
  --inv-act-h: clamp(44px, 16cqw, 56px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}
.inv-item.locked { opacity: 0.55; filter: grayscale(0.5); }
/* LA COLUMNA IZQUIERDA: dibujo + boton de vista previa, los dos del mismo ancho.
   Anclada ARRIBA (`flex-start`): la ficha empieza por su esquina superior izquierda — icono
   y nombre a la misma altura — en vez de con el icono flotando a media altura frente a un
   texto que arranca arriba. */
.inv-item-side {
  flex: 0 0 auto; align-self: flex-start;
  width: min(32cqw, 45%);
  display: flex; flex-direction: column; gap: clamp(10px, 0.9vw, 14px);
}
/* LAS DOS ACCIONES, EN LA MISMA LINEA, Y ARRIBA. Cuando hay algo que comprar (el pie solo se
   monta entonces, de ahi el `:has()`), PREVIEW y el precio van en la misma fila, justo debajo
   de lo que acabe MAS ABAJO: el dibujo o el texto. Con texto corto quedan donde esta el
   PREVIEW de un objeto ya poseido (pegado al dibujo); con texto largo bajan lo justo para no
   pisarlo. El hueco sobrante queda al fondo de la ficha.
   (Antes los dos se anclaban al FONDO de la ficha: alineados entre si, pero mas abajo que el
   PREVIEW del objeto poseido, y la tienda se leia con los botones a dos alturas.)
   Es una REJILLA de 2x2 (dibujo | texto / preview | pie) con las dos columnas en
   `display: contents`, porque el preview vive en la columna del dibujo y el pie en la del
   texto: solo una fila compartida los alinea sin medir nada.
   Las medidas van en `%` y no en `cqw`: la ficha ES el contenedor de consulta, y un `cqw`
   escrito en ella misma se resuelve contra el contenedor de FUERA (medido: el dibujo salia
   un 40 % mas grande). En una columna de rejilla, `32%` es lo mismo que el `32cqw` de
   `.inv-item-side`.
   La 1a fila mide lo que el dibujo como minimo y crece con el texto mientras quepan los
   botones; si no caben, el texto se recorta (`overflow: hidden`) como antes. */
.inv-item:has(.inv-item-foot) {
  display: grid;
  grid-template-columns: 32% minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: start;                         /* el sobrante, al fondo; no estira las filas */
  column-gap: clamp(12px, 1.1vw, 16px);
  row-gap: clamp(10px, 0.9vw, 14px);           /* el mismo aire dibujo-preview que en `.inv-item-side` */
}
.inv-item:has(.inv-item-foot) .inv-item-side,
.inv-item:has(.inv-item-foot) .inv-item-body { display: contents; }
.inv-item:has(.inv-item-foot) .inv-item-art { grid-area: 1 / 1; align-self: start; }
.inv-item:has(.inv-item-foot) .inv-item-info { grid-area: 1 / 2; min-height: 0; overflow: hidden; }
.inv-item:has(.inv-item-foot) .inv-item-preview { grid-area: 2 / 1; }
.inv-item:has(.inv-item-foot) .inv-item-foot { grid-area: 2 / 2; margin-top: 0; }
/* El arte va recortado y anclado ARRIBA: en una carta de héroe la cara está en el tercio
   superior, y centrado se quedaba en el cinturón.
   CUADRADO (1:1): los objetos que no son sobres comparten formato de icono. El arte de
   origen sigue siendo vertical, así que el recorte es más agresivo que con el 3:4 de
   antes — de ahí que el anclaje suba (ver `object-position` justo debajo). */
.inv-item-art {
  /* TODO el alto útil de la ficha, y cuadrado: se estira al alto (que `.inv-item` fija) y
     el 1:1 le da el ancho. Sólo funciona porque ese alto NO depende de lo que mida el
     icono; ver la nota de `.inv-item`. */
  /* El alto se declara (`100%`), no se estira: con `align-self: stretch` a secas Chrome
     dejaba el cuadrado 6 px corto, porque el ancho no se transfiere de un alto estirado.
     Y con TOPE en el ancho de la ficha (`34cqw`): en una columna estrecha un cuadrado de
     todo el alto dejaría el texto sin sitio. Ninguna de las dos cifras depende del
     contenido, así que no hay bucle. */
  /* `aspect-ratio: 1/1` con UNA sola medida dada: la otra sale de ella, así que el icono
     es CUADRADO siempre, mida lo que mida la ficha. El tope en `cqw` es lo que impide que
     al crecer la ficha el icono se coma el ancho del texto. */
  /* El ANCHO lo pone la columna (`.inv-item-side`) y el dibujo lo llena; el alto sale del
     `aspect-ratio`. Es lo que hace que el icono sea CUADRADO y que el boton de debajo mida
     exactamente lo mismo, sin que ninguna de las dos medidas este escrita dos veces. */
  width: 100%; height: auto;
  aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  position: relative;   /* ancla del rótulo de acabado que va sobre la imagen */
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08);
}
/* not inside a DECK BOX tile: the box's own imgs (logo) have their own sizing in deckbox.css.
   `:where()` keeps the exclusion WITHOUT adding weight (stays 0,1,1): a bare `:not(.is-box)`
   made this 0,2,1 and it beat the finer rules below — the FOIL wordmark of a skin
   (`.inv-item-finish`) blew up to the whole icon and the skin's own layers lost their fit. */
.inv-item-art:where(:not(.is-box)) img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; }
/* Una SKIN se enseña como en la carta: su FONDO al fondo, el brillo del acabado encima y
   el personaje ENTERO apoyado en el suelo. Es la ventana de arte de la carta sin el marco,
   y con el mismo orden de capas (en una carta de dos capas el brillo va DETRÁS). */
.inv-item-art.is-skin .inv-item-artbg,
.bundle-row-art.is-skin .inv-item-artbg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.inv-item-art.is-skin .inv-item-char,
.bundle-row-art.is-skin .inv-item-char {
  position: relative; z-index: 1;
  object-fit: contain; object-position: center bottom;
}
/* EL ACABADO de una skin, sobre su imagen y abajo al centro — el mismo sitio que ocupa en
   una carta del mazo. El alto va en % del icono (que cambia de tamaño con la ficha) y no
   en px, y las sombras apiladas son las de allí: siguen el ALFA del dibujo, así que el
   rótulo pastel se lee sobre cualquier arte sin dibujar un recuadro a su alrededor. */
.inv-item-art .inv-item-finish,
.bundle-row-art .inv-item-finish {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); z-index: 2;
  height: 19%; width: auto;
  filter:
    drop-shadow(0 0 1.5px rgba(4, 8, 17, 0.95))
    drop-shadow(0 1px 2px rgba(4, 8, 17, 0.9))
    drop-shadow(0 0 6px rgba(4, 8, 17, 0.72));
}
/* Un objeto con DIBUJO PROPIO (la calavera de Larry) no se recorta: es una estampa sobre
   transparencia, así que se pinta entera y con aire alrededor. */
.inv-item-art.is-icon { background: rgba(0, 0, 0, 0.42); }
.inv-item-art.is-icon img { object-fit: contain; object-position: center; padding: 9%; }
.inv-item-body { flex: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
/* Con WRAP: en un móvil estrecho caben el nombre y DOS etiquetas justas, y sin esto la que
   se recortaba era el nombre ("Rekt S…"). Al envolver, el nombre sale entero y las chapas
   bajan a su propia línea. En escritorio caben las tres en una y no cambia nada.
   `space-between` y NO `margin-left: auto` en las chapas: la fila tiene dos hijos (nombre y
   grupo de chapas), asi que con sitio para los dos el nombre va a la izquierda y las chapas
   a la derecha — lo de siempre —, pero cuando el nombre es tan largo que las echa abajo,
   `space-between` deja al hijo SOLO de esa linea pegado al principio. Con `margin-left:
   auto` se quedaba clavado a la derecha, colgando bajo el nombre y sin nada al lado. */
.inv-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; justify-content: space-between; }
/* Las chapas, JUNTAS: envuelven como una sola pieza (por eso caen las dos a la vez) y el
   orden del marcado manda — ESPECIAL primero, propiedad despues. `wrap` propio por si en
   una ficha muy estrecha ni siquiera las dos chapas caben en una linea. */
.inv-item-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
/* El nombre ya NO se estira: encoge (con sus puntos suspensivos) pero deja que la etiqueta
   de "special" caiga pegada a él. La de propiedad se va al otro extremo ella sola. */
.inv-item-name {
  flex: 0 1 auto; min-width: 0; font-family: var(--font-display);
  font-size: clamp(16px, 1.35vw, 21px); color: var(--gold-bright);
  /* SIN `white-space: nowrap`: cortaba los nombres largos en seco ("Paris P…") aunque
     hubiera sitio de sobra debajo. Ahora baja a una segunda línea, y el `line-clamp` es
     el freno por si alguna vez entra un nombre absurdo. */
  /* 1.35 y no 1.2: Bowlby One pinta 29 px de tinta con 21 de cuerpo, y en una caja de
     1.2 (25 px) el `overflow: hidden` le cortaba el trazo inferior. Medido, no a ojo. */
  line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere;
}
.inv-item-tag {
  flex: 0 0 auto; padding: 3px 9px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 800; font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--player-bright);
  background: var(--player-soft); border: 2px solid var(--gv-ink, #070f1d);
}
/* Lo BÁSICO se distingue: no es algo que hayas conseguido, es de serie. */
.inv-item-tag.basic { color: var(--text-dim); background: rgba(255, 255, 255, 0.06); }
/* ESPECIAL: chapa de oro. No es "lo tienes", es "esto no es el efecto de fábrica de nadie". */
.inv-item-tag.special { color: #1a1206; background: linear-gradient(180deg, #ffd873, var(--gold) 62%); }
/* CINEMATIC: chapa roja. El objeto trae un video (Genesis Block: el de Satoshi, satoshi-cine.js). */
/* La misma chapa, dentro de un boton de efecto de invocacion (mazo y simulador). */
.cl-cine-tag {
  display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 999px; vertical-align: middle;
  font-size: 0.68em; font-weight: 900; letter-spacing: .06em; line-height: 1.5;
  color: #fff; background: linear-gradient(180deg, #ff5a5a, #d91f2e 62%); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.inv-item-tag.cinematic { color: #fff; background: linear-gradient(180deg, #ff5a5a, #d91f2e 62%); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
/* La ficha tiene alto fijo, así que el texto no puede estirarla y el `line-clamp` es la
   red de seguridad. Cinco líneas y no tres: con el ancho y el alto de hoy la descripción
   más larga del catálogo entra entera, y el tope sólo actúa si alguna vez se escribe una
   mucho más larga — antes recortaba a media frase en el uso normal. */
.inv-item-desc {
  margin: 0; font-family: var(--font-body); font-size: clamp(12.5px, 1vw, 14.5px);
  line-height: 1.45; color: var(--text-dim);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden;
}
/* EL BLOQUE DE TEXTO (nombre + descripcion + "funciona con") ACABA DONDE ACABA EL DIBUJO.
   Su suelo es el borde inferior del icono, y "funciona con" se apoya en el (`margin-top:
   auto`) en vez de caer al fondo de la ficha, un palmo por debajo del boton de preview.
   El alto minimo es `32cqw`, que es la MISMA medida que da el ancho de la columna izquierda
   —y con el 1:1, el alto del dibujo—: en `.inv-item-side` esa medida esta escrita
   `min(32cqw, 45%)`, pero las dos se resuelven contra el mismo ancho (el contenido de
   `.inv-item`, que es el contenedor de consulta), asi que 32 < 45 siempre y el termino que
   manda es el de `cqw`. Aqui no puede ir el `min()` entero porque un `%` de ALTO se
   resolveria contra otra cosa.
   Es MINIMO y no fijo a proposito: en la columna estrecha de la tienda el dibujo es pequeno
   y el texto necesita mas sitio, asi que el bloque crece y la linea baja con el. Y encoge
   (`flex-shrink`) hasta ese minimo si el pie de compra no cabe — lo que se recorta entonces
   es la descripcion, no la linea, que sigue pegada al suelo del bloque. */
.inv-item-info {
  flex: 0 1 auto; min-height: 32cqw; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.inv-item-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-item-works {
  flex: 0 0 auto; margin-top: auto; min-width: 0;
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 0.95vw, 13px); line-height: 1.35; color: var(--text-muted);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.inv-item-works b { color: var(--text-dim); font-weight: 800; }
/* Debajo del dibujo y de su MISMO ancho (lo da la columna), con la palabra dentro. El
   tamano de letra sigue al ancho de la FICHA (`cqw`) y no al de la ventana: en la columna
   estrecha de la tienda, "PREVIEW" en 12,5 px fijos no cabia en el boton. */
.inv-item-preview {
  width: 100%; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: clamp(6px, 1.4cqw, 10px) 8px;
  /* EL MISMO ALTO QUE EL BOTON DE PRECIO (ver `--inv-act-h` en `.inv-item`): los dos estan
     en la misma linea, y con altos distintos se leian como dos piezas sueltas. */
  height: var(--inv-act-h); min-height: var(--inv-act-h);
  font-size: clamp(10.5px, 3.1cqw, 13px); letter-spacing: 0.04em;
}
.inv-item-preview-label { text-transform: uppercase; font-weight: 800; }
.inv-item-preview .cl-sim-tri { font-size: 0.8em; }
/* EL TRIÁNGULO SE VA CUANDO NO CABE, y no antes. En la columna estrecha de la tienda la
   ficha mide ~240 px, o sea el botón ~77: la palabra (47) más el dibujo (17) más el aire no
   entran, y como los dos son cajas FLEXIBLES lo que pasaba es que el dibujo se encogía hasta
   1,6 px de ancho —una mota negra pegada al texto, no un triángulo— en vez de irse. Cuando
   sólo cabe uno manda la PALABRA: es la que dice qué hace el botón.
   El corte sale de la cuenta: el botón es el 32 % del ancho de la ficha (ver
   `.inv-item-side`) y necesita ~92 px para los dos, así que la ficha tiene que medir ~290. */
@container (max-width: 300px) {
  .inv-item-preview .play-ico { display: none; }
}
/* El mensaje de "aquí no tienes nada" NO va pegado a las pestañas: separado como lo
   estaría la cuenta de sección que sale cuando sí hay algo. */
.inventory-screen .shop-empty { margin-top: clamp(20px, 2.6vh, 32px); }
/* La vista previa de una SKIN no es una simulación: es la carta, y se puede inclinar.
   `relative` para el cartel de TWIST, que va ANCLADO a un lado y no en la fila (ver abajo). */
.inv-skin-body { position: relative; display: flex; align-items: center; justify-content: center; padding: clamp(10px, 1.4vh, 18px); }
/* MÁS AIRE ARRIBA Y ABAJO para que la carta inclinada no asome por el borde de la caja (que
   tiene `overflow-y: auto` y sacaba la barra de scroll a medio giro, sobre todo en las skins
   con botones de FX debajo, como Hillbilly Chad). Y la carta no pasa del 40 % del alto de la
   ventana: en pantallas bajas el modal topa con su `max-height` y la caja se encogía. */
.inv-skin-modal .inv-skin-body { padding-block: clamp(20px, 3vh, 34px); }
.inv-skin-modal .inv-skin-body .cl-preview { width: min(clamp(252px, 44%, 372px), 40vh); }
/* LA CARTA EN GRANDE (dueño 2026-10-24: "que se vean mas grandes para que pueda apreciarse"). La pantalla
   del juego es horizontal: los botones de FX / voces pasan a una COLUMNA a la derecha y la carta
   se queda con casi todo el alto del modal (antes los botones, debajo, le quitaban 1/3 y medía ~300 px). */
.cl-modal.inv-skin-modal {
  display: grid; width: auto; max-width: 96vw;
  grid-template-columns: auto minmax(0, 240px); grid-template-rows: auto 1fr auto;
  column-gap: clamp(14px, 2vw, 30px);
}
.inv-skin-modal > .cl-head { grid-column: 1 / -1; }
.inv-skin-modal > .inv-skin-body { grid-column: 1; grid-row: 2 / 4; padding-block: clamp(10px, 2vh, 22px); overflow: visible; }
/* NO SCROLL (dueno 2026-10-24): la carta ya mide lo que cabe (ver el ancho de .cl-preview abajo); lo unico que se
   salia de la caja era el cartel de TWIST, a un lado, y la carta al inclinarla, y eso sacaba barras de scroll. */
.inv-skin-modal > .inv-skin-fxsims { grid-column: 2; grid-row: 2 / 4; align-self: center; flex-direction: column; align-items: stretch; margin-top: 0; }
.inv-skin-modal > .inv-skin-fxsims .ui-btn.cl-sim { width: 100%; }
/* La carta y, a su DERECHA, el cartel de TWIST, en su propia columna (dueno 2026-10-24): anclado en absoluto se
   montaba sobre el borde de la carta. SIN botones (`no-fx`) el modal es de una sola columna y la carta va en el
   CENTRO: rejilla 1fr | carta | 1fr, con el cartel en la columna de la derecha, asi que no la descentra. */
.inv-skin-modal > .inv-skin-body { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; column-gap: clamp(8px, 1.4vw, 18px); }
.inv-skin-modal > .inv-skin-body > .twist-hint { position: static; transform: none; }
.cl-modal.inv-skin-modal.no-fx { grid-template-columns: minmax(0, 1fr); }
.inv-skin-modal.no-fx > .inv-skin-body { grid-template-columns: 1fr auto 1fr; justify-content: stretch; }
.inv-skin-modal.no-fx > .inv-skin-body > .cl-preview { grid-column: 2; }
.inv-skin-modal.no-fx > .inv-skin-body > .twist-hint { grid-column: 3; justify-self: start; }
/* el alto que deja el modal (94 % de la ventana menos cabecera y márgenes) en ancho de carta (11/16) */
/* a short screen (phone in landscape): the column of buttons, compact */
@media (max-height: 520px) {
  .inv-skin-modal > .inv-skin-fxsims { gap: 5px; }
  .inv-skin-modal > .inv-skin-fxsims .ui-btn.cl-sim { min-height: 30px; padding-block: 3px; font-size: 11px; }
  .inv-skin-modal > .inv-skin-fxsims .cl-sim-ico { width: 18px; height: 18px; }
  .cl-modal.inv-skin-modal { padding-top: 10px; }
  .inv-skin-modal > .cl-head { margin-bottom: 4px; }
}
.inv-skin-modal .inv-skin-body .cl-preview {
  padding: clamp(6px, 2vh, 26px);   /* the room to tilt, smaller on a short screen */
  width: min(560px, 52vw, calc((94vh - 130px) * 0.6875)); width: min(560px, 52vw, calc((94dvh - 130px) * 0.6875));
}

/* ============================================================
   CARTEL «TWIST» — la pista de que la carta hay que INCLINARLA
   ------------------------------------------------------------
   Va al lado de la carta en la vista previa de una skin cuyo contenido sólo aparece al
   girarla (ver `skinRevealsOnTilt`). Dibujado entero aquí, sin imagen ni SVG, como
   `.play-ico`: una carta en perspectiva que se mece de lado a lado — el MISMO eje que
   revela el efecto — entre dos flechas que se encienden por turnos, y la palabra debajo.
   Todo escala con `--tw`, así que otro tamaño es un número y no otro dibujo.
   ============================================================ */
.twist-hint {
  --tw: clamp(46px, 5.4vw, 74px);
  /* FUERA DEL FLUJO: como hermano de la carta en una fila centrada, el cartel empujaba la
     carta a la izquierda — la carta dejaba de estar en el centro de la vista previa por el
     hecho de que la skin tuviera aviso. Anclado a la derecha, la carta no se entera. */
  position: absolute; right: clamp(20px, 7%, 72px); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center;
  gap: calc(var(--tw) * 0.17);
  /* Se APAGA en cuanto agarras la carta: el aviso ya ha cumplido, y dejarlo parpadeando
     encima estorbaría justo al mirar el efecto. Hermano POSTERIOR de `.cl-preview`. */
  transition: opacity 0.18s ease-out;
}
.cl-preview.grabbing ~ .twist-hint { opacity: 0.15; }
/* La caja de la carta: `perspective` corta para que el balanceo se note de verdad, y las
   dos flechas colgadas de ella (::before / ::after) a izquierda y derecha. */
.twist-ico {
  position: relative; display: block;
  width: calc(var(--tw) * 0.66); height: var(--tw);
  perspective: calc(var(--tw) * 2.4);
}
.twist-ico i {
  display: block; width: 100%; height: 100%;
  border-radius: calc(var(--tw) * 0.11);
  border: max(2px, calc(var(--tw) * 0.045)) solid var(--gv-ink, #070f1d);
  background: var(--gold-face, linear-gradient(180deg, #ffe8a3 0%, #fde68a 48%, #f5c14a 100%));
  box-shadow: 0 calc(var(--tw) * 0.06) calc(var(--tw) * 0.14) rgba(4, 8, 17, 0.55);
  animation: twist-rock 2.6s ease-in-out infinite;
  overflow: hidden;
}
/* El destello que barre la cara al girar: es lo que hace que se lea como una carta FOIL
   pillando la luz y no como un rectángulo dorado dando vueltas. */
.twist-ico i::after {
  content: ''; position: absolute; inset: -30%;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.9) 50%, transparent 62%);
  animation: twist-sheen 2.6s ease-in-out infinite;
}
.twist-ico::before, .twist-ico::after {
  content: ''; position: absolute; top: 50%;
  width: calc(var(--tw) * 0.2); height: calc(var(--tw) * 0.2);
  border-top: max(2px, calc(var(--tw) * 0.045)) solid var(--gold-bright, #fde68a);
  border-left: max(2px, calc(var(--tw) * 0.045)) solid var(--gold-bright, #fde68a);
  border-radius: calc(var(--tw) * 0.04);
  filter: drop-shadow(0 1px 2px rgba(4, 8, 17, 0.9));
  animation: twist-arrow 2.6s ease-in-out infinite;
}
.twist-ico::before { left: calc(var(--tw) * -0.28); transform: translateY(-50%) rotate(-45deg); }
.twist-ico::after  { right: calc(var(--tw) * -0.28); transform: translateY(-50%) rotate(135deg); animation-delay: 1.3s; }
.twist-word {
  font-family: var(--font-display); font-weight: 400;
  font-size: calc(var(--tw) * 0.27); letter-spacing: 0.1em;
  color: var(--gold-bright, #fde68a);
  text-shadow: 0 2px 0 rgba(4, 8, 17, 0.85), 0 0 10px rgba(245, 193, 74, 0.45);
}
@keyframes twist-rock {
  0%, 100% { transform: rotateY(-32deg); }
  50%      { transform: rotateY(32deg); }
}
@keyframes twist-sheen {
  0%, 100% { transform: translateX(-42%); }
  50%      { transform: translateX(42%); }
}
/* Cada flecha se enciende cuando la carta va HACIA ella (la de la derecha con 1,3 s de
   retraso, media vuelta del balanceo), así que el par marca el ida y vuelta del gesto. */
@keyframes twist-arrow {
  0%, 40%, 100% { opacity: 0.25; }
  15%           { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .twist-ico i, .twist-ico i::after, .twist-ico::before, .twist-ico::after { animation: none; }
  .twist-ico i { transform: rotateY(-22deg); }
}
/* En móvil `.cl-body` se apila en columna y la carta ocupa el ancho: ahí no hay "un lado"
   donde anclar el cartel, así que vuelve al flujo y se coloca debajo. */
@media (max-width: 520px) {
  .twist-hint { position: static; transform: none; margin-top: 10px; }
}

/* Tarjetas del inventario. Se llamaban "mini" cuando el sobre iba a 76 px; hoy el
   sobre es la pieza grande de la pantalla y la tarjeta solo es su marco. */
.shop-card.mini { padding: clamp(18px, 1.6vw, 26px) clamp(14px, 1.2vw, 20px) clamp(16px, 1.4vw, 22px); gap: clamp(9px, 0.8vw, 14px); }
.shop-card.mini .shop-pack-art { width: auto; aspect-ratio: 448 / 600; height: clamp(190px, 17vw, 272px); }
.shop-card.mini h3 { font-size: clamp(16px, 1.3vw, 21px); }
.shop-card.mini .shop-open-btn { padding: clamp(9px, 0.8vw, 13px) clamp(18px, 1.7vw, 28px); font-size: clamp(14px, 1.05vw, 17px); }
.shop-card.mini .owned-packs-badge { --badge-d: clamp(38px, 3.2vw, 50px); font-size: clamp(16px, 1.3vw, 21px); right: clamp(-2px, -0.2vw, 0px); top: clamp(-2px, -0.2vw, 0px); }

/* Coin glyph used in price chips and buy buttons — enlarged so prices read at a
   glance (the wallet/balance icon is already large at --icon-min). */
.coin-sm { width: 30px; height: 30px; object-fit: contain; display: block; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }

.price-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: auto;
  padding: 7px 16px 7px 10px; border-radius: 999px;
  background: var(--surface-0); border: 1px solid var(--border-soft);
}
.price-chip b { font-family: var(--font-display); font-size: 19px; color: var(--gold-bright); font-variant-numeric: tabular-nums; }

/* BUY 1 / BUY 10 — the "BUY n" label + bonus pill sit OUTSIDE/above the button; the button itself
   shows only the (big) price. The 10-pack is "featured" (accent ring). Bottom-aligned so the
   buttons line up while the bonus pill rises above the Buy-10 column. */
.shop-buy-row { display: flex; align-items: flex-end; gap: clamp(14px, 1.5vw, 22px); width: 100%; margin-top: clamp(6px, 0.8vw, 12px); }
.buy-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.buy-label-out { font-family: var(--font-display); font-size: clamp(15px, 1.3vw, 20px); letter-spacing: 0.03em; color: var(--text); }
.shop-buy-row .buy-btn {
  width: 100%; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(14px, 1.5vw, 22px) clamp(12px, 1.2vw, 18px); line-height: 1.05;
  border-radius: 14px; cursor: pointer;
  background: var(--surface-0); border: 1px solid var(--border-strong);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
@media (hover: hover) and (pointer: fine) { .shop-buy-row .buy-btn:hover:not(:disabled) { background: var(--surface-1); transform: translateY(-2px); } }
.shop-buy-row .buy-btn:active:not(:disabled) { transform: scale(0.98); }
.shop-buy-row .buy-btn:focus-visible { outline: 2px solid var(--player-bright); outline-offset: 2px; }
.shop-buy-row .buy-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.shop-buy-row .buy-btn.featured { border-color: var(--player); box-shadow: 0 0 0 1px var(--player-soft), 0 0 20px -6px var(--player); }
@media (hover: hover) and (pointer: fine) { .shop-buy-row .buy-btn.featured:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--player), 0 6px 22px -6px var(--player); } }
.buy-btn .buy-cost {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: clamp(22px, 2vw, 32px);
  color: var(--gold-bright); font-variant-numeric: tabular-nums;
}
/* La gema va a la MISMA talla que la moneda: el boton de gems dice ahora lo mismo que el de
   oro (BUY + icono + precio) y con el icono a 22px la fila se leia como un pie de pagina.
   Gana a `.gem-md` (22px, mas abajo en la hoja) por especificidad, no por orden. */
.buy-btn .buy-cost .coin-md,
.buy-btn .buy-cost .gem-md { width: clamp(26px, 2.2vw, 36px); height: clamp(26px, 2.2vw, 36px); object-fit: contain; }
.buy-btn:disabled .buy-cost { color: var(--text-dim); }
.buy-free {
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px, 0.9vw, 12px); letter-spacing: 0.04em;
  color: #06210f; background: linear-gradient(180deg, #56e08a, #22c55e);
  border: 1px solid #14532d; border-radius: 999px; padding: 3px 11px;
  box-shadow: 0 3px 9px -2px rgba(34,197,94,0.65);
}

/* Phones: disable the 3D tilt's perspective so nothing clips. */
@media (max-width: 560px) {
  .shop-card { transform: none; }
  .shop-buy-row { max-width: none; }
}
/* Narrow headers: the packs chip + wallet + title stopped fitting on one line once the
   chip arrived, so the chip tightens up (icon + count still read + tap works). */
@media (max-width: 620px) {
  .shop-packs-chip { padding: 6px 12px 6px 8px; }
  .shop-head-chips { gap: 8px; }
}

/* ============================================================================
   STOREFRONT — the shop is ONE screen: rail (pick the collection) · stage (see the
   pack) · panel (buy it). It used to be a catalogue grid plus a "Details →" hop to
   reach two buttons, which cost a navigation step AND left the bottom half of every
   viewport empty. Everything below is sized to FILL the shell, never to overflow it.
   ============================================================================ */
.shop-screen.shop-store {
  display: flex; flex-direction: column;
  /* La tienda usa TODO el ancho del dispositivo. Antes se capaba a 1860 px y se centraba,
     asi que en un monitor grande quedaban dos franjas muertas a los lados mientras las tres
     columnas se apretaban en el centro. Ahora el rail queda pegado a la izquierda y la ficha
     de compra a la derecha, y lo unico que separa del borde es el padding de `.shop-screen`. */
  max-width: none;
  /* The storefront is SIZED to fit at every viewport we ship, so in practice no scrollbar
     ever appears. `auto` rather than `hidden` only as a safety net: at 200% browser zoom
     or with a huge OS font, hidden would silently CLIP the buy button instead of letting
     the player reach it. overflow-x stays hidden so nothing can produce a sideways bar. */
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: max(clamp(16px, 2.4vh, 30px), var(--safe-b, 0px));
}
.shop-store .shop-head { flex: 0 0 auto; margin-bottom: clamp(10px, 1.8vh, 24px); }
.store-body {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  /* La ficha de compra se ACOTA en vez de crecer en proporcion: con `1.2fr` en un monitor
     de 2560 px se convertia en un panel de 900 px con el mismo contenido dentro, todo aire.
     Ahora tiene una banda propia a la derecha y el sobrante se lo queda el escaparate. */
  grid-template-columns: auto minmax(0, 1fr) minmax(380px, clamp(380px, 26vw, 580px));
  /* El hueco entre columnas es lo que separa el rail del escaparate y este de la ficha;
     con 34 px de tope las tres se tocaban en cuanto la pantalla crecia. */
  gap: clamp(16px, 3.4vw, 78px);
  /* Centred, not stretched: the rail and the panel are only as tall as their content
     (a full-height panel is 200px of void above and below the buy button, and a
     full-height rail turns its divider into a stray line down the screen). The stage
     is the one column that DOES fill, so the pack sits on the optical centre. */
  align-items: center;
}
/* `display: grid` de arriba GANA al `[hidden] { display: none }` del navegador — las reglas
   de autor pisan las del agente de usuario— así que sin esta línea el atributo `hidden` no
   hace absolutamente nada y la tienda entera se sigue viendo. Es lo que oculta el rail
   cuando se abre la página de GEMS. */
.store-body[hidden] { display: none; }

/* ---- Rail: each collection is a small hanging BANNER (pennant-notched bottom, pack
   thumbnail on the pole side, name on the cloth). The notch is a clip-path on the button
   itself, so the button's own background IS the banner's frame and `::before` (inset 2px,
   same shape) paints the cloth — one pseudo instead of two stacked ones. `::before` is
   absolutely positioned, which paints it ABOVE in-flow content, so the children are made
   `position: relative` to join the same paint step and stay on top. clip-path also eats
   `outline`, so focus is drawn as an inset ring on the cloth. ---- */
.store-rail {
  /* Cuanto asoma el sobre por ARRIBA del banner. Es tambien el hueco vertical que hay
     que respetar entre banners, de ahi que el `gap` sea comodamente mayor. */
  --pack-rise: clamp(24px, 2.9vw, 48px);
  display: flex; flex-direction: column; gap: clamp(46px, 7.6vh, 94px);
  /* `center` (no `start`) para que la columna quede a la misma altura que el panel de
     compra: con `start` los banderines se pegaban al borde de arriba y el resto de la
     tienda se leia a media pantalla. */
  align-content: center; align-items: stretch; align-self: center; min-width: 0;
  padding-right: clamp(4px, 0.6vw, 10px);
}
/* El banderín salió del widget "DIAGONAL STRIPES" del lab (shop-rail-lab.html, H), pero su
   diagonal repetida YA NO ESTÁ: cada colección trae ahora su propio fondo (la lluvia matrix
   de Satoshi en Genesis, el arrecife en Awakening) y la trama encima lo ensuciaba — por poco
   alpha que se le diera se leía como cinta de obra. Tres piezas, cada una con UNA
   responsabilidad:
     .store-rail-item     solo maquetación (sin recortar, para que el sobre pueda salirse)
     .store-rail-panel    la superficie con borde + `overflow: hidden` para recortar el fondo
     .store-rail-bg       el fondo de la colección (+ el velo que hace legible el nombre)
   El sobre va de hermano por encima: borde + fondo recortado + arte que sobresale no caben
   en un solo elemento. */
.store-rail-item {
  --pack-w: clamp(122px, 11.6vw, 196px);
  /* Lo que el sobre saca de mas por cada lado en su estado MAS GRANDE: el giro de -8deg
     mas el `scale(1.05) translateY(-5px)` del seleccionado. Se usa como aire de la ventana
     por arriba y como separacion minima al borde izquierdo; calcularlo solo con el giro
     (que fue el primer intento) deja al seleccionado cortado por arriba. */
  --pack-tilt: clamp(14px, 1.5vw, 25px);
  /* Pegado a la esquina: `--pack-x` es la posicion de la CAJA, y el arte queda ~16px a su
     izquierda por el giro + el `scale` del seleccionado. Se deja justo lo justo para que
     el sobre roce el borde sin que la ventana le muerda la esquina. */
  --pack-x: clamp(11px, 1.24vw, 21px);
  /* El contorno de tinta que el sobre calca del widget: un PNG no admite `border`, así que
     se traza apilando drop-shadows de desenfoque CERO en ocho direcciones — la unión de las
     ocho copias es un borde que sigue su silueta real. `--edge` cambia a dorado en `.on`,
     igual que el `border-color` del panel.
     OJO CON EL GROSOR: los `drop-shadow` de una cadena se ENCADENAN (cada uno proyecta el
     RESULTADO del anterior), así que lo que se ve no es el desplazamiento sino la mayor
     SUMA de un subconjunto de los ocho vectores. Con 3px en los ejes y 2 en las diagonales
     eso daban 7 px medidos, contra los 3 del `border` del panel: el sobre iba con un
     contorno dos veces y media más gordo que su propio banner. Los factores de abajo son
     los que hacen que esa suma máxima valga exactamente `--gv-bw` — y valga lo mismo en
     los ejes (a + 2d) que en las diagonales ((a + d)·√2), que es lo que lo mantiene
     uniforme en todo el contorno.
     PERO LOS DESPLAZAMIENTOS TIENEN QUE SER PIXELES ENTEROS. Afinarlos a la teoría daba
     0,93 y 0,66 px, y a esa escala `drop-shadow` no dibuja una sombra fina: la reparte
     según cae en la rejilla de píxeles, y encadenadas ocho el error se acumula siempre
     hacia el mismo lado — el contorno salía grueso arriba y a la izquierda y no existía
     abajo ni a la derecha. Con 1 y 1 el máximo vale 1+2 = 3 px en los ejes y
     (1+1)·√2 = 2,83 en las diagonales: el mismo grosor que el `border` de 3 px del panel,
     un 6% de diferencia entre eje y diagonal que no se ve, y ni un solo sub-píxel.
     Van en píxeles literales y no derivados de `--gv-bw` justamente por eso: lo que
     importa aquí es caer en la rejilla, no seguir una fórmula. Si `--gv-bw` cambiara de 3,
     estos dos números se ajustan a mano (a + 2d = el grosor que se quiera, ambos enteros). */
  --edge: var(--gv-ink);
  --stroke-a: 1px;
  --stroke-d: 1px;
  --stroke:
    drop-shadow(var(--stroke-a) 0 0 var(--edge)) drop-shadow(calc(-1 * var(--stroke-a)) 0 0 var(--edge))
    drop-shadow(0 var(--stroke-a) 0 var(--edge)) drop-shadow(0 calc(-1 * var(--stroke-a)) 0 var(--edge))
    drop-shadow(var(--stroke-d) var(--stroke-d) 0 var(--edge)) drop-shadow(calc(-1 * var(--stroke-d)) var(--stroke-d) 0 var(--edge))
    drop-shadow(var(--stroke-d) calc(-1 * var(--stroke-d)) 0 var(--edge)) drop-shadow(calc(-1 * var(--stroke-d)) calc(-1 * var(--stroke-d)) 0 var(--edge));
  position: relative; display: flex; flex-direction: column; justify-content: center;
  gap: clamp(3px, 0.35vw, 6px);
  width: clamp(252px, 25.4vw, 438px);
  min-height: clamp(90px, 7.8vw, 126px);
  /* El hueco de la izquierda es EXACTAMENTE lo que el sobre tapa del widget (va absoluto
     y no reserva sitio): su ancho menos lo que se sale por fuera, más un respiro. Se
     deriva de `--pack-w` para que al tocar el tamaño del sobre no haya que recalcularlo
     a mano — es lo que se me fue una vez y el nombre acabó debajo del arte. */
  padding: clamp(9px, 0.8vw, 13px) clamp(11px, 0.9vw, 15px) clamp(9px, 0.8vw, 13px)
           calc(var(--pack-x) + var(--pack-w) * 0.85 + clamp(12px, 1.1vw, 19px));
  cursor: pointer; color: inherit; font: inherit; border: none; text-align: left;
  background: none; overflow: visible;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out);
}
.store-rail-panel {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  border: var(--gv-bw) solid var(--gv-ink); border-radius: 16px;
  background: linear-gradient(180deg, #17203a, #0e1526);
  /* Solo la sombra PROYECTADA: despega el banderín de la pantalla, que es lo que le
     faltaba para leerse como una pieza del kit y no como un recorte pegado al fondo.
     El relieve (las dos bandas) va en el ::after — ver abajo. */
  box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.7);   /* la misma sombra corta que `--counter-relief` */
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* LUZ Y RELIEVE. Las dos bandas del kit estaban en el `box-shadow` del panel y NO SE VEÍAN:
   `.store-rail-bg` es un hijo a `inset: 0` que pinta el arte de la colección justo encima.
   Aquí van en un ::after, que al ser el ÚLTIMO hijo se pinta por delante del arte — y sigue
   por detrás del nombre (z-index 1) y del sobre (z-index 2, y además hermano del panel).
   El degradado es el brillo: luz arriba que se apaga a media altura, como el resto de
   chapas de la app. */
.store-rail-panel::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: 13px;   /* el 16 del panel menos sus 3 de borde */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 46%);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
/* Fondo propio de cada coleccion, DEBAJO de la diagonal. Va en su capa (y no en el
   `background` del panel) porque Genesis necesita meter dentro un <canvas> y porque asi
   el estado seleccionado puede encenderlo con un `filter` sin tocar nada mas. El velo
   lateral es el que garantiza que el nombre del sobre se lea encima. */
.store-rail-bg {
  position: absolute; inset: 0; overflow: hidden;
  filter: brightness(0.5) saturate(0.6);
  transition: filter .18s ease;
}
.store-rail-item.on .store-rail-bg { filter: none; }
/* GENESIS: el mismo fondo ESTÁTICO que su banner de HOME (Satoshi), sin la lluvia matrix (dueño 2026-10-24). */
.store-rail-panel.set-genesis .store-rail-bg {
  background:
    linear-gradient(90deg, rgba(4,11,24,0.34), rgba(4,11,24,0.14) 55%, rgba(4,11,24,0.2)),
    url("../UI/satoshi_banner.jpg") center / cover no-repeat;
}
/* AWAKENING OF THE WHALES: el mismo arrecife que el banner de HOME. */
.store-rail-panel.set-bitcoin .store-rail-bg {
  background:
    linear-gradient(90deg, rgba(4,11,24,0.34), rgba(4,11,24,0.14) 55%, rgba(4,11,24,0.2)),
    url("../UI/AOTW_bg.jpg") center 62% / cover no-repeat;
}
/* El velo del nombre va aparte para que el `filter` del estado apagado no lo aclare:
   sea cual sea el fondo, la mitad derecha (donde vive el texto) queda oscura. */
.store-rail-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4,9,20,0) 18%, rgba(4,9,20,0.62) 52%, rgba(4,9,20,0.74));
}
/* VENTANA del sobre: se extiende `--pack-rise` por ENCIMA del banner y se cierra en los
   otros tres lados (justo por dentro del borde, para no taparlo). Resultado: el sobre
   asoma por el borde de arriba y su base queda CORTADA por el de abajo — se mete en el
   banner como en un bolsillo en vez de flotar por delante. `pointer-events: none` para
   que el clic siga llegando al boton. */
.store-rail-clip {
  position: absolute; z-index: 2; pointer-events: none; overflow: hidden;
  top: calc(-1 * (var(--pack-rise) + var(--pack-tilt)));
  left: var(--gv-bw); right: var(--gv-bw); bottom: var(--gv-bw);
  border-radius: 0 0 13px 13px;
}
/* Alto MAYOR que la ventana a proposito: lo que sobra por abajo es lo que se corta.
   OJO: hijo DIRECTO de la ventana. Antes era `.store-rail-item img` a secas y eso alcanzaba
   tambien a los <img> de dentro de la CARTA del lote (que es un componente entero), y los
   colocaba absolutos uno encima de otro. */
.store-rail-clip > img {
  position: absolute; left: var(--pack-x); top: var(--pack-tilt);
  width: var(--pack-w); height: calc(var(--pack-w) * 1.339); object-fit: contain;
  transform: rotate(-8deg);
  filter: var(--stroke) drop-shadow(0 8px 15px rgba(0,0,0,0.72)) saturate(0.78) brightness(0.86);
  transition: filter .2s ease, transform .2s var(--ease-out);
}
.store-rail-name {
  /* Por encima de la ventana (z 2), que es donde viven la carta y los sobres: con z 1 el
     conjunto del lote se le comia el principio del nombre. La sombra lo asienta sobre lo
     que tenga detras, sea el arte de una coleccion o una carta. */
  position: relative; z-index: 3; min-width: 0;
  /* CONTORNO DE TINTA, como el resto de piezas del kit: ocho sombras de desenfoque cero
     (la union de las ocho es el borde) mas la sombra suave que lo asienta. Es lo que hace
     que el nombre se lea igual sobre el arte de una coleccion que sobre una carta. */
  text-shadow:
    1px 0 0 var(--gv-ink, #070f1d), -1px 0 0 var(--gv-ink, #070f1d),
    0 1px 0 var(--gv-ink, #070f1d), 0 -1px 0 var(--gv-ink, #070f1d),
    1px 1px 0 var(--gv-ink, #070f1d), -1px 1px 0 var(--gv-ink, #070f1d),
    1px -1px 0 var(--gv-ink, #070f1d), -1px -1px 0 var(--gv-ink, #070f1d),
    0 3px 6px rgba(3, 7, 15, 0.75);
  /* TODO EN MAYUSCULAS. Los nombres de las colecciones vienen del catalogo en caja de
     titulo («Welcome Pack») y COSMETICS ya estaba en caja alta, asi que el rail se leia a dos
     estilos. Se hace con `text-transform` y NO cambiando los textos: esos mismos nombres se
     pintan tambien en el escaparate y en la ficha de compra, donde la caja de titulo es la
     que toca. El espaciado sube un punto porque en caja alta las letras se apelmazan. */
  font-family: var(--font-display); font-size: clamp(13px, 1.2vw, 20px);
  text-transform: uppercase;
  letter-spacing: 0.045em; line-height: 1.14; color: var(--text);
  /* Con el widget estrecho y el sobre comiéndose su lado izquierdo, "Awakening of the
     Whales" necesita TRES líneas para no quedarse en "Awakening of the...". Caben en el
     `min-height`, así que el rail no se estira. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .18s ease;
}
.store-rail-item:active { transform: scale(0.97); }
.store-rail-item:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .store-rail-item:hover .store-rail-panel { background: linear-gradient(180deg, #1c2745, #111a2f); }
  .store-rail-item:not(.on):hover .store-rail-bg { filter: brightness(0.72) saturate(0.85); }
  .store-rail-item:hover .store-rail-clip > img { transform: rotate(-8deg) translateY(-4px) scale(1.04); filter: saturate(1) brightness(1); }
  .store-rail-item:hover .store-rail-name { color: var(--text); }
}
/* La seleccionada: contorno dorado, su fondo a plena luz (el apagado va con `filter`) y el
   sobre más grande y más brillante. */
.store-rail-item.on { --edge: var(--gold-edge); }
/* Ojo: el `background` del panel ya no se ve (lo tapa `.store-rail-bg`), asi que el estado
   seleccionado se expresa con el contorno dorado, el relieve y el fondo a plena luz. Se deja
   el degradado de acento como respaldo por si el arte no cargara. */
.store-rail-item.on .store-rail-panel {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent, var(--gold)) 28%, #16203a),
    color-mix(in srgb, var(--accent, var(--gold)) 14%, #0e1526));
  /* La seleccionada se levanta más y añade un halo dorado corto. */
  box-shadow:
    0 9px 20px -9px rgba(0, 0, 0, 0.95),
    0 0 20px -8px color-mix(in srgb, var(--gold) 70%, transparent);
}
/* Su banda de luz es cálida (la del kit en oro), y por el mismo motivo que la neutra
   tiene que ir en el ::after o el arte de la colección se la come. */
.store-rail-item.on .store-rail-panel::after {
  background: linear-gradient(180deg, rgba(255, 236, 190, 0.16), rgba(255, 255, 255, 0) 46%);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.22),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
.store-rail-item.on .store-rail-clip > img {
  transform: rotate(-8deg) translateY(-5px) scale(1.05);
  filter: saturate(1.08) brightness(1.08);
}
.store-rail-item.on .store-rail-name { color: #fff; }

/* ---- EL LOTE en el rail ---------------------------------------------------------
   Mismo banner que una coleccion; lo que asoma por la ventana es una CARTA. Va en su
   propia caja porque el giro del banner y la inclinacion del hover son dos transforms
   distintos: el de la caja es fijo, el de la carta lo ESCRIBE `applyFoilTilt`. */
/* RAYOS con el punto de fuga EN EL CENTRO DE LA CARTA. No es un `50% 50%` a ojo: la carta
   se coloca con `--pack-x` / `--pack-rise` (y su ancho sale de `--pack-w`), asi que el
   centro se deriva de esas mismas variables y sigue cuadrando si cambia el tamano del
   banner. Ojo con el sistema de coordenadas: `.store-rail-bg` empieza DENTRO del borde del
   panel (de ahi el `--gv-bw`), y la ventana saca la carta `--pack-rise` por arriba. */
.store-rail-panel.set-welcome {
  --rays-w: calc(var(--pack-w) * 0.9);
  --rays-x: calc(var(--pack-x) + var(--rays-w) / 2);
  /* `--card-lift` es lo que el banner LEVANTA la carta al estar elegido o bajo el raton.
     Lo declara el item y lo leen las dos: el `transform` de la carta y este punto de fuga.
     Un numero solo, porque si se escriben aparte el foco se queda 5 px por debajo del
     centro en cuanto el banner esta seleccionado — que es como se ve casi siempre. */
  --rays-y: calc(var(--rays-w) * 16 / 11 / 2 - var(--pack-rise) - var(--gv-bw) - var(--card-lift, 0px));
}
/* EL GIRO DE LAS RAYAS. Se anima el angulo de ARRANQUE del degradado conico con una custom
   property registrada (igual que `--iriAngle` y compañia mas arriba); girar la capa entera
   con un `transform` obligaria a agrandarla para que siguiera cubriendo, y ademas moveria el
   punto de fuga, que es justo lo que tiene que quedarse clavado en la carta.
   El recorrido es UN PERIODO del patron (11,5deg), no una vuelta entera: al repetirse cada
   11,5deg, ahi ya vuelve a estar igual, asi que el bucle no tiene costura. En sentido
   HORARIO porque en un `conic-gradient` el angulo crece en ese sentido. Lento a proposito:
   una vuelta completa son ~2 minutos. */
@property --raysAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes raysSpin { to { --raysAngle: 11.5deg; } }
.set-welcome .store-rail-bg,
.set-cosmetics .store-rail-bg,
.home2-banner-rays { animation: raysSpin 4s linear infinite; }
/* Su PROPIA capa (2026-11-07). El giro repinta el fondo en CADA fotograma (un angulo de un
   degradado no lo anima la GPU), y sin capa propia ese repintado arrastraba a lo que tiene
   encima y alrededor (las cartas del rail con sus filtros, la rejilla de COSMETICS): medido con
   la GPU real, 133 ms por fotograma en COSMETICS; con la capa, 16,7. */
.set-welcome .store-rail-bg,
.set-cosmetics .store-rail-bg { will-change: transform; }
@media (prefers-reduced-motion: reduce) {
  .set-welcome .store-rail-bg,
  .set-cosmetics .store-rail-bg,
  .home2-banner-rays { animation: none; }
}
.store-rail-panel.set-welcome .store-rail-bg {
  background:
    /* El patron: amarillo y de poco contraste, que es lo pedido — se lee como textura, no
       como un dibujo. Los sectores son desiguales (5deg de rayo, 6,5 de hueco) para que no
       se vea la simetria del repetido. */
    repeating-conic-gradient(from calc(-4deg + var(--raysAngle)) at var(--rays-x) var(--rays-y),
      rgba(255, 214, 112, 0.13) 0deg 5deg,
      rgba(255, 214, 112, 0) 5deg 11.5deg),
    /* Y debajo, el bosque bitcoin — el MISMO sitio del que sale la carta. El velo lo pone
       `.store-rail-bg::after`, asi que aqui solo va la foto. */
    url('../UI/bitcoin_forest.jpg') center 58% / cover no-repeat;
}
/* Los dos sobres del lote, asomando por DETRAS de la carta (z 0 contra su z 1). Se colocan
   contra la misma esquina que la carta y se giran al reves que ella, que es lo que los hace
   leer como "lo que hay detras" y no como piezas sueltas. */
/* La ventana del LOTE se abre por los LADOS ademas de por arriba: sus sobres asoman a
   izquierda y derecha de la carta. Con `clip-path` en vez de moviendo el recorte, porque
   `--pack-x` se mide desde el borde de la ventana y desplazarla movería tambien la carta.
   Lo unico que sigue cortando es el BORDE DE ABAJO, que es lo que mete el conjunto en el
   bolsillo del banner. */
/* El conjunto se corre a la derecha: con el sobre izquierdo pegado al borde, la esquina
   redondeada del banner quedaba tapada y parecia rota.
   El lote usa el MISMO `--stroke` que los demas banners (1px/1px): lo que hacia que su
   contorno se viera mas gordo no era el grosor, ver `.store-rail-group`. */
.store-rail-item.is-bundle { --pack-x: calc(var(--pack-w) * 0.46); }
.store-rail-item.is-bundle .store-rail-clip {
  overflow: visible;
  clip-path: inset(-260px -260px 0 -260px);
}
/* EL GRUPO: carta + sobres. Aqui va la SOMBRA del conjunto, pero NO el contorno.
   El trazo estuvo aqui y hacia que la carta se viera con un borde mucho mas gordo que el
   sobre de los demas banners, por dos motivos que se suman:
   - un sobre es un PNG PELADO y todo su contorno es este trazo; la CARTA, en cambio, ya
     trae el suyo pintado en la plantilla, asi que el trazo se le sumaba al que ya tenia;
   - y el marco de la carta lleva su propia `drop-shadow` DESENFOCADA (14 px) en linea. El
     trazo se calca del alfa COMPUESTO del grupo, asi que no calcaba el filo de la carta
     sino esa sombra difuminada: en vez de una linea de 1 px salia un halo ancho y blando.
   Asi que el contorno se lo quedan los sobres, que son los unicos que lo necesitan, y la
   carta se queda con el que ya trae. El conjunto sigue leyendose como una sola silueta
   porque los dos sobres no se solapan entre si — solo con la carta, que los tapa. */
.store-rail-group {
  position: absolute; inset: 0; pointer-events: none;
  filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.72));
}
.store-rail-behind { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.store-rail-behind img {
  /* Asoman por ENCIMA del marco, igual que la carta. El contorno es el MISMO `--stroke`
     que el sobre de una coleccion, asi que se ven exactamente igual de gruesos. */
  position: absolute; top: calc(var(--pack-tilt) + var(--pack-w) * 0.08);
  width: calc(var(--pack-w) * 0.62); height: auto;
  filter: var(--stroke) brightness(0.82) saturate(0.88);
}
/* Los DOS a la derecha de la carta, en abanico. A la izquierda no caben: la ventana se
   recorta en el borde del banner (`.store-rail-clip`), asi que un sobre ahi solo enseña el
   canto. Y el que va DETRAS es el que se pone mas a la derecha — si no, el de delante lo
   tapa entero y parece que solo hay uno. */
/* Uno a cada lado de la carta. El de la izquierda se sale del marco del banner, que es
   justo lo que se pide: la ventana ya no le corta ahi (ver el `clip-path` de arriba). */
.store-rail-behind img.is-l { left: calc(var(--pack-x) - var(--pack-w) * 0.34); transform: rotate(-17deg); }
.store-rail-behind img.is-r { left: calc(var(--pack-x) + var(--pack-w) * 0.62); transform: rotate(15deg); }
.store-rail-card {
  z-index: 1;
  position: absolute; left: var(--pack-x); top: var(--pack-tilt);
  width: calc(var(--pack-w) * 0.9); aspect-ratio: 11 / 16;
  transform: rotate(-8deg) translateY(calc(-1 * var(--card-lift, 0px)));
  /* Sin contorno propio (ya lo trae pintado la plantilla) y sin sombra: la del conjunto la
     pone `.store-rail-group`. */
  filter: saturate(0.78) brightness(0.86);
  transition: filter .2s ease, transform .2s var(--ease-out);
}
/* La carta ocupa su caja, y la inclinacion del raton entra por su `transform` en linea.
   La transicion es lo que la hace SUAVE al entrar y al salir; `applyFoilTilt` ya se
   encarga del `will-change` (solo mientras se mueve, para que quieta pinte nitida). */
.store-rail-card .card {
  width: 100%; height: 100%;
  transition: transform .18s var(--ease-out);
}
/* LAS CARTAS DEL RAIL, QUIETAS POR DENTRO (dueño 2026-11-07: "la tienda va con lag"). Cuelgan de
   DOS filtros (la sombra de `.store-rail-group` y el saturate/brightness de la carta), y cualquier
   animacion de dentro de la cara (la deriva del rotulo FOIL, el giro de la gema) obligaba a rehacer
   esos filtros sobre la carta entera en cada fotograma: medido con la GPU de verdad, la tienda iba
   a 8-10 fps y el HOME a 60. Es la misma regla que ya lleva la app (`html.is-native .fullart-board`,
   al final del fichero). La inclinacion del raton sigue moviendo el brillo: va por --foil-x /
   --foil-y, no por animacion. */
.store-rail .fullart-board *,
.store-rail .fullart-board *::before,
.store-rail .fullart-board *::after { animation: none !important; }
/* Cuanto se levanta la carta en cada estado. Va en el ITEM y no en la carta porque los
   rayos del fondo (que son HERMANOS de la carta, no descendientes) tienen que leerlo. */
.store-rail-item { --card-lift: 0px; }
@media (hover: hover) and (pointer: fine) {
  .store-rail-item.is-bundle:hover { --card-lift: 4px; }
  .store-rail-item.is-bundle:hover .store-rail-card {
    transform: rotate(-8deg) translateY(calc(-1 * var(--card-lift))) scale(1.04);
    filter: saturate(1) brightness(1);
  }
}
.store-rail-item.on { --card-lift: 5px; }
.store-rail-item.on .store-rail-card {
  transform: rotate(-8deg) translateY(calc(-1 * var(--card-lift))) scale(1.05);
  filter: saturate(1.08) brightness(1.08);
}

/* ---- COSMETICOS en el rail ------------------------------------------------------
   El banner llevaba la gema de `icons/gems.png` centrada y nada mas, sobre el degradado azul
   del panel. Ahora es una COMPOSICION, como la del lote: tres gemas a la izquierda, las dos
   cartas de skin en el centro (la de Paris delante y sobresaliendo, la del Cryptobro detras)
   y el dorso del clan Shillobi a la derecha, sobre un gradiente de colores animado.
   TODAS las medidas salen de `--pack-w` —el ancho de referencia del rail— para que al
   cambiar el tamano del banner la composicion se mueva entera y no haya que recolocar pieza
   por pieza. Las posiciones horizontales van en % del ancho de la VENTANA (que es el banner
   menos su borde), que es lo que reparte las tres zonas de izquierda a derecha. */

/* EL FONDO: el JARDIN DEL TEMPLO de Shillobi — el mismo arte que hay detras de su carta —,
   con RAYOS GIRANDO encima. Es la misma receta que el banner del LOTE (`set-welcome`): la
   foto abajo, un `repeating-conic-gradient` de sectores desiguales encima y el angulo de
   ARRANQUE del cono animado, que es lo que lo hace girar sin mover la capa.
   Se anima el angulo y no un `transform` por dos motivos: girar la capa entera obligaria a
   agrandarla para que siguiera cubriendo el banner, y ademas moveria el PUNTO DE FUGA, que es
   justo lo que tiene que quedarse clavado.
   EL PUNTO DE FUGA es el centro de la carta de delante, y no un `50% 50%` a ojo: sale de las
   mismas variables con las que se coloca la carta, asi que sigue cuadrando si cambia el
   tamano del banner. Ojo con el sistema de coordenadas — `.store-rail-bg` empieza DENTRO del
   borde del panel (de ahi el `--gv-bw`) y la ventana saca la carta `--pack-rise` por arriba —
   y con `--card-lift`, que es lo que la carta sube al estar elegida: sin restarlo, el foco se
   queda 5 px por debajo del centro justo cuando el banner es el elegido. */
.store-rail-panel.set-cosmetics {
  --rays-w: calc(var(--pack-w) * 0.90);   /* el ancho de la carta de delante */
  --rays-x: calc(var(--pack-x) + var(--rays-w) / 2);
  --rays-y: calc(var(--rays-w) * 16 / 11 / 2 - var(--pack-rise) - var(--gv-bw) - var(--card-lift, 0px));
}
.store-rail-panel.set-cosmetics .store-rail-bg {
  background:
    /* Los rayos: blancos, de poco contraste y con los sectores desiguales (5deg de rayo, 6,5
       de hueco) para que no se lea la simetria del repetido. */
    repeating-conic-gradient(from calc(-4deg + var(--raysAngle)) at var(--rays-x) var(--rays-y),
      rgba(255, 255, 255, 0.45) 0deg 5deg,
      rgba(255, 255, 255, 0) 5deg 11.5deg),
    /* UN VELO PLANO ENTRE LOS RAYOS Y LA FOTO. Sin el los rayos no se veian: el jardin es un
       dibujo CLARO (cielo, cerezos rosas) y un rayo blanco sobre rosa claro no existe — el
       banner del lote se los puede permitir tan sutiles porque debajo tiene un bosque oscuro.
       Bajando la foto un tercio, el mismo rayo pasa a leerse, y de paso el nombre gana. */
    linear-gradient(rgba(6, 10, 24, 0.28), rgba(6, 10, 24, 0.28)),
    /* Y debajo el jardin. El velo lo pone `.store-rail-bg::after`, asi que aqui solo va la
       foto. El encuadre (`center 60%`) es lo unico que se puede elegir: la tira es de 3,3 a 1
       y el cuadro es CUADRADO, asi que `cover` lo escala al ancho y solo queda decidir a que
       altura se corta. A 38% salian el cielo y las cumbres —un banner de montanas—; a 60%
       entran el cerezo, el jardin de piedras y la base del templo, que es lo que hace que se
       reconozca de que sitio es el fondo. */
    url('../card_templates/card_images/hero/shillobi_bg.jpg') center 60% / cover no-repeat;
}
/* El velo del nombre, un punto mas suave que el general: el nombre trae su propio contorno de
   tinta, y con el velo de serie (0,74) la mitad derecha del banner se quedaba negra — o sea
   el jardin solo se veia en el lado del dorso. */
.store-rail-panel.set-cosmetics .store-rail-bg::after {
  background: linear-gradient(90deg, rgba(4, 9, 20, 0) 20%, rgba(4, 9, 20, 0.36) 52%, rgba(4, 9, 20, 0.5));
}

/* Las cartas arrancan pasado el DORSO, que es lo que ocupa ahora el borde izquierdo, y el
   nombre se corre hasta pasada la carta de detras: su hueco sale de `--pack-x`, asi que aqui
   se escribe el padding entero en vez de heredar la formula del sobre. */
.store-rail-item.is-cosmetics {
  /* EL MISMO REPARTO QUE EL LOTE, pieza por pieza: la carta de delante donde va la suya y las
     dos de los lados donde van sus sobres (ver `.store-rail-behind img` unas lineas mas
     arriba). Por eso `--pack-x` vale lo mismo que alli y el hueco del nombre NO se escribe:
     con `--pack-x` en su sitio, la formula generica de `.store-rail-item` ya deja el nombre
     donde lo deja en el lote. */
  --pack-x: calc(var(--pack-w) * 0.46);
  /* EL BORDE DE ARRIBA DEL BANNER, en coordenadas de la ventana. La ventana empieza
     `--pack-rise + --pack-tilt` MAS ARRIBA que el banner (es lo que deja que la composicion
     asome), asi que un `top: 0` ahi no es el borde del banner sino ese punto de mas arriba —
     y todo lo que se coloque con numeros pequenos acaba flotando FUERA. Lo usan las GEMAS,
     que son la unica pieza que tiene que quedarse dentro del marco; las tres del abanico se
     miden desde `--pack-tilt`, igual que las del lote, y por eso asoman igual que ellas. */
  --in-top: calc(var(--pack-rise) + var(--pack-tilt));
}
/* La ventana sigue abierta SOLO por arriba (es lo que deja asomar al abanico); los otros tres
   lados cortan, que es lo que mete las gemas dentro del banner. */
.store-rail-item.is-cosmetics .store-rail-clip { display: block; }
/* La regla que coloca el sobre de una coleccion (`.store-rail-clip > img`) no alcanza aqui:
   las piezas son nietas de la ventana, no hijas. La sombra del CONJUNTO la pone
   `.store-rail-group`, que se reusa tal cual. */
.rail-cosm { z-index: 0; }

/* LAS TRES GEMAS, a la DERECHA. Tres tamanos (una grande abajo, una mediana arriba y una
   pequena en medio) y tres giros distintos: repetidas al mismo tamano se leerian como un
   patron. La grande sale por el borde de ABAJO, que es lo que las mete en el banner en vez de
   dejarlas flotando. Contorno de tinta con el mismo `--stroke` que los sobres.
   Se anclan con `right` y no con `left`: asi se quedan pegadas a SU borde pase lo que pase
   con el ancho del banner, que es lo unico que cambia entre un monitor y un telefono. */
.rail-cosm-gems { position: absolute; inset: 0; pointer-events: none; }
.rail-cosm-gems img {
  position: absolute; width: auto; height: auto; object-fit: contain;
  filter: var(--stroke) drop-shadow(0 4px 7px rgba(0, 0, 0, 0.55));
}
/* Bajaron de talla al pasar el abanico a las proporciones del lote: la carta de la derecha
   llega ahora hasta ~0,25 del borde, asi que las tres viven en la franja que queda entre esa
   carta y el canto del banner. Meterlas mas adentro no valdria — las cartas van en `z-index`
   1 y 2 y se las comerian. */
.rail-cosm-gems .is-1 {   /* la grande, abajo del todo y mordida por el borde de abajo */
  width: calc(var(--pack-w) * 0.28);
  right: calc(var(--pack-w) * -0.035); bottom: calc(var(--pack-w) * -0.06);
  transform: rotate(-13deg);
}
.rail-cosm-gems .is-2 {   /* la mediana, en la esquina de arriba */
  width: calc(var(--pack-w) * 0.19);
  right: calc(var(--pack-w) * -0.015); top: calc(var(--in-top) + var(--pack-w) * 0.01);
  transform: rotate(16deg);
}
.rail-cosm-gems .is-3 {   /* la pequena, a media altura y un paso hacia dentro */
  width: calc(var(--pack-w) * 0.13);
  right: calc(var(--pack-w) * 0.185); top: calc(var(--in-top) + var(--pack-w) * 0.115);
  transform: rotate(-4deg);
}

/* EL DORSO DEL CLAN, en el hueco del SOBRE IZQUIERDO del lote: mismo ancho (0,62), misma
   altura (`--pack-tilt` + 0,08) y mismo giro (-17deg) que `.store-rail-behind img.is-l`. */
.rail-cosm-back {
  position: absolute; z-index: 0;
  left: calc(var(--pack-x) - var(--pack-w) * 0.34); top: calc(var(--pack-tilt) + var(--pack-w) * 0.08);
  width: calc(var(--pack-w) * 0.62); height: auto;
  transform: rotate(-17deg);
  /* Un punto por debajo del resto: el nombre del banner cae justo encima (no hay ancho para
     las dos cosas, ver el bloque de arriba) y sobre el dorso a plena luz el blanco se perdia.
     En `.on` sube, que es cuando el banner es el elegido y manda la imagen. */
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)) brightness(0.8);
  transition: transform .2s var(--ease-out), filter .2s ease;
}

/* LAS DOS CARTAS. No reusan `.store-rail-card` a proposito: esa clase trae el giro y el
   `translateY` del lote escritos en su `transform`, y aqui cada carta necesita el suyo. Lo
   que si se reusa es `--card-lift`, la variable con la que el item dice cuanto levanta su
   arte al estar elegido o bajo el raton. */
.rail-cosm-card { position: absolute; aspect-ratio: 11 / 16; }
.rail-cosm-card .card { width: 100%; height: 100%; }
/* Miami Cryptobro ocupa el sitio de LA CARTA del lote: `--pack-x`, `--pack-tilt`, 0,9 de
   ancho y -8deg (ver `.store-rail-card`). */
.rail-cosm-card.is-front {
  z-index: 2;
  left: var(--pack-x); top: var(--pack-tilt);
  width: calc(var(--pack-w) * 0.90);
  transform: rotate(-8deg) translateY(calc(-1 * var(--card-lift, 0px)));
  filter: saturate(0.82) brightness(0.9);
  transition: transform .2s var(--ease-out), filter .2s ease;
}
/* Y Paris Penthouse el del SOBRE DERECHO (`.store-rail-behind img.is-r`): +0,62 de
   desplazamiento, 0,62 de ancho y +15deg. Sale mas apagada que la de delante por lo mismo que
   los sobres del lote — es lo que la manda al fondo del abanico. */
.rail-cosm-card.is-behind {
  z-index: 1;
  left: calc(var(--pack-x) + var(--pack-w) * 0.62); top: calc(var(--pack-tilt) + var(--pack-w) * 0.08);
  width: calc(var(--pack-w) * 0.62);
  transform: rotate(15deg) translateY(calc(-1 * var(--card-lift, 0px) * 0.5));
  filter: saturate(0.68) brightness(0.74);
  transition: transform .2s var(--ease-out), filter .2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .store-rail-item.is-cosmetics:hover { --card-lift: 4px; }
  .store-rail-item.is-cosmetics:hover .rail-cosm-card.is-front { filter: saturate(1) brightness(1); }
  .store-rail-item.is-cosmetics:hover .rail-cosm-card.is-behind { filter: saturate(0.9) brightness(0.9); }
  .store-rail-item.is-cosmetics:hover .rail-cosm-back {
    transform: rotate(-17deg) translateY(-3px);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)) brightness(0.92);
  }
}
.store-rail-item.is-cosmetics.on .rail-cosm-card.is-front {
  transform: rotate(-7deg) translateY(calc(-1 * var(--card-lift))) scale(1.04);
  filter: saturate(1.08) brightness(1.08);
}
.store-rail-item.is-cosmetics.on .rail-cosm-card.is-behind { filter: saturate(0.95) brightness(0.95); }
.store-rail-item.is-cosmetics.on .rail-cosm-back {
  transform: rotate(-17deg) translateY(-4px) scale(1.03);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)) brightness(1);
}

/* Un DORSO a tamano carta: el dibujo manda (ya trae sus esquinas redondeadas y su
   margen transparente), asi que solo se le da ancho y su sombra. */
.deck-back-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55)); }
.inv-back-body { justify-content: center; }

/* ---- LA FICHA DEL LOTE ---------------------------------------------------------- */
/* LA COMPOSICION: todo lo que trae el lote en una sola imagen. Los sobres a los lados y por
   detras, el efecto delante y abajo, y la carta en el centro. Las piezas de alrededor van
   absolutas y QUIETAS: la unica que responde al raton es la del centro, que es el producto.
   El alto lo pone la carta (unica pieza en flujo), asi que la caja no puede colapsar. */
/* La caja es MAS ESTRECHA que la suma de las piezas a proposito: asi los sobres se meten
   por detras de la carta en vez de quedarse a un lado, y las cuatro cosas se leen como un
   grupo. Las de alrededor van absolutas y quietas; la del centro es la unica que se mueve. */
/* EL CONTORNO DEL CONJUNTO, no de cada pieza: un `drop-shadow` puesto en el CONTENEDOR se
   calcula sobre el alfa ya compuesto de todo lo que lleva dentro, asi que dibuja UNA sola
   silueta alrededor del grupo (donde dos piezas se solapan no hay borde). Dos capas: una
   pegada al canto, que es el contorno, y otra ancha y suave, que es el brillo. */
.bundle-compo {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: min(100%, clamp(280px, 30vw, 520px));
  filter:
    drop-shadow(0 0 3px rgba(255, 244, 214, 0.72))
    drop-shadow(0 0 22px rgba(245, 193, 74, 0.4));
}
/* UN MONTON POR COLECCION. El contenedor solo marca DONDE empieza la pila (no tiene caja
   propia); cada sobre se coloca contra ese punto y se separa segun su profundidad `--k`,
   que ademas lo gira un poco mas y lo apaga un poco mas: eso es lo que da sensacion de
   fondo sin tener que dibujar sombras entre copias. */
/* El contenedor es una CAJA DE VERDAD (la de un sobre), no un punto: las copias se colocan
   contra sus esquinas y se separan segun `--k`. Con `width: 0` las copias se anclaban al
   borde de un contenedor sin ancho y la pila entera se iba de sitio. */
.bundle-compo-stack {
  /* ABANICO: las dos pilas se apilan en el CENTRO y cada copia gira sobre un punto por
     debajo (`transform-origin`), que es lo que las abre en arco a los lados dejando el
     medio para la carta. `--k` es la profundidad: cuanto mas al fondo, mas abierta va y
     mas apagada. */
  position: absolute; left: 50%; top: 50%; z-index: 1; pointer-events: none;
  /* El ancho va en % DEL ESCAPARATE, no en `vw`: el abanico tiene que caber en SU
     columna, y esa columna se estrecha mucho antes que la ventana. Con `vw` a 1440
     el abanico medía 801 px dentro de un escaparate de 380 y se metía en el rail y
     en la ficha. */
  width: 40%; aspect-ratio: 448 / 600;
}
.bundle-compo-stack img {
  position: absolute; left: 0; top: 0; width: 100%; height: auto;
  transform-origin: 50% 152%;
  transform: rotate(var(--a));
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.6))
          brightness(calc(0.98 - var(--d) * 0.05)) saturate(calc(0.98 - var(--d) * 0.04));
}
/* La APERTURA del abanico en dos mandos: el angulo del primer sobre y lo que se abre cada
   copia siguiente. Van en variables porque los dos sitios que usan la composicion no la ven
   igual de ancha — la ficha de la tienda vive en una columna estrecha y el cartel del home
   es apaisado, asi que alli el abanico se abre mas (ver `.home2-banner-media`). */
.bundle-compo-stack { --fan-a0: 11deg; --fan-step: 6deg; }
.bundle-compo-stack.is-l img { --a: calc(-1 * (var(--fan-a0) + var(--k) * var(--fan-step))); }
.bundle-compo-stack.is-r img { --a: calc(var(--fan-a0) + var(--k) * var(--fan-step)); }
/* El efecto, DELANTE de la carta y mordiendole la esquina: pegado a ella, no suelto. */
.bundle-compo-fx-wrap {
  position: absolute; z-index: 4; pointer-events: none;
  left: -2%; bottom: -6%;
  width: clamp(104px, 10vw, 158px); aspect-ratio: 1 / 1;
  display: grid; place-items: center;
}
/* Un lote con dibujo propio del efecto (`fxArt`: recorte transparente, sin marco): mas grande
   que la miniatura cuadrada, porque su contenido no llena la caja. */
.bundle-compo-fx-wrap.is-art { width: clamp(180px, 17vw, 270px); left: -24%; bottom: -15%; }
.bundle-compo-fx-wrap.is-art .bundle-compo-fx { --fx-a: 0deg; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)); }
.home2-banner-media .bundle-compo-fx-wrap.is-art { width: 84%; left: -30%; bottom: -14%; }
/* EL IMPACTO DE DETRAS. Dibujado, no el efecto en marcha: se pidio SIN animar, y ademas el
   burst de verdad se monta a base de particulas que se borran solas — no hay nada que
   dejar quieto. Son las mismas tres piezas que el impacto del juego (nucleo, puas y
   anillo) y los mismos tonos calidos: el fogonazo en un `radial-gradient`, las puas en un
   `repeating-conic-gradient` y el anillo en el ::after. La mascara redonda es la que
   apaga las puas hacia fuera, para que no se vea el borde de la caja. */
.bundle-compo-burst {
  position: absolute; inset: -32%; z-index: 0; pointer-events: none;
  display: grid; place-items: center;
}
/* El fogonazo suave DEBAJO de la estrella: le da cuerpo al centro del golpe. */
.bundle-compo-burst::before {
  content: ''; position: absolute; inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 253, 242, 0.85) 0%, rgba(255, 232, 168, 0.42) 26%, rgba(255, 200, 92, 0) 62%);
}
/* LA ESTRELLA: puntas irregulares, como el golpe del juego. */
.burst-star {
  position: relative; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 0 7px rgba(255, 214, 120, 0.6));
}
.burst-star path { fill: rgba(255, 250, 231, 0.82); }
/* La calavera se apoya LADEADA a la izquierda. El angulo de reposo vive en `--fx-a` y no
   escrito en el `transform`, porque la ESTAMPA de entrada tambien gira: si el angulo se
   pusiera aparte, la animacion acabaria en 0deg y la pieza pegaria un salto al terminar.
   Asi los fotogramas de `bundleStamp` giran ALREDEDOR de el y la estampa aterriza ya
   inclinada. Lo comparten los dos carteles, que es lo que tiene ser la misma pieza. */
.bundle-compo-fx {
  position: relative; z-index: 1;
  width: 100%; height: auto;
  --fx-a: -8deg;
  transform: rotate(var(--fx-a));
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6));
}
/* EL DORSO que trae el lote: una carta boca abajo apoyada contra la del escaparate por la
   esquina de ABAJO A LA DERECHA — la simetrica de la estampa de impacto, que muerde la de
   abajo a la izquierda. Va DELANTE de la carta (z 4, el mismo que la estampa): detras se
   perdia — la carta del escaparate le tapaba dos tercios y solo asomaba una tira. */
.bundle-compo-back {
  position: absolute; z-index: 4; pointer-events: none;
  right: -1%; bottom: -7%;
  width: clamp(96px, 9.2vw, 146px);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.62));
}
.bundle-compo-back img { width: 100%; height: auto; display: block; }
/* La carta del escaparate: grande, y con la misma inclinacion al raton que en el rail. */
.bundle-card { position: relative; z-index: 3; width: clamp(180px, 17vw, 270px); aspect-ratio: 11 / 16; perspective: 1300px; }

/* ---- LA ENTRADA, al seleccionar el lote --------------------------------------------
   `BundleDetail` se monta de nuevo cada vez que se elige el lote (va con `key`), asi que
   basta una animacion CSS con `backwards`: se reproduce sola en cada seleccion y no hay
   que orquestar nada. Los sobres y la carta hacen POP escalonado; la calavera no — ella
   ESTAMPA, como el impacto del que sale, y se queda puesta. */
@keyframes bundlePop {
  0%   { transform: var(--pop-t, none) scale(0.62); opacity: 0; }
  62%  { transform: var(--pop-t, none) scale(1.06); opacity: 1; }
  100% { transform: var(--pop-t, none) scale(1);    opacity: 1; }
}
/* Los giros son RELATIVOS al angulo de reposo (`--fx-a`, ver `.bundle-compo-fx`), no
   absolutos: asi la estampa aterriza en la inclinacion que tenga la pieza en vez de en 0deg
   y dar un salto al acabar. */
@keyframes bundleStamp {
  0%   { transform: scale(0.28) rotate(calc(var(--fx-a, 0deg) - 16deg)); opacity: 0; }
  45%  { transform: scale(1.18) rotate(calc(var(--fx-a, 0deg) + 5deg));  opacity: 1; }
  72%  { transform: scale(0.96) rotate(calc(var(--fx-a, 0deg) - 2deg));  opacity: 1; }
  100% { transform: scale(1)    rotate(var(--fx-a, 0deg));               opacity: 1; }
}
.bundle-card { animation: bundlePop 420ms var(--ease-out) 60ms backwards; }
/* La pila entera hace UN pop, no uno por sobre: se anima el contenedor, que no lleva
   transform propio, asi que la animacion no le come el giro a ninguna copia. Cada lado
   entra con su retardo. */
/* La pila entera hace UN pop. Su centrado va en `--pop-t` o el primer fotograma de la
   animacion se lo comeria y el abanico saltaria de sitio. */
.bundle-compo-stack { --pop-t: translate(-50%, -76%); transform: var(--pop-t); animation: bundlePop 420ms var(--ease-out) backwards; }
.bundle-compo-stack.is-l { animation-delay: 150ms; }
.bundle-compo-stack.is-r { animation-delay: 220ms; }
/* El fogonazo ESTALLA y se queda: sale de golpe, se pasa de tamano y vuelve — pero
   termina puesto, que es lo que lo deja congelado detras del objeto. */
@keyframes bundleBurstIn {
  0%   { transform: scale(0.15); opacity: 0; }
  38%  { transform: scale(1.28); opacity: 1; }
  70%  { transform: scale(0.94); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
/* El dorso entra con el mismo POP que los sobres y la carta, no con la ESTAMPA de la
   calavera: es una carta que se deja sobre la mesa, no un golpe. Su giro va en `--pop-t`
   por lo mismo que el de las pilas — si no, el primer fotograma se lo comeria. */
.bundle-compo-back { --pop-t: rotate(21deg); transform: var(--pop-t); animation: bundlePop 420ms var(--ease-out) 260ms backwards; }
.bundle-compo-fx { animation: bundleStamp 520ms cubic-bezier(.2, 1.3, .35, 1) 300ms backwards; }
.bundle-compo-burst { animation: bundleBurstIn 560ms cubic-bezier(.2, 1.1, .35, 1) 300ms backwards; }
@media (prefers-reduced-motion: reduce) {
  .bundle-card, .bundle-compo-stack, .bundle-compo-fx, .bundle-compo-burst, .bundle-compo-back { animation: none; }
}
.bundle-card .card { width: 100%; height: 100%; transition: transform .18s var(--ease-out); }
/* WHAT YOU GET: rotulo de TITULO (la display del juego) en oro claro, como los demas
   encabezados de la tienda. Bowlby One ya es muy ancha de por si, asi que el espaciado
   entre letras baja de 0.12em a 0.05em o se lee como un cartel de neon. */
.bundle-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(13px, 1.05vw, 17px); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 12px rgba(245, 193, 74, 0.3);
  margin-bottom: 10px;
}
/* ---- EL POP-UP DE DUPLICADO ----
   Reusa el cascaron `.buy-done` (relieve del kit, animacion de entrada, contorno de tinta);
   lo unico propio es el acento AMBAR, que se mete por `--accent` para que lo cojan a la vez
   el borde y el resplandor que ya lee esa clase. */
.dupe-warn { --accent: #f0b73a; max-width: min(430px, 100%); gap: 12px; }
/* El signo de admiracion, en chapa redonda: es lo primero que se ve y es lo que dice que
   esto no es la confirmacion de siempre. */
.dupe-warn-mark {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 32px; line-height: 1; color: #3a2708;
  background: linear-gradient(180deg, #ffd98a, #f0b73a);
  border: 3px solid var(--gv-ink);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.55), 0 4px 12px -4px rgba(0,0,0,0.7);
}
.dupe-warn-title { color: var(--gold-bright); }
.dupe-warn-body {
  margin: 0; max-width: 42ch;
  font-family: var(--font-ui); font-size: clamp(12.5px, 1vw, 14.5px); line-height: 1.55;
  color: var(--text-dim);
}
/* Los objetos repetidos, con su arte: la lista contesta "cuales" sin que haya que cerrarlo
   para ir a mirarlo. */
.dupe-warn-list {
  list-style: none; margin: 2px 0 0; padding: 0; width: 100%;
  display: flex; flex-direction: column; gap: 7px;
}
.dupe-warn-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 12px 7px 8px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06);
}
/* `position: relative` NO es adorno, es LA correccion. La skin de Larry es foil, asi que
   `ItemArt` le monta encima `.foil-fx` (`inset: 0`, `mix-blend-mode: overlay`) y su destello.
   Con esta caja en `static`, ese `inset: 0` no se mide contra la miniatura sino contra el
   primer ancestro POSICIONADO — el panel — y el arcoiris se estiraba a 414x564: el modal
   entero salia verde. El `overflow: hidden` no lo impedia, porque no recorta a un absoluto
   cuyo bloque contenedor esta mas arriba. `isolation` ademas encierra la mezcla. */
.dupe-warn-art {
  position: relative; isolation: isolate;
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
}
.dupe-warn-art img { width: 100%; height: 100%; object-fit: contain; }
.dupe-warn-name {
  text-align: left; font-family: var(--font-ui); font-weight: 700;
  font-size: clamp(12px, 0.95vw, 14px); color: var(--text);
}

/* ---- AVISO DE DUPLICADO ----
   El rotulo del lote a la izquierda y, en la esquina contraria, cuantos de sus cosmeticos ya
   tienes. El `margin-bottom` del titulo se anula: ahora lo pone la fila, o el cartel quedaria
   descolgado 10 px por encima. */
.bundle-head-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.bundle-head-row .bundle-title { margin-bottom: 0; }
/* Ambar y no rojo: no es un error, es un "ojo con esto". El rojo de la casa esta reservado
   a lo que sale mal. */
.bundle-dupe-flag {
  flex: 0 0 auto;
  font-family: var(--font-ui); font-weight: 800;
  font-size: clamp(9.5px, 0.72vw, 11.5px); letter-spacing: .06em; line-height: 1;
  text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  color: #3a2708; background: linear-gradient(180deg, #ffd98a, #f0b73a);
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 6px -2px rgba(0,0,0,0.6);
}
/* La chapa de la FILA: dice CUAL de los tres repites. Mas apagada que el cartel — el cartel
   es el titular y esto la letra pequena. */
.bundle-row-owned { flex: 0 0 auto; font-size: 9.5px; padding: 2px 7px; }
/* Y BAJA DE LINEA. El cuerpo de la fila es `art | nombre | Preview | xN` y el nombre ya iba
   justo (por eso lleva `-webkit-line-clamp: 2`): meter la chapa en la misma linea dejaba
   "Deathbound Larry (Skin)" en "Deat La...". Con la chapa presente el nombre se queda la
   primera linea entera y la chapa se va abajo con el boton. */
.bundle-row.is-owned .bundle-row-body { flex-wrap: wrap; row-gap: 6px; }
.bundle-row.is-owned .bundle-row-name { flex: 1 1 100%; }

.bundle-list { list-style: none; margin: 0 0 clamp(10px, 1.4vh, 16px); padding: 0; display: flex; flex-direction: column; gap: 7px; }
/* RELIEVE Y BRILLO, como el resto de superficies del kit: cara con luz arriba, contorno de
   tinta, filo claro pegado al borde superior y sombra propia debajo. El brillo va en el
   PROPIO fondo y no en un `::after`: una capa absoluta encima laveria el texto y el dibujo,
   que van en flujo. Mas relleno a la DERECHA (16 vs 11) para que el x1 / x5 no quede pegado
   al canto. */
.bundle-row {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 16px 7px 11px; border-radius: 12px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.105) 0%, rgba(255, 255, 255, 0.038) 46%, rgba(0, 0, 0, 0.10) 100%);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow:
    0 3px 7px rgba(0, 0, 0, 0.38),
    inset 0 2px 0 rgba(255, 255, 255, 0.16),
    inset 0 -3px 7px rgba(0, 0, 0, 0.28);
}
/* El dibujo de cada linea: el SOBRE se pinta entero y el objeto va recortado como en el
   inventario, de ahi el modificador. */
/* El dibujo, GRANDE: es lo que hace que la lista se lea de un vistazo. */
/* `position: relative` porque el dibujo de un OBJETO se monta en capas ABSOLUTAS (el fondo
   de la skin, el brillo del foil, el rotulo del acabado): sin ancla se irian al primer padre
   posicionado, que aqui es media tienda. */
.bundle-row-art {
  position: relative;
  flex: 0 0 auto; width: clamp(54px, 4.6vw, 76px); aspect-ratio: 1 / 1;
  display: grid; place-items: center;
}
.bundle-row-art img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.bundle-row-art.is-item {
  border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, 0.34);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.10);
}
/* Un objeto con DIBUJO PROPIO (la calavera, un dorso) se pinta ENTERO, igual que en el
   inventario: es una estampa sobre transparencia, no una ventana de arte que recortar. */
.bundle-row-art.is-icon .inv-item-main { object-fit: contain; object-position: center; padding: 8%; }
/* El rotulo del acabado es la misma pieza que en la ficha, pero la casilla de la fila es
   bastante mas pequena: sin subirlo un poco se queda en un rayajo. */
.bundle-row-art .inv-item-finish { height: 26%; bottom: 5%; }
/* Por CLASE y no por `img`: dentro de la casilla hay mas imagenes (el fondo de la skin, su
   rotulo de acabado) y un selector de elemento se las llevaba por delante. */
.bundle-row-art.is-item .inv-item-main { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
/* Un objeto de IMPACTO se enseña igual que en el escaparate: su estampa sobre el fogonazo,
   entera y sin recortar (por eso pierde el `cover` de la casilla). */
.bundle-row-art.has-burst { position: relative; overflow: visible; background: none; border-color: transparent; }
.bundle-row-art.has-burst .inv-item-main { object-fit: contain; object-position: center; position: relative; z-index: 1; }
.bundle-row-art.has-burst .bundle-compo-burst { inset: -34%; animation: none; }
/* Nombre y (si lo hay) su boton de vista previa, apilados: el boton no puede empujar al
   numero, que vive pegado al borde derecho. */
/* Nombre y boton EN LINEA: el boton a la derecha del nombre, no debajo. El nombre encoge
   (puede partirse en dos lineas) y el boton nunca. */
.bundle-row-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
/* El nombre ENVUELVE en vez de recortarse: la columna de la ficha encogio al separar mas
   las columnas de la tienda, y "Deathbound Larry Foil Skin" se quedaba en "Foil S…". */
.bundle-row-name {
  flex: 1; min-width: 0; font-family: var(--font-ui); font-weight: 700;
  font-size: clamp(12px, 0.95vw, 14px); line-height: 1.25; color: var(--text);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.bundle-row-preview {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; font-size: 11.5px;
}
.bundle-row-preview .cl-sim-tri { font-size: 0.8em; }
.bundle-row-n {
  flex: 0 0 auto; font-family: var(--font-display); font-size: clamp(13px, 1.05vw, 16px);
  color: var(--gold-bright); font-variant-numeric: tabular-nums;
}
.bundle-value {
  margin: 0 0 clamp(10px, 1.4vh, 16px); font-family: var(--font-ui); font-weight: 700;
  font-size: 11.5px; letter-spacing: 0.02em; color: var(--text-muted); text-align: center;
}
/* La caja de confirmacion/recibo del lote: la misma que la de los sobres, un poco mas
   ancha porque lo que ensena es una LISTA y no un abanico de sobres. */
.bundle-modal { width: min(420px, 92vw); }
.bundle-modal .bundle-list { width: 100%; margin: 12px 0 4px; }

/* ---- Stage: the product shot, vertically centred in whatever height is left ---- */
.store-stage {
  position: relative; min-width: 0; min-height: 0; align-self: stretch;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(2px, 0.5vh, 8px);
  animation: storeStageIn 0.26s var(--ease-out) backwards;
}
@keyframes storeStageIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; } }
/* EL LOTE necesita mas aire bajo la composicion que un sobre suelto: sus piezas (la
   estampa, el dorso) van en absoluto y CUELGAN por debajo de la caja, asi que con el hueco
   de serie el rotulo WELCOME PACK quedaba tapado. */
.store-stage.bundle-stage { gap: clamp(22px, 6vh, 64px); }
.store-stage-name {
  margin: 0; font-family: var(--font-display); letter-spacing: 0.03em; text-align: center;
  font-size: clamp(20px, min(2.2vw, 3.4vh), 38px); color: var(--text);
  text-shadow: 0 3px 14px color-mix(in srgb, var(--accent, var(--gold)) 45%, transparent);
  display: flex; align-items: center; justify-content: center; gap: clamp(9px, 0.9vw, 15px);
  flex-wrap: wrap;
}
/* La chapa del lote (×10 (+1)) vive a la izquierda del nombre de la coleccion. Misma
   pildora dorada que llevaba debajo de los sobres; el `+1` cuelga de su borde derecho
   en absoluto, para que la chapa no se descentre al aparecer al segundo. */
/* Solo el numero: sin pildora, sin fondo y sin contorno. */
.stage-count {
  flex: 0 0 auto; position: relative;
  font-family: var(--font-display); font-size: 0.72em; line-height: 1;
  color: var(--gold-bright); font-variant-numeric: tabular-nums;
  animation: stageCountIn 320ms var(--ease-out) backwards;
}
/* El `+1` va en absoluto (para no descentrar la chapa al entrar al segundo), asi que el
   sitio para el hay que RESERVARLO aqui: sin esto se monta encima del nombre. */
.stage-count.has-plus { margin-right: 1.5em; }
@keyframes stageCountIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
.stage-count-plus {
  position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-size: 0.86em; line-height: 1; color: #4ade80;
  text-shadow: 0 0 10px rgba(34,197,94,0.45);
  animation: packStackPlus 260ms var(--ease-out) 1000ms backwards;
}
/* El acceso a la coleccion del sobre. Era un enlace de texto gris que se perdia sobre el
   pedestal; hoy lleva la clase `.btn`, o sea el 9-slice del UI KIT en su tono APAGADO (el
   dorado de esta pantalla es COMPRAR y no se le puede hacer sombra). Aqui solo se le da la
   talla: la altura `--gb-h` manda en el grosor del contorno y se declara junto al resto de
   alturas del kit, al final de la hoja. */
.store-coll-link {
  margin-top: clamp(2px, 0.6vh, 8px);
  padding: 0 clamp(12px, 1.1vw, 20px); min-height: var(--gb-h); line-height: 1;
  border-radius: 10px; cursor: pointer;
  font-size: clamp(11.5px, 0.92vw, 14px);
  display: inline-flex; align-items: center; gap: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s var(--ease-out), filter .15s ease;
}
@media (hover: hover) and (pointer: fine) { .store-coll-link:hover { transform: translateY(-2px); filter: brightness(1.06); } }
.store-coll-link:active { transform: translateY(1px); }
.store-coll-link:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
/* ---- Panel: one solid surface so the buy flow reads as a counter, not loose text ---- */
.store-panel {
  min-width: 0; min-height: 0; max-height: 100%; align-self: center;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(16px, 1.6vw, 28px) clamp(16px, 1.5vw, 26px);
  border-radius: 20px; border: 1px solid var(--border-soft);
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent, var(--gold)) 13%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.017));
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 18px 44px -28px rgba(0,0,0,0.9);
}
/* Everything the panel sells, in one column. Deliberately NOT a scroll container:
   `overflow-y: auto` silently promotes overflow-x to auto as well, and the `+1 FREE`
   badge (which hangs 6px past its button on purpose) then produced a permanent 5px
   sideways scrollbar on every landscape size. The column is sized to fit instead. */
.store-panel-scroll {
  display: flex; flex-direction: column; gap: clamp(12px, 1.6vh, 22px);
  min-height: 0; overflow: visible;
}
.store-panel .pack-contents { max-width: none; margin: 0; gap: clamp(8px, 1vh, 13px); }
.store-panel .shop-buy-row { margin-top: 0; }

/* Landscape but SHORT (laptops, small windows): trim the vertical rhythm before
   anything is allowed to overflow. */
@media (min-width: 1025px) and (max-height: 760px) {
  .shop-store .shop-head { margin-bottom: clamp(6px, 1.2vh, 14px); }
  .shop-store .shop-head-icon { width: clamp(34px, 4vw, 52px); height: clamp(34px, 4vw, 52px); }
  .shop-store .shop-head h2 { font-size: clamp(22px, 3vw, 38px); }
  .store-panel { padding: clamp(12px, 1.2vw, 20px) clamp(14px, 1.3vw, 22px); }
}

/* Narrow / portrait: the rail becomes a horizontal strip above the stage, and the
   stage + panel stack. Here the screen MAY scroll — that's the "only if it's really
   necessary" case. */
@media (max-width: 1024px) {
  .store-body {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: min-content;
    gap: clamp(12px, 2vh, 22px);
    align-items: start;
  }
  .store-rail {
    flex-direction: row; flex-wrap: wrap; justify-content: center;
    padding: 0 0 clamp(10px, 1.6vh, 16px);
  }
  /* EL BANNER, MAS ANCHO. A 230 px el arte se llevaba el hueco entero y al nombre le
     quedaban 47: «Welcome Pack» salia como «WELCO PACK» y COSMETICS como «COSME». Ya venia
     cortado de antes —el hueco del arte se deriva de `--pack-w`, que aqui no baja de 122— y
     las mayusculas, que son un 8-10 % mas anchas, lo dejaron en evidencia.
     Con 330 el nombre tiene ~136 px y caben los cuatro. Y siguen entrando DOS por fila:
     2 x 330 + hueco < 1024, que es donde empieza este bloque. */
  .store-rail-item { width: clamp(230px, 45vw, 330px); }
  .store-rail-name { -webkit-line-clamp: 2; }
  .store-stage { gap: 6px; }
  /* Portrait has height to spare and no second column to feed, so the hero is sized
     off the WIDTH — the landscape vw caps left a small pack under a tall empty gap. */
  .store-stage .shop-pack-art.detail-art {
    width: clamp(160px, 30vw, 300px);
    height: clamp(226px, min(42vw, 34vh), 420px);
  }
}
/* Phones: the storefront still has to FIT (a 430x932 handset overflowed by ~160px), so
   every piece drops a size class. The bulk badge goes with them — it repeats verbatim the
   `+1 FREE` pill sitting a few px below it on the 10-pack option. */
@media (max-width: 560px) {
  .shop-screen.shop-store { padding-top: max(14px, var(--safe-t)); padding-bottom: max(12px, var(--safe-b, 0px)); }
  .shop-store .shop-head { margin-bottom: 8px; }
  .store-body { gap: clamp(10px, 1.4vh, 16px); }
  .store-rail { gap: 8px; padding-bottom: 8px; }
  /* Narrow enough that BOTH banners sit on one row — stacked they cost 72px of a
     viewport that has none to spare. */
  /* El sobre baja de talla con todo lo demas — y el hueco que le reserva el padding sale
     de `--pack-w`, no de un numero suelto, o el arte se comeria el nombre. */
  .store-rail-item {
    --pack-w: 52px; --pack-x: 7px;
    width: clamp(118px, 41vw, 172px); min-height: 58px; gap: 3px;
    padding: 7px 9px 7px calc(var(--pack-x) + var(--pack-w) + 8px);
  }
  /* HIJO DIRECTO DE LA VENTANA, que es el sobre de una coleccion — el mismo cuidado que ya
     lleva escrito `.store-rail-clip > img` unas cuantas lineas mas arriba. A secas
     (`.store-rail-item img`) esto alcanzaba a TODOS los <img> del banner: los de dentro de
     la carta del lote y, desde la composicion de cosmeticos, tambien sus gemas y su dorso —
     y a los tres les clavaba 74 px de alto. */
  .store-rail-item .store-rail-clip > img { height: 74px; }
  /* En el movil el banner mide 172 px y el hueco del arte se lleva 84, asi que al nombre le
     quedan 79. En caja alta «COSMETICS» pedia ~85 y perdia la ultima letra, y «AWAKENING OF
     THE WHALES» no cabe en dos lineas a ningun tamano razonable. Baja el cuerpo y sube a
     TRES lineas — caben de sobra en el `min-height` de 58 px del banner. */
  .store-rail-name { font-size: 11px; -webkit-line-clamp: 3; }
  .store-stage .shop-pack-art.detail-art {
    width: clamp(118px, 33vw, 220px);
    height: clamp(166px, min(42vw, 28vh), 300px);
  }
  .detail-stage { padding: 2px 0 6px; }
  .store-stage-name { font-size: clamp(19px, 6vw, 26px); }
  .store-coll-link { font-size: 12px; padding: 0 12px; }
  .store-panel { padding: 14px; }
  .store-panel-scroll { gap: 12px; }
}

/* Wide landscape phones/tablets keep the 3 columns but pay for the shorter height. */
@media (max-width: 1024px) and (orientation: landscape) and (min-aspect-ratio: 3/2) {
  .store-body { grid-template-columns: auto minmax(0, 1fr) minmax(380px, 1.2fr); align-items: stretch; }
  .store-rail { flex-direction: column; flex-wrap: nowrap; padding: 0 clamp(4px, 0.6vw, 10px) 0 0; }
  .store-rail-item {
    --pack-w: 56px; --pack-x: 7px;
    width: clamp(126px, 17vw, 168px); min-height: 60px; gap: 3px;
    padding: 7px 9px 7px calc(var(--pack-x) + var(--pack-w) + 8px);
  }
  .store-rail-item img { width: var(--pack-w); height: 78px; }
  .store-rail-name { font-size: 12px; }
}

/* ---- The lit pedestal the pack (or the 10-pack stack) stands on ---- */
/* El padding inferior reservaba sitio para la chapa ×N, que ahora vive junto al titulo. */
.detail-stage { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; padding: clamp(6px, 0.8vw, 14px) 0 clamp(8px, 0.9vw, 16px); }
/* No radial pool behind the pack any more, and no blurred floor ellipse under it: the
   light now traces the lot's own outline (see `.pack-stack-row` below), which a circular
   gradient could never do once the row is ten packs wide. */
.detail-stage .shop-pack-art { position: relative; z-index: 1; }

/* ---- The pack row: what a 10-pack looks like before you buy it ----
   Packs racked side by side, left→right: copy 0 is fully readable and on top, every next
   one sits BEHIND it shifted right by one `--x` step so only its edge shows. `--d` is the
   position in the row, used for the dimming. No scale and no vertical drift — they are
   all standing on the same shelf. (A symmetric FAN and an alternating-sides pile both
   lived here first; the fan read as a peacock and the pile buried the artwork.) */
.pack-stack { position: relative; width: 100%; height: 100%; }
/* El brillo del lote es UNO SOLO: el filtro corre sobre esta capa, asi que la
   drop-shadow la proyecta el alpha COMPUESTO de todos los packs — la silueta unida del
   conjunto — en vez de un aro por copia (que es lo que daria el filtro puesto en cada
   `.pack-stack-item`). Dos pasadas: un contorno pegado y un bloom mas abierto. */
.pack-stack-row { position: absolute; inset: 0; }
.buy-confirm-art .pack-stack-row { filter: drop-shadow(0 10px 18px rgba(0,0,0,0.55)); }
.detail-stage .pack-stack-row {
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--accent, var(--gold)) 48%, transparent))
          drop-shadow(0 0 8px color-mix(in srgb, var(--accent, var(--gold)) 26%, transparent));
  animation: packGlowPulse 2.9s ease-in-out infinite;
}
/* Pulse sutil: solo respira el radio y la fuerza, no la posicion (nada se mueve). */
@keyframes packGlowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 1.5px color-mix(in srgb, var(--accent, var(--gold)) 40%, transparent))
            drop-shadow(0 0 6px color-mix(in srgb, var(--accent, var(--gold)) 20%, transparent));
  }
  50% {
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent, var(--gold)) 58%, transparent))
            drop-shadow(0 0 11px color-mix(in srgb, var(--accent, var(--gold)) 34%, transparent));
  }
}
.pack-stack-item {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transform: translateX(var(--x, 0%));
  /* Depth reads through light, not blur: each pack further back loses a little
     brightness, tapering off so the far end of the row does not go black.
     NO drop-shadow here: the group's contour traces the composited alpha of this layer,
     so a blurred shadow per pack would fatten the silhouette into a halo. Whatever
     shadow the lot needs is cast once, by `.pack-stack-row`. */
  filter: brightness(calc(1 - min(var(--d, 0) * 0.055, 0.34)));
}
/* Dealt, not revealed: each pack FALLS into its place in the row, back of the row first
   (`--n - 1 - --d`), so the readable front one is the last to land — one on top of the
   next. `both` (not `forwards`) so a pack waiting on its delay is drawn in the 0% frame
   (above the shelf, invisible) instead of flashing at its final position first.
   `--drop-step` is mirrored by DROP_STEP in game.js, which fires the landing thud. */
.pack-stack { --drop-step: 60ms; }
.pack-stack-item {
  animation: packDropIn 260ms cubic-bezier(0.24, 0.86, 0.3, 1) both;
  animation-delay: calc((var(--n, 1) - 1 - var(--d, 0)) * var(--drop-step));
}
/* El pack de REGALO del lote de 10: cae 1 s despues (FREE_DROP_DELAY en game.js), un
   paso por DELANTE de la fila y el ultimo en pintarse, asi que queda encima. Sin marca
   propia: quien cuenta el regalo es el `+1` del titulo. */
.pack-free {
  z-index: 2;
  animation: packDropIn 260ms cubic-bezier(0.24, 0.86, 0.3, 1) 1000ms both;
}
.pack-free > img { width: 100%; height: 100%; object-fit: contain; display: block; }
@keyframes packDropIn {
  0%   { transform: translate(var(--x, 0%), -52px) scale(1.06) rotate(-2.5deg); opacity: 0; }
  38%  { opacity: 1; }
  /* Touchdown: a shallow squash sells the weight without moving the row. */
  72%  { transform: translate(var(--x, 0%), 3px) scale(0.985) rotate(0deg); opacity: 1; }
  100% { transform: translateX(var(--x, 0%)); opacity: 1; }
}
/* The exact count — a row of identical edges can't carry "ten" on its own. Centred under
   the row, which spreads symmetrically about the box centre, and hung BELOW the art box
   (the stage reserves the room) so it reads as a label for the lot instead of a sticker
   stuck on the front pack. */
.pack-stack-count {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: -30px; z-index: 3;
  font-family: var(--font-display); font-size: clamp(15px, 1.3vw, 21px); line-height: 1;
  color: #241703; padding: 5px 12px 4px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 1.5px solid rgba(0,0,0,0.45);
  box-shadow: 0 4px 12px -3px rgba(0,0,0,0.75);
  font-variant-numeric: tabular-nums;
  animation: packStackCount 320ms var(--ease-out) backwards;
  animation-delay: calc((var(--n, 1) - 1) * var(--drop-step) + 210ms);
}
@keyframes packStackCount {
  from { opacity: 0; transform: translateX(-50%) scale(0.6); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}
/* Cuelga del borde derecho de la chapa (sin descentrarla) y entra con el pack gratis. */
.pack-stack-plus {
  position: absolute; left: calc(100% + 7px); top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-size: 0.82em; line-height: 1; color: #4ade80;
  text-shadow: 0 0 10px rgba(34,197,94,0.45);
  animation: packStackPlus 260ms var(--ease-out) 1000ms backwards;
}
@keyframes packStackPlus {
  from { opacity: 0; transform: translate(-6px, -50%) scale(0.6); }
  to   { opacity: 1; transform: translate(0, -50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .pack-stack-item, .pack-stack-count { animation: none; }
  /* El pulse se va; el contorno estatico de `.detail-stage .pack-stack-row` se queda. */
  .detail-stage .pack-stack-row { animation: none; }
  .pack-stack-plus, .stage-count { animation: none; }
}

/* ---- Quantity selector: 1 pack or 10 (the fan follows the choice) ---- */
.qty-select { display: flex; flex-direction: column; gap: clamp(7px, 0.8vw, 11px); width: 100%; }
.qty-label {
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px, 0.85vw, 13px);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
}
.qty-opts { display: flex; gap: clamp(10px, 1.1vw, 16px); }
.qty-opt {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: clamp(10px, 1.1vw, 16px) clamp(8px, 0.9vw, 14px); border-radius: 14px; cursor: pointer;
  background: var(--surface-0); border: 1.5px solid var(--border-strong); color: inherit;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), border-color .15s ease, background .15s ease, box-shadow .18s ease;
}
@media (hover: hover) and (pointer: fine) { .qty-opt:hover { background: var(--surface-1); } }
.qty-opt:active { transform: scale(0.98); }
.qty-opt:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.qty-opt.on {
  border-color: color-mix(in srgb, var(--accent, var(--gold)) 75%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--gold)) 20%, var(--surface-0)), var(--surface-0));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, var(--gold)) 45%, transparent),
              0 8px 22px -12px color-mix(in srgb, var(--accent, var(--gold)) 85%, transparent);
}
.qty-n { font-family: var(--font-display); font-size: clamp(21px, 1.9vw, 30px); line-height: 1; color: var(--text); }
.qty-opt.on .qty-n { color: var(--gold-bright); }
/* Dentro del boton y en flujo (antes era una chapa absoluta colgando de la esquina):
   letra gruesa de display, verde, sin pildora ni borde. */
.qty-free {
  font-family: var(--font-display); font-size: clamp(11px, 0.95vw, 14px); line-height: 1;
  letter-spacing: 0.02em; color: #4ade80; text-shadow: 0 0 12px rgba(34,197,94,0.5);
}

/* ---- The one BUY button (quantity is chosen above) ---- */
.shop-buy-row .buy-btn.buy-main {
  gap: clamp(10px, 1.1vw, 18px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--gold)) 30%, var(--surface-0)), var(--surface-0));
  border-color: color-mix(in srgb, var(--accent, var(--gold)) 60%, var(--border-strong));
  box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--accent, var(--gold)) 85%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  .shop-buy-row .buy-btn.buy-main:hover:not(:disabled) {
    box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--accent, var(--gold)) 85%, transparent);
  }
}
.buy-main-label { font-family: var(--font-display); font-size: clamp(18px, 1.6vw, 26px); letter-spacing: 0.05em; color: var(--text); }
.buy-btn:disabled .buy-main-label { color: var(--text-dim); }

/* ---- Purchase confirmation (reuses the .buy-done shell) ---- */
.buy-confirm-art {
  position: relative; width: clamp(112px, 11vw, 154px); height: clamp(154px, 15vw, 210px);
  /* The lot's count tag hangs BELOW the art box; the modal has no stage padding to absorb
     it, so it books the room here or the tag lands on the title. */
  margin-bottom: 22px;
}
.buy-confirm-art .pack-stack-count { bottom: -24px; }
.buy-confirm-total {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  margin-top: 6px; padding: 9px 14px; border-radius: 12px;
  background: var(--surface-0); border: 1px solid var(--border-soft);
}
.buy-confirm-total-label {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
}
/* `.coin-md` is only SIZED inside `.buy-btn .buy-cost`; anywhere else it renders at the
   PNG's natural size (it filled the whole row here). Size it for this context too. */
.buy-confirm-total-cost { display: inline-flex; align-items: center; gap: 8px; }
/* La gema, a la talla de la moneda tambien AQUI: el total de la confirmacion se pinta en la
   moneda con la que se paga, y a 22px la linea de gems se leia mas floja que la de oro. */
.buy-confirm-total-cost .coin-md,
.buy-confirm-total-cost .gem-md { width: clamp(26px, 2.2vw, 34px); height: clamp(26px, 2.2vw, 34px); object-fit: contain; flex-shrink: 0; }
.buy-confirm-total-cost b { font-family: var(--font-display); font-size: clamp(19px, 1.6vw, 26px); color: var(--gold-bright); font-variant-numeric: tabular-nums; }

/* ---- Pack collection info (inside the detail view) ---- */
.pack-coll { width: 100%; max-width: min(420px, 100%); padding: clamp(12px, 1.2vw, 18px) clamp(14px, 1.3vw, 20px); display: flex; flex-direction: column; gap: clamp(10px, 1vw, 14px); margin: 4px 0 2px; }
.pack-coll-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pack-coll-label { font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px, 0.85vw, 13px); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.pack-coll-count { font-family: var(--font-display); font-size: clamp(15px, 1.2vw, 21px); color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.pack-coll-tally { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pack-coll-rar { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.9vw, 14px); color: var(--text-dim); }
.pack-coll-rar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rar); box-shadow: 0 0 6px -1px var(--rar); flex-shrink: 0; }
.pack-coll-rar b { color: var(--text); font-variant-numeric: tabular-nums; }
.pack-coll-view { width: 100%; margin-top: 2px; }

/* ---- Buy → open loop: header packs chip, purchase panel, pack picker ----
   All own class names: `.shop-card`/`.shop-head` are shared with Inventory and
   Missions, so nothing here touches them. */
/* Los DOS contadores de la cabecera son la misma pieza: mismo ancho, misma altura, mismo
   fondo semitransparente y mismo borde. Antes el monedero era una pildora dorada opaca
   (se la ponia el retrofit cartoon) y el de packs translucido, y con numeros de distinta
   longitud tampoco median igual. Hace falta `.wallet-chip.coins` para ganarle a la regla
   del retrofit, que declara lo mismo con (0,2,0) pero MAS ABAJO en el archivo. */
.shop-head-chips { display: flex; align-items: center; gap: clamp(8px, 0.9vw, 14px); flex-shrink: 0; }
.shop-head-chips > .shop-packs-chip,
.shop-head-chips > .wallet-chip,
.shop-head-chips > .wallet-chip.coins {
  box-sizing: border-box;
  min-width: clamp(108px, 9.4vw, 138px);
  height: clamp(44px, 3.6vw, 54px);
  justify-content: center; gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border-strong));
  box-shadow: none;
}
/* Con la altura fija, los iconos se miden contra ELLA (el de packs venia de --icon-min,
   50px, y estiraba su chapa 14px mas que la del monedero). La mochila va MAS GRANDE que
   la moneda a proposito: el PNG de la moneda pinta de borde a borde (~90% de pixeles
   opacos) y el de la mochila deja aire, asi que a la misma caja se ven muy distintos.
   Ninguno de los dos cambia el tamaño de la chapa, que tiene la altura fija de arriba. */
.shop-head-chips > .wallet-chip .wallet-icon {
  width: clamp(26px, 2.2vw, 32px); height: clamp(26px, 2.2vw, 32px);
}
.shop-head-chips > .shop-packs-chip .shop-packs-icon {
  width: clamp(36px, 3.1vw, 46px); height: clamp(36px, 3.1vw, 46px);
}
.shop-packs-chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border-strong));
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), border-color .15s ease, box-shadow .2s ease;
  animation: shopPacksIn 0.28s var(--ease-out) backwards;
}
@keyframes shopPacksIn { from { opacity: 0; transform: translateY(-6px) scale(0.94); } to { opacity: 1; } }
@media (hover: hover) and (pointer: fine) { .shop-packs-chip:hover { border-color: var(--gold-bright); box-shadow: 0 0 18px -6px var(--gold); } }
.shop-packs-chip:active { transform: scale(0.96); }
.shop-packs-chip:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.shop-packs-icon { width: var(--icon-min); height: var(--icon-min); object-fit: contain; display: block; }
.shop-packs-chip b { font-family: var(--font-display); font-size: 17px; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
/* The purchase panel (and the pack picker, which reuses its shell). */
.buy-done {
  position: relative; width: min(420px, 100%);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: clamp(22px, 2.4vw, 34px) clamp(20px, 2.2vw, 30px) clamp(20px, 2.2vw, 28px);
  background: linear-gradient(180deg, rgba(24,33,56,0.97), rgba(10,15,28,0.98));
  border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 40%, var(--border-strong));
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.65), 0 0 46px -14px color-mix(in srgb, var(--accent, var(--gold)) 60%, transparent),
              inset 0 1px 0 rgba(255,255,255,0.06);
  animation: buyDoneIn 260ms var(--ease-out);
}
@keyframes buyDoneIn { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; } }
.buy-done-art { position: relative; width: clamp(96px, 9vw, 132px); height: clamp(130px, 12vw, 180px); display: flex; align-items: center; justify-content: center; }
.buy-done-art img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 22px rgba(0,0,0,0.6)); }
/* z-index 0 (not -1): the art wrapper isn't a stacking context, so a negative layer
   would sink behind the panel's opaque background and the glow would vanish. */
.buy-done-art::before {
  content: ''; position: absolute; inset: -14% -22%; z-index: 0; border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--accent, var(--gold)) 55%, transparent), transparent 70%);
  filter: blur(12px);
}
.buy-done-count {
  position: absolute; right: -6px; bottom: 4px; z-index: 2;   /* above the art (which is z-index 1) */
  min-width: 34px; height: 30px; padding: 0 9px;
  display: flex; align-items: center; justify-content: center; border-radius: 999px;
  font-family: var(--font-display); font-size: 16px; color: #1a1206;
  background: var(--gold); border: 2px solid var(--bg-1); box-shadow: 0 3px 10px rgba(0,0,0,0.55);
}
.buy-done-title { margin: 2px 0 0; font-family: var(--font-display); font-size: clamp(21px, 2vw, 30px); letter-spacing: 0.04em; color: var(--gold-bright); }
.buy-done-sub { font-family: var(--font-ui); font-weight: 700; font-size: clamp(13px, 1.1vw, 16px); color: var(--text-dim); }
.buy-done-free {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.04em;
  color: #06210f; background: linear-gradient(180deg, #56e08a, #22c55e);
  border: 1px solid #14532d; border-radius: 999px; padding: 4px 12px;
  box-shadow: 0 3px 9px -2px rgba(34,197,94,0.65);
}
.buy-done-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 8px; }
/* El mismo aire a cada lado que el resto de botones de modal, y la misma altura. */
.buy-done-actions .ui-btn { width: auto; margin-inline: var(--modal-btn-inset); min-height: var(--modal-btn-h); }
/* Pack picker rows (header chip with 2+ owned collections). */
/* EL MODAL DE "TUS SOBRES": mas ancho que el de compra (aqui se enseña MERCANCIA, no una
   cifra) y con sitio arriba a la derecha para la X. */
.pack-tray { width: min(600px, 100%); padding-top: clamp(26px, 2.8vw, 40px); }
/* DOS clases en el selector a proposito: el retrofit del kit le pone `position: relative`
   a `.cl-close` MAS ABAJO en el fichero, y a igual especificidad ganaria el ultimo — la X
   se quedaba centrada en el flujo de la columna en vez de irse a la esquina. */
.pack-tray .pack-tray-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.pack-tray-list { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 10px; }
.pack-tray-row {
  display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; text-align: left;
  padding: 9px 14px 9px 10px; border-radius: 14px;
  background: var(--surface-0); border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 32%, var(--border-soft));
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, border-color .15s ease, transform .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .pack-tray-row:hover { background: var(--surface-1); border-color: color-mix(in srgb, var(--accent, var(--gold)) 60%, transparent); } }
.pack-tray-row:active { transform: scale(0.98); }
.pack-tray-row:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.pack-tray-row img { width: 40px; height: 52px; object-fit: contain; flex-shrink: 0; }
.pack-tray-name { flex: 1; min-width: 0; font-family: var(--font-ui); font-weight: 800; font-size: clamp(14px, 1.15vw, 17px); color: var(--text); }
.pack-tray-count { font-family: var(--font-display); font-size: clamp(15px, 1.25vw, 19px); color: var(--gold-bright); font-variant-numeric: tabular-nums; }
/* ---- Purchase choreography ----
   El lote se ENVIA: mientras los sprites vuelan al contador, la pila del pedestal se
   apaga (son esos mismos sobres los que estan en el aire, no puede haber dos). Al
   terminar, `refill` remonta <PackStack> y la pila se reparte otra vez. */
.pack-stack.shipping .pack-stack-row,
.pack-stack.shipping .pack-free,
.pack-stack.shipping .pack-stack-count {
  opacity: 0;
  transition: opacity 320ms var(--ease-out);
}
/* The wallet is visibly draining while the coins are in the air. */
.wallet-chip.spending {
  border-color: var(--gold-bright);
  animation: walletSpend 620ms var(--ease-in-out) infinite;
}
@keyframes walletSpend {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,193,74,0); }
  50% { box-shadow: 0 0 16px -2px rgba(245,193,74,0.55); }
}
.shop-packs-chip.pop { animation: shopPacksPop 380ms var(--ease-out); }
@keyframes shopPacksPop {
  0% { transform: scale(1); }
  38% { transform: scale(1.16); box-shadow: 0 0 22px -4px var(--gold-bright); }
  100% { transform: scale(1); }
}
/* Invisible catcher: a tap anywhere skips the sequence. Below .ui-modal-overlay (1300)
   so the panel it hands over to is still clickable. */
.buy-fx-skip { position: fixed; inset: 0; z-index: 1250; cursor: pointer; background: transparent; }
@media (prefers-reduced-motion: reduce) {
  .shop-packs-chip, .buy-done, .wallet-chip.spending, .shop-packs-chip.pop { animation: none; }
}

/* ============== COLLECTION MODAL (pack drop rates) ============== */
.coll-modal { width: min(1080px, 96vw); }
.coll-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: clamp(18px, 1.8vw, 28px) clamp(18px, 1.8vw, 28px) clamp(12px, 1.2vw, 18px);
  border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
}
.coll-modal-title { min-width: 0; }
.coll-modal-title h2 { margin: 0; font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 34px); letter-spacing: 0.03em; color: var(--gold-bright); }
.coll-modal-sub { display: block; margin-top: 4px; font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.95vw, 14px); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
/* Close uses the app's red close.png on a neutral dark square (matches the
   graveyard / battle-log close buttons; the gold face would fight the red icon). */
.coll-modal-close {
  flex: 0 0 auto; width: clamp(38px, 3.2vw, 48px); height: clamp(38px, 3.2vw, 48px);
  border-radius: 11px; background: rgba(255,255,255,0.06); border: 1px solid var(--border-soft);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .15s ease, border-color .15s ease, transform .12s var(--ease-out);
}
.coll-modal-close img { width: 56%; height: 56%; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .coll-modal-close:hover { background: rgba(239,68,68,0.22); border-color: var(--ai-bright); transform: scale(1.05); } }
.coll-modal-close:active { transform: scale(0.95); }
.coll-modal-close:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
/* The shared filter bar sits under the header inside the modal. */
.coll-modal .filter-bar { padding: clamp(12px, 1.2vw, 18px) clamp(18px, 1.8vw, 28px); border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
/* Las pestanas REGULAR / FOIL. Dos arreglos:
   · `align-self: flex-start` — `.cs-toggle` es `inline-flex`, pero dentro de la columna flex
     del modal se blockifica y `align-items: stretch` lo estiraba a todo el ancho: el carril
     oscuro cruzaba el modal entero en vez de encoger a sus botones.
   · aire arriba y abajo: iban pegadas al buscador y a la rejilla de cartas. */
.coll-finish-toggle {
  align-self: flex-start; flex-shrink: 0;
  margin: clamp(14px, 1.4vw, 20px) clamp(18px, 1.8vw, 28px) clamp(6px, 0.6vw, 10px);
}
.coll-modal-body { padding: clamp(16px, 1.6vw, 26px) clamp(18px, 1.8vw, 28px) clamp(20px, 2vw, 30px); overflow-y: auto; min-height: 0; }
.coll-grid { display: grid; gap: clamp(16px, 1.6vw, 24px) clamp(12px, 1.1vw, 18px); grid-template-columns: repeat(auto-fill, minmax(clamp(100px, 9vw, 150px), 1fr)); }
.coll-cell { position: relative; display: flex; flex-direction: column; align-items: center; }
.coll-cell .card { width: 100%; }
.coll-pct {
  margin-top: clamp(8px, 0.8vw, 12px); font-family: var(--font-display); font-size: clamp(13px, 1.1vw, 16px); font-variant-numeric: tabular-nums;
  color: var(--rar); padding: 2px clamp(10px, 1vw, 14px); border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rar) 50%, transparent);
  background: color-mix(in srgb, var(--rar) 16%, rgba(0,0,0,0.35));
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
/* ULTRA: la pill en iridiscente, la MISMA paleta que la gema de rareza ultra (.tpl-center-gem.iri),
   desplazandose despacio; tinta oscura encima para que el numero se lea sobre el pastel */
.coll-pct.is-ultra {
  color: #2a1640; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.7);
  background: linear-gradient(100deg, #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  background-size: 300% 100%;
  box-shadow: 0 0 10px rgba(198, 158, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: collPctIri 6s linear infinite;
}
@keyframes collPctIri { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .coll-pct.is-ultra { animation: none; } }
.coll-empty { margin: 12px 0; }
/* Cards in the drop-rate modal open the same zoom-and-tilt overlay as My Collection —
   which is z 300, so it needs lifting above the modal it was opened from (z 1300). */
.coll-cell .card { cursor: zoom-in; }
.card-modal.coll-zoom { z-index: 1400; }

/* ============== WHITEPAPER SCRY MODAL (reorder top of deck) ============== */
.scry-overlay { z-index: 1250; } /* above the duel board, below filter sheets */
.scry-modal {
  width: auto; max-width: min(760px, 96vw);
  align-items: center; gap: clamp(14px, 1.6vw, 22px);
  padding: clamp(20px, 2.2vw, 34px) clamp(20px, 2.4vw, 38px) clamp(22px, 2.4vw, 36px);
}
.scry-head { text-align: center; }
.scry-head h2 {
  margin: 0; font-family: var(--font-display); font-size: clamp(20px, 2.4vw, 30px);
  letter-spacing: 0.04em; color: var(--gold-bright);
}
.scry-sub { display: block; margin-top: 5px; font-family: var(--font-ui); font-weight: 600; font-size: clamp(12px, 1vw, 15px); color: var(--text-dim); }
.scry-row { display: flex; gap: clamp(14px, 1.8vw, 28px); justify-content: center; flex-wrap: wrap; }
.scry-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 22px;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.scry-row.dragging .scry-cell { cursor: grabbing; }
.scry-cell .card { width: clamp(116px, 13vw, 168px); transition: filter .15s ease; pointer-events: none; }
.scry-cell.is-top .card { filter: drop-shadow(0 0 14px rgba(245,193,74,0.6)); }
/* The card being dragged leaves an empty slot (the ghost shows it under the finger). */
.scry-cell.is-dragging { opacity: 0; }
/* Position badge (1 = drawn next). */
.scry-pos {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px; color: #2a1c00;
  background: var(--gold-face); border: 1px solid var(--gold-edge); box-shadow: var(--gold-relief);
}
.scry-cell.is-top .scry-pos { display: none; } /* the DRAW tag stands in for the top card */
.scry-draw-tag {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%); z-index: 3;
  font-family: var(--font-display); font-size: clamp(11px, 0.95vw, 14px); letter-spacing: 0.06em;
  color: #2a1c00; padding: 4px 12px; border-radius: 999px;
  background: var(--gold-face); border: 1px solid var(--gold-edge); box-shadow: var(--gold-relief);
}
/* Floating clone that follows the finger while dragging a card. */
.scry-ghost {
  position: fixed; z-index: 1400; pointer-events: none;
  transform: translate(-50%, -50%) scale(1.06) rotate(-3deg);
  filter: drop-shadow(0 16px 26px rgba(0,0,0,0.6));
}
.scry-ghost .card { width: clamp(116px, 13vw, 168px); }
/* Proof of Life pick: tap to select (no drag); the selected card takes the gold glow. */
.grave-pick-cell { cursor: pointer; padding-top: 0; touch-action: auto; }
.grave-pick-cell:not(.is-top) .card { filter: brightness(0.7); }
.grave-pick-cell .card { width: clamp(96px, 11vw, 150px); }
.scry-actions { display: flex; justify-content: center; gap: clamp(8px, 1vw, 14px); }
/* Smart Contract Audit: the whole hand, lit (it is a LOOK) and BIG. Any card opens enlarged on tap;
   a trap The Dev may discard carries its SELECT button underneath. The whole hand FITS, no scroll:
   HandPeekModal lays it out in --peek-rows rows of --peek-cols cards and the card width is whatever
   the screen allows, by width (the columns) and by height (the rows + the modal's own chrome).
   `overflow-y` stays only as the last resort of a screen too small for the minimum card. */
.scry-modal.peek-modal { max-width: min(96vw, 100%); }
.peek-row {
  --peek-gap: clamp(10px, 1.4vw, 24px);
  display: grid; grid-template-columns: repeat(var(--peek-cols, 6), auto); gap: var(--peek-gap);
  justify-content: center; align-items: start; padding: 14px 6px 6px; min-height: 0; overflow-y: auto;
}
.peek-cell { cursor: default; gap: 8px; }
.peek-cell:not(.is-top) .card { filter: none; }
.peek-card { cursor: zoom-in; transition: transform .14s ease; }
@media (hover: hover) and (pointer: fine) { .peek-card:hover { transform: translateY(-4px); } }
.peek-row .card {
  pointer-events: none;
  width: clamp(64px, min(
    calc((92vw - 96px - (var(--peek-cols, 6) - 1) * var(--peek-gap)) / var(--peek-cols, 6)),
    calc(((90dvh - 274px - (var(--peek-rows, 1) - 1) * var(--peek-gap)) / var(--peek-rows, 1) - 52px) * 0.6875)
  ), 212px);
}
.peek-pick { padding: 5px 16px; font-size: clamp(11px, 0.95vw, 13px); }
/* Chinese Spy: the top of the rival's deck, in draw order. Room above each card for Whitepaper's
   position badge (1..5; the NEXT DRAW tag on the first, which also takes the gold glow). */
.peek-modal.is-deck-peek .peek-cell { padding-top: 30px; }
.peek-modal.is-deck-peek .peek-cell:first-child .card { filter: drop-shadow(0 0 14px rgba(245,193,74,0.6)); }
.peek-modal.is-deck-peek .peek-cell:first-child .scry-pos { display: none; }
.peek-modal.is-deck-peek .scry-draw-tag { white-space: nowrap; }
/* the enlarged card sits above the scry overlay (the duel's own card-modal is far below it) */
.card-modal.peek-zoom { z-index: 1260; }
.scry-confirm { margin-top: clamp(8px, 1vw, 14px); padding-left: clamp(22px, 2.4vw, 38px); padding-right: clamp(22px, 2.4vw, 38px); }

/* ============== PACK OPENING MODAL ============== */
.pack-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: radial-gradient(ellipse at center, rgba(20,12,40,0.78), rgba(0,0,0,0.92));
  backdrop-filter: blur(6px); animation: cardModalIn 200ms var(--ease-out);
}
.pack-modal {
  width: min(960px, 100%); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(28,22,46,0.96), rgba(12,10,24,0.97));
  border: 1px solid var(--border-strong); border-radius: 22px; padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.pack-modal-head { text-align: center; }
.pack-modal-head h2 {
  margin: 0; font-family: var(--font-display); font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0.05em; color: var(--gold-bright); text-shadow: 0 2px 14px rgba(245,193,74,0.4);
}
.pack-best { margin: 6px 0 0; font-size: 14px; color: var(--text-dim); }
.pack-best b { color: var(--rar); }
.pack-reveal-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.pack-reveal-card {
  position: relative; opacity: 0;
  animation: packReveal 520ms var(--ease-out) calc(var(--i, 0) * 120ms) forwards;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pack-reveal-card .card { width: clamp(118px, 17vw, 150px); }
/* The recap cards are CLICKABLE: tapping one opens it big in the middle (.card-modal.po-inspect).
   The lift on hover is the affordance; it goes away once they gather and fly to the counter. */
.pack-reveal-card { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .po-summary:not(.collecting) .pack-reveal-card:hover .card { transform: translateY(-6px) scale(1.04); } }
.po-summary.collecting .pack-reveal-card { cursor: default; }
.pack-reveal-card:focus-visible { outline: 2px solid var(--player); outline-offset: 5px; border-radius: 12px; }
/* Inspect overlay: the zoom inspector's modal, but the tilt is GRAB-driven (hold & drag, so it works
   on touch too) — the card leans only while held and springs flat on release. Capped by 56vh so the
   card plus its hint always fit; the hint is the only thing telling you the lean is there. */
.card-modal.po-inspect { cursor: default; touch-action: none; flex-direction: column; gap: clamp(10px, 2vh, 20px); }
.card-modal.po-inspect .card.preview { width: min(480px, 90vw, 56vh); }
.card-modal.po-inspect .card { cursor: grab; transition: transform 0.12s ease-out; }
.card-modal.po-inspect.grabbing, .card-modal.po-inspect.grabbing .card { cursor: grabbing; }
.card-modal.po-inspect.grabbing .card { transition: transform 0.06s linear; }
.po-inspect-hint {
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(10px, 1.2vw, 12px);
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted);
  pointer-events: none;
}
/* Rarity AURA on the obtained cards. A drop-shadow on the .card (NOT a box-shadow) follows the
   template's painted alpha, so the halo hugs the real silhouette — no floating rectangle. Sized
   down vs the reveal (these cards are small + in a row); the animated life comes from the rising
   dust particles. Common gets no aura (its rarity shows only by the label). */
.pack-reveal-card.rar-rare  .card { filter: drop-shadow(0 0 3px rgba(78,163,255,1)) drop-shadow(0 0 8px rgba(78,163,255,0.6)) drop-shadow(0 0 16px rgba(78,163,255,0.36)); }
.pack-reveal-card.rar-super .card { filter: drop-shadow(0 0 3px rgba(176,107,255,0.95)) drop-shadow(0 0 9px rgba(176,107,255,0.6)) drop-shadow(0 0 17px rgba(176,107,255,0.38)); animation: poGlowSuperSm 2.2s ease-in-out infinite; }
/* Ultra gets the ROTATING CONIC HALO (pseudo-elements) instead of a drop-shadow — see the
   "MAX-rarity ROTATING CONIC HALO" block below (shared with the reveal). */
.pack-reveal-card.rar-rare .card, .pack-reveal-card.rar-super .card { will-change: filter; }
/* smaller-scale variants of the reveal glow keyframes (the row cards are ~150px). */
@keyframes poGlowSuperSm {
  0%,100% { filter: drop-shadow(0 0 3px rgba(176,107,255,0.8)) drop-shadow(0 0 8px rgba(176,107,255,0.5)) drop-shadow(0 0 15px rgba(176,107,255,0.3)); }
  50%     { filter: drop-shadow(0 0 5px rgba(176,107,255,1)) drop-shadow(0 0 13px rgba(176,107,255,0.8)) drop-shadow(0 0 23px rgba(176,107,255,0.5)); }
}
@media (prefers-reduced-motion: reduce) {
  .pack-reveal-card.rar-super .card, .pack-reveal-card.rar-ultra .card { animation: none; }
}
.pack-reveal-rarity {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.05em;
  color: var(--rar); text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
/* ULTRA label: animated iridescent gradient text — the SAME crystal palette as the canto edge. */
.pack-reveal-rarity.iris, .pack-best b.iris {
  color: transparent; -webkit-text-fill-color: transparent;
  background: linear-gradient(100deg, #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  background-size: 320% 100%;
  -webkit-background-clip: text; background-clip: text;
  text-shadow: none; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  animation: foilTextDrift 6s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .pack-reveal-rarity.iris, .pack-best b.iris { animation: none; } }
/* Rarity + (optional) FOIL tag, side by side under the card. */
.pack-reveal-tags { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
/* ============ FINISH WORDMARKS (FOIL / PROMO) ============
   The finish is announced with ART now, not text: thick letters underlined by a 4-point
   shooting star, drawn in fx-lab.html → UI/foil_label.png (· UI/promo_label.png). The
   bitmaps are the same height, so one `height` per placement lines them up; the width
   follows. `alt` carries the word for anyone reading the page aloud. */
.finish-label {
  display: block; width: auto; height: 24px; flex: none;
  pointer-events: none; user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
/* Pack reveal (under the card) and the bigger pack summary. Kept SMALL: it sits next to
   the rarity word (11px there, clamp(12,1.05vw,15) in the summary) and the wordmark is
   about twice as tall as its own letters, so matching heights would shout over it. */
.pack-reveal-foil { height: 17px; }
.po-summary .pack-reveal-foil { height: clamp(18px, 1.6vw, 23px); }
@keyframes foilTextDrift { 0% { background-position: 0% 50%; } 100% { background-position: 320% 50%; } }
/* "NEW" over a freshly-acquired card — thick yellow letters with a gentle pulse.
   Dark outline + shadow keep it legible over any card art. */
.pack-new-badge {
  position: absolute; top: 6px; left: 50%; z-index: 6; transform: translateX(-50%);
  font-family: var(--font-display); font-size: clamp(13px, 1.5vw, 19px); letter-spacing: 0.1em;
  /* Soft neon: pale yellow letters with a warm glowing halo (not a harsh solid). */
  color: #fbf7b0;
  text-shadow:
    0 0 4px rgba(255, 247, 150, 0.95),
    0 0 9px rgba(255, 238, 110, 0.9),
    0 0 18px rgba(255, 224, 70, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: packNewPulse 1.1s var(--ease-in-out) infinite;
}
@keyframes packNewPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .pack-new-badge { animation: none; } }
@keyframes packReveal {
  0%   { opacity: 0; transform: translateY(20px) scale(0.78); }
  60%  { opacity: 1; transform: translateY(-5px) scale(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.pack-continue { padding: 12px 30px; font-size: 15px; }

/* ============== PACK OPENING (full-screen, interactive sobre) ============== */
/* OPEN PACK takes over the whole viewport: tear the vector envelope open
   (drag right→left), a 1s iridescent glow flares if a super-rare+ is inside,
   then the 5 cards rise stacked and each tap flings the top one off-screen. */
.po-screen {
  position: fixed; inset: 0; z-index: 1300;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(14px, 3vw, 32px);
  /* Fondo AZUL OSCURO, plano y sin el halo cálido del acento que había arriba (tenía un
     `radial-gradient` del oro del sobre al 20 % en 50%/28%). `--accent` se sigue usando en el resto
     de la pantalla; lo que se quita es solo esa capa de fondo. */
  background: radial-gradient(ellipse at center, #0d1a33 0%, #071023 70%, #03070f 100%);
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
  animation: cardModalIn 220ms var(--ease-out);
}
.po-close {
  position: absolute; top: clamp(12px, 2vw, 22px); left: clamp(12px, 2vw, 22px); z-index: 6;
  width: clamp(40px, 4vw, 50px); height: clamp(40px, 4vw, 50px); border-radius: 12px;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(22, 16, 32, 0.92); border: 1px solid var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s var(--ease-out), background 0.15s;
}
@media (hover: hover) and (pointer: fine) { .po-close:hover { background: rgba(40, 30, 56, 0.95); transform: translateY(-1px); } }
.po-close:active { transform: translateY(1px); }
.po-close img { width: 56%; height: 56%; object-fit: contain; opacity: 0.85; }

/* ---- CERRAR (X) y SKIP de la apertura: SIN plancha, fondo TRANSPARENTE ----
   El kit de UI (más abajo, "UI KIT · BOTONES DEL SPRITESHEET") repinta `.po-close` con el 9-slice
   ámbar: una placa OPACA que tapaba el fondo. Aquí se apaga esa lámina (las capas ::before/::after)
   y en su lugar queda el MISMO botón con el contorno fino del tono del kit: misma posición, tamaño,
   icono, hover y pulsación. `.po-skip` (el del juego) ya era un contorno transparente y no se toca.
   Especificidad (0,2,0) + !important para ganar al `background/border/box-shadow` del kit. */
.po-screen .po-close,
.np-screen .po-close,
.np-screen .np-skip {
  background: transparent !important;
  /* MISMA CONSTRUCCIÓN que los botones de la app (medida sobre `.home2-play-btn` en pantalla, que es el
     9-slice `UI/kit/btn-idle.png`), pieza a pieza de fuera a dentro:
       · TINTA marrón muy oscura de ~3 px alrededor  → aquí el `border` (NO un filo amarillo);
       · una franja CREMA de ~2 px justo por dentro de la tinta, arriba;
       · el cuerpo con un degradado vertical suave (claro arriba → hondo abajo);
       · una franja OSCURA de ~4 px justo por dentro de la tinta, abajo;
       · y una sombra SUAVE bajo la pieza (no un escalón macizo).
     Lo único que no se copia es el relleno ámbar: estos dos botones van transparentes. */
  /* el filo: NEUTRO y claro (nada de amarillo). En la app la tinta es marrón muy oscura porque el cuerpo
     es ámbar brillante; aquí el cuerpo es transparente sobre azul casi negro, así que la tinta oscura no
     se vería (y en marrón se embarra): lo que dibuja la pieza es un filo claro de 2 px. */
  border: 2px solid rgba(236, 240, 252, 0.34) !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -3px 0 rgba(0, 0, 0, 0.5),
    0 4px 9px rgba(0, 0, 0, 0.55) !important;
  color: rgba(255, 240, 205, 0.95);
  text-shadow: 0 2px 0 rgba(30, 14, 0, 0.8);
}
/* EL CUERPO: degradado vertical suave como el del botón de la app (arriba más claro, abajo más hondo).
   `z-index: -1` queda dentro del botón porque el kit le pone `isolation: isolate`. */
.po-screen .po-close::before,
.np-screen .po-close::before,
.np-screen .np-skip::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit; border: 0; filter: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.045) 46%, rgba(0, 0, 0, 0.22) 100%);
}
.po-screen .po-close::after,
.np-screen .po-close::after,
.np-screen .np-skip::after { content: none; }
/* al pasar por encima sube un poco y se aclara, como los botones de la app */
@media (hover: hover) and (pointer: fine) {
  .po-screen .po-close:hover,
  .np-screen .po-close:hover,
  .np-screen .np-skip:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(246, 249, 255, 0.55) !important;
    transform: translateY(-1px);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.62),
      inset 0 -3px 0 rgba(0, 0, 0, 0.45),
      0 6px 12px rgba(0, 0, 0, 0.55) !important;
  }
}
/* pulsado: se hunde — la luz pasa abajo y la sombra arriba, y la sombra exterior casi desaparece */
.po-screen .po-close:active,
.np-screen .po-close:active,
.np-screen .np-skip:active {
  background: rgba(0, 0, 0, 0.12) !important;
  transform: translateY(2px);
  box-shadow:
    inset 0 3px 0 rgba(0, 0, 0, 0.4),
    inset 0 -2px 0 rgba(250, 240, 205, 0.22),
    0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.po-stage {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 2.4vh, 26px);
  perspective: 1200px;
}

/* -------- the envelope -------- */
.po-envelope {
  position: relative;
  width: clamp(266px, min(58vh, 90vw), 438px);
  aspect-ratio: 300 / 440;
  transform-style: preserve-3d;
  filter: drop-shadow(0 26px 26px rgba(0, 0, 0, 0.55));
  animation: poFloat 5s var(--ease-in-out) infinite;
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.po-envelope.dimmed { opacity: 0; transform: rotateX(6deg) scale(0.9); animation: none; }
@keyframes poFloat {
  0%, 100% { transform: rotateX(6deg) translateY(0); }
  50%      { transform: rotateX(6deg) translateY(-12px); }
}

/* -------- image-based pack (real artwork): closed → open + rip-off crimp -------- */
.po-envelope.img {
  aspect-ratio: 448 / 600;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.5));
  animation-name: poFloatFlat;
}
/* once the cards rise, the image pack disappears (doesn't linger behind them) */
.po-envelope.img.dimmed { opacity: 0; transform: none; }
@keyframes poFloatFlat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.po-pack-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; -webkit-user-select: none; user-select: none;
}
/* the open pack recoils as the crimp is yanked off */
.po-envelope.img.ph-opening .po-pack-img { animation: poRecoil 360ms var(--ease-out); }
@keyframes poRecoil {
  0%   { transform: translateY(0); }
  26%  { transform: translateY(6px) scale(0.992); }
  100% { transform: translateY(0); }
}
/* the torn crimp piece: the wrapper handles the launch (shot up off-screen), the
   inner image flexes elastically so it reads like paper/plastic snapping loose */
.po-piece {
  position: absolute; z-index: 4; pointer-events: none;
  filter: drop-shadow(0 7px 11px rgba(0, 0, 0, 0.5));
  will-change: transform;
  animation: poPieceFly 860ms linear forwards;
}
.po-piece-img {
  display: block; width: 100%; height: 100%; object-fit: fill;
  transform-origin: 50% 30%;
  animation: poPieceWobble 860ms cubic-bezier(0.3, 0.6, 0.3, 1) forwards;
}
@keyframes poPieceFly {
  0%   { transform: translate(0, 0) rotate(0deg); }
  8%   { transform: translate(calc(var(--drift, 0px) * 0.1), -7vh) rotate(calc(var(--rot, 0deg) * 0.2)); }
  40%  { transform: translate(calc(var(--drift, 0px) * 0.45), -24vh) rotate(calc(var(--rot, 0deg) * 0.7)); }
  100% { transform: translate(var(--drift, 0px), -132vh) rotate(var(--rot, 0deg)); }
}
/* squash/stretch + skew flutter — strongest on the initial yank, then settles */
@keyframes poPieceWobble {
  0%   { transform: scale(1, 1) skewX(0deg); }
  12%  { transform: scale(1.06, 0.82) skewX(-9deg); }
  30%  { transform: scale(0.93, 1.14) skewX(6deg); }
  48%  { transform: scale(1.05, 0.92) skewX(-4deg); }
  66%  { transform: scale(0.97, 1.05) skewX(2.5deg); }
  82%  { transform: scale(1.02, 0.98) skewX(-1deg); }
  100% { transform: scale(1, 1) skewX(0deg); }
}
/* ============ image pack: mouse-traced tear (ONE image → strip + body) ============ */
/* both layers carry the SAME artwork at the same size/position — only the JS-built
   clip-path differs, so the traced seam reads as a single torn pack */
.pack-strip, .pack-body {
  position: absolute; inset: 0;
  background-image: var(--pack-src);
  background-size: 100% 100%; background-position: 0 0; background-repeat: no-repeat;
  will-change: transform, clip-path;
  -webkit-user-select: none; user-select: none;
}
.pack-body  { z-index: 0; pointer-events: none; }
.pack-strip { z-index: 4; pointer-events: none; }   /* purely visual; the hit band catches the drag */
/* the image flow has no 3D children → flatten so strip/body/cards layer by z-index
   (the base .po-envelope is preserve-3d for the vector-envelope fallback only) */
.po-envelope.img { transform-style: flat; }

/* generous transparent hit band across the top of the pack — the cut cursor never drops
   out even if the player strays a bit, and the tear point is easy to find. The actual cut
   y is still clamped to the 8–16% band in JS, so a wide hit area doesn't change the rip. */
.po-screen .po-cut-hit {
  position: absolute; left: 0; right: 0; top: 0; height: 30%; z-index: 8;
  pointer-events: auto; touch-action: none;
  cursor: url('../icons/pack_hand_cursor.png') 42 22, grab !important;
}
/* ── LA MANO DE PINZA NO CAMBIA HASTA QUE EL SOBRE ESTÁ ABIERTO DEL TODO ──
   Dos cosas la quitaban antes de tiempo:
   (a) al PULSAR, `body.app-cursor *:active` (0,2,1) ganaba a la regla de arriba (0,2,0) y pintaba el
       dedo pulsado durante todo el arrastre → aquí el mismo selector con `:active` (0,3,0) lo gana;
   (b) al saltar el corte, la banda se desmontaba (fase `opening`) y el cursor volvía al dedo con la
       apertura aún en marcha → durante `opening` la mano se pinta en TODA la pantalla, así que no
       depende de dónde haya quedado el puntero. Vuelve al dedo en `cards`, con el sobre ya abierto.
   La X de cerrar se queda con su dedo: sigue siendo un botón. */
.po-screen .po-cut-hit:active { cursor: url('../icons/pack_hand_cursor.png') 42 22, grab !important; }
@media (hover: hover) and (pointer: fine) { .po-screen .po-cut-hit:hover { cursor: url('../icons/pack_hand_cursor.png') 42 22, grab !important; } }
.po-screen.ph-opening,
.po-screen.ph-opening * { cursor: url('../icons/pack_hand_cursor.png') 42 22, grab !important; }
.po-screen.ph-opening .po-close,
.po-screen.ph-opening .po-close * { cursor: url('../icons/cursor.png?v=2') 11 4, pointer !important; }

/* the cut FX overlay: the iridescent shimmer of the cut + the white cutting-point glow.
   This is the ONLY visual of the cut path (there is no debug stroke). */
/* clipped to the pack artwork's horizontal extent (x∈[14.73%, 85.04%]) so the iridescent
   line + its glow never spill onto the transparent side margins of the image */
.po-cut-fx { position: absolute; inset: 0; z-index: 5; pointer-events: none; clip-path: inset(0 14.96% 0 14.73%); }
.po-cut-trail {
  fill: none; stroke: url(#poCutIrid); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 11px rgba(200, 230, 255, 0.8));
  animation: poCutIridShift 1.8s linear infinite;
}
@keyframes poCutIridShift {
  from { filter: drop-shadow(0 0 5px rgba(255,255,255,0.95)) drop-shadow(0 0 11px rgba(200,230,255,0.8)) hue-rotate(0deg); }
  to   { filter: drop-shadow(0 0 5px rgba(255,255,255,0.95)) drop-shadow(0 0 11px rgba(200,230,255,0.8)) hue-rotate(360deg); }
}
.po-cut-head {
  opacity: 0; transition: opacity 220ms ease;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 16px rgba(255, 255, 255, 0.7));
}
.po-cut-head circle { animation: poCutHeadPulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes poCutHeadPulse { 0%, 100% { transform: scale(0.9); } 50% { transform: scale(1.12); } }
/* the pack floats while sealed; freeze it once it's being torn open / spilling cards */
/* PAUSE the idle float (don't remove it) the moment a cut starts and through opening/cards:
   pausing HOLDS the envelope exactly where it was, so there's no snap to translateY(0) when
   the cut completes — the pack starts falling from the very spot it was cut. */
.po-envelope.img.cutting, .po-envelope.img.ph-opening, .po-envelope.img.ph-cards { animation-play-state: paused; }

/* the torn strip flies up & off, flexing like a snapped foil crimp (~0.8s) */
.po-envelope.img.ph-opening .pack-strip { animation: packStripTear 820ms cubic-bezier(0.34, 0.62, 0.3, 1) forwards; }
@keyframes packStripTear {
  0%   { transform: translateY(0) rotate(0deg) skewX(0deg) scale(1, 1); opacity: 1; }
  12%  { transform: translateY(-6vh) rotate(calc(var(--rot, 12deg) * 0.18)) skewX(-7deg) scale(1.04, 0.9); opacity: 1; }
  34%  { transform: translateY(-26vh) rotate(calc(var(--rot, 12deg) * 0.55)) skewX(6deg) scale(0.95, 1.08); opacity: 1; }
  60%  { transform: translateY(-62vh) rotate(calc(var(--rot, 12deg) * 0.82)) skewX(-3deg) scale(1.02, 0.96); }
  100% { transform: translate(var(--drift, 0px), -120vh) rotate(var(--rot, 12deg)) skewX(2deg) scale(0.98, 1); opacity: 0; }
}
/* the spent sleeve drops away to reveal the cards. TWO phases so it reads as the cards
   being EXTRACTED (not two stacked layers):
   1) STRAIGHT fall — pure translateY while it still overlaps the cards, so its opaque body
      uncovers them top-down (clip/occlusion stays active). No rotate/skew/scale here.
   2) Only AFTER it has fully cleared the cards does it tip into a free, organic fall
      (rotate/skew/scale).
   It NEVER fades — opacity stays 1; it just leaves the viewport by translateY. */
.po-envelope.img.ph-cards .pack-body { animation: packBodyDrop 1150ms cubic-bezier(0.42, 0, 0.62, 1) 100ms forwards; }
@keyframes packBodyDrop {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(60vh); }   /* by here the body's top has cleared the cards' bottom */
  74%  { transform: translate(calc(var(--bdrift, 0px) * 0.5), 92vh) rotate(calc(var(--brot, 12deg) * 0.55)) skewX(-5deg) scale(0.99); }
  100% { transform: translate(var(--bdrift, 0px), 145vh) rotate(var(--brot, 12deg)) skewX(4deg) scale(0.97); }
}

/* the cards are STORED inside the pack: they sit centred within the body and are clipped to
   the pack so the part below the cut stays hidden — only what rises ABOVE the cut edge shows.
   `clip-path: inset(... 0 ...)` clips the BOTTOM at the pack's bottom (nothing pokes out below)
   but leaves the TOP open (so a revealed card can still fly up off-screen). The opaque body
   masks them until the cut, then they emerge UPWARD through the opening as the body drops. */
.po-cards.from-pack { z-index: -1; animation: none; pointer-events: none; clip-path: inset(-300% -50% 6% -50%); }
.po-cards.from-pack .po-card.top { pointer-events: auto; }
/* No permanent `will-change`/preserve-3d here: a permanently-promoted layer renders SOFT while the card
   sits still frontal in the reveal (blurry face-on, crisp only when tilted). Frontal = FLAT + un-promoted
   → painted directly → crisp. The 3D context (for the canto) + promotion switch on only while tilting. */
.po-card-rise { display: block; position: relative; }
/* FRONT/BACK faces for the ultra reveal double-spin. FRONT stays in-flow (it gives the pile
   its height); it's hidden by the faceTick while the card faces away. BACK is an absolute overlay
   pre-rotated 180° (the card back), hidden until the faceTick flips it in mid-spin. */
.po-card-front { position: relative; }
.po-card-back {
  position: absolute; inset: 0; visibility: hidden; pointer-events: none;
  transform: rotateY(180deg); backface-visibility: hidden;
}
.po-card-back img { width: 100%; height: 100%; object-fit: contain; display: block;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5)); }
/* each card's rise preserves 3D (so its stacked thickness layers sit behind its face in depth, and the
   .po-card-back can flip into view) + promotes — ONLY WHILE TILTING or during the ultra SPIN.
   Frontal/idle it stays flat & un-promoted (see .po-card-rise above) so the face-on card paints crisp
   instead of sitting as a soft composited texture. */
.po-cards.from-pack.tilting .po-card-rise,
.po-cards.from-pack.po-spinning .po-card-rise { transform-style: preserve-3d; will-change: transform; }
/* short rise from inside the pack (centre) up to the reveal spot — NOT from off-screen below.
   spring cubic-bezier for an organic settle. NO per-card stagger: the whole pile is a tight
   stack (only the front shows), so every card rises with the SAME transform at every instant
   → a rigid single block. A stagger (delay by --j) made the back cards lag ~90px BELOW the
   front mid-rise; whenever the reveal-clip cleared before the last card settled that lag
   flashed as fanned card-bottoms poking out under the front — the pile stopped reading as one
   block. Rising together also settles the whole pile by 720ms, well before the 1000ms clip
   clear, so there's no clip-vs-emergence race on any viewport. */
.po-cards.from-pack .po-card-rise { animation: poCardEmerge 720ms cubic-bezier(0.34, 1.45, 0.45, 1) both; }
@keyframes poCardEmerge {
  0%   { transform: translateY(30%) scale(0.92); }
  100% { transform: translateY(0) scale(1); }
}

/* ============ pack reveal: rarity GLOW (on the card's real edge) + fine dust ============ */
/* The GLOW is a drop-shadow on the CARD NODE itself — it follows the painted alpha edge of
   the card (transparent corners/margins ignored), so the halo is flush to the visible border
   with NO transparent ring/gap (box-shadow on a wrapper would project from the rect = the gap). */
.po-card.rar-rare .card, .po-card.rar-super .card { will-change: filter; }
.po-card.rar-rare  .card { filter: drop-shadow(0 0 5px rgba(78,163,255,1)) drop-shadow(0 0 14px rgba(78,163,255,0.7)) drop-shadow(0 0 28px rgba(78,163,255,0.4)); }
/* Super — purple, gentle breathing pulse */
.po-card.rar-super .card { filter: drop-shadow(0 0 6px rgba(176,107,255,0.95)) drop-shadow(0 0 16px rgba(176,107,255,0.65)) drop-shadow(0 0 30px rgba(176,107,255,0.4)); animation: poGlowSuper 2.2s ease-in-out infinite; }
@keyframes poGlowSuper {
  0%,100% { filter: drop-shadow(0 0 5px rgba(176,107,255,0.85)) drop-shadow(0 0 13px rgba(176,107,255,0.55)) drop-shadow(0 0 26px rgba(176,107,255,0.32)); }
  50%     { filter: drop-shadow(0 0 8px rgba(176,107,255,1)) drop-shadow(0 0 22px rgba(176,107,255,0.85)) drop-shadow(0 0 40px rgba(176,107,255,0.55)); }
}
/* ===== MAX-rarity RAINBOW HALO (ultra), reveal + summary =====
   The rainbow twin of rare's drop-shadow. Rare hugs the card's PAINTED alpha by drop-shadowing the
   .card, but drop-shadow is one colour. To get an ANGULAR rainbow (colour sections around the card,
   rotating like the canto) that STILL hugs the real silhouette, each layer is a conic-gradient MASKED
   by the card's frame PNG (alpha = the silhouette). The mask is on the FILL; the blur is on its PARENT
   wrapper, so the blur runs AFTER the mask and the masked rainbow blooms OUTWARD past the card edge —
   a mask + blur on the SAME element would clip that bloom off (that was the old washed-out, oversized
   halo: two big-blur conic RECTANGLES, which both blurred the spectrum to pale mush AND ignored the
   silhouette). Two layers: `.hi` = a tight bright rim, `.lo` = a wide soft bloom — matching rare's
   stacked shadows. --halo-frame / --halo-ms (frame url + its board-fit mask-size, same values the tilt
   canto uses) are set per-card in JS; --haloAngle spins so the spectrum rotates around the perimeter.
   Tuned by measuring excess luminance vs the backdrop at d px from the card edge against rare as the
   reference (rare reveal = 30/20/15/10 at d = 0/8/16/26). */
@property --haloAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes poHaloSpin { to { --haloAngle: 360deg; } }
.pack-reveal-card.rar-ultra { isolation: isolate; }  /* z-index:-1 halo stays inside the wrapper */
.po-halo {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
/* summary wrapper is a flex COLUMN (card + tags); pin the halo to the CARD box only (top, aspect 11/16). */
.pack-reveal-card .po-halo { inset: auto; top: 0; left: 0; width: 100%; aspect-ratio: 11 / 16; }
.po-halo-w { position: absolute; inset: 0; }
.po-halo-f {
  position: absolute; inset: 0;
  background: conic-gradient(from var(--haloAngle) at 50% 50%, #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  -webkit-mask: var(--halo-frame) center / var(--halo-ms) no-repeat;
          mask: var(--halo-frame) center / var(--halo-ms) no-repeat;
  animation: poHaloSpin 3s linear infinite;
}
/* reveal (big card): tight bright rim + wide soft bloom. */
.po-card .po-halo-w.hi { filter: blur(4px);  opacity: 1;    }
.po-card .po-halo-w.lo { filter: blur(17px); opacity: 0.7;  }
/* On reveal the ultra halo mounts only AFTER the card's double-spin finishes (gated in JS);
   fade + scale it in so it "lights up" cleanly rather than popping. Reveal-only (the summary halo
   is always present). */
.po-card .po-halo { animation: poHaloIn 340ms ease-out both; }
@keyframes poHaloIn { from { opacity: 0; transform: scale(0.86); } to { opacity: 1; transform: scale(1); } }

/* ── Rarity reveal TITLE (ultra): big iridescent letters popped in above the card, synced to the
   voice, with floating particles around them. Rendered at the STABLE envelope level (not inside the card)
   so it stays put — positioned above the card's resting centre (card is centred in the envelope: its top
   edge is at 50% + halfCardHeight from the bottom; halfCardHeight = cardWidth·8/11 for the 11/16 card). */
.po-rar-title {
  position: absolute; left: 50%;
  bottom: calc(50% + clamp(180px, min(52vh, 64vw), 290px) * 8 / 11 + clamp(20px, 3.6vh, 44px));
  transform: translateX(-50%);
  z-index: 8; pointer-events: none; white-space: nowrap;
}
/* On pass (the card flies off) the title fades out FAST in place — it does NOT fly up with the card. */
.po-rar-title.fading { opacity: 0; transition: opacity 170ms ease-out; }
.po-rar-title-inner {
  position: relative; display: flex; justify-content: center; gap: 0.01em;
  font-family: var(--font-display, 'Bowlby One', system-ui, sans-serif);
  font-weight: 400; font-size: clamp(19px, 4.4vw, 44px); line-height: 1;
  filter: drop-shadow(0 4px 9px rgba(0, 0, 0, 0.6));
}
.po-rar-title-inner span {
  display: inline-block;
  /* fewer, wider colour bands (background-size 560%) → the colours read more spaced out */
  background-image: linear-gradient(100deg, #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
  background-size: 560% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;   /* no ink outline — just the iridescent fill */
  transform-origin: 50% 92%;
  animation: poTitlePop 480ms cubic-bezier(0.2, 1.5, 0.4, 1) both, poTitleIris 9s linear infinite;
  animation-delay: calc(var(--i, 0) * 42ms), calc(var(--i, 0) * -320ms);   /* staggered pop + slow travelling rainbow */
}
/* rare = BLUE, super rare = PURPLE (same sheen animation, mono-hue). ultra keep the iridescent default. */
.po-rar-title.rar-rare  .po-rar-title-inner span { background-image: linear-gradient(100deg, #4ea3ff, #cfe8ff, #4ea3ff, #3a86e0, #4ea3ff); }
.po-rar-title.rar-super .po-rar-title-inner span { background-image: linear-gradient(100deg, #b06bff, #e8d5ff, #b06bff, #9550e0, #b06bff); }
@keyframes poTitlePop {
  0%   { opacity: 0; transform: translateY(15px) scale(0.35) rotate(-8deg); }
  62%  { opacity: 1; transform: translateY(0) scale(1.18) rotate(3deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}
@keyframes poTitleIris { to { background-position: 560% 50%; } }
.po-rar-title-particles { position: absolute; inset: -55% -12%; }
.po-rar-title-particles i {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--sz, 4px); height: var(--sz, 4px); border-radius: 50%;
  background: var(--c, #fff); box-shadow: 0 0 6px 1px var(--c, #fff);
  opacity: 0; animation: poTitleFloat var(--dur, 2.2s) ease-in-out var(--d, 0ms) infinite;
}
@keyframes poTitleFloat {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4); }
  22%  { opacity: 0.95; }
  78%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -18px)) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .po-rar-title-inner span { animation: poTitleIris 9s linear infinite; opacity: 1; transform: none; }
  .po-rar-title-particles { display: none; }
}
/* summary cards are ~0.57x → scale the blur radii down so the halo stays the same relative tightness.
   Slightly tighter/stronger than a pure 0.57x scale so the spectrum still reads at ~150px. */
.pack-reveal-card .po-halo-w.hi { filter: blur(2.5px); opacity: 1;    }
.pack-reveal-card .po-halo-w.lo { filter: blur(8px);   opacity: 0.85; }

/* FINE DUST — tiny motes drifting up the OUTSIDE of the card (recycled, CSS-looped). */
.po-card-particles { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: visible; container-type: size; }
.po-card-particles span {
  position: absolute; bottom: -2%; left: var(--px, 50%);
  width: var(--sz, 2px); height: var(--sz, 2px); border-radius: 50%;
  opacity: 0; will-change: transform, opacity;
  animation: poParticleRise var(--pdur, 3s) linear var(--pd, 0ms) infinite;
}
@keyframes poParticleRise {
  0%   { transform: translateY(0) translateX(0) scale(0.5); opacity: 0; }
  16%  { opacity: var(--pop, 0.55); }
  84%  { opacity: var(--pop, 0.55); }
  100% { transform: translateY(-104cqh) translateX(var(--pdx, 0px)) scale(1); opacity: 0; }
}
.po-card-particles.rar-rare span   { background: #b6daff; box-shadow: 0 0 3px 0.5px rgba(78,163,255,0.85); }
.po-card-particles.rar-super span  { background: #ddc4ff; box-shadow: 0 0 3px 0.5px rgba(176,107,255,0.85); }
/* Ultra — each mote's hue is the crystal spectrum sampled at its SIDE (colour delay --cd =
   angular offset: left band ≈ opposite the right band) and advances in LOCKSTEP with the halo's clockwise
   spin (same 3s), so the motes read as sections of the rotating spectrum — NOT an independent per-mote pulse. */
.po-card-particles.rar-ultra span { box-shadow: 0 0 4px 0.5px rgba(255,170,235,0.8);
  animation: poParticleRise var(--pdur, 3s) linear var(--pd, 0ms) infinite, poPartIris 3s linear var(--cd, 0ms) infinite; }
@keyframes poPartIris {   /* = PO_IRIS_CONIC crystal palette, in order → motes match the halo/contour */
  0%    { background: #ff8fd0; } 14.3% { background: #8fb2ff; } 28.6% { background: #8ff0de; } 42.9% { background: #ffe79a; }
  57.1% { background: #ffac8f; } 71.4% { background: #c69eff; } 85.7% { background: #8fe2ff; } 100%  { background: #ff8fd0; }
}
@media (prefers-reduced-motion: reduce) {
  .po-card.rar-super .card, .po-card.rar-ultra .card { animation: none; } /* keep the static glow */
  .po-halo-f { animation: none; }   /* freeze the rainbow halo (static spectrum sections, no spin) */
  .po-card-particles { display: none; }   /* no drifting dust */
}

/* ============ pack reveal: 3D tilt — REAL card thickness (Pokémon-Pocket) ============ */
/* perspective on the pile gives the rotateY real depth; the front card preserves 3D so the
   stacked thickness layers behind it render in space. The whole pile shares one rotateY (set
   per-card in JS) so it turns as a rigid block — nothing peeks flat behind the front card. */
.po-cards { perspective: 1100px; }
/* EVERY pile card preserves 3D so its own stacked thickness layers render in depth (the back cards
   need it too now — each shows its canto). Cards still composite by z-index (.po-cards stays flat),
   so the front always occludes the ones behind regardless of their translateZ. ONLY while tilting —
   frontal/idle the pile is flat so the face-on card isn't a soft composited 3D layer (blur fix). */
.po-cards.from-pack.tilting .po-card,
.po-cards.from-pack.po-spinning .po-card { transform-style: preserve-3d; }
/* The thickness/canto layers only matter when tilted (edge-on = invisible when frontal). Hide them
   while NOT tilting so the rise has no 3D children → it stays flat & un-promoted → crisp face-on. */
.po-cards.from-pack:not(.tilting) .po-card-thick { display: none; }
/* once the pile has settled, drop the pack clip entirely so nothing crops the glow/edges. */
.po-cards.from-pack.revealed { clip-path: none; }

/* The card's REAL physical thickness: a stack of the card's own SILHOUETTE at stepped negative
   translateZ behind the front face. The silhouette comes from MASKING a tinted div with the card's
   frame PNG (mask-size:contain + centred = the SAME contain/letterbox the front .fullart-board uses),
   so each layer is the exact rounded contour (NOT a rounded-rect/border — that was the "rectangle
   that ignores the corners" bug). Edge-on when flat (hidden behind the card); seen from the side as
   the card turns they form a solid rarity-coloured canto that follows the real corners. mask-image,
   translateZ + tint are set per-layer in JS; mask-size/position are shared so the browser reuses one
   rasterised mask. */
.po-card-thick {
  position: absolute; inset: 0;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  backface-visibility: hidden; pointer-events: none;
  will-change: transform, filter;
}
/* LIVE canto — ONLY on rare+ cards (.lit; common cantos stay a flat static colour). The colour
   shimmers (brightness/saturation pulse + a hue sweep) instead of being flat; staggered per layer
   (delay set in JS) so the shimmer travels through the deck depth. Paused until the pile is being
   turned (the canto is hidden when flat anyway). */
/* The canto background is a CONIC spectrum (foil/iris) laid on each slab; spinning --edgeAngle rotates it so
   a rainbow slice FLOWS continuously along whichever edge is exposed on tilt. Paused until the pile turns. */
@property --edgeAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.po-card-thick.lit { animation: poEdgeSpin 4.6s linear infinite paused; }
/* FOIL + ULTRA: the ultra-rare crystal spectrum, spun faster + saturated for max-rarity holographic flow
   (foil shares ULTRA's colour by design). */
.po-card-thick.edge-iris.lit,
.po-card-thick.edge-foil.lit { animation-duration: 3s; filter: saturate(1.35) brightness(1.08); }
.po-cards.tilting .po-card-thick.lit { animation-play-state: running; }
@keyframes poEdgeSpin { to { --edgeAngle: 360deg; } }
/* (Super rare used to get its own purple 'epic' canto that pulsed. It now takes the flat type tone
   like common/rare — only ultra/foil animate — so that rule and poEdgeEpic are gone.) */
@media (prefers-reduced-motion: reduce) {
  .po-card-thick.lit,
  .po-card-thick.edge-iris.lit { animation: none; }
}
/* While turning, drop the same-colour rarity AURA (glow) down to a neutral shadow so the real
   geometric CANTO is the prominent coloured edge (the aura would otherwise drown it). The .card
   filter transition (.15s) fades it out on tilt and back in at rest. */
.po-card.tilting .card { animation: none; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); }

.po-env-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.po-env-top { position: absolute; inset: 0; z-index: 3; transform: translateZ(14px); }
.po-env-top.falling { animation: poTopFall 720ms cubic-bezier(0.4, 0.05, 0.6, 1) forwards; }
@keyframes poTopFall {
  0%   { transform: translateZ(14px) translate(0, 0) rotate(0deg); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateZ(40px) translate(var(--drift, 40px), 130vh) rotate(var(--rot, 30deg)); opacity: 0.9; }
}

/* the cut interaction strip, sitting on the seam where the crimp meets the body
   (a touch below it). Hovering shows the pinch-hand cursor instead of the arrows */
.po-screen .po-cut-track {
  position: absolute; left: 15.4%; right: 15.6%; top: 7.5%; height: 13%; z-index: 5;
  cursor: url('../icons/pack_hand_cursor.png') 42 22, grab !important;
  touch-action: none;
}
.po-cut-fill {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  height: 6px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 240, 180, 0.2), var(--gold-bright));
  box-shadow: 0 0 10px 2px rgba(253, 230, 138, 0.85);
  transition: width 70ms linear;
}
.po-blade {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: clamp(22px, 3.4vw, 32px); line-height: 1; pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 6px rgba(253, 230, 138, 0.8));
}
.po-blade span { display: block; transform: scaleX(-1); }

/* a soft, subtle iridescent bloom sitting behind the rays (accompanies them) */
.po-rays-glow {
  position: absolute; left: 50%; top: 11%; z-index: 1;
  width: 120%; aspect-ratio: 5 / 3; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0; pointer-events: none;
  mix-blend-mode: screen; filter: blur(24px);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 62%),
    conic-gradient(from 210deg at 50% 55%,
      #ffd1ec, #e7c8ff, #c8e6ff, #c6ffe5, #fff3c4, #ffd9c2, #ffd1ec);
}
.po-rays-glow.on { animation: poRaysGlow 1000ms ease-out forwards; }
@keyframes poRaysGlow {
  0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.5); }
  26%  { opacity: 0.42; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 0;    transform: translate(-50%, -50%) scale(1.18); }
}

/* -------- iridescent pastel RAYS shooting upward (super-rare or better) -------- */
.po-rays {
  position: absolute; left: 50%; bottom: 84%; z-index: 2;
  width: 210%; height: 130%;
  transform: translateX(-50%) scaleY(0.3);
  transform-origin: 50% 100%;
  opacity: 0; pointer-events: none;
  mix-blend-mode: screen; filter: blur(1.5px);
  /* WIDE rays bursting from INSIDE the pack: the conic origin sits below the
     opening (at 50% 112%) so the beams already span the pack's width at the mouth
     and fan out wider above — like light pouring out of the open sleeve. */
  background:
    conic-gradient(from -62deg at 50% 112%,
      transparent 0deg 3deg,
      rgba(255, 209, 236, 0.95) 3deg 9deg,
      transparent 9deg 14deg,
      rgba(200, 230, 255, 0.95) 14deg 20deg,
      transparent 20deg 25deg,
      rgba(198, 255, 229, 0.95) 25deg 31deg,
      transparent 31deg 36deg,
      rgba(255, 243, 196, 0.95) 36deg 42deg,
      transparent 42deg 47deg,
      rgba(231, 200, 255, 0.95) 47deg 53deg,
      transparent 53deg 58deg,
      rgba(255, 209, 236, 0.95) 58deg 64deg,
      transparent 64deg 69deg,
      rgba(200, 230, 255, 0.95) 69deg 75deg,
      transparent 75deg 80deg,
      rgba(198, 255, 229, 0.95) 80deg 86deg,
      transparent 86deg 91deg,
      rgba(255, 243, 196, 0.95) 91deg 97deg,
      transparent 97deg 102deg,
      rgba(231, 200, 255, 0.95) 102deg 108deg,
      transparent 108deg 113deg,
      rgba(255, 209, 236, 0.95) 113deg 119deg,
      transparent 119deg 124deg,
      transparent 124deg 360deg);
  -webkit-mask-image: radial-gradient(92% 108% at 50% 100%, #000 16%, rgba(0,0,0,0.5) 52%, transparent 84%);
          mask-image: radial-gradient(92% 108% at 50% 100%, #000 16%, rgba(0,0,0,0.5) 52%, transparent 84%);
}
.po-rays.on { animation: poRaysFlare 1000ms ease-out forwards; }
@keyframes poRaysFlare {
  0%   { opacity: 0; transform: translateX(-50%) scaleY(0.2) rotate(-5deg); }
  20%  { opacity: 1; transform: translateX(-50%) scaleY(0.95) rotate(0deg); }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1.12) rotate(5deg); }
}

/* -------- pack-open FOUNTAIN: stars + glints shot up from BEHIND the pack mouth -------- */
/* Mounted at z-index -1 (below the pack body z:0) so it only shows above/behind the torn top,
   never over the art → reads as bursting from INSIDE. Works because `.po-envelope.img` is
   transform-style:flat (negative z-index layers correctly). The particles themselves are the
   shared `.fx-star`/`.fx-glint` from fx-effects.css; here we just place + hide the origin point.
   The inline `transform: scale()` (set by PackOpeningScreen) sizes the fountain to the real pack. */
.po-back-burst { position: absolute; left: 50%; top: 15%; width: 0; height: 0; z-index: -1; pointer-events: none; }

/* -------- sparkle burst when the pack is torn open (every open) — legacy, superseded by .po-back-burst -------- */
.po-sparks { position: absolute; left: 50%; top: 15%; width: 0; height: 0; z-index: 5; pointer-events: none; }
.po-spark {
  position: absolute; left: 0; top: 0;
  width: var(--s, 9px); height: var(--s, 9px); margin: calc(var(--s, 9px) / -2);
  background: radial-gradient(circle at 50% 50%, #fff 0%, #fff4c0 42%, rgba(255, 224, 150, 0) 72%);
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  filter: drop-shadow(0 0 5px rgba(255, 240, 180, 0.95));
  opacity: 0; will-change: transform, opacity;
  animation: poSpark 760ms ease-out var(--d, 0ms) forwards;
}
@keyframes poSpark {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.2) rotate(0deg); }
  28%  { opacity: 1; transform: translate(calc(var(--tx) * 0.5), calc(var(--ty) * 0.5)) scale(1.15) rotate(70deg); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.35) rotate(150deg); }
}
/* FOIL pack: the spark burst is PASTEL-IRIDESCENT instead of gold — each spark takes
   one of five pastel hues (cycled) so the whole burst reads as an iridescent shimmer,
   and the glow halo turns soft lavender. */
.po-sparks.foil .po-spark { filter: drop-shadow(0 0 5px rgba(226, 210, 255, 0.95)); }
.po-sparks.foil .po-spark:nth-child(5n+1) { background: radial-gradient(circle at 50% 50%, #fff 0%, #fbd0e8 42%, rgba(251, 208, 232, 0) 72%); }
.po-sparks.foil .po-spark:nth-child(5n+2) { background: radial-gradient(circle at 50% 50%, #fff 0%, #fde9b0 42%, rgba(253, 233, 176, 0) 72%); }
.po-sparks.foil .po-spark:nth-child(5n+3) { background: radial-gradient(circle at 50% 50%, #fff 0%, #c9f5d8 42%, rgba(201, 245, 216, 0) 72%); }
.po-sparks.foil .po-spark:nth-child(5n+4) { background: radial-gradient(circle at 50% 50%, #fff 0%, #c5e8ff 42%, rgba(197, 232, 255, 0) 72%); }
.po-sparks.foil .po-spark:nth-child(5n)   { background: radial-gradient(circle at 50% 50%, #fff 0%, #e3d2ff 42%, rgba(227, 210, 255, 0) 72%); }

/* -------- thick glowing arrow showing where (and which way) to tear -------- */
.po-cut-arrow {
  position: absolute; top: 14%; right: 1%; z-index: 6;
  width: clamp(32px, 5.5vw, 46px); pointer-events: none;
  animation: poCutArrow 1.15s var(--ease-in-out) infinite;
}
.po-cut-arrow svg { display: block; width: 100%; height: auto; }
.po-cut-arrow path { fill: #ffdd00; stroke: #8a6500; stroke-width: 3; stroke-linejoin: round; }
@keyframes poCutArrow {
  0%, 100% { transform: translateY(-50%) translateX(7px) scale(1);    filter: drop-shadow(0 0 4px rgba(255, 221, 0, 0.7)); opacity: 0.9; }
  50%      { transform: translateY(-50%) translateX(-7px) scale(1.14); filter: drop-shadow(0 0 13px rgba(255, 221, 0, 1));  opacity: 1; }
}

/* -------- the card stack (tap or drag a card UP to reveal the next) -------- */
.po-cards {
  position: absolute; inset: 0; z-index: 4;
  animation: poCardsRise 560ms var(--ease-out) both;
}
@keyframes poCardsRise {
  0%   { opacity: 0; transform: translateY(54px) scale(0.5); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.po-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: clamp(202px, min(58vh, 72vw), 325px);
}
.po-card.top { touch-action: none; }
.po-card .card { width: 100%; height: auto; pointer-events: none; }
/* default cursor for the WHOLE pack opening = the pointing hand — including clickable cards
   and buttons (NOT the system pointer nor the open/fist hand). Only the cut zone
   (.po-cut-hit, sealed only) overrides it with the pinch hand.
   NOTE: the app-wide `body.app-cursor` rules now paint the same finger everywhere, so
   this only still bites where those don't apply (touch/coarse pointers). */
.po-screen, .po-screen button, .po-screen .ui-btn, .po-card.top,
.po-cards.grabbing, .po-cards.grabbing .po-card.top {
  cursor: url('../icons/cursor.png') 12 3, auto;
}
.po-card-rar {
  position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: 0.05em; color: var(--rar); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

/* -------- hints -------- */
.po-hint {
  position: relative; z-index: 5; margin: 0;
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(14px, 1.65vw, 19px);
  letter-spacing: 0.04em; color: var(--text-dim); text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  /* reserve the line height so the hint emptying out (sealed → opening) doesn't collapse the
     stage column and nudge the envelope — that reflow was the "jump" at the end of the cut. */
  min-height: 1.7em;
}
.po-hint-arrow {
  display: inline-block; color: var(--gold-bright); font-size: 1.4em; font-weight: 900;
  animation: poHintArrow 1.3s var(--ease-in-out) infinite;
}
@keyframes poHintArrow {
  0%, 100% { transform: translateX(6px); opacity: 0.5; }
  50%      { transform: translateX(-6px); opacity: 1; }
}
/* SKIP — a deliberately understated SECONDARY action (no gold fill): a faint
   outlined pill with dim text that only brightens on hover, so it never competes
   with the primary gold buttons. Jumps straight to the 5-card summary. */
.po-skip {
  position: relative; z-index: 5;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: -6px;
  padding: 6px 18px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--font-ui); font-weight: 700;
  font-size: clamp(11px, 1.2vw, 13px); letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer; opacity: 0.62;
  transition: opacity .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}
@media (hover: hover) and (pointer: fine) {
  .po-skip:hover {
    opacity: 1; color: var(--text);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.06);
  }
}
.po-skip:active { transform: translateY(1px); }
/* Gentle fade-in for the reveal hint + SKIP once the pack is gone. `backwards` fill (NOT forwards)
   so after the fade the element reverts to its base opacity → the .po-skip:hover state still works. */
.po-fade-in { animation: poFadeIn 0.45s var(--ease-out) backwards; }
@keyframes poFadeIn { from { opacity: 0; } }

/* -------- summary (same row as the old reveal) + actions -------- */
.po-summary {
  position: relative; z-index: 5;
  width: min(1280px, 100%); max-height: 94vh; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: clamp(26px, 4.2vh, 52px);
  padding: clamp(16px, 3vh, 34px) 10px;
  animation: cardModalIn 260ms var(--ease-out);
}
/* bigger cards + more air in the pack summary (kept to one row on desktop) */
.po-summary .pack-reveal-row { gap: clamp(12px, 1.5vw, 22px); }
.po-summary .pack-reveal-card { gap: 10px; }
.po-summary .pack-reveal-card .card { width: clamp(132px, 17.5vw, 196px); }
.po-summary .pack-reveal-rarity { font-size: clamp(12px, 1.05vw, 15px); }
.po-summary-actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: clamp(6px, 1.6vh, 18px); }
.po-summary-actions .ui-btn { padding: 14px 34px; font-size: 16px; }
.po-add-btn { padding: 16px 44px; font-size: 17px; letter-spacing: 0.04em; }

/* -------- "Add to collection" : counter + cards flying into it -------- */
/* Sits to the LEFT of the close button, never under it: same top and same height as
   `.po-close`, and its `right` is the X's own offset + the X's width + a gap, so the two
   track each other at every viewport (both are clamp()-sized). */
.po-coll-counter {
  position: absolute; z-index: 7;
  top: clamp(12px, 2vw, 22px);
  right: calc(clamp(12px, 2vw, 22px) + clamp(40px, 4vw, 50px) + clamp(10px, 1.2vw, 16px));
  height: clamp(40px, 4vw, 50px);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 0 16px 0 10px; border-radius: 999px;
  background: rgba(16, 12, 28, 0.86); border: 1px solid var(--gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(245, 193, 74, 0.35);
  animation: poCounterIn 360ms var(--ease-out) both;
}
.po-coll-counter img { width: clamp(30px, 3.4vw, 42px); height: auto; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.po-coll-num { font-family: var(--font-display); font-size: clamp(20px, 2.2vw, 30px); color: var(--gold-bright); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: center; }
.po-coll-counter.leaving { animation: poCounterOut 600ms var(--ease-out) 200ms forwards; }
@keyframes poCounterIn { 0% { opacity: 0; transform: translateY(-14px) scale(0.7); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes poCounterOut { 0% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px) scale(0.85); } }
/* a soft pulse each time the number ticks up */
.po-coll-num { animation: poCountPulse 260ms var(--ease-out); }
@keyframes poCountPulse { 0% { transform: scale(1); } 45% { transform: scale(1.28); color: #fff; } 100% { transform: scale(1); } }

/* gather → fly flourish: the summary cards themselves glide together (CSS anim, so
   it reliably tweens), the text fades a beat later, then they shoot into the counter. */
.po-summary.collecting { overflow: visible; }
.po-summary.collecting .pack-reveal-card {
  opacity: 1; filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5)); will-change: transform, opacity;
}
.pack-reveal-card.gathering { animation: poGather var(--gather, 540ms) cubic-bezier(0.22, 0.72, 0.3, 1) both; }
.pack-reveal-card.flying {
  animation: poFlyToCounter var(--fly, 500ms) cubic-bezier(0.5, 0, 0.75, 0.35) calc(var(--i, 0) * var(--step, 120ms)) both;
}
@keyframes poGather {
  0%   { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 1; transform: translate(var(--gx, 0px), var(--gy, 0px)); }
}
/* No fade: the card stays solid the whole way and is cut the instant it enters the counter
   (the 99.9% stop holds opacity at 1; only the last frame hides it, so it never sits on the chip). */
@keyframes poFlyToCounter {
  0%    { opacity: 1; transform: translate(var(--gx, 0px), var(--gy, 0px)) scale(1) rotate(0deg); }
  99.9% { opacity: 1; }
  100%  { opacity: 0; transform: translate(var(--fx, 0px), var(--fy, -200px)) scale(0.08) rotate(14deg); }
}
.po-summary.collecting .pack-reveal-rarity,
.po-summary.collecting .pack-reveal-foil { opacity: 0; transition: opacity 220ms ease; }
.po-summary.collecting .pack-modal-head { opacity: 0; transition: opacity 360ms ease 440ms; }   /* fades AFTER the gather */
.po-summary.collecting .po-summary-actions { opacity: 0; pointer-events: none; transition: opacity 200ms ease; }

.po-done {
  position: relative; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: clamp(18px, 3vh, 34px);
  animation: cardModalIn 320ms var(--ease-out);
}
.po-done-title {
  margin: 0; font-family: var(--font-display); font-size: clamp(20px, 3vw, 32px);
  color: var(--gold-bright); letter-spacing: 0.04em; text-shadow: 0 2px 14px rgba(245, 193, 74, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .po-envelope, .po-hint-arrow { animation: none; }
  /* the strip still flies (it must clear the slit), but cards just fade into place */
  .po-cards.from-pack .po-card-rise { animation-duration: 1ms; }
}

/* ============== CARD RARITY ============== */
/* No generic rarity rings/glows/top-line around the cards anymore — each card's
   rarity is conveyed by its own painted treatment (template, gold, iridescent,
   gems, stars…). Only `rarityPulse` is kept (reused by the reward-level-up text). */
@keyframes rarityPulse {
  0%,100% { filter: drop-shadow(0 0 2px var(--rarity)); }
  50%     { filter: drop-shadow(0 0 10px var(--rarity)); }
}
.rarity-chip {
  font-family: var(--font-ui); font-weight: 800; font-size: 8.5px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--rar);
  padding: 1px 6px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rar) 60%, transparent);
  background: color-mix(in srgb, var(--rar) 16%, transparent);
}

/* ============== GAME-OVER REWARDS ============== */
/* Boxless rewards — no pills, no container frame. Just icons + values in a row. */
.reward-box {
  margin: 16px 0 4px; padding: 6px 0; width: 100%;
  background: none; border: none;
}
.reward-title {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.16em;
  color: var(--text-muted); text-align: center; margin-bottom: 12px;
}
.reward-list { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: center; }
.reward-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 800; font-size: 18px; color: var(--text);
  background: none; border: none; padding: 0;
}
.reward-chip img { width: var(--icon-min); height: var(--icon-min); object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }
/* Same coin-density correction as .wallet-chip.coins — see the note there. */
.reward-chip.coins img { width: calc(var(--icon-min) * 0.72); height: calc(var(--icon-min) * 0.72); }
.reward-chip.xp { color: var(--gold-bright); }

/* ---- Victory coin burst: ~1 coin per 5 gold flies into the counter ---- */
.coin-target { will-change: transform; }
.coin-target.coin-pop { animation: coinTargetPop 240ms var(--ease-out); }
@keyframes coinTargetPop {
  0%   { transform: scale(1); }
  42%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
/* Coins fly ABOVE the gold HUD (z-index 530 > 520) so they land on top of it. */
.coin-fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 530; overflow: hidden; }
.coin-fly {
  position: fixed;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;   /* center on the (left,top) anchor point */
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 9px rgba(245, 193, 74, 0.6));
  will-change: transform, opacity;
  /* ease-out arc: quick launch, gentle glide into the counter */
  animation: coinFly 880ms cubic-bezier(0.34, 0.85, 0.27, 1) var(--delay, 0ms) both;
}
@keyframes coinFly {
  0%   { transform: translate(var(--dx), var(--dy)) scale(0.4) rotate(0deg); opacity: 0; }
  14%  { opacity: 1; }
  82%  { transform: translate(0, 0) scale(1) rotate(var(--spin, 360deg)); opacity: 1; }
  100% { transform: translate(0, 0) scale(1.05) rotate(var(--spin, 360deg)); opacity: 0; }
}
@media (max-width: 820px) {
  .coin-fly { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
}

/* Impact burst — a flash + little stars right where the coin hits the counter. */
.coin-spark-layer { position: fixed; inset: 0; pointer-events: none; z-index: 540; overflow: hidden; }
.coin-spark { position: fixed; transform: translate(-50%, -50%); }
.spark-flash {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 220, 0.95) 0%, rgba(245, 193, 74, 0.55) 38%, transparent 70%);
  animation: sparkFlash 420ms ease-out forwards;
}
@keyframes sparkFlash {
  0%   { transform: scale(0.3); opacity: 0; }
  28%  { opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}
.spark-star {
  position: absolute; left: 0; top: 0; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
  background: #fff7d6;
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  filter: drop-shadow(0 0 3px rgba(245, 193, 74, 0.9));
  animation: sparkStar 560ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes sparkStar {
  0%   { transform: rotate(var(--a)) translateX(0) scale(0); opacity: 0; }
  25%  { opacity: 1; transform: rotate(var(--a)) translateX(10px) scale(1); }
  100% { transform: rotate(var(--a)) translateX(38px) scale(0.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .coin-fly-layer, .coin-spark-layer { display: none; }   /* counter still ticks up */
}
.reward-levelup {
  margin-top: 12px; text-align: center; font-family: var(--font-display); font-size: 18px;
  letter-spacing: 0.04em; color: var(--gold-bright); text-shadow: 0 2px 12px rgba(245,193,74,0.5);
  animation: rarityPulse 1.4s var(--ease-in-out) infinite;
}
.reward-hint { margin-top: 8px; text-align: center; font-size: 12px; color: var(--text-dim); }

/* ---------------- REDUCED MOTION ---------------- */
/* Keep opacity/colour cues that aid comprehension; remove movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   NEW DUEL HUD  (landscape-first redesign)
   The board fills the screen. The HUD is anchored to the battlefield:
   four corners (tools · CPU plate · player plate · log), two side rails
   (deck + graveyard flanking the divider), a centre-right action zone, and
   a centred .duel-stage holding the two 5-cell rows + the hands.
   ============================================================ */

/* ----- Core stage: hands · cpu row · divider · player row ----- */
/* Five bands: cpu hand · cpu row · divider · player row · player hand. The two
   card rows get equal 1fr bands; their cards are capped BELOW the band height and
   aligned toward their own hand, so a gap opens toward the centre — that gap (plus
   the divider band) is the open middle holding the rails + END TURN. */
/* La capa del tablero es un CONTENEDOR a pantalla completa (`inset: 0`), así que se quedaba con
   TODOS los toques — también los que caen en sus huecos, donde lo que se ve es el paisaje. Eso
   dejaba muertos los trastos interactivos del escenario (`.battlefield-props`, que se pintan por
   debajo): el puntero nunca llegaba a ellos. Con la capa transparente al puntero y sus HIJOS
   (filas, manos y el divisor) reactivándolo, los huecos dejan pasar. Los toques de escenario no
   se enteran: los recoge `.battlefield` por burbujeo, igual que antes.
   Se ENUMERAN los hijos que deben recibirlos en vez de reactivarlos en bloque: los otros hijos de
   la capa son overlays decorativos a pantalla completa (las dos `.impact-fx-layer` y el velo de
   objetivo) que ya venían inertes, y un `> *` los habría despertado — cambiando un tragón por
   otro. */
.duel-stage { pointer-events: none; }
.duel-stage > .duel-row,
.duel-stage > .hand-fan,
.duel-stage > .duel-divider { pointer-events: auto; }
.duel-stage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: stretch;
  justify-items: center;
  /* Horizontal padding keeps the rows clear of the corner plates + side rails —
     wide enough to leave a clear gap between the field and the deck/GY column. */
  padding: clamp(4px, 1.4vh, 14px) clamp(64px, 10.5vw, 152px);
  /* Las filas se recortan a la ARENA PINTADA, no al viewport: --arena-t/-b/-l/-r se miden en JS
     desde el dibujo real (ver battlefieldRef). Sin esto los slots se salían del marco de piedra
     al paisaje. Las laterales son NUEVAS con el cuadro 21:9: su arena es proporcionalmente más
     estrecha que la del arte anterior, y recortando solo arriba y abajo la fila de 5 se salía
     por los lados. Las manos van FUERA de la arena a propósito, así que cancelan el recorte
     vertical más abajo. */
  padding-top: max(clamp(4px, 1.4vh, 14px), var(--arena-t, 0px));
  padding-bottom: max(clamp(4px, 1.4vh, 14px), var(--arena-b, 0px));
  padding-left: max(clamp(64px, 10.5vw, 152px), var(--arena-l, 0px));
  padding-right: max(clamp(64px, 10.5vw, 152px), var(--arena-r, 0px));
  gap: clamp(2px, 0.8vh, 8px);
  z-index: 10;
}

/* One line of 5 equal card-shaped cells: SPELL · HERO · HERO · HERO · SPELL. */
.duel-row {
  --rgap: clamp(6px, 1.4vw, 16px);
  display: flex;
  gap: var(--rgap);
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  /* `size` (not just inline-size) so the cells below can be capped by the row's own
     HEIGHT (100cqh). Sizing them off the viewport instead let them outgrow the row. */
  container-type: size;
}
/* Each row centres its cells in its half of the sand, so the breathing room is shared
   between the stone frame and the middle divider instead of piling up on one side. */
.duel-row-ai,
.duel-row-player { align-items: center; padding-block: clamp(2px, 0.7vh, 7px); }
/* Every cell (hero slot + spell slot) is the same 11:16 box — the largest that fits
   BOTH 5-across AND the row's height (with a little air, so a card never touches the
   frame or the divider). */
.duel-row > .slot,
.duel-row > .spell-slot {
  aspect-ratio: 11 / 16;
  width: min((100cqw - 4 * var(--rgap)) / 5, calc(97cqh * 11 / 16), 208px);
  height: auto;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
}
/* Phone landscape: the sand band is only ~300px tall, so the same 97% share would leave
   the cards almost touching the stone frame — hand a little of it back. */
@media (max-height: 560px) {
  .duel-row > .slot,
  .duel-row > .spell-slot { width: min((100cqw - 4 * var(--rgap)) / 5, calc(90cqh * 11 / 16), 208px); }
}
/* In the merged row the spell slots are full, equal cells (not the old mini
   slots). Keep them interactive only mid-drag, as before. */
.duel-row > .spell-slot { border-radius: 12px; }

/* ----- Centre divider (a single clean line; no medallion) ----- */
.duel-divider {
  position: relative;
  width: 100%;
  height: 2px;
  align-self: center;
  background: linear-gradient(90deg, transparent, var(--border-strong) 22%, var(--border-strong) 78%, transparent);
  opacity: 0.5;
}

/* ----- Deck + Graveyard rails — each player's pair lives inside its own half,
   mirrored diagonally: CPU on the LEFT of the upper half, player on the RIGHT of
   the lower half. Desde el 2026-09-23 los dos van EN FILA, a la misma altura: el
   jugador con el mazo a la izquierda y el cementerio a la derecha, y la CPU al
   reves (cementerio a la izquierda, mazo a la derecha: es su espejo). La fila se
   centra justo donde estaba el MAZO cuando iban en columna (el rail iba centrado al
   30 % / 70 % del alto con el par apilado, o sea el mazo caia a medio par de ahi:
   por debajo en la CPU, por encima en el jugador), asi que la altura del mazo no
   se mueve. `--rail-w` es el ancho de cada carta y `--rail-gap` el hueco entre las
   dos; de ellos sale el desplazamiento. ----- */
/* Las medidas del par mazo + cementerio. Las comparte `.duel-action`: en el móvil END TURN va justo
   ENCIMA del par del jugador y del mismo ancho (APK PASS 5, al final), con las mismas cuentas. */
.duel-rail, .duel-action {
  --rail-w-base: min(clamp(70px, 7.9vw, 118px), max(60px, calc(20.6vh - 64px)));
  --rail-gap: clamp(18px, 3.4vh, 36px);       /* entre mazo y cementerio (antes 10..22: seguian pegados) */
  --rail-margin: clamp(12px, 2vw, 26px);      /* al borde de la pantalla (antes 6..16) */
  /* En fila el par es el doble de ancho y en ventanas estrechas (1320x720) pisaba el marco
     de piedra de la arena. El ancho de carta se acota ademas a lo que cabe entre el borde
     de la pantalla y la arena (`--arena-l` / `--arena-r`, publicados por el duelo), menos
     el margen, el marco de piedra que asoma fuera del rect de la arena (~32px) y un poco
     de aire. Cada rail usa el lado que le toca (mas abajo). */
  --rail-w: var(--rail-w-base);
  /* medio par en columna: (alto de carta + hueco) / 2, con alto = ancho * 16/11 */
  --rail-shift: calc((var(--rail-w-base) * 16 / 11 + var(--rail-gap)) / 2);   /* con el ancho BASE: la altura del mazo no depende del recorte lateral */
  /* Las dos pilas van ancladas ABAJO (la carta del fondo en el hueco, crecen hacia arriba). Para que
     la carta de ARRIBA del mazo lleno siga donde estaba, el hueco baja lo que mide la pila entera:
     (cards - 1) * edge de FX.TUNE.shuffle = 15 * 2.6px. */
  --pile-thick: 39px;
}
.duel-rail {
  position: absolute;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--rail-gap);
  z-index: 25;
}
.duel-rail-cpu {
  top: calc(30% + var(--rail-shift) + var(--pile-thick)); left: var(--rail-margin);
  --rail-w: max(56px, min(var(--rail-w-base), calc((var(--arena-l, 999px) - var(--rail-margin) - 44px - var(--rail-gap)) / 2)));
}
.duel-rail-player {
  top: calc(70% - var(--rail-shift) + var(--pile-thick)); right: var(--rail-margin);
}
.duel-rail-player, .duel-action {
  --rail-w: max(56px, min(var(--rail-w-base), calc((var(--arena-r, 999px) - var(--rail-margin) - 44px - var(--rail-gap)) / 2)));
}
/* Slightly smaller than a hand card so the stacked deck+graveyard pair fits
   comfortably within a single half without crowding the hero row or HUD. */
/* EL TOPE DE ALTURA no es por que los dos railes se toquen (van en COLUMNAS opuestas:
   el del CPU a la izquierda y el del jugador a la derecha, asi que solaparse en vertical
   no se ve): lo que limita es la CHAPA DE IDENTIDAD de la esquina. El rail va centrado al
   30% del alto, o sea que cuanto mas grande es la carta mas sube su borde superior, y
   acaba metiendose debajo de `.hud-tl`. De ahi sale la cuenta, que es la regla escrita
   tal cual en vez de un numero magico:
     borde superior = 0.3H - par/2   y   par = 2 * altoCarta + hueco
     altoCarta = ancho * 16/11
   despejando "el borde superior queda por debajo de la chapa (~70px) con 16px de aire":
     ancho <= 0.206 * H - 64px
   El `max(60px, ...)` es el suelo para ventanas muy bajas, donde esa cuenta se va a cero. */
.duel-rail .zone-slot { width: var(--rail-w); }

/* Deck (card back) + Graveyard (empty slot + icon): card-shaped, ~hand-card size
   (smaller than hero/spell slots). The count badge only shows on hover/tap. */
.zone-slot {
  position: relative;
  width: clamp(64px, 7.4vw, 104px);
  aspect-ratio: 11 / 16;
  height: auto;                 /* width + aspect drive the size (override stale rules) */
  display: block;
  border: 0; padding: 0; margin: 0; background: none;
  box-shadow: none;            /* no slot "container" — the deck reads as a bare card */
  overflow: visible;           /* let the count badge poke outside without being clipped */
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .15s ease;
}
.zone-card {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
/* El mazo: hueco donde DeckSlot monta la pila de dorsos (FX.shuffleDeck). Mide lo que el slot y
   no recorta: los cantos asoman por debajo y la carta que sale al barajar se desliza mas abajo. */
.deck-pile { position: relative; width: 100%; height: 100%; }
/* El cementerio con cartas: la pila (crece un canto por carta) y la lapida encima, pequena y
   abajo a la derecha, para que no se lea como un segundo mazo. Vacio, la pila no pinta nada y
   se ve el hueco discontinuo de siempre (.zone-empty). */
.grave-zone .zone-empty { z-index: 1; }
.zone-gv-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 60%; height: auto; z-index: 2;
  opacity: 0.95; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); pointer-events: none;
}
.deck-zone[data-empty="true"] .deck-pile { border: 2px dashed var(--border-soft); border-radius: 11px; box-sizing: border-box; }
.zone-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border-soft); border-radius: 11px;
  background: rgba(255,255,255,0.03);
}
.zone-gv-icon { width: 54%; height: auto; object-fit: contain; opacity: 0.9; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.zone-slot[data-empty="true"] { opacity: 0.55; }
.grave-zone:not(:disabled) { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .grave-zone:not(:disabled):hover { transform: translateY(-2px); } }
@media (hover: hover) and (pointer: fine) { .grave-zone:not(:disabled):hover .zone-empty { border-color: var(--gold); } }
/* Count badge — a fully circular, gold-toned chip (matches the action button).
   Hidden by default; revealed on hover (PC) or tap (.show-count). */
.zone-count {
  position: absolute; top: -8px; right: -8px;
  width: 30px; height: 30px; min-width: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-display); font-size: 14px; line-height: 1;
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(253,230,138,0.22), rgba(245,193,74,0.12)), rgba(8,11,20,0.94);
  border: 2px solid var(--gold);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 8px rgba(245,193,74,0.35);
  /* Opacity-only reveal (no transform/scale): a transform transition here promotes
     a compositor layer that re-rasterizes the deck back image, making it look
     slightly pixelated on hover. Fading only keeps the back crisp + unchanged. */
  opacity: 0;
  transition: opacity .14s ease;
  pointer-events: none;
}
.zone-slot.show-count .zone-count { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .zone-slot:hover .zone-count { opacity: 1; } }

/* ----- Corners: icon tools + identity plates ----- */
.hud-corner { position: absolute; z-index: 40; display: flex; }
.hud-tl { top: clamp(8px, 1.6vh, 16px); left: clamp(8px, 1.4vw, 16px); }
.hud-tr { top: clamp(8px, 1.6vh, 16px); right: clamp(8px, 1.4vw, 16px); flex-direction: row; gap: 8px; }
.hud-bl { bottom: clamp(8px, 1.6vh, 16px); left: clamp(8px, 1.4vw, 16px); }
.hud-br { bottom: clamp(8px, 1.6vh, 16px); right: clamp(8px, 1.4vw, 16px); }

/* Icon tool boxes share the action button's embossed gold relief (--gold-relief-*):
   raised at rest, lifts + glows on hover, presses IN on tap. Icons keep their
   natural colours (they have their own dark outlines) with a soft drop shadow. */
.hud-icon-btn {
  width: clamp(48px, 5.2vw, 58px);
  height: clamp(48px, 5.2vw, 58px);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--gold-edge);
  background: var(--gold-face);
  box-shadow: var(--gold-relief);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), filter .12s var(--ease-out);
}
.hud-icon-btn img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45)); }
@media (hover: hover) and (pointer: fine) { .hud-icon-btn:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: var(--gold-relief-hover); } }
.hud-icon-btn:active { transform: translateY(1px); filter: brightness(0.96); box-shadow: var(--gold-relief-press); }
/* The back glyph points left (the source arrow points right). */
.back-btn img { transform: scaleX(-1); }

.player-plate {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(8px, 1.1vw, 16px);
}
/* name + stars stacked; energy sits beside them (right for player, left for CPU). */
.pp-id { display: flex; flex-direction: column; gap: clamp(3px, 0.6vh, 6px); }
.pp-player              { flex-direction: row; }          /* [id] [energy] */
.pp-player .pp-id       { align-items: flex-start; text-align: left; }
.pp-ai                  { flex-direction: row; }          /* [id] [energy] — now in the left corner */
.pp-ai .pp-id           { align-items: flex-start; text-align: left; }
.pp-name {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.1vw, 26px);
  letter-spacing: 0.03em;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.pp-ai .pp-name     { color: var(--ai-bright); }
/* The player's face left of the name (same rounded-square portrait as HOME). Rim in the side's colour. */
.pp-avatar {
  flex: 0 0 auto;
  width: clamp(44px, 4.4vw, 62px); height: clamp(44px, 4.4vw, 62px);
  border-radius: var(--av-radius, 22%); overflow: hidden;
  background: radial-gradient(circle at 50% 34%, rgba(120,150,190,0.45), rgba(6,12,24,0.75));
  box-shadow: 0 0 0 3px var(--pp-rim), 0 3px 8px rgba(0,0,0,0.55);
}
.pp-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-player .pp-avatar { --pp-rim: var(--player-bright); }
.pp-ai .pp-avatar     { --pp-rim: var(--ai-bright); }
.pp-player .pp-name { color: var(--player-bright); }
/* Bigger stars in the plate. */
.player-plate .star-meter { gap: 4px; }
.player-plate .star-slot { width: clamp(18px, 2.2vw, 26px); height: clamp(18px, 2.2vw, 26px); }
.player-plate .star-slot img { width: 100%; height: 100%; }
/* Energy — no pill/box wrapper, just a big bolt + count. */
.player-plate .energy-meter { gap: 7px; }
.player-plate .em-icon { width: clamp(30px, 3.2vw, 42px); height: clamp(30px, 3.2vw, 42px); }
.player-plate .em-count { font-size: clamp(16px, 1.8vw, 21px); min-width: 0; }
.player-plate .em-count b { font-size: clamp(19px, 2.1vw, 25px); }

/* ----- Action zone (END TURN / hints) — bottom-right, just LEFT of the battle-log
   button, on the same baseline. ----- */
.duel-action {
  position: absolute;
  right: clamp(6px, 1.4vw, 16px);    /* right edge aligned with the deck/GY rail */
  bottom: clamp(8px, 1.6vh, 16px);
  width: clamp(118px, 16vw, 168px);
  display: flex;
  justify-content: flex-end;
  z-index: 35;
}
.duel-action .action-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.duel-action .btn {
  width: 100%;
  min-height: clamp(48px, 5.2vw, 58px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(13px, 1.4vw, 16px);
  text-align: center;
}
/* Status messages in the action zone (Drawing a card…, target prompts, etc.) share
   the action button's box: same min-height, display font and font-size so any
   message reads at the same legible scale as END TURN. A dark chip (not gold fill)
   keeps it clearly a status, not a tappable button. */
.duel-action .hint {
  width: 100%;
  min-height: clamp(48px, 5.2vw, 58px);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 0.01em;
  line-height: 1.12;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--gold-bright);
  background: rgba(8, 11, 20, 0.72);
  border: 1px solid var(--border-soft);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.duel-action .draw-hint { color: var(--gold-bright); }
.duel-action .hint-label { min-width: 0; } /* allow the text to wrap beside the icon */
.duel-action .hint-icon {
  width: clamp(22px, 2.4vw, 28px); height: clamp(22px, 2.4vw, 28px);
  object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Action button (END TURN) — the SAME premium treatment as the wallet "connect"
   button (display font, dark-on-gold colours, gold fill, lift+glow), but
   rectangular instead of a pill. The disabled "ENEMY'S TURN" state (.enemy-turn,
   no .primary) keeps its red pulse, so this only targets the active gold button. */
.duel-action .btn.primary.end-turn {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  color: #2a1c00;
  border: 1px solid var(--gold-edge);
  border-radius: 12px;
  background: var(--gold-face);
  box-shadow: var(--gold-relief);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), filter .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .duel-action .btn.primary.end-turn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.05);
    background: var(--gold-face);
    box-shadow: var(--gold-relief-hover);
  }
}
.duel-action .btn.primary.end-turn:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.96);
  box-shadow: var(--gold-relief-press);
}

/* ----- VOICES: megaphone next to END TURN + its emote wheel -----
   The megaphone hangs off the LEFT of the action zone, on END TURN's baseline. The wheel is a
   ring split in 6 slices (clockwise from the top) that opens ABOVE the button: the button sits
   in the bottom corner, so a ring centred on it would lose its lower half off-screen. */
.emote {
  position: absolute;
  right: calc(100% + clamp(8px, 1vw, 12px));
  bottom: 0;
  z-index: 2;
}
.emote-btn { padding: 3px; }  /* speaker.png already carries ~15% transparent margin */
/* EMOJIS to the RIGHT of the megaphone, in the buttons' own type: END TURN's size in the
   duel HUD, the PREVIEW buttons' size in INVENTORY > EMOJIS. The square icon button widens
   into a pill that keeps its height. */
/* `.hud-icon-btn.` on purpose: the UI-kit block further down squares every .hud-icon-btn
   (padding 0, icon at 70 %) with the same one-class weight and would win by order. */
.hud-icon-btn.emote-btn, .hud-icon-btn.inv-wheel-btn {
  width: auto; flex-direction: row; gap: clamp(6px, 0.6vw, 9px);
  padding: 0 clamp(14px, 1.2vw, 18px) 0 clamp(8px, 0.8vw, 12px);
}
.hud-icon-btn.emote-btn img, .hud-icon-btn.inv-wheel-btn img { width: auto; height: 66%; flex: 0 0 auto; }
.emote-btn-label {
  font-family: var(--font-display); letter-spacing: 0.04em; line-height: 1;
  color: #2a1c00; white-space: nowrap;
}
.emote-btn .emote-btn-label { font-size: clamp(13px, 1.4vw, 16px); }
.inv-wheel-btn .emote-btn-label { font-size: 13px; }
.emote.open .emote-btn { filter: brightness(1.08); box-shadow: var(--gold-relief-press), 0 0 0 3px rgba(255, 214, 90, 0.45); }
/* While the wheel is open its zone goes above the HUD corners (z 40): on a short screen the
   ring reaches the top-right buttons and they would paint over its slices. */
.duel-action:has(.emote.open) { z-index: 45; }
.emote-wheel-pos {
  /* The un-animated box: it carries the size and the place (centred over the button, above
     it) plus the nudge `EmoteWheel` measures to keep the ring inside the screen. */
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  /* Six slices: bigger than the old four-slice ring so the stickers don't shrink. Capped by
     the viewport HEIGHT too, since the duel is landscape and a phone is short. */
  width: min(clamp(340px, 36vw, 500px), 84vh);
  aspect-ratio: 1;
  transform: translate(calc(-50% + var(--emote-dx, 0px)), var(--emote-dy, 0px));
}
.emote-wheel {
  display: block; width: 100%; height: 100%;
  transform-origin: 50% 100%;
  overflow: visible;
  animation: emote-wheel-in .18s var(--ease-out) both;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.6));
}
@keyframes emote-wheel-in {
  from { opacity: 0; transform: scale(0.55); }
  to   { opacity: 1; transform: scale(1); }
}
/* THE SLICES wear the UI kit's plate: ink outline, a dark lip under the face, the blue face
   gradient of the game's panels and a gloss on its upper half. Hover turns the face GOLD, the
   kit's "selected" colour (the tabs, END TURN). */
.emote-g-face-a { stop-color: #2a5da8; }
.emote-g-face-b { stop-color: #16386e; }
.emote-g-face-c { stop-color: #0f2751; }
.emote-slice { cursor: pointer; transform-box: view-box; transform-origin: 100px 100px; transition: transform .12s var(--ease-out), filter .12s var(--ease-out); }
.emote-slice-ink { fill: var(--gv-ink, #070f1d); }
.emote-slice-lip { fill: #081a3a; }
.emote-slice-face { fill: url(#emoteFace); }
.emote-slice-gloss { fill: url(#emoteGloss); pointer-events: none; }
.emote-slice text {
  font-family: var(--font-display);
  fill: #fff;
  stroke: var(--gv-ink, #070f1d);
  stroke-width: 3.2px;
  stroke-linejoin: round;
  paint-order: stroke;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.emote-slice-art text { stroke-width: 2.2px; }   /* small lines under the sticker: thinner outline */
.emote-slice-art image { pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .emote-slice:not(.empty):hover { transform: scale(1.05); } }
@media (hover: hover) and (pointer: fine) { .emote-slice:not(.empty):hover .emote-slice-face { fill: url(#emoteFaceGold); } }
@media (hover: hover) and (pointer: fine) { .emote-slice:not(.empty):hover .emote-slice-lip { fill: #8a5a0c; } }
@media (hover: hover) and (pointer: fine) { .emote-slice:not(.empty):hover .emote-slice-ink { fill: #2a1c05; } }
.emote-slice:not(.empty):active { transform: scale(0.98); }
.emote-slice.empty { cursor: default; }
/* An empty slot: a sunken well instead of a plate (no lip, no gloss), dashed inside. */
.emote-slice.empty .emote-slice-lip, .emote-slice.empty .emote-slice-gloss { display: none; }
.emote-slice.empty .emote-slice-ink { fill: rgba(7, 15, 29, 0.82); }
.emote-slice.empty .emote-slice-face { fill: rgba(8, 18, 38, 0.72); stroke: rgba(120, 160, 220, 0.45); stroke-width: 1.2; stroke-dasharray: 4 3.5; }
/* The hub: closes the wheel in the duel, decorative in the editor. */
.emote-hub { cursor: pointer; }
.emote-hub-face { fill: url(#emoteFaceGold); }
.emote-hub .emote-slice-lip { fill: #8a5a0c; }
.emote-hub .emote-slice-ink { fill: #2a1c05; }
.emote-hub image { pointer-events: none; }

/* The phrase in big, thick letters (Bowlby, gold with a dark outline), one WORD at a time:
   each .emote-word pops in after the previous one (its delay is set inline). */
.emote-text {
  display: inline-flex;
  gap: 0.3em;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
  filter: drop-shadow(0 4px 0 #1a1000) drop-shadow(0 8px 14px rgba(0,0,0,0.55));
}
.emote-word {
  display: inline-block;
  position: relative;
  color: #1a1000;
  -webkit-text-stroke: 0.16em #1a1000;
  transform-origin: 50% 85%;
  animation: emote-word-in .36s var(--ease-out) both;
}
/* The word itself is the dark OUTLINE; the gold face is a copy on top (a stroke on
   gradient-clipped text would eat the fill). */
.emote-word::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  -webkit-text-stroke: 0;
  background: linear-gradient(180deg, #fff6cf 0%, #ffd34d 48%, #f39c12 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes emote-word-in {
  0%   { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  55%  { opacity: 1; transform: scale(1.18) rotate(2deg); }
  80%  { transform: scale(0.95) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
/* Over the sender's energy: above your plate, below the rival's (its plate is at the top).
   The words bring themselves in; the bubble only holds and fades the whole phrase out (its
   duration grows with the word count — set inline, see emoteShowMs). */
.emote-bubble {
  position: absolute;
  left: clamp(12px, 1.4vw, 22px);
  pointer-events: none;
  z-index: 5;
  isolation: isolate;
  animation: emote-out 2.6s linear both;
}
.emote-bubble.emote-player { bottom: calc(100% + clamp(14px, 2.2vh, 24px)); }
.emote-bubble.emote-ai     { top: calc(100% + clamp(14px, 2.2vh, 24px)); }
@keyframes emote-out {
  0%, 88% { opacity: 1; transform: none; }
  100%    { opacity: 0; transform: translateY(-6px); }
}
.emote-bubble.is-preview { position: relative; left: 0; animation: none; }
/* An emoji = the sticker with its phrase UNDER it. The phrase wraps (long ones like OUCH!
   THAT MUST HURT) and is smaller than the old text-only emote so the pair reads as one. */
.emote-stack { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.emote-img {
  width: clamp(92px, 9vw, 132px); height: auto; display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  transform-origin: 50% 85%;
  animation: chatStickerPop .6s cubic-bezier(.2, .9, .3, 1.2) both;
}
.emote-stack .emote-text {
  font-size: clamp(22px, 2.3vw, 34px); white-space: normal; flex-wrap: wrap; justify-content: center;
  max-width: clamp(220px, 22vw, 340px); row-gap: 0.08em; text-align: center;
}
/* in the duel the phrase is CENTRED under the sticker (lines of a long phrase too) */
.emote-bubble.emote-player .emote-stack .emote-text, .emote-bubble.emote-ai .emote-stack .emote-text { justify-content: center; text-align: center; }
.inv-voice-body { display: flex; align-items: center; justify-content: center; min-height: 180px; cursor: pointer; isolation: isolate; }
/* The emoji preview modal is a SQUARE (1:1) sized off the smaller side of the screen, so it
   never needs to scroll; the sticker and its phrase scale with it (`--vm` = the square's side). */
.cl-modal.inv-voice-modal { --vm: min(580px, 94vw, 94vh); width: var(--vm); height: var(--vm); max-height: none; }
/* the phrase is already the big text under the sticker: the title stays on ONE line */
.inv-voice-modal .cl-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Sized off the BODY (what is left between the title and DONE), so sticker + up to three
   lines of phrase always fit whatever the square's size. */
.inv-voice-modal .inv-voice-body { flex: 1 1 auto; min-height: 0; overflow: hidden; align-items: center; padding: 0; container-type: size; }
.inv-voice-modal .emote-img { width: min(62cqh, 62cqw); }
.inv-voice-modal .emote-stack { gap: 1cqh; }
.inv-voice-modal .emote-stack .emote-text { font-size: min(10.4cqh, 7.6cqw); max-width: 98cqw; }
/* An emoji with a `halo` (EmoteSticker): the box takes the sticker's size class, the animated
   sparkles (svg) sit behind and the drawing on top. The drop shadow moves to the drawing, or
   the light would cast one too. */
.emote-fx { position: relative; display: block; aspect-ratio: 1; filter: none !important; }
.emote-fx > .emote-fx-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}
.emote-halo { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.emote-halo-rays { animation: emoteHaloSpin 26s linear infinite; opacity: 0.85; }
.emote-halo-glow { animation: emoteHaloPulse 2.6s ease-in-out infinite; }
.emote-halo-spark { transform-box: fill-box; transform-origin: center; animation: emoteHaloTwinkle 2.6s ease-in-out infinite; }
@keyframes emoteHaloSpin { to { transform: rotate(360deg); } }
@keyframes emoteHaloPulse { 0%, 100% { opacity: 0.6; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes emoteHaloTwinkle { 0%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
/* VOICES tab: the megaphone that opens the wheel editor sits at the END of the count row
   (after the rule line, which is the row's ::after). */
.inv-wheel-btn { order: 1; height: 46px; }
/* The wheel editor: the duel's ring, static and centred, with the owned voices under it. */
.voice-wheel-modal { width: min(620px, 96vw); }
.voice-wheel-body { flex-direction: column; align-items: center; gap: 12px; overflow-y: auto; }
/* Nothing in the column may shrink: with six slices and ten emojis it is taller than a short
   screen, and a squeezed hint or chip row gets clipped instead of scrolled. */
.voice-wheel-body > * { flex: 0 0 auto; }
.emote-wheel.is-editor {
  position: relative; left: auto; bottom: auto; transform: none; animation: none;
  width: min(460px, 84vw, 48vh); height: auto;
  touch-action: none;   /* on the <svg>: Chrome ignores touch-action on its inner <g>s */
}
.emote-wheel.is-editor .emote-slice { cursor: grab; touch-action: none; }
.emote-wheel.is-editor .emote-slice.empty { cursor: default; }
@media (hover: hover) and (pointer: fine) { .emote-wheel.is-editor .emote-slice:not(.empty):hover { transform: scale(1.04); } }
.emote-wheel.is-editor .emote-hub { cursor: default; }
.voice-wheel-body.is-dragging, .voice-wheel-body.is-dragging * { cursor: grabbing !important; user-select: none; }
.emote-wheel.is-editor .emote-slice.lifted { opacity: 0.35; transform: none; filter: none; }
.emote-wheel.is-editor .emote-slice.drop { transform: scale(1.07); filter: brightness(1.25); }
.emote-wheel.is-editor .emote-slice.drop .emote-slice-face { fill: url(#emoteFaceGold); stroke: none; }
.emote-wheel.is-editor .emote-slice.drop .emote-slice-ink { fill: #2a1c05; }
.voice-wheel-hint { margin: 10px 0 0; min-height: 2.8em; max-width: 380px; text-align: center; font-family: var(--font-body); font-size: 15px; color: var(--text-muted); line-height: 1.4; }
.voice-wheel-hint.is-remove { color: #ff8a7a; }
.voice-wheel-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.voice-chip {
  font-family: var(--font-display); font-size: 15px; letter-spacing: 0.02em; color: #ffe8a3;
  padding: 8px 14px; border-radius: 999px; cursor: grab; touch-action: none; user-select: none;
  /* The same plate as the wheel's slices: ink outline, blue face, light on top, lip below. */
  color: #fff; text-shadow: 0 2px 0 rgba(6, 20, 44, .6);
  background: var(--gem-face); border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 rgba(4, 14, 34, 0.55), 0 3px 8px -3px rgba(0, 0, 0, 0.7);
  transition: transform .12s var(--ease-out), filter .12s var(--ease-out), opacity .12s;
}
.voice-chip { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; }
.voice-chip-img { width: 30px; height: 30px; object-fit: contain; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .voice-chip:hover { transform: translateY(-1px); filter: brightness(1.2); } }
.voice-chip.lifted { opacity: 0.35; }
/* The piece that follows the pointer while dragging (centred on it, above everything). */
.voice-ghost {
  position: fixed; z-index: 1500; pointer-events: none;
  transform: translate(-50%, -50%) scale(1.08) rotate(-3deg);
  border-color: #2a1c05; background: var(--gold-face); color: #2a1c05; text-shadow: none;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(138, 90, 12, 0.6), 0 10px 24px rgba(0,0,0,0.55);
}
.voice-ghost.is-remove { border-color: #ff6b5a; background: #3a1210; color: #ffd0c8; }
.voice-wheel-actions { display: flex; justify-content: center; }
/* Inventory tile of a voice: the phrase itself is the icon. */
.inv-item-art.is-voice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqi; padding: 6cqi 4cqi;
  background: radial-gradient(circle at 50% 40%, #2b3350 0%, #121828 75%);
  isolation: isolate;
  container-type: inline-size;
}
/* beats `.inv-item-art img` (cover at 100 %), which cropped the sticker */
.inv-item-art.is-voice .voice-art-img {
  width: 64cqi; height: auto; flex: 0 1 auto; min-height: 0; object-fit: contain; object-position: center;
  display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
}
.voice-art-text {
  font-family: var(--font-display);
  font-size: 13cqi;
  line-height: 1;
  color: #ffd34d;
  -webkit-text-stroke: 0.08em #1a1000;
  paint-order: stroke fill;
  text-align: center;
  filter: drop-shadow(0 3px 0 #1a1000);
}
@media (prefers-reduced-motion: reduce) {
  .emote-wheel { animation-duration: 0.01s; }
  .emote-bubble, .emote-word, .emote-img { animation: none; }
  .emote-halo-rays, .emote-halo-glow { animation: none; }
  .emote-halo-spark { animation: none; opacity: 0.9; }
}

/* ----- Hands inside the stage (top = enemy, bottom = player) ----- */
/* The hand-fan keeps its own internal layout (absolute slots), but in the grid
   it lives in the first/last auto rows. Give it room to show the cards. */
.duel-stage > .hand-fan { width: 100%; align-self: stretch; }
/* The hands live OUTSIDE the sand (at the screen edges), so they cancel out the stage's
   arena inset with an equal negative margin — the rows stay clamped, the hands don't move. */
.duel-stage > .hand-fan.side-player { align-self: end; height: clamp(40px, 8vh, 78px); margin: 0 0 calc(-1 * var(--arena-b, 0px)); }
.duel-stage > .hand-fan.side-ai     { align-self: start; height: clamp(30px, 6vh, 58px); margin: calc(-1 * var(--arena-t, 0px)) 0 0; }

/* ----- In-duel settings modal ----- */
.duel-settings-overlay {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(3, 6, 12, 0.66);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.duel-settings-modal {
  width: min(440px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20,28,48,0.98), rgba(11,15,26,0.98));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  padding: 18px;
}
.duel-settings-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.duel-settings-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.4vw, 24px);
  letter-spacing: 0.04em;
  color: var(--gold-bright);
}
.duel-settings-close {
  width: 34px; height: 34px; padding: 7px;
  border-radius: 10px; border: 1px solid var(--border-soft);
  background: var(--surface-1); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.duel-settings-close img { width: 100%; height: 100%; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .duel-settings-close:hover { border-color: var(--border-strong); background: var(--surface-2); } }
.duel-settings-body { display: flex; flex-direction: column; gap: 16px; }

/* ----- Confirmation dialog (Proof of Sacrifice) -----
   Everything scales with vmin so it shrinks to fit short phone-landscape screens
   (no cutoff) and grows on large desktops, clamped to sensible min/max bounds.
   max-height + scroll is the safety net on the shortest viewports. */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 320;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(10px, 2vmin, 24px);
  background: rgba(3, 6, 12, 0.72);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.confirm-modal {
  width: clamp(300px, 42vw, 560px);
  max-height: 94vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(20,28,48,0.98), rgba(11,15,26,0.98));
  border: 1px solid var(--border-strong);
  border-radius: clamp(14px, 1.6vmin, 20px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  padding: clamp(16px, 2.6vmin, 28px);
  text-align: center;
}
.confirm-title {
  margin: 0 0 clamp(8px, 1.4vmin, 14px);
  font-family: var(--font-display);
  font-size: clamp(19px, 4.4vmin, 32px);
  letter-spacing: 0.04em;
  color: var(--ai-bright);
}
.confirm-text {
  margin: 0 0 clamp(8px, 1.4vmin, 12px);
  font-family: var(--font-ui); font-size: clamp(13px, 2.2vmin, 17px);
  color: var(--text); line-height: 1.5;
}
.confirm-warn {
  margin: 0 0 clamp(12px, 2.4vmin, 20px);
  font-family: var(--font-ui); font-size: clamp(11px, 1.9vmin, 14px); line-height: 1.45;
  color: var(--ai-bright); background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.30); border-radius: 10px;
  padding: clamp(8px, 1.5vmin, 12px) clamp(10px, 1.8vmin, 14px);
}
/* ----- CardThick: the physical thickness of a flipping card (game.js). Copies of the card's frame
   silhouette stacked in Z between its faces; the parent flip node must be preserve-3d. NO opacity /
   filter here (they would flatten the 3D stack). ----- */
.card-thick, .card-thick > i { position: absolute; inset: 0; pointer-events: none; }
.card-thick { transform-style: preserve-3d; visibility: hidden; }   /* CardThick's tick shows it only side-on */
.card-thick > i {
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
/* ----- Proof of Sacrifice cinematic (disintegration → spiral → flip-zoom) ----- */
.sac-fx-overlay { position: fixed; inset: 0; z-index: 330; perspective: 1400px; perspective-origin: 50% 50%; } /* swallows input while it plays */
/* En la VISTA PREVIA (DuelSim): por encima del modal, recortado al tablero (clip-path en
   linea) y sin tragarse los toques, para poder elegir otro efecto o cerrar a medias. */
.sac-fx-overlay.is-preview { z-index: 1500; pointer-events: none; }
.sac-fx-dim { position: fixed; inset: 0; background: rgba(3, 4, 10, 0.5); opacity: 0; pointer-events: none; z-index: 0; } /* darkens the board while charging */
/* El vortice del portal (FX.vortex, WebGL): debajo del lienzo de particulas; lo coloca y lo enciende SacrificeFx. */
.sac-fx-portal { position: fixed; display: none; pointer-events: none; z-index: 1; }
.sac-fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
/* 3D flip container for the summoned card (front = card, back = card_back_01). */
.sac-fx-float { position: fixed; pointer-events: none; will-change: transform, opacity; z-index: 2; transform-style: preserve-3d; transform-origin: center center; }
/* Two stacked faces in the float's 3D space. Which one shows is driven per-frame
   from the live rotateX (see faceTick) — more reliable than backface-visibility,
   which Chrome ignores for the card's composited child layers. */
.sac-fx-face { position: absolute; inset: 0; }
.sac-fx-front .card { width: 100% !important; height: 100% !important; }
.sac-fx-front { transform: translateZ(calc(var(--card-thick, 0px) / 2)); }
.sac-fx-back { transform: rotateY(180deg) translateZ(calc(var(--card-thick, 0px) / 2)); visibility: hidden; }
.sac-fx-back img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 10px 22px rgba(0,0,0,0.55)); }
.slot.fx-hide .card { visibility: hidden; } /* hide the landed hero until the FX drops it in */

/* "PROOF OF SACRIFICE SUMMON" announcement — reuses the trap banner's dim + slam
   animation and duration (--trb-dur), just recoloured red. */
.pos-banner {
  position: fixed; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  animation: trapBannerDim var(--trb-dur, 1500ms) ease both;
}
.pos-banner-inner {
  will-change: transform, opacity, filter;
  animation: trapBannerSlam var(--trb-dur, 1500ms) cubic-bezier(0.2, 1, 0.3, 1) both;
}
.pos-banner-text {
  font-family: var(--font-display);
  font-size: clamp(22px, 5.4vw, 60px); letter-spacing: 0.04em; line-height: 1.05;
  text-align: center; max-width: 92vw; padding: 0 16px; display: inline-block;
  color: #ff6b6b;
  text-shadow: 0 3px 0 rgba(0,0,0,0.5), 0 0 24px rgba(239,68,68,0.9), 0 0 64px rgba(239,68,68,0.55);
}

.confirm-actions { display: flex; gap: clamp(8px, 1.6vmin, 14px); justify-content: center; }
.confirm-actions .btn {
  flex: 1;
  font-size: clamp(12px, 2vmin, 16px);
  padding: clamp(9px, 1.6vmin, 14px) clamp(14px, 2vmin, 22px);
}
/* El aviso de cambios sin guardar es el unico con TRES salidas: la ventana va un punto mas
   ancha y la fila se PARTE antes que apretar los rotulos, que es lo que pasaba al meter un
   tercer boton en una fila pensada para dos. */
.db-unsaved-modal { width: clamp(300px, 52vw, 620px); }
.db-unsaved-modal .confirm-actions { flex-wrap: wrap; }
.db-unsaved-modal .confirm-actions .btn { flex: 1 1 150px; }

/* Inline energy cost: the energy gem icon + the value (replaces the ⚡ glyph). */
.energy-cost { display: inline-flex; align-items: center; gap: 0.18em; font-weight: 800; color: var(--gold-bright); vertical-align: middle; }
.energy-cost-icon { width: 1.15em; height: 1.15em; object-fit: contain; vertical-align: middle; transform: translateY(-0.03em); }

/* The two cards: tribute (left) → summoned hero (right). */
.sacrifice-cards {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(10px, 2.2vmin, 20px);
  margin: clamp(2px, 0.8vmin, 6px) 0 clamp(10px, 2vmin, 18px);
}
.sacrifice-card { display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.2vmin, 10px); }
.sacrifice-card .card { width: clamp(82px, 19vmin, 158px); cursor: default; }
.sacrifice-card-label {
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(10px, 1.7vmin, 13px);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: clamp(2px, 0.5vmin, 4px) clamp(8px, 1.6vmin, 12px); border-radius: 999px;
}
.sacrifice-card-label.tribute { color: var(--ai-bright); background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.40); }
.sacrifice-card-label.summon  { color: var(--gold-bright); background: rgba(245,193,74,0.14); border: 1px solid rgba(245,193,74,0.40); }
/* Tribute reads as "doomed": desaturated with a red ring; the summon glows gold. */
.sacrifice-card.is-tribute .card { filter: grayscale(0.4) brightness(0.82); box-shadow: 0 0 0 2px var(--ai), 0 6px 14px rgba(0,0,0,0.55); }
.sacrifice-card.is-summon .card  { box-shadow: 0 0 0 2px var(--gold-bright), 0 8px 18px rgba(0,0,0,0.55); }
/* Thick, sharp-cornered block arrow (SVG path, mitered joins). */
.sacrifice-arrow {
  flex: 0 0 auto;
  width: clamp(24px, 5.2vmin, 48px); height: auto;
  margin-bottom: clamp(16px, 3.4vmin, 30px);
  fill: var(--gold-bright);
  stroke: rgba(40, 26, 2, 0.6); stroke-width: 2; stroke-linejoin: miter;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* ----- Multi-tribute PICKER (cards whose Proof of Sacrifice may eat 1 or 2 heroes) -----
   Same shell as the confirm modal above; the left half becomes a row of TAPPABLE
   tributable heroes instead of a single fixed card. Unpicked cards are dimmed, picked
   ones get the same "doomed" red ring the plain tribute uses, so the two dialogs read
   as one family. It's wider than the plain confirm because it can show 5 candidates. */
.sac-pick-modal { width: clamp(320px, 60vw, 780px); }
.sac-pick-hint {
  margin: 0 0 clamp(8px, 1.4vmin, 12px);
  font-family: var(--font-ui); font-size: clamp(11px, 1.9vmin, 14px); line-height: 1.45;
  color: var(--text-dim, rgba(226, 232, 240, 0.7));
}
.sac-pick-options {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: clamp(6px, 1.4vmin, 12px);
}
.sac-pick-opt {
  position: relative;
  padding: 0; margin: 0; border: 0; background: none; line-height: 0;
  cursor: pointer;
  border-radius: 12px;
  transition: transform .14s ease, filter .14s ease;
}
.sac-pick-opt .card { width: clamp(64px, 14vmin, 118px); cursor: pointer; }
/* Not picked: pushed back (dim + desaturated), so the chosen tributes pop out. */
.sac-pick-opt .card { filter: grayscale(0.55) brightness(0.62); box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
@media (hover: hover) and (pointer: fine) { .sac-pick-opt:hover .card { filter: grayscale(0.25) brightness(0.85); } }
.sac-pick-opt.on .card {
  filter: grayscale(0.4) brightness(0.82);
  box-shadow: 0 0 0 2px var(--ai), 0 6px 14px rgba(0,0,0,0.55);
}
.sac-pick-opt.on { transform: translateY(-4px); }
/* Already at the tribute cap and this one isn't picked → tapping it would do nothing. */
.sac-pick-opt.locked { cursor: not-allowed; }
.sac-pick-opt.locked .card { filter: grayscale(0.8) brightness(0.42); }
/* The ✓ / + badge on each candidate's corner. */
.sac-pick-mark {
  position: absolute; top: -6px; right: -6px;
  width: 1.55em; height: 1.55em; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(11px, 1.9vmin, 15px); line-height: 1;
  color: rgba(226, 232, 240, 0.75);
  background: rgba(11, 15, 26, 0.95);
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.55);
}
.sac-pick-opt.on .sac-pick-mark {
  color: #fff;
  background: var(--ai); border-color: var(--ai-bright);
  box-shadow: 0 2px 8px rgba(239,68,68,0.6);
}
.sac-pick-cost { font-weight: 700; }
/* Cost you can't pay — the Summon button is disabled too, this just says why. */
.energy-cost.short { color: var(--ai-bright); }
.confirm-actions .btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.5); }

/* ---- Aviso de acción RECHAZADA (p.ej. Forkhydra repitiendo objetivo) ----
   Entra de golpe en el centro del tablero, aguanta un par de segundos y se va con un
   fundido. No bloquea nada: `pointer-events: none`, porque es un mensaje, no un diálogo
   — el jugador tiene que poder seguir jugando sin cerrarlo.
   `--notice-dur` lo pone el componente (NOTICE_MS en game.js); los porcentajes reparten
   ese total entre entrada, aguante y salida, así que ambos valores van siempre a la par. */
.action-notice {
  position: absolute;
  left: 50%;
  top: 22%;
  z-index: 300;
  pointer-events: none;
  max-width: min(86vw, 620px);
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(15px, 2.6vw, 27px);
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: #ffe4e4;
  padding: clamp(10px, 1.8vmin, 16px) clamp(16px, 2.6vmin, 26px);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(84, 14, 20, 0.94), rgba(44, 6, 10, 0.94));
  border: 2px solid rgba(239, 68, 68, 0.75);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 26px rgba(239, 68, 68, 0.35);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  animation: actionNoticeIn var(--notice-dur, 2200ms) cubic-bezier(0.2, 1, 0.3, 1) both;
}
@keyframes actionNoticeIn {
  0%   { opacity: 0; transform: translate(-50%, -14px) scale(0.9); }
  8%   { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  14%  { transform: translate(-50%, 0) scale(1); }
  70%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.98); }   /* fundido de salida */
}
@media (prefers-reduced-motion: reduce) {
  .action-notice { animation: actionNoticeFade var(--notice-dur, 2200ms) linear both; }
  @keyframes actionNoticeFade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
}

/* ----- Portrait gate: the duel is landscape-only on phones ----- */
.rotate-gate { display: none; }
.rotate-gate-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; max-width: 320px; }
.rotate-gate-phone {
  width: 54px; height: 92px;
  border: 3px solid var(--gold);
  border-radius: 12px;
  position: relative;
  animation: rotateGatePhone 2.4s var(--ease-in-out) infinite;
}
.rotate-gate-phone::after {
  content: '';
  position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 2px; background: var(--gold);
}
@keyframes rotateGatePhone {
  0%, 35%  { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}
.rotate-gate h2 { margin: 0; font-family: var(--font-display); font-size: 24px; letter-spacing: 0.04em; color: var(--gold-bright); }
.rotate-gate p  { margin: 0; font-family: var(--font-ui); font-size: 14px; color: var(--text-dim); line-height: 1.45; }

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-gate {
    display: flex;
    position: fixed; inset: 0; z-index: 200;
    align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(4, 7, 14, 0.97);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
}

/* ----- Tighter spacing on short landscape (phones held sideways) ----- */
@media (max-height: 480px) {
  /* Menos aire a los lados, pero SIN perder el recorte a la arena: si se escribe el `clamp`
     a secas gana a la regla de arriba y la fila de 5 vuelve a salirse del marco de piedra. */
  .duel-stage {
    padding-left: max(clamp(46px, 8vw, 104px), var(--arena-l, 0px));
    padding-right: max(clamp(46px, 8vw, 104px), var(--arena-r, 0px));
  }
  .hud-icon-btn { width: 44px; height: 44px; padding: 8px; }
  .pp-name { font-size: clamp(14px, 3vw, 19px); }
  .duel-action { width: clamp(112px, 22vw, 160px); bottom: clamp(6px, 1.4vh, 12px); }
}

/* ----- Reduced-cost FX: luminous green particles drifting off the cost number
   (hand cards whose energy cost was discounted by a board effect) ----- */
.cost-spark-fx { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.cost-spark {
  position: absolute; left: 0; top: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #d6ffe9 0%, #46f7a2 55%, rgba(70, 247, 162, 0) 78%);
  box-shadow: 0 0 6px rgba(70, 247, 162, 0.9);
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  animation: costSpark 1.5s ease-out var(--d, 0s) infinite;
}
@keyframes costSpark {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  22%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.7); }
}

/* ===================================================================
   GUIDED TUTORIAL — spotlight overlay + coach narrator
   =================================================================== */
.tut-overlay { position: fixed; inset: 0; z-index: 4000; pointer-events: none; }
/* Invisible pointer gate: blocks the board except through the spotlight holes. */
.tut-catcher { position: fixed; inset: 0; pointer-events: auto; background: transparent; }
/* Feathered screen-dim with cutouts (the dark layer with target holes). */
.tut-mask { position: fixed; inset: 0; pointer-events: none; }

/* Looping GESTURE demo: a cursor/sword icon that mimes the action (drag / click /
   attack). Position + image are driven imperatively by rAF (TutGesture); CSS only
   styles it. The inner <img> carries the per-frame scale + hotspot offset. */
.tut-gesture {
  position: fixed; left: 0; top: 0; z-index: 4200; pointer-events: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
}
/* Hand cursors are tiny PNGs (24–32px) → keep them near native so they stay crisp,
   not blown up and pixelated. The big 512px icons (sword / spell) can be larger. */
.tut-gesture img { display: block; width: 36px; height: auto; will-change: transform; }
.tut-gesture.is-attack img, .tut-gesture.is-spell img { width: 54px; }
/* NOTE: the four custom hand cursors (pointer / press / grab / fist) are already
   applied to the whole app — duel and tutorial included — by the global
   `body.app-cursor` rules above (search `cursor: url`). No tutorial-specific cursor
   CSS needed. */

/* Skip button: centrado arriba (los puntos de capitulo que iban ahi se quitaron). */
.tut-skip {
  position: fixed; top: clamp(10px, 2vh, 18px); left: 50%; transform: translateX(-50%);
  pointer-events: auto; cursor: pointer;
  font: 600 12px/1 var(--font-body, "Space Grotesk", system-ui, sans-serif);
  letter-spacing: 0.06em; text-transform: uppercase; color: rgba(234, 240, 255, 0.82);
  background: rgba(8, 12, 22, 0.72); border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 8px 12px; border-radius: 10px; backdrop-filter: blur(4px);
  transition: color .15s, border-color .15s, background .15s;
}
@media (hover: hover) and (pointer: fine) { .tut-skip:hover { color: #fff; border-color: rgba(255, 255, 255, 0.34); background: rgba(14, 20, 34, 0.85); } }

/* Narrator: coach avatar + speech bubble. */
.tut-narrator {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(760px, 94vw); display: flex; gap: 14px; pointer-events: none;
}
/* LARRY (el muneco de characters/larry) vive SIEMPRE abajo a la izquierda, de pie entre la placa
   de energia del jugador (.hud-bl) y su mano, con los pies en el borde de la pantalla; el
   bocadillo va ENCIMA de el con la cola apuntandole hacia abajo. `pos-top/bottom` no le afecta. */
.tut-narrator.at-larry, .tut-narrator.at-larry.pos-bottom, .tut-narrator.at-larry.pos-top {
  --larry-width: clamp(250px, 26vw, 420px);
  /* a la derecha de la placa de energia (.hud-bl: ~216px + su margen) */
  left: var(--larry-left, clamp(300px, 22.5vw, 380px)); right: auto; top: auto; transform: none;
  /* los pies (la linea de corte de las poses) quedan POR DEBAJO del borde: no se ve el corte.
     `--larry-left` / `--larry-width` los escribe el juego medidos en px (`useLarryAnchor`,
     game.js): a la izquierda de la antorcha inferior izquierda si cabe sin tapar la placa de
     energia, y si no, pegado a la placa. */
  bottom: -4vh;
  width: min(520px, 46vw); flex-direction: column; align-items: flex-start; gap: 0;
}
.tut-narrator.at-larry .tut-coach {
  order: 2; width: var(--larry-width); aspect-ratio: auto; margin-left: 0;
  animation: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
}
.tut-narrator.at-larry .tut-coach.is-talking, .tut-narrator.collapsed.at-larry .tut-coach { animation: none; }
.tut-narrator.collapsed.at-larry .tut-coach { animation: tutCoachPulse 1.8s ease-in-out infinite; }
.tut-coach-larry { width: 100%; }
/* `--bubble-shift` (<= 0, lo escribe `useLarryAnchor`): con Larry arrastrado hacia la derecha el
   bocadillo se corre a la izquierda lo justo para no salirse de la pantalla; la cola deshace ese
   corrimiento para seguir apuntando a Larry. */
.tut-narrator.at-larry .tut-bubble { order: 1; margin: 0 0 32px var(--bubble-shift, 0px); width: 100%; }
.tut-narrator.at-larry .tut-bubble::before, .tut-narrator.at-larry .tut-bubble::after {
  left: calc(var(--larry-width) / 2 - 14px - var(--bubble-shift, 0px)); top: auto;
}
.tut-narrator.at-larry .tut-bubble::before { bottom: -14px; border-width: 14px 14px 0 14px; border-right-color: transparent; border-top-color: var(--bubble-line, #f5c14a); }
.tut-narrator.at-larry .tut-bubble::after  { bottom: -11px; left: calc(var(--larry-width) / 2 - 12px - var(--bubble-shift, 0px)); border-width: 12px 12px 0 12px; border-right-color: transparent; border-top-color: rgba(17, 23, 40, 0.98); }
/* Arrastrable por el borde inferior: sin `touch-action` el navegador se queda el gesto para
   desplazar la pagina y el arrastre con dedo nunca empieza. */
.tut-narrator.at-larry .tut-coach { cursor: grab; touch-action: none; }
.tut-narrator.at-larry.is-dragging .tut-coach { cursor: grabbing; animation: none; }
.tut-narrator.at-larry.is-dragging .tut-bubble { pointer-events: none; }
/* La caja de Larry cuelga 4vh por debajo del borde (el corte de los muslos): el chip sube ese
   tanto para quedar a la vista, sobre sus piernas. */
.tut-narrator.at-larry .tut-coach-peek { bottom: calc(4vh + 14px); }
.tut-narrator.pos-bottom { bottom: clamp(16px, 4vh, 44px); align-items: flex-end; }
.tut-narrator.pos-top { top: clamp(64px, 9vh, 96px); align-items: flex-start; }
.tut-coach {
  flex: none; width: clamp(78px, 11vw, 132px);
  /* Los SIETE fotogramas viven apilados aqui dentro, asi que la caja no puede medirse por su
     contenido (todos son absolutos): la altura la pone el aspecto del recorte. */
  position: relative; aspect-ratio: 300 / 312;   /* el del recorte: ver UI/coach/ */
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5));
  animation: tutCoachBob 3.4s ease-in-out infinite;
}
/* Cambiar de boca es encender otro fotograma, no cambiar un `src`: asi no hay ni descarga ni
   decodificacion en medio del ciclo. SIN transicion — una boca que se funde con la siguiente
   no vocaliza, se ve borrosa. */
.tut-coach-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; opacity: 0; pointer-events: none;
}
.tut-coach-frame.on { opacity: 1; }
/* Mientras habla, el balanceo va mas vivo: se nota que esta "en marcha". */
.tut-coach.is-talking { animation: tutCoachBob 1.9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tut-coach, .tut-coach.is-talking { animation: none; } }
@keyframes tutCoachBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.tut-bubble {
  position: relative; flex: 1 1 auto; pointer-events: auto;
  /* Fondo LISO a proposito (antes era un degradado de rgba(22,30,52) a
     rgba(12,16,28)). La cola es un triangulo CSS y un triangulo solo puede
     llevar color plano: con el degradado, el relleno de la punta solo coincidia
     a una altura concreta y a las demas se veia de otro color. Este liso es el
     punto medio de aquel degradado, asi que el bocadillo se ve casi igual y la
     punta encaja EXACTO este donde este. */
  background: rgba(17, 23, 40, 0.98);
  /* YELLOW outline (2px), tail included: the tail's outer triangle carries the same colour */
  border: 2px solid var(--bubble-line, #f5c14a);
  border-radius: 16px; padding: 14px 18px 16px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: tutBubbleIn .32s cubic-bezier(0.2, 1, 0.3, 1);
}
/* Tail pointing toward the coach — a clean LEFT-pointing triangle that reads as one
   piece with the bubble (a 1px border layer behind + a matching fill layer in
   front), not a rotated square that looked like a stray diamond. */
.tut-bubble::before, .tut-bubble::after {
  content: ""; position: absolute; width: 0; height: 0;
  border-style: solid; border-color: transparent;
}
/* Geometria de la punta, para que lea como UNA pieza con el bocadillo:
   - contorno: punta en -11, base en 0 (justo el borde de la caja del bocadillo)
   - relleno : punta en -10 (1px dentro) y base en +1, o sea que PISA el borde de
     1px del bocadillo — si no, quedaba una raya vertical cruzando la base.
   - el relleno es 2px mas bajo y va 1px mas abajo, asi asoma 1px de contorno por
     arriba y por abajo: mismo grosor que el borde del bocadillo por todos lados
     (antes el relleno estaba 2px a la derecha y la punta salia con doble grosor). */
/* 2px outline: the outer triangle's base sits on the padding edge (it covers the 2px border band) and its
   tip is 14px out; the fill is 3px shorter at the tip (≈ 2px perpendicular on a 45° side) and reaches 1px
   INTO the bubble, so the border line never crosses the tail's base. Fill centre = outline centre. */
.tut-bubble::before { /* contorno */
  left: -14px; border-width: 14px 14px 14px 0;
  border-right-color: var(--bubble-line, #f5c14a);
}
.tut-bubble::after { /* relleno: EL MISMO color liso del bocadillo */
  left: -11px; border-width: 12px 12px 12px 0;
  border-right-color: rgba(17, 23, 40, 0.98);
}
/* Solo el narrador de lado (sin Larry): con Larry la cola cuelga por DEBAJO del bocadillo, y
   estas reglas —declaradas despues y con la misma especificidad— la metian 18px dentro. */
.tut-narrator.pos-bottom:not(.at-larry) .tut-bubble::before { bottom: 18px; }
.tut-narrator.pos-bottom:not(.at-larry) .tut-bubble::after  { bottom: 20px; }
.tut-narrator.pos-top:not(.at-larry) .tut-bubble::before { top: 18px; }
.tut-narrator.pos-top:not(.at-larry) .tut-bubble::after  { top: 20px; }
@keyframes tutBubbleIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.tut-bubble-name {
  font: 700 12px/1 var(--font-display, "Bowlby One", sans-serif);
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--gold-bright, #fde68a); margin-bottom: 6px;
}
.tut-bubble-text { color: #eaf0ff; font: 500 clamp(14px, 1.35vw, 18px)/1.5 var(--font-body, "Space Grotesk", system-ui, sans-serif); }
/* El cursor mientras escribe. Va en un ::after del propio parrafo para que siga a la ultima
   letra sin medir nada. */
.tut-bubble-text.is-typing::after {
  content: ""; display: inline-block; vertical-align: -1px;
  width: 2px; height: 1em; margin-left: 3px;
  background: var(--gold-bright, #fde68a);
  animation: tutCaret 0.9s steps(2, end) infinite;
}
@keyframes tutCaret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
/* Mientras se escribe, el bocadillo NO puede encoger y crecer con cada letra: se reserva la
   altura de la frase entera con una linea invisible. Sin esto el bloque da saltos y la
   pantalla entera baila debajo. */
.tut-bubble-text { min-height: 3em; }
.tut-bubble-actions { margin-top: 12px; display: flex; align-items: center; justify-content: flex-end; min-height: 34px; }
.tut-next { font-size: 13px; }
.tut-hint {
  font: 600 12px/1.3 var(--font-body, "Space Grotesk", system-ui, sans-serif);
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold-bright, #fde68a);
  display: flex; align-items: center; gap: 8px;
}
.tut-hint::before { content: "↳"; opacity: .8; }

/* Coach is tappable to show/hide the bubble (so it never blocks the action). */
.tut-coach { cursor: pointer; pointer-events: auto; }
/* Small "hide" button in the bubble's top-right corner. */
.tut-bubble-hide {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  display: grid; place-items: center; pointer-events: auto; cursor: pointer;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06); color: rgba(234, 240, 255, 0.7);
  font: 700 14px/1 var(--font-body, system-ui, sans-serif);
  transition: background .15s, color .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .tut-bubble-hide:hover { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.3); } }
.tut-bubble-name { padding-right: 26px; }   /* keep the name clear of the hide button */
/* Collapsed: only the coach shows, with a soft pulse + a little "tap me" chip. */
.tut-narrator.collapsed .tut-bubble { display: none; }
.tut-narrator.collapsed .tut-coach { animation: tutCoachBob 3.4s ease-in-out infinite, tutCoachPulse 1.8s ease-in-out infinite; }
@keyframes tutCoachPulse { 0%, 100% { filter: drop-shadow(0 10px 18px rgba(0,0,0,0.5)); } 50% { filter: drop-shadow(0 10px 18px rgba(0,0,0,0.5)) drop-shadow(0 0 12px rgba(245,193,74,0.8)); } }
.tut-coach-peek {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  pointer-events: none; white-space: nowrap;
  font: 700 10px/1 var(--font-body, system-ui, sans-serif); letter-spacing: 0.05em; text-transform: uppercase;
  color: #1a1205; background: var(--gold-bright, #fde68a);
  padding: 4px 8px; border-radius: 999px; box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* Completion screen. */
.tut-complete-overlay {
  position: fixed; inset: 0; z-index: 4010; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 14, 0.78); backdrop-filter: blur(6px);
  animation: tutBubbleIn .3s ease;
}
.tut-complete {
  width: min(440px, 92vw); text-align: center;
  background: linear-gradient(180deg, rgba(22, 30, 52, 0.98), rgba(12, 16, 28, 0.98));
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.16)); border-radius: 22px;
  padding: 28px 26px 26px; box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
}
.tut-complete-coach { width: clamp(96px, 16vw, 140px); margin: -64px auto 6px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); }
.tut-complete-coach img { width: 100%; display: block; }
.tut-complete-title { font: 400 clamp(22px, 3vw, 30px)/1 var(--font-display, "Bowlby One", sans-serif); color: var(--gold-bright, #fde68a); margin: 4px 0 10px; letter-spacing: 0.02em; }
.tut-complete-body { color: #cdd6ee; font: 500 clamp(14px, 1.4vw, 17px)/1.55 var(--font-body, "Space Grotesk", system-ui, sans-serif); margin: 0 0 20px; }
.tut-complete-btn { width: 100%; justify-content: center; }

/* DUEL lobby — TUTORIAL entry card. */
.start-tutorial-card {
  display: flex; align-items: center; gap: clamp(16px, 1.5vw, 26px); width: 100%; margin: 0 0 22px;
  padding: clamp(8px, min(1.3vw, 2.1vh), 22px) clamp(18px, 1.6vw, 28px); cursor: pointer; text-align: left;
  background: linear-gradient(135deg, rgba(245, 193, 74, 0.16), rgba(245, 193, 74, 0.05));
  border: 1px solid rgba(245, 193, 74, 0.5); border-radius: clamp(16px, 1.3vw, 20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .start-tutorial-card:hover { transform: translateY(-2px); border-color: var(--gold-bright, #fde68a); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 24px rgba(245, 193, 74, 0.3); } }
.start-tutorial-coach { flex: none; width: clamp(56px, min(8.5vw, 10.6vh), 104px); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); }
.start-tutorial-coach img { width: 100%; display: block; }
.start-tutorial-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.start-tutorial-title { font: 400 clamp(20px, min(2.7vw, 3.8vh), 32px)/1 var(--font-display, "Bowlby One", sans-serif); color: var(--gold-bright, #fde68a); letter-spacing: 0.02em; }
.start-tutorial-desc { font: 500 clamp(13px, min(1.45vw, 2.2vh), 18px)/1.4 var(--font-body, "Space Grotesk", system-ui, sans-serif); color: #cdd6ee; }
.start-tutorial-go { flex: none; font-size: clamp(20px, 2.4vw, 30px); color: var(--gold-bright, #fde68a); opacity: 0.9; }

/* ===================================================================
   DUEL lobby — mode select (TUTORIAL / QUICK DUEL) + sub-pickers
   =================================================================== */
.start-modes { width: 100%; max-width: var(--duel-col, 640px); display: flex; flex-direction: column;
  gap: clamp(8px, min(1.2vw, 1.9vh), 20px); margin: clamp(10px, min(2.4vw, 3.2vh), 34px) auto 0; }
.start-modes .start-tutorial-card.start-mode { margin: 0; }
/* TUTORIAL, un poco mas grande que los otros modos: es la puerta de entrada y lleva a Larry
   (TutorialCoverLarry, pose `crossed`). El dibujo esta CORTADO por abajo (a media pierna), asi
   que se APOYA en el borde inferior de la tarjeta: `align-self: flex-end` y un margen negativo
   igual al relleno inferior, para que el corte coincida con el filo y no se lea como pies
   cortados. `overflow: hidden` + el radio recortan esa base contra el marco. */
.start-mode.tutorial {
  --tut-pad-y: clamp(10px, min(1.6vw, 2.6vh), 28px);
  position: relative; overflow: hidden;
  padding: var(--tut-pad-y) clamp(20px, 1.9vw, 34px);
}
.start-mode.tutorial .start-tutorial-coach.cover-larry {
  position: relative; align-self: flex-end; margin-bottom: calc(-1 * var(--tut-pad-y));
  height: clamp(104px, min(13vw, 18.2vh), 196px); aspect-ratio: 329 / 640; width: auto;
}
/* Los tres fotogramas, apilados; solo se ve el encendido (cambio seco: es un parpadeo). */
.cover-larry img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; visibility: hidden; }
.cover-larry img.on { visibility: visible; }
.start-mode.tutorial .start-tutorial-title { font-size: clamp(22px, min(3vw, 4.4vh), 38px); }
.start-mode.tutorial .start-tutorial-desc { font-size: clamp(14px, min(1.55vw, 2.4vh), 20px); }
.start-mode.quick .start-tutorial-coach.quick-icon { display: flex; align-items: center; justify-content: center; }
.start-mode.quick .quick-icon > img { width: 70%; height: auto; }
.start-mode.pvp .start-tutorial-coach.quick-icon { display: flex; align-items: center; justify-content: center; }
.start-mode.pvp .quick-icon img { width: 70%; height: auto; }
/* CHOOSE OPPONENT (CpuFoePicker): the CPU's face as the card's icon. RANDOM fans the three faces out. */
.start-mode.foe .foe-avatar img { border-radius: 18%; }
.foe-trio { position: relative; display: block; width: 100%; aspect-ratio: 1; }
.foe-trio img { position: absolute; top: 18%; width: 64% !important; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45); }
.foe-trio img:nth-child(1) { left: 0; transform: rotate(-12deg); }
.foe-trio img:nth-child(3) { right: 0; transform: rotate(12deg); }
.foe-trio img:nth-child(2) { left: 18%; top: 4%; z-index: 1; }
/* DIFFICULTY (2026-10-30): five pips where the description used to be, lit up to the foe's level. */
.foe-difficulty { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.foe-difficulty-label { font-family: 'Lilita One', sans-serif; font-size: clamp(12px, min(1.3vw, 2vh), 16px); letter-spacing: 0.06em; color: #c9d6ef; }
.foe-difficulty-pips { display: inline-flex; gap: 5px; }
.foe-difficulty-pips i { width: clamp(12px, min(1.4vw, 2.1vh), 18px); aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22); }
.foe-difficulty-pips i.on { background: radial-gradient(circle at 35% 30%, #ffe9a3, #f5b82e 55%, #c97b0c); box-shadow: 0 0 6px rgba(245, 184, 46, 0.6), inset 0 0 0 1px rgba(120, 60, 0, 0.5); }
/* QUICK DUEL before the tutorial has paid the Starter Deck out: still READABLE — the mode
   has to be visible to be a goal — but plainly out of reach. The gold is drained out of
   the frame and the swords, the lift on hover is cancelled, and the chevron is a padlock
   with the reason where the description goes. */
.start-mode.is-locked {
  cursor: not-allowed;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.13), rgba(148, 163, 184, 0.04));
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
@media (hover: hover) and (pointer: fine) { .start-mode.is-locked:hover { transform: none; border-color: rgba(148, 163, 184, 0.32); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04); } }
.start-mode.is-locked .start-tutorial-coach { filter: grayscale(1) brightness(0.72); opacity: 0.7; }
.start-mode.is-locked .start-tutorial-title { color: #b6c0d6; }
.start-mode.is-locked .start-tutorial-desc { color: #98a3bd; }
.start-mode.is-locked .start-tutorial-go { color: #b6c0d6; opacity: 0.85; }

/* Sub-view header (Back + title) */
.start-sub-head { width: 100%; max-width: var(--duel-col, 640px); margin: 0 auto 4px; display: flex; align-items: center; gap: 14px; }
/* ICONO, no la palabra: el boton de volver es la flecha en TODA la app (constructor,
   coleccion, tienda), y estas dos pantallas — el lobby del tutorial y el de duelo rapido —
   eran las ultimas que ponian "BACK" con una flechita de texto. Mismas medidas que
   `.db-back` para que sea el mismo boton y no uno parecido; lo unico propio es la
   superficie, mas oscura, porque aqui va sobre el arte del lobby. */
.start-back {
  flex: none; pointer-events: auto; cursor: pointer;
  width: 40px; height: 40px; border-radius: 11px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 22, 0.6); border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform .12s var(--ease-out), border-color .15s, background .15s;
}
.start-back img { width: 24px; height: 24px; object-fit: contain; }
@media (hover: hover) and (pointer: fine) { .start-back:hover { border-color: rgba(255, 255, 255, 0.34); background: rgba(14, 20, 34, 0.8); } }
.start-back:active { transform: scale(0.94); }
.title.sub { font-size: clamp(24px, 4.5vw, 44px); margin: 0; flex: 1 1 auto; text-align: left; }

/* Quick-duel deck list (outside .start-section → constrain like the modes) */
.start-screen > .start-deck-list { width: 100%; max-width: var(--duel-col, 640px);
  margin: clamp(10px, 1.4vw, 20px) auto 0; gap: clamp(10px, 1vw, 16px); }
/* QUICK DUEL: your decks in a 2-column grid (MAX_DECKS = 5 → 3 rows), each with its box on the left */
.start-screen > .start-deck-list.qd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: min(100%, 1440px); }
.start-screen > .qd-empty { width: 100%; max-width: var(--duel-col, 640px); margin: clamp(10px, 1.4vw, 20px) auto 0; }
.start-deck-box { flex: 0 0 auto; align-self: stretch; width: clamp(54px, 5.6vw, 88px); min-height: clamp(70px, 7.4vw, 116px);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45)); pointer-events: none; }
/* half-width tiles, but big enough to read the cards and the box (the grid has the room:
   5 decks max → 3 rows); the warning wraps */
.start-screen .qd-grid .start-deck { gap: clamp(10px, 1vw, 18px); padding: clamp(12px, 1.2vw, 20px) clamp(14px, 1.3vw, 22px); }
.start-screen .qd-grid .start-deck-box { width: clamp(64px, 6.6vw, 132px); min-height: clamp(84px, 8.8vw, 176px); }
.start-screen .qd-grid .start-deck-feat-card { width: clamp(48px, 5.4vw, 108px); }
.start-screen .qd-grid .start-deck-name { font-size: clamp(17px, 1.8vw, 28px); }
.start-screen .qd-grid .start-deck-meta { font-size: clamp(13px, 1.2vw, 19px); }
@media (min-width: 721px) { .start-screen .qd-grid .start-deck-meta { white-space: nowrap; } }
@media (max-width: 720px) {   /* one column on a phone: the row has no room to grow */
  .start-screen .qd-grid .start-deck-box { width: 56px; min-height: 76px; }
  .start-screen .qd-grid .start-deck-feat-card { width: 42px; }
}
.start-screen .qd-grid .start-deck-go { font-size: clamp(15px, 1.5vw, 22px); }
.start-screen .qd-grid .start-deck-main { min-width: 96px; }
.start-screen .qd-grid .start-deck-warn { white-space: normal; max-width: 7.5em; }
@media (max-width: 720px) { .start-screen > .start-deck-list.qd-grid { grid-template-columns: minmax(0, 1fr); } }
.start-deck.starter { border-color: rgba(245, 193, 74, 0.6); background: linear-gradient(135deg, rgba(245, 193, 74, 0.1), rgba(245, 193, 74, 0.03)); }
@media (hover: hover) and (pointer: fine) { .start-deck.starter:hover { border-color: var(--gold-bright, #fde68a); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 18px rgba(245, 193, 74, 0.25); } }


/* La tarjeta de mazo del quick duel crece con el resto del tab. Va acotada a `.start-screen`
   porque `.start-deck` se usa también fuera de aquí. */
.start-screen .start-deck { padding: clamp(13px, 1.2vw, 20px) clamp(16px, 1.5vw, 26px); gap: clamp(12px, 1.2vw, 20px); border-radius: clamp(14px, 1.2vw, 18px); }
.start-screen .start-deck-feat { gap: clamp(6px, 0.6vw, 10px); }
.start-screen .start-deck-feat-card { width: clamp(46px, 5.4vw, 82px); }
.start-screen .start-deck-name { font-size: clamp(16px, 1.7vw, 22px); }
.start-screen .start-deck-meta { font-size: clamp(12px, 1.2vw, 16px); }
.start-screen .start-deck-emojis { font-size: clamp(18px, 1.8vw, 24px); }
.start-screen .start-deck-go { font-size: clamp(13px, 1.3vw, 17px); }
.start-screen .start-deck-warn { font-size: clamp(11px, 1.1vw, 15px); }

/* Tutorial part (lesson) picker */
.tut-part-list { width: 100%; max-width: var(--duel-col, 640px); display: flex; flex-direction: column;
  gap: clamp(12px, 1.1vw, 18px); margin: clamp(12px, 1.4vw, 20px) auto 0; }
.tut-part-card {
  display: flex; align-items: center; gap: clamp(16px, 1.4vw, 24px); width: 100%;
  padding: clamp(14px, 1.2vw, 20px) clamp(18px, 1.5vw, 26px); cursor: pointer; text-align: left;
  background: linear-gradient(135deg, rgba(245, 193, 74, 0.1), rgba(245, 193, 74, 0.03));
  border: 1px solid rgba(245, 193, 74, 0.38); border-radius: clamp(14px, 1.2vw, 18px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); transition: transform .15s, border-color .15s, box-shadow .15s;
}
@media (hover: hover) and (pointer: fine) { .tut-part-card:hover { transform: translateY(-2px); border-color: var(--gold-bright, #fde68a); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42), 0 0 20px rgba(245, 193, 74, 0.26); } }
.tut-part-card.full { border-color: rgba(245, 193, 74, 0.66); background: linear-gradient(135deg, rgba(245, 193, 74, 0.18), rgba(245, 193, 74, 0.05)); }
.tut-part-tag {
  flex: none; min-width: clamp(46px, 4.2vw, 62px); height: clamp(46px, 4.2vw, 62px);
  display: flex; align-items: center; justify-content: center;
  border-radius: clamp(12px, 1vw, 16px); background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(245, 193, 74, 0.4);
  color: var(--gold-bright, #fde68a); font: 400 clamp(16px, 1.5vw, 21px)/1 var(--font-display, "Bowlby One", sans-serif);
  letter-spacing: 0.02em;
}
.tut-part-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tut-part-title { font: 400 clamp(17px, 2.3vw, 27px)/1.1 var(--font-display, "Bowlby One", sans-serif); color: #eef2ff; letter-spacing: 0.01em; }
.tut-part-desc { font: 500 clamp(13px, 1.35vw, 17px)/1.35 var(--font-body, "Space Grotesk", system-ui, sans-serif); color: #aeb8d4; }
.tut-part-go { flex: none; font-size: clamp(17px, 2.1vw, 27px); color: var(--gold-bright, #fde68a); opacity: 0.85; }
/* The reward is NOT itemised in the lobby: each part only shows a CHEST — closed while
   there is still something to earn, open (and the card tinted green) once it is paid. */
.tut-part-side { flex: none; display: flex; align-items: center; gap: 10px; }
.tut-part-chest { width: clamp(46px, 4.2vw, 62px); height: clamp(46px, 4.2vw, 62px); object-fit: contain; display: block; filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.5)); }
.tut-part-card.is-claimed { border-color: rgba(70, 196, 106, 0.42); background: linear-gradient(135deg, rgba(70, 196, 106, 0.1), rgba(70, 196, 106, 0.03)); }
.tut-part-card.is-claimed .tut-part-chest { filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 10px rgba(245, 193, 74, 0.45)); }

/* ===== LA FICHA DEL COFRE (TutorialChestTip) =====
   Lo que paga la leccion, al pasar por encima de su cofre. Es GRANDE a proposito: enseña
   las cartas dibujadas, no una lista — el cofre tiene que dar ganas de entrar.
   `fixed` porque la coloca JS midiendo el cofre (a la derecha si cabe, si no a la
   izquierda), e INERTE al puntero: es un cartel, y si robara el hover se apagaria sola al
   pasar por encima. El contorno y el relieve se los da la lista de paneles del bloque
   "premium cartoon" de mas abajo, como al resto de fichas del juego. */
.tut-tip {
  /* El ancho de una carta de la ficha. Lo comparten las cartas y el sobre (que se ajusta por
     ALTURA, porque su dibujo no es 11:16), asi que la estanteria queda a una sola altura. */
  --tut-tip-cw: clamp(62px, 5.6vw, 82px);
  position: fixed;
  z-index: 260;
  pointer-events: none;
  width: clamp(292px, 26vw, 400px);
  padding: clamp(12px, 1.3vw, 18px);
  background: linear-gradient(180deg, rgba(20, 28, 48, 0.985), rgba(11, 15, 26, 0.985));
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62);
  display: flex; flex-direction: column; gap: clamp(9px, 1vw, 13px);
  animation: tutTipIn 140ms ease-out both;
}
@keyframes tutTipIn { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
.tut-tip-head { display: flex; align-items: center; gap: 10px; }
.tut-tip-head img { width: clamp(30px, 2.6vw, 40px); height: auto; display: block; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.tut-tip-head span {
  font: 400 clamp(15px, 1.5vw, 20px)/1 var(--font-display, "Bowlby One", sans-serif);
  color: var(--gold-bright, #fde68a); letter-spacing: 0.03em;
}
/* Oro / experiencia / sobres: una fila de chapas, la misma lectura que los premios de nivel. */
.tut-tip-loot { display: flex; flex-wrap: wrap; gap: 8px; }
.tut-tip-loot-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px 6px 7px; border-radius: 12px;
  background: rgba(245, 193, 74, 0.1);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.tut-tip-loot-item img { width: clamp(22px, 1.9vw, 28px); height: clamp(22px, 1.9vw, 28px); object-fit: contain; display: block; }
.tut-tip-loot-item b { font: 400 clamp(15px, 1.4vw, 19px)/1 var(--font-display, "Bowlby One", sans-serif); color: var(--gold-bright, #fde68a); }
.tut-tip-loot-item i {
  font: 700 clamp(10px, 0.85vw, 12px)/1 var(--font-ui, system-ui, sans-serif);
  font-style: normal; letter-spacing: 0.1em; color: #c3cde6;
}
/* LA PUERTA QUE ABRE EL COFRE (hoy solo el ultimo: QUICK DUEL). Franja entera y dorada, no
   una chapa mas: es lo mas gordo que paga el tutorial y tiene que leerse antes que el resto. */
.tut-tip-unlock {
  display: flex; align-items: center; gap: clamp(9px, 0.9vw, 13px);
  padding: clamp(7px, 0.7vw, 10px) clamp(10px, 1vw, 14px);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 193, 74, 0.2), rgba(245, 193, 74, 0.06));
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.14), inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.tut-tip-unlock img {
  width: clamp(34px, 3vw, 46px); height: auto; display: block; flex: none;
  filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5));
}
.tut-tip-unlock span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tut-tip-unlock i {
  font: 700 clamp(9px, 0.78vw, 11px)/1 var(--font-ui, system-ui, sans-serif);
  font-style: normal; letter-spacing: 0.14em; color: #c3cde6;
}
.tut-tip-unlock b {
  font: 400 clamp(14px, 1.35vw, 19px)/1.05 var(--font-display, "Bowlby One", sans-serif);
  color: var(--gold-bright, #fde68a); letter-spacing: 0.02em;
}
.tut-tip-sub {
  font: 700 clamp(10px, 0.86vw, 12px)/1 var(--font-ui, system-ui, sans-serif);
  letter-spacing: 0.12em; text-transform: uppercase; color: #8e9ab8;
}
.tut-tip-cards { display: flex; flex-wrap: wrap; gap: clamp(6px, 0.7vw, 10px); justify-content: flex-start; }
.tut-tip-card { position: relative; display: block; line-height: 0; }
.tut-tip-card .card { width: var(--tut-tip-cw); cursor: default; }
/* ONE card paid in a finish (a SPECIAL mission's FOIL, e.g. Chinese Spy): it IS the prize, shown big and centred. */
.tut-tip.is-solo-card { --tut-tip-cw: clamp(150px, 13vw, 190px); }
.tut-tip.is-solo-card .tut-tip-cards { justify-content: center; }
/* El sobre: misma ALTURA que una carta (su arte es 448x600, no 11:16, asi que cuadrarlo por
   ancho lo dejaria mas bajo que las cartas y la fila se veria descolgada). */
.tut-tip-card.is-pack img {
  height: calc(var(--tut-tip-cw) * 16 / 11);
  width: auto; display: block;
  filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5));
}
/* Cuantas copias caen de cada carta. Va sobre la esquina, como el multiplicador de sobres. */
.tut-tip-copies {
  position: absolute; right: -4px; bottom: -5px;
  min-width: 22px; padding: 1px 5px; border-radius: 9px;
  font: 400 clamp(11px, 1vw, 14px)/1.45 var(--font-display, "Bowlby One", sans-serif);
  text-align: center; color: #1a1206; background: var(--gold, #f5c14a);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
/* OBJETOS dentro del cofre (el del dia 30 del DAILY LOG IN): la ficha crece y los pinta en
   una rejilla 2x2 de fichas grandes — el dibujo de la carta del efecto y su nombre debajo,
   con el mismo contorno de tinta y relieve que las chapas de oro de arriba. */
/* 4 columnas: con 7 objetos son 2 filas y la ficha cabe en alto; nunca pasa del alto de la ventana. */
.tut-tip.has-items { width: min(calc(100vw - 20px), clamp(560px, 50vw, 780px)); max-height: calc(100vh - 20px); overflow: hidden; gap: clamp(11px, 1.1vw, 15px); }
.tut-tip.has-items .tut-tip-head img { width: clamp(40px, 3.4vw, 54px); }
.tut-tip.has-items .tut-tip-head span { font-size: clamp(19px, 1.9vw, 26px); }
.tut-tip-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 0.9vw, 12px); }
@media (max-width: 620px) { .tut-tip-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tut-tip-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: clamp(8px, 0.8vw, 11px); border-radius: 16px;
  background: rgba(245, 193, 74, 0.08);
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.tut-tip-item-art {
  display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 11px;
  border: 2px solid var(--gv-ink, #070f1d); background: #0b1220;
}
.tut-tip-item-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; display: block; }
/* La pegatina entera (contain, no recortada) con su frase debajo, en las letras del megáfono. */
.tut-tip-item-art.is-voice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%;
  padding: 6% 5%;
  background: radial-gradient(circle at 50% 40%, #2b3350 0%, #121828 75%);
}
.tut-tip-item-art.is-voice img { width: auto; height: 68%; max-width: 80%; min-height: 0; flex: none; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
.tut-tip-item-art.is-voice .voice-art-text { font-size: clamp(12px, 1.15vw, 17px); flex: none; white-space: nowrap; }
.tut-tip-item b {
  font: 400 clamp(15px, 1.4vw, 19px)/1 var(--font-display, "Bowlby One", sans-serif);
  color: var(--gold-bright, #fde68a); letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  text-align: center;
}
.tut-tip-note {
  font: 500 clamp(11px, 0.95vw, 13px)/1.35 var(--font-body, "Space Grotesk", system-ui, sans-serif);
  color: #8e9ab8;
}
.tut-tip-foot {
  font: 500 clamp(11px, 0.95vw, 13px)/1.3 var(--font-body, "Space Grotesk", system-ui, sans-serif);
  color: #6fd48c;
}

/* ===== LECCION BLOQUEADA =====
   Solo THE BASICS empieza abierta; cada leccion destapa la siguiente al cobrar su cofre
   (ver tutorialPartUnlocked). Se sigue LEYENDO entera — es el proximo objetivo, tiene que
   apetecer — pero sin oro, sin el salto del hover y con un candado donde va la flecha. */
.tut-part-card.is-locked {
  cursor: not-allowed;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.04));
  border-color: rgba(148, 163, 184, 0.34);
}
@media (hover: hover) and (pointer: fine) { .tut-part-card.is-locked:hover { transform: none; border-color: rgba(148, 163, 184, 0.34); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36); } }
.tut-part-card.is-locked .tut-part-title { color: #b6c0d6; }
.tut-part-card.is-locked .tut-part-desc { color: #93a0bd; }
.tut-part-card.is-locked .tut-part-chest { filter: grayscale(1) brightness(0.78) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.tut-part-card.is-locked .tut-part-go { color: #b6c0d6; opacity: 0.9; }
.tut-part-lock {
  font: 700 clamp(10px, 0.9vw, 12.5px)/1.3 var(--font-ui, system-ui, sans-serif);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold, #f5c14a); opacity: 0.85;
}

/* ===================================================================
   Hero HP bar (field cards) — green fill + orange "ghost damage" trail
   =================================================================== */
.hp-bar {
  border-radius: 999px; overflow: hidden;
  background: #1a0a0a; border: 4px solid rgba(0, 0, 0, 0.62);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.55), 0 2px 5px rgba(0, 0, 0, 0.4);
}
.hp-bar-track { position: absolute; inset: 0; background: linear-gradient(180deg, #4a1818, #280b0b); }
/* Orange "ghost" of recent damage — drains down to the fill after a short delay. */
.hp-bar-ghost {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit;
  background: linear-gradient(180deg, #ffc061, #ff7a18);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Green current-HP fill — snaps (near-instant) to the new value on damage. */
.hp-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit;
  background: linear-gradient(180deg, #8dffab, #25c94a);
  box-shadow: inset 0 3px 4px rgba(255, 255, 255, 0.4), inset 0 -3px 5px rgba(0, 0, 0, 0.25);
  transition: width 0.12s linear;
}

/* ============================================================
   AUTH / LOGIN GATE  (Supabase session — supersedes the wallet login)
   ============================================================ */
/* ---- LA PANTALLA DE CARGA: logo, barra y «Loading» ----
   Las tres piezas comparten ANCHO (`--boot-w`) y van en columna: el logo manda el tamano y
   la barra se le iguala, que es lo que hace que se lean como una sola pieza y no como tres
   cosas centradas por separado. */
.boot-splash {
  --boot-w: min(78vw, 400px);
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  background: var(--bg-0);
}
.boot-logo {
  display: block; width: var(--boot-w); height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
}

/* LA BARRA. El carril es una pieza del kit (contorno de tinta y hundido por dentro), y el
   relleno es azul con rayas que corren. */
.boot-bar {
  /* Mas gruesa de lo que pedia el ojo al escribirla: el carril se lleva 3 px de contorno POR
     LADO, asi que a 14 px de alto el relleno se quedaba en 8 y las rayas no se leian. */
  width: var(--boot-w); height: clamp(20px, 2.4vh, 28px);
  border: var(--gv-bw) solid var(--gv-ink); border-radius: 999px;
  background: rgba(4, 9, 20, 0.75);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), 0 4px 12px -6px rgba(0, 0, 0, 0.8);
  overflow: hidden;   /* las rayas del relleno se cortan en la curva del carril */
}
.boot-bar-fill {
  display: block; height: 100%; border-radius: 999px;
  background:
    /* LAS RAYAS, encima del azul. Van a 45deg y se repiten cada 22px; lo que se anima es la
       POSICION de esta capa, asi que corren dentro del relleno sin mover el relleno. */
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, 0.22) 0 11px,
      rgba(255, 255, 255, 0) 11px 22px),
    linear-gradient(180deg, #5aa2ff 0%, #2f7ae5 55%, #1b56b8 100%);
  background-size: 31.11px 31.11px, 100% 100%;   /* 22 / sen45 = el periodo medido en X */
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.25);
  animation: bootFill 8s cubic-bezier(0.2, 0.9, 0.25, 1) forwards, bootStripes 0.8s linear infinite;
}
/* AVANZA PERO NO LLEGA... HASTA QUE LA CARGA ACABA. No hay progreso real que medir —la carga
   es una peticion, no una descarga por trozos—, asi que la barra corre deprisa al principio y
   se va frenando hasta quedarse cerca del final. Plantarse en el 100% con la pantalla todavia
   puesta es peor que no tener barra: dice que ya esta y no lo esta. El tramo final hasta el
   100% lo pone `BootSplash` (game.js) con una animacion de script cuando la carga TERMINA. */
@keyframes bootFill { from { width: 6%; } to { width: 93%; } }
/* Un PERIODO exacto del patron (31,11px en X), asi el bucle no tiene costura. */
@keyframes bootStripes { from { background-position: 0 0, 0 0; } to { background-position: 31.11px 0, 0 0; } }

/* «Loading», ahora pequeno y debajo. Mantiene el degradado dorado del titular original. */
.boot-line { display: inline-flex; align-items: center; gap: 8px; }
.boot-title {
  font-family: var(--font-display); font-size: clamp(15px, 1.6vw, 22px);
  line-height: 1.05; letter-spacing: 0.08em; text-transform: uppercase;
  background: linear-gradient(180deg, #fde68a 0%, #f5c14a 45%, #b8861a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}
/* LOS PUNTOS: elementos redondos, no caracteres. Laten por turnos con 0,16 s de retraso entre
   ellos — el mismo gesto que los tres puntos de siempre, pero sin depender de que la fuente
   tenga el punto redondo (no lo tiene). */
.boot-dots { display: inline-flex; align-items: center; gap: 5px; }
.boot-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold);
  opacity: 0.25; animation: bootDot 1.2s ease-in-out infinite;
}
.boot-dots i:nth-child(2) { animation-delay: 0.16s; }
.boot-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes bootDot {
  0%, 70%, 100% { opacity: 0.25; transform: scale(0.8); }
  35%           { opacity: 1;    transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .boot-bar-fill { animation: none; width: 60%; }
  .boot-dots i { animation: none; opacity: 0.7; }
}
/* LA COLUMNA TIENE QUE CABER SIEMPRE. Al subir todo de talla el login mide ~720 px de alto, y
   `html, body` van con `overflow: hidden` (el juego es una app de ventana fija): en un portatil
   de 720p o en un movil apaisado la columna se salia y NO habia forma de desplazarla — el
   boton de entrar quedaba fuera de la pantalla.
   Dos cosas lo arreglan, y hacen falta las dos:
     · `height` + `overflow-y: auto` — esta pantalla, y solo esta, es una caja que desplaza;
     · `safe center` — con un `center` normal, un contenido mas alto que su caja desborda por
       ARRIBA tanto como por abajo, y esa mitad de arriba no se puede alcanzar desplazando
       (es el fallo clasico del centrado). Con `safe`, en cuanto no cabe el centrado cede y
       se alinea al principio, que es justo lo que deja llegar a todo.
   El fondo no se mueve al desplazar porque va en un `::before` `fixed`. */
.login-screen {
  position: relative; height: 100dvh; overflow-y: auto;
  display: grid; place-items: safe center; padding: 24px 24px 32px;
}
/* EL FONDO DE LA PRIMERA PANTALLA: el bosque, con el MISMO velo que el HOME (ver
   `.home2::before`) — la puerta y lo que hay detrás de ella tienen que ser el mismo sitio.
   `fixed` y no `absolute` por lo mismo que allí: el dibujo cubre la ventana entera aunque la
   tarjeta sea pequeña y esté centrada. El velo no es decoración: sobre un dibujo tan luminoso
   el texto claro de la tarjeta no se leería. */
.login-screen::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 12, 26, 0.58), rgba(6, 12, 26, 0.76)),
    url('../UI/home_bg.jpg') center / cover no-repeat;
}
/* SIN CAJA. El panel oscuro con su borde y su sombra desaparece: lo que queda es una columna
   de piezas FLOTANDO sobre el bosque. El <div> sigue estando porque es quien pone el ancho y
   el centrado — lo que se ha ido es su superficie, no el elemento.
   Lo que hacia legible el texto era ese panel, asi que cada pieza tiene que apanarselas sola:
   los campos y los botones ya traen fondo propio, y el texto suelto (el subtitulo, las
   etiquetas, el pie) lleva ahora contorno de tinta — ver `--login-ink` mas abajo. */
.login-card {
  /* 100% del hueco y no 94vw: `.login-screen` ya pone 24px de padding a cada lado, asi que
     en un movil 94vw era MAS ancho que el hueco y los botones se salian por la derecha. */
  position: relative; z-index: 1; width: min(100%, 460px);
  background: none; border: 0; border-radius: 0; padding: 0;
  box-shadow: none;
  /* El contorno del texto suelto, escrito UNA vez: cuatro sombras de desenfoque cero (la
     union de las cuatro es el borde) mas una difusa que lo asienta. Es la misma receta que
     el nombre de los banners de la tienda, que tiene el mismo problema: texto claro sobre un
     dibujo que no se controla. */
  --login-ink:
    1px 0 0 rgba(4, 9, 20, .85), -1px 0 0 rgba(4, 9, 20, .85),
    0 1px 0 rgba(4, 9, 20, .85), 0 -1px 0 rgba(4, 9, 20, .85),
    0 3px 10px rgba(3, 7, 15, .8);
}
.login-title {
  font-family: var(--font-display); font-size: clamp(26px, 5vw, 34px);
  text-align: center; color: var(--gold-bright); margin: 0 0 2px; letter-spacing: .02em;
}
/* EL LOGO. Ocupa el ancho de la tarjeta menos un respiro y su alto sale del dibujo, así que
   no hay ninguna proporción escrita aquí que pueda quedarse desfasada si cambia el fichero.
   El `drop-shadow` lo despega del bosque: el logo tiene contorno oscuro propio, pero sobre
   las zonas claras del dibujo (la cascada, el cielo) su borde se disolvía. */
.login-logo {
  display: block; width: min(100%, 380px); height: auto; margin: 0 auto 22px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
}
/* De aqui abajo TODO sube una talla: sin el panel que lo enmarcara, la columna se leia
   pequena en medio de la pantalla. */
.login-sub {
  text-align: center; color: #d9e6fb; font-family: var(--font-ui); font-size: 16px;
  margin: 0 0 8px; text-shadow: var(--login-ink);
}
/* La linea bajo el subtitulo del login ("First time? Any of these creates your account").
   Ocupa el sitio que dejo el pie de "crear cuenta" cuando el correo se retiro del login. */
.login-note {
  margin: 0 0 20px; text-align: center;
  font-family: var(--font-ui); font-size: 15px; font-weight: 600; line-height: 1.45;
  color: var(--gold-bright); text-shadow: var(--login-ink);
}
.login-field { display: block; margin-top: 14px; }
.login-field > span {
  display: block; font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  color: #cfe0f7; margin-bottom: 6px; text-shadow: var(--login-ink);
}
/* La entrada se oscurece y engorda su borde: sin panel detras, un campo translucido dejaba
   ver el bosque por dentro y el texto escrito competia con las ramas. */
.login-input {
  width: 100%; padding: 14px 15px; border-radius: 13px; border: 2px solid var(--border-strong);
  background: rgba(4, 9, 20, .72); color: var(--text); font-size: 17px; font-family: var(--font-ui);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.login-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,193,74,.18); }
/* Campo en ROJO mientras las dos contrasenas no coinciden. El color lo lleva el BORDE y no el
   fondo: el fondo oscuro es lo que hace legible lo que se escribe, y tenirlo de rojo lo
   estropea justo cuando el jugador esta mirando ahi. */
.login-input.is-bad { border-color: rgba(239, 68, 68, .75); }
.login-input.is-bad:focus { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.login-input::placeholder { color: rgba(203, 219, 240, .45); }
/* El aviso del campo: pegado a el (no al pie de la columna, donde estan los errores del
   servidor) porque habla de lo que se acaba de teclear dos lineas mas arriba. */
.login-hint {
  display: block; margin-top: 6px; font-family: var(--font-ui); font-size: 13px; font-weight: 700;
  color: #fca5a5; text-shadow: var(--login-ink);
}
/* El hueco del captcha. Con `appearance: interaction-only` el widget NO se dibuja salvo que
   haya que retar al visitante, asi que EN REPOSO esta caja no puede ocupar nada: tal y como
   estaba dejaba 66 px de hueco y un margen bajo la contrasena esperando algo que casi nunca
   llega. `is-shown` (lo enciende `before-interactive-callback`) le devuelve su sitio cuando
   el reto aparece de verdad.
   Y no se centra un ancho fijo: el widget es `size: flexible`, o sea que toma el ancho de su
   caja y queda a ras de los campos del formulario. */
.login-captcha { margin-top: 0; }
.login-captcha > div { min-height: 0; }
.login-captcha.is-shown { margin-top: 14px; }
/* Las esquinas: el widget vive en un iframe de Cloudflare y su interior no se puede tocar,
   pero SU CAJA si — redondearla al mismo radio que los campos (13px) y recortar lo que
   sobresalga es lo unico que hace falta para que no se lea como una pegatina cuadrada
   pegada sobre un formulario redondeado. El alto lo sigue mandando el iframe (`min-height`
   es un suelo, no un tope), asi que un reto que crezca no se corta. */
.login-captcha.is-shown > div { min-height: 66px; border-radius: 13px; overflow: hidden; }
/* (Aqui vivia `.link-provider-btn`, que metia la marca del proveedor DENTRO del boton de
   enlazar. Se fue cuando la fila paso a llevar su icono delante: el logo salia dos veces en
   la misma linea. La marca identifica la fila; el boton solo dice la accion.) */
/* El AVISO de una fila de ajustes: es una descripcion mas, pero en ambar y con su simbolo,
   porque lo que dice es «esto no hace lo que parece». Sin el color se lee como parte de la
   explicacion y es justo lo que no puede pasar. */
.setting-warn { color: var(--gold-bright); font-weight: 700; }
.setting-warn::before { content: '⚠ '; }
/* El boton principal crece, y con el su `--gb-h`: el grosor del marco 9-slice del kit sale
   de esa variable, asi que si el boton sube de talla y ella no, el contorno queda fino. */
.login-btn { width: 100%; margin-top: 20px; min-height: 52px; font-size: 15px; --gb-h: 52px; }
.login-alt {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 6px;
  color: #b9cbe6; font-size: 14px; font-family: var(--font-ui); text-transform: uppercase; letter-spacing: .08em;
  text-shadow: var(--login-ink);
}
/* Las dos rayas, mas claras: sobre el bosque, `--border-soft` no existia. */
.login-alt::before, .login-alt::after {
  content: ''; flex: 1; height: 2px; border-radius: 2px;
  background: rgba(210, 228, 255, .28);
}
.login-oauth {
  width: 100%; margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 15px; border-radius: 14px; border: 2px solid var(--border-strong);
  background: rgba(23, 34, 57, .88); color: var(--text); font-family: var(--font-ui); font-weight: 700; font-size: 16px;
  cursor: pointer; transition: background .15s, border-color .15s;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .38);
}
@media (hover: hover) and (pointer: fine) { .login-oauth:hover { background: rgba(35, 50, 82, .92); border-color: var(--gold); } }
/* La marca del proveedor, delante del rótulo. El hueco lo pone el `gap` del botón, que ya
   estaba puesto para esto. `flex: 0 0 auto` porque en un botón estrecho el <img> es lo que
   cede: sin ello el dibujo se estruja a una raya en vez de encogerse el texto. */
.login-oauth-ico { flex: 0 0 auto; width: 22px; height: 22px; object-fit: contain; }

/* PANTALLAS BAJAS (un portatil de 720p, un movil apaisado): la columna baja una talla para
   que quepa sin desplazar. No se toca el ANCHO, que ahi no es el problema — lo que sobra es
   alto, asi que se recortan el logo y los huecos, que es de donde sale sin tocar el tamano
   de letra de nada de lo que hay que leer o pulsar. */
@media (max-height: 820px) {
  .login-logo { width: min(100%, 300px); margin-bottom: 14px; }
  .login-sub { font-size: 15px; margin-bottom: 14px; }
  .login-oauth { margin-top: 9px; padding: 12px; }
  .login-alt { margin: 14px 0 4px; }
  .login-field { margin-top: 10px; }
  .login-input { padding: 11px 14px; }
  .login-btn { margin-top: 14px; min-height: 46px; --gb-h: 46px; }
  .login-switch { margin-top: 14px; }
}
.login-switch {
  text-align: center; margin-top: 20px; font-family: var(--font-ui); font-size: 15px;
  color: #d0dff5; text-shadow: var(--login-ink);
}
.login-switch button {
  background: none; border: 0; color: var(--gold-bright); font-weight: 800; cursor: pointer;
  font-family: var(--font-ui); font-size: 15px; text-shadow: var(--login-ink);
}
/* Aviso legal al pie del login: pequeno y apagado, pero legible sobre el bosque. */
.login-legal {
  margin: 22px 0 0; text-align: center; font-family: var(--font-ui); font-size: 12px; line-height: 1.45;
  color: #b8c7de; text-shadow: var(--login-ink);
}
.login-legal a { color: var(--gold-bright); }
.login-msg { margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-family: var(--font-ui); font-size: 15px; text-align: center; }
.login-msg.err { background: rgba(239,68,68,.14); color: var(--ai-bright); border: 1px solid rgba(239,68,68,.3); }
.login-msg.ok { background: rgba(34,197,94,.14); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
/* Account row in the profile widget (replaces the old wallet-login block). */
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.account-email { font-family: var(--font-ui); font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-signout {
  flex: 0 0 auto; background: var(--surface-1); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 9px; padding: 6px 12px; font-family: var(--font-ui); font-weight: 700; font-size: 12px; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .account-signout:hover { background: var(--surface-2); } }

/* ============== MISSIONS ============== */
/* (.missions-screen reuses .shop-screen for layout/scroll/padding.) */
/* The screen is two tabs: DAILY MISSIONS and LEVEL REWARDS. Same segmented recipe as the
   collection's finish toggle (sunken track + gold active pill), sized up because this is a
   section switch, not a filter. The badge repeats the nav count PER TAB, so the red dot on
   the nav still tells you which half is waiting for you. */
.mission-tabs {
  display: inline-flex; gap: 3px; padding: 4px; margin: 4px 0 6px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-soft); border-radius: 14px;
}
.mission-tab {
  position: relative; appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: 0.07em;
  text-transform: uppercase; padding: 10px 20px; border-radius: 10px;
  color: var(--text-dim); background: transparent;
  transition: color .15s, background .15s, box-shadow .15s;
}
.mission-tab.on { color: #2a1c02; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
@media (hover: hover) and (pointer: fine) { .mission-tab:not(.on):hover { color: var(--text); } }
/* MISSIONS tabs carry an icon (icons/missions/*.png, all on the same 160px square canvas so
   they read the same size). Negative block margin: the icon is taller than the label and
   must not grow the pill. */
.missions-screen > .mission-tabs .mission-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.mission-tab-icon {
  flex: 0 0 auto; width: 36px; height: 36px; margin: -9px 0; object-fit: contain;
  pointer-events: none; user-select: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}
/* Section switch of a whole screen: a notch bigger than the shared control. Only where the
   five tabs fit in ONE row with the icon beside the label; narrower than that the icon goes
   ABOVE the label (five icon + label pairs side by side wrapped the labels / ran off screen). */
@media (min-width: 1281px) {
  .missions-screen > .mission-tabs .mission-tab { padding: 13px 24px; font-size: 14.5px; gap: 10px; white-space: nowrap; }
}
@media (max-width: 1280px) {
  .missions-screen > .mission-tabs .mission-tab { flex-direction: column; gap: 4px; }
  .mission-tab-icon { margin: 0; }
}
.mission-tab-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-family: var(--font-display); font-size: 11px; line-height: 1;
  border: 2px solid var(--bg-1); font-variant-numeric: tabular-nums;
}

/* Reset chip sits right NEXT TO the "DAILY MISSIONS" title (not pushed to the far edge). */
.missions-daily-head { display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin: 10px 0 20px; }
.missions-daily-title { margin: 0 !important; font-size: 14px !important; }
.missions-reset {
  font-family: var(--font-ui); font-weight: 700; font-size: 13px; letter-spacing: 0.05em;
  color: var(--text-dim); background: var(--surface-0); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 7px 15px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* 3 daily missions + the bonus form a 2x2 grid on PC; single column on mobile. */
.missions-list { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .missions-list { grid-template-columns: repeat(2, 1fr); } }
/* a SPECIAL mission (PROMO) runs the whole width above the 3 of the day + Daily Clear (still a 2x2 below) */
.missions-list > .mission-special { grid-column: 1 / -1; }

/* ============== DAILY LOG IN ==============
   A 30-day calendar (10 x 3 on PC) in the app's cartoon relief: every tile is a MISSIONS
   card (solid surface, ink outline, light band on top / shadow band at the bottom). Days
   still to claim sit RAISED on a hard drop shadow; claimed days are pressed IN — pushed
   down onto where their shadow was, bevel inverted, dimmed, stamped with a check. TODAY's
   tile is the raised one in gold. The art sits in a sunken well; gold and gems print their
   amount big under the icon, inside that same well. */
.login-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 12px; padding-bottom: 18px; align-items: start; }
/* A day = the square frame; its number and its CLAIM button live INSIDE it. */
.login-cell { min-width: 0; display: flex; flex-direction: column; align-items: center; container: login-cell / inline-size; }
@media (min-width: 520px) { .login-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 640px) { .login-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1100px) { .login-grid { grid-template-columns: repeat(10, 1fr); gap: 14px; } }
.login-day {
  --ld-drop: 6px;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* Extra bottom padding = half the bevel's dark bottom band: the art sits a touch above the
     box's centre (the full band read as too high, none as too low). */
  width: 100%; aspect-ratio: 1; padding: 9% 9% calc(9% + var(--gv-sh-h) / 2); min-width: 0; box-sizing: border-box;
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.92), rgba(12, 21, 39, 0.96));
  border: var(--gv-bw) solid var(--gv-ink); border-radius: 16px;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 var(--ld-drop) 0 rgba(3, 7, 15, 0.6);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), filter .18s ease;
}
/* The day number: pinned to the tile's top-left corner, over the art. */
.login-day-n {
  position: absolute; left: 8%; top: 10%; z-index: 1; line-height: 1;
  font-family: var(--font-display); font-size: clamp(12px, 14cqw, 22px); letter-spacing: 0.02em; color: #c3cde6;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  -webkit-text-stroke: 3px var(--gv-ink); paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}
/* The art box: NO frame of its own (the tile is the only frame). A size container, so the
   icon and the number scale with whatever room the tile gives it. */
.login-day-art {
  position: relative; width: 100%; flex: 1 1 0; min-height: 0;
  container-type: size;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqh;
}
.login-day-art img { width: 62cqw; height: 62cqh; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
/* Gold and gems stack: the coin / gem on top, its amount underneath. */
.login-day.is-coins .login-day-art, .login-day.is-gems .login-day-art { gap: 0; }
.login-day.is-coins .login-day-art img, .login-day.is-gems .login-day-art img { width: 58cqw; height: 54cqh; }
.login-day.is-pack .login-day-art img { width: 90cqw; height: 92cqh; }
/* The amount: big, heavy, ink-stroked — gold in gold, gems in the gems' blue. */
.login-day-num {
  font-family: var(--font-display); font-weight: 400; line-height: 1;
  font-size: min(34cqh, 30cqw); letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
  color: var(--gold-bright);
  -webkit-text-stroke: 1.5px var(--gv-ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(3, 7, 15, 0.75), 0 6px 7px rgba(0, 0, 0, 0.45);
}
/* Tucked up against the coin / gem: it overlaps the art's bottom edge a little, above it. */
.login-day.is-coins .login-day-num, .login-day.is-gems .login-day-num { position: relative; z-index: 1; margin-top: -8cqh; }
.login-day.is-gems .login-day-num { color: #c6e6ff; }
/* Rare days keep their colour on the outline so they read from across the grid. */
.login-day.is-gems { background: linear-gradient(180deg, rgba(38, 72, 122, 0.95), rgba(13, 26, 52, 0.97)); }
.login-day.is-chest { background: linear-gradient(180deg, rgba(92, 70, 28, 0.95), rgba(34, 24, 10, 0.97)); }
.login-day-art img.login-chest { width: 100cqw; height: 96cqh; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
/* CLAIMED: pressed in. Pushed down by the height of its drop, bevel inverted, dimmed. */
.login-day.is-claimed {
  transform: translateY(var(--ld-drop));
  background: linear-gradient(180deg, rgba(10, 17, 32, 0.96), rgba(16, 26, 46, 0.96));
  box-shadow:
    inset 0 6px 0 rgba(0, 0, 0, 0.45),
    inset 0 -2px 0 rgba(255, 255, 255, 0.06);
}
.login-cell.is-claimed .login-day-n { color: #6f7b98; text-shadow: none; }
/* The reward keeps its exact layout once claimed (same sizes, the amount stays): only dimmed. */
.login-day.is-claimed .login-day-art img { opacity: 0.35; filter: grayscale(0.5); }
.login-day.is-claimed .login-day-num { opacity: 0.4; filter: grayscale(0.5); }
.login-day-check {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: clamp(40px, 56cqmin, 76px); height: clamp(40px, 56cqmin, 76px);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}
/* The MISSIONS icon's tick: a fat green stroke with square tips and no outline, lit along its top. */
.login-day-check svg { display: block; width: 100%; height: 100%; overflow: visible; }
.login-day-check path { fill: none; stroke-linecap: butt; stroke-linejoin: miter; }
.login-day-check .ldc-fill { stroke: #22a24a; stroke-width: 20; }
.login-day-check .ldc-hi { stroke: #5fd57f; stroke-width: 5; }
/* TODAY: raised higher, outlined in gold ink, pulsing glow; the tile itself is the claim. */
.login-day.is-ready {
  --ld-drop: 8px;
  transform: translateY(-2px);
  border-color: var(--gv-ink-gold);
  background: linear-gradient(180deg, rgba(120, 90, 30, 0.95), rgba(46, 33, 12, 0.97));
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.3),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 var(--ld-drop) 0 rgba(3, 7, 15, 0.6),
    0 0 22px rgba(234, 184, 60, 0.35);
  cursor: pointer;
  animation: loginDayGlow 1.4s ease-in-out infinite;
}
@media (hover: hover) and (pointer: fine) { .login-day.is-ready:hover { transform: translateY(-4px); } }
.login-day.is-ready:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
.login-cell.is-ready .login-day-n, .login-cell.is-soon .login-day-n { color: var(--gold-bright); }
/* The pulse: brightness plus a gold halo that swells and fades (the drop shadow stays put). */
@keyframes loginDayGlow {
  0%, 100% {
    filter: brightness(1);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.3),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 var(--ld-drop) 0 rgba(3, 7, 15, 0.6),
      0 0 10px 0 rgba(234, 184, 60, 0.25);
  }
  50% {
    filter: brightness(1.22);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.45),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 var(--ld-drop) 0 rgba(3, 7, 15, 0.6),
      0 0 30px 6px rgba(255, 206, 84, 0.7);
  }
}
/* Small squares (mobile, short laptops), measured on the cell itself: a thinner number stroke. */
@container login-cell (max-width: 119px) {
  .login-day-n { -webkit-text-stroke-width: 2.5px; }
}
/* The next day while waiting: dashed gold outline + the countdown under the well. */
.login-day.is-soon { border-style: dashed; border-color: var(--gold-edge); }
.login-next { border-color: var(--gold-edge); }
.login-next b { color: var(--gold-bright); font-weight: 800; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .login-day.is-ready { animation: none; } .login-day { transition: none; } }
@media (min-width: 1100px) {
  .missions-screen.on-login { display: flex; flex-direction: column; padding-bottom: clamp(14px, 2.4vh, 30px); }
  .missions-screen.on-login .missions-daily-head { margin-bottom: clamp(10px, 1.6vh, 18px); }
  /* The grid takes EXACTLY the height left (basis 0), so it can be measured; JS (loginFit)
     picks the columns + square size and hands them over as --login-cols / --login-s. */
  .missions-screen.on-login .login-grid { flex: 1 1 0; min-height: 320px; }
  .login-grid.is-fit {
    grid-template-columns: repeat(var(--login-cols), var(--login-s));
    grid-auto-rows: auto; gap: 18px 12px;
    /* The grid keeps the page's own column: day 1 starts under the first tab and the last
       column ends under the wallet (it used to borrow the side margin for bigger squares, and
       the calendar hung out to the left of the tabs). space-between: when HEIGHT caps the
       squares the two edges still hold and the slack goes between the columns. */
    justify-content: space-between; align-content: center; padding-bottom: 14px;
  }
  .login-grid.is-fit .login-day { width: var(--login-s); }
}
/* Day 30: the CHEST. Gold-edged tile; hovering it lists the four impact effects it can drop. */
/* The rolled impact effect, revealed big in the centre: its card art + its name. */
.login-reveal-item { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-reveal-item img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: top; border-radius: 18px;
  border: 3px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
.login-reveal-item b { font-family: var(--font-display); font-size: 26px; color: var(--gold-bright); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.8); white-space: nowrap; }
.login-err { font-family: var(--font-ui); font-weight: 700; font-size: 12px; color: var(--danger); }
.mission-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 16px;
  padding: 15px 18px; transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.mission-card.is-done { border-color: var(--gold-edge); box-shadow: inset 0 0 0 1px rgba(234,184,60,0.20), 0 0 18px rgba(234,184,60,0.08); }
.mission-card.is-claimed { opacity: 0.6; }
.mission-body { flex: 1 1 auto; min-width: 0; }
.mission-name { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.01em; color: var(--text); margin-bottom: 3px; }
.mission-desc { font-family: var(--font-ui); font-weight: 600; font-size: 13px; color: var(--text-muted); margin-bottom: 11px; letter-spacing: 0.02em; }
.mission-progress { display: flex; align-items: center; }
/* Thicker bar; the percentage reads centered INSIDE it (over both filled and empty parts). */
.mission-bar { position: relative; flex: 1 1 auto; height: 22px; border-radius: 999px; background: rgba(0,0,0,0.34); overflow: hidden; border: 1px solid var(--border-soft); }
.mission-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width .4s var(--ease-out); }
.mission-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.02em; color: #fff;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,0.75); pointer-events: none;
}

/* Reward side: the CHEST is the reward icon. On claim it opens (FX.chestOpen) and every
   reward flies OUT of it to its own counter — no reward numbers are shown on the card. */
.mission-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 104px; }
.mission-chest-box { width: 66px; height: 66px; display: grid; place-items: center; }
.mission-chest.rf-chest { width: 66px; height: 66px; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.mission-claim { padding: 8px 16px; min-height: 36px; font-size: 12px; width: 100%; }
/* Claimed missions show a muted "CLAIMED" button instead of the CLAIM CTA. */
.mission-claim.is-claimed {
  opacity: 1; cursor: default;
  color: #7ff0a0; border-color: rgba(70,196,106,0.5); background: rgba(70,196,106,0.14); box-shadow: none;
}
.mission-bonus { border-style: dashed; }
.mission-bonus .mission-name { color: var(--gold-bright); }

/* Header reward counters. The wallet sits at top-right; during a claim the coin "+N" gain
   chip and the pack/card counters all appear to the LEFT of the wallet chip, vertically
   centred on it (one at a time, so they share the slot). Absolute → no layout shift. */
.mission-wallet-wrap { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.mission-coin-gain {
  position: absolute; right: calc(100% + 12px); top: 50%; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-family: var(--font-display); font-size: 17px; color: var(--gold-bright);
  font-variant-numeric: tabular-nums; opacity: 0; transform: translate(10px, -50%);
  transition: opacity .2s var(--ease-out), transform .2s var(--ease-out); pointer-events: none;
}
.mission-coin-gain img { width: 22px; height: 22px; }
.mission-coin-gain.on { opacity: 1; transform: translate(0, -50%); }
/* Same size & proportions as the coin counter: mirror .wallet-chip + .wallet-chip.big
   (padding/gap/font + icon at var(--icon-min)) so the three chips read as one family. */
.mission-count-chip {
  position: absolute; right: calc(100% + 12px); top: 50%; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 14px 7px 9px; border-radius: 999px;
  background: var(--surface-0); border: 1px solid var(--border-soft);
  font-family: var(--font-ui); font-weight: 700; font-size: 17px; color: var(--text);
  opacity: 0; transform: translate(12px, -50%) scale(0.9); pointer-events: none;
  transition: opacity .26s var(--ease-out), transform .26s var(--ease-out);
}
.mission-count-chip img { width: var(--icon-min); height: var(--icon-min); object-fit: contain; display: block; }
.mission-count-chip b { font-family: var(--font-display); font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.mission-count-chip.on { opacity: 1; transform: translate(0, -50%) scale(1); }
.mission-count-chip.pop { animation: missionChipPop .34s var(--ease-out); }
@keyframes missionChipPop {
  0% { transform: translate(0, -50%) scale(1); }
  40% { transform: translate(0, -50%) scale(1.14); }
  100% { transform: translate(0, -50%) scale(1); }
}

/* ============== LEVEL REWARDS ==============
   The battle-pass rail under the daily missions: one rung per account level (1..30),
   scrolled sideways, with a gold line running through the level pips that stops at the
   player's level. Rungs reuse the missions' surface language; the FOIL tag reuses the
   collection's foil gradient so the same finish reads the same everywhere. */
.lvr-head { flex-wrap: wrap; }
.lvr-level { color: var(--gold-bright); }
.lvr-hint {
  font-family: var(--font-ui); font-weight: 600; font-size: 12px; letter-spacing: 0.03em;
  color: var(--text-muted);
}
/* The LEVEL tab is ONE row on a full-height screen, so it floats in the leftover space
   instead of leaving a void under it. Column flex + `margin-block: auto` on the rail;
   the pill-shaped rows have to opt out of the stretch that flex would give them. */
.missions-screen.on-level { display: flex; flex-direction: column; }
.missions-screen.on-level .lvr-rail-wrap { margin-top: auto; margin-bottom: auto; flex: 0 0 auto; }
/* SEASON PASS (Coming soon): the placeholder fills what the header leaves, no scroll. */
.missions-screen.on-pass { display: flex; flex-direction: column; }
.missions-screen.on-pass .mission-pass-soon { flex: 1 1 auto; height: auto; min-height: 0; }
.mission-pass-soon .tab-placeholder-icon { width: clamp(110px, 16vh, 160px); height: clamp(110px, 16vh, 160px); opacity: 1; }
.mission-tabs, .missions-daily-head { align-self: flex-start; }
/* "Some tabs are hidden. Change this in Settings." — only when the ADVANCED setting has hidden
   every tab but REFERRALS. "Settings" is a link (a button) to #/settings/advanced. */
.mission-hidden-note {
  align-self: flex-start; margin: 10px 0 0;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px; letter-spacing: 0.03em;
  color: var(--text-muted);
}
.mission-hidden-link {
  padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit;
  color: var(--gold-bright); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .mission-hidden-link:hover { color: #fff; } }

/* The rail owns the sideways scroll; the page keeps its vertical one. */
.lvr-rail {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 2px 16px; margin-bottom: 6px;
  -webkit-overflow-scrolling: touch; touch-action: pan-x;
}
/* There is NO scrollbar on the track: you grab it and drag it sideways (the handlers live
   in MissionsScreen; the grab/fist cursors with the rest of the cursor set). The wrapper
   exists so the direction hints can hang off the rail's edges. */
.lvr-rail-wrap { position: relative; }
.lvr-rail { scrollbar-width: none; }
.lvr-rail::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* No scroll SNAP on this rail. It used to be `scroll-snap-type: x proximity`, which fought
   both the pointer and the momentum: letting go mid-drag snapped the track BACKWARDS to the
   nearest rung (measured: a release at 270px jumped back to 192px) and a parked drag drifted
   ~38px on its own. The track is a strip you browse, not a carousel — it scrolls free.
   Mid-drag a text/image selection would trail the pointer, so that is turned off here. */
.lvr-rail.is-dragging { user-select: none; -webkit-user-select: none; }

/* Direction hint — a chevron trio at whichever edge still has track behind it, nudging
   the way to drag. `to-left` is the SAME arrow mirrored (`scaleX(-1)`), so one shape and
   one keyframe serve both. Never a control: pointer-events stay off. */
.lvr-nudge {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 3px;
  opacity: 0; transition: opacity .25s ease; pointer-events: none; z-index: 3;
}
.lvr-nudge.on { opacity: 1; }
.lvr-nudge.to-right { right: 2px; }
.lvr-nudge.to-left { left: 2px; transform: translateY(-50%) scaleX(-1); }
/* A scrim so the gold reads over whatever card art sits under it. */
.lvr-nudge::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 190px; height: 200px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(4, 8, 17, 0.88), rgba(4, 8, 17, 0));
}
.lvr-nudge i {
  position: relative; width: 0; height: 0;
  border-top: 13px solid transparent; border-bottom: 13px solid transparent;
  border-left: 17px solid var(--gold-bright);
  filter: drop-shadow(0 2px 3px rgba(3, 7, 15, 0.85));
  animation: lvrNudge 1.15s var(--ease-in-out) infinite;
}
.lvr-nudge i:nth-child(2) { animation-delay: 0.14s; }
.lvr-nudge i:nth-child(3) { animation-delay: 0.28s; }
@keyframes lvrNudge {
  0%, 100% { opacity: 0.2; transform: translateX(-4px); }
  50% { opacity: 1; transform: translateX(4px); }
}
/* Once you ARE dragging, the guide has done its job — it fades out until you let go. */
.lvr-rail.is-dragging ~ .lvr-nudge { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .lvr-nudge i { animation: none; opacity: 0.85; }
}
/* The rung itself carries NO chrome: it is just the column that lines the track bar up
   with its reward panel. The bar strip sits on top, detached by the gap; everything with
   a border/fill lives in `.lvr-card` below it. */
.lvr-node {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.lvr-card {
  align-self: stretch;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 12px 14px; border-radius: 16px;
  background: var(--surface-0); border: 1px solid var(--border-soft);
  transition: border-color .2s ease, opacity .2s ease;
}
.lvr-node.is-locked .lvr-tiles { opacity: 0.45; filter: grayscale(0.4); }
.lvr-node.is-locked .lvr-pip { color: var(--text-muted); }
.lvr-node.is-ready .lvr-card { border-color: var(--gold-edge); }
.lvr-node.is-claimed .lvr-tiles { filter: saturate(0.5) brightness(0.78); }
.lvr-node.is-claiming .lvr-card { border-color: var(--gold-bright); }

/* The connecting line: every rung paints its own segment PLUS half of each gap, so the
   track reads as one continuous line with no absolute positioning to keep in sync. It
   turns gold up to the player's level. Every pip is the same HEIGHT (milestones only get
   wider), or the line would step up and down along the rail. */
/* Every rung paints its OWN segment of the bar, overflowing by half the gap so the
   segments abut into one continuous strip — no absolute maths to keep in sync, and how
   far the gold reaches is just a class per rung. The overflow must be half the gap and no
   more: the rungs are transparent now, so a bigger one would let a locked rung's dim
   segment paint over the gold of the reached rung beside it. */
.lvr-pip-row { position: relative; align-self: stretch; display: flex; justify-content: center; }
/* No seams: square, OPAQUE segments that overlap by 1px (a translucent fill doubled up at
   every join, and rounded ends notched it), so the round caps live only on the rail's two
   ends. The relief is a vertical gradient, identical on every segment, never a shadow —
   a box-shadow would draw its edge at each join again. */
.lvr-pip-row::before {
  content: ''; position: absolute; top: 50%; left: -6.5px; right: -6.5px; height: 8px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #1a2436 0%, #2c3a52 45%, #34435d 60%, #222d41 100%);
}
.lvr-node:first-child .lvr-pip-row::before { border-radius: 4px 0 0 4px; }
.lvr-node:last-child .lvr-pip-row::before { border-radius: 0 4px 4px 0; }
.lvr-node.is-reached .lvr-pip-row::before {
  background: linear-gradient(180deg, #ffe8a3 0%, var(--gold-bright) 30%, var(--gold) 65%, var(--gold-edge) 100%);
}
/* A CIRCLE, not a pill: fixed square box, so milestones can only differ in colour — and
   so every pip centre sits at the same height and the bar reads as one straight line. */
.lvr-pip {
  position: relative; z-index: 1; width: 40px; height: 40px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: linear-gradient(180deg, rgba(40, 58, 92, 0.95), rgba(12, 21, 39, 0.95));
  border: 2px solid var(--border-strong);
  font-family: var(--font-display); font-size: 15px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.lvr-node.is-reached .lvr-pip { background: var(--gold-face); border-color: var(--gold-edge); color: #2a1c04; }
/* Milestone rungs: a gold halo around the pip (the pip can't grow any more) + the gold
   wash on the reward panel. */
.lvr-node.is-milestone .lvr-pip::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(245, 193, 74, 0.55); pointer-events: none;
}
.lvr-node.is-milestone.is-reached .lvr-pip::after { border-color: var(--gold-bright); }
.lvr-node.is-milestone .lvr-card { border-color: rgba(184, 130, 30, 0.5); background: rgba(245, 193, 74, 0.05); }
.lvr-node.is-milestone.is-ready .lvr-card { border-color: var(--gold); }

/* Reward tiles. A card tile IS the game card (foil finish); coins and packs sit in a
   sunken box of the SAME footprint so every rung lines up. */
/* The tab gives the track the whole screen, so the tiles scale with it (they were sized
   for a strip squeezed under the daily missions). The art box takes the card's own
   proportion, so a coin/pack tile always matches the card tile beside it. */
.lvr-rail { --lvr-tile-w: clamp(96px, 8.2vw, 148px); }
.lvr-tiles { display: flex; align-items: flex-start; gap: 10px; }
.lvr-tile { width: var(--lvr-tile-w); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lvr-tile-art {
  position: relative; width: 100%; aspect-ratio: 11 / 16; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-soft);
}
.lvr-tile.is-card .lvr-tile-art { background: none; border: 0; border-radius: 0; }
.lvr-tile.is-card .lvr-tile-art .card { width: 100%; cursor: pointer; }
/* Foil de nivel = DOS copias apiladas: la de abajo, detrás y corrida a la derecha, deja ver su
   canto lateral derecho. Sin animaciones (casi no se ve) y algo más oscura para leerse detrás. */
/* La casilla de la foil es MÁS ANCHA: la carta mide lo mismo que las demás recompensas y el
   sobrante de la derecha es para el canto de la copia de abajo, que así no pisa la de al lado. */
.lvr-tile.is-card { width: calc(var(--lvr-tile-w) * 1.24); align-items: flex-start; }
.lvr-tile.is-card .lvr-tile-art.is-stack { width: calc(100% / 1.24); }
.lvr-tile.is-card .lvr-tile-foil { align-self: center; }
.lvr-tile-art.is-stack > .card { position: relative; z-index: 1; }
.lvr-card-under {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  transform: translate(12%, 0) rotate(4deg); transform-origin: 50% 100%;
  filter: brightness(0.72) saturate(0.9);
}
.lvr-card-under .card { width: 100%; cursor: default; }
.lvr-card-under, .lvr-card-under * { animation: none !important; }
.lvr-tile.is-coins .lvr-tile-art img { width: 60%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
/* The pack fills its tile like the card beside it (owner 2026-11-06: "en grande, no en pequeño");
   claiming it still sends a SMALL pack flying to the counter (runPacks). */
.lvr-tile.is-pack .lvr-tile-art img { width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
/* Las GEMS se pintan como el oro (mismo tamaño y sombra dura), pero su cifra va en el azul
   de la chapa de gems y no en dorado: la moneda que anuncian es otra. */
.lvr-tile.is-gems .lvr-tile-art img { width: 60%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.lvr-tile.is-gems .lvr-tile-tag b { color: #c6e6ff; }
/* UN DORSO es una carta: se pinta ENTERO y sin caja detras (su dibujo ya trae marco), igual
   que la ficha de la carta foil del peldano de al lado. */
.lvr-tile.is-back .lvr-tile-art { background: none; border: 0; border-radius: 0; }
.lvr-tile-back { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 8px rgba(3, 7, 15, 0.6)); }
.lvr-mult {
  position: absolute; right: 7px; bottom: 7px;
  font-family: var(--font-display); font-size: 17px; color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}
.lvr-tile-tag {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-muted); text-align: center; line-height: 1.3;
}
.lvr-tile-tag b { font-family: var(--font-display); font-size: 14px; color: var(--gold-bright); letter-spacing: 0.02em; }
/* The FOIL rung wears the wordmark instead of a pill (see .finish-label). Small, like the
   pack-reveal one: the sibling tags on the other rungs are 11px text, and the art is about
   twice as tall as its own letters. */
.lvr-tile-foil { height: 18px; margin: 1px auto 0; }

.lvr-btn { width: 100%; min-height: 34px; padding: 7px 12px; font-size: 11px; }
/* COBRAR TODO: es una accion de la SECCION, no de un peldano, asi que va centrada debajo
   del rail y con su propio ancho en vez de pegada a ninguna tarjeta. */
.lvr-claimall-row { display: flex; justify-content: center; margin-top: clamp(12px, 1.8vh, 22px); }
.lvr-claimall {
  min-width: clamp(190px, 18vw, 260px); min-height: 42px;
  font-size: clamp(12px, 1vw, 14px); letter-spacing: 0.06em;
}
.lvr-btn.is-claimed, .lvr-btn.is-locked {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border-soft);
  font-family: var(--font-ui); font-weight: 800; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.lvr-btn.is-claimed { color: #7ff0a0; border-color: rgba(70, 196, 106, 0.5); background: rgba(70, 196, 106, 0.14); }
.lvr-btn.is-locked { color: var(--text-muted); background: rgba(0, 0, 0, 0.26); }

@media (max-width: 720px) {
  .lvr-rail { --lvr-tile-w: 88px; }
  .mission-tab { padding: 9px 14px; font-size: 12px; letter-spacing: 0.05em; }
  /* Portrait: the track stays UP by the header. Centring it (what the desktop does with
     its leftover height) left a ~250px hole above the bar on a phone. */
  .missions-screen.on-level .lvr-rail-wrap { margin-top: 6px; }
}

/* Claimable-count badge on the MISSIONS nav tab (anchored to .nav-icon-wrap). */
.nav-badge {
  position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; font-family: var(--font-display); font-size: 11px; line-height: 1;
  border-radius: 999px; border: 1.5px solid rgba(0,0,0,0.4); box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  pointer-events: none; font-variant-numeric: tabular-nums;
}

/* Tutorial-complete reward chips. */

/* ============================================================================
   Efecto de apertura AGUA (MULTICOLOR LIQUID FX) — clases .pw-* DUPLICADAS de
   fx-lab.html (el usuario eligió duplicar). El renderer va en pack-fx.js. La capa
   .po-fx-back es la capa POR DETRÁS del sobre (como .po-sparks del lab). TODAS las capas del efecto son
   cajas FIJAS de 200x268 (el tamaño de autoría en fx-lab) ESCALADAS con --fx-scale = anchoReal/200 para
   que el efecto sea IDÉNTICO al del lab en un sobre más grande (img pack = 448/600 = mismo aspecto).
   ============================================================================ */
  .po-envelope .po-fx-back  { position: absolute; left: 0; top: 0; width: 200px; height: 268px; transform: scale(var(--fx-scale, 1)); transform-origin: 0 0; z-index: -1; pointer-events: none; clip-path: inset(-1500px 5px -1500px 5px); }
  .po-envelope .pw-fountain { position: absolute; left: 0; top: 0; width: 200px; height: 268px; transform: scale(var(--fx-scale, 1)); transform-origin: 0 0; z-index: 5; pointer-events: none; clip-path: inset(-1500px 5px -1500px 5px); }
  .pw-drop { position: absolute; top: 0; left: 0; pointer-events: none;
    animation: pwDropX var(--dur, 1400ms) linear var(--delay, 0ms) both; }
  /* Horizontal a VELOCIDAD CONSTANTE (lineal 0→--tx durante toda la animación): como un proyectil real,
     la X no se frena nunca → la combinación con la Y (gravedad) da una PARÁBOLA suave y continua, sin el
     cambio brusco de dirección que había al fijar la X en el pico. */
  @keyframes pwDropX {
    0%   { transform: translateX(0); opacity: 0; }
    8%   { opacity: 1; }
    100% { transform: translateX(var(--tx, 0)); opacity: 1; }
  }
  /* La caja se AUTORA al tamaño MÁXIMO de la animación (alto ×1,72 = el estirón final) y los keyframes escalan
     SIEMPRE ≤ 1: el raster de la gota (degradado + sombra) nunca se amplía → sin pixelado al caer. */
  .pw-drop-i {
    position: absolute; top: 0; left: 0;
    width: var(--sz, 16px); height: calc(var(--sz, 16px) * 1.72);
    margin: calc(var(--sz, 16px) * -0.86) 0 0 calc(var(--sz, 16px) / -2);
    border-radius: 52% 52% 55% 55% / 62% 62% 46% 46%;
    background: radial-gradient(ellipse at 34% 27%, var(--hi, #e8ffff) 0%, var(--mid, #4fc6e6) 50%, var(--edge, #1d6f96) 100%);
    box-shadow: 0 0 6px var(--glow, rgba(95,210,240,0.7)), inset 0 -2px 3px rgba(0,0,0,0.22), inset 1px 2px 3px rgba(255,255,255,0.4);
    /* timing LINEAL: la trayectoria la definen los keyframes (parábola de gravedad) → sube frenándose
       y CAE acelerando, SIN suavizarse al final (la gota va más rápida cuanto más baja). */
    animation: pwDropY var(--dur, 1100ms) linear var(--delay, 0ms) both;
  }
  /* Parábola de GRAVEDAD muestreada FINO (timing lineal + posiciones y = peak + span·f²) para una
     curvatura SUAVE y CONTINUA: sube frenando, se relentiza en el pico (v≈0) y cae acelerando de forma
     progresiva. Con muchos pasos la velocidad cambia poco a poco (sin saltos) → transición fluida. */
  /* scaleY = el de antes / 1,72 (la caja ya mide 1,72·sz de alto): mismas formas en pantalla, raster nunca ampliado. */
  @keyframes pwDropY {
    0%   { transform: translateY(0) scale(0.44, 0.256); }
    6%   { transform: translateY(calc(var(--peak, -60px) * 0.56)) scale(0.86, 0.5); }
    12%  { transform: translateY(calc(var(--peak, -60px) * 0.89)) scale(0.97, 0.593); }
    18%  { transform: translateY(var(--peak, -60px)) scale(1.0, 0.581); }                          /* PICO: casi parado */
    38%  { transform: translateY(calc(var(--peak, -60px) + var(--span, 500px) * 0.06)) scale(0.93, 0.628); }
    56%  { transform: translateY(calc(var(--peak, -60px) + var(--span, 500px) * 0.22)) scale(0.86, 0.698); }
    74%  { transform: translateY(calc(var(--peak, -60px) + var(--span, 500px) * 0.46)) scale(0.8, 0.802); }
    90%  { transform: translateY(calc(var(--peak, -60px) + var(--span, 500px) * 0.74)) scale(0.74, 0.913); }
    100% { transform: translateY(var(--fall, 440px)) scale(0.7, 1); }                              /* cae rápido (acelera), sale */
  }
  /* salpicaduras pequeñas (spray): puntitos de agua que estallan en abanico ancho y se apagan */
  .pw-spray {
    position: absolute; top: 0; left: 0; pointer-events: none; border-radius: 50%;
    width: var(--sz, 4px); height: var(--sz, 4px);
    margin: calc(var(--sz, 4px) / -2) 0 0 calc(var(--sz, 4px) / -2);
    background: radial-gradient(circle at 40% 34%, var(--hi, #eaffff) 0%, var(--mid, #7fd8ee) 72%);
    box-shadow: 0 0 3px var(--glow, rgba(140,220,245,0.6));
    animation: pwSpray var(--dur, 700ms) cubic-bezier(0.2, 0.6, 0.4, 1) var(--delay, 0ms) both;
  }
  @keyframes pwSpray {
    0%   { transform: translate(0, 0) scale(0.5); opacity: 0; }
    14%  { opacity: 1; }
    100% { transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.85); opacity: 0; }
  }
  /* Líquido que CHORREA sutilmente por la cara del sobre (capa por delante del cuerpo): hilos
     finos que se DIBUJAN de arriba abajo (scaleY desde el borde superior), con una gota-cabeza
     al frente (::after) y translúcidos. Sustituye a las gotas que resbalaban de forma irregular. */
  /* overflow HIDDEN → el chorro/regueros/goteo NUNCA se muestran fuera de los límites del sobre. */
  .po-envelope .pw-liquid { position: absolute; left: 0; top: 0; width: 200px; height: 268px; transform: scale(var(--fx-scale, 1)); transform-origin: 0 0; z-index: 3; pointer-events: none; overflow: hidden; }
  /* Chorreos de líquido (RIBBONS RELLENOS, ver JS renderWaterBurst) que se comportan como AGUA: bajan
     serpenteando con grosor variable y CABEZA REDONDA (gota), hasta el FINAL del sobre. El SVG entero se
     DIBUJA de ARRIBA→ABAJO (el líquido baja) con un clip y se mantiene; luego CADA chorro (.pw-stream) se
     va por su cuenta (ver más abajo). Relleno de agua + ribbon blanco fino encima = reflejo glossy. */
  .po-envelope .pw-bifur {
    position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
    animation: pwBifurStream var(--drawDur, 820ms) ease-in var(--drawDelay, 0ms) both;   /* cada chorro: su tiempo/velocidad */
  }
  .pw-bifur path, .pw-bifur ellipse { stroke: none; }
  /* PILA VECTORIAL de cada chorro (paintInto en pack-fx.js): cintas concéntricas de ancho decreciente, SIN filtros
     raster (el drop-shadow de antes se rasterizaba a 200 px y la capa lo ampliaba ×2+ → borroso/pixelado). Nítido
     a cualquier --fx-scale. De abajo arriba: halo (×2) · canto oscuro · cuerpo translúcido · núcleo claro ·
     especular blanco corrido hacia la luz · reflejos partidos (trazo discontinuo). */
  .pw-bifur-glow     { fill: var(--glow, rgba(160,230,252,0.7)); opacity: 0.26; }   /* halo cercano (sustituye al drop-shadow) */
  .pw-bifur-glow.far { opacity: 0.12; }                                              /* halo lejano, más tenue */
  .pw-bifur-rim      { fill: var(--edge, #1d7aa0); opacity: 0.62; }                 /* canto: el agua refracta y se oscurece en los bordes */
  .pw-bifur-w        { fill: var(--liq2, rgba(150,222,248,0.9)); opacity: 0.66; }   /* cuerpo translúcido: el arte se ve a través */
  .pw-bifur-core     { fill: var(--hi, #eaffff); opacity: 0.4; transform: translateX(0.4px); }   /* núcleo claro (grosor del agua) */
  .pw-bifur-hi       { fill: #ffffff; opacity: 0.82; transform: translateX(-0.9px); }            /* especular hacia la luz (arriba-izq) */
  .pw-bifur-gleam    { fill: none; stroke: #ffffff; stroke-width: 0.9; stroke-linecap: round; opacity: 0.9; }   /* reflejos partidos */
  /* DIBUJO top→down (el líquido BAJA acelerando por gravedad, ease-in) y se mantiene. Arranca en la BOCA
     del chorro (--drawFrom, que el JS pone en la y del CORTE trazado) y no en la cima del sobre. */
  @keyframes pwBifurStream {
    0%   { clip-path: inset(0 0 var(--drawFrom, 100%) 0); }
    100% { clip-path: inset(0 0 -4% 0); }
  }
  /* Cada CHORREO desaparece por su cuenta DISMINUYENDO su grosor (scaleX→0) y desvaneciéndose, en su
     propio momento (--goneDelay) → NO todos a la vez. transform-box: fill-box → se afina sobre su centro. */
  .pw-stream {
    transform-box: fill-box; transform-origin: 50% 30%;
    animation: pwStreamGone var(--goneDur, 820ms) ease-in var(--goneDelay, 1200ms) both;
  }
  @keyframes pwStreamGone {
    0%   { transform: scaleX(1);    opacity: 1; }
    60%  { transform: scaleX(0.4);  opacity: 0.92; }
    100% { transform: scaleX(0.06); opacity: 0; }
  }
  /* GOTA que se descuelga al llegar al final del hilo y CAE con gravedad (sale por abajo). */
  /* gota que gotea al final: PEQUEÑA y REDONDITA (casi circular) */
  /* caja al tamaño MÁXIMO del estirón (alto ×1,5) y escalas ≤ 1 → el raster no se amplía (ver .pw-drop-i) */
  .pw-drip {
    position: absolute; pointer-events: none; transform-origin: 50% 0;
    width: var(--dw, 5px); height: calc(var(--dw, 5px) * 1.62); margin-left: calc(var(--dw, 5px) / -2);
    border-radius: 48% 48% 50% 50% / 46% 46% 52% 52%;
    background: radial-gradient(ellipse at 38% 30%, #ffffff 0%, var(--liq2, rgba(150,222,248,0.95)) 68%);
    box-shadow: 0 0 3px var(--glow, rgba(160,230,252,0.7)), inset 0 -1px 1px rgba(0,0,0,0.16);
    animation: pwDrip var(--ddur, 900ms) linear var(--ddelay, 0ms) both;
  }
  @keyframes pwDrip {
    0%   { transform: translateY(0) scale(0.4, 0.267); opacity: 0; }
    16%  { transform: translateY(2px) scale(1, 0.667); opacity: 1; }                         /* cuelga */
    34%  { transform: translateY(8px) scale(0.9, 0.787); opacity: 1; }                       /* se estira y suelta */
    64%  { transform: translateY(calc(var(--dfall, 200px) * 0.3)) scale(0.82, 0.893); opacity: 1; }
    100% { transform: translateY(var(--dfall, 200px)) scale(0.76, 1); opacity: 1; }           /* cae acelerando, sale */
  }
  /* Anillo de salpicadura en la boca. */
  .pw-ring {
    position: absolute; top: 0; left: 0; pointer-events: none;
    width: var(--sz, 70px); height: var(--sz, 70px);
    margin: calc(var(--sz, 70px) / -2) 0 0 calc(var(--sz, 70px) / -2);
    border-radius: 50%; border: 3px solid var(--ring, rgba(160,235,252,0.8));
    animation: pwRing var(--dur, 700ms) cubic-bezier(0.2, 0.7, 0.3, 1) var(--delay, 0ms) both;
  }
  @keyframes pwRing { 0% { transform: scale(0.2); opacity: 0; } 22% { opacity: 0.85; } 100% { transform: scale(1); opacity: 0; } }
  /* Resplandor de la boca (agua = cian, oro = dorado, super rare = iridiscente). Screen para lavar suave.
     Va POR DETRÁS del sobre (en .po-sparks, z-index -1) → retroiluminación que EMANA del sobre, no se
     pinta sobre el arte. El elemento se EXTIENDE por ENCIMA del sobre (top:-50%; height:100% → coord del
     elemento = coord del sobre + 50%; la boca del sobre = elem 50%). La FORMA la da un degradado RADIAL
     (elipse): su caída suave redondea el EXTREMO superior en SEMICÍRCULO y apaga los lados ANTES de
     llegar al recorte lateral (5px) → NO hay líneas verticales que corten el resplandor. La mitad
     inferior queda oculta tras el sobre → parece que la luz sale de la abertura. */
  .pw-cone {
    position: absolute; left: 0; width: 100%; top: -50%; height: 100%; pointer-events: none; mix-blend-mode: screen;
    transform-origin: 50% 60%;
    animation: pwGlow var(--dur, 850ms) ease-out var(--delay, 0ms) both;
  }
  @keyframes pwGlow { 0% { transform: scale(0.5); opacity: 0; } 26% { opacity: var(--peakOp, 0.7); } 100% { transform: scale(1.1); opacity: 0; } }
  /* Degradado RADIAL (elipse) centrado justo en la boca (elem 54%): brillante en la abertura y se apaga
     de forma redondeada hacia arriba (extremo = SEMICÍRCULO) y hacia los lados (transparente antes del
     borde → sin cortes verticales). La mitad de abajo la tapa el sobre. */
  .pw-cone.water { background: radial-gradient(44% 34% at 50% 54%, rgba(150,232,252,0.54) 0%, rgba(120,214,246,0.32) 46%, rgba(120,214,246,0.11) 72%, transparent 100%); }
  .pw-cone.gold  { background: radial-gradient(44% 34% at 50% 54%, rgba(255,226,150,0.50) 0%, rgba(246,198,90,0.29) 46%, rgba(246,198,90,0.11) 72%, transparent 100%); }
  /* Variante IRIDISCENTE (ultra rare): un ARCOÍRIS cónico (la gama del canto ultra) recortado por la MISMA
     elipse con una máscara, + hue-rotate que lo hace CICLAR. Antes era un lila plano: no se leía iridiscente. */
  .pw-cone.iris  { background: conic-gradient(from 0deg at 50% 54%, #ff8fd0, #8fb2ff, #8ff0de, #ffe79a, #ffac8f, #c69eff, #8fe2ff, #ff8fd0);
                   -webkit-mask-image: radial-gradient(44% 34% at 50% 54%, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.36) 46%, rgba(0,0,0,0.13) 72%, transparent 100%);
                   mask-image: radial-gradient(44% 34% at 50% 54%, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.36) 46%, rgba(0,0,0,0.13) 72%, transparent 100%);
                   animation: pwGlow var(--dur, 850ms) ease-out var(--delay, 0ms) both, pwConeIris 1500ms linear infinite; }
  @keyframes pwConeIris { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
  /* Símbolo de Bitcoin (₿) dorado con contorno de tinta — sube en el cono como una chispa más. */
  .pw-btc {
    position: absolute; top: 0; left: 0; pointer-events: none;
    width: var(--sz, 24px); height: var(--sz, 24px);
    margin: calc(var(--sz, 24px) / -2) 0 0 calc(var(--sz, 24px) / -2);
    font: 900 var(--sz, 24px)/1 'Segoe UI', 'Arial Black', system-ui, sans-serif;
    text-align: center;
    background: linear-gradient(150deg, #fff4cf 0%, #ffd35a 46%, #f0a92e 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 1.6px #6a4610; paint-order: stroke;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    animation: pwBtcFly var(--dur, 900ms) cubic-bezier(0.16, 0.9, 0.3, 1) var(--delay, 0ms) both;
  }
  @keyframes pwBtcFly {
    0%   { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 0; }
    14%  { opacity: 1; transform: translate(calc(var(--tx) * 0.32), calc(var(--ty) * 0.32)) scale(1.05) rotate(calc(var(--spin, 0deg) * 0.4)); }
    100% { transform: translate(var(--tx), var(--ty)) scale(0.6) rotate(var(--spin, 0deg)); opacity: 0; }
  }

/* ============================================================================
   "OPEN DEMO PACK" (store) + DEMO badge on the opening screen (a SIMULATION:
   full opening animation, no cards obtained).
   ============================================================================ */
.demo-pack-btn {
  margin-top: 12px; width: 100%; padding: 11px 14px; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent, #ffd166); background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--accent, #ffd166);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .demo-pack-btn:hover { background: rgba(255, 255, 255, 0.11); box-shadow: 0 0 14px rgba(255, 209, 102, 0.22); } }
.demo-pack-btn:active { transform: translateY(1px); }
/* demo simulator controls: pack + forced-final selectors above the OPEN DEMO button */
.demo-controls { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.demo-controls .demo-pack-btn { margin-top: 0; }
.demo-selects { display: flex; gap: 10px; }
.demo-sel { flex: 1; display: flex; flex-direction: column; gap: 3px;
  font-family: var(--font-ui, inherit); font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #aeb7c7; }
.demo-sel select {
  font-family: var(--font-ui, inherit); font-size: 13px; padding: 7px 8px; border-radius: 9px; cursor: pointer;
  color: #fff; background: rgba(10, 14, 24, 0.92); border: 1.5px solid rgba(255, 255, 255, 0.16);
}
.demo-sel select:focus { outline: none; border-color: var(--accent, #ffd166); }
/* demo simulator: "only cards with image" toggle */
.demo-check { display: flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: var(--font-ui, inherit); font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #aeb7c7; user-select: none; }
.demo-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent, #ffd166); }
/* la etiqueta DEMO sirve a las dos aperturas: la v1 (.po-screen) y la neón (.np-screen) */
.po-screen.demo .po-demo-badge,
.np-screen.np-demo .po-demo-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 5px 16px; border-radius: 999px; pointer-events: none;
  font-family: inherit; font-weight: 900; font-size: 12px; letter-spacing: 0.3em; text-indent: 0.3em;
  color: #0b0e14; background: linear-gradient(180deg, #ffe27a, #f0a92e);
  border: 1.5px solid rgba(0, 0, 0, 0.35); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ============================================================================
   UI KIT · BOTONES DEL SPRITESHEET  (ver fx-lab.html#ui-kit)
   ---------------------------------------------------------------------------
   Repinta los botones que el juego YA tiene con el arte del kit. No se añade
   ningún botón nuevo ni se toca game.js: solo cambia el aspecto de las clases
   existentes.

     rectangular  ->  .btn · .ui-btn · .home2-play-btn · .demo-pack-btn ·
                      .shop-buy-row .buy-btn
     cuadrado     ->  .ui-btn-icon · .hud-icon-btn · .po-close ·
                      .coll-modal-close · .cl-close
     circular     ->  .cl-dd-play-btn   (el único redondo que había)

   CÓMO: dos capas en ::before / ::after (idle y hover cruzado), igual que en el
   laboratorio. El grosor del 9-slice se calcula desde `--gb-h` (la altura del
   botón) para que el contorno salga a escala: recorte 28 de un arte de 83 px de
   alto -> 28/83 = 0.337 de la altura. Cada clase declara su `--gb-h`.

   Los `!important` son solo sobre background / border / box-shadow: el juego
   pinta esos tres en ~30 reglas de estado (`:hover:not(:disabled)`, etc.) y así
   se neutralizan de una vez sin reescribirlas. Quitando este bloque el aspecto
   anterior vuelve intacto.
   ============================================================================ */
.btn,
.ui-btn,
.home2-play-btn,
.demo-pack-btn,
.shop-buy-row .buy-btn,
.ui-btn-icon,
.hud-icon-btn,
.po-close,
.coll-modal-close,
.cl-close,
.cl-dd-play-btn {
  --gb-h: 44px;
  --gb-idle: url('../UI/kit/btn-idle.png');
  --gb-hover: url('../UI/kit/btn-hover.png');
  --gb-down: url('../UI/kit/btn-down.png');
  --gb-slice: 28 30;
  --gb-bw: calc(var(--gb-h) * 0.337) calc(var(--gb-h) * 0.361);
  --gb-r: 0.25;                                        /* radio de la esquina del arte, en alturas */
  --gb-tint: saturate(1.4) brightness(0.96);          /* amber, el tono del set */
  --gb-glow: 0 0 9px rgba(255, 205, 74, 0.5);
  position: relative;
  isolation: isolate;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #4a2f16;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn::before, .btn::after,
.ui-btn::before, .ui-btn::after,
.home2-play-btn::after,
.demo-pack-btn::before, .demo-pack-btn::after,
.shop-buy-row .buy-btn::before, .shop-buy-row .buy-btn::after,
.ui-btn-icon::before, .ui-btn-icon::after,
.hud-icon-btn::before, .hud-icon-btn::after,
.po-close::before, .po-close::after,
.coll-modal-close::before, .coll-modal-close::after,
.cl-close::before, .cl-close::after,
.cl-dd-play-btn::before, .cl-dd-play-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  box-sizing: border-box;
  pointer-events: none;
  border-style: solid;
  /* EL FORRO. Las 9 piezas se pintan por separado y, cuando el corte no cae en un pixel
     entero (pantalla al 125/150 %, un boton con scale o un translate con decimales), cada
     pieza suaviza su canto y por la junta se veia el fondo: una raya fina y oscura. Debajo
     va la franja CENTRAL del mismo arte estirada a todo el ancho (el mismo perfil vertical
     que el 9-slice), recortada un poco por dentro del contorno de tinta: el borde real es
     solo ese margen (`border-image-width` es quien manda el grosor del 9-slice) y el radio
     sigue la esquina del arte, asi que el forro nunca asoma por fuera. */
  border-width: calc(var(--gb-h) * 0.07);
  border-radius: calc(var(--gb-h) * var(--gb-r));
  background: var(--gb-idle) center / 1000% 100% no-repeat border-box padding-box;
  border-image-source: var(--gb-idle);
  border-image-slice: var(--gb-slice) fill;
  border-image-width: var(--gb-bw);
  border-image-repeat: stretch;
  filter: var(--gb-tint);
}
.btn::after,
.ui-btn::after,
.home2-play-btn::after,
.demo-pack-btn::after,
.shop-buy-row .buy-btn::after,
.ui-btn-icon::after,
.hud-icon-btn::after,
.po-close::after,
.coll-modal-close::after,
.cl-close::after,
.cl-dd-play-btn::after {
  border-image-source: var(--gb-hover);
  background-image: var(--gb-hover);
  opacity: 0;
  transition: opacity 0.16s ease;
  filter: drop-shadow(var(--gb-glow)) var(--gb-tint);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled)::after,
  .ui-btn:hover:not(:disabled)::after,
  .demo-pack-btn:hover:not(:disabled)::after,
  .shop-buy-row .buy-btn:hover:not(:disabled)::after,
  .ui-btn-icon:hover:not(:disabled)::after,
  .hud-icon-btn:hover:not(:disabled)::after,
  .po-close:hover::after,
  .coll-modal-close:hover::after,
  .cl-close:hover::after,
  .cl-dd-play-btn:hover::after { opacity: 1; }
}
.btn:active:not(:disabled)::before,
.ui-btn:active:not(:disabled)::before,
.demo-pack-btn:active:not(:disabled)::before,
.shop-buy-row .buy-btn:active:not(:disabled)::before,
.ui-btn-icon:active:not(:disabled)::before,
.hud-icon-btn:active::before,
.po-close:active::before,
.coll-modal-close:active::before,
.cl-close:active::before,
.cl-dd-play-btn:active::before { border-image-source: var(--gb-down); background-image: var(--gb-down); }
.btn:active::after,
.ui-btn:active::after,
.demo-pack-btn:active::after,
.shop-buy-row .buy-btn:active::after,
.ui-btn-icon:active::after,
.hud-icon-btn:active::after,
.po-close:active::after,
.coll-modal-close:active::after,
.cl-close:active::after,
.cl-dd-play-btn:active::after { opacity: 0; }

/* deshabilitado: el juego ya baja la opacidad; aquí se apaga el color */
.btn:disabled::before,
.ui-btn:disabled::before,
.demo-pack-btn:disabled::before,
.shop-buy-row .buy-btn:disabled::before,
.ui-btn-icon:disabled::before,
.hud-icon-btn:disabled::before { filter: grayscale(0.85) brightness(0.82); }
.btn:disabled::after,
.ui-btn:disabled::after,
.shop-buy-row .buy-btn:disabled::after { opacity: 0 !important; }

/* ---- alturas reales de cada botón (mandan el grosor del 9-slice) ---- */
.btn { --gb-h: 38px; }
.ui-btn { --gb-h: 44px; }
.home2-play-btn { --gb-h: clamp(44px, 4.4vw, 64px); }
.demo-pack-btn { --gb-h: 40px; }
.shop-buy-row .buy-btn { --gb-h: clamp(52px, 5.2vw, 76px); }
.store-coll-link { --gb-h: clamp(30px, 2.6vw, 36px); }


/* ---- tonos: el primario va en amber; el secundario, apagado ---- */
.btn,
.demo-pack-btn,
.shop-buy-row .buy-btn,
.ui-btn-ghost { --gb-tint: saturate(0.12) brightness(1.02); --gb-glow: 0 0 0 transparent; }
.btn.primary,
.ui-btn-gold,
.home2-play-btn { --gb-tint: saturate(1.4) brightness(0.96); --gb-glow: 0 0 9px rgba(255, 205, 74, 0.5); }
/* el kit no trae rojo (girar el matiz rompe el contorno de tinta): la acción
   destructiva se distingue por peso, en bronce */
.btn.danger { --gb-tint: saturate(1.2) brightness(0.8); --gb-glow: 0 0 0 transparent; }

/* La misma tipografia que el UI KIT (Lilita One, ya cargada en index.html).
   Es mas ancha que Space Grotesk, asi que el espaciado entre letras se afloja
   un punto para que no se apelmace. */
.btn, .ui-btn, .home2-play-btn, .demo-pack-btn,
.shop-buy-row .buy-btn, .shop-buy-row .buy-btn .buy-main-label,
.ui-btn-icon, .cl-close {
  font-family: 'Lilita One', 'Bowlby One', var(--font-display), sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* el texto vuelve a leer sobre oro */
.btn, .btn.primary, .btn.danger,
.ui-btn, .ui-btn-gold, .ui-btn-ghost,
.home2-play-btn, .demo-pack-btn,
.shop-buy-row .buy-btn, .shop-buy-row .buy-btn .buy-main-label,
.ui-btn-icon, .cl-close { color: #4a2f16; }
/* deshabilitado: SIN sombra de texto. La sombra clara sobre el gris apagado
   hacia que el label pareciera desenfocado. */
.btn:disabled, .ui-btn:disabled, .shop-buy-row .buy-btn:disabled,
.shop-buy-row .buy-btn:disabled .buy-main-label,
.home2-play-btn:disabled, .demo-pack-btn:disabled,
.ui-btn-icon:disabled, .hud-icon-btn:disabled {
  /* el juego ya baja el boton a opacity .4; el label va mas solido para que
     siga leyendose sin necesidad de sombra */
  color: rgba(52, 34, 16, 0.9);
  text-shadow: none;
}
.ui-btn-ghost img, .btn img { filter: drop-shadow(0 1px 0 rgba(58, 36, 19, 0.35)); }

/* ---- VIEW COLLECTION ----
   Amarillo relleno y letra negra. El relleno del 9-slice lo pinta la palabra `fill` de
   `border-image-slice`, que es la de serie del retrofit, asi que aqui no hay que tocarla:
   solo el TONO (el ambar del primario, no el gris del secundario) y el color del texto.
   Vive al final del retrofit porque comparte especificidad con `.btn` y solo gana por orden. */
.store-coll-link {
  --gb-tint: saturate(1.4) brightness(0.96);
  --gb-glow: 0 0 10px rgba(255, 205, 74, 0.55);
  /* Negro sobre el amarillo. La sombra vuelve a ser clara: es la que despega la letra del
     oro, y sobre relleno no puede ser oscura o el texto se emborrona. */
  color: #14100a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ---- CUADRADOS ---- */
.ui-btn-icon,
.hud-icon-btn,
.po-close,
.coll-modal-close,
.cl-close {
  --gb-idle: url('../UI/kit/btnsq-idle.png');
  --gb-hover: url('../UI/kit/btnsq-hover.png');
  --gb-down: url('../UI/kit/btnsq-down.png');
  --gb-slice: 38;
  --gb-bw: calc(var(--gb-h) * 0.271);
  --gb-r: 0.19;
}
.ui-btn-icon { --gb-h: 40px; }
.hud-icon-btn { --gb-h: clamp(48px, 5.2vw, 58px); }
.po-close { --gb-h: clamp(40px, 4vw, 50px); }
.coll-modal-close { --gb-h: clamp(38px, 3.2vw, 48px); }
.cl-close { --gb-h: 34px; }
/* El icono va a un % de la CAJA COMPLETA, no del hueco que dejaba el padding del
   juego (box-sizing es border-box y `.hud-icon-btn` tenia 10px, asi que un 62%
   acababa siendo ~17px en un boton de 48). El aro del arte ya hace de margen. */
.ui-btn-icon,
.hud-icon-btn,
.po-close,
.cl-close,
.coll-modal-close { padding: 0; }
.hud-icon-btn img,
.ui-btn-icon img,
.po-close img,
.cl-close img,
.coll-modal-close img { width: 70%; height: 70%; object-fit: contain; opacity: 1; }
/* el aspa de cerrar es oscura sobre crema: se le quita el filtro que la aclaraba */
@media (hover: hover) and (pointer: fine) { .coll-modal-close:hover { background: none !important; transform: scale(1.05); } }

/* ---- CIRCULAR (el único que había: reproducir voz en el desplegable) ---- */
.cl-dd-play-btn {
  --gb-h: 26px;
  --gb-idle: none;
  --gb-hover: none;
  --gb-down: none;
}
.cl-dd-play-btn::before,
.cl-dd-play-btn::after {
  border: 0;
  border-image-source: none;
  background: center / 100% 100% no-repeat;
  border-radius: 50%;
}
.cl-dd-play-btn::before { background-image: url('../UI/kit/btnci-idle.png'); }
.cl-dd-play-btn::after { background-image: url('../UI/kit/btnci-hover.png'); }
.cl-dd-play-btn:active::before { background-image: url('../UI/kit/btnci-down.png'); }
.cl-dd-play-btn { color: #4a2f16; }
.cl-dd-play-btn.on { --gb-tint: saturate(1.6) brightness(1.06); color: #4a2f16; }

/* El botón PLAY de la home ya usaba ::before para su halo respirante (anima
   box-shadow Y opacity), así que ahí no puede ir el arte: parpadearía. Su capa
   de arte va en ::after y cambia de estado sin fundido. */
.home2-play-btn::after {
  border-image-source: var(--gb-idle);
  background-image: var(--gb-idle);
  opacity: 1;
  filter: var(--gb-tint);
}
@media (hover: hover) and (pointer: fine) { .home2-play-btn:hover::after { border-image-source: var(--gb-hover); background-image: var(--gb-hover); } }
.home2-play-btn:active::after { border-image-source: var(--gb-down); background-image: var(--gb-down); }

/* el botón de compra de la tienda es la acción principal de esa pantalla */
.shop-buy-row .buy-btn { --gb-tint: saturate(1.4) brightness(0.96); --gb-glow: 0 0 9px rgba(255, 205, 74, 0.5); }

/* ============================================================================
   ESTÉTICA VECTORIAL CARTOON — HOME Y MISIONES
   ---------------------------------------------------------------------------
   Misma receta que el UI CSS KIT (ver fx-lab.html#ui-kit): contorno oscuro del
   MISMO grosor en los cuatro lados, esquinas redondeadas y el relieve hecho con
   dos bandas PLANAS de `box-shadow` con desenfoque cero — una clara arriba y una
   oscura abajo. Ni un degradado en el relieve.

   Los colores del juego NO cambian: cada superficie conserva su fondo y sus
   acentos. Lo que se añade es lo que faltaba — contorno, luz y sombra — y se
   sustituyen las sombras difuminadas de 1px por ese relieve plano.

   Va al final del fichero para ganar por orden a las reglas originales sin
   reescribirlas; borrando el bloque vuelve el aspecto anterior.
   ============================================================================ */
:root {
  --gv-ink: #070f1d;                      /* contorno: casi negro azulado */
  --gv-ink-gold: #6b4a12;                 /* contorno de las piezas doradas */
  --gv-hi: rgba(255, 255, 255, 0.13);     /* banda de luz, arriba */
  --gv-sh: rgba(0, 0, 0, 0.34);           /* banda de sombra, abajo */
  --gv-hi-gold: rgba(255, 255, 255, 0.42);
  --gv-sh-gold: rgba(84, 47, 0, 0.4);
  --gv-bw: 3px;
  --gv-hi-h: 4px;
  --gv-sh-h: 8px;
  /* Anillo de 1px por FUERA del contorno. El contorno es tinta (L~7) y sobre el bosque
     oscurecido (L~40-75) no tenia contra que separarse: el canto del panel se disolvia.
     Este anillo le da SIEMPRE un borde claro contra el que recortarse, y tambien suma
     sobre el fondo oscuro del resto de pestanas. */
  --gv-halo: rgba(198, 220, 255, 0.16);
}

/* ---------------- HOME · superficies ---------------- */
.home2-panel,
.home2-bar,
.home2-deck {
  border: var(--gv-bw) solid var(--gv-ink);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 0 0 1px var(--gv-halo),
    0 10px 24px -12px rgba(0, 0, 0, 0.75);
}
/* Mismo redondeado que el avatar del HOME: 22% (--av-radius) de clamp(64px,5.2vw,94px). */
:root { --avatar-corner: clamp(14px, 1.144vw, 20.7px); }
@media (max-width: 560px) { :root { --avatar-corner: 8.8px; } }   /* avatar a 40px */
.home2-panel, .home2-bar, .home2-deck { border-radius: var(--avatar-corner); }
/* el hover deja de inflar la sombra difuminada: solo sube la pieza */
/* El hover repite el halo y la sombra: el `box-shadow` se REEMPLAZA entero, no se suma,
   asi que sin estas dos lineas la pieza perderia el canto justo al pasar por encima. */
@media (hover: hover) and (pointer: fine) {
  .home2-tile:hover,
  .home2-deck:hover {
    border-color: var(--gv-ink);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.2),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 0 0 1px var(--gv-halo),
      0 14px 30px -14px rgba(0, 0, 0, 0.8);
  }
}
@media (hover: hover) and (pointer: fine) { .home2-deck:hover { border-color: var(--gold-edge); } }
/* REORDENAR arrastrando (DecksStrip): el cogido va pegado al puntero, sin transicion y por
   encima de todo; los demas se deslizan a su hueco provisional (la transicion de `.home2-deck`). */
.home2-deck[data-deck-i] { touch-action: pan-x; -webkit-user-select: none; user-select: none; }
.home2-deck-strip.is-sorting .home2-deck { cursor: grabbing; }
.home2-deck.is-dragging {
  z-index: 5; transition: none; border-color: var(--gold);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.2),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 0 0 2px rgba(245, 193, 74, 0.45),
    0 24px 40px -14px rgba(0, 0, 0, 0.85);
}
/* Chapita del mazo ACTIVO (el primero): el que juega el widget PLAY. */
.home2-deck-active {
  position: absolute; top: 10px; left: 10px; z-index: 4; pointer-events: none;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(9px,0.72vw,11px); letter-spacing: 0.1em; line-height: 1.2;
  color: #2a1a02; background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 2px solid var(--gv-ink-gold, #5a3a08); box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
/* La barra de XP del home ya no se retoca aquí: su bloque de arriba copia el raíl y el
   relleno azul del flow de recompensas (`.rf-xp-bar` / `.xp-fill`, fx-effects.css). */

/* (El avatar va SIN aro; su regla base ya no pone box-shadow y aquí tampoco.) */

/* ---------------- MISIONES ---------------- */
.mission-card {
  /* la superficie pasa a ser SOLIDA (como los paneles del home): sobre el
     `--surface-0` translucido de antes las dos bandas planas no se leian */
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
  border: var(--gv-bw) solid var(--gv-ink);
  border-radius: 18px;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
/* PROMO Mission (SPECIAL_MISSIONS, once per account): the PROMO hologram label over the name and a
   pastel edge like the label's own colours. When it is completed the edge turns gold like the rest. */
.mission-card.mission-promo:not(.is-done) {
  border-color: #b7c8ff;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(214, 226, 255, 0.2),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 0 14px rgba(160, 200, 255, 0.16);
}
.mission-promo-tag { display: block; height: 24px; width: auto; margin: -2px 0 3px -2px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55)); }
/* completada: el contorno se vuelve dorado, sin halo difuso */
.mission-card.is-done {
  border-color: var(--gold-edge);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.18),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
.mission-bar {
  height: 24px;
  border: var(--gv-bw) solid var(--gv-ink);
  box-shadow:
    inset 0 5px 0 rgba(0, 0, 0, 0.42),
    inset 0 -3px 0 rgba(255, 255, 255, 0.08);
}
.mission-bar-fill {
  background: var(--gold);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.55),
    inset 0 -4px 0 rgba(140, 88, 8, 0.45);
}
.mission-count-chip,
.missions-reset,
.wallet-chip {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
/* el raíl de recompensas por nivel entra en el mismo trato: contorno de tinta plano y
   las dos bandas de relieve; el raíl del progreso va HUNDIDO (bandas invertidas), como
   la barra de misión */
.lvr-card {
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
  border: var(--gv-bw) solid var(--gv-ink);
  border-radius: 18px;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
.lvr-node.is-ready .lvr-card, .lvr-node.is-milestone.is-ready .lvr-card {
  border-color: var(--gold-edge);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 224, 150, 0.18),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
.lvr-node.is-milestone .lvr-card { border-color: var(--gv-ink-gold); }
.mission-tabs { border: 2px solid var(--gv-ink); box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.4); }
.mission-tab.on { box-shadow: inset 0 2px 0 var(--gv-hi-gold), inset 0 -3px 0 var(--gv-sh-gold); }
.lvr-pip {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.lvr-node.is-reached .lvr-pip {
  border-color: var(--gv-ink-gold);
  box-shadow:
    inset 0 3px 0 var(--gv-hi-gold),
    inset 0 -4px 0 var(--gv-sh-gold);
}
.lvr-pip-row::before { box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.45); }
.lvr-node.is-reached .lvr-pip-row::before { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(140, 88, 8, 0.45); }
/* Sin marcos hundidos dentro del conjunto: el unico marco es el de la `.lvr-card` (con el
   relieve de la UI); cada premio flota suelto dentro de ella. */
.lvr-tile-art { background: none; border: 0; box-shadow: none; }
.lvr-btn.is-claimed, .lvr-btn.is-locked {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}

/* el cofre de la recompensa: sombra proyectada plana, no difuminada */
.mission-chest.rf-chest { filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.55)); }

/* ---------------- iconos: contorno plano en vez de sombra difusa ---------- */
.home2-tile-icon { filter: drop-shadow(0 3px 0 rgba(3, 7, 15, 0.5)); }
/* La sombra va en el CONTENEDOR del abanico, no en cada carta: un `filter` sobre un elemento
   ROTADO se rasteriza en su espacio local y luego se estira girado, y las 2 laterales salian
   borrosas. En el deck solo al hover (sin hover las cartas no se ven y la caja ya tiene la suya). */
.home2-play-cards:has(.home2-play-card) { filter: drop-shadow(0 5px 0 rgba(3, 7, 15, 0.5)); }
@media (hover: hover) and (pointer: fine) { .home2-deck:hover .home2-deck-cards { filter: drop-shadow(0 5px 0 rgba(3, 7, 15, 0.5)); } }

/* el monedero de la cabecera (misiones/tienda): CONTORNO dorado.
   Su relleno ámbar y sus bandas de relieve se han retirado de aquí — el fondo de
   TODOS los contadores de oro lo pone ahora el bloque "CONTADORES DE ORO" del
   final del fichero. Esta regla se queda con lo único que sigue siendo suyo, el
   color del borde (que es el que tenía). */
.wallet-chip.coins {
  border-color: var(--gv-ink-gold);
}
/* la barra de mision: mas presencia, el raiz se ve poco sobre el panel oscuro */
.mission-bar { background: rgba(0, 0, 0, 0.5); }

/* ============================================================================
   ESTÉTICA VECTORIAL CARTOON · RESTO DE PANTALLAS
   Tienda · Ajustes · Duelo · Inventario · Colección · Constructor de mazos ·
   Modales · Tutorial completo.
   ---------------------------------------------------------------------------
   Misma receta que en el home: contorno del MISMO grosor en los cuatro lados y
   el relieve en dos bandas planas (`box-shadow`, desenfoque cero). Los colores
   del juego no se tocan; se añade lo que faltaba.

   La lista de superficies NO se ha escrito a mano: sale de escanear el propio
   `styles.css` buscando las reglas que declaran `border: 1px solid var(--border-*)`
   junto a un radio — que es como el juego marca una superficie. De ahí salieron
   68, y se repartieron en tres niveles:
     A · superficies grandes   contorno 3px, bandas 4/8
     B · piezas pequeñas       contorno 2px, bandas 2/4
     C · raíles de progreso    hundidos (bandas invertidas) + relleno plano
   Quedaron fuera a propósito las que llevan `clip-path` (las pestañas-banderín
   de la tienda: el recorte se comería el borde) y los `input`.
   ============================================================================ */

/* ---------------- A · superficies grandes ---------------- */
.ui-panel,
.panel,
.home-widget,
.store-panel,
.shop-card,
.pack-modal,
.cl-modal,
.cl-choice,
.filter-sheet,
.filter-dd-menu,
.board-dd-menu,
.buy-done,
.inv-item,
.filter-dd-box,
.builder,
.builder-head,
.grave-modal,
.rx-panel,
.reaction-box,
.log-drawer-sheet,
.duel-settings-modal,
.confirm-modal,
.ui-modal,
.collection-sets,
.cset-row,
.setting-row,
.deck-card,
.start-deck,
.player-bar,
.tut-complete,
.tut-part-card,
.tut-tip,
.start-tutorial-card,
.shop-empty,
.buy-confirm-total {
  border: var(--gv-bw) solid var(--gv-ink);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
/* radios un punto más redondos, que es lo que pide el cartoon */
.store-panel, .pack-modal, .cl-modal, .grave-modal, .duel-settings-modal,
/* (`.login-card` SALIO de estas dos listas de SUPERFICIES: ya no lo es. Es la columna
   flotante del login, sin fondo ni borde, y el retrofit le seguia pintando el contorno de
   tinta y las dos bandas — o sea la caja que se acababa de quitar.) */
.confirm-modal, .ui-modal, .filter-sheet, .tut-complete, .tut-tip { border-radius: 22px; }
.shop-card, .builder, .rx-panel, .reaction-box, .log-drawer-sheet,
.deck-card, .start-deck, .tut-part-card, .start-tutorial-card,
.shop-empty { border-radius: 18px; }
.collection-sets, .cset-row, .setting-row, .cl-choice, .filter-dd-menu,
.builder-head, .home-widget, .ui-panel, .panel, .player-bar, .inv-item { border-radius: 16px; }
/* ============================================================================
   MODAL DE SOBRES ("Your Packs", y la misma chapa que usa la confirmación de compra).
   Ni `.buy-done` ni `.pack-tray-row` estaban en ninguna de las dos listas de arriba:
   se habían quedado con 1px de borde tintado de acento mientras el resto de modales
   del juego llevan 3px de tinta y relieve. Ya entran ahí; aquí van solo los remates
   que el retrofit no puede saber.
   ============================================================================ */
/* La sombra PROYECTADA y el halo de acento los borraría el `box-shadow` del retrofit
   (que lo declara entero), y son los que despegan el modal del velo. Se repiten con
   las bandas delante. */
.buy-done {
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 0 46px -14px color-mix(in srgb, var(--accent, var(--gold)) 60%, transparent);
}
/* El acento de cada colección ya no puede ser el borde (ahora es tinta): pasa a ser una
   BANDA vertical a la izquierda de la fila, que además se lee mejor de un vistazo. */
.pack-tray-row {
  position: relative;
  overflow: hidden;
  padding: clamp(8px, 0.9vw, 12px) clamp(14px, 1.4vw, 20px);
  gap: clamp(12px, 1.4vw, 20px);
}
/* Sin franja lateral: la fila ya se distingue por su contorno y su sobre. */
@media (hover: hover) and (pointer: fine) {
  .pack-tray-row:hover {
    border-color: var(--gv-ink);
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.16),
      inset 0 -4px 0 rgba(0, 0, 0, 0.3),
      0 0 18px -6px color-mix(in srgb, var(--accent, var(--gold)) 75%, transparent);
  }
}
/* El sobre, en su marco: suelto sobre el fondo parecía pegado con cinta. */
/* El sobre, GRANDE y suelto: sin recuadro ni fondo detras — es el producto, no un icono
   dentro de una casilla. La sombra propia es lo que lo despega de la fila. */
.pack-tray-row img {
  width: clamp(92px, 9vw, 128px); height: auto; padding: 0;
  border: none; border-radius: 0; background: none; box-shadow: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6));
}
/* El contador toma el cristal de los demás (lista de arriba) y aquí su forma. */
.pack-tray-count {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 2px solid var(--gv-ink);
}

/* El menú del campo flota: al contorno y las bandas del bloque de arriba le añade una
   sombra proyectada larga, que es lo que lo despega de la fila que tapa. */
.board-dd-menu {
  border-radius: 14px;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 18px 34px -16px rgba(0, 0, 0, 0.9);
}

/* El BOCADILLO del coach (`.tut-bubble`) se queda COMO ESTABA a proposito: su
   cola son dos triangulos CSS calibrados contra un borde de 1px, y engordarlo
   descuadraba el pico. Solo la tarjeta de leccion lleva contorno dorado. */
.tut-part-card { border-color: var(--gold-edge); }

/* ---------------- B · piezas pequeñas ---------------- */
.ui-chip,
.wallet-addr,
.price-chip,
.qty-opt,
.filter-chip,
.filter-btn,
.filter-opt,
.filter-dd-head,
.board-dd-head,
.pack-tray-row,
.cl-dd-head,
.cl-close,
.cl-back,
.db-back,
.db-name,
.db-del,
.cs-toggle,
.icon-btn,
.widget-action,
.avatar-edit,
.deck-del,
.grave-close,
.grave-stat,
.grave-stat-total,
.stage-stat,
.reaction-trap,
.rx-slot-clear,
.drawer-close,
.duel-settings-close,
.account-signout,
.account-row,
.login-oauth,
.pool-card-ctrls,
.coin-sm,
.tut-part-tag,
.tut-skip,
.tut-next,
.shop-back-icon,
.pack-slot,
.start-back,
.builder-count,
.builder-actions,
.cset-count,
.inv-count {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}

/* ---------------- C · raíles de progreso: hundidos ---------------- */
.xp-bar,
.cset-bar {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 4px 0 rgba(0, 0, 0, 0.42),
    inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
/* …y sus rellenos, planos (antes eran degradados de oro) */
.xp-fill,
.cset-fill {
  background: var(--gold);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -3px 0 rgba(140, 88, 8, 0.4);
}

/* ---------------- toques finales ---------------- */
/* las sombras difuminadas de las cartas y los iconos pasan a sombra plana */
.shop-card img,
.deck-card img,
.tut-part-chest,
.tut-coach { filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }

/* ---------------- D · carteles y tooltips del tutorial ---------------- */
/* El chip "TAP TO REPEAT" bajo Larry: pastilla de ORO con contorno de tinta dorada y el
   relieve plano de los botones; letra de titulo. */
.tut-coach-peek {
  font: 400 11px/1 var(--font-display); letter-spacing: 0.06em;
  color: #2a1a04; background: var(--gold-face);
  border: 2px solid var(--gv-ink-gold); border-radius: 999px; padding: 7px 13px 6px;
  box-shadow:
    inset 0 2px 0 var(--gv-hi-gold),
    inset 0 -3px 0 var(--gv-sh-gold),
    0 4px 0 rgba(3, 7, 15, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* El aviso "do the action" del bocadillo: placa oscura con contorno de tinta, texto dorado de
   titulo y la flecha como chapa. */
.tut-hint {
  font: 400 11.5px/1.2 var(--font-display); letter-spacing: 0.06em;
  color: var(--gold-bright); background: linear-gradient(180deg, #1b2439 0%, #0c1220 100%);
  border: 2px solid var(--gv-ink); border-radius: 12px; padding: 8px 12px 7px 10px;
  box-shadow: inset 0 2px 0 var(--gv-hi), inset 0 -3px 0 var(--gv-sh);
  text-shadow: 0 2px 0 rgba(3, 7, 15, 0.6);
}
.tut-hint::before { content: "\25B6"; font-size: 9px; opacity: 1; color: var(--gold); }
/* El boton de plegar el bocadillo: misma pieza pequena que los icon-btn. */
.tut-bubble-hide {
  border: 2px solid var(--gv-ink); border-radius: 9px;
  background: linear-gradient(180deg, #243050 0%, #141c2e 100%); color: var(--gold-bright);
  box-shadow: inset 0 2px 0 var(--gv-hi), inset 0 -3px 0 var(--gv-sh);
}
@media (hover: hover) and (pointer: fine) { .tut-bubble-hide:hover { background: linear-gradient(180deg, #2c3a60 0%, #182238 100%); color: #fff; border-color: var(--gv-ink); } }
/* El tooltip de hover del juego (`installUiTooltips`, game.js): sustituye al globo nativo de los
   `title`. Placa oscura con contorno de tinta, relieve plano y flechita hacia el elemento. */
.ui-tip {
  position: fixed; left: 0; top: 0; z-index: 6000; pointer-events: none;
  max-width: 260px; padding: 7px 11px 6px;
  border: 2px solid var(--gv-ink); border-radius: 10px;
  background: linear-gradient(180deg, #1b2439 0%, #0c1220 100%);
  color: var(--gold-bright);
  font: 700 11px/1.3 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; text-align: center;
  text-shadow: 0 2px 0 rgba(3, 7, 15, 0.6);
  box-shadow: inset 0 2px 0 var(--gv-hi), inset 0 -3px 0 var(--gv-sh), 0 6px 0 rgba(3, 7, 15, 0.45);
  opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .14s ease;
}
.ui-tip.is-on { opacity: 1; transform: none; }
.ui-tip[hidden] { display: none; }
/* La flechita: un cuadrado girado con el mismo contorno, clavado en `--tip-ax` (el centro del
   elemento) — abajo cuando el tooltip va encima, y arriba cuando va debajo. */
.ui-tip::after {
  content: ""; position: absolute; top: 100%; left: var(--tip-ax, 50%);
  width: 10px; height: 10px; margin: -6px 0 0 -5px;
  background: #0c1220; border-right: 2px solid var(--gv-ink); border-bottom: 2px solid var(--gv-ink);
  transform: rotate(45deg);
}
.ui-tip.is-below::after {
  top: auto; bottom: 100%; margin: 0 0 -6px -5px;
  background: #1b2439; border: 0; border-left: 2px solid var(--gv-ink); border-top: 2px solid var(--gv-ink);
}
/* La ficha del cofre (hover en el selector de lecciones) y la de probabilidades del sobre: el
   mismo contorno y relieve que las tarjetas. */
.tut-tip, .pack-odds-tip {
  border: 2px solid var(--gv-ink);
  box-shadow:
    inset 0 2px 0 var(--gv-hi),
    inset 0 -4px 0 var(--gv-sh),
    0 8px 0 rgba(3, 7, 15, 0.45),
    0 26px 60px rgba(0, 0, 0, 0.55);
}
/* el scrim de los modales: plano, sin desenfoque de fondo */
.confirm-overlay,
.duel-settings-overlay,
.cl-overlay,
.grave-overlay,
.builder-overlay { backdrop-filter: none; }

/* Los HUECOS DEL TABLERO (`.slot`, `.spell-slot`) se quedan como estaban a
   propósito: el campo de duelo ya trae su propio marco pintado y un contorno
   grueso ahí pelearía con el arte, además de restarle lectura al arrastrar
   cartas. Si se quiere, es una línea más en la lista de arriba. */

/* ---------------- La barra de navegación ----------------
   Contorno y sombra en la BARRA, no en los iconos (`.nav-item` se queda como
   está). Al ser un raíl pegado al borde de la pantalla no lleva contorno por los
   cuatro lados: la tinta va en el lado que separa del contenido, con una banda de
   luz arriba y una sombra plana proyectada. En tablet/móvil la barra pasa abajo,
   así que el contorno se muda al borde superior. */
.app-nav {
  border-right: 4px solid var(--gv-ink);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.09),
    6px 0 0 rgba(3, 7, 15, 0.45);
}
@media (max-width: 1024px) {
  .app-nav {
    border-right: none;
    border-top: 4px solid var(--gv-ink);
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.09),
      0 -6px 0 rgba(3, 7, 15, 0.45);
  }
}
@media (orientation: landscape) and (pointer: coarse) and (hover: none) {
  .app-shell .app-nav {
    border-right: none;
    border-top: 4px solid var(--gv-ink);
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.09),
      0 -6px 0 rgba(3, 7, 15, 0.45);
  }
}

/* Los banderines de la tienda ya NO pasan por aquí: el widget con su trama diagonal se
   define entero arriba (busca `.store-rail-panel`), borde de tinta y bandas incluidos.
   El bloque que los convertía de banderín a rectángulo se ha eliminado — dejarlo ponía un
   SEGUNDO borde sobre `.store-rail-item`, que ahora es solo la caja de maquetación. */

/* el precio del botón de compra iba en oro claro SOBRE el botón dorado: no se
   leía. Va en la misma tinta que su etiqueta. */
.buy-btn .buy-cost { color: #4a2f16; }
.buy-btn:disabled .buy-cost { color: rgba(52, 34, 16, 0.55); }

/* ============================================================================
   ETIQUETAS DE TEXTO GENÉRICAS EN PARTIDA — fuera
   ---------------------------------------------------------------------------
   Rótulos que repetían con palabras lo que la propia carta o su animación ya
   están diciendo. Se ocultan (no se borra el marcado ni las cadenas de i18n, así
   que revertirlo es quitar este bloque):

     .card-showcase-label   "CPU · SPELL" / "TÚ · TRAP" encima de la carta que se
                            acaba de jugar — la carta está ahí delante, con su
                            tipo y su marco.
     .card-showcase-label.negated  "NEGATED" sobre la carta cancelada, que ya se
                            desvanece con su propia animación (`negateVanish`).
     .done-attack-badge     "ATTACKED" estampado sobre el héroe que ya atacó: la
                            carta YA se ve en gris y atenuada (`.card.done-attack`
                            le pone `grayscale(.55) brightness(.78)`).

   Se MANTIENEN a propósito los rótulos que dicen algo que no se ve: RECOIL y
   BLOCKED del popup de reacción (anticipan el resultado del ataque), el cartel
   de PROOF OF SACRIFICE (nombra una mecánica concreta, no una acción genérica),
   el FX de STUN, los avisos de turno/victoria/derrota y las etiquetas HERO /
   SPECIAL de los huecos vacíos, que son guía de colocación y no un aviso.

   REVERTIDO: `.trap-banner-text` — "CPU ACTIVATES A TRAP" / "ENEMY ACTIVATES A
   SPELL" — vuelve a verse. Se había ocultado dando por hecho que el icono gigante
   del cartelón bastaba, pero el texto grande es justo lo que anuncia la jugada del
   rival antes de revelar la carta. NO volver a meterlo en esta lista.
   ============================================================================ */
.card-showcase-label,
.done-attack-badge { display: none; }

/* ---------------- Botón X de la apertura de sobres ----------------
   Dos cosas:
   1) BUG mío: el bloque de botones del kit pone `position: relative` a toda su
      lista, y `.po-close` ya era `position: absolute`. Al pasar a relativo, su
      `top/left` dejaron de contar desde la pantalla del sobre y pasaron a
      desplazarlo desde su sitio en el flujo — acababa en mitad de la pantalla
      (medido: (54,447) en vez de (22,22)). Vuelve a ser absoluto.
      Comprobado que `.po-close` es el ÚNICO de esa lista que era absoluto.
   2) Y va a la esquina superior DERECHA, que es donde toca. */
.po-close {
  position: absolute;
  left: auto;
  right: clamp(12px, 2vw, 22px);
}

/* El widget grande (banner de la colección) pasa a la DERECHA y la columna
   estrecha (JUGAR + tarjetas) a la izquierda. Se invierte el reparto de las
   columnas para que cada widget conserve el ancho que tenía: antes 1.16fr | 1fr,
   ahora 1fr | 1.16fr. La barra de jugador y la tira de DECKS no se tocan. */
.home2-hero { grid-template-columns: 1fr 1.16fr; }

/* ============================================================================
   CONTADORES — UNA SOLA SUPERFICIE
   ---------------------------------------------------------------------------
   (La segunda mitad, "MISMA CHAPA EN TODAS LAS PESTAÑAS", está justo debajo.)

   Los contadores de monedas se habían quedado con cuatro fondos distintos: el
   del home no tenía NINGUNO (icono y cifra sueltos), el de la tienda era una
   píldora blanca translúcida y los de misiones / inventario / recompensas
   píldoras ÁMBAR OPACAS. Aquí todos pasan al mismo fondo: cristal — translúcido,
   con desenfoque de lo que hay detrás y el relieve del kit (dos bandas planas,
   luz arriba y sombra abajo).

   Solo se toca el FONDO. El contorno y el número conservan su color en cada
   sitio (tinta dorada en misiones/inventario, oro fino en tienda y HUD, ninguno
   en el home) y el icono de la moneda no se toca en ningún caso.

   Entran también las chapas HERMANAS que el CSS ya declaraba "la misma pieza"
   que el monedero — la de sobres de la tienda y los contadores transitorios de
   misiones — porque comparten fila con él y dejarlas atrás rompería la familia.

   Va al final del fichero para ganar por orden a las reglas originales sin
   reescribirlas; borrando el bloque vuelve el aspecto anterior.
   ============================================================================ */
:root {
  /* La cara es casi transparente: un velo de luz arriba que se apaga hacia abajo
     sobre un tinte midnight mínimo. El cuerpo lo pone el DESENFOQUE, no la
     opacidad — que es justo lo que separa el cristal de una píldora oscura. */
  --counter-face:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03) 62%),
    rgba(9, 17, 33, 0.3);
  /* Mismo desenfoque denso que la barra de jugador del duelo (`.player-bar`). */
  --counter-blur: blur(16px) saturate(1.25);
  /* Relieve del kit cartoon: dos bandas PLANAS (desenfoque cero) + una sombra
     proyectada corta que despega la chapa del panel que tenga detrás. */
  --counter-relief:
    inset 0 3px 0 rgba(255, 255, 255, 0.22),
    inset 0 -4px 0 rgba(0, 0, 0, 0.3),
    0 4px 10px -6px rgba(0, 0, 0, 0.7);
}

/* Los `.shop-head-chips > …` hacen falta para ganarle a la regla (0,3,0) de la
   cabecera de la tienda, que declara su propio fondo y `box-shadow: none`. */
.home2-coin,
.wallet-chip,
.shop-head-chips > .wallet-chip,
.shop-head-chips > .wallet-chip.coins,
.shop-packs-chip,
.pack-tray-count,
/* El de packs necesita el `.shop-head-chips >` por lo mismo que el monedero: sin él se
   queda en (0,1,0) y pierde contra la regla de la cabecera de la tienda, que declara su
   propio fondo y `box-shadow: none`. Sin esta línea era el ÚNICO contador de la app que
   seguía plano, y encima al lado del monedero, que sí llevaba el cristal. */
.shop-head-chips > .shop-packs-chip,
.mission-count-chip,
.cs-count,
.db-count,
.inv-count,
.gold-hud {
  background: var(--counter-face);
  -webkit-backdrop-filter: var(--counter-blur);
  backdrop-filter: var(--counter-blur);
  box-shadow: var(--counter-relief);
}

/* El monedero del home no era una chapa, era icono + cifra al aire. Su caja (y la de
   todas las demás) la pone el bloque siguiente; el CONTORNO vuelve aquí. Sin él era el
   único contador de oro sin canto, y sobre el bosque la chapa de cristal se deshacía por
   los bordes. Misma tinta dorada que el de la tienda y misiones (`.wallet-chip.coins`);
   gana a `border: none` de su regla base por orden, no por peso (ambas 0-1-0). */
.home2-coin { border: 2px solid var(--gv-ink-gold); }

/* ============================================================================
   CONTADORES — MISMA CHAPA EN TODAS LAS PESTAÑAS
   ---------------------------------------------------------------------------
   Al fondo común le faltaba la MEDIDA común: cada pestaña traía su chapa
   (HOME 145x42, MISIONES 130x54, TIENDA 135x52, MISIONES-transitoria 97x61) y
   el contador saltaba de tamaño al cambiar de pestaña. Aquí se les da una sola
   caja, un solo icono y una sola cifra.

   `min-width` en lugar de `width`: con estos contenidos (icono + hasta 6 cifras)
   ninguna llega al tope, así que TODAS miden exactamente lo mismo; y si algún
   día una cifra desorbitada no cupiese, esa chapa se ensancha en vez de recortar
   el número. La altura sí es fija, que es lo que las alinea entre pestañas.

   El icono de la mochila va MÁS GRANDE que el resto a propósito y eso se
   conserva: su PNG deja aire alrededor mientras el de la moneda pinta de borde a
   borde, así que a la misma caja se verían de tamaños muy distintos.
   ============================================================================ */
:root {
  --counter-w: clamp(120px, 10.4vw, 152px);
  --counter-h: clamp(44px, 3.6vw, 54px);
  --counter-pad: clamp(10px, 0.9vw, 14px);
  --counter-gap: clamp(6px, 0.6vw, 9px);
  --counter-icon: clamp(28px, 2.5vw, 36px);      /* moneda · libro · mazo */
  --counter-icon-lg: clamp(35px, 3.1vw, 45px);   /* mochila (ver nota arriba) */
  --counter-num: clamp(15px, 1.2vw, 17px);
}

/* Los `.shop-head-chips > …` y el `.wallet-chip.big` hacen falta para ganarle a
   las reglas (0,3,0) / (0,2,0) que ya declaraban medidas propias. */
.home2-coin,
.wallet-chip.big,
.shop-head-chips > .shop-packs-chip,
.shop-head-chips > .wallet-chip,
.shop-head-chips > .wallet-chip.coins,
.mission-count-chip,
.cs-count,
.db-count {
  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--counter-w);
  height: var(--counter-h);
  padding: 0 var(--counter-pad);
  gap: var(--counter-gap);
  border-radius: 999px;
  white-space: nowrap;
}

/* Una sola cifra: familia display, tamaño único y cifras de ancho fijo (sin
   `tabular-nums` la chapa bailaría de ancho al contar hacia arriba). */
.home2-coin b,
.wallet-chip.big b,
.shop-packs-chip b,
.mission-count-chip b,
.cs-count b,
.db-count b {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--counter-num); font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em; line-height: 1;
}

/* Un solo icono. La primera línea repite el selector con `:not()` (0,4,0) que
   dimensiona la moneda más arriba en el fichero — sin ella seguiría a 36 px
   fijos y la chapa no escalaría con la pantalla. */
.wallet-chip.coins:not(.rf-coin-chip) .wallet-icon,
.wallet-chip.big .wallet-icon,
.home2-coin img,
.mission-count-chip img,
.cs-count img,
.db-count img {
  width: var(--counter-icon); height: var(--counter-icon);
  object-fit: contain; display: block; flex-shrink: 0;
}
.shop-head-chips > .shop-packs-chip .shop-packs-icon,
.mission-count-chip.mc-pack img {
  width: var(--counter-icon-lg); height: var(--counter-icon-lg);
}

/* Los dos contadores que NO eran chapa: la colección ("27/80") y el constructor
   de mazos ("0/20"), que eran texto suelto en la esquina. Contorno de tinta como
   el resto de piezas neutras del kit; el color de la cifra no se toca — el del
   constructor sigue cambiando a verde/ámbar según el mazo esté completo. */
.cs-count,
.db-count {
  border: 2px solid var(--gv-ink);
  flex: 0 0 auto;
}
.db-count { color: var(--text-dim); }

/* El "10 items" del inventario es un distintivo del TÍTULO de sección, no una
   chapa de pestaña: conserva su tamaño propio y solo toma la superficie común y
   la forma de píldora (con el contorno de tinta que ya tenía y sin radio, el
   cristal lo dejaba como un rectángulo). */
.inv-count { border-radius: 999px; padding: clamp(6px, 0.5vw, 9px) clamp(14px, 1.2vw, 22px); }

/* En móvil la barra del home va a una línea: la chapa encoge con todo lo demás,
   pero SIGUE siendo la misma en las cinco pestañas porque todas leen los tokens. */
@media (max-width: 560px) {
  :root {
    --counter-w: 104px;
    --counter-h: 34px;
    --counter-pad: 8px;
    --counter-gap: 5px;
    --counter-icon: 22px;
    --counter-icon-lg: 27px;
    --counter-num: 13px;
  }
  .home2-coin { padding: 0 var(--counter-pad); gap: var(--counter-gap); }
}


/* ============== COMBO ATTACK ==============
   Several heroes swing at ONE enemy as a single attack (1 leader + up to 2 supports).
   While the picker is open the board dims and only the pieces that matter stay lit.
   EL COLOR DEL COMBO ES EL ROJO, y el estado se lee por la INTENSIDAD del aura, no por
   un contorno: quien PUEDE entrar late en rojo suave, quien ya esta dentro (lider y
   apoyos) lo lleva encendido y con ascuas subiendo a su alrededor, y el objetivo guarda
   su anillo rojo de siempre. Al cerrarse el combo se va todo solo, porque las clases
   viven con `comboPrompt`. */
.battlefield.combo-picking .slot .card { transition: filter 160ms ease, opacity 160ms ease; }
.battlefield.combo-picking .slot:not(.combo-leader):not(.combo-support):not(.combo-eligible):not(.combo-target) .card {
  filter: grayscale(0.55) brightness(0.62);
  opacity: 0.85;
}
/* EL AURA. Va en `filter: drop-shadow` y NO en `outline`/`box-shadow` a proposito: el
   drop-shadow sigue el ALFA de lo pintado, asi que el halo ABRAZA la silueta de la carta
   —esquinas redondeadas incluidas— en vez de dibujar un rectangulo a su alrededor, que es
   lo que hacia el contorno amarillo. Dos intensidades y nada mas: late suave el que PUEDE
   entrar, late fuerte el que ya esta dentro. */
.slot.combo-eligible { cursor: pointer; }
.slot.combo-eligible .card { animation: comboAuraSoft 1.15s ease-in-out infinite; }
.slot.combo-leader .card,
.slot.combo-support .card { animation: comboAuraHot 0.9s ease-in-out infinite; }
@keyframes comboAuraSoft {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 86, 68, 0.55)) drop-shadow(0 0 11px rgba(214, 26, 26, 0.35)); }
  50%      { filter: drop-shadow(0 0 6px rgba(255, 120, 90, 0.9)) drop-shadow(0 0 22px rgba(226, 32, 24, 0.6)); }
}
@keyframes comboAuraHot {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 150, 110, 0.95)) drop-shadow(0 0 20px rgba(236, 42, 28, 0.75)); }
  50%      { filter: drop-shadow(0 0 10px rgba(255, 206, 150, 1)) drop-shadow(0 0 36px rgba(255, 70, 40, 0.95)); }
}
/* ── SKILL ACTIVA (hoy: Chad FLANQUEADO, su ataque ignora la DEF) ──
   Halo ROJO en el contorno de la carta —`drop-shadow`, que sigue la silueta pintada, no una caja— y unas
   pocas motas subiendo DESPACIO. SIN latido a propósito: esto es un ESTADO que dura mientras dure, y un
   parpadeo lo convertiría en un aviso. Cede ante los estados de acción (atacante elegido, ataque en curso,
   COMBO: sus animaciones mandan sobre esta declaración). */
/* EL HALO es un DEGRADADO CÓNICO rojo↔naranja que GIRA en sentido horario, muy despacio (14 s). No es un
   invento: es el mismo recurso que el aura iridiscente del juego (`PoHalo` — un cónico recortado por el
   MARCO de la carta, de ahí que siga su silueta), sólo que en la gama brasa y a otro ritmo. Lo monta el
   propio `Card` (prop `skillHot`), así que sale igual en el campo, en el peek del hover y en el zoom. */
.skill-halo { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.skill-halo .po-halo-f {
  background: conic-gradient(from var(--haloAngle) at 50% 50%,
    #ff3b1e, #ff7a22, #ffb545, #ff8a24, #e8241a, #ff6a20, #ffa038, #ff3b1e);
  animation-duration: 14s;   /* el PoHalo gira en 3 s; aquí SUTIL */
}
.skill-halo .po-halo-w.hi { filter: blur(3px);  opacity: 0.95; }
.skill-halo .po-halo-w.lo { filter: blur(13px); opacity: 0.75; }
/* ARO DE HECHIZOS (The Dev, `artRingBack`/`artRingFront`): glifos recortados del fondo. La mitad
   DELANTERA va sobre el personaje y, sin el halo que tienen los glifos pintados, se veria plana:
   lleva un brillo suave siempre. En la copia FOIL las dos mitades brillan de verdad y laten. El
   `drop-shadow` sigue el alfa de los glifos, no la caja. */
.art-ring.is-front { filter: drop-shadow(0 0 3px rgba(120, 250, 240, 0.55)); }
.art-ring.is-foil {
  filter: drop-shadow(0 0 3px rgba(150, 255, 245, 0.95)) drop-shadow(0 0 9px rgba(90, 220, 255, 0.75)) drop-shadow(0 0 18px rgba(150, 120, 255, 0.55));
  animation: artRingGlow 2.4s ease-in-out infinite alternate;
}
@keyframes artRingGlow {
  from { opacity: 0.85; }
  to   { opacity: 1; filter: drop-shadow(0 0 4px rgba(190, 255, 250, 1)) drop-shadow(0 0 13px rgba(90, 220, 255, 0.9)) drop-shadow(0 0 26px rgba(150, 120, 255, 0.7)); }
}
@media (prefers-reduced-motion: reduce) { .art-ring.is-foil { animation: none; } }
/* PARALLAX de la copia foil (toda ULTRA de dos capas + `artParallax`): TRES planos de profundidad. El
   MARCO es el plano 0 (quieto); el PERSONAJE va HUNDIDO detras de el (se mueve contra la inclinacion)
   y el FONDO aun mas lejos (se mueve mas). Mas lejos = mas desplazamiento, asi se lee como una ventana.
   (Antes el personaje iba A FAVOR de la inclinacion, "delante" del marco, pero la ventana lo recorta y
   el usuario lo veia pegado al marco.) El fondo va ampliado para que su borde nunca asome. `translate`
   (no `transform`) para no pisar ningun otro transform; la transicion suaviza el puntero y la vuelta. */
.plx-bg, .plx-fg { transition: translate 0.18s ease-out; }
.plx-bg {
  scale: 1.14;
  translate: calc(var(--foil-x, 0) * -6%) calc(var(--foil-y, 0) * -6%);
}
.plx-fg {
  translate: calc(var(--foil-x, 0) * -2.5% * var(--plx-k, 1)) calc(var(--foil-y, 0) * -2%);
}
/* `artParallax: 'grounded'` (Forkhydra, skin Deathbound Larry): el recorte llega CORTADO al borde de
   abajo, asi que el personaje solo puede bajar (hundirse bajo el marco); si subiera asomaria el corte. */
.plx-fg.plx-grounded {
  translate: calc(var(--foil-x, 0) * -2.5% * var(--plx-k, 1)) max(0%, calc(var(--foil-y, 0) * -2%));
}
/* Un plano MAS CERCA que el personaje (`plxFront`: el corredor de Forkhydra): se mueve menos. */
.plx-front { transition: translate 0.18s ease-out; translate: calc(var(--foil-x, 0) * -0.8% * var(--plx-k, 1)) calc(var(--foil-y, 0) * -0.6%); }
.plx-front.plx-grounded { translate: calc(var(--foil-x, 0) * -0.8% * var(--plx-k, 1)) max(0%, calc(var(--foil-y, 0) * -0.6%)); }
/* (`--plx-k`: la capa ANCHA de Forkhydra tiene la caja mas ancha que la ventana; el % horizontal se
   corrige para moverse lo mismo en px. El vertical no hace falta: el alto de la caja no cambia.) */
/* Las capas del fundido de la skin promo ya animan su opacidad: se suman las dos transiciones. */
.plx-fg[class*="promo-art-"] { transition: translate 0.18s ease-out, opacity .12s linear; }
@media (prefers-reduced-motion: reduce) {
  .plx-bg, .plx-fg, .plx-fg.plx-grounded, .plx-front, .plx-front.plx-grounded { translate: none; transition: none; }
}
/* …y la MISMA aura por dentro de la ilustración, pegada al personaje: otro `drop-shadow`, que sigue el
   recorte del PNG (`tpl-art-char`), con el mismo vaivén de tono y en fase con el de fuera. */
.slot.skill-hot .tpl-art-char,
.card-preview-overlay.skill-hot .tpl-art-char,
.card-modal.skill-hot .tpl-art-char {
  animation: skillHotChar 6s ease-in-out infinite alternate;
}
@keyframes skillHotChar {
  from { filter: drop-shadow(0 0 3px rgba(255, 96, 64, 0.95)) drop-shadow(0 0 10px rgba(226, 32, 24, 0.6)); }
  to   { filter: drop-shadow(0 0 3px rgba(255, 168, 62, 0.95)) drop-shadow(0 0 10px rgba(240, 96, 18, 0.6)); }
}
@media (prefers-reduced-motion: reduce) {
  .skill-halo .po-halo-f { animation: none; }
  .slot.skill-hot .tpl-art-char, .card-preview-overlay.skill-hot .tpl-art-char, .card-modal.skill-hot .tpl-art-char {
    animation: none; filter: drop-shadow(0 0 3px rgba(255, 110, 48, 0.95)) drop-shadow(0 0 10px rgba(233, 64, 20, 0.6));
  }
}
.skill-motes { position: absolute; inset: -6% -8% 0; z-index: 5; pointer-events: none; }
.skill-motes i {
  position: absolute; left: var(--x); bottom: 0;
  width: var(--sz); height: var(--sz); border-radius: 50%;
  /* núcleo claro → NARANJA → rojo que se apaga: la misma brasa que el halo */
  background: radial-gradient(circle, #fff0d8 0%, #ffab3d 38%, #ff5a2a 62%, rgba(226, 32, 24, 0) 78%);
  filter: drop-shadow(0 0 3px rgba(255, 120, 40, 0.85));
  opacity: 0;
  animation: skillMote var(--dur) linear var(--delay) infinite;
}
@keyframes skillMote {
  0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
  18%  { opacity: 0.85; }
  78%  { opacity: 0.7; }
  100% { transform: translate3d(var(--dx), calc(var(--rise) * -1), 0) scale(0.3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .skill-motes { display: none; } }

/* LAS ASCUAS del que ya esta dentro: puntitos de fuego que suben alrededor de la carta.
   Son `i` sueltas con su propio retardo y recorrido (los numeros los pone el JSX, fijos y
   no al azar, para que no salten de sitio en cada repintado). */
.combo-embers { position: absolute; inset: -4% -8% 0; z-index: 5; pointer-events: none; }
.combo-embers i {
  position: absolute; left: var(--x); bottom: 0;
  width: var(--sz); height: var(--sz); border-radius: 50%;
  background: radial-gradient(circle, #fff6d0 0%, #ffb03a 42%, rgba(226, 32, 24, 0) 74%);
  filter: drop-shadow(0 0 4px rgba(255, 120, 40, 0.9));
  opacity: 0;
  animation: comboEmber var(--dur) ease-out var(--delay) infinite;
}
@keyframes comboEmber {
  0%   { transform: translate3d(0, 0, 0) scale(0.5); opacity: 0; }
  14%  { opacity: 1; }
  72%  { opacity: 0.85; }
  100% { transform: translate3d(var(--dx), calc(var(--rise) * -1), 0) scale(0.18); opacity: 0; }
}
/* LAS ETIQUETAS. Sin pildora: la palabra SUELTA, en la display del juego y con relleno
   amarillo->rojo (la onomatopeya de FX.combo va en BLANCO desde que el estallido pasó a
   rojo entero; estas van sobre el ARTE de la carta, donde el calido sigue leyendo mejor).
   Lo que la hace legible sobre
   cualquier arte es la SOMBRA, no una caja: contorno de tinta pegado al glifo + una
   proyectada dura debajo. Va en `drop-shadow` y no en `text-shadow` porque el relleno es
   un degradado recortado por el propio texto — un text-shadow se dibujaria por debajo. */
.slot.combo-leader::after,
.slot.combo-support::after {
  content: 'LEADER';
  position: absolute;
  top: 2px; left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  z-index: 7;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(10px, 1.05vw, 14px); letter-spacing: 0.03em; line-height: 1;
  background: linear-gradient(180deg, #fff3b8 0%, #ffc21e 45%, #ff5a1f 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter:
    drop-shadow(0 0 2px rgba(24, 6, 2, 0.95))
    drop-shadow(0 3px 0 rgba(24, 6, 2, 0.75))
    drop-shadow(0 0 8px rgba(255, 90, 31, 0.5));
  pointer-events: none;
}
.slot.combo-support::after { content: 'SUPPORT'; }
.slot.combo-target {
  border-color: var(--ai);
  border-style: solid;
  background: rgba(239, 68, 68, 0.1);
  box-shadow: inset 0 0 34px rgba(239, 68, 68, 0.26), 0 0 22px rgba(239, 68, 68, 0.35);
}
/* The action-bar prompt lives in a ~170px column, so it is two SHORT lines: the title
   in the chip's own display weight, the state underneath in a lighter, smaller body
   face. Without the size drop the second line wraps to three and crowds the buttons. */
.hint.combo-hint {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; line-height: 1.2; padding: 8px 8px;
}
.combo-hint-title { color: var(--gold); font-weight: 800; letter-spacing: 0.06em; font-size: clamp(12px, 1.25vw, 14px); }
.combo-hint-body {
  font-family: var(--font-body); font-weight: 500;
  font-size: clamp(11px, 1.1vw, 13px);
  letter-spacing: 0; opacity: 0.92;
}
.btn.combo-go { letter-spacing: 0.04em; }
/* No supports picked yet: the swing would be the plain (usually pointless) solo attack,
   so it stays a quiet secondary — the allies waiting to be tapped are the real call. */
.duel-action .btn.combo-go.combo-solo {
  background: rgba(8, 11, 20, 0.72);
  color: var(--gold-bright);
  border: 1px solid var(--border-soft);
  font-size: clamp(11px, 1.15vw, 13px);
  min-height: clamp(38px, 4vw, 46px);
}
@media (prefers-reduced-motion: reduce) {
  /* Sin animacion el aura se queda ENCENDIDA (no apagada): es informacion, no adorno. */
  .slot.combo-eligible .card { animation: none; filter: drop-shadow(0 0 5px rgba(255, 100, 80, 0.75)) drop-shadow(0 0 18px rgba(226, 32, 24, 0.5)); }
  .slot.combo-leader .card,
  .slot.combo-support .card { animation: none; filter: drop-shadow(0 0 8px rgba(255, 170, 120, 0.95)) drop-shadow(0 0 28px rgba(255, 70, 40, 0.8)); }
  .combo-embers { display: none; }
}

/* The reaction popup's COMBO badge: the card on screen is the LEADER (the only hero the
   trap can hit) and this names the heroes swinging with it. Sits under the card, where
   the recoil tag sits above it, so the two never collide. */
.rx-card-tag.combo {
  top: auto; bottom: -10px;
  background: var(--gold);
  color: #2a1c04;
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  max-width: 128%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   AVISO DE COMPRA RECHAZADA (tienda)
   Con la compra decidida en el servidor, un fallo —sin oro, sin conexión, choque de
   escrituras— tiene que poder verse. Va FIJO sobre la tienda entera y no dentro de la ficha
   del sobre: el rechazo puede venir de un sobre o de un lote, y cuando aparece ya no queda
   ninguna confirmación abierta de la que colgarlo. Se cierra al tocarlo.
   ============================================================ */
.shop-buy-error {
  position: fixed;
  left: 50%;
  top: 84px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 480px);
  padding: 12px 14px 12px 18px;
  border-radius: 12px;
  border: 2px solid #7a1411;                 /* --ds-red-deep */
  background: linear-gradient(180deg, #e8443a 0%, #c62a22 100%);
  color: #ffd2c7;                            /* --ds-red-light */
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .6);
  cursor: pointer;
  animation: shopBuyErrorIn 220ms cubic-bezier(.18, .9, .3, 1) both;
}
.shop-buy-error-x {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .22);
  color: #ffd2c7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
@keyframes shopBuyErrorIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { .shop-buy-error { animation: none; } }

/* Apertura rechazada por el servidor. El corte se deshace y el sobre sigue siendo del
   jugador, así que esto es un aviso, no un duelo: se toca y se va. */
.po-tear-error {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(90vw, 460px);
  padding: 12px 18px;
  border-radius: 12px;
  border: 2px solid #7a1411;
  background: linear-gradient(180deg, #e8443a 0%, #c62a22 100%);
  color: #ffd2c7;
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .6);
  cursor: pointer;
}

/* Entrar con WALLET. Va con los botones alternativos del login pero se distingue: es la
   puerta que este juego quiere destacar, así que lleva el azul de la marca en vez del gris
   neutro de los de OAuth. */
/* En FILA, como los otros dos: `display: block` estaba puesto para centrar su texto y ahora
   estorba — con el, el icono y el rotulo se apilarian en vez de ponerse uno al lado del otro.
   El centrado lo hace el `justify-content` que ya trae `.login-oauth`. */
.login-oauth.login-wallet {
  display: flex;
  border: 1px solid rgba(116, 182, 255, .45);
  background: linear-gradient(180deg, rgba(63, 142, 240, .22) 0%, rgba(20, 58, 114, .30) 100%);
  color: #c6e6ff;
  text-align: center;
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .login-oauth.login-wallet:hover:not(:disabled) {
    border-color: rgba(116, 182, 255, .75);
    background: linear-gradient(180deg, rgba(63, 142, 240, .32) 0%, rgba(20, 58, 114, .40) 100%);
  }
}
.login-oauth.login-wallet:disabled { opacity: .6; cursor: default; }

/* Añadir correo a una cuenta creada con wallet. Son dos campos y un botón dentro de una
   fila de ajustes, así que se apilan en vertical y se estrechan para no romper la fila. */
.add-email-row { align-items: flex-start; }
.add-email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.add-email-form .login-input { padding: 8px 10px; font-size: 13px; }

/* ============================================================
   CHIP DE GEMS (barra de recursos de HOME)
   Misma forma que el de oro — son dos monedas del mismo juego, no una premium escondida —
   y lo que las distingue es el color: la gema azul contra la moneda dorada, que es la
   pareja de rampas que el sistema de diseño ya tiene (--ds-gold / --ds-blue).
   `.home2-coin.home2-gems` es (0,2,0) igual que el chip de oro base, así que gana por
   ORDEN sin necesidad de subir especificidad — y va al final del fichero a propósito.
   ============================================================ */
.home2-coin.home2-gems {
  border-color: rgba(116, 182, 255, .40);
  background: linear-gradient(180deg, rgba(63, 142, 240, .20) 0%, rgba(20, 58, 114, .28) 100%);
}
@media (hover: hover) and (pointer: fine) {
  .home2-coin.home2-gems:hover {
    border-color: rgba(116, 182, 255, .70);
    background: linear-gradient(180deg, rgba(63, 142, 240, .30) 0%, rgba(20, 58, 114, .38) 100%);
  }
}
.home2-coin.home2-gems b { color: #c6e6ff; }   /* --ds-blue-light */
/* Todos los contadores llevan el redondeado del avatar del HOME (--avatar-corner), no píldora.
   Mismas selecciones que la familia de contadores de arriba; gana por orden (máx. 0-3-0). */
.home2-coin,
.wallet-chip,
.shop-head-chips > .wallet-chip,
.shop-head-chips > .wallet-chip.coins,
.shop-packs-chip,
.shop-head-chips > .shop-packs-chip,
.pack-tray-count,
.mission-count-chip,
.cs-count,
.db-count,
.inv-count,
.gold-hud { border-radius: var(--avatar-corner); }

/* ============================================================
   TIENDA DE COSMÉTICOS
   Reusa la rejilla y la ficha del inventario (`.inv-item`), que ya traen arte, descripción
   y vista previa. Lo único que se añade aquí es el precio, el botón de comprar y el saldo.
   ============================================================ */
.cosmetics-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cosmetics-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cosmetics-sub { flex: 1 1 220px; margin: 0; color: #c9b48a; font-size: 14px; }
.cosmetics-balance {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(116, 182, 255, .40);
  background: linear-gradient(180deg, rgba(63, 142, 240, .20) 0%, rgba(20, 58, 114, .28) 100%);
  color: #c6e6ff; font-weight: 800; font-size: 16px;
}
.cosmetics-msg { margin: 0; }
.gem-sm { width: 15px; height: 15px; object-fit: contain; vertical-align: -2px; }
.gem-md { width: 22px; height: 22px; object-fit: contain; }

/* Un objeto EN VENTA: el precio sustituye a la chapa de "lo tienes", y la ficha no se pinta
   apagada aunque no lo poseas — en la tienda "no lo tienes" no es una carencia, es la
   oferta. Por eso se anula el `.locked` que el inventario sí quiere. */
.inv-item.for-sale { opacity: 1; filter: none; }
.inv-item-tag.gems {
  display: inline-flex; align-items: center; gap: 5px;
  border-color: rgba(116, 182, 255, .45);
  background: rgba(63, 142, 240, .18);
  color: #c6e6ff;
}
/* La ALTURA de los botones la fija LA FILA, no lo que lleva cada uno dentro: el de compra
   la sacaba de su texto (56 px) y el de preview de su icono (40), así que la pareja salía
   descuadrada — y cualquier retoque del precio la volvía a descuadrar. Con `--inv-act-h`
   los dos miden lo mismo pase lo que pase dentro.
   Se mide en `cqw`, o sea contra EL ANCHO DE ESTA FICHA (ver el `container-type` de
   `.inv-item`) y no contra la pantalla: en la columna estrecha de la tienda (ficha de
   ~350 px) la pareja a tamaño fijo no cabe en el pie, se parte en dos líneas y la ficha,
   que tiene ALTO FIJO, se la come. */
.inv-item-actions {
  /* `--inv-act-h` se declara en `.inv-item` (ver alli): el boton de preview, que esta en la
     OTRA columna, tambien la lee. */
  display: inline-flex; gap: 8px; align-items: center;
}
/* El boton de compra de un cosmetico: gema + precio. El aro del kit ya se lleva
   ~30 px de ancho (0.337 x la altura, por lado), asi que el relleno propio va corto. */
/* El PRECIO es la decisión de la ficha: la gema y la cifra se quedaban pequeñas al lado del
   arte del cosmético, así que el botón va con más cuerpo, gema mayor y más aire. Y va
   ALARGADO: una pastilla ancha junto al icono cuadrado del preview separa las dos acciones
   mejor que dos cajas del mismo tamaño. Todo en `cqw` por lo mismo que la altura. */
.inv-item-buy {
  white-space: nowrap; padding: 0 clamp(12px, 4.7cqw, 26px);
  height: var(--inv-act-h); min-height: var(--inv-act-h);
  /* el grosor del 9-slice del kit sale de `--gb-h`: si no sigue a la altura real, el
     contorno del botón de LOTE (el único de esta fila que aún lo pinta) queda fino. */
  --gb-h: var(--inv-act-h);
}
/* Gema y cifra CENTRADAS entre sí. `.buy-cost` no declara `display` en ningún sitio, así
   que aquí era una caja EN LÍNEA: la gema se apoyaba en la línea de base del número y
   quedaba un par de píxeles alta, y el `gap` no pintaba nada. En flex comparten centro. */
.inv-item-buy .buy-cost {
  display: inline-flex; align-items: center; gap: clamp(6px, 2.3cqw, 9px);
  font-size: clamp(17px, 7cqw, 25px); line-height: 1;
}
.inv-item-buy .buy-cost .gem-md { width: clamp(24px, 9.5cqw, 32px); height: clamp(24px, 9.5cqw, 32px); }
/* Ya comprado: el precio sigue a la vista, apagado y sin cursor ni hover. */
.inv-item-buy.gem-btn.is-owned { opacity: 0.4; pointer-events: none; cursor: default; filter: saturate(0.6); }
/* Si aun asi no cabe (pantalla estrecha, precio de 4 cifras), la fila de acciones parte en
   dos lineas en vez de desbordar la ficha. */
.cosmetics-detail .inv-item-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }

/* (El banner del rail para cosméticos era la gema centrada y vivía aquí. Ahora es una
   COMPOSICIÓN —tres gemas, las dos skins y el dorso del clan sobre un gradiente animado— y
   está escrita junto a la del lote, que es de lo que es hermana; buscar `.rail-cosm`.) */

/* El chip de GEMS de la cabecera de la tienda. Va a (0,3,0) igual que el del oro
   (`.shop-head-chips > .wallet-chip.coins`), que es la especificidad que hace falta para
   ganarle al `.wallet-chip` base del retrofit cartoon — ya mordió tres veces, ver lessons.md. */
/* La de MISIONES va en la misma regla y con el mismo peso (0,3,0) a través de su envoltorio:
   así las dos chapas de gems del juego no pueden acabar pintándose distinto. */
.shop-head-chips > .wallet-chip.gems,
.mission-wallet-wrap > .wallet-chip.gems {
  border-color: rgba(116, 182, 255, .40);
  background: linear-gradient(180deg, rgba(63, 142, 240, .20) 0%, rgba(20, 58, 114, .30) 100%);
}
.shop-head-chips > .wallet-chip.gems b,
.mission-wallet-wrap > .wallet-chip.gems b { color: #c6e6ff; }
.wallet-chip.gems:not(.rf-coin-chip) .wallet-icon {
  width: calc(var(--icon-min) * 0.72);
  height: calc(var(--icon-min) * 0.72);
}

/* Una chapa que ADEMAS es un boton: hoy las dos de gems (tienda y misiones), que llevan a
   la recarga igual que el contador del HOME. El aspecto ya se lo da `.wallet-chip`; aqui
   solo se le quita al navegador lo suyo y se le pone el gesto de "esto se pulsa", copiado
   del contador del home (`.home2-coin:hover`) para que las tres puertas se sientan igual.
   El color del hover va aparte y con `.gems`, que es de quien es el azul: `.is-link` no
   deberia decidir el color de una chapa que manana sea de oro. */
.wallet-chip.is-link {
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s var(--ease-out), border-color .15s ease, filter .18s ease;
}
.wallet-chip.is-link:active { transform: translateY(0) scale(0.96); }
.wallet-chip.is-link:focus-visible { outline: 2px solid rgba(116, 182, 255, .9); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .wallet-chip.gems.is-link:hover {
    border-color: rgba(116, 182, 255, .70);
    transform: translateY(-1px);
    filter: brightness(1.10);
  }
}


/* ============================================================
   COSMÉTICOS: dos columnas, pestañas, buscador y catálogo desplazable
   ============================================================ */

/* Ocupa el CENTRO y la DERECHA de la rejilla de la tienda. Con una sola columna la rejilla
   de fichas se quedaba en dos por fila y la mitad derecha de la pantalla vacía: aquí no hay
   escaparate que enseñar a un lado y una ficha de compra al otro, hay un catálogo.
   Y se ESTIRA a lo alto (`align-self: stretch`, contra el `align-items: center` de
   `.store-body`), que es lo que le da a la rejilla un alto contra el que desplazar — sin
   eso crecería con el catálogo y empujaría la tienda entera. */
.cosmetics-detail {
  grid-column: 2 / -1;
  align-self: stretch;
  min-height: 0;
  gap: clamp(12px, 1.6vh, 20px);
}

.cosmetics-filters {
  display: flex; align-items: center; gap: clamp(10px, 1.2vw, 20px); flex-wrap: wrap;
}
/* Las pestañas se quedan del ancho de su contenido; estiradas a toda la fila el fondo del
   grupo se leía como una barra vacía con tres palabras en una esquina. El buscador se va al
   otro extremo con `margin-left: auto`. */
.cosmetics-tabs { flex: 0 1 auto; min-width: 0; margin: 0; }

/* El buscador y la casilla comparten bloque y se van juntos al otro extremo. En pantallas
   estrechas la casilla BAJA (`flex-wrap`) en vez de estrujar el campo. */
.cosmetics-search {
  /* La base de 330 px NO es decorativa: con `flex: 0 1 auto` el bloque se dejaba estrujar
     hasta ~190 px para caber al lado de las seis pestanas, y entonces partia POR DENTRO —
     campo arriba, casilla debajo, descolgada. Con una base que no cabe junto a las pestanas,
     el bloque entero baja a su propia linea y ahi los dos van en fila. */
  flex: 1 1 330px; min-width: min(330px, 100%); margin-left: auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; justify-content: flex-end;
}
.cosmetics-search .settings-input { flex: 0 1 clamp(180px, 22vw, 300px); }

/* ---- LA CASILLA "solo los mios" ----
   El `<input>` de verdad sigue ahi (teclado, lector de pantalla, el estado :checked) pero
   invisible; lo que se ve es el `<span>` hermano. El kit no trae casilla, asi que se pinta
   con lo mismo que todo lo demas: contorno de tinta, luz arriba y sombra abajo. */
.cosm-check {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.cosm-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.cosm-check-box {
  position: relative; flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 6px;
  /* Apagada tiene que VERSE: sobre el fondo del panel un hueco casi negro no se lee como un
     control, se lee como un agujero. Cara clara translucida + el mismo contorno de tinta. */
  background: rgba(255, 255, 255, 0.13);
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), inset 0 -2px 0 rgba(255, 255, 255, 0.12);
  transition: background .14s ease, box-shadow .14s ease;
}
/* La marca es un palito girado con dos bordes — no un glifo: una tipografia distinta la
   pintaria de otro tamano en cada maquina. Se dibuja siempre y se revela con `scale`. */
.cosm-check-box::after {
  content: ""; position: absolute; left: 5.5px; top: 1.5px;
  width: 5px; height: 10px;
  border: solid #2a1c02; border-width: 0 2.5px 2.5px 0;
  transform: rotate(42deg) scale(0);
  transform-origin: center;
  transition: transform .16s var(--ease-out);
}
.cosm-check input:checked + .cosm-check-box {
  background: var(--gold-face);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 2px 7px -2px rgba(245, 193, 74, 0.7);
}
.cosm-check input:checked + .cosm-check-box::after { transform: rotate(42deg) scale(1); }
.cosm-check input:focus-visible + .cosm-check-box { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .cosm-check:hover .cosm-check-box { border-color: var(--gold); } }
.cosm-check-label {
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 0.85vw, 13px);
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap;
}
.cosm-check input:checked ~ .cosm-check-label { color: var(--gold-bright); }
/* ---- LA MISMA PIEZA, EN REDONDO: el apartado de ORDEN.
   Sus tres opciones se excluyen, y esa diferencia se dice con LA FORMA — redonda es "sólo
   una", cuadrada es "las que quieras" —, que es la convención que trae cualquier sistema
   operativo. Sólo cambian el radio y la marca: la casilla, el contorno, el relieve y el
   encendido en oro son exactamente los de arriba, así que las dos se leen como el mismo
   control. La marca deja de ser el palito girado y pasa a ser un PUNTO centrado, porque una
   palomita dentro de un círculo se lee otra vez como casilla. */
.cosm-check.is-radio .cosm-check-box { border-radius: 50%; }
.cosm-check.is-radio .cosm-check-box::after {
  left: 50%; top: 50%; width: 8px; height: 8px;
  border: none; border-radius: 50%; background: #2a1c02;
  transform: translate(-50%, -50%) scale(0);
}
.cosm-check.is-radio input:checked + .cosm-check-box::after { transform: translate(-50%, -50%) scale(1); }
/* El reveal de la trampa DENTRO de la simulación del mazo. `.card-showcase` es `fixed` para
   ocupar la pantalla en el duelo; aquí tiene que quedarse dentro del tablero del preview, así
   que se ancla a él (el `.cl-sim-board` es su contenedor posicionado) y se le baja el z-index
   para no taparle la cabecera al modal. La carta va más pequeña: el cuadro es una ventana, no
   una pantalla. */
.cl-sim-showcase {
  position: absolute; inset: 0; z-index: 8;
}
.cl-sim-showcase .card.preview { width: min(38%, 190px); }
.cl-sim-showcase .card-showcase-label { font-size: 11px; padding: 5px 11px; }
/* Las filas del arrasado llevan MÁS DE UNA carta, al revés que el resto de simulaciones. */
.cl-sim-row.wipe { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2.2vw, 22px); }

/* ---- EL DESPLEGABLE DE FILTROS ----
   Tres casillas sueltas ocupaban mas que el buscador y se partian en pantallas estrechas, asi
   que van dentro de un panel que FLOTA sobre la rejilla (mismo esqueleto que el desplegable de
   campo/clima de los ajustes: `absolute` + z-index, cierre al pulsar fuera). Se viste como el
   resto de la tienda y no como los ajustes: contorno de tinta, cara oscura y acento DORADO
   cuando hay algo puesto (el azul es de los ajustes; aqui manda el oro de la tienda). */
.cosm-filter { position: relative; flex: 0 0 auto; }
.cosm-filter-head {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-ui); font-weight: 800;
  font-size: clamp(11px, 0.85vw, 13px); letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.10), inset 0 -3px 7px rgba(0, 0, 0, 0.42);
  transition: color .14s ease, border-color .14s ease, background .14s ease, transform .1s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .cosm-filter-head:hover { color: var(--text); border-color: var(--gold); } }
.cosm-filter-head:active { transform: scale(0.985); }
.cosm-filter-head:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
/* Con filtros puestos el boton se enciende: el panel esta cerrado casi siempre y la rejilla
   recortada tiene que explicarse desde fuera. */
.cosm-filter.has-sel .cosm-filter-head,
.cosm-filter.open .cosm-filter-head { color: var(--gold-bright); border-color: var(--gold); }
.cosm-filter-count {
  flex: none; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; line-height: 1;
  background: var(--gold-face); color: #2a1c02;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.cosm-filter-caret {
  flex: none; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid currentColor; opacity: .8;
  transition: transform .2s var(--ease-out);
}
.cosm-filter.open .cosm-filter-caret { transform: rotate(180deg); }
/* El panel se ancla a la DERECHA (`right: 0`): el bloque del buscador se alinea a ese lado,
   y abriendolo desde la izquierda se salia del panel en pantallas estrechas. */
.cosm-filter-menu {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 30;
  min-width: 240px; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
  /* OPACO: flota sobre las fichas de la rejilla, y una superficie translucida las dejaria ver. */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), var(--bg-2);
  border: 2px solid var(--gv-ink); border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.10), 0 20px 38px -16px rgba(0, 0, 0, 0.92);
  animation: filterDdOpen 140ms var(--ease-out);
}
/* Los dos apartados, separados por una linea (no por un hueco a secas: dos bloques de casillas
   sin nada en medio se leen como una sola lista de tres). */
.cosm-filter-group { display: flex; flex-direction: column; gap: 9px; }
.cosm-filter-group + .cosm-filter-group {
  padding-top: 12px; border-top: 2px solid rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06);
}
.cosm-filter-title {
  margin: 0; font-family: var(--font-ui); font-weight: 800; font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
}
/* Dentro del panel la casilla es una FILA entera y se puede pulsar en todo su ancho. */
.cosm-filter-menu .cosm-check {
  width: 100%; padding: 5px 6px; border-radius: 9px;
  transition: background .12s ease;
}
@media (hover: hover) and (pointer: fine) { .cosm-filter-menu .cosm-check:hover { background: var(--surface-1); } }
.cosm-filter-menu .cosm-check-label { white-space: normal; }
.cosm-filter-clear {
  align-self: flex-start; margin-top: -2px;
  font-family: var(--font-ui); font-weight: 800; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); background: none; border: none; padding: 4px 6px;
  border-radius: 8px; cursor: pointer; transition: color .12s ease, background .12s ease;
}
@media (hover: hover) and (pointer: fine) { .cosm-filter-clear:hover { color: var(--gold-bright); background: var(--surface-1); } }

.cosmetics-search .settings-input {
  width: 100%; margin: 0;
  font-size: clamp(13px, 1vw, 15px);
}
/* Chrome pinta su propia "x" de borrar en `type="search"`, y sobre un campo oscuro sale
   como un cuadrado claro. Se quita: el campo se vacía seleccionando, como cualquier otro. */
.cosmetics-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* LA REJILLA. `flex: 1 1 auto` + `min-height: 0` la hacen ocupar el hueco que queda entre
   los filtros y el borde de abajo, y ahí dentro DESPLAZA — eso es lo que sustituyó al
   paginador, que obligaba a medir cuántas fichas cabían y a rebobinar a la primera página
   en cada filtro.
   Y la barra se va al borde derecho DE LA PANTALLA: el margen negativo estira la caja hasta
   comerse el aire lateral de `.shop-screen` y el `padding-right` se lo devuelve a las
   fichas, así que lo único que acaba ahí fuera es la barra. `overflow-x: hidden` porque una
   caja más ancha que su columna no debe poder estrenar una barra horizontal.
   `align-content: start` para que una rejilla a medias no reparta sus filas por el centro. */
.cosmetics-grid {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  margin-right: calc(-1 * var(--shop-pad-x));
  padding-right: var(--shop-pad-x);
  align-content: start;
  margin-top: 0;
  /* SÓLO el ancho deseado: la plantilla de columnas (y con ella el mínimo de tres en PC)
     se hereda de `.inv-item-grid`. Aquí la rejilla ocupa dos columnas de la tienda y no la
     pantalla entera, así que el deseado es algo menor. */
  --inv-col: clamp(380px, 26vw, 500px);
}

/* La rejilla se queda con `flex: 1` aunque este vacia, asi que el mensaje caia al FONDO de
   la pantalla, a un palmo de donde se mira. Sin fichas la rejilla se pliega (`:empty`) y el
   mensaje se centra en el hueco que queda. */
.cosmetics-grid:empty { flex: 0 0 auto; }
.cosmetics-empty {
  margin: auto; padding: clamp(18px, 3vh, 34px) 0; text-align: center;
  color: var(--text-dim); font-size: clamp(14px, 1.1vw, 17px);
}

/* El pie de la ficha, en la columna ESTRECHA de la tienda. Ya no comparte fila con
   "funciona con" —esa linea se fue al bloque de texto, a la altura del dibujo—, asi que
   aqui solo quedan los botones de compra. El recorte a UNA línea que hubo ("Wc w…") tampoco
   hace falta: la ficha creció de alto y de ancho y la linea cabe en las dos que hereda.
   El texto completo sigue en el `title`. */
.cosmetics-detail .inv-item-foot { flex-wrap: wrap; gap: 10px; }
.cosmetics-detail .inv-item-actions { margin-left: auto; }

/* Comprar un sobre CON GEMS. Va debajo del botón de oro y en segundo plano a propósito: el
   oro es la moneda principal de sobres y se gana jugando; las gems son el atajo de pago.
   Invertir esta jerarquía convertiría la tienda en una caja registradora. */
.shop-buy-row.shop-buy-gems { flex-direction: column; gap: 6px; margin-top: 10px; }
/* EL LOTE se paga con las DOS monedas y los botones van a la par, mitad y mitad. `.buy-btn`
   trae `width: 100%` (venia de ser hijo unico), asi que sin este `flex` los dos encogerian
   por su contenido y el de oro, que dice mas, se comeria al otro. */
/* ---- EL LOTE, con las DOS monedas a la par ----
   `align-items: stretch` y no el `flex-end` heredado: los dos botones no miden lo mismo por
   su cuenta — el de oro lo pinta el 9-slice del kit y el azul lleva un borde de 3 px que le
   suma 6 de alto — y bajo el mismo rotulo eso se ve. Estirando, la fila los iguala.

   El contenido va en UNA linea (icono + precio). Estuvo apilado mientras los botones decian
   "BUY": con la palabra delante, en un boton de ~155 px de ancho -donde el marco del kit ya
   se lleva ~50 (0.337 x la altura, por lado)- no cabia. Sin ella sobra sitio. */
.bundle-buy-row { align-items: stretch; gap: clamp(10px, 1vw, 16px); }
.bundle-buy-row .buy-btn { flex: 1 1 0; min-width: 0; }

/* ---- `.gem-btn`: TODO boton que gasta gemas ----
   Un solo sitio para el azul, porque son tres botones en tres pantallas (el sobre, el lote y
   los cosmeticos) y tienen que leerse como la misma moneda. El relieve es el del kit
   (`--gv-*`), el mismo de `.gems-banner`, no uno nuevo.

   POR QUE EL SELECTOR VA CON SU ANFITRION DELANTE (`.shop-buy-row .buy-btn.gem-btn`,
   `.ui-btn.gem-btn`) Y NO A SECAS: estos botones estan en el retrofit del UI KIT, que pinta
   `background/border/box-shadow: none !important` sobre `.shop-buy-row .buy-btn` (0,2,0) y
   saca el 9-slice ambar en `::before`/`::after`. Un `.gem-btn` pelado es (0,1,0) y PIERDE —
   con !important y todo, porque entre dos !important gana la especificidad. Ese fue
   exactamente el fallo: el azul quedaba de adorno y el boton seguia saliendo crema. */
.shop-buy-row .buy-btn.gem-btn,
.ui-btn.gem-btn {
  border: var(--gv-bw) solid var(--gv-ink) !important;
  background: var(--gem-face) !important;
  color: var(--gem-text) !important;
  text-shadow: 0 2px 0 rgba(6, 20, 44, 0.55);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 4px 10px -6px rgba(0, 0, 0, 0.7) !important;
}
/* `::before` es la capa de reposo del kit y `::after` la de hover: las dos fuera. */
.shop-buy-row .buy-btn.gem-btn::before, .shop-buy-row .buy-btn.gem-btn::after,
.ui-btn.gem-btn::before, .ui-btn.gem-btn::after { content: none; }
/* El rotulo, otra vez con el anfitrion delante: el retrofit tine `.shop-buy-row .buy-btn
   .buy-main-label` de marron (0,3,0) para que lea sobre el oro, y sobre el azul quedaba
   casi negro. */
.shop-buy-row .buy-btn.gem-btn .buy-main-label,
.shop-buy-row .buy-btn.gem-btn .buy-cost,
.gem-btn .buy-main-label,
.gem-btn .buy-cost { color: var(--gem-text); }
@media (hover: hover) and (pointer: fine) {
  .shop-buy-row .buy-btn.gem-btn:hover:not(:disabled),
  .ui-btn.gem-btn:hover:not(:disabled) {
    background: var(--gem-face-hover) !important;
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.20),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 8px 18px -8px rgba(0, 0, 0, 0.8),
      0 0 16px var(--gem-glow) !important;
  }
}
.shop-buy-row .buy-btn.gem-btn:active:not(:disabled),
.ui-btn.gem-btn:active:not(:disabled) {
  box-shadow:
    inset 0 4px 8px rgba(6, 20, 44, 0.75),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.35) !important;
}
.gem-btn:disabled { opacity: .5; }
.shop-buy-row .buy-btn.gem-btn:disabled .buy-main-label,
.shop-buy-row .buy-btn.gem-btn:disabled .buy-cost,
.gem-btn:disabled .buy-main-label,
.gem-btn:disabled .buy-cost { color: rgba(219, 238, 255, 0.6); }
.gem-btn:focus-visible { outline: 2px solid #7cc0ff; outline-offset: 2px; }

/* ============================================================
   GEMS — el banner de la cabecera y la página de recarga

   La sección de dinero real NO vive en el rail de ofertas. Ahí era un banderín más
   compitiendo con lotes y colecciones, que son otra cosa: aquéllas se compran con oro
   ganado jugando. Aquí tiene una puerta propia en la cabecera y, al abrirla, la pantalla
   entera, sin nada al lado tirando del ojo.

   Todo el bloque usa el vocabulario del kit (`--gv-ink`, `--gv-hi`, `--gv-sh`, `--gv-bw`):
   contorno de tinta, banda de luz arriba, banda de sombra abajo y sombra proyectada corta.
   Es lo que hace que estas piezas se lean como parte de la app y no como un añadido.
   ============================================================ */

/* ---- EL BANNER, entre el título "SHOP" y los contadores ---- */
.gems-banner {
  flex: 1 1 auto; min-width: 0;
  /* Un tope para que en pantallas muy anchas no se estire hasta parecer una barra de
     estado: es un botón, y a partir de cierto ancho deja de leerse como tal. */
  max-width: clamp(280px, 32vw, 520px);
  margin: 0 clamp(12px, 2vw, 40px);
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: clamp(10px, 1.2vw, 18px);
  padding: clamp(10px, 1.3vh, 17px) clamp(16px, 1.5vw, 26px);
  /* RECTANGULAR con las esquinas redondeadas, como los banderines del rail (16px). El
     píldora de antes no pertenecía a ninguna familia de la app. */
  border-radius: 16px;
  border: var(--gv-bw) solid var(--gv-ink);
  background: var(--gem-face);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 4px 10px -6px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transition: transform .14s var(--ease-out), border-color .14s ease, box-shadow .14s ease;
}
/* La luz de arriba, igual que en el resto de chapas: claro arriba que se apaga a media
   altura. Va en un ::after para pintarse POR ENCIMA de las flechas del fondo; el contenido
   se sube con `position: relative` para quedar por delante de las dos capas. */
.gems-banner::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 13px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 46%);
}
.gems-banner > * { position: relative; z-index: 1; }
@media (hover: hover) and (pointer: fine) {
  .gems-banner:hover {
    transform: translateY(-2px);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.20),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 8px 18px -8px rgba(0, 0, 0, 0.8),
      0 0 16px rgba(79, 162, 255, 0.45);
  }
}
.gems-banner:active {
  transform: translateY(1px);
  /* Hundido: bisel invertido, igual que `--gold-relief-press`. */
  box-shadow:
    inset 0 4px 8px rgba(6, 20, 44, 0.75),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.35);
}
.gems-banner:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }

/* ---- EL PATRÓN DE FLECHAS ----
   Dos juegos de rayas diagonales: uno ocupa la mitad de ARRIBA y baja hacia la derecha, el
   otro ocupa la de ABAJO y sube hacia la derecha. Al encontrarse en la línea media forman
   puntas "»" que apuntan a donde lleva el botón.

   LA GEOMETRÍA, para que el bucle no dé un salto:
   un degradado a un ángulo A se repite cada `--arw-p` medido SOBRE SU EJE. Desplazar el
   fondo `dx` en horizontal avanza `dx · sin(A)` sobre ese eje, así que el patrón vuelve a
   caer donde estaba cuando `dx = --arw-p / sin(A)`. Con A = 70° eso son 31.93px, y por eso
   ese número no es redondo: cualquier otro produciría un tirón visible en cada vuelta.
   Los dos ángulos son 70° y -70°, espejo uno del otro, así que comparten el mismo avance. */
.gems-banner-arrows {
  position: absolute; inset: 0; pointer-events: none;
  --arw-p: 34px;                  /* periodo del degradado, sobre su eje */
  --arw-w: 15px;                  /* grosor de la raya */
  --arw-dx: 36.182px;             /* = --arw-p / sin(70deg) */
  --arw-c: rgba(206, 234, 255, 0.20);
  /* Se apagan por la izquierda para no pelearse con el icono y el rótulo, y se dejan ver
     hacia la derecha, que es adonde van. */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 32%, #000 100%);
          mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.35) 32%, #000 100%);
}
/* LAS DOS MITADES, Y POR QUÉ CADA UNA OCUPA LA CAJA ENTERA.
   El primer intento ponía un degradado de media altura arriba y otro de media altura abajo.
   No encajaban: la trama de un `repeating-linear-gradient` se mide desde el CENTRO de su
   caja de fondo, y esas dos cajas tenían centros distintos, así que cada mitad caía con una
   fase diferente y los brazos no llegaban a tocarse.
   Aquí las dos capas cubren la caja COMPLETA — mismo centro— y lo que se recorta es el
   elemento, no el fondo.

   Y LOS ÁNGULOS SON 70° Y 110°, NO 70° Y -70°. Los dos pares dan rayas con la misma
   inclinación, así que a ojo parecen intercambiables, pero sólo 110° es el ESPEJO de 70°
   respecto de la horizontal (180-70). Con -70° la trama se recorre al revés sobre su eje y
   cae desfasada: las rayas quedan paralelas pero descolocadas, y en vez de puntas salen
   bandas partidas. Con 110° la figura es simétrica respecto de la línea media, las dos
   tramas coinciden EXACTAMENTE sobre ella y las puntas cierran solas. */
.gems-banner-arrows::before,
.gems-banner-arrows::after {
  content: ''; position: absolute; inset: 0;
  background-position: 0 0;
  animation: gemsArrows 3.4s linear infinite;
}
.gems-banner-arrows::before {
  clip-path: inset(0 0 50% 0);
  background-image: repeating-linear-gradient(70deg,
    var(--arw-c) 0 var(--arw-w), transparent var(--arw-w) var(--arw-p));
}
.gems-banner-arrows::after {
  clip-path: inset(50% 0 0 0);
  background-image: repeating-linear-gradient(110deg,
    var(--arw-c) 0 var(--arw-w), transparent var(--arw-w) var(--arw-p));
}
@keyframes gemsArrows {
  to { background-position: var(--arw-dx) 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gems-banner-arrows::before, .gems-banner-arrows::after { animation: none; }
}

.gems-banner-icon {
  width: clamp(30px, 2.8vw, 46px); height: clamp(30px, 2.8vw, 46px);
  object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(6, 20, 44, .75));
}
.gems-banner-title {
  min-width: 0;
  font-family: var(--font-display); letter-spacing: .04em;
  font-size: clamp(16px, 1.7vw, 27px); color: #fff; line-height: 1.15;
  text-shadow: 0 2px 4px rgba(6, 20, 44, .8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gems-banner-go {
  margin-left: auto; flex-shrink: 0;
  font-size: clamp(24px, 2.2vw, 36px); line-height: 1; color: #cfe7ff;
  text-shadow: 0 2px 4px rgba(6, 20, 44, .8);
  transition: transform .14s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .gems-banner:hover .gems-banner-go { transform: translateX(4px); } }

/* En pantallas estrechas la cabecera ya va justa con el título y los contadores: el banner
   se queda con el icono y la flecha, que siguen diciendo qué es y que se puede pulsar. */
@media (max-width: 720px) {
  .gems-banner { flex: 0 0 auto; max-width: none; margin: 0 8px; padding: 9px 13px; }
  .gems-banner-title { display: none; }
}

/* ---- LA PÁGINA ---- */
.gems-page {
  /* `flex-shrink: 0`: con `min-height: 0` + centrado, en una pantalla baja (móvil) la
     página se encogía por debajo de su contenido y éste rebosaba por ARRIBA, bajo la
     cabecera y fuera del alcance del scroll. Sin encoger, crece y la tienda hace scroll. */
  flex: 1 0 auto; min-height: 0; align-self: center;
  width: 100%; max-width: 1280px;
  display: flex; flex-direction: column;
  /* Aire entre los tres bloques (cabecera, tramos, letra pequeña). Antes iban demasiado
     apilados para una pantalla que sólo tiene tres cosas. */
  gap: clamp(26px, 4.2vh, 52px);
  /* Centrada, no estirada, la misma decisión que toma `.store-body`: sin esto el contenido
     se pega arriba y deja media pantalla de vacío debajo de la letra pequeña. */
  justify-content: center;
  padding: clamp(8px, 1.6vh, 20px) 0;
}

.gems-page-head { display: flex; align-items: center; gap: clamp(14px, 1.7vw, 26px); flex-wrap: wrap; }
.gems-back { flex: 0 0 auto; }
.gems-page-icon {
  width: clamp(52px, 5.4vw, 84px); height: clamp(52px, 5.4vw, 84px); object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(6, 20, 44, .7));
}
.gems-page-titles { flex: 1 1 260px; min-width: 0; }
.gems-page-title {
  margin: 0; font-family: var(--font-display); letter-spacing: .04em;
  font-size: clamp(30px, 3.8vw, 56px); color: var(--ds-blue-light);
  text-shadow: 0 3px 0 rgba(6, 20, 44, .55), 0 6px 16px rgba(6, 20, 44, .6);
}
.gems-page-sub { margin: 10px 0 0; font-size: clamp(15px, 1.3vw, 22px); color: #c9b48a; }

.gems-msg { margin: 0; font-size: clamp(14px, 1.1vw, 17px); }

/* ---- LOS TRAMOS ---- */
.gem-tier-grid {
  display: grid; gap: clamp(12px, 1.4vw, 22px);
  /* Columnas EXPLÍCITAS y no `auto-fit`. Con `auto-fit` el panel entraba a veces a 3
     columnas y el cuarto tramo se quedaba solo en una fila, justo el más caro, colgando de
     la nada. Los tramos son 5 desde el 04-10-2026: 1×5, o 2×2 con el grande ocupando la
     fila entera debajo, y nunca un huérfano. */
  grid-template-columns: repeat(2, 1fr);
}
.gem-tier:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .gem-tier-grid { grid-template-columns: repeat(5, 1fr); }
  .gem-tier:last-child:nth-child(odd) { grid-column: auto; }
}

.gem-tier {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: clamp(28px, 3.4vh, 42px) clamp(14px, 1.4vw, 24px) clamp(24px, 2.8vh, 34px);
  border-radius: 20px;
  border: var(--gv-bw) solid var(--gv-ink);
  background: var(--gem-face);   /* el MISMO azul del banner: una sola moneda, un solo color */
  /* El mismo relieve del kit que llevan las demás chapas: luz arriba, sombra abajo y una
     proyectada corta que despega la ficha del fondo. */
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 6px 14px -8px rgba(0, 0, 0, 0.75);
  color: var(--ds-blue-light);
  cursor: pointer;
  transition: transform .14s var(--ease-out), box-shadow .14s ease, border-color .14s ease;
}
/* El brillo de arriba. En ::before para que las chapas absolutas (la de mejor precio, el
   porcentaje, el paso en curso) puedan subirse por encima con z-index. */
.gem-tier::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 17px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0) 48%);
}
.gem-tier-icon, .gem-tier-amount, .gem-tier-price { position: relative; z-index: 1; }
.gem-tier-flag, .gem-tier-step { z-index: 2; }

@media (hover: hover) and (pointer: fine) {
  .gem-tier:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.20),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 12px 24px -10px rgba(0, 0, 0, 0.85),
      0 0 22px rgba(79, 162, 255, 0.40);
  }
}
.gem-tier:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 0 5px 10px rgba(6, 20, 44, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.35);
}
.gem-tier:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.gem-tier:disabled { opacity: .55; cursor: default; }

/* El tramo destacado lleva el ORO de la casa, no más azul: es la única forma de que
   sobresalga de una rejilla que ya es toda del mismo color. */
.gem-tier.is-best {
  border-color: var(--gv-ink-gold);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 var(--gv-hi),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 6px 14px -8px rgba(0, 0, 0, 0.75),
    0 0 22px rgba(245, 193, 74, 0.28);
}
.gem-tier-flag {
  /* CENTRADA. Estaba a la izquierda para no chocar con el porcentaje de arriba a la derecha;
     ese porcentaje ya no existe (ahora el desglose va debajo del total), así que la fila de
     arriba está libre y la chapa puede ir donde toca. */
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: 4px 13px; border-radius: 999px;
  border: 2px solid var(--gv-ink-gold);
  background: var(--gold-face); color: #2a1c05;
  font-size: clamp(11px, 0.85vw, 14px); font-weight: 900; letter-spacing: .06em;
  white-space: nowrap;
  box-shadow:
    inset 0 2px 0 var(--gv-hi-gold),
    inset 0 -3px 0 var(--gv-sh-gold),
    0 3px 6px -2px rgba(0, 0, 0, 0.6);
}
.gem-tier-split {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap;
  gap: 4px 8px; position: relative; z-index: 1;
  font-size: clamp(12px, 1.05vw, 17px); font-weight: 800; letter-spacing: .02em;
  line-height: 1.2;
}
/* Lo que dan esos dólares al cambio de entrada: apagado, porque no es la cifra que se
   compra — está para que el regalo de al lado tenga contra qué leerse. */
.gem-tier-split.is-empty { visibility: hidden; }
.gem-tier-base { color: #9db4d4; }
.gem-tier-free { color: #8ce0a8; text-shadow: 0 2px 3px rgba(6, 20, 44, .8); }
.gem-tier-icon {
  /* La caja mide de ALTO lo que el cofre del tramo grande (1,9x) en TODAS las fichas: así
     el cofre cabe dentro de la suya y las cinco siguen igual de altas, con la cifra a la
     misma altura. Las gemas no crecen: `contain` las deja a su tamaño, centradas. */
  --gem-ico: clamp(56px, 5.4vw, 84px);
  width: var(--gem-ico); height: calc(var(--gem-ico) * 1.9); object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(6, 20, 44, .7));
}
/* El cofre del tramo grande: tiene mucho más detalle que una gema y llena la caja entera. */
.gem-tier-icon.is-big { width: calc(var(--gem-ico) * 1.9); }
.gem-tier-amount {
  font-family: var(--font-display); letter-spacing: .02em;
  font-size: clamp(28px, 3vw, 46px); line-height: 1.05; color: #fff;
  text-shadow: 0 3px 0 rgba(6, 20, 44, .5), 0 5px 12px rgba(6, 20, 44, .55);
}
.gem-tier-price {
  font-size: clamp(15px, 1.35vw, 22px); font-weight: 800; color: #f0e4c8;
  letter-spacing: .02em; text-shadow: 0 2px 3px rgba(6, 20, 44, .8);
  /* Al fondo: con 5 columnas el desglose parte en dos líneas en unas fichas y en otras no,
     y sin esto los precios quedaban a alturas distintas. */
  margin-top: auto;
}
/* El paso en curso sustituye visualmente al precio sin moverlo de sitio: la ficha no debe
   cambiar de alto a media compra o la rejilla entera da un salto. */
.gem-tier-step {
  position: absolute; inset: auto clamp(10px, 1.1vw, 16px) clamp(22px, 2.6vh, 32px);
  text-align: center; line-height: 1.25;
  font-size: clamp(11px, 0.9vw, 14px); font-weight: 700; color: #d8c49a;
}
.gem-tier.is-busy .gem-tier-price { visibility: hidden; }

/* BONUS DE PRIMERA COMPRA (2026-10-06): la chapa roja de la esquina, el sumando en oro del
   desglose y la nota de arriba. La chapa va RECTA y CENTRADA, en el sitio de la de POPULAR,
   que no se pinta mientras el tramo tenga su bonus (2026-10-07). */
.gem-tier-first {
  position: absolute; z-index: 2; top: -13px; left: 50%; transform: translateX(-50%);
  padding: 4px 16px; border-radius: 999px;
  border: 2px solid #4a0a06; background: #e0281f; color: #fff;
  font-size: clamp(9px, 0.72vw, 12px); font-weight: 900; letter-spacing: .05em; white-space: nowrap;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .28), inset 0 -3px 0 rgba(0, 0, 0, .22), 0 3px 6px -2px rgba(0, 0, 0, .6);
}
.gem-tier-bonus { flex-basis: 100%; text-align: center; color: var(--gold-bright); text-shadow: 0 2px 3px rgba(6, 20, 44, .8); }
.gems-first-note { border-color: var(--gv-ink-gold); color: var(--gold-bright); }

/* CUENTA ATRAS de una oferta con caducidad (el Welcome Pack): encima de los botones de
   compra, en el cartel del HOME y bajo el nombre en el rail de la tienda. */
.offer-timer {
  display: inline-block; align-self: flex-start; width: fit-content;
  padding: 6px 15px; border-radius: 999px;
  border: 2px solid #4a0a06; background: #e0281f; color: #fff;
  font-size: clamp(14px, 1.25vw, 19px); font-weight: 900; letter-spacing: .05em; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .28), inset 0 -3px 0 rgba(0, 0, 0, .22);
}
/* EL AVISO DE OFERTA (OfferLaunchModal): el cascaron `.buy-done` con el dibujo de la tarjeta
   de OFFERS dentro, la cuenta atras y el precio grande. */
.offer-pop { width: min(480px, 100%); gap: 12px; }
.offer-pop-kicker {
  font-family: var(--font-ui); font-weight: 900; font-size: clamp(11px, 0.9vw, 13px); letter-spacing: .14em;
  color: #ff8a7a;
}
.offer-pop-art { width: 100%; height: clamp(190px, 30vh, 260px); border-radius: 16px; border: 2px solid var(--gv-ink, #070f1d); flex: 0 0 auto; }
.offer-timer.is-pop { align-self: center; font-size: clamp(16px, 1.4vw, 21px); padding: 7px 18px; }
/* LA CHAPA DE REBAJA fuera de OFFERS: en el cartel del HOME cuelga de la esquina de arriba a
   la izquierda del dibujo, y en la ficha del lote, de la de su composicion central. */
.offer-badge.is-home { top: 4%; left: -4%; width: clamp(84px, 8.4vw, 132px); }
/* En movil el dibujo del cartel ocupa todo el ancho y la chapa caia sobre el titulo: va a la
   esquina de arriba a la derecha. */
@media (max-width: 720px) { .offer-badge.is-home { left: auto; right: 3%; top: 3%; width: 76px; } }
/* En la ficha cuelga de la COMPOSICION: pegada a la esquina de arriba a la izquierda de la
   carta (que mide `clamp(180px, 17vw, 270px)` y va centrada), mordiendola. */
.offer-badge.is-stage {
  --bw: clamp(124px, 12vw, 186px);
  z-index: 5; width: var(--bw);
  left: calc(50% - clamp(180px, 17vw, 270px) / 2 - var(--bw) * 0.56); top: calc(var(--bw) * -0.34);
}
.offer-badge.is-stage .offer-badge-txt { font-size: clamp(22px, 2.05vw, 32px); }
/* La cuenta atras de la ficha, en grande bajo el nombre del lote. */
.bundle-stage-head { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.4vh, 16px); }
/* Lotes de emojis: la compra bajo el nombre, centrada y con el ancho de un boton de la ficha. */
.buy-on-stage .bundle-buy-row { width: clamp(220px, 24vw, 340px); margin-top: clamp(2px, 0.6vh, 8px); }
.offer-timer.is-stage {
  align-self: center; position: relative; z-index: 2;
  font-size: clamp(19px, 1.9vw, 29px); padding: 8px 22px; border-width: 3px;
}
.offer-pop-price { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: clamp(26px, 2.6vw, 38px); color: #fff; }
.offer-pop-price b { font-weight: 400; }
.offer-pop-price .gem-md { width: 1em; height: 1em; }

/* En el rail va colgada de la esquina de arriba a la derecha del banner del lote, por encima
   de su ventana (z 2) y de su nombre (z 3). */
.offer-timer.is-rail {
  position: absolute; z-index: 4; top: -9px; right: 8px;
  padding: 3px 9px; font-size: clamp(10px, 0.86vw, 13.5px); letter-spacing: .03em;
}

/* La letra pequeña, sobre una superficie propia con el mismo contorno y relieve. Sin ella
   flotaba suelta al pie de la pantalla; con ella se lee como una nota, que es lo que es. */
.gems-legal {
  margin: 0; max-width: 82ch;
  padding: clamp(12px, 1.6vh, 18px) clamp(14px, 1.4vw, 22px);
  border-radius: 14px;
  border: 2px solid var(--gv-ink);
  background: rgba(8, 18, 38, 0.45);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.07), inset 0 -3px 0 rgba(0, 0, 0, 0.28);
  font-size: clamp(13px, 1.05vw, 17px); line-height: 1.65; color: #a08f6e;
}

/* «Powered by Base», el cierre de la pantalla. Discreto a proposito: es una atribucion de
   infraestructura, no una oferta — tiene que estar y no competir con los tramos.
   El disco de la marca lleva su propio fondo blanco porque el simbolo de Base es una figura
   AZUL con una ranura CALADA: sobre el fondo oscuro del juego la ranura desaparecia y el
   circulo se leia entero, que ya no es su logo. */
.gems-base {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: clamp(14px, 2vh, 22px);
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(12px, 1vw, 14px);
  letter-spacing: 0.04em; color: var(--text-muted);
}
/* SIN disco blanco detras. Lo llevaba la marca ANTERIOR (el circulo con la ranura calada),
   que necesitaba un fondo claro para que la ranura se leyera. El cuadrado es una figura LLENA
   y se pinta sola sobre el fondo oscuro; el disco, ademas, le habria comido las esquinas. */
.gems-base img {
  width: clamp(19px, 1.6vw, 23px); height: clamp(19px, 1.6vw, 23px);
}

/* GET GEMS SIN SCROLL (2026-10-10). En pantalla de escritorio la pagina entera tiene que caber
   en el alto de la ventana: sus medidas pasan a depender del ALTO (vh) y no del ancho, la
   rejilla de tramos se queda con el alto que sobre, y el sticker deja de ocupar una fila propia
   (se monta sobre la de «Powered by Base», que queda centrada y le deja libre la izquierda).
   Por debajo de 900 px de ancho (movil) sigue como estaba, con su scroll. */
@media (min-width: 900px) {
  .gems-page { gap: clamp(8px, 1.7vh, 20px); padding: 0; justify-content: flex-start; }
  .gems-page-icon { width: clamp(36px, 6.4vh, 72px); height: clamp(36px, 6.4vh, 72px); }
  .gems-page-title { font-size: clamp(22px, 4.8vh, 50px); line-height: 1; }
  .gems-page-sub { margin-top: clamp(2px, 0.6vh, 8px); font-size: clamp(12px, 1.9vh, 19px); }
  .gems-page .settings-msg, .gems-msg { padding-top: clamp(5px, 1vh, 12px); padding-bottom: clamp(5px, 1vh, 12px); font-size: clamp(12px, 1.7vh, 16px); }
  .gem-tier-grid { flex: 1 1 auto; max-height: 46vh; margin-top: clamp(6px, 1vh, 12px); }
  .gem-tier { gap: clamp(3px, 0.8vh, 10px); padding: clamp(16px, 2.8vh, 38px) clamp(10px, 1.2vw, 22px) clamp(10px, 2vh, 28px); }
  .gem-tier-icon { --gem-ico: clamp(36px, 7.2vh, 84px); }
  .gem-tier-amount { font-size: clamp(20px, 4.1vh, 46px); }
  .gem-tier-split { font-size: clamp(10px, 1.7vh, 16px); }
  .gem-tier-price { font-size: clamp(12px, 2.1vh, 21px); }
  .gems-legal { max-width: none; padding: clamp(6px, 1vh, 14px) clamp(12px, 1.2vw, 20px); font-size: clamp(10.5px, 1.5vh, 15px); line-height: 1.45; }
  .gems-base { margin-top: 0; min-height: clamp(44px, 7vh, 80px); }
}


/* ---- La barrera de edad reusa el panel `.buy-done`; sólo necesita sitio para el campo. */
.age-gate { max-width: 400px; }
.age-gate-input {
  width: 150px; margin: 6px auto 0;
  text-align: center; font-size: clamp(20px, 2vw, 26px); font-weight: 800; letter-spacing: .14em;
}

/* Cosméticos que SOLO entran en un lote: el botón no dice un precio sino que lleva al lote,
   así que va en ORO (la moneda con la que se compran los lotes) y no en el azul de las gems.
   Y su chapa dice IN PACK, para que se entienda antes de leer el botón. */
.inv-item-buy.pack-btn {
  background: var(--gold-face, linear-gradient(180deg, #ffd76a, #e8a52c));
  color: #3a2506;
  border-color: rgba(0, 0, 0, 0.55);
  font-weight: 800;
  letter-spacing: 0.04em;
}
/* Los pocos cosmeticos que TAMBIEN se venden por oro: un segundo boton, dorado, con la moneda. */
.inv-item-buy.coin-btn {
  background: var(--gold-face, linear-gradient(180deg, #ffd76a, #e8a52c));
  color: #3a2506;
  border-color: rgba(0, 0, 0, 0.55);
  font-weight: 800;
}
/* La vista previa de un efecto de hechizo: un clip del efecto sobre el campo. */
.cl-modal.inv-fxvid-modal { width: min(94vw, 900px); max-width: none; }
.inv-fxvid-body { display: block; padding: 0; }
.inv-fxvid { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #0b0812; }
.inv-item-tag.pack { background: rgba(240, 183, 58, 0.18); color: #f0b73a; border-color: rgba(240, 183, 58, 0.5); }

/* EL BOTÓN DE PREVIEW DE UN OBJETO = el icono de play (`PlayIcon`, dibujado en SVG).
   El botón se queda sin relleno ni borde propios: el dibujo YA trae su caja con su borde y su
   relieve, así que un segundo marco alrededor lo ensuciaba. Lo único que pone el botón es el
   área de pulsación y la reacción al ratón. */
.inv-item-preview.is-icon,
.bundle-row-preview.is-icon {
  padding: 3px;
  background: none;
  border: 0;
  box-shadow: none;
  line-height: 0;
  /* Sin esto el botón heredaría el alto mínimo de `.ui-btn` (44 px) y el icono, que es
     cuadrado, quedaría flotando dentro de un rectángulo vertical. */
  min-height: 0;
  min-width: 0;
  gap: 0;
}
/* En la ficha de un objeto va A LA ALTURA DE LA FILA — la misma que el botón de precio.
   El icono la llena (`PlayIcon size` = alto menos el relleno), así que el botón no crece
   por su cuenta: si cambia `--inv-act-h`, cambia también el `size` del icono. */
.inv-item-preview.is-icon { height: var(--inv-act-h); }
@media (hover: hover) and (pointer: fine) {
  .inv-item-preview.is-icon:hover,
  .bundle-row-preview.is-icon:hover { background: none; }
}
/* LA PLACA DEL KIT, FUERA. `.ui-btn::before/::after` pintan la superficie 9-slice de los
   botones del kit, y con el botón "vacío" seguía asomando por detrás del icono: se veía como un
   contorno claro alrededor del borde negro. Se apaga igual que en `gem-btn`. */
.inv-item-preview.is-icon::before, .inv-item-preview.is-icon::after,
.bundle-row-preview.is-icon::before, .bundle-row-preview.is-icon::after { content: none; }

/* EL BOTÓN DE PREVIEW DE UN OBJETO: UNA SOLA CAJA, gris azulada.
   Antes era la placa BEIGE del kit (`ui-btn-ghost`) con el icono de play dentro — y el
   icono trae su propia caja, con su borde y su relieve —, así que se leía como un botón
   metido dentro de otro botón. Ahora la placa del botón ES la del icono crecida a todo el
   ancho: misma paleta, mismo contorno de tinta y mismo relieve. El triángulo entra en su
   forma `bare` (sin caja) y comparte la caja con la palabra.
   Por eso se apaga aquí la placa 9-slice del kit (`content: none`), igual que en `.is-icon`.
   Teñir esa placa con un filtro (`--gb-tint`) SÍ se probó, y es lo que se descartó: la
   matriz de `hue-rotate` no gira el ámbar hasta un gris azulado sino hasta un malva, y
   `grayscale + sepia` deja el contorno de tinta lavado, sin contorno. Con el dibujo escrito
   el color es exacto y el contorno sigue siendo negro.
   Los tres `!important` son los del retrofit del kit, que apaga `background`/`border`/
   `box-shadow` de TODOS los botones con `!important` para no reescribir las ~30 reglas de
   estado del juego (ver su cabecera): pintar una placa propia obliga a igualar el peso.
   EL ACABADO ES EL DEL BOTÓN DE AL LADO, el de precio (`.gem-btn`), sólo que en gris azulado
   en vez de en azul gema. Los dos comparten fila, así que comparten estructura, que es la
   del kit y la MISMA de todas las superficies del juego (ver el retrofit cartoon):
     · el CONTORNO de tinta, del grosor del kit (`--gv-bw`);
     · el RELIEVE, que son DOS BANDAS PLANAS y sin desenfoque por dentro — luz arriba
       (`--gv-hi-h` de alto) y sombra abajo (`--gv-sh-h`) —, no un degradado;
     · la SOMBRA PROYECTADA corta de debajo, la misma línea que el botón de precio.
   Tuvo un relieve propio (un brillo recortado a media cara, sombras difuminadas y un canto
   duro que se hundía al pulsar) y el problema era justo ése: al lado del botón de gemas de
   su misma fila se leía como una pieza traída de otro juego.
   Las bandas van en su versión CLARA (0.42 / 0.30, el par que el kit usa para las piezas
   doradas y no el de las oscuras): sobre una cara clara, `--gv-hi` / `--gv-sh` no se ven. */
.inv-item-preview {
  border: var(--gv-bw) solid var(--gv-ink) !important;
  border-radius: 12px;
  background: linear-gradient(180deg, #9db5cb 0%, #88a5c0 40%, #7189ab 76%, #56719b 100%) !important;
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.42),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 rgba(12, 22, 44, 0.30),
    0 4px 10px -6px rgba(0, 0, 0, 0.7) !important;
  /* Tinta oscura sobre la cara clara — el marrón del retrofit del kit era para el oro. */
  color: #12203a;
  text-shadow: 0 1px 0 rgba(226, 238, 246, 0.4);
}
.inv-item-preview::before, .inv-item-preview::after { content: none; }
/* Hover y pulsación, otra vez las del botón de precio: la pieza NO se mueve de sitio (eso lo
   hacen los botones sueltos del juego, no los del kit); lo que cambia es la luz. */
@media (hover: hover) and (pointer: fine) {
  .inv-item-preview:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.55),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 rgba(12, 22, 44, 0.30),
      0 8px 18px -8px rgba(0, 0, 0, 0.8) !important;
  }
}
/* HUNDIDA: la banda de luz se va arriba y entra una sombra interior — el bisel al revés. */
.inv-item-preview:active:not(:disabled) {
  filter: brightness(0.95);
  box-shadow:
    inset 0 4px 8px rgba(12, 22, 44, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.35) !important;
}

/* ============================================================================
   ICONO DE PLAY (`PlayIcon`) — el botón de preview de un objeto, dibujado con CSS.
   Un solo elemento con su hijo: la caja lleva el borde, la cara, el relieve y el
   destello; el hijo es el triángulo. Todo en PORCENTAJES de `--s`, así que el
   tamaño se cambia con una variable y el dibujo no se deforma.
   ============================================================================ */
.play-ico {
  --s: 34px;
  position: relative; display: block; box-sizing: border-box;
  width: var(--s); height: var(--s);
  border-radius: 22%;
  /* el borde mide el 4.1 % del lado en el original; nunca menos de 1 px o desaparece */
  border: max(1px, calc(var(--s) * 0.041)) solid #07080c;
  background: linear-gradient(180deg, #90a9c0 0%, #809eb7 34%, #7a97b1 76%, #63799b 100%);
  /* el RELIEVE: luz tendida bajo el filo de arriba y sombra en el fondo. Va en sombras
     interiores y no en un borde claro — un borde dibuja una línea por todo el perímetro y se
     lee como un segundo marco, que es justo lo que había que quitar. */
  box-shadow:
    inset 0 calc(var(--s) * 0.10) calc(var(--s) * 0.11) calc(var(--s) * -0.09) rgba(234, 243, 248, 0.55),
    inset 0 calc(var(--s) * -0.13) calc(var(--s) * 0.13) calc(var(--s) * -0.09) rgba(16, 26, 46, 0.5);
  transition: transform 0.12s ease, filter 0.12s ease;
}
/* El destello: un óvalo pequeño arriba a la izquierda. */
.play-ico::before {
  content: ''; position: absolute; left: 7%; top: 5%; width: 42%; height: 30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(222, 236, 244, 0.85), rgba(222, 236, 244, 0));
}
/* El TRIÁNGULO. El recorte marca el RELLENO claro (del 34.3 % al 72.2 % de ancho y del 26.7 %
   al 69.5 % de alto de la cara, con la punta a media altura) y el contorno lo ponen unas
   sombras proyectadas alrededor: `clip-path` no sabe dibujar un borde. Ocho direcciones para
   que el trazo sea igual de grueso en las diagonales que en la vertical. */
.play-ico i {
  position: absolute; inset: 0;
  background: #3d5573;
  /* El CONTORNO: el mismo triángulo crecido 3.4 % del lado hacia fuera. Los vértices salen de
     escalar los del relleno desde el INCENTRO (46.8 %, 48.1 %) por 1.272 — así el trazo queda
     igual de grueso en los tres lados, que es lo que no da un escalado desde el centro. */
  clip-path: polygon(30.9% 20.9%, 79.1% 48.1%, 30.9% 75.3%);
}
/* Y el RELLENO claro encima, con las medidas del icono de referencia. Son DOS capas recortadas
   y no un `filter: drop-shadow` porque `clip-path` se aplica DESPUÉS del filtro: la sombra se
   dibujaba y el recorte se la comía entera, así que el triángulo salía sin contorno. */
.play-ico i::after {
  content: ''; position: absolute; inset: 0;
  background: #e7edeb;
  clip-path: polygon(34.3% 26.7%, 72.2% 48.1%, 34.3% 69.5%);
}
@media (hover: hover) and (pointer: fine) { .is-icon:hover .play-ico { transform: scale(1.08); filter: brightness(1.08); } }
.is-icon:active .play-ico { transform: scale(0.95); }
/* SIN CAJA (`PlayIcon bare`): sólo el triángulo, del color de la letra (`currentColor`), así
   que el símbolo y la palabra se leen como una sola marca. Se usa cuando el botón que lo
   contiene YA es esta misma placa (`.inv-item-preview`).
   ESQUINAS REDONDEADAS: `clip-path` no sabe redondear un vértice, así que aquí el triángulo
   deja de ser un recorte y pasa a ser una MÁSCARA SVG. El redondeo no está dibujado punta a
   punta: es el propio trazo del `path`, que va con `stroke-linejoin: round` y del mismo
   color que el relleno — un contorno redondeado sobre su propia figura ES la figura con las
   esquinas romas. El grosor del trazo (4 de 24) es el radio, y por eso el triángulo del
   `d` va un poco metido hacia dentro: el trazo lo devuelve a su tamaño.
   `mask` y no `background-image`: así el dibujo sigue a `currentColor` como antes. */
.play-ico.is-bare {
  border: 0; border-radius: 0; background: none; box-shadow: none;
}
.play-ico.is-bare::before { content: none; }
.play-ico.is-bare i {
  clip-path: none;
  background: currentColor;
  -webkit-mask: var(--play-tri) center / 100% 100% no-repeat;
          mask: var(--play-tri) center / 100% 100% no-repeat;
}
.play-ico.is-bare i::after { content: none; }
:root {
  --play-tri: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.6 6.4 L17.4 12 L8.6 17.6 Z' fill='%23fff' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
}


/* ==========================================================================
   THE GAMBLER'S DIE (DiceRollOverlay) — same stage as the coin flip: a fixed dim, a title
   that fades once the cube is rolling, FX.dice in the middle (fx-effects.css owns the cube)
   and the outcome line that slides up when it stops. `--dice-tint` = whose roll it is.
   ========================================================================== */
.dice-roll {
  --dice-tint: 96, 165, 250;                      /* the player's blue */
  position: fixed;
  inset: 0;
  z-index: 133;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 46%, rgba(10, 14, 32, 0.62) 0%, rgba(3, 5, 12, 0.88) 78%);
  animation: coinDimIn 320ms ease both;
  touch-action: none;
}
.dice-roll.is-ai { --dice-tint: 248, 113, 113; }  /* the CPU's red */
.dice-roll.ph-out { animation: coinDimOut var(--dice-out, 320ms) ease both; }
.dice-title {
  position: absolute;
  top: 9vh; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(20px, 4.4vh, 40px);
  letter-spacing: 0.08em;
  color: #fff3cf;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 22px rgba(245, 193, 74, 0.55);
}
.dice-who {
  position: absolute;
  top: calc(9vh + clamp(26px, 5.4vh, 48px)); left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(12px, 2.2vh, 18px);
  letter-spacing: 0.14em;
  color: rgb(var(--dice-tint));
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}
/* The FX.dice host: a square the cube's bounce can overflow (it starts 2.4 sides up). */
.dice-stage {
  position: relative;
  width: clamp(52px, 9.5vh, 92px);
  height: clamp(52px, 9.5vh, 92px);
  margin-top: 6vh;
}
.dice-result {
  position: absolute;
  bottom: 12vh; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 260ms ease, transform 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.dice-roll.ph-result .dice-result, .dice-roll.ph-out .dice-result { opacity: 1; transform: none; }
.dice-result b {
  font-family: var(--font-display);
  font-size: clamp(34px, 8vh, 72px);
  line-height: 1;
  color: #ffd75e;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 200, 70, 0.55);
}
.dice-roll.is-bad .dice-result b { color: #ff7b7b; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 90, 90, 0.5); }
.dice-result span {
  font-family: var(--font-display);
  font-size: clamp(13px, 2.6vh, 22px);
  letter-spacing: 0.08em;
  color: #fff3cf;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  text-align: center;
  padding: 0 16px;
}

/* ---------------- AMIGOS (pestaña FRIENDS) ----------------
   Mismas piezas que MISIONES: `.shop-screen` de marco, `.mission-card` de fila, el
   segmentado `.mission-tabs` y el `.settings-input` de AJUSTES. Aquí solo lo propio: el
   avatar con su punto de conectado, la línea de nivel + ID y el hueco de acciones. */
.friends-myid { display: flex; align-items: center; gap: 10px; min-width: 0; }
.friends-myid-label {
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
.mission-card.friends-add { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 22px; padding: 18px 20px; }
.friends-add .mission-desc { margin-bottom: 0; }
.friends-search { display: flex; gap: 10px; max-width: 620px; }
.friends-search-input { flex: 1 1 auto; width: auto; font-family: var(--font-display); letter-spacing: 0.1em; }
.friends-search-input::placeholder { font-family: var(--font-ui); letter-spacing: 0.02em; }
.friends-msg { max-width: 620px; }
/* la ficha encontrada va HUNDIDA dentro del panel de búsqueda, no como otra tarjeta */
.friends-add .friend-row { max-width: 620px; background: rgba(0, 0, 0, 0.26); box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.3); }

.mission-card.friend-row { padding: 12px 16px; gap: 14px; }
.friend-row.is-online { border-color: rgba(74, 222, 128, 0.6); }
.friend-avatar { position: relative; flex: 0 0 auto; width: 58px; height: 58px; border-radius: var(--av-radius, 22%); }
.friend-row:not(.is-online) .friend-avatar .home2-avatar-face img { filter: saturate(0.55) brightness(0.85); }
.friend-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  background: #5b6577; border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25);
}
.friend-dot.on { background: #3ddc6b; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 8px rgba(61, 220, 107, 0.7); }
.friend-avatar .friend-dot { position: absolute; right: -1px; bottom: 1px; width: 18px; height: 18px; border-width: 3px; }
.friend-avatar .friend-dot.on { animation: friendPulse 2.4s ease-in-out infinite; }
@keyframes friendPulse {
  0%, 100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 4px rgba(61, 220, 107, 0.5); }
  50%      { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 12px rgba(61, 220, 107, 0.95); }
}
@media (prefers-reduced-motion: reduce) { .friend-avatar .friend-dot.on { animation: none; } }
.friend-body { display: flex; flex-direction: column; gap: 3px; }
.mission-name.friend-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-meta { display: flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-weight: 800; font-size: 12px; color: var(--text-muted); }
.friend-lvl { color: var(--gold-bright); letter-spacing: 0.06em; }
.friend-code { letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.friend-status { font-family: var(--font-ui); font-weight: 700; font-size: 12.5px; color: var(--text-dim); }
.friend-status.is-on { color: #6ee79a; }
.friend-status.is-in { color: var(--gold-bright); }
.friend-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.friend-actions .ui-btn { min-height: 40px; padding: 9px 14px; font-size: 13px; }
.friend-remove.armed { color: #fecaca; border-color: rgba(239, 68, 68, 0.6); }
.friend-tag {
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--gv-ink, #070f1d);
}
.friend-tag.is-friend { color: #6ee79a; }
.friends-tab-count { margin-left: 4px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.friends-online-chip { display: inline-flex; align-items: center; gap: 8px; }
.friends-screen .shop-section-title:first-of-type { margin-top: 18px; }
.friends-empty { margin-top: 4px; }
.friends-list + .friends-empty { margin-top: 0; }
.friends-list:empty { display: none; }

@media (max-width: 560px) {
  .friends-screen .shop-head { flex-wrap: wrap; }
  .friends-myid { flex: 1 1 100%; justify-content: flex-start; }
  /* el HOME esconde el chip compacto por debajo de 600 px; aquí sí cabe y es donde se da */
  .friends-myid .player-code.compact { display: inline-flex; }
  .friends-search { flex-direction: column; }
  .mission-card.friend-row { flex-wrap: wrap; gap: 12px; }
  .friend-avatar { width: 50px; height: 50px; }
  .friend-row .friend-body { flex: 1 1 0; }
  /* dos botones (aceptar/rechazar) bajan a su propia línea; uno solo cabe al lado */
  .friend-actions:has(> :nth-child(2)) { flex: 1 1 100%; }
  .friend-actions:has(> :nth-child(2)) .ui-btn { flex: 1 1 0; }
}

/* SEIS pestañas en la barra lateral: con la altura de un portátil (720-860 px) los iconos
   de 74 px ya no caben y AJUSTES se salía por abajo. Se encogen con la altura. */
@media (min-width: 1025px) and (max-height: 860px) {
  .app-nav { gap: 4px; padding-top: max(10px, var(--safe-t)); padding-bottom: 10px; }
  .nav-item { padding: 8px 6px; gap: 8px; }
  .nav-icon { width: clamp(46px, 7.4vh, 74px); height: clamp(46px, 7.4vh, 74px); }
}

/* ---------------- CHAT ENTRE AMIGOS (#/friends/chat/<ID>) ----------------
   La pantalla NO hace scroll entera: la cabecera y el cuadro de escribir quedan fijos y
   solo se desplaza el registro de mensajes. Burbujas: las mías en oro a la derecha, las
   del amigo en azul tinta a la izquierda (misma receta de relieve que los paneles). */
.friend-chat-btn { position: relative; }
.friend-chat-btn .mission-tab-badge { top: -8px; right: -8px; }
.shop-screen.chat-screen { display: flex; flex-direction: column; overflow: hidden; max-width: min(980px, 94vw); }
.chat-head { margin-bottom: clamp(12px, 1.6vw, 20px); flex: 0 0 auto; }
.chat-title { gap: 14px; }
.chat-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-who .friend-name { font-size: clamp(20px, 2vw, 26px); }
.mission-card.chat-panel {
  flex: 1 1 auto; min-height: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden;
}
.chat-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 10px;
}
.chat-older { align-self: center; min-height: 34px; padding: 7px 14px; font-size: 12px; margin-bottom: 8px; }
.chat-empty { margin: auto; text-align: center; font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text-muted); padding: 24px; }
.chat-day { display: flex; justify-content: center; margin: 10px 0 4px; }
.chat-day span {
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); background: rgba(0, 0, 0, 0.3); border-radius: 999px; padding: 4px 12px;
}
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 560px); }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-bubble {
  font-family: var(--font-body, var(--font-ui)); font-weight: 600; font-size: 17px; line-height: 1.4; color: var(--text);
  padding: 9px 14px; border-radius: 16px 16px 16px 5px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: linear-gradient(180deg, rgba(58, 84, 132, 0.95), rgba(34, 52, 88, 0.95));
  border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.chat-msg.mine .chat-bubble {
  color: #2a1c02; border-radius: 16px 16px 5px 16px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(140, 88, 8, 0.4);
}
.chat-meta { font-family: var(--font-ui); font-weight: 700; font-size: 12px; color: var(--text-muted); margin: 3px 6px 0; font-variant-numeric: tabular-nums; }
.chat-seen { color: #6ee79a; }
.chat-compose {
  flex: 0 0 auto; display: flex; gap: 10px; padding: 12px 14px;
  border-top: 2px solid var(--gv-ink, #070f1d); background: rgba(0, 0, 0, 0.22);
}
.chat-input { flex: 1 1 auto; width: auto; font-size: 17px; }
.chat-err { margin: 0 14px 12px; }
@media (max-width: 560px) {
  .chat-log { padding: 12px 10px 8px; }
  .chat-msg { max-width: 86%; }
  .chat-compose { padding: 10px; }
}

/* ---------------- PAGINA CHAT (#/chat/<ID>) ----------------
   Sin scroll de pagina: las conversaciones en una columna a la IZQUIERDA (se desplaza ella
   sola) y el chat activo ocupando el resto, con el mismo panel que el chat de FRIENDS. En
   estrecho (<= 720 px) se ve UNA de las dos: la lista, o el chat elegido con su flecha. */
.shop-screen.chat-page { display: flex; flex-direction: column; overflow: hidden; }
.chat-page > .shop-head { flex: 0 0 auto; }
.chat-page-layout {
  flex: 1 1 auto; min-height: 0; display: grid; gap: clamp(14px, 1.6vw, 24px);
  grid-template-columns: clamp(260px, 26vw, 360px) minmax(0, 1fr);
}
.mission-card.chat-list {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  flex-direction: column; align-items: stretch; gap: 4px; padding: 8px;
}
.chat-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left;
  padding: 10px; border-radius: 14px; border: 2px solid transparent; background: transparent;
  color: inherit; cursor: pointer; transition: background .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .chat-row:hover { background: rgba(255, 255, 255, 0.06); } }
.chat-row:focus-visible { outline: 3px solid #fff3c4; outline-offset: -2px; }
.chat-row.is-active { background: rgba(245, 193, 74, 0.14); border-color: rgba(245, 193, 74, 0.55); }
.chat-row .friend-avatar { flex: 0 0 auto; }
.chat-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-row-top .friend-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.chat-row-time { flex: 0 0 auto; font-family: var(--font-ui); font-weight: 700; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chat-row-snippet {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--text-dim);
}
.chat-row.has-unread .chat-row-snippet { color: var(--text); font-weight: 800; }
.chat-row.has-unread .chat-row-time { color: var(--gold-bright); }
.chat-row-typing { color: #6ee79a; font-style: italic; }
.chat-row-empty { color: var(--text-muted); font-style: italic; }
.chat-row-badge { position: static; flex: 0 0 auto; }
.chat-list-empty {
  margin: auto; padding: 24px 14px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text-muted);
}
.chat-page-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-pane .chat-head { margin-bottom: clamp(8px, 1.2vw, 14px); }
.chat-pane .chat-back { display: none; }          /* solo en estrecho, para volver a la lista */
.chat-delete-btn { margin-left: auto; color: #ffb4a8; }
.mission-card.chat-page-empty {
  flex: 1 1 auto; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
  font-family: var(--font-ui); font-weight: 700; font-size: 15px; color: var(--text-muted);
}
.chat-page-empty img { width: 72px; height: 72px; object-fit: contain; opacity: 0.55; }
.chat-delete-modal { flex-direction: column; align-items: stretch; gap: 16px; max-width: min(460px, 92vw); }
/* Escritorio: la BANDEJA es una columna a toda altura PEGADA al borde izquierdo (junto al rail
   del nav) con el titulo CHAT y el volver ENCIMA de la lista; el chat ocupa la otra columna de
   arriba abajo, centrado y con tope de ancho. El envoltorio `.chat-page-layout` se disuelve
   (`display: contents`) para que cabecera, lista y chat sean celdas de la misma rejilla. El
   panel de la columna es el `::before` (tambien celda): asi titulo y lista comparten fondo. */
@media (min-width: 721px) {
  .shop-screen.chat-page {
    display: grid; grid-template-columns: clamp(280px, 24vw, 360px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr); column-gap: clamp(20px, 3vw, 56px);
    padding: 0 clamp(16px, 3vw, 56px) 0 0;
    max-width: none; margin: 0;   /* sin el tope centrado de .shop-screen: la lista va al borde */
  }
  .chat-page::before {
    content: ''; grid-column: 1; grid-row: 1 / span 2;
    background: linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
    border-right: var(--gv-bw) solid var(--gv-ink);
    box-shadow: 6px 0 18px rgba(0, 0, 0, 0.28);
  }
  .chat-page-layout { display: contents; }
  .chat-page > .shop-head {
    grid-column: 1; grid-row: 1; position: relative; z-index: 1; margin: 0;
    padding: max(clamp(18px, 3vh, 32px), var(--safe-t)) 16px clamp(10px, 1.6vh, 16px);
  }
  .chat-page > .shop-head h2 { font-size: clamp(30px, 2.6vw, 44px); }
  /* el volver, a la DERECHA del titulo (al final de la cabecera de la columna) */
  .chat-page > .shop-head .shop-title { flex: 1 1 auto; }
  .chat-page > .shop-head .shop-back-icon { order: 3; margin-left: auto; }
  .mission-card.chat-list {
    grid-column: 1; grid-row: 2; margin: 0; height: 100%; position: relative; z-index: 1;
    background: none; border: 0; border-radius: 0; box-shadow: none;
    padding: 0 10px 14px;
  }
  .chat-page-main {
    grid-column: 2; grid-row: 1 / span 2; width: 100%; max-width: 1180px; justify-self: center;
    padding: max(clamp(18px, 3vh, 32px), var(--safe-t)) 0 clamp(18px, 3vh, 36px);
  }
}
@media (max-width: 720px) {
  .chat-page-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-page-layout:not(.has-active) .chat-page-main { display: none; }
  .chat-page-layout.has-active .chat-list { display: none; }
  .chat-pane .chat-back { display: inline-flex; }
  /* solo la lista: ninguna fila esta "abierta"; y con un chat abierto, una sola flecha (la del chat) */
  .chat-page-layout:not(.has-active) .chat-row.is-active { background: transparent; border-color: transparent; }
  .chat-page.has-active > .shop-head { display: none; }
}

/* "está escribiendo…": burbuja del amigo con tres puntos que saltan en ola */
.chat-typing .chat-bubble { display: flex; }
/* Mide EXACTAMENTE una línea de texto (1.4em = el line-height de la burbuja) y hereda su
   padding: la burbuja de escribiendo tiene la misma altura que un mensaje de una línea. */
.chat-typing-dots { display: inline-flex; gap: 5px; align-items: center; height: 1.4em; }
.chat-typing-dots i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); display: block;
  animation: chatTypingDot 1.1s ease-in-out infinite;
}
.chat-typing-dots i:nth-child(2) { animation-delay: .15s; }
.chat-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chatTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30%           { transform: translateY(-5px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .chat-typing-dots i { animation: none; opacity: .8; } }

/* Selector de emojis del chat: botón redondo a la izquierda del campo y panel que sube
   por encima de la barra de escribir. */
.chat-compose { position: relative; align-items: center; }
.chat-emoji { position: static; flex: 0 0 auto; }
.chat-emoji-btn {
  width: 46px; height: 46px; border-radius: 12px; cursor: pointer; font-size: 24px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: rgba(0, 0, 0, 0.34); border: 2px solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.3);
  filter: grayscale(0.35); transition: transform .12s var(--ease-out), filter .15s, border-color .15s;
}
.chat-emoji-btn.on { filter: none; border-color: var(--gold); transform: translateY(-1px); }
@media (hover: hover) and (pointer: fine) { .chat-emoji-btn:hover { filter: none; border-color: var(--gold); transform: translateY(-1px); } }
.chat-emoji-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.chat-emoji-panel {
  position: absolute; left: 12px; bottom: calc(100% + 8px); z-index: 5;
  width: min(420px, calc(100% - 24px)); max-height: 260px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; padding: 10px;
  background: linear-gradient(180deg, #213252, #0e1830);   /* opaco: los mensajes de detrás no se transparentan */
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); border-radius: 16px;
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.1)), 0 12px 28px rgba(0, 0, 0, 0.55);
  animation: chatEmojiIn .16s var(--ease-out);
}
@keyframes chatEmojiIn { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
.chat-emoji-opt {
  height: 42px; font-size: 24px; line-height: 1; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; transition: background .12s, transform .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .chat-emoji-opt:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.15); } }
.chat-emoji-opt:active { transform: scale(0.95); }
.chat-emoji-opt:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
@media (max-width: 560px) { .chat-emoji-btn { width: 42px; height: 42px; font-size: 22px; } }
/* STICKERS: the button wears one of the stickers; the panel reuses the emoji panel's box with
   bigger cells. A sticker message has no bubble: the die-cut PNG already carries its white
   outline, so it sits straight on the log. */
.chat-sticker-btn img { width: 34px; height: 34px; object-fit: contain; display: block; }
.chat-sticker-panel {
  width: min(460px, calc(100% - 24px)); max-height: 300px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px;
}
.chat-sticker-opt {
  aspect-ratio: 1; padding: 6px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; transition: background .12s, transform .12s var(--ease-out);
}
.chat-sticker-opt img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .chat-sticker-opt:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); transform: scale(1.08); } }
.chat-sticker-opt:active:not(:disabled) { transform: scale(0.95); }
.chat-sticker-opt:disabled { opacity: 0.5; cursor: default; }
.chat-sticker-opt:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
.chat-sticker {
  width: clamp(110px, 16vw, 150px); height: auto; display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
  transform-origin: 30% 90%;
}
.chat-msg.mine .chat-sticker { transform-origin: 70% 90%; }
/* The POP: from nothing, overshoots, squashes back and settles with a small wobble. */
.chat-sticker.pop { animation: chatStickerPop .62s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes chatStickerPop {
  0%   { transform: scale(0) rotate(-14deg); opacity: 0; }
  45%  { transform: scale(1.22) rotate(5deg); opacity: 1; }
  65%  { transform: scale(0.9) rotate(-3deg); }
  82%  { transform: scale(1.05) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .chat-sticker.pop { animation: none; } }
@media (max-width: 560px) {
  .chat-sticker-btn img { width: 30px; height: 30px; }
  .chat-sticker-panel { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
}

/* Sugerencias de amigos: tres fichas en fila (una por línea en móvil) con el botón de
   "otros 3" al final de la línea del título. */
.friends-sugg { margin-bottom: 22px; }
.friends-sugg-title { margin-top: 0; }
.friends-sugg-new { order: 3; min-height: 34px; padding: 7px 14px; font-size: 12px; gap: 7px; }
.friends-sugg-ico { display: inline-block; font-size: 15px; line-height: 1; }
.friends-sugg-ico.spin { animation: friendsSpin .7s linear infinite; }
@keyframes friendsSpin { to { transform: rotate(360deg); } }
.friends-sugg-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); transition: opacity .15s; }
.friends-sugg-list .friend-row { padding: 12px 14px; }
.friend-meta { white-space: nowrap; }
/* en fila de 3 (y en móvil) el botón baja debajo de la ficha y ocupa todo el ancho: al lado
   se comía el nombre */
.friends-sugg-list .mission-card.friend-row { flex-wrap: wrap; }
.friends-sugg-list .friend-body { flex: 1 1 0; }
.friends-sugg-list .friend-actions { flex: 1 1 100%; }
.friends-sugg-list .friend-actions > * { flex: 1 1 0; }
.friends-sugg-list.is-loading { opacity: 0.55; }
.friends-sugg-list .friend-row { animation: friendsSuggIn .28s var(--ease-out) both; }
.friends-sugg-list .friend-row:nth-child(2) { animation-delay: .05s; }
.friends-sugg-list .friend-row:nth-child(3) { animation-delay: .1s; }
@keyframes friendsSuggIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .friends-sugg-ico.spin, .friends-sugg-list .friend-row { animation: none; } }

/* ---- FRIENDS a dos columnas ----
   Estrecho: una sola columna en el orden del DOM (buscar, sugerencias, lista).
   Desde 1100 px: la LISTA a la izquierda (ancha, con rejilla propia) y a la derecha una
   columna fija con buscar + sugerencias, estas una debajo de otra. */
.friends-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 clamp(20px, 2.2vw, 36px); align-items: start; }
.friends-main .mission-tabs { margin-top: 0; }
.friends-main .friends-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.friends-tab-count.is-full { color: #fecaca; opacity: 1; }
.mission-tab.on .friends-tab-count.is-full { color: #9b1c1c; }
@media (min-width: 1100px) {
  .friends-layout { grid-template-columns: minmax(0, 1fr) clamp(330px, 30%, 430px); grid-template-areas: "main side"; }
  .friends-main { grid-area: main; min-width: 0; }
  .friends-side { grid-area: side; min-width: 0; }
  .friends-side .friends-sugg-list { grid-template-columns: minmax(0, 1fr); }
  .friends-side .friends-search { flex-direction: column; }
  .friends-side .friends-search .ui-btn { align-self: stretch; }
}

/* ---- FRIENDS sin scroll de página (2026-09-24) ----
   Cabecera: título | ADD FRIEND + tu ID. Debajo, desde 1100 px, las dos columnas llenan
   el alto que queda: la lista se desplaza DENTRO de su panel y la pantalla no. Buscar por
   ID es un modal (`.friends-add-modal`). En estrecho: lista y sugerencias apiladas, con el
   scroll normal de siempre. */
.friends-head-actions { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 22px); min-width: 0; }
.friends-add-btn { gap: 8px; }
.friends-add-plus { font-size: 20px; line-height: 0; margin-top: -2px; }
.friends-toast { margin-bottom: 12px; }
.friends-main { display: flex; flex-direction: column; min-width: 0; }
.friends-main > .mission-tabs { align-self: flex-start; }
/* REFERRALS lleva la misma barra que la lista (FriendsTabs): mismo margen que en `.friends-main` */
.ref-tabs { display: flex; flex-direction: column; align-items: flex-start; }
.ref-tabs > .mission-tabs { margin-top: 0; }
/* ...y el mismo hueco bajo la cabecera que `.friends-home`, para que la barra no salte al cambiar */
@media (min-width: 1100px) {
  .missions-screen.on-referrals > .shop-head { margin-bottom: clamp(12px, 2vh, 26px); }
}
.friends-scroll { min-height: 0; }
.friends-side .friends-sugg { margin-bottom: 0; }

@media (min-width: 1100px) {
  .shop-screen.friends-home {
    display: flex; flex-direction: column; overflow: hidden;
    padding-bottom: clamp(16px, 2.4vh, 28px);
  }
  .friends-home > .shop-head { flex: 0 0 auto; margin-bottom: clamp(12px, 2vh, 26px); }
  .friends-home .shop-head-icon { width: clamp(42px, 7vh, 74px); height: clamp(42px, 7vh, 74px); }
  .friends-home .shop-head h2 { font-size: clamp(26px, 6vh, 50px); }
  .friends-home > .friends-layout { flex: 1 1 auto; min-height: 0; grid-template-areas: "main side"; align-items: stretch; }
  .friends-home .friends-main, .friends-home .friends-side { min-height: 0; }
  .friends-home .friends-scroll {
    flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
    /* aire para que las sombras y el borde de la última fila no se corten contra el borde */
    padding: 2px 6px 8px 2px; margin: 0 -6px 0 -2px;
  }
  .friends-home .friends-side { display: flex; flex-direction: column; overflow-y: auto; }
  .friends-home .friends-side .friends-sugg-title { margin-top: 4px; }
}

/* El modal de buscar: el mismo panel de antes, flotando. */
.mission-card.friends-add-modal {
  width: min(560px, 100%); margin: 0; max-height: 90vh; overflow-y: auto;
  animation: buyDoneIn 240ms var(--ease-out);
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.1)), 0 28px 70px rgba(0, 0, 0, 0.65);
}
.friends-add-head { display: flex; align-items: flex-start; gap: 12px; }
.friends-add-head .friends-add-text { flex: 1 1 auto; min-width: 0; }
.friends-add-modal .friends-search, .friends-add-modal .friends-msg, .friends-add-modal .friend-row { max-width: none; }
@media (max-width: 560px) {
  .friends-head-actions { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; }
  .friends-home .friends-myid { flex: 0 1 auto; }
}
/* apilado: las sugerencias ARRIBA (son 3 fichas); debajo de 50 amigos no las veria nadie */
@media (max-width: 1099px) { .friends-side { order: -1; margin-bottom: 22px; } }
/* ---------------- FRIENDS, rediseño 2026-09-24 ----------------
   Tu placa en la cabecera, la lista partida por estado (EN PARTIDA / CONECTADOS /
   DESCONECTADOS, estos compactos), DUEL como accion principal, CHAT y "⋯" como
   botones-icono, sugerencias compactas con un "+" redondo y el vacio con Larry. */
/* Rectángulo con el MISMO redondeo que el avatar: su radio (22 % de 46 px) + los 5 px de relleno,
   así la esquina de fuera es concéntrica con la del retrato. */
.friends-me {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 14px 5px 5px;
  border-radius: calc(46px * 0.22 + 5px); border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  background: linear-gradient(180deg, rgba(40, 58, 92, 0.95), rgba(12, 21, 39, 0.95));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.1), 0 4px 0 rgba(3, 7, 15, 0.45);
}
.friend-avatar.friends-me-av { width: 46px; height: 46px; }
.friends-me-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.friends-me-name {
  font-family: 'Lilita One', var(--font-display); font-size: 17px; line-height: 1.05; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.friends-me-meta { display: flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-weight: 800; font-size: 12px; }
.friends-me .player-code.compact { padding: 2px 8px; }
.friends-me .player-code.compact .player-code-val { font-size: 13px; }
@media (max-width: 560px) {
  .friends-me .player-code.compact { display: inline-flex; }
  .friends-home .friends-me { flex: 0 1 auto; }
}

/* los grupos */
.friends-group { margin-top: 6px; }
.friends-group + .friends-group { margin-top: 18px; }
.friends-group-head {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 10px;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
}
.friends-group-head::after { content: ''; flex: 1 1 auto; height: 2px; margin-left: 4px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent); }
.friends-group.is-online .friends-group-head { color: #6ee79a; }
.friends-group.is-match .friends-group-head { color: #fbbf24; }
.friends-group-n {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: rgba(3, 7, 15, 0.5); color: #e8eefc; letter-spacing: 0; font-variant-numeric: tabular-nums;
}

/* filas: las conectadas con un brillo del color de su estado; las desconectadas, compactas */
.friends-group .friend-row.is-online {
  background: radial-gradient(70% 160% at 0% 50%, rgba(61, 220, 107, 0.14), transparent 60%), linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
}
.friends-group .friend-row.is-match {
  border-color: rgba(251, 191, 36, 0.6);
  background: radial-gradient(70% 160% at 0% 50%, rgba(251, 191, 36, 0.14), transparent 60%), linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
}
.mission-card.friend-row.is-offline { padding-top: 8px; padding-bottom: 8px; background: rgba(12, 21, 39, 0.62); }
.friend-row.is-offline .friend-avatar { width: 46px; height: 46px; }
.friend-row.is-offline .friend-name { font-size: 16px; color: #c9d3e6; }
.friend-row.is-offline .friend-body { gap: 1px; }

/* acciones: DUEL grande, el resto iconos */
.friend-actions .ui-btn.friend-duel-btn { gap: 7px; min-height: 44px; padding: 8px 18px 8px 12px; font-size: 14px; }
.friend-duel-btn img { width: 24px; height: 24px; object-fit: contain; margin: -4px 0; filter: drop-shadow(0 2px 0 rgba(90, 58, 8, 0.45)); }
.friend-icon-btn {
  position: relative; width: 44px; height: 44px; flex: 0 0 auto; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 13px; border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  background: linear-gradient(180deg, #2c3a55, #141d31); color: #e8eefc;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.14), 0 4px 0 rgba(3, 7, 15, 0.5);
  transition: transform .12s var(--ease-out), filter .15s;
}
@media (hover: hover) and (pointer: fine) { .friend-icon-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.18); } }
.friend-icon-btn:active:not(:disabled) { transform: translateY(1px); }
.friend-icon-btn:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
.friend-icon-btn:disabled { opacity: 0.5; cursor: default; }
.friend-icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.friend-chat-btn.friend-icon-btn { color: var(--gold-bright); }
.friend-row.is-offline .friend-icon-btn { width: 40px; height: 40px; }
.friend-more { position: relative; flex: 0 0 auto; }
.friend-more-btn[aria-expanded="true"] { filter: brightness(1.25); }
/* el menu sale a la IZQUIERDA del boton, a la altura de la fila: nunca lo corta el scroll */
.friend-more-menu {
  position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); z-index: 5;
  padding: 5px; border-radius: 12px; border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  background: #101a2e; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  animation: friendMenuIn .14s var(--ease-out);
}
@keyframes friendMenuIn { from { opacity: 0; transform: translate(6px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.friend-more-item {
  display: block; white-space: nowrap; padding: 8px 14px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: #e8eefc;
}
@media (hover: hover) and (pointer: fine) { .friend-more-item:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); } }
.friend-more-item.is-danger { color: #fca5a5; }
.friend-more-item.is-danger.armed { background: #b91c1c; color: #fff; }

/* sugerencias: fila compacta, el "+" redondo a la derecha */
.friends-sugg-list .mission-card.friend-row.is-sugg { flex-wrap: nowrap; padding: 10px 12px; }
.friends-sugg-list .friend-row.is-sugg .friend-actions { flex: 0 0 auto; }
.friends-sugg-list .friend-row.is-sugg .friend-avatar { width: 48px; height: 48px; }
.friend-add-icon.friend-icon-btn {
  border-radius: 50%; font-family: var(--font-display); font-size: 24px; line-height: 1; color: #2a1c04;
  background: var(--gold-face); border-color: var(--gv-ink-gold, #6b4a12);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), inset 0 -4px 0 rgba(140, 88, 8, 0.45), 0 4px 0 rgba(3, 7, 15, 0.5);
}
.friend-add-icon.is-sent { font-size: 18px; color: #6ee79a; background: rgba(3, 7, 15, 0.5); border-color: rgba(110, 231, 154, 0.5); box-shadow: none; cursor: default; }
.friends-sugg-list .friend-row.is-sugg.is-online { border-color: var(--gv-ink, #070f1d); }

/* vacio: Larry con su bocadillo */
.friends-empty-larry { display: flex; align-items: flex-end; gap: 4px; margin-top: 8px; max-width: 720px; }
.friends-empty-coach { width: clamp(130px, 16vw, 190px); height: auto; flex: 0 0 auto; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)); }
.friends-empty-bubble {
  position: relative; display: flex; flex-direction: column; gap: 8px; margin-bottom: 40px; padding: 16px 20px;
  border-radius: 18px; border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); background: #fff6dc; color: #3a2402;
  box-shadow: 0 6px 0 rgba(3, 7, 15, 0.45);
  font-family: var(--font-ui); font-weight: 700; font-size: 14px;
}
.friends-empty-bubble::before {
  content: ''; position: absolute; left: -14px; bottom: 22px; width: 22px; height: 22px; background: #fff6dc;
  border-left: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); border-bottom: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  transform: rotate(45deg) skew(8deg, 8deg);
}
.friends-empty-bubble b { font-family: 'Lilita One', var(--font-display); font-weight: 400; font-size: 22px; color: #3a2402; }
.friends-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
@media (max-width: 560px) {
  .friends-empty-larry { flex-direction: column; align-items: center; }
  .friends-empty-bubble { margin-bottom: 0; }
  .friends-empty-bubble::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .friend-more-menu { animation: none; } }

/* "In a match…": un amigo conectado que está jugando un duelo — ámbar, no verde */
.friend-status.is-match { color: #fbbf24; }
/* y su punto de conectado pasa al mismo ámbar (con su propio latido) */
.friend-dot.on.match { background: #fbbf24; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 8px rgba(251, 191, 36, 0.7); }
.friend-avatar .friend-dot.on.match { animation-name: friendPulseMatch; }
@keyframes friendPulseMatch {
  0%, 100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 4px rgba(251, 191, 36, 0.5); }
  50%      { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 0 12px rgba(251, 191, 36, 0.95); }
}

/* ---------------- REFERIDOS ----------------
   El enlace (campo de solo lectura + COPIAR), el modal INVITE de FRIENDS y la pestaña
   REFERRALS de MISSIONS, que reutiliza las tarjetas de misión (cofre + CLAIM). */
.ref-link { display: flex; gap: 10px; margin-top: 12px; min-width: 0; }
.ref-link-input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 14px; color: var(--gold-bright); text-overflow: ellipsis; }
.ref-link-copy { flex: 0 0 auto; min-width: 128px; }
.ref-link-copy.is-copied { filter: saturate(0.6) brightness(1.1); }
.ref-modal .ref-link { margin-top: 0; }
.ref-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.friends-invite-btn { position: relative; }
.friends-invite-btn .mission-tab-badge { top: -8px; right: -8px; }
.mission-sub { font-family: var(--font-ui); font-weight: 800; font-size: 12px; color: var(--gold-bright); margin: -6px 0 8px; letter-spacing: 0.02em; }
@media (max-width: 560px) {
  .ref-link { flex-direction: column; }
  .ref-link-copy { width: 100%; }
}

/* ---- Banner INVITE FRIENDS (columna derecha de FRIENDS) ----
   Oro sobre tinta con el cofre saliéndose por la izquierda y un brillo que cruza cada pocos
   segundos: es la llamada a la acción de la pestaña. */
.ref-banner {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  margin: 0 0 14px; padding: 10px 16px 10px 10px; cursor: pointer; text-align: left;
  border-radius: 18px; border: var(--gv-bw, 3px) solid var(--gv-ink-gold, #5a3a08);
  background: linear-gradient(180deg, #ffd96a 0%, #f5b62e 55%, #d9901a 100%);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.55), inset 0 -5px 0 rgba(140, 88, 8, 0.45), 0 6px 0 rgba(3, 7, 15, 0.45);
  overflow: hidden; -webkit-tap-highlight-color: transparent;
  transition: transform .14s var(--ease-out), filter .15s;
}
.ref-banner::after {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-18deg); animation: refBannerShine 3.6s ease-in-out infinite; pointer-events: none;
}
@keyframes refBannerShine { 0%, 62% { left: -40%; } 100% { left: 130%; } }
@media (hover: hover) and (pointer: fine) { .ref-banner:hover { transform: translateY(-2px); filter: brightness(1.05); } }
.ref-banner:active { transform: translateY(1px); }
.ref-banner:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
.ref-banner-chest {
  width: 58px; height: 58px; object-fit: contain; flex: 0 0 auto; margin: -6px 0;
  filter: drop-shadow(0 4px 0 rgba(90, 58, 8, 0.45)); animation: refChestBob 2.4s ease-in-out infinite;
}
@keyframes refChestBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(3deg); } }
.ref-banner-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.ref-banner-text b { font-family: 'Lilita One', var(--font-display); font-weight: 400; font-size: 21px; letter-spacing: 0.03em; color: #3a2402; line-height: 1.05; }
.ref-banner-text i { font-style: normal; font-family: var(--font-ui); font-weight: 800; font-size: 13px; color: #6b4309; letter-spacing: 0.02em; }
.ref-banner-go { flex: 0 0 auto; font-size: 16px; color: #3a2402; opacity: 0.8; }
.ref-banner .mission-tab-badge { top: 7px; right: 34px; }
@media (prefers-reduced-motion: reduce) { .ref-banner::after, .ref-banner-chest { animation: none; } }

/* el cofre del widget "Invite friends" (y del modal): pasar por encima enseña lo de dentro */
.ref-chest-badge { width: 54px; height: 54px; object-fit: contain; flex: 0 0 auto; cursor: help; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); transition: transform .15s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .ref-chest-badge:hover { transform: scale(1.08) rotate(-4deg); } }
.tut-tip.is-over-modal { z-index: 1400; }

/* ---- Selector de avatar: modal grande centrado, retrato + nombre del personaje ---- */
.mission-card.avatar-pick {
  position: relative; width: min(920px, 100%); margin: 0; flex-direction: column; align-items: center;
  gap: clamp(14px, 2vh, 22px); padding: 30px clamp(18px, 3vw, 36px) 30px;
  max-height: 92vh; overflow-y: auto; animation: buyDoneIn 280ms var(--ease-out);
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.1)), 0 28px 70px rgba(0, 0, 0, 0.65);
}
.avatar-pick-x { position: absolute; top: 12px; right: 12px; }
.avatar-pick-title { margin: 0; font-family: var(--font-display); font-size: clamp(23px, 2.5vw, 32px); line-height: 1.15; color: var(--gold-bright); letter-spacing: 0.02em; text-align: center; }
.avatar-pick-grid { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(12px, 1.6vw, 22px); }
.avatar-pick-opt {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0;
  background: none; border: none; padding: 0; cursor: pointer; color: var(--text-dim);
}
.avatar-pick-opt .avatar-opt { width: 100%; }
@media (hover: hover) and (pointer: fine) { .avatar-pick-opt:hover .avatar-opt { transform: scale(1.06); } }
.avatar-pick-opt.sel .avatar-opt { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gv-ink, #070f1d), 0 0 16px rgba(245, 193, 74, 0.55); }
.avatar-pick-name { font-family: var(--font-ui); font-weight: 700; font-size: clamp(12px, 1vw, 15px); line-height: 1.15; text-align: center; letter-spacing: 0.02em; }
@media (hover: hover) and (pointer: fine) { .avatar-pick-opt:hover .avatar-pick-name { color: var(--text); } }
.avatar-pick-opt.sel .avatar-pick-name { color: var(--gold-bright); }
.avatar-pick-opt .avatar-opt { position: relative; }
.avatar-pick-opt.is-locked { cursor: not-allowed; }
/* Punto rojo de "avatar nuevo": en el retrato de HOME y en cada casilla recién desbloqueada. */
.avatar-new-dot { min-width: 0; width: 16px; height: 16px; padding: 0; top: -4px; right: -4px; z-index: 3; }
/* Punto rojo sin numero (cartas nuevas): en HOME del menu y en el acceso a la coleccion. */
.nav-badge.nav-dot { min-width: 0; width: 14px; height: 14px; padding: 0; }
/* NEW sobre la carta en la coleccion: arriba y por encima de la chapa de copias. Solo las
   letras (con su halo de neon), sin chapa ni borde (2026-10-25). */
.pack-new-badge.cs-new-badge {
  top: -0.55em; z-index: 7; font-size: clamp(12px, 1.2vw, 16px); line-height: 1.1;
}
/* OBJETOS NUEVOS (cosmeticos recien comprados): la chapa roja CON numero en la pestana del
   inventario, y el mismo NEW de la coleccion sobre el dibujo de la ficha (centrado en la
   columna del dibujo: el relleno de la ficha + la mitad de sus 32cqw). */
.inv-tabs .inv-tab-badge { top: -7px; right: -5px; z-index: 1; }
.inv-item { position: relative; }
.pack-new-badge.inv-new-badge { left: calc(clamp(11px, 1vw, 15px) + 16cqw); }
.avatar-pick-opt.is-locked .avatar-opt img { filter: grayscale(1) brightness(0.45); }
@media (hover: hover) and (pointer: fine) { .avatar-pick-opt.is-locked:hover .avatar-opt { transform: none; } }
.avatar-pick-opt.is-locked .avatar-pick-name { color: var(--text-muted); }
.avatar-pick-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(22px, 2.4vw, 34px); filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); }
.avatar-pick-need { margin-top: -4px; font-family: var(--font-ui); font-weight: 700; font-size: clamp(10px, 0.8vw, 12px); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-bright); opacity: 0.8; }
@media (max-width: 720px) { .avatar-pick-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---- Bienvenida del INVITADO ("X te ha invitado a jugar a Memetic") ---- */
.mission-card.ref-welcome {
  position: relative; width: min(560px, 100%); margin: 0; flex-direction: column; align-items: center;
  text-align: center; gap: 14px; padding: 34px clamp(20px, 3.4vw, 36px) 28px;
  max-height: 92vh; overflow-y: auto; animation: buyDoneIn 280ms var(--ease-out);
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.1)), 0 28px 70px rgba(0, 0, 0, 0.65), 0 0 60px -12px rgba(245, 193, 74, 0.45);
}
.ref-welcome-x { position: absolute; top: 12px; right: 12px; }
.friend-avatar.ref-welcome-av { width: 96px; height: 96px; }
.ref-welcome-title { margin: 0; font-family: var(--font-display); font-size: clamp(23px, 2.5vw, 32px); line-height: 1.15; color: var(--gold-bright); letter-spacing: 0.02em; }
.ref-welcome .tut-tip-sub { margin-top: 2px; }
.ref-welcome-packs { display: flex; justify-content: center; gap: clamp(16px, 3vw, 30px); }
.ref-welcome-pack { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ref-welcome-pack img { height: clamp(160px, 23vh, 215px); width: auto; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); animation: refPackFloat 3s ease-in-out infinite; }
.ref-welcome-pack:nth-child(2) img { animation-delay: -1.5s; }
@keyframes refPackFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.ref-welcome-pack figcaption { font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); max-width: 160px; }
.ref-welcome-packs.is-claimed img { animation: refPackGot .6s var(--ease-out) both, refPackFloat 3s ease-in-out .6s infinite; filter: drop-shadow(0 0 16px rgba(245, 193, 74, 0.8)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
@keyframes refPackGot { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.ref-welcome-cta { min-width: 220px; }
.ref-welcome-friend {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 6px; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.26);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.3); text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text);
}
.ref-welcome-friend span:first-child { flex: 1 1 180px; }
.ref-welcome-play { min-width: 220px; margin-top: 2px; }

/* ---- REGALO DEL ADMIN (GiftNoticeModal): el mismo marco que la bienvenida del referido ---- */
.mission-card.gift-modal { width: min(1040px, 96vw); gap: 12px; padding: clamp(24px, 3.4vh, 40px) clamp(24px, 3.4vw, 44px) clamp(20px, 3vh, 32px); }
.gift-sticker { width: clamp(96px, 12vh, 160px); height: auto; display: block; margin-bottom: -4px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55)); animation: refPackFloat 3s ease-in-out infinite; }
.gift-sub { margin: 0; font: 600 clamp(15px, 1.35vw, 19px)/1.4 var(--font-body, "Space Grotesk", system-ui, sans-serif); color: var(--text-dim); }
.gift-loot { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: clamp(16px, 2.4vw, 30px); margin: 8px 0 6px; }
.gift-thing { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gift-thing figcaption { font-family: var(--font-ui); font-weight: 800; font-size: 14px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim); max-width: 200px; }
.gift-thing figcaption b { color: var(--gold-bright, #fde68a); font-size: 18px; }
.gift-thing.is-currency img { width: clamp(64px, 9vh, 100px); height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.gift-thing.is-pack img { height: clamp(130px, 17vh, 240px); width: auto; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
.gift-item-slot { display: block; width: clamp(120px, 16vh, 190px); container-type: inline-size; }   /* ItemArt (el de la tienda) lo llena, cuadrado. Contenedor: el padding en cqi del emoji se mide contra EL (como en la ficha) */
.gift-item-slot > .inv-item-art { display: block; }   /* en la tienda lo bloquea su columna; aqui es un span suelto */
.gift-item-slot > .inv-item-art.is-voice { display: flex; }
.gift-card { display: block; width: clamp(104px, 13vh, 170px); }
.gift-card .card { width: 100%; }
/* la carta de la beta (Beta Tester): es EL regalo, asi que va en grande */
.gift-modal.is-beta .gift-card { width: clamp(150px, 27vh, 250px); }
/* la carta primero y sus dos efectos a los lados */
.gift-modal.is-beta .gift-thing.is-card { order: -1; }
/* HALLOWEEN 2026 (reason 'halloween', o objetos del evento en un regalo del admin): el MODAL DEL
   JUEGO (contorno de tinta, banda de luz arriba, banda de sombra abajo, sombra proyectada), con
   los colores del evento: morado de bruja y luz de calabaza. La calabaza del evento de pegatina.
   TODOS los premios del mismo tamaño y alineados: cada uno en una casilla igual (`--hw-slot`),
   el dibujo encajado dentro (contain) y su nombre debajo, a la misma altura. */
.mission-card.gift-modal.is-halloween {
  --hw-slot: clamp(120px, min(21vh, 13vw), 200px);
  width: min(1180px, 96vw);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 138, 30, 0.24), rgba(255, 138, 30, 0) 60%),
    linear-gradient(180deg, rgba(58, 34, 92, 0.98), rgba(22, 12, 40, 0.99));
  border: var(--gv-bw) solid var(--gv-ink);
  box-shadow:
    inset 0 var(--gv-hi-h) 0 rgba(255, 214, 160, 0.16),
    inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 0 60px -12px rgba(255, 138, 30, 0.55);
}
.gift-modal.is-halloween .ref-welcome-title { color: #ffb347; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 138, 30, 0.45); }
.gift-modal.is-halloween .gift-sub { color: #d9cdf2; }
.gift-modal.is-halloween .gift-sticker { width: clamp(100px, 13vh, 150px); }
.gift-modal.is-halloween .gift-loot { align-items: flex-start; flex-wrap: nowrap; gap: clamp(10px, 1.6vw, 22px); }
@media (max-width: 760px) { .gift-modal.is-halloween .gift-loot { flex-wrap: wrap; } }
.gift-modal.is-halloween .gift-thing { width: var(--hw-slot); }
.gift-modal.is-halloween .gift-thing figcaption { color: #f3e6ff; max-width: none; }
.gift-modal.is-halloween .gift-thing > img,
.gift-modal.is-halloween .gift-thing > .gift-item-slot,
.gift-modal.is-halloween .gift-thing > .gift-card {
  width: var(--hw-slot); height: var(--hw-slot); display: grid; place-items: center;
}
.gift-modal.is-halloween .gift-thing > img { object-fit: contain; }
/* la MISMA casilla para todos (la de los objetos: fondo oscuro, contorno de tinta): sobres y gems
   dentro de ella, con aire, igual que los objetos dentro de su ficha */
.gift-modal.is-halloween .gift-thing.is-currency > img,
.gift-modal.is-halloween .gift-thing.is-pack > img {
  box-sizing: border-box; padding: 10%; border-radius: 12px; filter: none;
  background: radial-gradient(circle at 50% 40%, rgba(139, 92, 246, 0.22), rgba(7, 10, 22, 0.9) 75%);
  border: var(--gv-bw) solid var(--gv-ink); box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.06), inset 0 -5px 0 rgba(0, 0, 0, 0.3);
}
.gift-modal.is-halloween .gift-thing.is-currency > img { padding: 20%; }
.gift-modal.is-halloween .gift-item-slot > .inv-item-art { width: 100%; height: 100%; }
/* pantallas bajas (moviles en horizontal): la misma casilla, mas pequena */
@media (max-height: 760px) {
  .mission-card.gift-modal.is-halloween { --hw-slot: clamp(84px, 10vw, 110px); }
  .gift-modal.is-halloween .gift-sticker { width: 72px; }
}
@media (max-height: 480px) {
  .mission-card.gift-modal.is-halloween { --hw-slot: 82px; }
  .gift-modal.is-halloween .gift-sticker { width: 52px; margin-bottom: -8px; }
  .gift-modal.is-halloween .gift-sub { font-size: 13px; }
  .gift-modal.is-halloween .gift-thing figcaption { font-size: 11px; }
}
.gift-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.gift-actions .ui-btn { min-width: 240px; }
/* Pantallas bajas: todo mas pequeno para que los botones se vean sin desplazar. */
@media (max-height: 760px) {
  .mission-card.gift-modal { padding-top: 22px; padding-bottom: 20px; gap: 8px; }
  .gift-sticker { width: 84px; }
  .gift-loot { gap: 10px 18px; margin: 2px 0; }
  .gift-thing { gap: 5px; }
  .gift-thing.is-currency img { width: 56px; }
  .gift-thing.is-pack img { height: 112px; }
  .gift-item-slot { width: 104px; }
  .gift-card { width: 84px; }
}
@media (prefers-reduced-motion: reduce) { .gift-sticker { animation: none !important; } }
@media (prefers-reduced-motion: reduce) { .ref-welcome-pack img { animation: none !important; } }
/* ---------------- REFERRALS (MISSIONS > REFERRALS), rediseño 2026-09-24 ----------------
   Cartel (cofre + sobres que suelta + tres pasos + ticket), carril de 10 asientos con los
   cofres de hito encima de la linea, y la plantilla de reclutas en fichas. Sin
   `.mission-card` a proposito: no tiene que parecer otra lista de tareas. */
.ref-poster {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: clamp(190px, 24%, 290px) minmax(0, 1fr);
  align-items: center; gap: clamp(14px, 2.4vw, 36px);
  padding: clamp(10px, 1.8vh, 24px) clamp(16px, 2.4vw, 32px); margin: 14px 0 clamp(10px, 1.6vh, 18px);
  border-radius: 22px; border: var(--gv-bw, 3px) solid var(--gv-ink-gold, #6b4a12);
  background:
    radial-gradient(60% 120% at 14% 55%, rgba(245, 193, 74, 0.30), transparent 70%),
    linear-gradient(180deg, rgba(42, 60, 98, 0.96), rgba(12, 21, 39, 0.97));
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 rgba(255, 224, 150, 0.2), inset 0 -5px 0 var(--gv-sh, rgba(0,0,0,.34)), 0 6px 0 rgba(3, 7, 15, 0.45);
}
/* rayos de sol detras del cofre */
.ref-poster::before {
  content: ''; position: absolute; left: calc(clamp(190px, 24%, 290px) / 2 + clamp(16px, 2.4vw, 32px)); top: 55%;
  width: 520px; height: 520px; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 110, 0.13) 0deg 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: refRays 40s linear infinite; pointer-events: none;
}
@keyframes refRays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.ref-poster-art { position: relative; height: clamp(130px, calc(38vh - 110px), 250px); }
.ref-poster-chest {
  position: absolute; left: 50%; bottom: 0; width: 64%; max-width: 170px; transform: translateX(-50%);
  filter: drop-shadow(0 8px 0 rgba(3, 7, 15, 0.45)); animation: refPosterBob 3s ease-in-out infinite;
}
.ref-poster.has-ready .ref-poster-chest { animation: refPosterShake 1.6s ease-in-out infinite; }
@keyframes refPosterBob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }
@keyframes refPosterShake {
  0%, 55%, 100% { transform: translateX(-50%) rotate(0); }
  62% { transform: translateX(-50%) rotate(-7deg); } 70% { transform: translateX(-50%) rotate(6deg); }
  78% { transform: translateX(-50%) rotate(-4deg); } 86% { transform: translateX(-50%) rotate(2deg); }
}
.ref-poster-pack {
  position: absolute; bottom: 12%; height: 88%; width: auto; max-width: 62%;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}
.ref-poster-pack.p0 { left: 0; --rot: -14deg; }
.ref-poster-pack.p1 { right: 0; --rot: 13deg; animation-delay: -1.7s; }
.ref-poster-pack { transform: rotate(var(--rot, 0deg)); animation: refPosterPack 3.4s ease-in-out infinite; }
@keyframes refPosterPack { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-7px) rotate(calc(var(--rot, 0deg) * 0.8)); } }
.ref-poster-main { position: relative; min-width: 0; }
.ref-poster-title {
  margin: 0; font-family: 'Lilita One', var(--font-display); font-weight: 400;
  font-size: clamp(24px, 2.5vw, 36px); line-height: 1.05; letter-spacing: 0.02em; color: var(--gold-bright);
  text-shadow: 0 3px 0 rgba(3, 7, 15, 0.7);
}
.ref-poster-sub { margin-top: 6px; font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text-dim); max-width: 700px; }
.ref-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
.ref-step {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(3, 7, 15, 0.38); border: 2px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; color: #e8eefc;
}
.ref-step { position: relative; }
.ref-step + .ref-step { margin-left: 16px; }
.ref-step + .ref-step::before { content: '›'; position: absolute; left: -15px; top: 50%; transform: translateY(-52%); color: var(--gold); font-size: 22px; line-height: 1; }
.ref-step-n {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-face); border: 2px solid var(--gv-ink-gold, #6b4a12); color: #2a1c04;
  font-family: var(--font-display); font-size: 12px;
}
.ref-by { margin-top: 10px; font-family: var(--font-ui); font-weight: 700; font-size: 12.5px; color: var(--text-dim); }

/* el TICKET: el codigo en papel dorado con su troquel, COPIAR y los botones de compartir */
.ref-ticket { display: flex; align-items: stretch; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.ref-ticket-code {
  display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 7px 22px;
  border-radius: 12px; border: 3px solid var(--gv-ink-gold, #6b4a12);
  background: linear-gradient(180deg, #fff4d1, #f0d387);
  outline: 2px dashed rgba(107, 74, 18, 0.45); outline-offset: -8px;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.7), 0 4px 0 rgba(3, 7, 15, 0.45);
}
.ref-ticket-code span { font-family: var(--font-ui); font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: #7a5212; }
.ref-ticket-code b { font-family: var(--font-display); font-weight: 400; font-size: clamp(20px, 2vw, 26px); letter-spacing: 0.14em; color: #3a2402; line-height: 1.05; }
.ref-ticket-actions { display: flex; align-items: center; gap: 10px; }
.ref-ticket .ref-link-copy { min-height: 48px; }
.ref-share {
  width: 48px; height: 48px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px; border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d); cursor: pointer; padding: 0;
  background: linear-gradient(180deg, #2c3a55, #141d31);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.14), 0 4px 0 rgba(3, 7, 15, 0.5);
  transition: transform .12s var(--ease-out), filter .15s;
}
@media (hover: hover) and (pointer: fine) { .ref-share:hover { transform: translateY(-2px); filter: brightness(1.15); } }
.ref-share:active { transform: translateY(1px); }
.ref-share img { width: 20px; height: 20px; }
.ref-share.is-dc { background: linear-gradient(180deg, #6c78f5, #4752c4); }
.ref-share.is-dc img { width: 26px; height: 26px; filter: brightness(0) invert(1); }
.ref-share.is-dc.is-copied { background: linear-gradient(180deg, #3ddc6b, #22a24c); }
.ref-share-ok { color: #fff; font-family: var(--font-display); font-size: 20px; line-height: 1; }
.ref-share svg { width: 24px; height: 24px; }
.ref-share.is-tg { background: linear-gradient(180deg, #3aa9e6, #1f7fbf); }
.ref-share.is-tg svg { fill: #fff; }
.ref-share.is-native svg { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* paneles con cabecera (YOUR SQUAD / RECRUITS) */
.ref-panel {
  padding: 12px clamp(14px, 1.8vw, 24px) 2px; margin-bottom: 14px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.13)), inset 0 -5px 0 var(--gv-sh, rgba(0,0,0,.34));
}
.ref-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ref-panel-title { font-family: 'Lilita One', var(--font-display); font-size: 20px; letter-spacing: 0.06em; color: var(--gold-bright); text-shadow: 0 2px 0 rgba(3, 7, 15, 0.6); }
.ref-section-head { margin-bottom: 10px; min-height: 40px; }
.ref-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.ref-pager-btn.friend-icon-btn:disabled { opacity: 0.35; cursor: default; }
.ref-pager-btn.friend-icon-btn { width: 38px; height: 38px; font-family: var(--font-display); font-size: 24px; line-height: 1; color: var(--gold-bright); padding-bottom: 3px; }
.ref-pager-n { min-width: 46px; text-align: center; font-family: var(--font-ui); font-weight: 800; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* REFERRALS cabe en una pantalla: sin barra de scroll (si una pantalla baja no llega, se
   sigue pudiendo desplazar con la rueda o el dedo, solo que sin barra). */
.missions-screen.on-referrals { scrollbar-width: none; padding-bottom: clamp(12px, 2vh, 28px); }
/* la cabecera de MISSIONS se encoge con la altura (como FRIENDS) en TODAS sus pestanas: REFERRALS
   cabe sin scroll y las pestanas quedan siempre a la misma altura */
@media (min-width: 1000px) {
  .missions-screen > .shop-head { margin-bottom: clamp(10px, 1.8vh, 26px); }
  .missions-screen .shop-head-icon { width: clamp(42px, 7vh, 74px); height: clamp(42px, 7vh, 74px); }
  .missions-screen .shop-head h2 { font-size: clamp(26px, 6vh, 50px); }
  /* una sola fila por pagina: 3 reclutas que ocupan el mismo ancho que el panel YOUR SQUAD */
  .missions-screen.on-referrals .ref-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
  .missions-screen.on-referrals .ref-panel { padding-top: 2px; }
  .missions-screen.on-referrals .ref-track { padding-top: 26px; }
}
/* pantallas bajas (portatil 720-760 px): todo un punto mas prieto */
/* ...y tambien las ESTRECHAS de altura media: con la ficha a ~290 px el texto parte en mas lineas */
@media (min-width: 1000px) and (max-height: 820px), (min-width: 1000px) and (max-width: 1399px) and (max-height: 999px) {
  .missions-screen.on-referrals .ref-steps { margin-top: 8px; }
  .missions-screen.on-referrals .ref-step { padding-top: 3px; padding-bottom: 3px; }
  .missions-screen.on-referrals .ref-ticket { margin-top: 10px; }
  .missions-screen.on-referrals .ref-ticket-code { padding: 4px 18px; }
  .missions-screen.on-referrals .ref-ticket .ref-link-copy { min-height: 42px; }
  .missions-screen.on-referrals .ref-share { width: 42px; height: 42px; }
  .missions-screen.on-referrals .ref-track { padding-bottom: 34px; }
  .missions-screen.on-referrals .ref-ms-btn { top: calc(50% + 34px); }
  .missions-screen.on-referrals .ref-section-head { min-height: 30px; margin-bottom: 4px; }
  .missions-screen.on-referrals .ref-poster-art { height: clamp(120px, calc(38vh - 126px), 250px); }
  .missions-screen.on-referrals .ref-panel { margin-bottom: 8px; }
  .missions-screen.on-referrals .ref-poster-sub { display: none; }
  .missions-screen.on-referrals .ref-track { padding-top: 22px; padding-bottom: 30px; }
  .missions-screen.on-referrals .ref-section-head { min-height: 26px; margin-bottom: 2px; }
  .missions-screen.on-referrals .ref-recruit { padding: 6px 12px; min-height: 0; gap: 10px; }
  .missions-screen.on-referrals .friend-avatar.ref-recruit-av { width: 52px; height: 52px; }
  .missions-screen.on-referrals .rf-chest.ref-recruit-chest { width: 46px; height: 46px; }
  .missions-screen.on-referrals .ref-recruit.is-ready .rf-chest.ref-recruit-chest { width: 36px; height: 36px; }
  .missions-screen.on-referrals .ref-recruit-side { gap: 2px; }
  .missions-screen.on-referrals .ui-btn.ref-recruit-open { min-height: 28px; padding: 3px 12px; }
  .missions-screen.on-referrals .ref-recruit-name { font-size: 18px; }
  .missions-screen.on-referrals .ref-recruit-state, .missions-screen.on-referrals .ref-recruit-lock { font-size: 12px; line-height: 1.2; }
  /* sin alto para la pastilla: el boton de amistad es una chapa redonda en la esquina del avatar */
  .missions-screen.on-referrals .ref-recruit-friend {
    position: absolute; left: 46px; top: calc(50% + 6px); z-index: 1; margin: 0; padding: 0; width: 24px; height: 24px;
    justify-content: center; font-family: var(--font-display); font-size: 16px; line-height: 1; letter-spacing: 0;
  }
  .missions-screen.on-referrals .ref-recruit-friend.is-friend, .missions-screen.on-referrals .ref-recruit-friend.is-sent { font-size: 12px; background: rgba(3, 7, 15, 0.92); }
  .missions-screen.on-referrals .ref-recruit-friend-label, .missions-screen.on-referrals .ref-recruit-err { display: none; }
  .missions-screen.on-referrals .ref-pager { margin-top: 6px; }
  .missions-screen.on-referrals .ref-pager-btn.friend-icon-btn { width: 30px; height: 30px; font-size: 20px; }
}
/* lo mas bajo (720 px): los ultimos pixeles salen de margenes, no de las fichas */
@media (min-width: 1000px) and (max-height: 740px) {
  .missions-screen.on-referrals { padding-bottom: 8px; }
  .missions-screen.on-referrals .ref-steps { margin-top: 4px; }
  .missions-screen.on-referrals .ref-ticket { margin-top: 6px; }
  .missions-screen.on-referrals .ref-track { padding-top: 18px; padding-bottom: 26px; }
  .missions-screen.on-referrals .ref-pager { margin-top: 2px; }
}
/* altura media (821-999 px): la ficha grande entera no cabe con los controles debajo; se
   queda un punto mas baja, con la pastilla de amistad a la vista */
@media (min-width: 1400px) and (min-height: 821px) and (max-height: 999px), (min-width: 1000px) and (max-width: 1399px) and (min-height: 1000px) {
  .missions-screen.on-referrals .ref-section-head { min-height: 32px; margin-bottom: 4px; }
  .missions-screen.on-referrals .ref-track { padding-top: 22px; padding-bottom: 36px; }
  .missions-screen.on-referrals .ref-panel { margin-bottom: 8px; }
  .missions-screen.on-referrals .ref-recruit { padding: 8px 16px; min-height: 0; gap: 12px; }
  .missions-screen.on-referrals .friend-avatar.ref-recruit-av { width: 60px; height: 60px; }
  .missions-screen.on-referrals .rf-chest.ref-recruit-chest { width: 56px; height: 56px; }
  .missions-screen.on-referrals .ref-recruit.is-ready .rf-chest.ref-recruit-chest { width: 44px; height: 44px; }
  .missions-screen.on-referrals .ref-recruit-name { font-size: 20px; }
  .missions-screen.on-referrals .ref-recruit-state, .missions-screen.on-referrals .ref-recruit-lock { font-size: 13px; line-height: 1.2; }
  .missions-screen.on-referrals .ref-recruit-friend { padding: 3px 10px; font-size: 11px; margin-top: 0; }
  .missions-screen.on-referrals .ref-pager { margin-top: 6px; }
  .missions-screen.on-referrals .ref-pager-btn.friend-icon-btn { width: 32px; height: 32px; font-size: 21px; }
}
.missions-screen.on-referrals::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* EL CARRIL: asientos + cofres de hito sobre una linea que se vuelve dorada. Cada pieza
   pinta su propio tramo (flex sin hueco), asi no hay cuentas absolutas que mantener. */
.ref-track {
  display: flex; align-items: center; overflow-x: auto; overflow-y: hidden;
  padding: 26px 6px 42px; scrollbar-width: thin;
}
.ref-seat, .ref-ms { position: relative; display: flex; align-items: center; justify-content: center; }
.ref-seat { flex: 1 1 52px; min-width: 52px; }
.ref-ms { flex: 0 0 auto; width: 104px; }
.ref-seat::before, .ref-ms::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 8px; transform: translateY(-50%);
  background: rgba(3, 7, 15, 0.55); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4);
}
.ref-seat:first-child::before { left: 50%; }
.ref-ms:last-child::before { right: 50%; }
.ref-seat.is-reached::before, .ref-ms.is-reached::before { background: var(--gold); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45); }
.ref-seat-pip {
  position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(40, 58, 92, 0.98), rgba(12, 21, 39, 0.98));
  border: 3px solid var(--gv-ink, #070f1d); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.1);
  font-family: var(--font-display); font-size: 14px; color: var(--text-muted, #64748b);
}
.ref-seat.is-filled .ref-seat-pip {
  width: 50px; height: 50px; background: var(--av, #7cb2e6); border-color: var(--gv-ink-gold, #6b4a12);
  box-shadow: 0 0 0 3px var(--gold), 0 4px 0 3px rgba(3, 7, 15, 0.45);
}
.ref-seat-pip img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.rf-chest.ref-ms-chest {
  position: relative; z-index: 1; width: 66px; height: 66px; object-fit: contain; cursor: help;
  filter: grayscale(0.55) brightness(0.75) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5));
}
.ref-ms.is-done .ref-ms-chest { filter: drop-shadow(0 0 14px rgba(245, 193, 74, 0.75)) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.ref-ms.is-done:not(.is-claimed):not(.is-opening) .ref-ms-chest { animation: refChestReady 1.6s ease-in-out infinite; }
.ref-ms.is-claimed .rf-chest.ref-ms-chest { filter: saturate(0.6) brightness(0.85) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
@keyframes refChestReady {
  0%, 55%, 100% { transform: rotate(0) scale(1); }
  62% { transform: rotate(-8deg) scale(1.06); } 70% { transform: rotate(7deg) scale(1.06); }
  78% { transform: rotate(-4deg) scale(1.03); } 86% { transform: rotate(2deg); }
}
.ref-ms-name {
  position: absolute; left: 50%; bottom: calc(50% + 36px); transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-bright);
}
.ref-ms-btn { position: absolute; left: 50%; top: calc(50% + 38px); transform: translateX(-50%); white-space: nowrap; }
.ui-btn.ref-ms-btn { min-height: 32px; padding: 5px 14px; font-size: 12px; }
span.ref-ms-btn {
  padding: 4px 12px; border-radius: 999px; background: rgba(3, 7, 15, 0.5); border: 2px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-ui); font-weight: 800; font-size: 11.5px; letter-spacing: 0.08em; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
span.ref-ms-btn.is-claimed { color: #6ee79a; }

/* LA PLANTILLA: una ficha por invitado + la ficha "+" que copia el enlace */
.ref-roster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); margin-bottom: 18px; }
.ref-recruit {
  position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; min-height: 118px; padding: 16px 20px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.78), rgba(12, 21, 39, 0.9));
  border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.13)), inset 0 -5px 0 var(--gv-sh, rgba(0,0,0,.34));
}
.ref-recruit.is-ready {
  border-color: var(--gold-edge);
  background: radial-gradient(90% 140% at 100% 50%, rgba(245, 193, 74, 0.22), transparent 60%), linear-gradient(180deg, rgba(40, 52, 78, 0.9), rgba(16, 22, 38, 0.95));
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 rgba(255, 224, 150, 0.2), inset 0 -5px 0 var(--gv-sh, rgba(0,0,0,.34)), 0 0 18px rgba(245, 193, 74, 0.18);
}
.ref-recruit.is-claimed { opacity: 0.62; }
.ref-recruit.is-claimed .friend-avatar img { filter: saturate(0.55) brightness(0.85); }
.friend-avatar.ref-recruit-av { width: 68px; height: 68px; flex: 0 0 auto; }
.ref-recruit-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1 1 auto; min-width: 0; }
.ref-recruit-name {
  font-family: 'Lilita One', var(--font-display); font-size: 22px; color: #fff; line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ref-recruit-state { display: flex; align-items: flex-start; gap: 6px; font-family: var(--font-ui); font-weight: 700; font-size: 14px; line-height: 1.25; color: var(--text-dim); }
.ref-recruit-lock { flex: 0 0 auto; font-size: 14px; line-height: 1.25; }
/* anadir al recluta como amigo: pastilla pequena bajo su estado (manda una solicitud normal) */
.ref-recruit-friend {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 4px 12px; border-radius: 999px;
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.06em; white-space: nowrap;
  color: var(--text-dim); background: rgba(3, 7, 15, 0.5); border: 2px solid rgba(255, 255, 255, 0.08);
}
button.ref-recruit-friend {
  cursor: pointer; color: #2a1c04; background: var(--gold-face); border-color: var(--gv-ink-gold, #6b4a12);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(140, 88, 8, 0.45), 0 3px 0 rgba(3, 7, 15, 0.5);
  transition: transform .12s var(--ease-out), filter .15s;
}
@media (hover: hover) and (pointer: fine) { button.ref-recruit-friend:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); } }
button.ref-recruit-friend:active:not(:disabled) { transform: translateY(1px); }
button.ref-recruit-friend:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
button.ref-recruit-friend:disabled { cursor: default; filter: saturate(0.4) brightness(0.8); }
.ref-recruit-friend.is-friend, .ref-recruit-friend.is-sent { color: #6ee79a; border-color: rgba(110, 231, 154, 0.35); }
.ref-recruit-err { font-family: var(--font-ui); font-weight: 700; font-size: 11px; line-height: 1.2; color: #ff9d9d; }
.ref-recruit.is-ready .ref-recruit-state { color: var(--gold-bright); }
.ref-recruit-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rf-chest.ref-recruit-chest { width: 66px; height: 66px; object-fit: contain; cursor: help; filter: drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.ref-recruit.is-playing .ref-recruit-chest { filter: grayscale(0.6) brightness(0.7) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.5)); }
.ref-recruit.is-ready:not(.is-opening) .ref-recruit-chest { animation: refChestReady 1.6s ease-in-out infinite; }
.ui-btn.ref-recruit-open { min-height: 30px; padding: 4px 14px; font-size: 12px; }
.ref-recruit-add {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: rgba(3, 7, 15, 0.22); border-style: dashed; border-color: rgba(245, 193, 74, 0.45); box-shadow: none;
  transition: background .15s, border-color .15s, transform .12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .ref-recruit-add:hover { background: rgba(245, 193, 74, 0.08); border-color: var(--gold); transform: translateY(-2px); } }
.ref-recruit-add:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
.ref-recruit-plus {
  width: 68px; height: 68px; flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 3px dashed rgba(245, 193, 74, 0.6); color: var(--gold); font-family: var(--font-display); font-size: 26px; line-height: 1;
}
.ref-recruit-add .ref-recruit-name { color: var(--gold-bright); }
.ref-recruit-add.is-copied .ref-recruit-plus { border-style: solid; background: rgba(110, 231, 154, 0.15); border-color: #6ee79a; color: #6ee79a; }

@media (max-width: 1000px) {
  .ref-steps { flex-direction: column; align-items: flex-start; }
  .ref-step + .ref-step { margin-left: 0; }
  .ref-step + .ref-step::before { display: none; }
  .ref-seat { flex-basis: 38px; min-width: 38px; }
  .ref-seat-pip { width: 34px; height: 34px; font-size: 12px; }
  .ref-seat.is-filled .ref-seat-pip { width: 38px; height: 38px; }
  .ref-ms { width: 86px; }
}
@media (max-width: 760px) {
  .ref-steps { align-items: center; }
  .ref-poster { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .ref-poster::before { left: 50%; top: 22%; }
  .ref-poster-art { height: 150px; }
  .ref-steps, .ref-ticket { justify-content: center; }
  .ref-poster-sub { margin-left: auto; margin-right: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ref-poster::before, .ref-poster-chest, .ref-poster-pack, .ref-ms-chest, .ref-recruit-chest { animation: none !important; }
}

/* ============================================================
   RETO A UN AMIGO (duelo PvP) — el boton DUEL de la fila y el modal del reto
   ============================================================ */
.friend-duel-btn:disabled { opacity: .45; filter: grayscale(.6); }
/* por encima de todo lo del menu: puede llegar un reto estando en cualquier pestana */
.ui-modal-overlay.pvp-overlay { z-index: 1400; }
.mission-card.pvp-modal { width: min(620px, 100%); display: flex; flex-direction: column; gap: 16px; }
.pvp-modal .friend-avatar { flex: 0 0 auto; }
.pvp-deck-list { max-height: min(58vh, 520px); overflow-y: auto; padding-right: 4px; }
.pvp-modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.pvp-wait { display: flex; justify-content: center; gap: 10px; padding: 6px 0 2px; }
.pvp-wait span {
  width: 12px; height: 12px; border-radius: 50%; background: #fbbf24;
  animation: pvpWait 1.1s ease-in-out infinite;
}
.pvp-wait span:nth-child(2) { animation-delay: .15s; }
.pvp-wait span:nth-child(3) { animation-delay: .3s; }
@keyframes pvpWait { 0%, 80%, 100% { transform: scale(.55); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pvp-wait span { animation: none; opacity: .8; } }
.gameover-friendly { opacity: .8; font-size: .9em; }

/* ============================================================
   ACCESOS DE LA BARRA DE HOME (inventory · collection · friends)
   FRIENDS lleva el aviso rojo (solicitudes + chat sin leer) que antes iba en su
   pestaña del menu.
   ============================================================ */
/* Solo el icono: sin chapa, sin circulo y sin contorno. Van en su propio grupo a la
   IZQUIERDA, pegados a los datos del jugador; `margin-right: auto` empuja el monedero
   (oro + gems) al extremo derecho. */
.home2-quicks { display: flex; align-items: flex-start; gap: clamp(10px,1.1vw,20px); margin-left: clamp(8px,2.2vw,44px); margin-right: auto; }
.home2-quick {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; padding: 0; cursor: pointer;
  transition: transform .12s, filter .18s;
}
.home2-quick img {
  width: calc(var(--counter-h) * 1.05); height: calc(var(--counter-h) * 1.05);
  object-fit: contain; display: block; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.55));
}
/* El libro abierto de COLLECTION (icons/my_collection.png) es apaisado y trae mas margen que la mochila: su
   dibujo ocupa el 75 % x 57 % del lienzo (el de INVENTORY, el 82 % x 80 %). Se amplia para que pesen igual. */
.home2-quick img.home2-quick-book { transform: scale(1.3); }
@media (hover: hover) and (pointer: fine) { .home2-quick:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.12); } }
.home2-quick-badge { top: -3px; right: -4px; }
/* Rotulo bajo el icono: misma letra que los de la barra de navegacion (`.nav-label`). */
.home2-quick-label { font-family: var(--font-ui); font-size: clamp(9px,0.72vw,11px); font-weight: 700; letter-spacing: 0.05em; color: var(--text); white-space: nowrap; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
/* Movil: la identidad ocupa la primera fila; debajo, los accesos a la izquierda y el
   monedero a la derecha (las chapas de moneda pierden el ancho minimo comun para caber). */
@media (max-width: 720px) {
  .home2-bar { flex-wrap: wrap; row-gap: 8px; }
  .home2-id { flex: 1 1 100%; }
  .home2-quicks { margin-left: 0; }   /* ya van en su propia fila, no hace falta separarlos */
  .home2-wallet { flex: 0 1 auto; gap: 6px; }
  .home2-wallet > .home2-coin { min-width: 0; padding: 0 10px; }
}

/* ================= SHOP > OFFERS (2026-09-25) =================
   The first rail entry groups every BUNDLE with its discount on show. The page is a stack of
   offer cards (art | name, contents, struck old price + new price, "See contents"). */
.offer-badge {
  position: absolute; z-index: 3; top: 8px; left: 8px;
  width: clamp(108px, 9vw, 140px); aspect-ratio: 1;
  display: grid; place-items: center; pointer-events: none;
  transform: rotate(-8deg);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
}
/* the impact trail: the game's burst star, in red with a dark ink outline */
.offer-badge .burst-star { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.offer-badge .burst-star path { fill: #e0281f; }   /* no outline: just the red trail */
.offer-badge-txt {
  position: relative; transform: translateY(4%);
  font-family: var(--font-display); font-size: clamp(17px, 1.45vw, 23px); line-height: 1; letter-spacing: 0.01em;
  color: #fff; -webkit-text-stroke: 0.12em #4a0a06; paint-order: stroke fill;
  animation: offerPulse 1.6s ease-in-out infinite;
}
/* a subtle heartbeat on the discount figure */
@keyframes offerPulse {
  0%, 100% { transform: translateY(4%) scale(1); }
  50%      { transform: translateY(4%) scale(1.09); }
}
@media (prefers-reduced-motion: reduce) { .offer-badge-txt { animation: none; } }
/* EL PRECIO DE ANTES de una oferta (lotes, aviso de oferta y anuncios del market rebajados):
   delante del precio real y tachado EN DIAGONAL, en rojo, de la esquina de arriba a la
   derecha a la de abajo a la izquierda. La raya es un degradado `to bottom right`, cuya
   linea del 50 % pasa justo por esas dos esquinas, sea cual sea el ancho de la cifra. */
.buy-cost .buy-was, .price-was {
  position: relative; display: inline-block; font-size: 0.78em; opacity: 0.78; margin-right: 0.4em;
  text-decoration: none; font-weight: inherit;
}
.buy-cost .buy-was::after, .price-was::after {
  content: ''; position: absolute; inset: -0.06em -0.22em; pointer-events: none;
  background: linear-gradient(to bottom right, transparent calc(50% - 0.085em), #e0281f calc(50% - 0.085em), #e0281f calc(50% + 0.085em), transparent calc(50% + 0.085em));
}
.mkt-chip .price-was { font-weight: 700; color: #cdbb93; }
/* the OFFERS tab of COSMETICS: red, it is the one on sale */
.cosmetics-tabs .mission-tab.is-offers:not(.on) { color: #ff8a7a; }
.offers-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  /* A GRID OF TILES (2026-10-07): a lone offer used to stretch over the whole panel, which
     looked wrong on big screens. `auto-fill` keeps the empty tracks, so one offer is one tile
     and not the full row. The art is a fixed-height window; a row's tiles share its height.
     `max-content` rows: the tiles clip (`overflow: hidden`), so an `auto` row would be squeezed
     to fit the list's height instead of making the list scroll. */
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(280px, 18vw, 380px)), 1fr));
  grid-auto-rows: max-content; gap: clamp(12px, 1.6vh, 22px);
  align-content: start; padding: 4px 4px 12px;
}
.offer-card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; border: var(--gv-bw, 3px) solid var(--gv-ink, #070f1d);
  background: linear-gradient(180deg, rgba(32, 48, 80, 0.9), rgba(12, 21, 39, 0.95));
  box-shadow: inset 0 var(--gv-hi-h, 4px) 0 var(--gv-hi, rgba(255,255,255,.1)), 0 10px 26px rgba(0,0,0,0.35);
}
.offer-art {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  flex: 0 0 auto; height: clamp(180px, 24vh, 260px); padding: 0; border: 0; cursor: pointer; align-self: stretch;
  background: radial-gradient(90% 120% at 50% 60%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%), rgba(0,0,0,0.25);
}
@media (hover: hover) and (pointer: fine) { .offer-art:hover .emoji-bundle-art { transform: scale(1.04); } }
/* WELCOME PACK: the HOME banner's slide, same background (the bitcoin forest + its veil + the
   gold halo) and the same piece (`.home2-banner-media` with the rays and the bundle compo,
   sized by the home rules); only the media box fills the whole art cell here. */
.offer-art.is-welcome {
  background:
    radial-gradient(90% 120% at 50% 52%, rgba(245,193,74,0.20), transparent 55%),
    linear-gradient(90deg, rgba(6,10,20,0.62), rgba(6,10,20,0.46) 58%, rgba(6,10,20,0.58)),
    url("../UI/bitcoin_forest.jpg") center 58% / cover no-repeat;
}
.offer-art .home2-banner-media.offer-home-media { inset: 0; width: 100%; }
.offer-art .offer-home-media .bundle-compo { height: 84%; }
.offer-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; padding: clamp(14px, 1.4vw, 20px); }
.offer-name { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 1.9vw, 30px); color: var(--gold-bright); line-height: 1.05; }
.offer-desc { margin: 0; font-family: var(--font-body); font-size: 14px; color: var(--text-dim); line-height: 1.4; }
.offer-bits { display: flex; flex-wrap: wrap; gap: 6px; }
.offer-bit {
  font-family: var(--font-ui); font-weight: 800; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text); background: rgba(0,0,0,0.3); border-radius: 999px; padding: 5px 11px;
}
.offer-body .bundle-buy-row { margin-top: auto; }
/* the offer card is half as wide as the bundle panel: smaller figures so old + new price fit */
.offer-body .buy-btn { padding-inline: 8px; }
.offer-body .buy-btn .buy-cost { font-size: clamp(17px, 1.45vw, 24px); gap: 6px; }
.offer-body .buy-btn .buy-cost .coin-md,
.offer-body .buy-btn .buy-cost .gem-md { width: clamp(20px, 1.6vw, 28px); height: clamp(20px, 1.6vw, 28px); }
.offer-see, .offers-back {
  align-self: flex-start; background: none; border: 0; padding: 2px 0; cursor: pointer;
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold-bright);
}
@media (hover: hover) and (pointer: fine) { .offer-see:hover, .offers-back:hover { text-decoration: underline; } }
.offers-back { margin-bottom: 6px; }
/* THE EMOJI BUNDLE: its six stickers in two staggered rows (no showcase card). */
.emoji-bundle-art {
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center;
  width: min(100%, clamp(280px, 30vw, 460px)); transition: transform .2s var(--ease-out);
}
.offer-art .emoji-bundle-art { width: auto; height: 66%; max-width: 88%; aspect-ratio: 1.5; }
.emoji-bundle-art img {
  width: 128%; height: auto; margin: -10% -14%; display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.45));
}
.emoji-bundle-art img:nth-child(odd)  { transform: rotate(-7deg); }
.emoji-bundle-art img:nth-child(even) { transform: rotate(6deg) translateY(6%); }
.emoji-bundle-art img:nth-child(n+4)  { position: relative; z-index: 1; }
/* four stickers (the Rug Rat pack): two rows of two instead of three columns */
.emoji-bundle-art.is-four { grid-template-columns: repeat(2, 1fr); width: min(100%, clamp(200px, 21vw, 320px)); }
.offer-art .emoji-bundle-art.is-four { width: auto; height: 62%; aspect-ratio: 1; }
.emoji-bundle-art.is-four img:nth-child(n+3) { position: relative; z-index: 1; }
@media (max-width: 720px) {
  .offer-art { min-height: 200px; height: 200px; }
}
/* An emoji in a BUNDLE's list (and its confirm/receipt): just the sticker — the row already
   names it. The tile's `cqi` sizes resolve against the inventory card, which isn't here. */
.bundle-row-art.is-voice { background: radial-gradient(circle at 50% 40%, #2b3350 0%, #121828 75%); }
.bundle-row-art.is-voice .voice-art-img { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45)); }
.bundle-row-art.is-voice .voice-art-text { display: none; }
/* Narrow store (the rail becomes a strip ABOVE, one column): COSMETICS — and its OFFERS tab —
   take that column instead of `2 / -1`, which spawned an implicit column over the rail. */
@media (max-width: 1024px) {
  .cosmetics-detail { grid-column: 1 / -1; }
}

/* ============================================================================
   MÓVIL — pasada de ajuste (2026-09-26)
   Lo que se rompía en teléfono medido con un auditor headless (390/360 px vertical,
   844/740 px apaisado). Va al FINAL a propósito: gana por orden a las reglas de
   escritorio sin subir especificidad. El estilo (chapas, tinta, oro) no se toca;
   solo medidas, envolturas y comportamiento táctil.
   ============================================================================ */

/* iOS infla el texto al girar a apaisado si no se fija esto, y el menú apaisado va
   ROTADO a vertical (ver `.app-shell` en pointer:coarse): salía todo más grande. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Safari hace ZOOM a la página al enfocar un campo con letra < 16 px, y en un juego
   con overflow:hidden no hay forma cómoda de deshacerlo. Solo en táctil: en escritorio
   los campos conservan su cuerpo. `!important` porque cada campo trae su propio
   font-size con más especificidad (login, buscador, chat, amigos…). */
@media (hover: none) and (pointer: coarse) {
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  textarea, select { font-size: 16px !important; }
}

/* El menú apaisado se rota con 100vh/100vw. En el móvil 100vh es el viewport GRANDE
   (sin la barra del navegador), así que con la barra visible el lado "inferior" de la
   vista rotada —la barra de navegación— quedaba fuera de pantalla. dvh = lo visible. */
@media (orientation: landscape) and (pointer: coarse) and (hover: none) {
  .app-shell { top: 100dvh; width: 100dvh; }
}

/* CABECERAS (título + contadores): en ≤560 px "SHOP"/"MISSIONS"/"INVENTORY" + dos
   chapas + el banner de gems no caben en una línea y los contadores se montaban
   ENCIMA del título. Primero se encoge el título; si aun así no cabe, los contadores
   bajan a una segunda línea alineados a la derecha en vez de pisarlo. */
@media (max-width: 560px) {
  .shop-head { flex-wrap: wrap; row-gap: 10px; }
  .shop-head > .shop-head-chips,
  .shop-head > .mission-wallet-wrap { margin-left: auto; }
  .shop-head .shop-head-icon { width: 36px; height: 36px; }
  .shop-head h2 { font-size: clamp(22px, 6.4vw, 26px); }
  .shop-title { gap: 10px; }
  /* El contador de gems de la cabecera YA abre la recarga (`openGems`): en el teléfono
     el banner repetía el mismo botón y era lo que empujaba la fila fuera de pantalla. */
  .shop-store .shop-head > .gems-banner { display: none; }
}

/* MISIONES: cuatro pestañas en un inline-flex más ancho que la pantalla — REFERRALS
   quedaba cortada contra el borde sin forma de verla. En el teléfono reparten el ancho. */
@media (max-width: 560px) {
  .missions-screen > .mission-tabs { display: flex; width: 100%; box-sizing: border-box; }
  .missions-screen > .mission-tabs .mission-tab {
    flex: 1 1 0; min-width: 0; min-height: 44px;
    padding: 8px 4px; font-size: 11px; letter-spacing: 0.03em; line-height: 1.2;
  }
  /* (el icono ya va ARRIBA del rótulo desde 1280px, ver .mission-tab-icon) */
  .missions-screen > .mission-tabs .mission-tab { gap: 3px; }
  .mission-tab-icon { width: 30px; height: 30px; }
}

/* AJUSTES › Username: en ≤620 px `.settings-btn` pasa a width:100% y, al estar en la
   MISMA fila que el campo, lo aplastaba a 30 px y el botón se salía de la tarjeta.
   Campo arriba a todo el ancho, botón(es) debajo. */
@media (max-width: 620px) {
  .settings-name-edit { flex-wrap: wrap; width: 100%; }
  .settings-name-input { flex: 1 1 100%; width: auto; }
  .settings-name-edit .settings-btn { flex: 1 1 100%; }
}

/* TIENDA › rail: en el teléfono los banderines medían 41vw (148 px a 360) y al nombre le
   quedaban 55 px: «WELCOME» y «COSMETICS» perdían letras. Dos por fila llenando la fila
   (el hueco es el `gap: 8px` del rail), y el nombre un punto más prieto. */
@media (max-width: 560px) {
  .store-rail-item { width: min(172px, calc(50% - 4px)); }
  .store-rail-name { font-size: 10.5px; letter-spacing: 0; }
}
/* 320-340 px (SE de 1a gen.): el sobre de la ventana encoge para dejarle sitio al nombre. */
@media (max-width: 340px) {
  .store-rail-item { --pack-w: 40px; }
  .store-rail-item .store-rail-clip > img { height: 58px; }
  .store-rail-name { font-size: 10px; }
}

/* DUELO › mano en táctil: el `:hover` se queda pegado tras un toque y
   `.card.blocked.in-hand:hover` (0,4,0) sustituía el `translateY(30%)` de reposo del
   abanico → la carta bloqueada tocada saltaba hacia arriba y se quedaba así. En táctil
   una carta de la mano solo se mueve por gesto (`.raised`, arrastre), nunca por hover. */
@media (hover: none) {
  .hand-fan-slot .card.in-hand:hover:not(.raised):not(.drop-active) { transform: translateY(30%); }
}

/* Modales del duelo: 88vh es el viewport GRANDE en el móvil; con la barra del navegador
   visible el pie del modal quedaba debajo de ella. */
.duel-settings-modal { max-height: 88dvh; }

/* SOBRES › resumen: en un teléfono vertical las 5 cartas ya llenan la pantalla y el único
   botón (ADD TO COLLECTION) quedaba por debajo del pliegue, sin pista de que había que
   bajar. Se queda pegado al pie del resumen (que es quien hace scroll) sobre un velo. */
@media (max-width: 720px) {
  .po-summary { max-height: 94dvh; }
  .po-summary-actions {
    position: sticky; bottom: 0; z-index: 40; align-self: stretch;
    margin-top: 4px;
    padding: 18px 0 max(12px, var(--safe-b, 0px));
    background: linear-gradient(180deg, rgba(4, 8, 18, 0), rgba(4, 8, 18, 0.88) 45%);
  }
}

/* Objetivos táctiles pequeños (medidos a 30 px de alto): el conmutador Regular/Foil/Skins
   de la colección y el plegador de la colección del constructor. Solo con dedo. */
@media (hover: none) and (pointer: coarse) {
  .cs-toggle-btn { padding-top: 11px; padding-bottom: 11px; }
  .db-coll-toggle { width: 52px; height: 38px; }
}

/* ============================================================
   MARKET — el banner de la cabecera y su pagina (OPEN MARKET + TRADE)

   Misma familia que GEMS (`.gems-banner`, `.gems-page-head`): el banner ES un `.gems-banner`
   con otra cara, y la pagina reusa la cabecera de la de gems. Aqui solo vive lo propio. El
   relieve es el del kit (`--gv-*`): contorno de tinta, luz arriba, sombra abajo.
   ============================================================ */

/* Las dos puertas de la cabecera, juntas: GET GEMS a la izquierda y MARKET a su derecha.
   La caja se lleva el hueco (y los margenes) que antes tenia el banner de gems solo. */
.shop-head-banners {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: stretch; gap: clamp(8px, 1vw, 16px);
  max-width: clamp(420px, 52vw, 900px);
  margin: 0 clamp(10px, 1.4vw, 30px);
}
.shop-head-banners > .gems-banner {
  /* `auto` y no `0`: cada banner pide lo que ocupa su rotulo y solo se reparte lo que sobra.
     A partes iguales, "GET GEMS" (mas largo que "MARKET") se quedaba en puntos suspensivos. */
  flex: 1 1 auto; max-width: none; margin: 0;
  gap: clamp(8px, 0.9vw, 16px); padding-inline: clamp(12px, 1.1vw, 22px);
}
.shop-head-banners .gems-banner-title { font-size: clamp(15px, 1.5vw, 25px); }

/* MARKET va en ambar: es la puerta del ORO, igual que el azul es la de las gems. */
.market-banner {
  background: linear-gradient(180deg, #c98a1f 0%, #8f5a10 52%, #6b410a 100%);
}
.market-banner .gems-banner-arrows { --arw-c: rgba(255, 236, 190, 0.20); }
.market-banner .gems-banner-icon { filter: drop-shadow(0 2px 5px rgba(44, 24, 4, .75)); }
.market-banner .gems-banner-title,
.market-banner .gems-banner-go { text-shadow: 0 2px 4px rgba(44, 24, 4, .8); }
.market-banner .gems-banner-go { color: #ffe9b8; }
@media (hover: hover) and (pointer: fine) {
  .market-banner:hover {
    box-shadow:
      inset 0 var(--gv-hi-h) 0 rgba(255, 255, 255, 0.20),
      inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh),
      0 8px 18px -8px rgba(0, 0, 0, 0.8),
      0 0 16px rgba(245, 193, 74, 0.45);
  }
}
.market-banner:active {
  box-shadow:
    inset 0 4px 8px rgba(44, 24, 4, 0.75),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.35);
}
/* Bloqueado (por debajo del nivel minimo): apagado, con la chapa del nivel en vez de la flecha.
   Sigue siendo pulsable: la pagina explica como se desbloquea. */
.market-banner.is-locked { filter: saturate(0.45) brightness(0.82); }
.market-banner.is-locked .gems-banner-arrows { display: none; }
.market-banner-lock {
  margin-left: auto; flex-shrink: 0;
  padding: 3px 9px; border-radius: 9px;
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(11px, 0.9vw, 14px); letter-spacing: .06em;
  color: #fff; background: rgba(0, 0, 0, 0.42); border: 2px solid var(--gv-ink);
  display: inline-flex; align-items: center; gap: 5px;
}
/* El CANDADO, el mismo del resto de cosas bloqueadas (modos de duelo, avatares). Va dentro de
   la chapa, que ya esta fuera del apagado del banner... no: el banner entero va apagado con
   `filter`, asi que la chapa lo deshace para que el candado se vea a todo color. */
.market-banner.is-locked .market-banner-lock { filter: saturate(2.2) brightness(1.2); }
.market-banner-lock-ico { font-size: 1.25em; line-height: 1; }

@media (max-width: 720px) {
  .shop-head-banners { flex: 0 0 auto; max-width: none; margin: 0 8px; gap: 6px; }
  .shop-head-banners > .gems-banner { flex: 0 0 auto; margin: 0; }
  /* En movil solo el candado: el nivel lo dice la pagina. */
  .market-banner-lock-lv { display: none; }
  .market-banner-lock { margin-left: 0; padding: 2px 5px; }
}

/* ---- LA PAGINA ---- */
.market-page {
  flex: 1 0 auto; min-height: 0; width: 100%;
  display: flex; flex-direction: column; gap: clamp(12px, 1.8vh, 22px);
  padding: clamp(4px, 1vh, 12px) 0;
}
.market-page-title { color: var(--gold-bright); text-shadow: 0 3px 0 rgba(44, 24, 4, .55), 0 6px 16px rgba(0, 0, 0, .55); }

.mkt-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mkt-tabs { margin: 0; }
.mkt-cta { width: auto; flex: 0 0 auto; padding-inline: clamp(18px, 2vw, 34px); }
.mkt-rules { margin: 0; max-width: 110ch; font-size: clamp(12.5px, 1vw, 15px); line-height: 1.45; color: #c9b48a; }

.mkt-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-controls .filter-bar { flex: 1 1 280px; padding: 0; }
.mkt-select {
  width: auto; flex: 0 0 auto; padding: 9px 12px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  color-scheme: dark;
}
.mkt-select option { background: #101a30; color: var(--text); }
.mkt-view { align-self: center; }
.mkt-refresh { font-size: 20px; line-height: 1; color: var(--text-dim); width: 40px; height: 40px; }
.mkt-refresh:disabled { opacity: .45; cursor: default; }
.mkt-msg { margin: 0; cursor: pointer; }

.mkt-body { min-height: 180px; }
.mkt-body[aria-busy="true"] { opacity: .6; transition: opacity .15s; }
.mkt-empty { min-height: 160px; }

/* ---- la rejilla de anuncios ---- */
.mkt-grid {
  display: grid; align-content: start; gap: clamp(10px, 1.1vw, 16px);
  grid-template-columns: repeat(auto-fill, minmax(clamp(132px, 12vw, 176px), 1fr));
}
.mkt-tile {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 8px 8px 10px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 33, 56, 0.92), rgba(10, 15, 28, 0.94));
  border: 2px solid var(--gv-ink);
  box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh), 0 4px 10px -6px rgba(0, 0, 0, 0.7);
  transition: transform .14s var(--ease-out), border-color .14s ease;
}
@media (hover: hover) and (pointer: fine) {
  .mkt-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--gold) 55%, var(--gv-ink)); }
}
.mkt-tile.is-closed { opacity: .62; }
@media (hover: hover) and (pointer: fine) { .mkt-tile.is-closed:hover { transform: none; } }
.mkt-tile-card { position: relative; }
.mkt-tile-card .card { width: 100%; cursor: zoom-in; }
.mkt-cost { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.mkt-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 4px; border-radius: 9px;
  font-family: var(--font-ui); font-weight: 800; font-size: 13.5px;
  background: rgba(0, 0, 0, 0.36); border: 2px solid var(--gv-ink);
}
.mkt-chip img { width: 18px; height: 18px; object-fit: contain; }
.mkt-chip.is-gold { color: var(--gold-bright); }
.mkt-chip.is-gems { color: var(--gem-text); }
.mkt-by {
  font-family: var(--font-ui); font-weight: 600; font-size: 12px; color: var(--text-dim); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mkt-btn { width: 100%; min-height: 36px; --gb-h: 36px; font-size: 12.5px; padding-inline: 8px; margin-top: auto; }
.mkt-btn + .mkt-btn { margin-top: 0; }
.mkt-status {
  align-self: center; padding: 2px 9px; border-radius: 8px;
  font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: .07em;
  color: var(--text-dim); background: rgba(0, 0, 0, 0.36); border: 1px solid var(--border-soft);
}
.mkt-status.is-active, .mkt-status.is-open, .mkt-status.is-pending { color: #bbf7d0; border-color: rgba(34, 197, 94, 0.5); }
.mkt-status.is-sold, .mkt-status.is-done, .mkt-status.is-accepted { color: #2a1c02; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); border-color: var(--gv-ink); }

/* La carta que un anuncio de intercambio BUSCA. */
.mkt-want { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.mkt-want-label { font-family: var(--font-ui); font-weight: 800; font-size: 10px; letter-spacing: .1em; color: var(--text-muted); }
.mkt-want-name {
  appearance: none; border: 0; background: none; padding: 0; max-width: 100%;
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; color: var(--gold-bright); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.mkt-want-name { cursor: zoom-in; text-decoration: underline dotted; text-underline-offset: 3px; }
.mkt-want-name.is-any { color: var(--text); }

/* ---- MIS INTERCAMBIOS: un anuncio por fila, con sus ofertas al lado ---- */
.mkt-mine { display: flex; flex-direction: column; gap: clamp(10px, 1.4vh, 16px); }
.mkt-section {
  margin: 6px 0 0; font-family: var(--font-display); letter-spacing: .04em;
  font-size: clamp(17px, 1.5vw, 24px); color: var(--gold-bright);
}
.mkt-ad {
  display: flex; gap: clamp(10px, 1.2vw, 18px); align-items: flex-start;
  padding: clamp(8px, 1vw, 14px); border-radius: 18px;
  background: rgba(0, 0, 0, 0.26); border: 2px solid var(--gv-ink);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.3);
}
.mkt-ad.is-closed { opacity: .62; }
.mkt-ad > .mkt-tile { flex: 0 0 clamp(120px, 11vw, 160px); }
.mkt-ad-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mkt-ad-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mkt-ad-head .mkt-want { align-items: flex-start; }
.mkt-ad-head .mkt-btn { width: auto; margin: 0 0 0 auto; padding-inline: 16px; }
.mkt-offers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(clamp(118px, 10vw, 150px), 1fr)); }
.mkt-hint { margin: 0; font-size: clamp(12.5px, 1vw, 14.5px); line-height: 1.45; color: var(--text-dim); }

/* ---- bloqueado ---- */
.mkt-locked {
  align-self: center; margin-top: clamp(10px, 4vh, 48px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: clamp(22px, 3vw, 40px) clamp(22px, 4vw, 60px); border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 33, 56, 0.92), rgba(10, 15, 28, 0.94));
  border: var(--gv-bw) solid var(--gv-ink);
  box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh);
}
.mkt-locked-ico { font-size: clamp(46px, 5vw, 68px); line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); }
.mkt-locked h3 { margin: 6px 0 0; font-family: var(--font-display); letter-spacing: .04em; font-size: clamp(22px, 2.2vw, 34px); color: var(--gold-bright); }
.mkt-locked p { margin: 0; font-size: clamp(14px, 1.2vw, 18px); color: var(--text); }

/* ---- los cuadros (sobre `.buy-done`) ---- */
.mkt-dialog { width: min(440px, 100%); max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
.mkt-dialog.is-wide { width: min(880px, 100%); }
/* El cuadro de DOS cartas (publicar un intercambio): con el ancho de serie no cabian las dos
   mas la flecha y salia barra de desplazamiento. */
.mkt-dialog.is-mid { width: min(620px, 100%); }
.mkt-dlg-card { display: block; width: clamp(120px, 14vw, 170px); }
.mkt-dlg-card .card { width: 100%; }
.mkt-dlg-msg { margin: 0; width: 100%; }
.mkt-lines { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.mkt-line {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text);
}
.mkt-price { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--text); }
.mkt-price-row { display: flex; align-items: center; gap: 8px; }
.mkt-price-row img { width: 30px; height: 30px; object-fit: contain; }
.mkt-price-row .settings-input { width: 140px; text-align: center; font-size: 20px; font-weight: 800; color: var(--gold-bright); }
.mkt-band { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.mkt-band.is-bad { color: #fecaca; }

.mkt-swap { display: flex; align-items: flex-start; justify-content: center; gap: clamp(8px, 1.4vw, 18px); }
.mkt-swap-side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mkt-swap-side small { font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: .1em; color: var(--text-muted); }
.mkt-swap-arrow { font-size: 30px; color: var(--gold-bright); align-self: center; }
/* La carta que BUSCAS, pulsable para volver a elegirla. */
.mkt-swap-pick { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; border-radius: 14px; transition: transform .14s var(--ease-out), filter .14s ease; }
@media (hover: hover) and (pointer: fine) { .mkt-swap-pick:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.12); } }
.mkt-swap-pick:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 4px; }
.mkt-swap-pick .card { pointer-events: none; }
.mkt-swap-side small.mkt-swap-change { letter-spacing: .04em; color: var(--gold-bright); }

.mkt-picker { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.mkt-picker-search { align-self: center; width: min(320px, 100%); padding: 9px 12px; }
.mkt-picker-grid {
  display: grid; gap: 10px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(clamp(96px, 11vw, 128px), 1fr));
  max-height: min(52vh, 520px); overflow-y: auto; padding: 4px;
}
.mkt-pick {
  position: relative; appearance: none; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 11px; transition: transform .12s var(--ease-out);
}
.mkt-pick .card { width: 100%; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .mkt-pick:hover { transform: translateY(-3px); } }
.mkt-pick:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
/* La casilla "cualquier carta": un hueco con la proporcion de una carta. */
.mkt-pick.is-any {
  aspect-ratio: 11 / 16;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: .05em; color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.3); border: 2px dashed color-mix(in srgb, var(--gold) 60%, transparent);
}
.mkt-pick.is-any small { font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--text-dim); }
span.mkt-pick.is-any { cursor: default; }
@media (hover: hover) and (pointer: fine) { span.mkt-pick.is-any:hover { transform: none; } }

@media (max-width: 720px) {
  .mkt-cta { flex: 1 1 100%; }
  .mkt-controls .filter-bar { flex: 1 1 100%; }
  /* Los dos desplegables se llevan su propia fila a medias: apretados junto al conmutador se
     quedaban en dos letras. */
  .mkt-select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .mkt-view { flex: 1 1 auto; }
  .mkt-view .cs-toggle-btn { flex: 1 1 0; }
  .mkt-ad { flex-direction: column; align-items: stretch; }
  .mkt-ad > .mkt-tile { flex: 0 0 auto; width: 150px; align-self: center; }
  .mkt-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .mkt-tile, .mkt-pick { transition: none; }
}

/* ---- AVISOS DEL MARKET: el numero rojo y el pop-up de venta ---- */
/* En el banner el numero va EN LA FILA (el banner recorta lo que sobresale, asi que una chapa
   colgada de la esquina saldria cortada), pegado al rotulo. */
.market-banner-badge {
  position: static; flex-shrink: 0;
  min-width: 22px; height: 22px; padding: 0 6px; font-size: 13px;
}
/* En las pestañas y en el conmutador ALL / MINE, colgado de la esquina como en INVENTORY. */
.mkt-badge { top: -7px; right: -5px; z-index: 1; }
.mkt-view .cs-toggle-btn { position: relative; }

.mkt-sold-cards { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: clamp(8px, 1vw, 14px); }
.mkt-sold-card { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mkt-sold-cards.is-many .mkt-dlg-card { width: clamp(84px, 9vw, 110px); }
.mkt-sold-total { justify-content: center; gap: 12px; font-size: 16px; }
.mkt-sold-total .mkt-chip { font-size: 17px; padding: 3px 11px 3px 6px; }
.mkt-sold-total .mkt-chip img { width: 22px; height: 22px; }

/* Las dos pestañas del market llevan icono (el oro de la venta, las cartas del intercambio). */
.mkt-tabs .mission-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.mkt-tabs .mission-tab-icon { width: 30px; height: 30px; margin: -7px 0; }

/* AUCTIONS: la pestaña existe, el contenido aun no. Mismo panel que el market bloqueado. */
.mkt-soon-ico { width: clamp(84px, 9vw, 128px); height: auto; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6)); }
/* Tres pestañas con icono no caben en una fila de movil: el icono sube encima del rotulo. */
@media (max-width: 720px) {
  .mkt-tabs { display: flex; width: 100%; }
  .mkt-tabs .mission-tab { flex: 1 1 0; flex-direction: column; gap: 3px; padding: 8px 6px; font-size: 11.5px; }
  .mkt-tabs .mission-tab-icon { margin: 0; }
}

/* ---- MARKET, 2a pasada: pestañas grandes y el buscador EN SU FILA ----
   Fila 1: las tres pestañas a la izquierda y el buscador + FILTER llenando hasta el borde
   derecho, a la misma altura. Fila 2: orden, acabado, vista, recargar y el boton de vender /
   publicar al final. El titulo y la vuelta viven ahora en la cabecera de la tienda. */
.mkt-bar { flex-wrap: nowrap; align-items: stretch; gap: clamp(10px, 1.2vw, 18px); }
.mkt-tabs { flex: 0 0 auto; padding: 5px; border-radius: 16px; }
.mkt-tabs .mission-tab { padding: 14px clamp(16px, 1.7vw, 28px); font-size: clamp(14px, 1.15vw, 16.5px); gap: 10px; border-radius: 12px; }
.mkt-tabs .mission-tab-icon { width: clamp(38px, 3.2vw, 48px); height: clamp(38px, 3.2vw, 48px); margin: -10px 0; }
.mkt-tabs .mkt-badge { top: -6px; right: -4px; min-width: 20px; height: 20px; font-size: 12.5px; }
.mkt-bar .filter-bar { flex: 1 1 auto; min-width: 0; padding: 0; align-items: stretch; }
.mkt-bar .filter-search-input, .mkt-bar .filter-btn { font-size: 15px; }
.mkt-controls .mkt-cta { margin-left: auto; }
.mkt-rules { max-width: none; }
/* El banner de vuelta: flecha delante, sin las rayas que empujan hacia la derecha. */
.market-banner.is-back .gems-banner-arrows { display: none; }
.market-banner.is-back .gems-banner-go { margin-left: 0; }
@media (hover: hover) and (pointer: fine) { .market-banner.is-back:hover .gems-banner-go { transform: translateX(-4px); } }
.market-banner.is-back .gems-banner-title { font-size: clamp(13px, 1.25vw, 21px); }
@media (max-width: 1100px) {
  /* Ya no caben en una fila: el buscador baja debajo de las pestañas, con sus mismos bordes. */
  .mkt-bar { flex-wrap: wrap; }
  .mkt-bar .filter-bar { flex: 1 1 100%; }
  .mkt-bar .filter-search { min-height: 44px; }
}
@media (max-width: 720px) {
  .mkt-tabs .mission-tab { padding: 9px 6px; font-size: 11.5px; gap: 3px; }
  .mkt-tabs .mission-tab-icon { width: 38px; height: 38px; margin: 0; }
  .mkt-controls .mkt-cta { margin-left: 0; order: -1; }
}
/* "GO BACK TO SHOP" es largo y el titulo MARKET le quita sitio a la fila: el rotulo va en DOS
   lineas ("GO BACK / TO SHOP") y GET GEMS no cede ancho, asi ninguno acaba en puntos suspensivos. */
.market-banner.is-back .gems-banner-title {
  white-space: normal; overflow: visible; text-overflow: clip;
  width: 5.6em; flex: 0 0 auto; line-height: 1.08; font-size: clamp(13px, 1.2vw, 20px); text-align: left;
}

/* ---- MARKET, 3a pasada ---- */
/* Dentro del market los dos banners de la cabecera son GEMELOS: mismo ancho, mismo alto, mismo
   cuerpo de letra y el icono del mismo tamaño visible. El PNG de la tienda trae mas aire
   alrededor del dibujo que el de la gema, asi que se amplia para que los dos DIBUJOS midan
   lo mismo (la caja ya era igual). */
.shop-head-banners:has(.is-back) > .gems-banner { flex: 1 1 0; min-width: 0; }
.shop-head-banners:has(.is-back) .gems-banner-title { font-size: clamp(13px, 1.2vw, 20px); }
.market-banner.is-back .gems-banner-icon { transform: scale(1.4); }
.market-banner.is-back .gems-banner-title { width: auto; flex: 0 1 5.6em; }

/* La descripcion de cada pestaña vive en su tooltip (`data-tip` -> `.ui-tip`). Donde no hay
   hover (movil) no hay tooltip, asi que alli se queda la linea corta bajo los mandos. */
.mkt-rules { display: none; }
@media (hover: none) { .mkt-rules { display: block; } }

/* ---- FEES: la chapa informativa y su ficha ---- */
.mkt-fees { position: relative; flex: 0 0 auto; display: flex; }
.mkt-fees-btn {
  appearance: none; cursor: help;
  display: inline-flex; align-items: center; gap: 8px; padding: 0 clamp(12px, 1.1vw, 18px);
  font-family: var(--font-ui); font-weight: 800; font-size: clamp(13px, 1.05vw, 15px); letter-spacing: .08em;
  color: var(--gem-text); border-radius: 14px;
  border: 2px solid var(--gv-ink); background: var(--gem-face);
  box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh), 0 4px 10px -6px rgba(0, 0, 0, 0.7);
  transition: transform .14s var(--ease-out), background .14s ease;
}
.mkt-fees.is-open .mkt-fees-btn { background: var(--gem-face-hover); transform: translateY(-1px); }
@media (hover: hover) and (pointer: fine) { .mkt-fees-btn:hover { background: var(--gem-face-hover); transform: translateY(-1px); } }
.mkt-fees-btn:focus-visible { outline: 2px solid #7cc0ff; outline-offset: 2px; }
.mkt-fees-i {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 15px; line-height: 1;
  color: #0f2751; background: #dbeeff; border: 2px solid var(--gv-ink);
}
.mkt-fees-pop {
  position: absolute; top: calc(100% + 12px); left: 50%; z-index: 60;
  width: max-content; max-width: min(92vw, 520px);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 16px 13px; border-radius: 16px; text-align: center;
  border: 2px solid var(--gv-ink);
  background: linear-gradient(180deg, #1b2439 0%, #0c1220 100%);
  box-shadow: inset 0 2px 0 var(--gv-hi), inset 0 -4px 0 var(--gv-sh), 0 8px 0 rgba(3, 7, 15, 0.45), 0 18px 34px rgba(0, 0, 0, 0.55);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, 4px); transition: opacity .12s ease, transform .14s ease, visibility 0s linear .14s;
}
/* La flechita, como la del `.ui-tip`. */
.mkt-fees-pop::after {
  content: ""; position: absolute; bottom: 100%; left: 50%; width: 12px; height: 12px; margin: 0 0 -7px -6px;
  background: #1b2439; border-left: 2px solid var(--gv-ink); border-top: 2px solid var(--gv-ink); transform: rotate(45deg);
}
.mkt-fees.is-open .mkt-fees-pop {
  opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s;
}
@media (hover: hover) and (pointer: fine) {
  .mkt-fees:hover .mkt-fees-pop { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
}
.mkt-fees-title { font-family: var(--font-display); font-weight: 400; letter-spacing: .05em; font-size: 17px; color: var(--gold-bright); text-shadow: 0 2px 0 rgba(3, 7, 15, 0.6); }
.mkt-fees-grid { display: grid; grid-template-columns: repeat(4, minmax(78px, 1fr)); gap: 8px; }
.mkt-fee {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 6px 9px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.3); border: 2px solid var(--gv-ink); box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.3);
}
.mkt-fee-name { font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text); white-space: nowrap; }
.mkt-fee .mkt-chip { font-size: 15px; }
.mkt-fees-note { margin: 0; font-family: var(--font-ui); font-weight: 600; font-size: 12.5px; color: var(--text-dim); }

/* El cristal: la imagen del diamante y, encima, el tinte de su rareza con las clases de la carta
   (`.tpl-center-gem.*`, mezcla `color`). `isolation` para que el tinte solo se mezcle con el
   cristal y no con lo que haya detras. En la carta el giro del morado esta centrado arriba
   (50% 8%, donde cae el cristal en el marco); aqui el cristal llena la caja, asi que al centro. */
.rar-gem { position: relative; display: block; width: 34px; isolation: isolate; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.rar-gem img { display: block; width: 100%; height: auto; }
.rar-gem .tpl-center-gem.super {
  background: conic-gradient(from var(--gemAngle) at 50% 50%, #a03cff 0deg, #bd6bff 55deg, #8f2cff 95deg, #4f9bff 124deg, #4f9bff 152deg, #6f66ff 176deg, #a849ff 205deg, #c37bff 250deg, #9233ff 282deg, #5fb4ff 308deg, #5fb4ff 332deg, #7d5cff 348deg, #a03cff 360deg);
}
.rar-gem .tpl-center-gem.super-depth {
  background: conic-gradient(from var(--gemAngle) at 50% 50%, #b98cff, #d9c2ff, #a878ff, #cdb0ff, #b98cff);
}

@media (max-width: 1100px) {
  .mkt-fees-btn { min-height: 44px; }
}
@media (max-width: 720px) {
  /* En movil la chapa va a la derecha del buscador y la ficha se abre hacia la izquierda. */
  .mkt-fees { order: 3; }
  .mkt-bar .filter-bar { flex: 1 1 0; }
  .mkt-fees-pop { left: auto; right: 0; transform: translate(0, 4px); }
  .mkt-fees.is-open .mkt-fees-pop { transform: translate(0, 0); }
  .mkt-fees-pop::after { left: auto; right: 28px; }
  .mkt-fees-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: 6px; }
}

/* ---- el ZOOM de un anuncio: la carta y, a su derecha, sus datos ----
   El panel es HERMANO de la carta, no hijo: `applyFoilTilt` inclina `.card.foil-card` con el
   raton, asi que la foil se mueve y el precio, la comision y el nombre se quedan quietos. */
.mkt-zoom { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 44px); max-width: 100%; }
.mkt-zoom-info {
  flex: 0 0 auto; min-width: 190px; max-width: 280px; cursor: default;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px; border-radius: 18px;
  border: var(--gv-bw) solid var(--gv-ink);
  background: linear-gradient(180deg, rgba(27, 36, 57, 0.97), rgba(12, 18, 32, 0.98));
  box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh), 0 18px 40px rgba(0, 0, 0, 0.6);
}
.mkt-zoom-line { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.mkt-zoom-line small { font-family: var(--font-ui); font-weight: 800; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.mkt-zoom-line .mkt-cost { justify-content: flex-start; }
.mkt-zoom-line .mkt-chip { font-size: 20px; padding: 4px 13px 4px 7px; border-radius: 11px; }
.mkt-zoom-line .mkt-chip img { width: 26px; height: 26px; }
.mkt-zoom-text { font-family: var(--font-ui); font-weight: 800; font-size: 18px; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 720px), (orientation: portrait) {
  /* Sin sitio al lado: el panel baja debajo de la carta, en una fila. */
  .mkt-zoom { flex-direction: column; gap: 14px; }
  .mkt-zoom-info { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 12px 22px; max-width: 94vw; padding: 12px 16px; }
  .mkt-zoom-line { align-items: center; }
  .mkt-zoom-line .mkt-chip { font-size: 16px; }
  .mkt-zoom-text { font-size: 15px; }
}

/* GO BACK TO SHOP, 2a vuelta: el rotulo en UNA linea y las flechas del fondo hacia la IZQUIERDA.
   Las flechas son las mismas del banner (`.gems-banner-arrows`) en espejo: `scaleX(-1)` les da
   la vuelta a la punta, al sentido del desplazamiento y al degradado que las apaga, de una vez.
   Para que quepa en una linea al mismo ancho que GET GEMS se va el galon suelto (la direccion
   ya la dicen las flechas) y los dos rotulos bajan un punto, iguales entre si. */
.market-banner.is-back .gems-banner-arrows { display: block; transform: scaleX(-1); }
.market-banner.is-back .gems-banner-go { display: none; }
.market-banner.is-back .gems-banner-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: auto; flex: 1 1 auto; min-width: 0; line-height: 1.15; text-align: left;
}
.shop-head-banners:has(.is-back) .gems-banner-title { font-size: clamp(11px, 1.08vw, 18px); }
.shop-head-banners:has(.is-back) > .gems-banner { gap: clamp(7px, 0.8vw, 13px); padding-inline: clamp(10px, 1vw, 18px); }
.shop-head-banners:has(.is-back) { margin-inline: clamp(8px, 1vw, 22px); }
/* "MARKET" es mas largo que "SHOP" y le quitaba a los banners justo el ancho que le falta a
   "GO BACK TO SHOP" para ir en una linea: con el market abierto el titulo baja un punto. */
.shop-store .shop-head:has(.market-banner.is-back) h2 { font-size: clamp(22px, 3.1vw, 42px); }
.shop-store .shop-head:has(.market-banner.is-back) { gap: 8px; }
.shop-head-banners:has(.is-back) .gems-banner-title { font-size: clamp(10.5px, 1vw, 18px); letter-spacing: .02em; }
.market-banner.is-back .gems-banner-icon { transform: scale(1.3); margin-inline: 0.12em; }
/* Con la barra lateral puesta y la ventana justa (1025-1300 px) es donde menos cabe. */
@media (min-width: 1025px) and (max-width: 1300px) {
  .shop-head-banners:has(.is-back) .gems-banner-title { font-size: clamp(10px, 0.9vw, 12px); letter-spacing: 0; }
  .shop-head-banners:has(.is-back) > .gems-banner { padding-inline: 9px; gap: 7px; }
}

/* El banner de vuelta lleva dos rotulos: el entero y uno corto ("BACK") para las ventanas
   donde "GO BACK TO SHOP" no cabe en una linea ni bajando la letra. */
.market-banner.is-back .is-short { display: none; }
@media (max-width: 1100px) {
  .market-banner.is-back .is-full { display: none; }
  .market-banner.is-back .is-short { display: inline; }
}

/* ---- LOS DESPLEGABLES DEL MARKET (`MarketSelect`) ----
   Boton y panel del desplegable de COSMETICS (`.cosm-filter-*`); aqui solo lo propio: la
   etiqueta apagada delante del valor, y las opciones como filas con su marca. */
.mkt-dd-head { min-height: 40px; padding: 8px 13px; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13.5px; }
.mkt-dd-label { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.mkt-dd-value { font-weight: 800; color: var(--text); white-space: nowrap; }
.mkt-dd.open .mkt-dd-value { color: var(--gold-bright); }
@media (hover: hover) and (pointer: fine) { .mkt-dd-head:hover .mkt-dd-value { color: var(--gold-bright); } }
.mkt-dd-menu { left: 0; right: auto; min-width: max(100%, 190px); padding: 6px; gap: 2px; z-index: 55; }
/* En MY COLLECTION el desplegable de edicion va pegado a la derecha: el menu abre hacia dentro. */
.cs-controls .mkt-dd-menu { left: auto; right: 0; }
.mkt-dd-opt {
  appearance: none; border: 0; background: none; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 10px; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: 13.5px; color: var(--text-dim); white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
@media (hover: hover) and (pointer: fine) { .mkt-dd-opt:hover { background: var(--surface-1); color: var(--text); } }
.mkt-dd-opt:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
.mkt-dd-opt.on { color: #2a1c02; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); box-shadow: inset 0 2px 0 var(--gv-hi-gold, rgba(255, 255, 255, 0.5)), inset 0 -3px 0 var(--gv-sh-gold, rgba(120, 74, 8, 0.4)); }
/* La marca de la opcion elegida: un punto que solo se llena en la activa. */
.mkt-dd-tick { flex: none; width: 9px; height: 9px; border-radius: 50%; border: 2px solid currentColor; opacity: .45; }
.mkt-dd-opt.on .mkt-dd-tick { background: currentColor; opacity: 1; }
@media (max-width: 720px) {
  .mkt-dd { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .mkt-dd-head { width: 100%; justify-content: space-between; }
  .mkt-dd-head .cosm-filter-caret { margin-left: auto; }
  .mkt-dd-value { overflow: hidden; text-overflow: ellipsis; }
}
/* Entre 721 y 1100 px, con el rotulo corto, mitad y mitad dejaba a GET GEMS sin sitio: ahi cada
   banner pide lo suyo (en escritorio siguen siendo gemelos; en movil son solo icono). */
@media (min-width: 721px) and (max-width: 1100px) {
  .shop-head-banners:has(.is-back) > .gems-banner { flex: 1 1 auto; }
}

/* FEES por ACABADO: dos filas por rareza (Regular / Foil), cada una con su precio. */
.mkt-fee-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mkt-fee-row small { font-family: var(--font-ui); font-weight: 800; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.mkt-fee-row.is-foil small {
  background: linear-gradient(115deg, #fbd0e8, #fde9b0, #c9f5d8, #c5e8ff, #e3d2ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mkt-fee-row .mkt-chip { font-size: 13.5px; padding: 1px 7px 1px 3px; }
.mkt-fee-row .mkt-chip img { width: 16px; height: 16px; }
.mkt-fees-grid { grid-template-columns: repeat(4, minmax(104px, 1fr)); }
@media (max-width: 720px) {
  .mkt-fees-grid { grid-template-columns: repeat(2, minmax(104px, 1fr)); }
}

/* MARKET bloqueado, 2a pasada: el nivel va SIN recuadro y con la letra del titulo ("LVL 5",
   del mismo cuerpo que MARKET), y el candado un poco mas grande. */
.market-banner-lock {
  padding: 0; border: 0; border-radius: 0; background: none; gap: clamp(6px, 0.6vw, 10px);
  font-family: var(--font-display); font-weight: 400; letter-spacing: .04em;
  font-size: clamp(16px, 1.7vw, 27px); line-height: 1.15; color: #fff;
  text-shadow: 0 2px 4px rgba(44, 24, 4, .8); white-space: nowrap;
}
.shop-head-banners .market-banner-lock { font-size: clamp(15px, 1.5vw, 25px); }
.market-banner-lock-ico { font-size: 1.3em; text-shadow: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
@media (max-width: 720px) {
  .market-banner-lock { padding: 0; }
  .market-banner-lock-ico { font-size: 24px; }
}
/* Con "LVL 5" a cuerpo de titulo, MARKET + candado + nivel no cabian en el banner y el rotulo
   acababa en puntos suspensivos: bloqueado, los dos textos bajan un punto (iguales entre si) y
   el banner pide algo mas de la fila que GET GEMS. */
.shop-head-banners > .market-banner.is-locked { flex: 1.25 1 auto; gap: clamp(7px, 0.8vw, 13px); padding-inline: clamp(10px, 1vw, 18px); }
.shop-head-banners .market-banner.is-locked .gems-banner-title,
.shop-head-banners .market-banner-lock { font-size: clamp(13px, 1.3vw, 22px); }
.shop-head-banners .market-banner.is-locked .gems-banner-title { flex: 0 0 auto; overflow: visible; }

/* ============================================================================
   PHONE PASS (2026-10-12), for the Android app and for any phone browser.
   ---------------------------------------------------------------------------
   Measured headless at 360x800, 384x832 and 412x915 (portrait menus) and at
   800x360, 832x384 and 915x412 (landscape duel), touch + no hover. Three goals:
   nothing readable under ~11 px, nothing tappable under ~40 px, and the short
   screens (missions, daily reward, tutorial picker) fit WITHOUT scrolling.
   Kept as one block at the end so it can be read, and reverted, in one go.
   ============================================================================ */

/* No rubber-band / pull-to-refresh glow behind the game, no double-tap zoom. */
html, body { overscroll-behavior: none; }
@media (hover: none) and (pointer: coarse) {
  body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

/* ---- Text floor ---- */
@media (max-width: 1024px) {
  .nav-label { font-size: 11px; }
}
@media (max-width: 380px) {
  .nav-label { font-size: 10.5px; letter-spacing: 0; }
}
@media (max-width: 560px) {
  .home2-quick-label { font-size: 11px; letter-spacing: 0.03em; }
  .store-rail-name { font-size: 11px; }
}
@media (max-width: 340px) {
  .store-rail-name { font-size: 10.5px; }
}

/* ---- Tap floor (finger only: a mouse keeps the tight desktop sizes) ---- */
@media (hover: none) and (pointer: coarse) {
  .mission-tab { min-height: 44px; }
  .wallet-chip.big, .shop-packs-chip { min-height: 40px; }
  .home2-coin { min-height: 40px; }
  .home2-play-btn { min-height: 44px; }
  /* The pencil on a deck tile only showed on :hover, which a finger never produces. */
  .home2-deck-edit { opacity: 1; width: 40px; height: 40px; top: 4px; right: 4px; }
  /* Carousel dots are 9 px discs: the disc stays, the finger gets a 36 px halo around it. */
  .home2-banner-dot { position: relative; }
  .home2-banner-dot::after { content: ''; position: absolute; inset: -14px -6px; }
  .ui-btn { min-height: 40px; }
}

/* ---- SETTINGS > GAME SETTINGS: the dropdown (fixed 200 px, 55 % cap overridden further
   down) left the label a ZERO-width column at 384 px and its text wrapped one word per
   line under the dropdown. Label on top, dropdown below at full width. ---- */
@media (max-width: 620px) {
  .setting-row.board-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row.board-row > .setting-text { width: auto; flex: 0 0 auto; }
  .setting-row.board-row > .board-dd { width: 100%; max-width: none; }
}

/* ---- MISSIONS: the section tabs (icon over label) were 75 px tall; 62 px on a phone. ---- */
@media (max-width: 560px) {
  .missions-screen > .mission-tabs { margin-bottom: 0; }
  .missions-screen > .mission-tabs .mission-tab { padding: 6px 4px 5px; gap: 2px; }
  .missions-screen > .mission-tabs .mission-tab-icon { width: 26px; height: 26px; }
  .missions-screen .missions-daily-head { margin: 8px 0 10px; }
  .shop-screen.missions-screen { padding-bottom: 6px; }
}

/* ---- MISSIONS > DAILY: four cards of 148 px (634 px) for a 409 px hole at 360x800.
   Tighter cards and a smaller chest: 4 x 92 px, no scroll. ---- */
@media (max-width: 560px) {
  .missions-screen .missions-list { gap: 8px; }
  .missions-screen .missions-list > .mission-card { padding: 8px 12px 8px 14px; gap: 10px; align-items: center; }
  .missions-screen .missions-list .mission-name { font-size: 16px; margin-bottom: 1px; line-height: 1.15; }
  .missions-screen .missions-list .mission-desc { font-size: 12px; line-height: 1.25; }
  .missions-screen .missions-list .mission-progress { margin-top: 5px; }
  .missions-screen .missions-list .mission-bar { height: 18px; }
  .missions-screen .missions-list .mission-side { width: 96px; gap: 4px; }
  .missions-screen .missions-list .mission-chest-box { width: 34px; height: 34px; }
  .missions-screen .missions-list .mission-chest-box > img { width: 34px; height: 34px; }
  .missions-screen .missions-list .ui-btn.mission-claim { min-height: 38px; width: 100%; }
}

/* ---- MISSIONS > DAILY REWARD: 4 columns = 8 rows = 719 px of calendar. Five columns
   make it 6 rows of ~56 px; the two chips share one line. Fits under the header at
   360x800. (>= 1100 px the grid is still fitted by JS, see `.login-grid.is-fit`.) ---- */
@media (max-width: 560px) {
  .missions-screen.on-login .missions-daily-head { gap: 6px 8px; margin-bottom: 6px; }
  .missions-screen.on-login .missions-reset { padding-left: 10px; padding-right: 10px; font-size: 12px; white-space: nowrap; }
  .missions-screen.on-login .lvr-hint { font-size: 11.5px; line-height: 1.3; }
  .missions-screen .login-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; padding-bottom: 0; }
}

/* ---- DUEL > TUTORIAL: six lessons of 91 px overflowed by 36 px. ---- */
@media (max-width: 560px) {
  .start-screen > .tut-part-list { gap: 8px; margin-top: 10px; }
  .start-screen .tut-part-card { padding: 9px 14px; gap: 12px; }
  .start-screen .tut-part-desc { line-height: 1.25; }
}

/* ---- DUEL on a phone held sideways (short landscape). The peek / showcase rules for
   phones were keyed on `max-width: 820px`, and a current phone is 850 to 930 px wide in
   landscape, so it got the DESKTOP preview: a side panel sized for a 720 px field. A
   phone is a SHORT screen, whatever its width. ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .card-preview-overlay:not(.center),
  .card-showcase {
    position: fixed; inset: 0;
    left: 0 !important; right: 0 !important; top: 0 !important;
    transform: none !important; animation: none !important;
    display: flex; align-items: center; justify-content: center;
    padding: 8px; z-index: 130;
  }
  .card-showcase { flex-direction: column; gap: 6px; z-index: 135; }
  .card-preview-overlay:not(.center)::before {
    content: ''; position: absolute; inset: 0;
    background: rgba(2, 4, 10, 0.62); backdrop-filter: blur(2px);
  }
  .card-preview-overlay:not(.center) .card.preview,
  .card-showcase .card.preview { animation: peekInCenter 180ms var(--ease-out); }
  /* As tall as the screen allows: at 360 px of height the old 58vh card was 209 px tall
     and its rules text 6 px. 90vh makes it 324 px. */
  .card.preview,
  .card-showcase .card.preview { height: min(90vh, 460px); width: auto; aspect-ratio: 5 / 7; }
  .card-preview-overlay.center { z-index: 130; bottom: 5vh; }
  .card-preview-overlay.center .card.preview { height: min(90vh, 460px); width: auto; }
  /* A veil behind the hand peek too: at this size the card covers the board's centre and
     without it the field cards read through the gaps of the frame. */
  .card-preview-overlay.center::before {
    content: ''; position: fixed; inset: 0; z-index: -1;
    background: rgba(2, 4, 10, 0.5);
  }
}

/* ---- ANDROID APP only (`html.is-native`, set by native.js) ---- */
/* The orientation is locked for real, so the "rotate your phone" gate must not flash during
   the half second the device takes to turn when a duel starts. (The CSS-rotated menu needs
   no override: it only ever shows mid-turn, already facing the way the screen will settle.) */
html.is-native .rotate-gate { display: none !important; }

/* ---- ANDROID APP, frame rate (2026-10-12) ----
   Measured with a 4x slower CPU: HOME went from 13 to ~50 fps and the duel from 1 to ~58.
   What costs a frame on a phone is not the number of animations but the ones the GPU cannot
   run alone: a gradient that turns, a background that slides or a box-shadow that breathes
   repaint on the main thread, and that wakes every other animation on the page with it.
   So here they stand still, except on the card being inspected (zoom / duel preview). */
/* The battlefield covers the whole screen: the menu background behind it is never seen. */
html.is-native .game-shell > .bg-fx { display: none; }
html.is-native .bg-fx-grid, html.is-native .bg-fx-base { animation: none; will-change: auto; }
html.is-native .tpl-gem-spell:not(.card-modal *, .card-preview-overlay *),
html.is-native .tpl-center-gem:not(.card-modal *, .card-preview-overlay *),
html.is-native .foil-fx:not(.card-modal *, .card-preview-overlay *) { animation: none !important; }
html.is-native .tpl-spark:not(.card-modal *, .card-preview-overlay *),
html.is-native .tpl-flash:not(.card-modal *, .card-preview-overlay *),
html.is-native .art-bubble:not(.card-modal *, .card-preview-overlay *),
html.is-native .fire-embers { display: none; }
html.is-native .home2-play-btn::before { animation: none; box-shadow: 0 0 18px 3px rgba(245,193,74,0.5); opacity: 0.9; }
html.is-native .home2-xp-fill::before { animation: none; }
/* (2026-11-04, medido en el WebView del emulador) Con el tablero QUIETO el teléfono seguía
   recomponiendo la pantalla entera ~50 veces por segundo: lo pedían el parpadeo de los resplandores
   de las hogueras (y las antorchas WebGL, ya en su fotograma quieto en la app: field-elements.js).
   Con todo parado, 1 fotograma en 5 s. El resplandor se queda encendido y quieto; su `screen` no
   cambiaba nada (la capa de los fuegos aísla la mezcla) y su `will-change` era una capa más. */
html.is-native .fire-fx .fire-glow { animation: none; opacity: .82; mix-blend-mode: normal; will-change: auto; }
/* Dos pulsos que se repintaban en el hilo principal en CADA fotograma mientras duraban (un
   drop-shadow y un box-shadow animados), justo cuando más trabaja el duelo: la habilidad lista
   (todo el turno) y el ENEMY'S TURN (todo el turno de la CPU). En la app: el halo fijo y, en la
   habilidad, el latido solo con `transform`, que lo mueve la GPU sin repintar. */
html.is-native .ability-activate:not(.armed) {
  animation-name: abilityReadyPulseLite;
  filter: drop-shadow(0 0 9px rgba(150, 208, 255, 0.85)) drop-shadow(0 0 22px rgba(56, 130, 246, 0.7));
}
@keyframes abilityReadyPulseLite { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
html.is-native .btn.enemy-turn { animation: none; box-shadow: 0 2px 14px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
/* Las pilas de mazo y cementerio: 28 dorsos con `will-change` eran 28 capas de GPU fijas todo el duelo.
   El barajado los mueve con transiciones CSS, y el navegador sube a capa lo que transiciona mientras
   dura: quietos, cada pila es UNA capa (styles de FX.shuffleDeck en fx-effects.css). */
html.is-native .fx-shuffle-card { will-change: auto; }
/* A blurred backdrop is re-blurred whenever anything moves behind it, and on Android WebView
   it is the usual source of flashing panels. */
html.is-native *, html.is-native *::before, html.is-native *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
/* No scrollbars anywhere in the app (owner, 2026-11-05): every list still scrolls with the finger.
   The game's gold bars (`::-webkit-scrollbar`, top of this file) stayed painted on Android and ate
   10 px of every scrolling screen. !important: some panels set `scrollbar-width: thin` themselves. */
html.is-native, html.is-native * { scrollbar-width: none !important; }
html.is-native::-webkit-scrollbar, html.is-native *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }

/* ============================================================
   TUTORIAL NARRATOR PLACEMENT (2026-10-13)
   `useLarryAnchor` (game.js) decides where the bubble goes so that neither Larry nor the bubble
   covers the step's spotlight: above him (the usual place, with its tail), beside him, or at the
   top of the screen. It writes the spot in px (--bubble-x / --bubble-y) and the bubble leaves the
   column. Only the "above" spot keeps the tail: anywhere else it would point at nothing.
   ============================================================ */
.tut-narrator.at-larry.bubble-placed .tut-bubble {
  position: fixed; left: var(--bubble-x, 0px); top: var(--bubble-y, 0px); margin: 0;
  width: min(520px, 46vw);
}
.tut-narrator.at-larry.bubble-placed .tut-bubble::before { left: clamp(14px, calc(var(--tail-x, 60px) - 14px), calc(100% - 42px)); }
.tut-narrator.at-larry.bubble-placed .tut-bubble::after  { left: clamp(16px, calc(var(--tail-x, 60px) - 12px), calc(100% - 40px)); }
.tut-narrator.at-larry.bubble-placed:not(.bubble-above) .tut-bubble::before,
.tut-narrator.at-larry.bubble-placed:not(.bubble-above) .tut-bubble::after { display: none; }
/* SMALL SCREENS (a phone in landscape is ~400 px tall): a smaller Larry and a compact bubble.
   The same test and the same numbers as LARRY_SMALL_* in game.js. */
@media (max-height: 520px), (max-width: 900px) {
  .tut-narrator.at-larry, .tut-narrator.at-larry.pos-bottom, .tut-narrator.at-larry.pos-top {
    --larry-width: clamp(112px, 34vh, 170px);
    width: min(340px, 44vw);
  }
  .tut-narrator.at-larry .tut-bubble,
  .tut-narrator.at-larry.bubble-placed .tut-bubble { width: min(340px, 44vw); padding: 8px 12px 9px; border-radius: 12px; }
  .tut-narrator.at-larry .tut-bubble { margin-bottom: 22px; }
  .tut-narrator.at-larry.bubble-placed .tut-bubble { margin: 0; }
  .tut-narrator .tut-bubble-name { font-size: 10px; margin-bottom: 4px; }
  .tut-narrator .tut-bubble-text { font-size: 12.5px; line-height: 1.38; min-height: 2.6em; }
  .tut-narrator .tut-bubble-actions { margin-top: 6px; min-height: 0; }
  .tut-narrator .tut-bubble-actions .ui-btn.tut-next { font-size: 12px; min-height: 34px; padding-top: 0; padding-bottom: 0; }
  .tut-narrator .tut-hint { font-size: 10.5px; }
  .tut-narrator .tut-bubble-hide { width: 24px; height: 24px; top: 5px; right: 5px; }
  .tut-skip { font-size: 11px; padding: 6px 10px; }
}

/* ============================================================
   DUEL LOADING SCREEN (DuelPreloadScreen, game.js): between picking a deck and the board.
   On <body>, above everything, opaque: the menu behind it is turning to landscape on a phone.
   It wears the app's loading screen (`.boot-splash` and its pieces); these rules only add what
   differs: the layer it sits on, and a fill driven by the real progress instead of `bootFill`.
   ============================================================ */
.duel-preload {
  z-index: 100000;
  animation: duelPreloadIn 0.18s ease-out;
}
@keyframes duelPreloadIn { from { opacity: 0; } to { opacity: 1; } }
.duel-preload-fill {
  animation: bootStripes 0.8s linear infinite;   /* the stripes keep running; the width is the progress */
  transition: width 0.12s linear;
}
@media (prefers-reduced-motion: reduce) { .duel-preload-fill { animation: none; } }

/* EMOJIS on a small screen: the megaphone alone. The word made the button as wide as END TURN's
   neighbour could spare, and the icon already says it. */
@media (max-height: 520px), (max-width: 900px) {
  .hud-icon-btn.emote-btn .emote-btn-label { display: none; }
  .hud-icon-btn.emote-btn { aspect-ratio: 1 / 1; padding: 3px; gap: 0; justify-content: center; }
}

/* ---- ANDROID APP: a card's own loops are OFF, the inspected card's too (2026-11-05) ----
   A foil face can run 60 loops at once (Proof of Life's night sky alone: 55 stars and a
   `filter` that drifts, which repaints the art on every frame). Pausing them was not enough
   (2026-10-13 they were paused, and left running on the zoom / duel preview). Measured in the
   emulator's WebView with a cc trace: every layer the GPU animates INSIDE a card face is
   rasterised at the size of the TEMPLATE (a hero face is drawn at 880x1203 board px and shrunk
   with `scale()`: 2310x3158 device px on a 2.625 screen), not at the ~180 px the card is shown
   at. One foil light = 14 MB, the rare gem 72 MB; tilting the Cyberpunk Larry preview asked for
   520 MB and the HOME banner 321 MB against a 190 MB budget, so the WebView dropped tiles and
   the art, the frame or the whole modal blinked out ("flicker when you touch the card"). A
   PAUSED animation still makes its layer, and so does a transition while it runs. Without them
   the card is one layer at its real size: preview 62 MB, HOME 78 MB, no blank frame.
   The tilt still moves the sheen, the parallax and the holograms (painted from --foil-x /
   --foil-y, not animated); the loops rest in their reduced-motion pose (lights below).
   Kept: the HP preview pulse, a small transform that is information. */
html.is-native .fullart-board :is([class*="tpl-"], [class*="foil-"], [class*="sky-"], [class*="art-"], [class*="wp-"], [class*="sat-holo"], [class*="promo-holo"]):not(.tpl-stat-preview),
html.is-native .fullart-board :is([class*="tpl-"], [class*="foil-"], [class*="sky-"], [class*="art-"], [class*="wp-"], [class*="sat-holo"], [class*="promo-holo"]):not(.tpl-stat-preview)::before,
html.is-native .fullart-board :is([class*="tpl-"], [class*="foil-"], [class*="sky-"], [class*="art-"], [class*="wp-"], [class*="sat-holo"], [class*="promo-holo"]):not(.tpl-stat-preview)::after {
  animation: none !important;
}
/* ...and their unnamed pieces (the foil ₿ of Satoshi / Bitcoin Whale drifts on a bare <span>). */
html.is-native .fullart-board :is([class*="foil-"], [class*="sky-"], [class*="wp-"], [class*="sat-holo"], [class*="promo-holo"]) * { animation: none !important; }
html.is-native .fullart-board :is(.plx-bg, .plx-fg, .plx-front, .foil-fx-sheen, .sat-holo-btc, .promo-holo, .promo-holo-glare, .promo-art-alt, .promo-art-base, .promo-art-fade) { transition: none !important; }
html.is-native .fullart-board :is(.sky-star, .sky-shoot, .foil-spark) { display: none; }
/* The lights at rest: the same values as the reduced-motion block next to `.foil-light`. */
html.is-native .foil-light-green { opacity: 0.6; }
html.is-native .foil-light-buy { opacity: 0.35; }
html.is-native .foil-light-mist { opacity: 0.4; }
html.is-native .foil-light-glint { background-position: var(--fl-glint-from, 15%) 0; opacity: 0.3; }
html.is-native .foil-light-blade { background-position: 70% 0; opacity: 0.25; }
html.is-native .foil-light-lamp { opacity: 0.6; }
html.is-native .foil-light-cyan { opacity: 0.55; }
html.is-native .foil-light-blue { opacity: 0.6; }
html.is-native .foil-light-bridge { opacity: 0.6; }
html.is-native .foil-light-violet { opacity: 0.75; }
html.is-native .foil-light-violet-glow { opacity: 0.7; }
html.is-native .foil-light-aura { opacity: 0.75; }
html.is-native .foil-light-neon-lime { opacity: 0.75; }
html.is-native .foil-light-aura-green { opacity: 0.3; }
html.is-native .foil-light-cyan-rim { opacity: 0.35; }
html.is-native .foil-light-life-beam { opacity: 0.22; }
html.is-native .foil-light-screen { opacity: 0.22; }
html.is-native .foil-light-life-orb { opacity: 0.6; }
html.is-native .foil-light-red { opacity: 0.55; }
html.is-native .foil-light-red-rim { opacity: 0.5; }
html.is-native .foil-light-gold-glow { opacity: 0.3; }
html.is-native .foil-light-ember { opacity: 0.5; }
html.is-native .foil-light-ember::after { opacity: 0; }
html.is-native .foil-light-fuse { opacity: 0.6; }
html.is-native .foil-light-sunlit { opacity: 0.16; }
html.is-native .foil-light-diamond { opacity: 0.5; }
html.is-native .foil-light-thread { opacity: 0.75; }
html.is-native .foil-light-ghost { opacity: 0.32; }
/* The ACTIVE skill aura inside the art stays, lit and still (its `filter` animation was one more
   template-size layer per ACTIVE hero). */
html.is-native :is(.slot, .card-preview-overlay, .card-modal).skill-hot .tpl-art-char {
  filter: drop-shadow(0 0 3px rgba(255, 110, 48, 0.95)) drop-shadow(0 0 10px rgba(233, 64, 20, 0.6));
}
@media (max-height: 520px), (max-width: 900px) { .hud-icon-btn.emote-btn img { height: 74%; } }

/* ---- PHONE PASS 2 (2026-10-13): what an audit of every screen at 360x800 and 800x360 found ---- */
@media (max-width: 560px) {
  /* COLLECTION: the search row took the width of its own content (383 px on a 360 screen) and
     the FILTER button was cut by the edge. */
  .cs-controls > .filter-bar { align-self: stretch; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
  .filter-bar .filter-btn { padding: 0 10px; }
  /* SHOP: the cards of the rail tiles poke out above their tile and landed on the wallet chips. */
  .shop-store .store-rail { margin-top: 18px; }
  .store-rail-item.is-cosmetics .store-rail-name { letter-spacing: -0.02em; }
  /* Text that had dropped under 11 px. */
  .home2-kicker { font-size: 11px; letter-spacing: 0.1em; }
  .gem-tier-first { font-size: 10.5px; }
}
@media (pointer: coarse) {
  .home2-name { min-height: 32px; }
  .home2-quick { min-width: 44px; }
  .duel-settings-close { min-width: 40px; min-height: 40px; }
  .setting-seg-opt { min-height: 36px; }
}
/* DUEL on a short screen: the slot captions (SPECIAL / HERO) had shrunk to 7 px. */
@media (max-height: 520px) and (orientation: landscape) {
  .slot.empty .slot-hint, .spell-slot.empty .slot-hint { font-size: 9px; letter-spacing: 0.04em; }
}

/* Swap's choice of effect (SwapChoiceModal), in the game's own UI (owner 2026-10-24): the ui-modal panel
   with the gold caps title of Flash Loan / Whitepaper (.scry-head), the two effects as the bevelled
   settings rows (.setting-row) with a picture each, gold edge on hover, and a kit button to cancel. */
.swap-overlay { z-index: 1250; }   /* over the duel board, like the scry modals */
.swap-modal {
  width: min(560px, 94vw); align-items: stretch; gap: clamp(12px, 1.5vw, 18px);
  padding: clamp(18px, 2.2vw, 30px) clamp(18px, 2.4vw, 32px) clamp(18px, 2.2vw, 28px);
}
.swap-modal .scry-head h2 { text-transform: uppercase; }
.swap-choice-opts { display: flex; flex-direction: column; gap: 10px; }
.swap-choice-opt.setting-row { gap: 16px; padding: 14px 18px; border-radius: 16px; transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.swap-choice-opt .setting-label { font-family: var(--font-display); font-weight: 400; font-size: clamp(15px, 1.4vw, 19px); letter-spacing: 0.03em; color: var(--gold-bright); text-transform: uppercase; }
.swap-choice-opt .setting-desc { font-size: clamp(12px, 1vw, 14px); }
.swap-choice-opt:focus-visible {
  border-color: var(--gold); background: rgba(245, 193, 74, 0.1); transform: translateY(-2px);
  box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh), 0 0 0 2px rgba(245, 193, 74, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35);
}
@media (hover: hover) and (pointer: fine) {
  .swap-choice-opt:hover:not(:disabled) {
    border-color: var(--gold); background: rgba(245, 193, 74, 0.1); transform: translateY(-2px);
    box-shadow: inset 0 var(--gv-hi-h) 0 var(--gv-hi), inset 0 calc(-1 * var(--gv-sh-h)) 0 var(--gv-sh), 0 0 0 2px rgba(245, 193, 74, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35);
  }
}
.swap-choice-opt:active:not(:disabled) { transform: translateY(0) scale(0.99); }
.swap-choice-opt:disabled { cursor: not-allowed; opacity: .45; filter: grayscale(0.6); }
/* the picture on the left of each row */
.swap-choice-art { flex: 0 0 auto; width: clamp(74px, 7vw, 96px); display: flex; align-items: center; justify-content: center; }
.swap-arrows { position: relative; height: clamp(48px, 4.6vw, 62px); }
.swap-arrows img { position: absolute; width: 62%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.swap-arrows img:first-child { left: 2%; top: 0; }
.swap-arrows img:last-child { right: 2%; bottom: 0; transform: rotate(180deg); }
.swap-stats { gap: 4px; }
.swap-stat-pair { display: flex; flex-direction: column; gap: 3px; }
.swap-stat { display: flex; align-items: center; gap: 3px; }
.swap-stat img { width: clamp(16px, 1.5vw, 20px); height: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.swap-stat b { font-family: var(--font-display); font-weight: 400; font-size: clamp(14px, 1.3vw, 18px); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55); }
.swap-stat-to { color: var(--gold-bright); font-size: clamp(14px, 1.3vw, 18px); line-height: 1; }
.swap-cancel { align-self: center; min-width: 180px; text-transform: uppercase; }

/* Skin preview: the button that plays the skin's own impact FX (vs Rug Rat) sits centred under the card. */
.inv-skin-fxsims { align-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
/* Same height as DONE and the same width for every preview button, whatever its label. */
.inv-skin-fxsims .ui-btn.cl-sim { margin-top: 0; min-height: var(--modal-btn-h); width: 230px; justify-content: center; }

/* Tutorial: the card the ENEMY is about to cast waits face up in its hand, lowered into view, with a pulsing blue
   glow (tutEnemyHolds -> .tut-cpu-reveal); TutSpellArrow points from it to its target. */
.hand-fan.side-ai .hand-fan-slot.tut-cpu-reveal .card.in-hand {
  transform: translate(-160%, 22%) scale(1.25); transform-origin: top center; pointer-events: none;   /* left of SKIP TUTORIAL (top centre) */
  animation: tutCpuPulse 1.3s ease-in-out infinite;
}
.tut-cpu-glow {
  position: absolute; inset: -14%; z-index: -1; border-radius: 18px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(96,190,255,0.75), rgba(30,144,255,0.35) 45%, rgba(30,144,255,0) 72%);
  filter: blur(8px); transform-origin: top center; translate: -160% 0; animation: tutCpuGlow 1.3s ease-in-out infinite;
}
@keyframes tutCpuPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(140,210,255,0.7), 0 0 14px 4px rgba(30,144,255,0.55); }
  50% { box-shadow: 0 0 0 3px rgba(190,232,255,1), 0 0 30px 10px rgba(30,144,255,0.9); }
}
@keyframes tutCpuGlow { 0%,100% { opacity: 0.55; transform: translateY(8%) scale(1.2); } 50% { opacity: 1; transform: translateY(8%) scale(1.42); } }

/* Modals / pop-ups never show a scrollbar: they still scroll (wheel, touch, drag), the bar
   is just invisible. Covers every *-modal / *-overlay / *-dialog root and anything inside it.
   !important because some panels inside them set `scrollbar-width: thin` themselves. */
[class*="-modal"], [class*="-modal"] *,
[class*="-overlay"], [class*="-overlay"] *,
[class*="-dialog"], [class*="-dialog"] * { scrollbar-width: none !important; -ms-overflow-style: none; }
[class*="-modal"]::-webkit-scrollbar, [class*="-modal"] *::-webkit-scrollbar,
[class*="-overlay"]::-webkit-scrollbar, [class*="-overlay"] *::-webkit-scrollbar,
[class*="-dialog"]::-webkit-scrollbar, [class*="-dialog"] *::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ============================================================================
   PHONE PASS 3 (2026-11-04): every menu tab again at 393x873 (portrait, touch) with a lived-in
   account, against the ui-ux checklist (touch >= 40-44 px, text >= ~11 px, no horizontal
   scroll, no cramped nested scroll). What was still off, and only that.
   ============================================================================ */
@media (max-width: 560px) {
  /* DECK BUILDER: the deck showed three big columns in a ~240 px window, less than one row of its
     20 cards. Five small columns show the whole list in four rows (tap still opens each copy's
     panel); the collection keeps three columns, its cards are the ones you read, with less air. */
  .db-deck .db-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 4px 10px 12px; }
  .db-collection .db-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 10px 14px; }
  /* COLLECTION screen too: `minmax(112px, 1fr)` fell to TWO huge columns under ~370 px (one card
     row on screen at 360x800); three, like at 393. */
  .cs-set .db-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .db-deck .db-badge { top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10.5px; }
  /* INVENTORY: seven tabs wrapped into three ragged rows; an even grid of four (two rows). */
  .inventory-screen .inv-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .inventory-screen .inv-tabs .mission-tab { min-width: 0; padding-left: 4px; padding-right: 4px; text-align: center; justify-content: center; }
  /* MARKET: FEES sat in the search row and squeezed the field to ~130 px ("Search by nar").
     On a phone FEES is its round "i" alone (the word stays as its accessible name). */
  .mkt-bar .mkt-fees-btn { font-size: 0; gap: 0; min-width: 44px; justify-content: center; padding-left: 0; padding-right: 0; }
  .mkt-bar .mkt-fees-btn .mkt-fees-i { font-size: 15px; margin: 0; }
  /* Text that had dropped under 11 px. */
  .home2-deck-active { font-size: 10.5px; }
  .tut-part-lock { font-size: 11px; }
}
@media (hover: none) and (pointer: coarse) {
  /* HOME deck pager arrows (30 px), the builder's SAVE (35 px) and its edition filter (30 px). */
  .home2-deck-pager-btn.friend-icon-btn { width: 40px; height: 40px; }
  .db-save { min-height: 40px; }
  .edition-filter-btn { min-height: 36px; }
}

/* ============================================================================
   APK PASS 4 (owner, 2026-11-05): on the phone the words that cross the duel screen and the
   trap window were too big, and the rival's emoji went under whatever was playing.
   (Hand cards a little bigger: `cardW` in game.js. Card flicker: the card-face block of the
   ANDROID APP section above.)
   ============================================================================ */
/* The emoji's corner rises above everything in the duel while it is up (`has-emote`, game.js): the
   cards and their showcases, the banners (132-135), the trap window (1100), scry / swap (1250).
   It lived at 40, inside the duel's stacking context, under all of them. */
.hud-corner.has-emote { z-index: 1700; }

@media (max-height: 520px) and (orientation: landscape) {
  /* Words sized off the HEIGHT: a phone on its side is ~410 px tall, and in vw YOUR TURN was 82 px,
     ENEMY ACTIVATES A TRAP (55 px) ran the whole width under a 165 px icon. */
  .turn-banner-text { font-size: clamp(26px, 10vh, 44px); }
  .trap-banner-inner { gap: 8px; }
  .trap-banner-icon { width: clamp(56px, 20vh, 92px); }
  .trap-banner-text, .pos-banner-text { font-size: clamp(18px, 7vh, 30px); }
  .action-notice { font-size: clamp(13px, 4vh, 17px); padding: 8px 14px; }
  :root .vic-title { font-size: clamp(40px, 15vh, 64px); }
  /* The emoji: sticker 92 -> ~70 px and its phrase 22 -> ~17 px. */
  .emote-img { width: clamp(56px, 17vh, 76px); }
  .emote-stack .emote-text { font-size: clamp(14px, 4.2vh, 18px); max-width: 200px; }

  /* THE TRAP WINDOW was 620x485 on a 411 px screen: its buttons fell off the bottom. Here it is ONE
     row under the title (what happens | the slot | the button), so the hand at the bottom, where the
     trap is dragged from, stays clear. Owner 2026-11-05 (after 1.0.6): bigger, TALLER above all, so
     the cards are read: 496x153 -> ~650x215 at 412 px of height, sized off the height (`vh`) so a
     shorter phone keeps the hand clear too. */
  .rx-overlay { padding-top: 6px; }
  .rx-panel {
    display: grid; grid-template-columns: auto auto auto; grid-template-areas: "title title title" "body slot actions";
    align-items: center; justify-items: center; column-gap: 18px; row-gap: 8px;
    width: auto; max-width: 96vw; padding: 10px 50px 14px 18px; border-radius: 18px;
  }
  .rx-title { grid-area: title; }
  .rx-panel > :is(.rx-attack, .rx-dip, .rx-spell) { grid-area: body; }
  .rx-slot { grid-area: slot; width: clamp(76px, 25vh, 108px); border-radius: 12px; }
  .rx-actions { grid-area: actions; }
  .rx-title-icon { width: clamp(40px, 12vh, 50px); margin: -9px -4px -9px -6px; }
  .rx-title h2 { font-size: clamp(15px, 4.6vh, 19px); }
  .rx-min { width: 34px; height: 34px; top: 8px; right: 10px; }
  .rx-card .card { width: clamp(76px, 25vh, 108px); }
  .rx-mid { width: clamp(56px, 17vh, 72px); gap: 4px; }
  .rx-swords { width: clamp(28px, 9vh, 38px); }
  .rx-arrow span { border-top-width: 6px; border-bottom-width: 6px; border-left-width: 10px; }
  .rx-calc-label { font-size: 11px; }
  .rx-calc-val { font-size: clamp(18px, 5.6vh, 23px); }
  .rx-card-tag { font-size: 10px; padding: 2px 7px; top: 3px; }
  .rx-spell .card { width: clamp(80px, 26vh, 112px); }
  .rx-dip { gap: 8px; }
  .rx-dip-text { font-size: 13px; max-width: 26ch; }
  .rx-phish-back { width: clamp(62px, 20vh, 86px); }
  .rx-phish-back + .rx-phish-back { margin-left: calc(clamp(62px, 20vh, 86px) * -0.56); }
  .rx-slot-hint { font-size: 12px; padding: 8px; }
  .rx-slot-clear { width: 26px; height: 26px; top: -9px; right: -9px; }
  .rx-actions .ui-btn { padding: 0 18px; min-height: 46px; font-size: 14px; white-space: nowrap; }
  .rx-timer { width: min(600px, 90vw); margin-top: 8px; padding: 5px 14px; gap: 10px; }
  .rx-timer-icon { width: 22px; }
  .rx-timer-bar { height: 12px; }
  .rx-timer-text { font-size: 15px; }
  .rx-restore { height: 30px; }
}

/* ============================================================================
   APK PASS 5 (owner, 2026-11-05): foil cards that would not tilt on a phone, cards painting their
   badges before their art, the trap window in the middle, END TURN over my deck + graveyard.
   (Tap particles: tapScale in fx-effects.js. Impact / summon sizes: fxScaleFor in game.js. Live fire:
   TUNE.fire in the app + buildTorch.)
   ============================================================================ */
/* A finger on the inspected card TILTS it. Without this the browser took the drag as a pan of the zoom
   overlay and cancelled the pointer at once: the `.card-modal` zooms (collection, market, missions,
   peek, the duel preview) never leaned on a phone, while the ones with `touch-action: none` did
   (inventory / loadout preview). Only on the card: the rest of the overlay still scrolls, a tap closes. */
.card-modal .card { touch-action: none; }
/* A card waiting for its images (`data-img-wait`, useCardImgs) hides what follows it in its cell too
   (the ×2 / NEW badges of the collection floated alone until the card appeared). */
.card[data-img-wait] ~ * { visibility: hidden; }
/* The phone's scaled box of an impact / status FX (fxScaleHost, game.js) sits between the FX layer and
   its pieces: they need the layer's own placement rule (as the HODL dome plane does). */
.fx-scale-host > * { position: absolute; will-change: transform, opacity; }

@media (max-height: 520px) and (orientation: landscape) {
  /* The trap window in the MIDDLE of the screen (its row is ~150 px, so the hand under it stays free).
     Folded (`is-min`) its timer bar stays docked at the top, out of the board's way. */
  .rx-overlay:not(.is-min) { justify-content: center; padding-top: 0; padding-bottom: 26px; }   /* centred a little high: the hand's top edge stays clear */
  /* END TURN right ON TOP of my deck + graveyard, as wide as the pair (it was a 160 px bar in the
     corner). The numbers are the pair's own (`--rail-*`, shared with `.duel-rail`): the slot's top
     edge is 70% + pile - shift - half a card, and a full deck stacks its backs `--pile-thick` above
     it; the zone's bottom sits 8 px over that. Status hints and the combo buttons stack upwards. */
  .duel-action {
    top: auto; right: var(--rail-margin);
    bottom: calc(30% + var(--rail-shift) + var(--rail-w) * 8 / 11 + 8px);
    width: calc(var(--rail-w) * 2 + var(--rail-gap));
  }
  .duel-action .btn, .duel-action .hint { min-height: 44px; font-size: 13px; }
  /* The megaphone stays in the bottom-right corner, where END TURN was (to its left it would sit on
     the arena's edge). `fixed`: out of the moved zone, still inside its stacking order. */
  .duel-action .emote { position: fixed; right: clamp(12px, 2vw, 26px); bottom: clamp(6px, 1.4vh, 12px); }
  /* Genesis Beam / Whale Dump fire from the left side: the reveal is 90vh tall here, so at the PC's 0.62
     it would cover half the arena. */
  .card-showcase { --spell-shot-scale: 0.45; }
}

/* THE END OF A DUEL on a phone held sideways (~410 px tall): the reward flow (VICTORY, EXP, chest,
   packs, cards, summary) and the defeat / draw screen were sized for a PC window: DEFEAT 92 px, the
   chest 196 px, the summary rows pushed PLAY AGAIN off the bottom (368..416 on a 412 screen).
   `:root` on the flow's rules: fx-effects.css loads after this file. */
@media (max-height: 520px) and (orientation: landscape) {
  .gameover-screen { padding: 10px 20px; padding-top: max(10px, var(--safe-t)); }
  .gameover-screen h2 { font-size: clamp(34px, 13vh, 56px); margin-bottom: 4px; }
  .gameover-screen p { font-size: 13px; line-height: 1.35; }
  .gameover-victory-icon { width: clamp(72px, 22vh, 110px); }
  .gameover-actions { margin-top: 10px; }
  .gameover-btn { padding: 10px 30px; font-size: 13px; }
  :root .vic-medal { width: clamp(96px, 30vh, 140px); }
  :root .rf-sub { font-size: 18px; margin-bottom: 8px; }
  :root .rf-body { min-height: 0; }
  :root .rf-xp { gap: 10px; }
  :root .rf-xp-gain { font-size: 24px; }
  :root .rf-lvl b { font-size: 30px; }
  :root .rf-chest { width: 120px; height: 120px; }
  :root .rf-coin-gain { font-size: 22px; }
  :root .rf-coin-gain img { width: 30px; height: 30px; }
  :root .rf-coin-chip { font-size: 18px; padding: 6px 14px 6px 8px; }
  :root .rf-coin-chip img { width: 32px; height: 32px; }
  :root .rf-coin-chip b { font-size: 19px; }
  :root .rf-hint { font-size: 12px; }
  :root .rf-packs { gap: 8px; }
  :root .rf-packs-row { min-height: 170px; gap: 18px; }
  :root .rf-pack img { width: 120px; max-height: 170px; }
  :root .rf-cards-stage { min-height: 230px; }
  :root .rf-cardfan { height: 220px; }
  :root .rf-card { width: var(--rf-card-w, clamp(92px, 30vh, 130px)); }
  :root .rf-sum-panel { padding: 8px; }
  :root .rf-sum-title { margin-bottom: 6px; }
  :root .rf-sum-row { gap: 10px; padding: 4px 10px; margin-bottom: 5px; }
  :root .rf-sum-row img { width: 32px; height: 32px; }
  :root .rf-sum-row .rf-sum-ico-txt { flex-basis: 32px; width: 32px; font-size: 15px; }
  :root .rf-sum-row .lbl { font-size: 12px; }
  :root .rf-sum-row .val { font-size: 18px; }
}

/* ============================================================================
   PHONE HOME (owner, 2026-11-05): on a phone the HOME is the bar + a big news carousel. No PLAY
   panel and no deck strip (HomeMain, `.home2.is-phone`): the decks have their own screen, opened
   from the DECKS access next to CHAT. Gold + gems in the top-right corner, on the avatar's row,
   and the avatar off the panel's edge.
   ============================================================================ */
/* THE DECKS SCREEN (DecksScreen + DecksStrip `grid`): every slot in two columns, scrolled with the
   page. A vertical finger scrolls; a long press drags a deck to reorder (both axes). */
.decks-screen-body { padding: 4px 12px 18px; }
.home2-decks.is-grid { animation: none; }
.home2-decks.is-grid .home2-deck-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow: visible; padding: 2px 2px 8px; scroll-snap-type: none; }
.home2-decks.is-grid .home2-deck { flex: none; width: auto; min-width: 0; max-width: none; }
.home2-decks.is-grid .home2-deck[data-deck-i] { touch-action: pan-y; }
@media (max-width: 560px) {
  /* THE AVATAR'S WIDGET (owner 2026-11-12: the XP bar was squeezed to ~50 px by the wallet sharing
     its row, and the accesses lived inside). Row 1: the portrait, and beside it the name, then LVL
     with the XP numbers, then the XP bar across the whole column. Row 2: gold | gems, half each. The
     accesses left the widget: `.home2-tiles` below. */
  .home2.is-phone .home2-bar {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "wallet";
    align-items: center; row-gap: 12px; padding: 14px 14px 14px 16px;
  }
  .home2.is-phone .home2-id { grid-area: id; gap: 14px; }
  .home2.is-phone .home2-avatar { width: 64px; height: 64px; flex: 0 0 auto; margin-left: 0; }
  .home2.is-phone .home2-id-info {
    flex: 1 1 auto; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "name name" "lvl xpt" "bar bar";
    align-items: center; column-gap: 8px; row-gap: 6px;
  }
  .home2.is-phone .home2-nameline,
  .home2.is-phone .home2-xprow { display: contents; }
  .home2.is-phone .home2-name, .home2.is-phone .home2-name-input { grid-area: name; justify-self: start; max-width: 100%; font-size: 17px; }
  .home2.is-phone .home2-lvl-pill { grid-area: lvl; font-size: 14px; }
  .home2.is-phone .home2-xp-text { grid-area: xpt; display: block; justify-self: end; font-size: 12px; }
  .home2.is-phone .home2-xp { grid-area: bar; width: 100%; height: 16px; }
  /* The wallet: two chips sharing the width (amounts in full: there is room now), 42 px tall. */
  .home2.is-phone .home2-wallet { grid-area: wallet; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .home2.is-phone .home2-wallet > .home2-coin { min-width: 0; height: 42px; padding: 0 12px; gap: 7px; justify-content: center; }
  .home2.is-phone .home2-coin img { width: 24px; height: 24px; }
  .home2.is-phone .home2-coin b { font-size: 16px; }
  .home2.is-phone .home2-coin:active { transform: scale(0.97); filter: brightness(1.1); }

  /* THE ACCESSES GRID, as wide as the banner: INVENTORY · COLLECTION · DECKS on top (a 6-column grid,
     two columns each), FRIENDS · CHAT under them (three each, icon beside the label, shorter). Each a
     tile of the HOME's glass; a finger gets a press (scale + light), never a hover. */
  .home2.is-phone .home2-tiles {
    flex: 0 0 auto; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0;
    animation: home2Rise 0.5s var(--ease-out) 0.06s backwards;
  }
  .home2.is-phone .home2-tiles > .home2-quick {
    grid-column: span 2; min-width: 0; min-height: 86px; padding: 10px 6px 9px; gap: 7px;
    background: var(--home-glass-face); border: 1px solid var(--border-strong); border-radius: 16px;
    box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .home2.is-phone .home2-tiles > .home2-quick:nth-child(n+4) { grid-column: span 3; flex-direction: row; min-height: 58px; gap: 10px; padding: 8px 10px; }
  .home2.is-phone .home2-tiles .home2-quick img { width: 44px; height: 44px; }
  .home2.is-phone .home2-tiles .home2-quick img.home2-quick-book { transform: scale(1.22); }
  .home2.is-phone .home2-tiles > .home2-quick:nth-child(n+4) img { width: 34px; height: 34px; }
  .home2.is-phone .home2-tiles .home2-quick-label { font-size: 12px; letter-spacing: 0.05em; }
  .home2.is-phone .home2-tiles .home2-quick-badge { top: 6px; right: 6px; }
  .home2.is-phone .home2-tiles > .home2-quick:active { transform: scale(0.96); filter: brightness(1.14); }
  @media (prefers-reduced-motion: reduce) { .home2.is-phone .home2-tiles { animation: none; } }
  /* A short phone (~640 px tall): portrait and tiles a size down, so the banner keeps its room. */
  @media (max-height: 700px) {
    .home2.is-phone .home2-avatar { width: 54px; height: 54px; }
    .home2.is-phone .home2-tiles > .home2-quick { min-height: 70px; padding: 7px 6px 6px; gap: 5px; }
    .home2.is-phone .home2-tiles > .home2-quick:nth-child(n+4) { min-height: 48px; padding: 6px 10px; }
    .home2.is-phone .home2-tiles .home2-quick img { width: 36px; height: 36px; }
    .home2.is-phone .home2-tiles > .home2-quick:nth-child(n+4) img { width: 30px; height: 30px; }
    .home2.is-phone .home2-banner { min-height: 190px; }
  }

  /* THE NEWS CAROUSEL takes what is left under the grid (shorter than before: the grid took its top
     part): a poster, the art on top (the whole desktop composition, which the compact <=900 strip had
     cut down to the packs) and the words at the foot over a veil, above the dots. */
  .home2.is-phone .home2-hero { flex: 1 1 0; min-height: 0; }
  .home2.is-phone .home2-banner { flex: 1 1 auto; height: auto; min-height: 220px; }
  .home2.is-phone .home2-banner-media,
  .home2.is-phone .home2-slide.is-bundle .home2-banner-media { inset: 0 0 auto 0; width: 100%; height: 64%; }
  .home2.is-phone .home2-banner-text,
  .home2.is-phone .home2-slide.is-bundle .home2-banner-text {
    position: absolute; inset: auto 0 0 0; height: auto; max-width: none;
    gap: 6px; padding: 26px 18px 50px; justify-content: flex-end;
    background: linear-gradient(0deg, rgba(4, 10, 22, 0.92) 0%, rgba(4, 10, 22, 0.78) 58%, rgba(4, 10, 22, 0));
  }
  .home2.is-phone .home2-banner-title { font-size: clamp(24px, 7.2vw, 32px); min-height: 0; }
  .home2.is-phone .home2-banner-line { display: block; font-size: 13px; }
  .home2.is-phone .home2-banner-card { display: block; }
  .home2.is-phone .home2-banner-media .bundle-card,
  .home2.is-phone .home2-banner-media .bundle-compo-back,
  .home2.is-phone .home2-banner-rays { display: block; }
  .home2.is-phone .home2-banner-media .bundle-compo-fx-wrap { display: grid; }
  .home2.is-phone .home2-banner-media .bundle-compo { height: 84%; width: auto; aspect-ratio: 324 / 356; }
  .home2.is-phone .home2-banner-media .bundle-compo-stack { height: auto; width: 50%; }
  .home2.is-phone .home2-banner-art { height: 108%; max-width: 74%; }
  .home2.is-phone .home2-banner-figure { left: -6%; bottom: -10%; height: 112%; }
  .home2.is-phone .home2-slide.is-cyber .home2-banner-card.is-skin { right: 7%; top: 50%; width: 46%; height: auto; }
  .home2.is-phone .home2-slide.is-cyber .home2-banner-card.is-skin .card { width: 100%; height: auto; }
  .home2.is-phone .home2-slide.is-emojis .emoji-bundle-art { width: 86%; height: auto; aspect-ratio: auto; }
  /* The rays turn a conic gradient (a repaint of the whole poster per frame, on the main thread):
     still in the app, as the other turning gradients (ANDROID APP, frame rate). */
  html.is-native .home2.is-phone .home2-banner-rays { animation: none; }
}
/* The empty slots past NEW are left out of the DECKS screen (its header counts them, n/10). */
.home2-decks.is-grid .home2-deck-empty { display: none; }

/* ============================================================================
   PHONE MISSIONS (owner, 2026-11-05): icon-only tabs; no CLAIM buttons (the ready card / rung is
   tapped and its chest or rewards take the room); a 4-column calendar of bigger days without its
   DAY n/30 and filler line (MissionsScreen `phone`); and the counters at the title's height, shown
   only while their own reward is being collected, one at a time (`data-show` on the wallet + the
   transient chips). FRIENDS > REFERRALS (the same screen, `.on-referrals`) keeps its header.
   ============================================================================ */
/* DAILY MISSIONS, PC + phone (owner: phone 2026-11-05, PC 2026-11-06): no CLAIM button, the chest
   takes its room (96 px here, 66 px on the phone below). Not done yet: dimmed. Ready: the card is the
   button, edged in gold, and its chest glows and wiggles. Claimed: the open chest, faded. */
.missions-screen .missions-list .mission-side { gap: 0; justify-content: center; }
.missions-screen .missions-list .mission-chest-box,
.missions-screen .missions-list .mission-chest-box > img { width: 96px; height: 96px; }
.missions-screen .missions-list .mission-card:not(.is-done) .mission-chest { filter: grayscale(0.6) brightness(0.75) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.55)); }
.missions-screen .missions-list .mission-card.is-claimed .mission-chest { opacity: 0.55; }
.missions-screen .missions-list .mission-card.is-tap { cursor: pointer; border-color: var(--gold-edge); }
.missions-screen .missions-list .mission-card.is-tap .mission-chest {
  filter: drop-shadow(0 0 9px rgba(255, 205, 90, 0.8)) drop-shadow(0 4px 0 rgba(3, 7, 15, 0.55));
  animation: missionChestReady 1.5s var(--ease-in-out) infinite;
}
@keyframes missionChestReady {
  0%, 55%, 100% { transform: scale(1) rotate(0); }
  12% { transform: scale(1.1) rotate(-7deg); }
  26% { transform: scale(1.1) rotate(6deg); }
  40% { transform: scale(1.04) rotate(-3deg); }
}
@media (hover: hover) and (pointer: fine) {
  .missions-screen .missions-list .mission-card.is-tap:hover { filter: brightness(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .missions-screen .missions-list .mission-card.is-tap .mission-chest { animation: none; }
}

@media (max-width: 560px) {
  /* TABS: the icon is the label (the name stays as the button's accessible name and title). */
  .missions-screen > .mission-tabs .mission-tab-label { display: none; }
  .missions-screen > .mission-tabs .mission-tab { min-height: 52px; padding: 7px 4px; }
  .missions-screen > .mission-tabs .mission-tab-icon { width: 36px; height: 36px; }

  /* COUNTERS: one slot at the right end of the title row. Every chip waits in it, hidden; the one
     whose reward is landing fades in (gold OR gems OR packs OR cards, never two). */
  .missions-screen:not(.on-referrals) .shop-head { flex-wrap: nowrap; }
  .missions-screen:not(.on-referrals) .shop-head > .mission-wallet-wrap {
    position: relative; display: block; flex: 0 0 auto; width: 0; height: 44px; margin-left: auto;
  }
  .missions-screen:not(.on-referrals) .mission-wallet-wrap > .wallet-chip,
  .missions-screen:not(.on-referrals) .mission-wallet-wrap > .mission-count-chip {
    position: absolute; right: 0; top: 50%; margin: 0; width: max-content;
    opacity: 0; transform: translateY(-50%) scale(0.9); pointer-events: none;
    transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
  }
  .missions-screen:not(.on-referrals) .mission-wallet-wrap[data-show="coins"] > .wallet-chip.coins,
  .missions-screen:not(.on-referrals) .mission-wallet-wrap[data-show="gems"] > .wallet-chip.gems,
  .missions-screen:not(.on-referrals) .mission-wallet-wrap > .mission-count-chip.on { opacity: 1; transform: translateY(-50%) scale(1); }
  .missions-screen:not(.on-referrals) .mission-coin-gain { display: none; }   /* the counter itself counts up */

  /* DAILY MISSIONS: the phone's chest (the rules are above, shared with PC). */
  .missions-screen .missions-list .mission-side { width: auto; }
  .missions-screen .missions-list .mission-chest-box,
  .missions-screen .missions-list .mission-chest-box > img { width: 66px; height: 66px; }

  /* LEVEL REWARDS: no CLAIM / LOCKED / CLAIMED row; the rewards grow into it. A ready rung is the
     button (gold glow); a claimed one wears a green tick in its corner. */
  .missions-screen .lvr-rail { --lvr-tile-w: 112px; }
  .missions-screen .lvr-card { position: relative; }
  .missions-screen .lvr-node.is-ready .lvr-card { cursor: pointer; box-shadow: 0 0 0 2px var(--gold-bright), 0 0 18px rgba(245, 193, 74, 0.5); }
  .missions-screen .lvr-node.is-claimed .lvr-card::before {
    content: ''; position: absolute; z-index: 4; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #6fe08f, #23974a); box-shadow: 0 0 0 2px var(--gv-ink), 0 3px 0 rgba(3, 7, 15, 0.55);
  }
  .missions-screen .lvr-node.is-claimed .lvr-card::after {
    content: ''; position: absolute; z-index: 5; right: 18px; top: 14px; width: 8px; height: 14px;
    border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(40deg);
  }

  /* DAILY REWARD: four bigger days a row (the content scales with the day: container units). */
  .missions-screen .login-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; padding-bottom: 12px; }
}

/* ============================================================================
   PHONE SHOP (owner, 2026-11-12): the shop opens on a LANDING with every banner (GET GEMS + MARKET,
   then the rail's offers and collections, full width); a tap opens that section ALONE, full screen,
   with a back arrow before the title (ShopScreen `phoneView`: `.shop-store.is-phone.on-<view>`,
   `.store-body.on-<view>`). NOTHING moves on the landing: in the app any live animation recomposes
   the whole screen every frame (the rail's turning rays and the doors' arrows repaint on the main
   thread). A finger gets a press, never a hover.
   ============================================================================ */
@media (max-width: 560px) {
  /* THE HEADER outside the landing: the back arrow before the title (GEMS' own arrow is the same
     action, so it goes: one way back, always in the same corner). */
  .shop-store.is-phone .shop-phone-back { margin-right: 2px; }
  .shop-store.is-phone .gems-back { display: none; }
  /* With the arrow the header fits ONE row on most phones: the shop icon goes (the arrow and the
     title already say where this is) and the title drops a size. */
  .shop-store.is-phone:not(.on-landing) .shop-head-icon { display: none; }
  .shop-store.is-phone:not(.on-landing) .shop-head h2 { font-size: 22px; }

  /* THE LANDING: the doors, then the banners in one column. */
  .store-body.on-landing { display: flex; flex-direction: column; gap: 0; padding-bottom: 8px; }
  .shop-land-doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-land-doors > .gems-banner {
    width: auto; max-width: none; margin: 0; min-height: 64px; padding: 10px 12px; gap: 7px;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .shop-land-doors .gems-banner-icon { width: clamp(30px, 9vw, 36px); height: clamp(30px, 9vw, 36px); }
  .shop-land-doors .gems-banner-title { display: block; font-size: clamp(13px, 3.8vw, 15px); white-space: normal; line-height: 1.1; }
  .shop-land-doors .gems-banner-go { font-size: 26px; }
  .shop-land-doors .market-banner-lock { margin-left: auto; padding: 2px 6px; font-size: 11px; }
  .shop-land-doors .gems-banner-arrows::before,
  .shop-land-doors .gems-banner-arrows::after { animation: none; }

  /* The banners: the whole width, taller, the art bigger (everything in the composition is sized
     off `--pack-w`); the gap is the room each one's art needs above it. All lit: a landing has no
     "selected" banner, so none is dimmed. */
  .store-body.on-landing .store-rail {
    --pack-rise: 24px;
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    gap: 34px; margin-top: 44px; padding: 0;
  }
  .store-body.on-landing .store-rail-item {
    --pack-w: 90px; --pack-tilt: 14px;
    width: 100%; min-height: clamp(84px, 12.5vh, 112px); gap: 4px;
    padding: 10px 44px 10px calc(var(--pack-x) + var(--pack-w) * 0.85 + 18px);
    -webkit-tap-highlight-color: transparent;
  }
  .store-body.on-landing .store-rail-item:not(.is-bundle):not(.is-cosmetics) { --pack-x: 16px; }
  /* A short phone (360x740): a little lower, so the four banners still (almost) fit without scrolling. */
  @media (max-height: 760px) { .store-body.on-landing .store-rail-item { min-height: 80px; } }
  .store-body.on-landing .store-rail-item .store-rail-clip > img { height: calc(var(--pack-w) * 1.339); }
  .store-body.on-landing .store-rail-name { font-size: 17px; letter-spacing: 0.03em; -webkit-line-clamp: 2; }
  .store-body.on-landing .store-rail-bg { filter: none; animation: none; will-change: auto; }
  .store-body.on-landing .store-rail-clip > img { filter: var(--stroke) drop-shadow(0 8px 15px rgba(0, 0, 0, 0.72)); }
  .store-body.on-landing .store-rail-card,
  .store-body.on-landing .rail-cosm-card.is-front { filter: none; }
  .store-body.on-landing .rail-cosm-card.is-behind { filter: saturate(0.9) brightness(0.9); }
  .store-body.on-landing .rail-cosm-back { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)); }
  .store-body.on-landing .store-rail-item:active { transform: scale(0.98); }
  .store-body.on-landing .store-rail-item:active .store-rail-panel { border-color: var(--gold-edge); }
  /* The cue that a banner OPENS something: a chevron at its right end, like the doors'. */
  .store-rail-go {
    position: absolute; z-index: 3; right: 14px; top: 50%; transform: translateY(-50%);
    font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--gold-bright);
    text-shadow: 0 2px 4px rgba(3, 7, 15, 0.8);
  }
  .store-body.on-landing .offer-timer.is-rail { align-self: flex-start; }

  /* INSIDE A SECTION, in the app: the two loops that repaint every frame go still, with the same look:
     the pack stack's breathing glow (a drop-shadow over up to ten packs, re-rastered per frame) and
     the 38 s drift of the "Special" pill (background-position, main thread). The transform-only ones
     (the -44% pulse, the emote halos) stay: the compositor moves them. */
  html.is-native .shop-store.is-phone .detail-stage .pack-stack-row,
  html.is-native .shop-store.is-phone .pack-slot.special,
  html.is-native .shop-store.is-phone .pack-slot.special::before { animation: none; }

  /* LIGHT BACKGROUNDS: the reduced copies of the two big ones (UI/m/, tools/make-phone-variants.mjs:
     4.3 Mpx -> 1.4 / 1.7 Mpx, sized for the HOME poster so nothing is upscaled). Same layers as the
     rules they replace (HOME slides, the rail, the Welcome offer's art cell). */
  .home2-slide.is-genesis {
    background:
      linear-gradient(90deg, rgba(4,11,24,0.74), rgba(4,11,24,0.5) 58%, rgba(4,11,24,0.56)),
      url("../UI/m/satoshi_banner.jpg") center / cover no-repeat;
  }
  .home2-slide.is-bundle {
    background:
      linear-gradient(90deg, rgba(6,10,20,0.80), rgba(6,10,20,0.52) 58%, rgba(6,10,20,0.58)),
      url("../UI/m/bitcoin_forest.jpg") center 58% / cover no-repeat;
  }
  .store-rail-panel.set-genesis .store-rail-bg {
    background:
      linear-gradient(90deg, rgba(4,11,24,0.34), rgba(4,11,24,0.14) 55%, rgba(4,11,24,0.2)),
      url("../UI/m/satoshi_banner.jpg") center / cover no-repeat;
  }
  .store-rail-panel.set-welcome .store-rail-bg {
    background:
      repeating-conic-gradient(from calc(-4deg + var(--raysAngle)) at var(--rays-x) var(--rays-y),
        rgba(255, 214, 112, 0.13) 0deg 5deg,
        rgba(255, 214, 112, 0) 5deg 11.5deg),
      url("../UI/m/bitcoin_forest.jpg") center 58% / cover no-repeat;
  }
  .offer-art.is-welcome {
    background:
      radial-gradient(90% 120% at 50% 52%, rgba(245,193,74,0.20), transparent 55%),
      linear-gradient(90deg, rgba(6,10,20,0.62), rgba(6,10,20,0.46) 58%, rgba(6,10,20,0.58)),
      url("../UI/m/bitcoin_forest.jpg") center 58% / cover no-repeat;
  }
}
