/* PokéMerge — estilos de los menús (la partida está en match.css).
   Look Mundo Misterioso / PokéSurvivor: paneles azules con doble borde,
   dorado para lo importante y fuente Pixelify. */

/* ?v= en las fuentes (y en los preload de index.html, el mismo número):
   assets/ se cachea un día, así que cada revisión de Pixelify PS lo sube. */
@font-face {
  font-family: 'Pixelify';
  src: url('../assets/fonts/PixelifyPS-400.ttf?v=2') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Pixelify';
  src: url('../assets/fonts/PixelifyPS-700.ttf?v=2') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #fff;
  --muted: #b9cbf0;
  --edge: #f4f8ff;
  --edge-in: #5b83d6;
  --edge-out: #0b1838;
  --gold: #ffd23f;
  --gold-2: #f2a91b;
  --red: #ff5f6d;
  --green: #5fe08a;
  --shadow: #0a1430;

  --bg-1: #0b1838;
  --bg-2: #15306f;
  --panel-1: #2c58b2;
  --panel-2: #1c3d8c;
  --panel-3: #152f6c;
  --well: rgba(6, 14, 38, 0.55);

  --r: 12px;
  --gap: 12px;
  --font: 'Pixelify', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --outline: 0 2px 0 var(--edge-out), 2px 0 0 var(--edge-out), -2px 0 0 var(--edge-out),
    0 -2px 0 var(--edge-out), 2px 2px 0 var(--edge-out), -2px 2px 0 var(--edge-out),
    2px -2px 0 var(--edge-out), -2px -2px 0 var(--edge-out), 0 4px 0 rgba(0, 0, 0, 0.35);
  --outline-sm: 0 1px 0 var(--edge-out), 1px 0 0 var(--edge-out), -1px 0 0 var(--edge-out),
    0 -1px 0 var(--edge-out), 0 2px 0 rgba(0, 0, 0, 0.4);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg-1);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.25;
  /* La fuente ya no trae ligaduras de f; esto cubre una caché vieja. */
  font-variant-ligatures: none;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button, input, select, textarea { font: inherit; font-variant-ligatures: inherit; color: inherit; }
button { cursor: pointer; }
textarea, input[type='text'] { user-select: text; -webkit-user-select: text; }
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #fff3b0; }
h1, h2, h3, p { margin: 0; }
img { image-rendering: pixelated; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.muted { color: var(--muted); }
.gold { color: var(--gold); }
.red { color: var(--red); }
.green { color: var(--green); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.outline { text-shadow: var(--outline); }
.row { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1; min-width: 0; }

/* ---------- Fondo animado ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, #3463c4 0%, rgba(52, 99, 196, 0) 60%),
    radial-gradient(90% 60% at 50% 115%, #1b3d8a 0%, rgba(27, 61, 138, 0) 70%),
    linear-gradient(180deg, #14306f 0%, var(--bg-1) 100%);
}
.bg-grid {
  position: absolute;
  inset: -96px;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
  background-size: 48px 48px;
  background-position: 0 0, 24px 24px;
  animation: bg-pan 18s linear infinite;
}
.bg-glow {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
}
.bg-glow-a { left: -20vmax; top: -25vmax; background: #4f8dff; animation: drift-a 22s ease-in-out infinite alternate; }
.bg-glow-b { right: -25vmax; bottom: -30vmax; background: #7b5cff; opacity: 0.22; animation: drift-b 26s ease-in-out infinite alternate; }
.bg-sparks {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 30%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(2px 2px at 72% 18%, rgba(255, 236, 160, 0.55), transparent 60%),
    radial-gradient(2px 2px at 38% 72%, rgba(255, 255, 255, 0.4), transparent 60%),
    radial-gradient(2px 2px at 86% 64%, rgba(160, 200, 255, 0.5), transparent 60%),
    radial-gradient(2px 2px at 55% 45%, rgba(255, 255, 255, 0.35), transparent 60%);
  background-size: 420px 420px;
  animation: sparks 30s linear infinite;
  opacity: 0.8;
}
@keyframes bg-pan { to { transform: translate(48px, 48px); } }
@keyframes drift-a { to { transform: translate(18vmax, 12vmax) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-14vmax, -10vmax) scale(0.9); } }
@keyframes sparks { to { background-position: 0 -420px; } }

body[data-screen='match'] .bg * { animation-play-state: paused; }

/* ---------- Arranque ---------- */

.boot {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
.boot-spin {
  width: 44px;
  height: 44px;
  border: 5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.boot-hint { max-width: 420px; font-size: 14px; }

/* ---------- Pantallas y transiciones ---------- */

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scr-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.screen.is-leaving {
  animation: scr-out 0.22s ease-in both;
  pointer-events: none;
  z-index: 0;
}
.screen-match { animation-name: scr-fade; }
.screen-match.is-leaving { animation-name: scr-fade-out; }

@keyframes scr-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes scr-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-10px) scale(1.01); }
}
@keyframes scr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes scr-fade-out { from { opacity: 1; } to { opacity: 0; } }

.screen-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  animation: scr-fade 0.3s 0.1s both;
}

.screen-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px max(16px, var(--safe-r)) 28px max(16px, var(--safe-l));
  scrollbar-width: thin;
  scrollbar-color: var(--edge-in) transparent;
}
.screen-body::-webkit-scrollbar { width: 8px; }
.screen-body::-webkit-scrollbar-thumb { background: var(--edge-in); border-radius: 8px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; }
.wrap-narrow { max-width: 720px; }

.screen-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px max(16px, var(--safe-r)) max(12px, var(--safe-b)) max(16px, var(--safe-l));
  background: linear-gradient(0deg, rgba(8, 18, 46, 0.95), rgba(8, 18, 46, 0.7));
  border-top: 2px solid rgba(91, 131, 214, 0.45);
}

/* ---------- Barra superior ---------- */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: max(8px, var(--safe-t)) max(12px, var(--safe-r)) 8px max(12px, var(--safe-l));
  background: linear-gradient(180deg, rgba(8, 18, 46, 0.92), rgba(8, 18, 46, 0.55));
  border-bottom: 2px solid rgba(91, 131, 214, 0.45);
}
.topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: var(--outline);
  padding: 4px 2px 6px;
}
.topbar .logo { flex: none; }
.topbar-spacer { flex: 1; }

.res { display: flex; gap: 6px; flex: none; }
.res-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
  background: rgba(5, 12, 32, 0.75);
  border: 2px solid var(--edge-in);
  box-shadow: 0 0 0 2px var(--edge-out), inset 0 2px 0 rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  text-shadow: var(--outline-sm);
}
.res-pill .ico { width: 22px; height: 22px; }
.res-pill.is-bump { animation: bump 0.35s ease-out; }

/* ---------- Iconos ---------- */

.ico {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  flex: none;
  vertical-align: -0.2em;
}
.ico svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* ---------- Paneles (doble borde Mundo Misterioso) ---------- */

.panel {
  position: relative;
  padding: 14px;
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel-1) 0%, var(--panel-2) 55%, var(--panel-3) 100%);
  border: 3px solid var(--edge);
  box-shadow:
    0 0 0 3px var(--edge-out),
    inset 0 0 0 2px var(--edge-in),
    inset 0 3px 0 4px rgba(255, 255, 255, 0.07),
    0 7px 0 3px rgba(4, 9, 26, 0.55);
}
.panel + .panel { margin-top: 0; }
.panel-dark {
  background: linear-gradient(180deg, #1b336f, #10224f);
}
.panel-gold {
  border-color: #fff4c2;
  box-shadow:
    0 0 0 3px #4a3200,
    inset 0 0 0 2px var(--gold-2),
    inset 0 3px 0 4px rgba(255, 255, 255, 0.07),
    0 7px 0 3px rgba(4, 9, 26, 0.55);
}
.panel-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--outline-sm);
}
.panel-h .ico { width: 22px; height: 22px; }
.panel-h .grow { color: var(--ink); }
.panel-sub { margin: -4px 0 10px; font-size: 14px; color: var(--muted); }
.well {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--well);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(91, 131, 214, 0.35);
}

/* ---------- Botones gordos con relieve ---------- */

.btn {
  --b1: #4a7fe6;
  --b2: #2b55b5;
  --bd: #183577;
  --tx: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 18px 10px;
  border: 3px solid var(--edge-out);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--b1) 0%, var(--b2) 100%);
  color: var(--tx);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.38),
    inset 0 -4px 0 rgba(0, 0, 0, 0.22),
    0 5px 0 var(--bd),
    0 5px 0 3px var(--edge-out);
  transform: translateY(0);
  transition: transform 0.07s ease-out, box-shadow 0.07s ease-out, filter 0.15s;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.08); }
.btn:active, .btn.is-pressed {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 0 0 var(--bd),
    0 0 0 3px var(--edge-out);
}
.btn .ico { width: 22px; height: 22px; }
.btn-label { min-width: 0; }
.btn[aria-disabled='true'] { filter: grayscale(0.85) brightness(0.72); cursor: not-allowed; }
.btn[aria-disabled='true']:active { transform: translateY(2px); }

.btn-gold { --b1: #ffe873; --b2: #f4ae1a; --bd: #a06a00; --tx: #3a2400; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55); }
.btn-red { --b1: #ff7d89; --b2: #d93a52; --bd: #861b30; }
.btn-green { --b1: #74eaa0; --b2: #2fb562; --bd: #136b36; --tx: #08341a; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn-purple { --b1: #b28bff; --b2: #7650d8; --bd: #3e2584; }
.btn-dark { --b1: #2a3f78; --b2: #1a2a57; --bd: #0e1838; }

.btn-lg { min-height: 64px; font-size: 24px; padding: 10px 28px 12px; border-radius: 16px; }
.btn-xl { min-height: 76px; font-size: clamp(28px, 7vw, 38px); padding: 10px 32px 14px; border-radius: 18px; letter-spacing: 0.04em; }
.btn-sm { min-height: 44px; font-size: 15px; padding: 6px 12px 8px; }
.btn-icon { padding: 6px; width: 48px; }
.btn-icon .ico { width: 24px; height: 24px; }
.btn-block { display: flex; width: 100%; }
.btn-lg > .ico { width: 28px; height: 28px; }
.btn-xl > .ico { width: 36px; height: 36px; }
.btn-sub { display: block; font-size: 13px; font-weight: 400; opacity: 0.85; text-shadow: none; }
.btn-label .ico { width: 18px; height: 18px; vertical-align: -3px; }
.btn-label .btn-sub .ico { width: 14px; height: 14px; vertical-align: -2px; }

.btn-pulse { animation: btn-pulse 1.8s ease-in-out infinite; }
.btn-pulse:active { animation: none; }
@keyframes btn-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15) drop-shadow(0 0 10px rgba(255, 210, 63, 0.65)); }
}

.is-shaking { animation: shake 0.38s ease-in-out; }
@keyframes shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -6px 0; }
  40% { translate: 5px 0; }
  60% { translate: -4px 0; }
  80% { translate: 2px 0; }
}

/* ---------- Pestañas y controles ---------- */

.tabs {
  position: relative;
  display: flex;
  gap: 6px;
  /* Una sola fila: si no caben, se desplazan de lado (con degradado en el
     borde que tiene más). El relleno deja ver las sombras de las pestañas. */
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 3px 3px 7px;
  margin: -3px -3px -7px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs.can-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.tabs.can-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
.tabs.can-left.can-right {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}
.tab {
  flex: 1 0 auto;
  scroll-snap-align: center;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 2px solid var(--edge-in);
  background: rgba(6, 14, 38, 0.55);
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 0 0 2px var(--edge-out);
  transition: background 0.15s, color 0.15s, transform 0.08s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab:active { transform: translateY(2px); }
.tab.is-active {
  color: #3a2400;
  background: linear-gradient(180deg, #ffe873, #f4ae1a);
  border-color: #fff4c2;
  box-shadow: 0 0 0 2px #4a3200, 0 3px 0 2px #a06a00;
}
.tab.is-locked { opacity: 0.5; }
.tabs.is-busy .tab:not(.is-active) { opacity: 0.6; }
.tab .ico { width: 18px; height: 18px; vertical-align: -3px; }

.seg { display: inline-flex; gap: 4px; padding: 4px; margin: 0; border-radius: 12px; background: var(--well); }
.seg .tab { flex: none; min-width: 56px; }

.select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding: 6px 34px 6px 12px;
  border-radius: 10px;
  border: 2px solid var(--edge-in);
  box-shadow: 0 0 0 2px var(--edge-out);
  background:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%) right 16px center / 7px 7px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--gold) 50%) right 10px center / 7px 7px no-repeat,
    rgba(6, 14, 38, 0.75);
  background-position: calc(100% - 17px) 50%, calc(100% - 11px) 50%, 0 0;
  color: var(--ink);
  font-size: 15px;
  max-width: 100%;
}
.select option { background: #142a5c; color: #fff; }

.switch {
  position: relative;
  flex: none;
  width: 64px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid var(--edge-out);
  background: #3a4a72;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.3);
  transition: background 0.18s;
  padding: 0;
}
.switch::before {
  content: '';
  position: absolute;
  inset: -7px -4px;     /* 44 px de alto para el dedo */
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #cfdcf5);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch[aria-checked='true'] { background: linear-gradient(180deg, #74eaa0, #2fb562); }
.switch[aria-checked='true']::after { transform: translateX(28px); }
.switch-wrap { display: inline-flex; align-items: center; min-height: 44px; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  margin: 0;
}
.range::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--edge-out);
  background: linear-gradient(90deg, var(--gold) 0 var(--v, 50%), #23345f var(--v, 50%) 100%);
}
.range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  border: 2px solid var(--edge-out);
  background: linear-gradient(90deg, var(--gold) 0 var(--v, 50%), #23345f var(--v, 50%) 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  border: 3px solid var(--edge-out);
  background: linear-gradient(180deg, #fff, #cfdcf5);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--edge-out);
  background: linear-gradient(180deg, #fff, #cfdcf5);
}

.input, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--edge-in);
  box-shadow: 0 0 0 2px var(--edge-out), inset 0 3px 0 rgba(0, 0, 0, 0.3);
  background: rgba(6, 14, 38, 0.8);
  color: var(--ink);
  font-size: 16px;
}
.textarea {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}
.input::placeholder, .textarea::placeholder { color: rgba(185, 203, 240, 0.55); }

/* Barra de progreso */
.bar {
  position: relative;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--edge-out);
  background: #1a2752;
  overflow: hidden;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.35);
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(180deg, #8af0b0, #2fb562);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.4s ease-out;
}
.bar.is-full .bar-fill { background: linear-gradient(180deg, #fff1a0, #f4ae1a); }
.bar-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  text-shadow: var(--outline-sm);
}

/* ---------- Chips de tipo, etiquetas y medallas ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 9px 3px;
  border-radius: 999px;
  background: var(--tc, #888);
  color: var(--tx, #fff);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 2px 0 rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.chip-sm { min-height: 20px; font-size: 11px; padding: 1px 7px 2px; }
.chip-n { opacity: 0.85; font-size: 0.9em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--edge-out);
  background: var(--rc, var(--muted));
  border: 2px solid var(--edge-out);
  text-shadow: none;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--edge-out);
  text-shadow: var(--outline-sm);
  line-height: 1;
}
.badge-shiny { background: linear-gradient(180deg, #fff3a6, #ffb81f); color: #4a2a00; text-shadow: none; }
.badge-gold { background: linear-gradient(180deg, #fff3a6, #ffb81f); color: #4a2a00; text-shadow: none; }
@keyframes badge-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ---------- Sprites ---------- */

.sprite {
  display: inline-block;
  flex: none;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}
.sprite.is-sil { filter: brightness(0) opacity(0.5); }
.sprite.is-missing { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.sprite-stage {
  position: relative;
  display: grid;
  place-items: center;
}
.sprite-stage::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 56%;
  height: 14%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), transparent);
}
.sprite-stage > .sprite { position: relative; }
/* Medido por el cuerpo (spriteStage con body): el Pokémon de pie sobre la
   sombra, que va pegada abajo; la caja la pone quien la usa. */
.sprite-stage.is-body { place-items: end center; padding-bottom: 8px; }
.sprite-stage.is-body::before { bottom: 2px; width: 70%; height: 12px; }

/* Las cartas y sus rejillas están en cards.css. */

/* ---------- Modales ---------- */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, var(--safe-t)) max(12px, var(--safe-r)) max(16px, var(--safe-b)) max(12px, var(--safe-l));
  background: rgba(3, 8, 24, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: scr-fade 0.18s both;
  overflow-y: auto;
}
.modal-layer.is-out { animation: scr-fade-out 0.18s both; pointer-events: none; }
.modal {
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  padding: 0;
  animation: modal-in 0.26s cubic-bezier(0.3, 1.3, 0.5, 1) both;
}
.modal-wide { width: min(860px, 100%); }
@keyframes modal-in { from { transform: scale(0.9) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title {
  padding: 14px 56px 6px 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--outline);
}
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 14px;
  overscroll-behavior: contain;
}
.modal-body > p + p { margin-top: 8px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 8px 16px 10px;
  border-top: 2px solid rgba(91, 131, 214, 0.4);
}
.modal-actions:empty { display: none; }
.modal-actions .btn { flex: 1 1 140px; }
.modal-x {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--edge-in);
  background: rgba(6, 14, 38, 0.6);
  box-shadow: 0 0 0 2px var(--edge-out);
}
.modal-x .ico { width: 20px; height: 20px; }

/* ---------- Avisos ---------- */

.toast-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: max(72px, calc(var(--safe-t) + 64px));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  max-width: min(460px, 100%);
  padding: 10px 16px 12px;
  border-radius: 12px;
  border: 3px solid var(--edge);
  box-shadow: 0 0 0 3px var(--edge-out), inset 0 0 0 2px var(--edge-in), 0 6px 0 2px rgba(4, 9, 26, 0.5);
  background: linear-gradient(180deg, #2c58b2, #1c3d8c);
  font-size: 15px;
  text-align: center;
  text-shadow: var(--outline-sm);
  animation: toast-in 0.28s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
.toast-error { background: linear-gradient(180deg, #c8445a, #8a1f35); border-color: #ffd5da; }
.toast-good { background: linear-gradient(180deg, #2fa35c, #17703a); border-color: #d8ffe5; }
.toast-gold { background: linear-gradient(180deg, #8a5b00, #5c3a00); border-color: #fff1a6; color: #ffe873; }
.toast.is-out { animation: toast-out 0.25s ease-in both; }
@keyframes toast-in { from { transform: translateY(-14px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }

/* ---------- Logo ---------- */

.logo {
  position: relative;
  display: inline-flex;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 0.06em 0 rgba(4, 9, 26, 0.6));
}
.logo-lg { font-size: clamp(54px, 15.5vw, 136px); }
.logo-md { font-size: clamp(36px, 9vw, 56px); }
.logo-sm { font-size: 26px; }
.lt {
  position: relative;
  display: inline-block;
  color: var(--edge-out);
  -webkit-text-stroke: 0.17em var(--edge-out);
  padding: 0 0.005em;
}
.lt::before, .lt::after {
  content: attr(data-l);
  position: absolute;
  left: 0.005em;
  top: 0;
}
.lt::before { color: #fff; -webkit-text-stroke: 0.075em #fff; }
.lt::after {
  -webkit-text-stroke: 0;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}
.lt-a::after { background-image: linear-gradient(180deg, #ffffff 0%, #d9e8ff 42%, #8fb9ff 54%, #4f87ee 100%); }
.lt-b::after { background-image: linear-gradient(180deg, #fff7c2 0%, #ffd23f 42%, #ffad1f 55%, #ff7f1f 100%); }
.logo-lg .lt, .logo-md .lt { animation: lt-bob 2.8s ease-in-out infinite; animation-delay: calc(var(--i) * -0.14s); }
.logo-lg .lt-b:nth-child(5) { margin-left: 0.04em; }
@keyframes lt-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-0.05em) rotate(-2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(0.02em) rotate(1.5deg); }
}

/* ---------- Título ---------- */

.screen-title { cursor: pointer; }
.title-rays {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 170vmax;
  height: 170vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 63, 0.09) 0deg 9deg, transparent 9deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 42%);
  mask: radial-gradient(circle, #000 0%, transparent 42%);
  transform: translate(-50%, -50%);
  animation: rays 80s linear infinite;
  pointer-events: none;
}
@keyframes rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.title-wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: max(24px, var(--safe-t)) 16px 170px;
  text-align: center;
}
.title-logo { animation: logo-drop 0.9s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes logo-drop { from { transform: translateY(-60px) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.tagline {
  font-size: clamp(16px, 4.4vw, 24px);
  color: var(--muted);
  text-shadow: var(--outline-sm);
  animation: scr-fade 0.6s 0.5s both;
}
.tap-hint {
  margin-top: 18px;
  padding: 10px 22px;
  border: 0;
  background: none;
  font-size: clamp(20px, 5.5vw, 30px);
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--outline);
  animation: blink 1.3s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.title-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(44px, calc(var(--safe-b) + 36px));
  height: 54px;
  background:
    linear-gradient(180deg, rgba(216, 192, 138, 0.0), rgba(216, 192, 138, 0.18) 30%, rgba(168, 141, 90, 0.22) 70%, rgba(168, 141, 90, 0));
  border-top: 2px dashed rgba(244, 248, 255, 0.12);
  border-bottom: 2px dashed rgba(244, 248, 255, 0.12);
  pointer-events: none;
}
.parade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(40px, calc(var(--safe-b) + 32px));
  height: 110px;
  overflow: hidden;
  pointer-events: none;
}
.parade-mon {
  position: absolute;
  left: 0;
  bottom: 10px;
  display: grid;
  place-items: end center;
  animation-name: parade;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}
@keyframes parade {
  from { transform: translateX(-150px); }
  to { transform: translateX(calc(100vw + 40px)); }
}
.title-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(10px, var(--safe-b));
  z-index: 2;
  text-align: center;
  font-size: 12px;
  color: rgba(185, 203, 240, 0.7);
}

/* ---------- Inicio ---------- */

/* Centrado vertical seguro (margin auto no corta el contenido si no cabe). */
.screen-home .screen-body { display: flex; flex-direction: column; }
.screen-home .screen-body > .wrap { margin: auto; }

.home {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.home-hero { display: flex; flex-direction: column; gap: 14px; }
.partner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.partner-stage {
  flex: none;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 70%),
    radial-gradient(60% 20% at 50% 78%, rgba(0, 0, 0, 0.45), transparent 70%);
  cursor: pointer;
}
.partner-stage.is-hop > .sprite { animation: hop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-22px); } 100% { transform: translateY(0); } }
.record-label { font-size: 13px; color: var(--muted); }
.record-wave {
  --rw: 30px;                 /* tamaño buscado; las pantallas grandes lo suben */
  font-size: var(--rw);
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--outline);
  line-height: 1.1;
}
/* Sin récord: «¡A estrenarse!» mide ≈ 7,5 em (Pixelify negrita), 1,5 veces
   «Oleada 29»: más pequeño para que no se parta en dos líneas. */
.record-wave.is-empty { font-size: calc(var(--rw) * 0.78); text-wrap: balance; }
/* Con consultas de contenedor, el titular se ajusta al hueco que le deja el
   compañero (sin pasar de --rw): «Oleada 129» (≈ 5,3 em) cabe con letra de
   hasta el 18 % de ese ancho y «¡A estrenarse!», hasta el 12,5 %. */
@supports (width: 1cqi) {
  .record { container-type: inline-size; }
  .record-wave { font-size: min(var(--rw), 18cqi); }
  .record-wave.is-empty { font-size: min(var(--rw), 12.5cqi); white-space: nowrap; }
}
.record-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.play-btn { width: 100%; }
.play-btn .btn-label { display: flex; flex-direction: column; align-items: center; gap: 2px; }
/* JUGAR y, a su lado, la ayuda (ancho fijo, con el alto de JUGAR). */
.home-play { --hp: 76px; display: flex; gap: 10px; align-items: stretch; }
.home-play .play-btn { flex: 1 1 0; width: auto; min-width: 0; }
.home-help { flex: none; width: var(--hp); padding: 6px; border-radius: 18px; }
.home-help .ico { width: calc(var(--hp) * 0.46); height: calc(var(--hp) * 0.46); }
/* Invitación a la ayuda (perfil que no ha jugado nunca). */
.home-invite {
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 14px 10px;
  text-align: left;
  border-color: #4a3200;
  animation: invite-glow 2.4s ease-in-out infinite;
}
.home-invite > .ico { width: 34px; height: 34px; }
.home-invite .btn-label { color: var(--gold); font-size: 18px; }
.home-invite .btn-sub { margin-top: 2px; color: var(--ink); font-size: 14px; }
@keyframes invite-glow {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.12) drop-shadow(0 0 8px rgba(255, 210, 63, 0.5)); }
}
.next-goal { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); text-align: center; }
.next-goal b { color: var(--gold); }
.next-goal .bar { height: 16px; }
.home-side { display: flex; flex-direction: column; gap: 14px; }
.team .panel-h { margin-bottom: 8px; }
.badge-up {
  gap: 2px;
  padding: 0 6px 0 3px;
  background: linear-gradient(180deg, #74eaa0, #2fb562);
  color: #08341a;
  text-shadow: none;
}
.badge-up .ico { width: 14px; height: 14px; }
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 10px;
}
.tile {
  flex-direction: column;
  min-height: 86px;
  padding: 10px 6px 10px;
  gap: 6px;
  font-size: 15px;
}
.tile .ico { width: 32px; height: 32px; }
.tile .badge { position: absolute; top: -8px; right: -6px; }
.tile .badge.tile-badge-l { right: auto; left: -6px; }
.home-stats { font-size: 13px; color: var(--muted); text-align: center; }

/* Dos columnas: las dos con la misma altura; el menú llena la suya. */
@media (min-width: 760px), (orientation: landscape) and (min-width: 560px) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 2.4vw, 36px); align-items: stretch; }
  .home-hero { justify-content: center; }
  .home-side .menu-grid { flex: 1; grid-auto-rows: 1fr; }
  .home-stats { grid-column: 1 / -1; }
}
/* Pantallas grandes: todo crece con la altura en vez de quedarse pequeño. */
@media (min-width: 760px) and (min-height: 640px) {
  .wrap.home { max-width: min(1320px, 100%); }
  .tile { min-height: clamp(86px, 13vh, 160px); font-size: clamp(15px, 2.1vh, 22px); }
  .tile .ico { width: clamp(32px, 6vh, 64px); height: clamp(32px, 6vh, 64px); }
  .record-wave { --rw: clamp(30px, 5.5vh, 56px); }
  .record-label, .record-sub, .next-goal { font-size: clamp(13px, 1.7vh, 18px); }
  .home .btn-xl { min-height: clamp(76px, 11vh, 120px); font-size: clamp(32px, 5vh, 52px); }
  .home-play { --hp: clamp(76px, 11vh, 120px); }
  .home-invite .btn-label { font-size: clamp(18px, 2.3vh, 24px); }
  .home-invite .btn-sub { font-size: clamp(14px, 1.7vh, 18px); }
  .home-invite > .ico { width: clamp(34px, 4.6vh, 48px); height: clamp(34px, 4.6vh, 48px); }
  .home .btn-sub { font-size: clamp(13px, 1.7vh, 18px); }
  .home-stats { font-size: clamp(13px, 1.6vh, 17px); }
}

/* ---------- Regiones ---------- */

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}
.region-card {
  --accent: var(--gold);
  position: relative;
  background: #1b2c5c;
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 132px;
  padding: 12px 10px 12px 14px;
  border-radius: 14px;
  border: 3px solid var(--edge);
  box-shadow:
    0 0 0 3px var(--edge-out),
    inset 0 0 0 2px var(--accent),
    0 7px 0 3px rgba(4, 9, 26, 0.55);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  transition: transform 0.12s, filter 0.15s;
  isolation: isolate;
}
.region-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(80% 90% at 85% 60%, rgba(255, 255, 255, 0.22), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 10px, transparent 10px 20px);
}
.region-card:active { transform: translateY(3px); }
@media (hover: hover) { .region-card:hover { transform: translateY(-2px); filter: brightness(1.08); } }
.region-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.region-gen { font-size: 12px; font-weight: 700; color: var(--accent); text-shadow: var(--outline-sm); letter-spacing: 0.06em; }
.region-name { font-size: 26px; font-weight: 700; text-shadow: var(--outline); }
.region-desc { font-size: 13px; color: rgba(255, 255, 255, 0.85); text-shadow: var(--outline-sm); }
.region-best { margin-top: auto; font-size: 14px; font-weight: 700; text-shadow: var(--outline-sm); }
.region-best b { color: var(--gold); }
.region-art { flex: none; width: 104px; display: grid; place-items: center; }
.region-bg { position: absolute; inset: 0; z-index: -2; }
.region-art { position: relative; }
/* Bloqueada: sólo el fondo y el legendario se apagan; el texto se lee entero. */
.region-card.is-locked { box-shadow: 0 0 0 3px var(--edge-out), inset 0 0 0 2px rgba(185, 203, 240, 0.35), 0 7px 0 3px rgba(4, 9, 26, 0.55); }
.region-card.is-locked .region-bg { filter: saturate(0.3) brightness(0.42); }
.region-card.is-locked::before { opacity: 0.4; }
.region-card.is-locked .region-gen { color: var(--muted); }
.region-card.is-locked .region-art .sprite { filter: brightness(0) opacity(0.55); }
.region-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(185, 203, 240, 0.4);
  background: rgba(4, 9, 26, 0.7);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}
.region-seal { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.region-seal .ico { width: 40px; height: 40px; filter: drop-shadow(0 3px 0 var(--edge-out)); }
.region-goal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
  margin-top: 2px;
  padding: 4px 11px 5px 8px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: rgba(4, 9, 26, 0.85);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  text-shadow: var(--outline-sm);
}
.region-goal .ico { width: 17px; height: 17px; }
.region-goal.is-far { border-color: rgba(185, 203, 240, 0.6); color: var(--ink); }
.region-progress { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 6px; font-weight: 700; text-shadow: var(--outline-sm); }
.region-progress b { color: var(--gold); }
.region-progress .bar { height: 12px; }
.region-card.is-new::after {
  content: '¡NUEVA!';
  position: absolute;
  top: 8px;
  right: -30px;
  z-index: 4;
  padding: 2px 34px;
  transform: rotate(35deg);
  background: var(--red);
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--edge-out);
}

/* ---------- Antes de jugar ---------- */

/* Móvil: región, tu mazo, sinergias y luego el resto de la ficha.
   Ancho: ficha a la izquierda, mazo y sinergias a la derecha. */
.pm { display: flex; flex-direction: column; gap: 16px; }
.pm-col { display: contents; }
.pm-head { order: 0; }
.pm-deck { order: 1; }
.pm-syn { order: 2; }
.pm-extra { order: 3; }
@media (min-width: 900px), (orientation: landscape) and (min-width: 700px) {
  .pm { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); align-items: start; }
  .pm-col { display: flex; flex-direction: column; gap: 16px; }
}
/* Móvil en horizontal: el mazo a la izquierda (lo primero que se ve), la
   ficha de la región compacta y sin descripción, y el botón más bajo. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 700px) {
  .pm { grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.75fr); gap: 12px; }
  .pm > .pm-col:first-child { order: 2; }
  .pm-head { padding: 8px 12px; }
  .pm-head .region-name { font-size: 22px; }
  .pm-head .region-desc { display: none; }
  .pm-head .region-best { margin-top: 2px !important; }
  .pm-play.btn-lg { min-height: 50px; padding: 6px 28px 8px; font-size: 21px; }
  .screen-prematch .screen-foot { padding-top: 8px; padding-bottom: max(8px, var(--safe-b)); }
}
.pm-play { min-width: min(320px, 100%); }

/* Tu mazo: el equipo que juegas. En el móvil en vertical, 3 + 2 cartas
   grandes; si el panel es ancho, las 5 en fila. Debajo de cada una, su papel. */
.pm-team-wrap { container-type: inline-size; margin-top: 14px; }
.pm-team {
  --cols: 3;
  --gx: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px var(--gx);
}
@container (min-width: 440px) {
  .pm-team { --cols: 5; --gx: 12px; }
}
.pm-member {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: calc((100% - (var(--cols) - 1) * var(--gx)) / var(--cols));
  max-width: 150px;
  min-width: 0;
}
.pm-member > .card { width: 100%; }
.pm-role {
  min-height: 2.3em;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  color: var(--muted);
  text-shadow: var(--outline-sm);
  overflow-wrap: anywhere;
}
.pm-member.is-empty .pm-role { color: var(--red); }
/* Al cambiar de mazo, las cartas se reparten una tras otra. */
.pm-team.is-switching .pm-member { animation: pm-deal 0.4s cubic-bezier(0.3, 1.35, 0.5, 1) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes pm-deal {
  from { opacity: 0; transform: translateY(16px) rotate(-3deg) scale(0.9); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-team.is-switching .pm-member { animation: none; }
}
.pm-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 95, 109, 0.16);
  box-shadow: inset 0 0 0 2px rgba(255, 95, 109, 0.6);
  color: #ffd6da;
  font-size: 14px;
  font-weight: 700;
}
.pm-warn[hidden] { display: none; }
/* Cabecera del mazo: título y «Editar mazo» arriba, pestañas debajo. En el
   móvil en horizontal, sin título: pestañas y botón en una sola fila. */
.pm-deck-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'title edit' 'tabs tabs';
  align-items: center;
  gap: 10px 10px;
}
.pm-deck-top > .panel-h { grid-area: title; margin: 0; }
.pm-deck-top > .pm-edit { grid-area: edit; }
.pm-deck-top > .tabs { grid-area: tabs; }
@media (orientation: landscape) and (max-height: 520px) and (min-width: 700px) {
  .pm-deck-top { grid-template-areas: 'tabs edit'; }
  .pm-deck-top > .panel-h { display: none; }
  .pm-team-wrap { margin-top: 12px; }
}
/* Móvil bajito en vertical: la ficha de la región más compacta. */
@media (orientation: portrait) and (max-height: 700px) {
  .pm-head { padding: 10px 12px; }
  .pm-head .region-name { font-size: 24px; }
  .pm-head .region-desc { display: none; }
  .pm-play.btn-lg { min-height: 54px; padding: 6px 28px 8px; font-size: 22px; }
}
.pm-edit.btn-sm { flex: none; padding: 4px 12px 6px; font-size: 14px; }
/* Pestañas de los 3 mazos (aquí y en el editor): siempre las 3 a la vista,
   iguales, con el nombre en hasta dos líneas. */
.tabs.deck-tabs { overflow: visible; -webkit-mask-image: none; mask-image: none; }
.deck-tabs .tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
}
.pm-hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.pm-syn-n { font-size: 13px; color: var(--muted); }
.pm-syn-n.is-on { color: var(--green); }
.pm-head {
  border-radius: 14px;
  padding: 14px;
  border: 3px solid var(--edge);
  box-shadow: 0 0 0 3px var(--edge-out), inset 0 0 0 2px var(--accent, var(--gold)), 0 7px 0 3px rgba(4, 9, 26, 0.55);
}
.pm-head .region-name { font-size: 30px; }
.legs { display: flex; flex-wrap: wrap; gap: 8px; }
.leg {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px;
  padding: 4px 4px 6px;
  border-radius: 10px;
  background: var(--well);
  font-size: 12px;
  text-align: center;
}
.leg .sprite-stage { width: 72px; height: 72px; }
.weather { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.weather + .weather { border-top: 1px solid rgba(91, 131, 214, 0.3); }
.weather .ico { width: 28px; height: 28px; }
.weather b { display: block; }
.weather span { font-size: 13px; color: var(--muted); }
/* Sinergias de un mazo (js/ui/deck-synergies.js): antes de jugar y al editar. */
.dsyn { display: flex; flex-direction: column; gap: 8px; }
.dsyn-row {
  padding: 8px 10px 8px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 22%, transparent), transparent 60%), var(--well);
  box-shadow: inset 4px 0 0 var(--tc), inset 0 0 0 1px rgba(91, 131, 214, 0.35);
}
.dsyn-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dsyn-bonus { font-size: 15px; text-shadow: var(--outline-sm); }
.dsyn-lv { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gold); text-shadow: var(--outline-sm); }
.dsyn-text { margin: 5px 0 0; font-size: 13px; line-height: 1.3; }
.dsyn-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.dsyn-who { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.dsyn-mon {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 36px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.dsyn-next { font-size: 12px; color: var(--muted); text-align: right; }
.dsyn-none { margin: 0; font-size: 14px; color: var(--muted); }
.dsyn-off { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 2px 2px 0; }
.dsyn-off-h { font-size: 12px; color: var(--muted); }
.dsyn-off .chip { filter: saturate(0.6); opacity: 0.8; }
/* En una fila (barra del editor de mazos). */
.dsyn-strip {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.dsyn-strip::-webkit-scrollbar { display: none; }
.dsyn-mini {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.75;
}
.dsyn-mini.is-on {
  opacity: 1;
  color: var(--ink);
  text-shadow: var(--outline-sm);
  background: color-mix(in srgb, var(--tc) 38%, rgba(6, 14, 38, 0.7));
  box-shadow: inset 0 0 0 2px var(--tc);
}
.dsyn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); border: 2px solid var(--edge-out); }
.dsyn-mini .pips { gap: 1px; }
.dsyn-mini .pip { width: 9px; height: 9px; border-width: 1.5px; border-radius: 2px; }
.dsyn-mini-empty { font-size: 12px; color: var(--muted); }
.pips { display: inline-flex; gap: 4px; align-items: center; justify-self: end; }
.pip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--edge-out);
  background: #23345f;
  transform: rotate(45deg) scale(0.8);
}
.pip.is-on { background: var(--gold); box-shadow: 0 0 8px rgba(255, 210, 63, 0.8); }

/* ---------- Resultados ---------- */

.res-layout { max-width: 720px; display: flex; flex-direction: column; gap: 14px; }
.res-place { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
/* Móvil en horizontal: oleada y estadísticas fijas a la izquierda; premios,
   rótulos, cartas y capturas a la derecha. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 640px) {
  .res-layout { max-width: 1080px; display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); align-items: start; }
  .res-main { position: sticky; top: 0; }
  .res-hero { padding: 0; }
}
.res-hero { text-align: center; padding: 6px 0 2px; }
.res-hero-label { font-size: 18px; color: var(--muted); text-shadow: var(--outline-sm); }
.res-wave {
  font-size: clamp(76px, 22vw, 150px);
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 4px 0 var(--edge-out), 4px 0 0 var(--edge-out), -4px 0 0 var(--edge-out), 0 -4px 0 var(--edge-out),
    4px 4px 0 var(--edge-out), -4px 4px 0 var(--edge-out), 4px -4px 0 var(--edge-out), -4px -4px 0 var(--edge-out),
    0 10px 0 rgba(0, 0, 0, 0.35);
}
.res-wave.is-done { animation: bump 0.5s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.res-region { font-size: 16px; color: var(--muted); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--well);
  animation: card-pop 0.3s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.stat .ico { width: 26px; height: 26px; }
.stat-v { font-size: 20px; font-weight: 700; text-shadow: var(--outline-sm); }
.stat-k { font-size: 12px; color: var(--muted); }
.rewards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--well);
  font-size: 28px;
  font-weight: 700;
  text-shadow: var(--outline);
}
.reward .ico { width: 34px; height: 34px; }
.reward-coins { color: var(--gold); }
.reward-tickets { color: #ff9cc8; }
.banners { display: flex; flex-direction: column; gap: 8px; }
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  border: 3px solid #fff4c2;
  box-shadow: 0 0 0 3px #4a3200, 0 0 22px rgba(255, 210, 63, 0.45);
  background: linear-gradient(180deg, #ffe873, #f4ae1a);
  color: #3a2400;
  animation: banner-in 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.banner .ico { width: 26px; height: 26px; }
.banner-blue { border-color: var(--edge); box-shadow: 0 0 0 3px var(--edge-out), 0 0 22px rgba(95, 184, 255, 0.45); background: linear-gradient(180deg, #6fb4ff, #2f6fd8); color: #fff; text-shadow: var(--outline-sm); }
.banner-green { border-color: #d8ffe5; box-shadow: 0 0 0 3px #0c3a1d, 0 0 22px rgba(95, 224, 138, 0.5); background: linear-gradient(180deg, #74eaa0, #2fb562); color: #08341a; }
.banner-shiny { justify-content: flex-start; text-align: left; border-color: #fff0fa; box-shadow: 0 0 0 3px #4a0f38, 0 0 22px rgba(255, 138, 209, 0.5); background: linear-gradient(180deg, #ffd1f0, #ff8ad1); color: #4a0f38; }
.banner-sub { display: block; font-size: 13px; font-weight: 400; opacity: 0.85; }
.banner .btn { flex: none; }
.banner-done { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 700; }
.banner-done .ico { width: 18px; height: 18px; }
/* Experiencia de las cartas jugadas */
.xp-grid { align-items: start; }
.xp-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.xp-item .bar { height: 16px; }
.xp-item .bar-text { font-size: 11px; }
.xp-state { display: flex; justify-content: center; min-height: 20px; }
.xp-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 2px solid var(--edge-out);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.xp-chip .ico { width: 12px; height: 12px; }
.xp-chip.is-up { background: linear-gradient(180deg, #74eaa0, #2fb562); color: #08341a; animation: badge-pop 1.2s ease-in-out infinite; }
.xp-chip.is-coins { background: #2a3350; color: #ffd0d5; }
.xp-chip.is-max { background: linear-gradient(180deg, #fff3a6, #ffb81f); color: #4a2a00; }
.xp-note { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.xp-note:empty { display: none; }
.xp-ready { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--green); text-shadow: var(--outline-sm); }
.xp-ready .ico { width: 20px; height: 20px; }
@keyframes banner-in { from { transform: scale(0.5) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.captures { --card-min: 86px; }
.cap-wrap { perspective: 600px; }
.cap-wrap .card { animation: cap-in 0.55s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
@keyframes cap-in {
  0% { transform: rotateY(90deg) scale(0.7); filter: brightness(3); }
  60% { transform: rotateY(-8deg) scale(1.05); filter: brightness(1.5); }
  100% { transform: none; filter: none; }
}
.skip-hint { font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Mazos ---------- */

.deck-name-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.deck-name-row .input { flex: 1 1 180px; }
.deck-status { font-weight: 700; }
.deck-status.is-ok { color: var(--green); }
.deck-status.is-bad { color: var(--red); }
.deck-tabs .tab { position: relative; }
/* El mazo en uso lleva un punto verde en su pestaña (editor). */
.deck-tabs .tab.is-inuse::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--edge-out);
}

/* Móvil: una columna. Pantalla ancha y alta: el mazo fijo a la izquierda
   (con sus sinergias completas) y la colección a la derecha. */
.dk { display: flex; flex-direction: column; gap: 16px; }
.dk .deck-name-row { margin: 12px 0; }
.dk-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 104px)); justify-content: center; gap: 8px; }
@media (orientation: landscape) and (max-height: 520px) {
  .dk-slots { grid-template-columns: repeat(5, minmax(0, 84px)); }
}
.dk-slot { display: flex; flex-direction: column; min-width: 0; }
.dk-slot > .card { width: 100%; flex: none; }   /* sin estirar: la carta guarda su 63/88 */
.dk-slot.is-pop { animation: dk-pop 0.38s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes dk-pop {
  from { transform: translateY(18px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.dk-status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; margin-top: 10px; }
.dk-syn-box { margin-top: 12px; padding-top: 10px; border-top: 2px solid rgba(91, 131, 214, 0.35); }
.dk-syn-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.dk-syn-h b { color: var(--gold); text-shadow: var(--outline-sm); }
.dk-syn .dsyn-strip { flex-wrap: wrap; overflow: visible; }
.dk-syn-full { display: none; }
.dk .deck-name-row .input { flex: 1 1 120px; min-width: 0; }
@media (max-width: 420px) {
  .dk-use-more { display: none; }
}
/* Al completar el mazo, el estado y el contador de la barra dan un salto. */
.deck-status.is-done, .dk-dock-n.is-done { animation: dk-done 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes dk-done {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); text-shadow: 0 0 12px rgba(95, 224, 138, 0.9); }
  100% { transform: scale(1); }
}
.deck-status { display: inline-block; transform-origin: left center; }
/* Ancho (escritorio o móvil en horizontal): el mazo fijo a la izquierda y la
   colección a la derecha; la barra que baja no hace falta. */
@media (min-width: 960px) and (min-height: 600px), (orientation: landscape) and (max-height: 520px) and (min-width: 700px) {
  .dk { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); align-items: start; }
  .dk-deck { position: sticky; top: 0; max-height: calc(100dvh - 120px); overflow-y: auto; scrollbar-width: thin; }
  .dk-dock-anchor { display: none; }
}
@media (min-width: 960px) and (min-height: 600px) {
  .dk-syn { display: none; }
  .dk-syn-full { display: block; }
}
/* Móvil en horizontal: columna del mazo estrecha y sin título. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 700px) {
  .dk { grid-template-columns: minmax(290px, 350px) minmax(0, 1fr); gap: 12px; }
  .dk-deck { max-height: calc(100dvh - 88px); padding: 10px 12px; }
  .dk-deck > .panel-h, .dk-syn-h, .dk-use-more { display: none; }
  .dk .deck-name-row { margin: 8px 0; }
  .dk-slots { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .dk-status-row { margin-top: 6px; }
  .dk-status-row .small { display: none; }
  .dk-syn-box { margin-top: 8px; padding-top: 8px; }
  .dk-syn .dsyn-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 22px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
  }
}

/* Barra del mazo: baja contigo por la colección cuando las ranuras de
   arriba se salen de la vista (no ocupa sitio mientras no se ve). */
.dk-dock-anchor { position: sticky; top: 0; z-index: 6; height: 0; max-width: 1080px; margin: 0 auto; }
.dk-dock {
  position: absolute;
  top: -14px;
  left: -8px;
  right: -8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px 9px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, rgba(10, 22, 56, 0.98), rgba(8, 18, 46, 0.96));
  box-shadow: 0 0 0 2px var(--edge-in), 0 0 0 4px var(--edge-out), 0 10px 18px rgba(0, 0, 0, 0.5);
  transform: translateY(calc(-100% - 24px));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s ease-in, opacity 0.2s, visibility 0s 0.2s;
}
.dk-dock.is-shown {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.3, 1.3, 0.5, 1), opacity 0.15s;
}
.dk-dock-row { display: flex; align-items: center; gap: 8px; }
.dk-dock-n { flex: none; min-width: 40px; font-size: 16px; font-weight: 700; text-align: center; color: var(--red); text-shadow: var(--outline-sm); }
.dk-dock-n.is-ok { color: var(--green); }
.dk-dock-slots { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.dk-dock-slot {
  display: grid;
  place-items: center;
  height: 44px;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid var(--edge-in);
  background: radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 70%);
  color: rgba(185, 203, 240, 0.5);
  font-size: 20px;
  font-weight: 700;
}
.dk-dock-slot.is-empty { border-style: dashed; background: none; }
button.dk-dock-slot:active { transform: translateY(2px); }
.dk-dock-slot.is-pop { animation: dk-pop 0.38s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
/* Si las sinergias no caben, se desplazan de lado y se difuminan al final. */
.dk-dock-syn .dsyn-strip {
  padding-right: 22px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
}
@media (min-width: 600px) {
  .dk-dock { flex-direction: row; align-items: center; gap: 12px; }
  .dk-dock-row { flex: 0 1 360px; }
  .dk-dock-syn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dk-dock, .dk-dock.is-shown { transition: none; }
  .dk-slot.is-pop, .dk-dock-slot.is-pop, .deck-status.is-done, .dk-dock-n.is-done { animation: none; }
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .select { flex: 1 1 140px; }
.count-line { font-size: 14px; color: var(--muted); }
.count-line b { color: var(--gold); }

/* ---------- Detalle de carta ---------- */

.detail-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.detail-head .chips { flex: 1; }
.detail-role { font-size: 16px; font-weight: 700; color: var(--gold); text-shadow: var(--outline-sm); }
.forms { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.form-stage-h { font-size: 13px; color: var(--muted); margin: 4px 0 -2px; }
.form-box {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--well);
}
.form-art { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.form-art .sprite-stage { width: 88px; height: 76px; }
.form-name { font-size: 14px; font-weight: 700; text-shadow: var(--outline-sm); }
.move-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; font-weight: 700; text-shadow: var(--outline-sm); }
.move-kind { font-size: 14px; margin-top: 4px; }
.move-fx { margin: 6px 0 0; padding: 0 0 0 16px; font-size: 13px; color: var(--muted); }
.move-fx li + li { margin-top: 2px; }
.move-dps { margin-top: 6px; font-size: 13px; }
.move-dps b { color: var(--gold); font-size: 15px; }
.ult {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.18), rgba(255, 210, 63, 0.05));
  border: 2px solid rgba(255, 210, 63, 0.5);
}
.ult-h { font-weight: 700; color: var(--gold); text-shadow: var(--outline-sm); }
.lvl { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.lvl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lvl-n { font-size: 22px; font-weight: 700; color: var(--gold); text-shadow: var(--outline); }
.shiny-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: var(--well); }
.arrow-down { text-align: center; color: var(--muted); font-size: 18px; line-height: 1; }

@media (max-width: 420px) {
  .form-box { grid-template-columns: 72px 1fr; }
  .form-art .sprite-stage { width: 72px; height: 76px; }
}

/* ---------- Ranking ---------- */

.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--well);
  animation: card-pop 0.3s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.medal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 18px;
  border: 3px solid var(--edge-out);
  background: #2a3f78;
  text-shadow: var(--outline-sm);
}
.medal-1 { background: linear-gradient(180deg, #fff3a6, #f4ae1a); color: #3a2400; text-shadow: none; box-shadow: 0 0 12px rgba(255, 210, 63, 0.6); }
.medal-2 { background: linear-gradient(180deg, #f4f8ff, #a9b8d6); color: #1a2440; text-shadow: none; }
.medal-3 { background: linear-gradient(180deg, #ffc89a, #c7783a); color: #3a1c00; text-shadow: none; }
.rank-wave { font-size: 20px; font-weight: 700; text-shadow: var(--outline-sm); }
.rank-meta { font-size: 13px; color: var(--muted); }
.rank-deck { display: flex; gap: 0; align-items: center; }
.rank-deck .sprite { margin: -6px -4px; }
@media (max-width: 480px) {
  .rank-row { grid-template-columns: 44px minmax(0, 1fr); }
  .rank-deck { grid-column: 2; }
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }

/* ---------- Ajustes ---------- */

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.set-row + .set-row { border-top: 1px solid rgba(91, 131, 214, 0.3); }
.set-label { flex: 1 1 160px; min-width: 0; }
.set-label b { display: block; font-size: 16px; }
.set-label span { display: block; font-size: 13px; color: var(--muted); }
.set-ctrl { flex: 1 1 200px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.set-ctrl .range { flex: 1; }
.set-val { width: 48px; text-align: right; font-weight: 700; color: var(--gold); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }

/* ---------- Online (js/ui/online-ui.js; sólo con el online configurado) ---------- */

/* Chip de estado en la barra de Inicio: nube con un punto del color del estado. */
.sync-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(5, 12, 32, 0.75);
  border: 2px solid var(--edge-in);
  box-shadow: 0 0 0 2px var(--edge-out), inset 0 2px 0 rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
}
.sync-chip[hidden] { display: none; }
.sync-chip::before { content: ''; position: absolute; inset: -4px 0; }   /* 44 px de alto para el dedo */
.sync-chip:active { transform: translateY(2px); }
.sync-chip .ico { width: 24px; height: 24px; }
.sync-dot, .ol-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--edge-out);
  background: var(--muted);
  flex: none;
}
.sync-dot { position: absolute; right: 5px; bottom: 3px; }
.is-good > .sync-dot, .is-good > .ol-dot { background: var(--green); }
.is-busy > .sync-dot, .is-busy > .ol-dot { background: #5fb8ff; animation: blink 0.9s ease-in-out infinite; }
.is-warn > .sync-dot, .is-warn > .ol-dot { background: var(--gold); }
.is-bad > .sync-dot, .is-bad > .ol-dot { background: var(--red); box-shadow: 0 0 8px rgba(255, 95, 109, 0.8); }
.sync-chip.is-bad { border-color: var(--red); }

/* Panel de Ajustes */
.ol-panel.is-flash { animation: ol-flash 1.4s ease-out; }
@keyframes ol-flash {
  0%, 60% { box-shadow: 0 0 0 3px var(--edge-out), inset 0 0 0 2px var(--edge-in), 0 0 0 7px rgba(255, 210, 63, 0.7), 0 7px 0 3px rgba(4, 9, 26, 0.55); }
}
.ol-intro { margin: -4px 0 8px; }
.ol-stored { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.ol-stored .ico { width: 18px; height: 18px; margin-top: -1px; }
.ol-field { display: flex; flex-direction: column; gap: 6px; }
.ol-field > span { font-size: 15px; font-weight: 700; }
.ol-err { margin: 8px 0 0; font-size: 14px; color: #ffb3bb; text-shadow: var(--outline-sm); }
.ol-err[hidden] { display: none; }
.ol-go { margin: 12px 0 6px; }
.ol-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid #ff7d89;
  background: rgba(217, 58, 82, 0.25);
  font-size: 14px;
}
.ol-alert .ico { width: 22px; height: 22px; }
.ol-alert .btn { flex: none; align-self: center; }
/* Aviso neutro: desactivado aquí antes (activar crea otra cuenta). */
.ol-alert.ol-former { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.07); }
.ol-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 4px;
  padding: 6px 8px 6px 12px;
  border-radius: 10px;
  background: var(--well);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(91, 131, 214, 0.35);
  font-weight: 700;
  text-shadow: var(--outline-sm);
}
.ol-status.is-bad { box-shadow: inset 0 0 0 2px var(--red); }
.ol-status .btn { flex: none; }
.ol-status .btn[hidden] { display: none; }
.ol-panel .set-ctrl { flex: 0 1 auto; margin-left: auto; }
.ol-name-row .set-ctrl { flex: 1 1 240px; }
.ol-name-row .input { flex: 1; min-width: 0; }
.set-row > .ol-err { flex: 1 1 100%; margin: -4px 0 4px; }

/* Pestañas Global | Mis partidas */
.ol-modes { display: flex; }
.ol-modes .tab { flex: 1 1 0; }
.ol-modes .tab .ico { margin-right: 6px; }
.stack > .panel[hidden] { display: none; }

/* Ranking global */
.ol-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  background: var(--well);
  box-shadow: inset 0 0 0 2px rgba(95, 224, 138, 0.55);
  font-size: 14px;
}
.ol-cta[hidden] { display: none; }
.ol-cta .ico { width: 26px; height: 26px; }
.ol-cta p { min-width: 150px; }
.ol-rows { display: flex; flex-direction: column; gap: 6px; }
.rank-row.ol-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; padding: 6px 10px; }
.ol-row .medal { width: 34px; height: 34px; font-size: 15px; border-width: 2px; }
.ol-row.is-me {
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.3), rgba(255, 210, 63, 0.12));
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 14px rgba(255, 210, 63, 0.35);
}
.ol-who { min-width: 0; }
.ol-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: var(--outline-sm);
}
.ol-you {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px 1px;
  border-radius: 6px;
  background: var(--gold);
  color: #3a2400;
  font-size: 12px;
  text-shadow: none;
  vertical-align: 2px;
}
.ol-row .rank-meta { font-size: 12px; }
.ol-deck .sprite { margin: -8px -6px; }
@media (max-width: 480px) {
  .rank-row.ol-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .rank-row.ol-row .rank-deck { grid-column: auto; }
}
@media (max-width: 400px) {
  .ol-deck .sprite { margin: -9px -8px; transform: scale(0.82); }
  .ol-name { font-size: 15px; }
}
.ol-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px; text-align: center; color: var(--muted); }
.ol-spin {
  width: 28px;
  height: 28px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.ol-me {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 0;
  color: var(--ink);
  text-align: left;
  border-radius: 10px;
  background: rgba(255, 210, 63, 0.16);
  box-shadow: inset 0 0 0 2px var(--gold);
  font-size: 14px;
}
.ol-me b { color: var(--gold); text-shadow: var(--outline-sm); }
.ol-me .ico { width: 20px; height: 20px; }
button.ol-me:active { transform: translateY(2px); }
.ol-total { margin-top: 10px; text-align: center; }

/* Resultados */
.ol-res-line { margin-top: 6px; color: #d6e6ff; }
.ol-res-line.is-wait { color: var(--muted); }
.ol-res-line .ico { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }

/* Ventanas: elegir partida, código y recuperar */
.ol-cmp {
  width: 100%;
  margin-top: 12px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.ol-cmp th, .ol-cmp td { padding: 5px 6px; text-align: center; vertical-align: middle; }
.ol-cmp-k { width: 34%; }
.ol-cmp thead th { padding-top: 8px; font-size: 14px; line-height: 1.15; color: var(--gold); text-shadow: var(--outline-sm); vertical-align: bottom; }
.ol-cmp tbody th { text-align: left; font-size: 13px; font-weight: 400; color: var(--muted); padding-left: 0; }
.ol-cmp tbody td { font-size: 15px; font-weight: 700; text-shadow: var(--outline-sm); }
.ol-cmp tbody tr > * { border-top: 1px solid rgba(91, 131, 214, 0.25); }
.ol-cmp tbody tr.is-date td { font-size: 13px; }
.ol-cmp td.is-more { color: var(--green); }
/* Las dos columnas, como dos tarjetas (el borde transparente hace de hueco). */
.ol-cmp .is-device, .ol-cmp .is-cloud { background-color: rgba(6, 14, 38, 0.55); background-clip: padding-box; }
.ol-cmp .is-cloud { border-left: 6px solid transparent; }
.ol-cmp thead th.is-device, .ol-cmp thead th.is-cloud { border-radius: 10px 10px 0 0; }
.ol-cmp tfoot td.is-device, .ol-cmp tfoot td.is-cloud { padding: 8px 6px 10px; border-radius: 0 0 10px 10px; }
.ol-cmp tfoot .btn { width: 100%; padding-left: 6px; padding-right: 6px; }
/* Móvil en horizontal: el texto a la izquierda y la tabla a la derecha. */
@media (orientation: landscape) and (max-height: 520px) {
  .modal.ol-conflict { width: min(760px, 100%); }
  .ol-conflict .modal-title { padding-top: 10px; }
  .ol-conflict .modal-body { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: 0 16px; align-items: start; }
  .ol-conflict .modal-body > .ol-err { grid-column: 1 / -1; }
  .ol-cmp { margin-top: 0; }
  .ol-cmp th, .ol-cmp td { padding-top: 2px; padding-bottom: 2px; }
  .ol-cmp tfoot td.is-device, .ol-cmp tfoot td.is-cloud { padding: 6px; }
}
.ol-code-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.input.ol-code {
  flex: 1 1 100%;
  min-width: 0;
  min-height: 52px;
  font-size: clamp(17px, 5.6vw, 22px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--gold);
  text-shadow: var(--outline-sm);
}
.ol-code-row .btn { flex: 1 0 auto; }
.ol-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--gold);
  background: rgba(255, 210, 63, 0.14);
  font-size: 14px;
  line-height: 1.35;
}
.ol-warn .ico { width: 28px; height: 28px; }
.ol-warn b { color: var(--gold); text-shadow: var(--outline-sm); }
.input.ol-code-input { margin-top: 10px; font-size: 18px; letter-spacing: 0.06em; text-align: center; }
.ol-note { margin-top: 10px; }

/* ---------- Créditos ---------- */

.credits p + p { margin-top: 8px; }
.credits .panel p { font-size: 15px; line-height: 1.4; }
.credits ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; font-size: 15px; }
.legal { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- Cómo se juega ---------- */

.help { display: flex; flex-direction: column; gap: 14px; }
.help-sec {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 21px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--outline);
}
.help-sec .ico { width: 24px; height: 24px; }
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 18px 16px;
}
.help-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
/* Dibujo de la tarjeta: sprites e iconos del juego sobre un pozo oscuro. */
.help-art {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 5px;
  min-height: 88px;
  margin-bottom: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: radial-gradient(80% 90% at 50% 60%, rgba(255, 255, 255, 0.08), transparent 70%), var(--well);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(91, 131, 214, 0.35);
}
.help-h { font-size: 18px; font-weight: 700; color: var(--gold); text-shadow: var(--outline-sm); }
.help-text { font-size: 15px; line-height: 1.32; }
.help-tip { font-size: 13px; line-height: 1.35; color: var(--muted); }
.help-mon { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.help-sign { font-size: 26px; font-weight: 700; color: var(--muted); text-shadow: var(--outline-sm); }
.help-arrow { display: inline-flex; color: var(--gold); filter: drop-shadow(0 2px 0 var(--edge-out)); }
.help-arrow .ico { width: 18px; height: 18px; }
.help-cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 3px 3px;
  border-radius: 999px;
  background: rgba(5, 12, 32, 0.75);
  border: 2px solid var(--edge-in);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: var(--outline-sm);
}
.help-cost .ico { width: 14px; height: 14px; }
.help-big .ico { width: 40px; height: 40px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.help-big.is-sm .ico { width: 30px; height: 30px; }
.help-lives { display: inline-flex; gap: 2px; }
.help-lives .ico { width: 24px; height: 24px; }
.help-weather .ico { width: 34px; height: 34px; }
/* Cartas en miniatura (tu mazo, el álbum) y un sobre pequeño. */
.help-deck { display: grid; grid-template-columns: repeat(5, minmax(0, 46px)); gap: 5px; width: 100%; justify-content: center; }
.help-deck.is-album { grid-template-columns: repeat(3, minmax(0, 50px)); gap: 8px; }
.help-pack { display: inline-flex; padding: 0 4px; }
.help-pack .pack { --pk-w: 41px; }   /* cabe en el alto de los otros dibujos */
.help-lv, .help-wave { font-size: 26px; font-weight: 700; color: var(--gold); text-shadow: var(--outline); }
/* Puntos de rango, con los colores del tablero (render/renderer.js). */
.rank-pips { display: inline-flex; gap: 3px; }
.rank-pip { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--edge-out); background: #fff; }
.rank-pip.r2 { background: #5fe08a; }
.rank-pip.r3 { background: #4fb3ff; }
.rank-pip.r4 { background: #c77dff; }
.rank-pip.r5 { background: #ffd23f; }
/* El marcado por el jefe: aro rojo que gira; el líder lleva corona. */
.help-mon.is-marked { margin: 0 14px; }
.help-mon.is-marked::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-radius: 50%;
  border: 3px dashed var(--red);
  animation: spin 6s linear infinite;
}
.help-badge { position: absolute; top: -6px; left: 50%; width: 26px; height: 26px; margin-left: -13px; z-index: 1; }
.help-badge .ico { width: 100%; height: 100%; }
.help-foot { font-size: 14px; color: var(--muted); text-align: center; }
.help-go { justify-content: center; margin-top: 2px; }
.help-go .btn { flex: 0 1 320px; }

/* ---------- Error de pantalla ---------- */

.screen-error { max-width: 520px; margin: 40px auto; text-align: center; }
.screen-error pre {
  margin: 10px 0;
  padding: 10px;
  max-height: 160px;
  overflow: auto;
  text-align: left;
  white-space: pre-wrap;
  font-size: 12px;
  background: var(--well);
  border-radius: 8px;
  user-select: text;
}

/* ---------- Animaciones comunes ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: scr-fade 0.35s both; }
.pop-in { animation: card-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) backwards; }
@keyframes card-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Adaptación a pantallas ---------- */

/* Móvil estrecho */
@media (max-width: 400px) {
  .topbar { min-height: 56px; gap: 6px; }
  .topbar-title { font-size: 20px; }
  .res-pill { height: 32px; padding: 0 8px 0 4px; font-size: 14px; gap: 4px; }
  .res-pill .ico { width: 18px; height: 18px; }
  .btn { font-size: 16px; }
  .btn-xl { font-size: 28px; min-height: 68px; }
  .home-play { --hp: 68px; }
  .tile { min-height: 78px; font-size: 14px; }
  .region-name { font-size: 22px; }
  .region-art { width: 84px; }
  .panel { padding: 12px; }
}

/* Móvil en horizontal: poca altura */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { min-height: 52px; padding-top: max(4px, var(--safe-t)); padding-bottom: 4px; }
  .topbar-title { font-size: 20px; }
  .screen-body { padding-top: 10px; padding-bottom: 18px; }
  .screen-foot { padding-top: 6px; padding-bottom: max(6px, var(--safe-b)); }
  .btn-xl { min-height: 60px; font-size: 28px; }
  .home-play { --hp: 60px; }
  .btn-lg { min-height: 54px; font-size: 20px; }
  .tile { min-height: 64px; flex-direction: row; gap: 8px; }
  .tile .ico { width: 26px; height: 26px; }
  .title-wrap { padding-bottom: 120px; gap: 8px; }
  .logo-lg { font-size: clamp(48px, 11vh, 96px); }
  .tap-hint { margin-top: 6px; }
  .parade { height: 90px; bottom: max(24px, var(--safe-b)); }
  .title-ground { bottom: max(28px, var(--safe-b)); height: 44px; }
  .title-foot { bottom: max(4px, var(--safe-b)); }
  .res-wave { font-size: clamp(64px, 18vh, 120px); }
  .modal { max-height: calc(100dvh - 20px); }
}

/* Escritorio */
@media (min-width: 1200px) {
  .screen-body { padding-top: 22px; }
}

/* Menos movimiento: fuera fondos y rebotes; los sprites y el desfile siguen. */
@media (prefers-reduced-motion: reduce) {
  *:not(.sprite):not(.parade-mon), *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
