/* =====================================================================
   PokéVersus · interfaz v3 (moderna): base, ventanas, botones, pestañas, listas y avisos.
   Todo va en rem: el tamaño de letra de la raíz crece con la pantalla (móvil 12 px, PC grande 20-22 px),
   así la interfaz entera escala sin saturar el móvil ni quedarse pequeña en un monitor grande.
   Letras: Jersey 10 (pixel) para títulos, botones y números; Nunito para los textos.
   ===================================================================== */
@font-face {
  font-family: 'Jersey 10';
  src: url('../assets/fonts/Jersey10.ttf') format('truetype');
  font-weight: 400 700;
  font-display: block;
  size-adjust: 128%; /* Jersey es más pequeña: así ocupa lo mismo que una letra normal */
}
@font-face {
  font-family: 'Nunito';
  src: url('../assets/fonts/Nunito.woff') format('woff');
  font-weight: 500 900;
  font-display: swap;
}

:root {
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);

  /* superficies (de más oscura a más clara) */
  --bg: #080d1c;
  --ink-0: #0a1024;
  --ink-1: #10183a;
  --ink-2: #172250;
  --ink-3: #1f2d66;
  --glass: rgba(11, 17, 38, 0.82);
  --glass-2: rgba(19, 28, 62, 0.86);
  --line: rgba(170, 195, 255, 0.12);
  --line-2: rgba(170, 195, 255, 0.22);
  --line-3: rgba(170, 195, 255, 0.34);

  /* texto */
  --tx: #f3f6ff;
  --tx-2: #b9c5ea;
  --tx-3: #7f8db8;

  /* colores Pokémon */
  --red: #ef4136; --red-2: #c9271f; --red-3: #861612;
  --yel: #ffcb05; --yel-2: #f2a400; --yel-ink: #3a2700;
  --blu: #3f7bff; --blu-2: #2856cc;
  --grn: #34cf6c; --grn-2: #1f9a4e;
  --pnk: #ff5fb4; --pur: #9a62ff; --org: #ff8a2a; --teal: #22c3bd;
  --frame: #ffcb05; /* color elegido en Ajustes (lo pone pixui.js) */

  /* formas */
  --r-xs: 0.35rem;
  --r-s: 0.55rem;
  --r-m: 0.8rem;
  --r-l: 1.15rem;
  --sh-1: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.3);
  --sh-2: 0 0.9rem 2.4rem rgba(0, 0, 0, 0.5);

  --f-disp: 'Jersey 10', system-ui, sans-serif;
  --f-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Pokéball dibujada con degradados (botón de jugar, cabeceras...) */
  --pkb: radial-gradient(circle at 50% 50%, #ffffff 0 15%, #1b1f33 15.5% 25%, transparent 25.5%),
    linear-gradient(180deg, #f2463c 0 45%, #1b1f33 45% 55%, #f3f5fb 55%);
}

/* tamaño base: 12 px en el móvil en horizontal, unos 16 px en tablet y portátil, 20-22 px en PC grande */
html { font-size: clamp(12px, min(6.9px + 1.212vh, 4px + 1.25vw), 22px); }
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--f-body);
  font-weight: 600;
  line-height: 1.3;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none; /* (en Android la lobby se podía arrastrar) */
}
canvas { display: block; touch-action: none; }
img { -webkit-user-drag: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--yel); outline-offset: 2px; }
a { color: #9ccaff; }
.hidden { display: none !important; }

h1, h2, h3, h4 { font-family: var(--f-disp); font-weight: 400; letter-spacing: 0.02em; margin: 0; }
h1 { font-size: 3rem; line-height: 1; text-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.45); }
h1.win { color: var(--yel); }
h1.lose { color: #ff7a6e; }
small { font-size: 0.82rem; }
b, strong { font-weight: 800; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0.05em 0.4em; margin-right: 0.2em; text-align: center;
  font-family: var(--f-disp); font-size: 1rem; color: var(--ink-0); background: #e8eeff;
  border-radius: 0.3rem; box-shadow: inset 0 -0.15rem 0 #a8b4d4;
}

/* barras de desplazamiento finas */
* { scrollbar-width: thin; scrollbar-color: rgba(170, 195, 255, 0.28) transparent; }
::-webkit-scrollbar { width: 0.45rem; height: 0.45rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(170, 195, 255, 0.28); border-radius: 1rem; }

/* ------------------------------------------------------------------ pantallas y ventanas */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.7rem, var(--sat)) calc(0.7rem + var(--sar)) max(0.7rem, var(--sab)) calc(0.7rem + var(--sal));
  background: radial-gradient(120% 95% at 50% 45%, rgba(12, 18, 44, 0.55), rgba(5, 8, 22, 0.9));
  overflow-x: hidden;
  overflow-y: auto; /* (si algo no cabe, se baja; las ventanas ya se desplazan por dentro) */
}
.screen > .panel, .screen > .wl-box { margin: auto; } /* centradas, pero sin cortarse por arriba si no caben */
.panel {
  position: relative;
  width: min(46rem, 100%);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1.1rem 1.1rem;
  text-align: left;
  border-radius: var(--r-l);
  background: linear-gradient(180deg, #19244e 0%, #121a3c 34%, #0d1430 100%);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: panelIn 0.22s ease-out both;
}
.panel.wide { width: min(66rem, 100%); }
/* borde de las ventanas con el color elegido en Ajustes (Marco de las ventanas) */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .panel { border-color: color-mix(in srgb, var(--frame) 42%, rgba(170, 195, 255, 0.2)); }
}
@keyframes panelIn { from { transform: translateY(0.6rem) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }

/* cabecera de cada ventana: flecha de volver, título y una Pokéball de fondo (se queda fija al bajar) */
.pn-head {
  --sec: var(--red);
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 -1.1rem 0.9rem;
  padding: 0.75rem 1.1rem 0.7rem;
  overflow: hidden;
  background: linear-gradient(180deg, #1c2858, #151f47);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 0.4rem 1rem rgba(4, 8, 22, 0.35);
}
.pn-head::before { /* franja de color de la sección */
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 0.22rem;
  background: linear-gradient(90deg, var(--sec), color-mix(in srgb, var(--sec) 35%, transparent));
}
.pn-head::after { /* Pokéball de adorno a la derecha */
  content: '';
  position: absolute;
  right: -1.6rem;
  top: 50%;
  width: 5.4rem;
  height: 5.4rem;
  transform: translateY(-50%) rotate(-18deg);
  border-radius: 50%;
  background: radial-gradient(circle, transparent 0 14%, rgba(255, 255, 255, 0.07) 14.5% 22%, transparent 22.5%),
    linear-gradient(180deg, transparent 46%, rgba(255, 255, 255, 0.07) 46% 54%, transparent 54%);
  box-shadow: inset 0 0 0 0.3rem rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.pn-head h2 {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1.75rem;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0.12rem 0 rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pn-head h2 small { font-family: var(--f-body); font-size: 0.85rem; font-weight: 700; color: var(--tx-2); text-shadow: none; }
.pn-head > *:not(h2) { position: relative; z-index: 1; }
/* color de cada sección */
#collection .pn-head, #detail .pn-head, #starters .pn-head { --sec: var(--grn); }
#missions .pn-head { --sec: var(--yel); }
#achievements .pn-head { --sec: var(--org); }
#friends .pn-head, #dm .pn-head { --sec: var(--pnk); }
#clan .pn-head, #profile .pn-head, #party .pn-head { --sec: var(--blu); }
#ranking .pn-head { --sec: var(--teal); }
#settings .pn-head { --sec: #8a96b8; }
#passscreen .pn-head { --sec: var(--pur); }
#safari .pn-head { --sec: var(--grn); }
#gachas .pn-head, #legend .pn-head { --sec: var(--yel); }
#halloween .pn-head { --sec: var(--org); }

/* botón de volver: como el botón blanco del centro de una Pokéball, con la flecha roja */
.back {
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #ffffff, #dde3f2);
  box-shadow: 0 0 0 0.2rem #1b2142, 0 0 0 0.32rem rgba(255, 255, 255, 0.16), 0 0.3rem 0.6rem rgba(0, 0, 0, 0.4);
  transition: transform 0.12s;
}
.back::after {
  content: '';
  width: 1.45rem;
  height: 1.45rem;
  background: var(--ico-arrow-l) center / contain no-repeat;
  image-rendering: pixelated;
}
.back:hover { transform: translateX(-0.12rem); }
.back:active { transform: scale(0.92); }

.sub { margin: 0 0 0.8rem; color: var(--tx-2); font-size: 0.95rem; text-align: left; }
.sep { margin: 0; text-align: center; color: var(--tx-3); }
.empty { margin: 0.3rem 0; font-size: 0.9rem; color: var(--tx-3); }
.row { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 0.9rem; }
.row.left { justify-content: flex-start; margin: 0 0 0.7rem; }

/* ------------------------------------------------------------------ botones */
/* botón principal: rojo con una Pokéball */
.big {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.1rem;
  padding: 0.35rem 1.6rem 0.4rem 3.4rem;
  font-family: var(--f-disp);
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: 0.03em;
  color: #fff;
  border: 0;
  border-radius: var(--r-m);
  background: linear-gradient(180deg, #ff6355 0%, #ec3a30 48%, #c8241e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -0.28rem 0 rgba(0, 0, 0, 0.2),
    0 0.3rem 0 #7f1511, 0 0.55rem 1.1rem rgba(0, 0, 0, 0.38);
  text-shadow: 0 0.13rem 0 rgba(110, 12, 8, 0.65);
  transition: transform 0.1s, filter 0.15s, box-shadow 0.1s;
}
.big::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1.85rem;
  height: 1.85rem;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--pkb);
  box-shadow: 0 0 0 0.14rem #1b1f33, 0 0.12rem 0.3rem rgba(0, 0, 0, 0.35);
}
.big:hover { filter: brightness(1.07); }
.big:active { transform: translateY(0.22rem); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -0.15rem 0 rgba(0, 0, 0, 0.2), 0 0.08rem 0 #7f1511; }
.big:disabled { filter: grayscale(0.75) brightness(0.75); cursor: default; }
.big .pxi { width: 1.6rem; height: 1.6rem; }

/* botones de acción */
.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.35rem;
  padding: 0.3rem 1rem 0.35rem;
  font-family: var(--f-disp);
  font-size: 1.2rem;
  line-height: 1;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  border-radius: var(--r-s);
  background: linear-gradient(180deg, #2c3c7a, #22306a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -0.2rem 0 rgba(0, 0, 0, 0.22), 0 0.15rem 0.45rem rgba(0, 0, 0, 0.3);
  text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.1s, filter 0.15s;
}
.act:hover:not(:disabled) { filter: brightness(1.1); }
.act:active:not(:disabled) { transform: translateY(0.12rem) scale(0.98); }
.act.blue { background: linear-gradient(180deg, #5a92ff, #2f63e2); }
.act.gold { background: linear-gradient(180deg, #ffdc4a, #f4ac00); color: var(--yel-ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.act.red { background: linear-gradient(180deg, #ff6457, #d42e26); }
.act.green { background: linear-gradient(180deg, #4fdc7f, #22a052); }
.act.gray, .act:disabled { background: #273159; color: #a9b4d6; text-shadow: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); cursor: default; }
.act .money img, .act img { width: 1.1rem; height: 1.1rem; image-rendering: pixelated; }

/* botón "Volver al lobby" y otros secundarios grandes */
#back, .lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.35rem 1.4rem 0.4rem;
  font-family: var(--f-disp);
  font-size: 1.45rem;
  line-height: 1;
  color: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  background: linear-gradient(180deg, #24336e, #1a2756);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0.3rem 0 #0b1230, 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
  transition: transform 0.1s, filter 0.15s;
}
#back:hover, .lb-btn:hover { filter: brightness(1.12); }
#back:active, .lb-btn:active { transform: translateY(0.2rem); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0.1rem 0 #0b1230; }

/* botón cuadrado con icono (ajustes, pausa, chat de la partida...) */
.icon-btn {
  position: relative;
  width: 2.7rem;
  height: 2.7rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  background: var(--glass-2);
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.1s, filter 0.15s;
}
.icon-btn:hover { filter: brightness(1.2); }
.icon-btn:active { transform: scale(0.93); }
.icon-btn .pxi { width: 1.65rem; height: 1.65rem; }
.pxi { width: 1.5rem; height: 1.5rem; image-rendering: pixelated; flex: none; }

/* botoncito cuadrado de las listas (aceptar, rechazar, mensaje...) */
.mini {
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.5rem;
  display: inline-grid;
  place-items: center;
  font-family: var(--f-disp);
  font-size: 1.15rem;
  line-height: 1;
  color: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: #2a3768;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.mini:hover { filter: brightness(1.15); }
.mini:active { transform: scale(0.94); }
.mini.ok { background: linear-gradient(180deg, #4fdc7f, #22a052); border-color: transparent; }
.mini.no, .prow .mini.no { background: linear-gradient(180deg, #ff6457, #d42e26); border-color: transparent; }
.mini.dm-btn.new { box-shadow: 0 0 0 2px #ff5f5f; animation: dmPulse 1.2s infinite; }
@keyframes dmPulse { 50% { box-shadow: 0 0 0 0.3rem rgba(255, 95, 95, 0.4); } }

.linkbtn { align-self: flex-start; padding: 0; font: inherit; font-size: 0.9rem; color: #9ccaff; text-decoration: underline; background: none; border: 0; cursor: pointer; }
.ver-link { padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 0.15em; background: none; border: 0; cursor: pointer; }
.fb-close {
  margin-left: auto;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  flex: none;
  padding: 0;
  font-size: 1.1rem;
  color: var(--tx-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.fb-close:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.with-arrow { display: inline-flex !important; align-items: center; gap: 0.4rem; }
.with-arrow::before { content: ''; width: 1rem; height: 1rem; background: var(--ico-arrow-lw) center / contain no-repeat; image-rendering: pixelated; }

/* ------------------------------------------------------------------ pestañas y selectores */
/* pestañas: control segmentado; la elegida, en amarillo Pokémon */
.tabs, .dt-tabs, .gc-tabs, .fb-kind {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 0.8rem;
  background: var(--ink-0);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tabs button, .dt-tabs button, .gc-tabs button, .fb-kind button {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0.38rem 0.6rem 0.42rem;
  font-family: var(--f-disp);
  font-size: 1.2rem;
  line-height: 1.05;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.tabs button:hover, .dt-tabs button:hover, .gc-tabs button:hover, .fb-kind button:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.tabs button.sel, .dt-tabs button.on, .gc-tabs button.on, .fb-kind button.on {
  color: var(--yel-ink);
  background: linear-gradient(180deg, #ffdc4a, #f4ac00);
  box-shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.gc-tabs .badge, .tabs .badge { top: -0.3rem; right: 0.2rem; }
.gc-tabs, .tabs { overflow: visible; }

/* grupo de opciones (ajustes, filtros, skins...) */
.px-seg { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.px-seg button {
  padding: 0.32rem 0.75rem 0.36rem;
  font-family: var(--f-disp);
  font-size: 1.1rem;
  line-height: 1.05;
  color: var(--tx-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--ink-1);
  transition: background 0.15s, color 0.15s;
}
.px-seg button:hover { color: #fff; border-color: var(--line-3); }
.px-seg button.sel { color: var(--yel-ink); border-color: transparent; background: linear-gradient(180deg, #ffdc4a, #f4ac00); }
.px-seg button:active { transform: scale(0.96); }

/* interruptor */
.px-toggle {
  position: relative;
  flex: none;
  width: 3.2rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #2a3459;
  box-shadow: inset 0 0.1rem 0.3rem rgba(0, 0, 0, 0.4);
  transition: background 0.18s;
}
.px-toggle i {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #dfe5f6;
  box-shadow: 0 0.12rem 0.3rem rgba(0, 0, 0, 0.4);
  transition: left 0.18s;
}
.px-toggle.on { background: var(--grn); }
.px-toggle.on i { left: 1.6rem; background: #fff; }

/* deslizador */
.px-range {
  -webkit-appearance: none;
  appearance: none;
  width: min(13rem, 40vw);
  height: 0.5rem;
  margin: 0.4rem;
  border-radius: 999px;
  background: #2a3459;
  outline: none;
}
.px-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff3a8, var(--yel) 60%, var(--yel-2));
  box-shadow: 0 0 0 0.2rem #141b38, 0 0.15rem 0.4rem rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.px-range::-moz-range-thumb { width: 1.4rem; height: 1.4rem; border: 0; border-radius: 50%; background: var(--yel); box-shadow: 0 0 0 0.2rem #141b38; }
.px-select, .col-filters select, .sanc-panel select, select {
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--tx);
  padding: 0.4rem 0.6rem;
  min-height: 2.3rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: var(--ink-0);
}

/* campos de texto */
input:not([type='range']):not([type='checkbox']):not([type='radio']), textarea {
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 1rem;
  color: var(--tx);
  padding: 0.5rem 0.75rem;
  min-height: 2.4rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: var(--ink-0);
  -webkit-user-select: text;
  user-select: text;
}
input::placeholder, textarea::placeholder { color: var(--tx-3); }
input:not([type='range']):focus, textarea:focus, select:focus { outline: none; border-color: var(--yel); box-shadow: 0 0 0 0.2rem rgba(255, 203, 5, 0.18); }

/* ------------------------------------------------------------------ piezas pequeñas */
.badge, .cw-badge {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  z-index: 2;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  font-family: var(--f-disp);
  font-size: 1rem;
  line-height: 1.4rem;
  text-align: center;
  color: #fff;
  border-radius: 999px;
  background: #ff3b4e;
  box-shadow: 0 0 0 0.14rem #0a1024, 0 0.15rem 0.4rem rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.bar {
  display: block;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffd23a, #ffae00); }
.ms-body .bar i, .sf-reg .bar i { background: linear-gradient(90deg, #5ae487, #25b45c); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.2rem;
  padding: 0.15rem 0.75rem 0.15rem 0.35rem;
  font-family: var(--f-disp);
  font-size: 1.25rem;
  line-height: 1;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--sh-1);
}
.pill b { font-weight: 400; }
.pill img, .money img { width: 1.35rem; height: 1.35rem; image-rendering: pixelated; }
.money { display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: middle; }
.money img { width: 1.1rem; height: 1.1rem; }
.pill.pay { gap: 0.3rem; padding: 0.1rem 0.6rem; }
.pill.pay img { width: 1.1rem; height: 1.1rem; }
.pill.pay b { font-size: 1.15rem; }
img.cup { width: 1rem; height: 1rem; image-rendering: pixelated; vertical-align: -0.12rem; }
.on { color: #6ff09a; }
.off { color: var(--tx-3); }
.need { margin: 0; width: 100%; font-size: 0.85rem; color: #ffb0a8; }
.pop { animation: pop 0.45s ease; }
@keyframes pop { 40% { transform: scale(1.1); filter: brightness(1.5); } }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-7deg); } 88% { transform: rotate(7deg); } 92% { transform: rotate(-3deg); } }
@keyframes blink { 50% { opacity: 0.4; } }
@keyframes itPulse { 50% { filter: brightness(1.25); } }
@keyframes heartbeat { 0%, 60%, 100% { transform: scale(1); } 70% { transform: scale(1.14); } 80% { transform: scale(1); } 90% { transform: scale(1.08); } }
@keyframes rowIn { from { transform: translateY(0.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes endPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.tico { display: inline-block; width: 1.4rem; height: 1.4rem; margin-right: 0.3rem; vertical-align: -0.35rem; flex: none; background: url(../assets/icons/tipos.png) no-repeat; background-size: calc(18 * 1.4rem) 1.4rem; background-position: calc(var(--i) * -1.4rem) 0; image-rendering: pixelated; }
.types { display: flex; gap: 0.25rem; flex-wrap: wrap; justify-content: center; }
.types i { font-style: normal; font-family: var(--f-disp); font-size: 1rem; color: #fff; padding: 0.05rem 0.5rem; border-radius: 999px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.types i .tico { width: 1rem; height: 1rem; background-size: calc(18 * 1rem) 1rem; background-position: calc(var(--i) * -1rem) 0; vertical-align: -0.15rem; margin-right: 0.2rem; }
img.flag { width: 1.2rem; height: 0.8rem; object-fit: cover; vertical-align: -0.05rem; margin-left: 0.3rem; border-radius: 0.15rem; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); image-rendering: auto; display: inline-block; }
img.flag.big { width: 1.8rem; height: 1.2rem; vertical-align: -0.2rem; margin: 0 0.15rem 0 0; }
.mast-ic { width: 1.3rem; height: 1.55rem; image-rendering: pixelated; vertical-align: middle; margin-left: 0.25rem; filter: drop-shadow(0 0 0.25rem rgba(255, 255, 255, 0.25)); }
.bot-tag { font-style: normal; font-family: var(--f-body); font-weight: 800; font-size: 0.65rem; margin-left: 0.35rem; padding: 0.05rem 0.35rem; vertical-align: 0.1rem; border-radius: 0.3rem; background: #3a4466; color: #c8d4ff; }
.bot-tag.friend { background: var(--grn-2); color: #fff; }

/* ------------------------------------------------------------------ listas (misiones, logros, amigos, ranking, ajustes) */
.plist { display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
.prow, .mission, .st-row, .login-box, .keys {
  border-radius: var(--r-m);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.prow { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 0.7rem; }
.prow.me { background: rgba(52, 207, 108, 0.12); border-color: rgba(52, 207, 108, 0.55); }
.prow.click { cursor: pointer; transition: background 0.15s, transform 0.1s; }
.prow.click:hover { background: rgba(255, 255, 255, 0.09); }
.prow.click:active { transform: scale(0.99); }
.prow .pos { width: 2rem; flex: none; text-align: center; font-family: var(--f-disp); font-size: 1.4rem; color: var(--yel); }
.prow .av { width: 2.6rem; height: 2.6rem; flex: none; border-radius: var(--r-s); image-rendering: pixelated; background: rgba(255, 255, 255, 0.07); }
.prow .av.avbig, .clan-head .av.avbig { width: 4rem; height: 4rem; flex: 0 0 4rem; }
.pinfo { flex: 1; display: flex; flex-direction: column; min-width: 0; gap: 0.05rem; }
.pinfo b { font-family: var(--f-disp); font-weight: 400; font-size: 1.25rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo small { font-size: 0.8rem; color: var(--tx-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcopas { display: flex; align-items: center; gap: 0.25rem; font-family: var(--f-disp); font-size: 1.3rem; color: var(--yel); white-space: nowrap; }
.pcopas img { width: 1.1rem; height: 1.1rem; image-rendering: pixelated; }
.clanrow { cursor: pointer; }
.clanrow:hover { background: rgba(255, 255, 255, 0.09); }
.tagok { font-size: 0.8rem; color: var(--tx-2); }
.search { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.search input { flex: 1; min-width: 9rem; }

/* ------------------------------------------------------------------ aviso SÍ / NO */
#modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, var(--sat)) calc(1rem + var(--sar)) max(1rem, var(--sab)) calc(1rem + var(--sal));
  background: rgba(4, 7, 18, 0.66);
}
.modal-wrap {
  width: min(28rem, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column-reverse; /* el texto arriba y los botones abajo */
  overflow: hidden;
  border-radius: var(--r-l);
  background: linear-gradient(180deg, #1b2754, #10183a);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-2);
  animation: endPop 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.modal-box { position: relative; min-height: 0; overflow-y: auto; padding: 1.4rem 1.3rem 1rem; text-align: center; }
.modal-box::before { /* Pokéball arriba */
  content: '';
  display: block;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  background: var(--pkb);
  box-shadow: 0 0 0 0.14rem #1b1f33;
}
.modal-box p { margin: 0; font-size: 1.08rem; line-height: 1.45; color: var(--tx); white-space: pre-line; -webkit-user-select: text; user-select: text; }
.modal-choices { display: flex; flex-direction: row-reverse; gap: 0.55rem; padding: 0 1.1rem 1.1rem; }
.modal-choices button {
  flex: 1;
  min-height: 2.7rem;
  font-family: var(--f-disp);
  font-size: 1.45rem;
  line-height: 1;
  color: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  background: #26346c;
  transition: filter 0.15s, transform 0.1s;
}
.modal-choices button:hover { filter: brightness(1.15); }
.modal-choices button:active { transform: scale(0.97); }
.modal-choices #modal-ok { border-color: transparent; background: linear-gradient(180deg, #ff6355, #d42e26); box-shadow: 0 0.2rem 0 #7f1511; }
.modal-choices button.hidden { display: none; }
/* (aviso con un solo botón: el de aceptar ocupa todo) */

/* aviso pequeño arriba */
#toast {
  position: fixed;
  left: 50%;
  top: max(0.8rem, var(--sat));
  z-index: 80;
  max-width: min(32rem, 90vw);
  padding: 0.55rem 1.1rem;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  color: #fff;
  border-radius: 999px;
  background: rgba(14, 20, 46, 0.96);
  border: 1px solid rgba(255, 203, 5, 0.55);
  box-shadow: var(--sh-2);
  pointer-events: none;
  animation: toastIn 0.22s ease-out both;
}
@keyframes toastIn { from { transform: translate(-50%, -0.6rem); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.money-tip {
  position: fixed;
  z-index: 9999;
  max-width: 17rem;
  padding: 0.55rem 0.75rem;
  font: 700 0.85rem/1.35 var(--f-body);
  color: #fff;
  border-radius: var(--r-s);
  background: #10183a;
  border: 1px solid rgba(255, 203, 5, 0.6);
  box-shadow: var(--sh-1);
  pointer-events: none;
}

/* ------------------------------------------------------------------ avisos a pantalla completa (novedades, perfil de otro, encuesta...) */
.patch {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.8rem, var(--sat)) calc(0.8rem + var(--sar)) max(0.8rem, var(--sab)) calc(0.8rem + var(--sal));
  background: rgba(4, 7, 18, 0.7);
}
.patch-panel {
  width: min(36rem, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 1.15rem 1.15rem;
  text-align: left;
  animation: endPop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.patch-head { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.65rem; margin-bottom: 0.75rem; flex: none; }
.patch-head h2 { flex: 1 1 auto; min-width: 0; font-size: 1.8rem; line-height: 1.05; color: var(--yel); }
.patch-head small { color: var(--tx-2); font-size: 0.85rem; }
.patch-ver { padding: 0.12rem 0.55rem; font-family: var(--f-disp); font-size: 1.1rem; color: var(--yel-ink); border-radius: 999px; background: var(--yel); }

/* ------------------------------------------------------------------ móvil: aviso de girar (en vertical no se puede jugar) */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 2rem;
  text-align: center;
  font-size: 16px;
  background: radial-gradient(circle at 50% 40%, #1d2a5c, #070b1a 75%);
}
#rotate .phone {
  position: relative;
  width: 64px;
  height: 108px;
  border: 5px solid var(--yel);
  border-radius: 16px;
  box-shadow: 0 0 24px rgba(255, 203, 5, 0.35);
  animation: turn 2s ease-in-out infinite;
}
#rotate .phone::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--pkb); }
#rotate p { margin: 0; font-family: var(--f-disp); font-size: 34px; line-height: 1.05; color: #fff; }
#rotate .rot-help { max-width: 22rem; font-size: 15px; color: var(--tx-2); }
#rotate .rot-btns { display: flex; flex-direction: column; gap: 10px; }
#rotate .act { font-size: 22px; min-height: 46px; padding: 6px 22px; }
@keyframes turn { 0%, 25% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse), (orientation: portrait) and (hover: none) {
  #rotate { display: flex; }
}

/* selección con el mando en los menús */
.pad-focus { outline: 0.3rem solid #ffffff !important; outline-offset: 0.2rem; box-shadow: 0 0 0 0.5rem rgba(90, 168, 255, 0.55), 0 0 1.1rem 0.5rem rgba(255, 255, 255, 0.35) !important; position: relative; z-index: 2; animation: padPulse 1s ease-in-out infinite; }
@keyframes padPulse { 50% { outline-color: #8ec2ff; } }
body:not(.pad) .pad-focus { outline: none !important; box-shadow: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
/* insignia de donador (PB.donorHtml): 💛 junto al nombre; grande con el texto en los perfiles */
.donor { margin-left: 0.3rem; font-size: 0.85em; filter: drop-shadow(0 0 3px rgba(255, 200, 40, 0.9)); display: inline-block; vertical-align: 0.05rem; cursor: default; }
.donor.donor-big { font-size: 0.6em; font-weight: 900; letter-spacing: 0.05em; padding: 0.15rem 0.5rem; border-radius: 1rem; vertical-align: 0.25rem; color: #4a2c00; background: linear-gradient(135deg, #fff1a8, #ffcc33 45%, #e0a020); box-shadow: 0 0 10px rgba(255, 200, 40, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.7); filter: none; }
