/* ==========================================================================
   Social Empires — shell común (portada, juego, chat, cuenta, acceso)
   Dirección de arte: el propio juego. Pradera de fondo (#669C2C del cliente), cintas azules del HUD,
   madera del marco, amarillo y rojo del logotipo. Tipografía del juego: Eras Bold ITC (títulos) y
   Arial Rounded MT Bold (cifras); texto corrido con la sans del sistema.
   CSS plano, sin dependencias externas (nada de CDN en la portada ni en el juego).
   ========================================================================== */

@font-face {
  font-family: "Eras SE";
  src: url("/css/fonts/eras-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rounded SE";
  src: url("/css/fonts/arial-rounded-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --pradera: #5f9b2b;
  --pradera-clara: #8fc43e;
  --pradera-honda: #2f5d1b;
  --pradera-noche: #1c3a12;
  --tinta: #0b1d32;
  --tinta-2: #12304f;
  --tinta-3: #1b4670;
  --cinta: #1f6fb2;
  --cielo: #cfeaf8;
  --cielo-claro: #eaf7fd;
  --oro: #ffc21a;
  --oro-claro: #ffe27a;
  --oro-hondo: #d98e00;
  --oro-borde: #7d4f00;
  --rojo: #b3201b;
  --rojo-hondo: #7a110d;
  --madera: #5b3a1a;
  --madera-clara: #93673a;
  --madera-vetas: #6e4721;
  --pergamino: #f3e4b0;
  --pergamino-2: #e4cf8f;
  --pergamino-borde: #a07a38;
  --texto: #10263f;
  --texto-suave: #4a5d72;
  --claro: #eef5fb;
  --apagado: #9db3c9;
  --linea: rgba(157, 179, 201, 0.22);
  --ok: #58b43a;
  --aviso: #f0a91a;
  --error: #e0564a;

  --f-display: "Eras SE", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --f-num: "Rounded SE", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Avenir Next", "Segoe UI", "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  --header-h: 56px;                 /* [Ux1] alto de la cabecera de UNA fila (+3 px de borde) */
  --radio: 12px;
  --sombra: 0 10px 30px rgba(4, 14, 26, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.se-body {
  margin: 0;
  min-height: 100vh;
  background: var(--tinta);
  color: var(--claro);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.se-body img { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden], .hidden { display: none !important; }
.se-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.se-skip {
  position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--oro); color: var(--tinta);
  padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none;
}
.se-skip:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }
.on-light :focus-visible, .lp :focus-visible { outline-color: var(--tinta-3); }

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

/* ---------- Texto con el tratamiento del logotipo (relleno amarillo, contorno rojo) ---------- */
.se-title {
  font-family: var(--f-display);
  font-weight: 700;
  color: var(--oro);
  -webkit-text-stroke: 0.14em var(--rojo-hondo);
  paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--rojo-hondo), 0 0.14em 0.1em rgba(60, 10, 5, 0.28);
  letter-spacing: 0.01em;
  line-height: 1.02;
  margin: 0;
}

/* ---------- Cabecera común ----------
   [Ux1] UNA sola fila de 56 px (+3 px de borde) en escritorio, con cualquier nombre, cifras de ocho dígitos e insignias con contador.
   Cómo se consigue: la cabecera y el HUD son contenedores (container queries). La cabecera decide la ESTRUCTURA por su ancho
   (una fila / dos filas / tres filas en móvil) y el HUD decide cuánto detalle enseña por el hueco que de verdad le queda
   (cifras completas -> abreviadas -> sin texto de XP -> compacto). Los umbrales están en rem: al subir el tamaño del texto en el
   panel de accesibilidad (115 / 130 %) se adelantan solos. Detalle y presupuesto de anchos en «Cabecera: niveles» más abajo. */
.se-header {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(180deg, var(--tinta-2) 0%, var(--tinta) 100%);
  border-bottom: 3px solid var(--madera-clara);
  box-shadow: 0 3px 0 var(--madera), 0 8px 18px rgba(2, 10, 20, 0.35);
  container: hdr / inline-size;
}
.se-header__in {
  max-width: 1920px; margin: 0 auto; padding: 0 14px; min-height: var(--header-h);
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
}
.se-brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; padding: 4px 0; }
.se-brand img { display: block; height: 40px; width: auto; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.se-nav { display: flex; align-items: center; flex: none; gap: 2px; margin-right: auto; }
.se-nav a, .se-nav button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; min-width: 40px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--apagado);
  font-weight: 700; font-size: 0.95rem; text-decoration: none; letter-spacing: 0.01em;
}
.se-nav a:hover, .se-nav button:hover { color: var(--claro); background: rgba(255, 255, 255, 0.07); }
.se-nav [aria-current="page"], .se-nav [aria-pressed="true"] { color: var(--tinta); background: var(--oro); }
.se-nav [aria-current="page"]:hover, .se-nav [aria-pressed="true"]:hover { background: var(--oro-claro); color: var(--tinta); }
.se-nav svg { width: 18px; height: 18px; flex: none; }
/* Por defecto la navegación es solo de iconos (el texto sigue ahí para lectores de pantalla y como tooltip: title); con sitio se enseña el texto */
.se-nav__txt {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.se-badge-n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rojo); color: #fff;
  font: 700 0.72rem/20px var(--f-num); text-align: center; box-shadow: 0 0 0 2px var(--tinta);
}
.se-nav .se-badge-n { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 0.66rem; line-height: 18px; white-space: nowrap; }
.se-header__right { display: flex; align-items: center; flex: none; gap: 10px; }
.se-guest { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.se-guest__links { display: flex; gap: 2px; }
.se-guest__links a {
  padding: 8px 12px; border-radius: 8px; color: var(--apagado); text-decoration: none; font-weight: 700; font-size: 0.93rem; white-space: nowrap;
}
.se-guest__links a:hover { color: var(--claro); background: rgba(255, 255, 255, 0.07); }
.se-guest .se-btn, .se-header__right .se-btn { white-space: nowrap; flex: none; }
/* Los hijos de #user-header-panel pasan a ser hijos de la cabecera: así el HUD puede ocupar la fila de abajo cuando no cabe en una */
.se-user { display: contents; }

/* HUD: lo que pasa en el juego, leído del propio juego. Es el ÚNICO elemento flexible de la fila: se queda con el hueco que sobra
   y, como contenedor, sus hijos se adaptan a ese hueco (ver «Cabecera: niveles») */
.se-hud {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  container: hud / inline-size;
}
.se-level { flex: none; display: flex; align-items: center; gap: 8px; }
.se-level__star {
  position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center;
}
.se-level__star svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4)); }
.se-level__n { position: relative; font: 700 0.95rem/1 var(--f-num); color: var(--tinta); }
.se-level__meta { display: flex; flex-direction: column; gap: 3px; min-width: 96px; }
.se-level__bar { height: 9px; border-radius: 6px; background: #06121f; border: 1px solid rgba(255, 255, 255, 0.18); overflow: hidden; }
.se-level__bar i { display: block; height: 100%; width: 0; background: linear-gradient(180deg, var(--oro-claro), var(--oro) 50%, var(--oro-hondo)); border-radius: 6px; transition: width 0.4s ease; }
.se-level__xp { font: 700 0.7rem/1 var(--f-num); color: var(--apagado); letter-spacing: 0.02em; white-space: nowrap; }
.se-res { flex: none; display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.se-res li {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 5px;
  border-radius: 16px; background: #06121f; border: 1px solid rgba(255, 255, 255, 0.14);
  font: 700 0.88rem/1 var(--f-num); color: var(--claro); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.se-res li svg { width: 22px; height: 22px; flex: none; }
.se-res li b { font-weight: 700; min-width: 2ch; text-align: right; }
/* cada cifra tiene dos formas: completa (el <b>, 3.962.733) y abreviada (data-abbr, 3,96 M, pintada por ::after); el HUD enseña una u otra según el hueco (app.js, HUD.tick) */
.se-res li b::after { content: attr(data-abbr); display: none; }
.se-res li[data-pulse="up"] { animation: se-pulse-up 0.7s ease; }
.se-res li[data-pulse="down"] { animation: se-pulse-down 0.7s ease; }
@keyframes se-pulse-up { 0% { box-shadow: 0 0 0 0 rgba(88, 180, 58, 0.9); } 100% { box-shadow: 0 0 0 9px rgba(88, 180, 58, 0); } }
@keyframes se-pulse-down { 0% { box-shadow: 0 0 0 0 rgba(224, 86, 74, 0.8); } 100% { box-shadow: 0 0 0 9px rgba(224, 86, 74, 0); } }

/* Botón de sonido (lo inyecta src/audio/AudioToggle.ts; el texto 🔇/🔊 se conserva pero se pinta un icono propio) */
#se-audio-slot { display: inline-flex; flex: none; }
.se-icon-btn, #se-audio-toggle.se-audio--slot {
  width: 38px; height: 38px; flex: none; display: inline-grid; place-items: center; padding: 0;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); color: var(--claro);
}
.se-icon-btn:hover, #se-audio-toggle.se-audio--slot:hover { background: rgba(255, 255, 255, 0.14); }
.se-icon-btn svg { width: 20px; height: 20px; }
#se-audio-toggle.se-audio--slot {
  position: static !important; font-size: 0 !important; display: inline-grid !important;
  background-repeat: no-repeat; background-position: center; background-size: 22px 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eef5fb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z' fill='%23eef5fb'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E");
}
#se-audio-toggle.se-audio--slot[aria-pressed="false"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239db3c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z' fill='%239db3c9'/%3E%3Cpath d='m16 9 6 6M22 9l-6 6'/%3E%3C/svg%3E");
}

/* Menú de cuenta */
.se-account { position: relative; flex: none; }
.se-account__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 4px; border-radius: 19px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); font-weight: 700; font-size: 0.92rem;
}
.se-account__btn:hover, .se-account__btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.14); }
/* [Ux1] la foto es SIEMPRE un círculo cuadrado (flex: none + aspect-ratio): en una fila apretada el círculo no se aplasta a óvalo */
.se-avatar {
  flex: none; width: 30px; height: 30px; aspect-ratio: 1 / 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--cinta); color: #fff; font: 700 0.95rem/1 var(--f-display); border: 2px solid var(--oro);
}
.se-account__name { display: none; max-width: 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70; min-width: 250px; padding: 8px;
  background: var(--tinta); border: 2px solid var(--madera-clara); border-radius: 14px; box-shadow: var(--sombra);
}
.se-menu__who { padding: 8px 12px 10px; border-bottom: 1px solid var(--linea); margin-bottom: 6px; }
.se-menu__who b { display: block; font-size: 0.98rem; }
.se-menu__who span { display: block; font-size: 0.8rem; color: var(--apagado); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-menu a, .se-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--claro); font-size: 0.93rem; text-align: left; text-decoration: none;
}
.se-menu a:hover, .se-menu button:hover, .se-menu a:focus-visible, .se-menu button:focus-visible { background: rgba(255, 255, 255, 0.09); }
.se-menu hr { border: 0; border-top: 1px solid var(--linea); margin: 6px 0; }
.se-menu svg { width: 18px; height: 18px; flex: none; color: var(--apagado); }
.se-menu .se-menu__danger { color: #ffb4ac; }
.se-menu small { margin-left: auto; color: var(--apagado); font-size: 0.75rem; }

/* ---------- Botones ---------- */
.se-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
  border-radius: 12px; border: 2px solid transparent; font-weight: 800; font-size: 0.97rem; letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; transition: transform 0.08s ease, filter 0.15s ease, background-color 0.15s;
}
.se-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.se-btn:active:not(:disabled) { transform: translateY(2px); }
.se-btn-primary {
  background: linear-gradient(180deg, var(--oro-claro) 0%, var(--oro) 45%, #f0a800 100%); color: #3b2300;
  border-color: var(--oro-borde); box-shadow: 0 4px 0 var(--oro-borde), 0 8px 16px rgba(0, 0, 0, 0.22);
}
.se-btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.se-btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--oro-borde); }
.se-btn-secondary { background: rgba(255, 255, 255, 0.07); color: var(--claro); border-color: rgba(255, 255, 255, 0.28); }
.se-btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.se-btn-danger { background: #a3241d; color: #fff; border-color: #6d1510; box-shadow: 0 3px 0 #6d1510; }
.se-btn-danger:hover:not(:disabled) { background: #bd2d25; }
.se-btn-sm { min-height: 34px; padding: 0 14px; font-size: 0.85rem; border-radius: 9px; }
.se-btn-block { width: 100%; }
.se-btn .se-spinner, .se-spinner {
  display: inline-block; width: 1em; height: 1em; margin-right: 0.5em; vertical-align: -0.125em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 9999px; animation: se-spin 0.7s linear infinite;
}
@keyframes se-spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.se-field { margin-bottom: 16px; }
.se-label { display: block; margin: 0 0 6px; font-weight: 700; font-size: 0.88rem; color: var(--claro); }
.se-input, .se-input:-webkit-autofill {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.2);
  background: #06121f; color: var(--claro); font: inherit; font-size: 1rem;
}
.se-input::placeholder { color: #5f7690; }
.se-input:focus { border-color: var(--oro); outline: none; box-shadow: 0 0 0 3px rgba(255, 194, 26, 0.25); }
.se-input[aria-invalid="true"], .border-red-500 { border-color: var(--error) !important; }
.se-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--apagado); }
.se-error {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: rgba(224, 86, 74, 0.14); border: 1px solid rgba(224, 86, 74, 0.55);
  color: #ffd0cb; font-size: 0.9rem;
}
.se-pw { position: relative; }
.se-pw .se-input { padding-right: 84px; }
.se-pw button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); height: 32px; padding: 0 10px; border-radius: 8px; border: 0;
  background: rgba(255, 255, 255, 0.08); color: var(--apagado); font-size: 0.78rem; font-weight: 700;
}
.se-pw button:hover { color: var(--claro); background: rgba(255, 255, 255, 0.16); }
.se-meter { display: flex; gap: 4px; margin-top: 8px; }
.se-meter span { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); transition: background-color 0.2s; }
.se-meter[data-score="1"] span:nth-child(-n+1) { background: #e0564a; }
.se-meter[data-score="2"] span:nth-child(-n+2) { background: #f0a91a; }
.se-meter[data-score="3"] span:nth-child(-n+3) { background: #a5cf3a; }
.se-meter[data-score="4"] span:nth-child(-n+4) { background: #58b43a; }
/* textos de error por campo que crea auth-ui.js */
.text-xs.text-red-400 { display: block; margin: 6px 0 0; font-size: 0.8rem; color: #ff9d94; }

/* ---------- Tarjetas y etiquetas (cuenta, perfil) ---------- */
.se-card { background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)); border: 1px solid var(--linea); border-radius: 16px; }
.se-badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 9999px; font-size: 0.68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid transparent;
}
.se-badge-ok { background: rgba(88, 180, 58, 0.16); color: #9fe08a; border-color: rgba(88, 180, 58, 0.45); }
.se-badge-warn { background: rgba(240, 169, 26, 0.16); color: #ffd478; border-color: rgba(240, 169, 26, 0.45); }
.se-badge-bad { background: rgba(224, 86, 74, 0.16); color: #ffaaa2; border-color: rgba(224, 86, 74, 0.45); }
.se-badge-info { background: rgba(31, 111, 178, 0.25); color: #9fd0f4; border-color: rgba(31, 111, 178, 0.6); }
.se-badge-mute { background: rgba(255, 255, 255, 0.08); color: var(--apagado); border-color: var(--linea); }
.se-table { width: 100%; font-size: 0.85rem; text-align: left; border-collapse: collapse; }
.se-table th { padding: 12px 14px; color: var(--apagado); font-weight: 700; background: rgba(0, 0, 0, 0.22); border-bottom: 1px solid var(--linea); white-space: nowrap; }
.se-table td { padding: 11px 14px; border-bottom: 1px solid var(--linea); vertical-align: top; }
.se-table tbody tr:hover { background: rgba(255, 194, 26, 0.05); }

/* ---------- Avisos (toasts) ---------- */
#notification-container {
  position: fixed; top: calc(var(--hdr-h, var(--header-h)) + 14px); right: 14px; z-index: 300; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 28px)); pointer-events: none;
}
#notification-container > * {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--tinta); color: var(--claro); border: 2px solid var(--madera-clara); box-shadow: var(--sombra);
  animation: se-toast-in 0.22s ease-out; font-size: 0.92rem;
}
#notification-container > * > i { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; font-size: 0; background: var(--cinta); }
#notification-container > .border-emerald-700 > i, #notification-container > [data-type="success"] > i { background: var(--ok); }
#notification-container > .border-red-700 > i, #notification-container > [data-type="error"] > i { background: var(--error); }
#notification-container > .border-amber-700 > i, #notification-container > [data-type="warning"] > i { background: var(--aviso); }
#notification-container p { margin: 0; }
#notification-container button { margin-left: auto; flex: none; border: 0; background: transparent; color: var(--apagado); width: 24px; height: 24px; border-radius: 6px; line-height: 1; }
#notification-container button:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
#notification-container button i { font-size: 0; display: block; width: 12px; height: 12px; margin: auto; background: linear-gradient(45deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); }
#notification-container .se-toast__body { flex: 1; min-width: 0; }
#notification-container .se-toast__body b { display: block; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--oro); margin-bottom: 2px; }
#notification-container .se-toast__body span { display: block; color: var(--claro); overflow-wrap: anywhere; }
#notification-container .se-toast__action { margin: 8px 0 0; width: auto; height: 32px; padding: 0 12px; background: var(--oro); color: var(--tinta); font-weight: 800; border-radius: 8px; }
@keyframes se-toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- Cargador global (peticiones largas) ---------- */
#global-loader {
  position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; background: rgba(5, 14, 26, 0.72);
}
#global-loader > div {
  display: flex; align-items: center; gap: 14px; padding: 18px 26px; border-radius: 14px; background: var(--tinta);
  border: 2px solid var(--madera-clara); font-weight: 700;
}
#global-loader svg { width: 28px; height: 28px; animation: se-spin 0.9s linear infinite; color: var(--oro); }
#global-loader .opacity-25 { opacity: 0.25; } #global-loader .opacity-75 { opacity: 0.85; }

/* ---------- Páginas con contenido (cuenta): contenedor común ---------- */
.se-page { min-height: calc(100vh - var(--header-h)); }

/* ---------- Cabecera: niveles (todo con container queries; rem = escala con el tamaño de texto del jugador) ----------
   Estructura (container `hdr` = ancho de la cabecera):
     >= 60 rem   una fila: marca | navegación | HUD (flexible) | sonido | idioma | cuenta
     < 60 rem    dos filas finas: marca, navegación, sonido, idioma y cuenta; debajo el HUD a todo el ancho (solo en la portada del juego)
     < 31 rem    móvil: marca + sonido + idioma + cuenta / navegación a todo el ancho / HUD
   Detalle (container `hud` = hueco que le queda al HUD): ver los @container hud más abajo.
   Texto de la navegación: solo iconos salvo con mucho sitio (>= 110 rem en el juego; >= 64 rem en las páginas de servidor).
   Nombre de usuario en la cuenta: >= 85 rem (recortado con puntos suspensivos; la foto siempre se ve). */
@container hdr (min-width: 64rem) {
  .se-header:not(.se-header--game) .se-nav a, .se-header:not(.se-header--game) .se-nav button { padding: 0 14px; }
  .se-header:not(.se-header--game) .se-nav__txt { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .se-header:not(.se-header--game) .se-nav .se-badge-n { position: static; margin-left: 2px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 0.72rem; line-height: 20px; }
}
@container hdr (min-width: 85rem) {
  .se-account__name { display: block; }
}
@container hdr (min-width: 100rem) {
  .se-account__name { max-width: 170px; }
}
@container hdr (min-width: 110rem) {
  .se-header--game .se-nav a, .se-header--game .se-nav button { padding: 0 14px; }
  .se-header--game .se-nav__txt { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .se-header--game .se-nav .se-badge-n { position: static; margin-left: 2px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 0.72rem; line-height: 20px; }
}
@container hdr (max-width: 80rem) {
  .se-brand img { height: 36px; }
}
@container hdr (max-width: 45rem) {
  .se-guest__links { display: none; }
}

/* Dos filas finas (tableta, portátil con la ventana estrecha): marca, navegación y cuenta arriba; el HUD, a todo el ancho, debajo */
@container hdr (max-width: 60rem) {
  .se-header__in { flex-wrap: wrap; row-gap: 0; padding-top: 3px; padding-bottom: 3px; }
  .se-brand { padding: 2px 0; }
  .se-brand img { height: 34px; }
  .se-nav { order: 1; }
  #se-audio-slot { order: 2; }
  .se-user > [data-lang-switch] { order: 3; }
  .se-user > .se-account, .se-header__in > .se-header__right { order: 4; }
  .se-hud {
    order: 5; flex: 1 0 100%; justify-content: space-between; margin-top: 1px; padding: 3px 0 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}
/* Móvil: marca + sonido + idioma + cuenta / navegación a todo el ancho (cinco objetivos táctiles iguales) / HUD */
@container hdr (max-width: 31rem) {
  .se-header__in { gap: 6px; padding-left: 8px; padding-right: 8px; padding-top: 2px; padding-bottom: 2px; }
  .se-brand img { height: 30px; }
  #se-audio-slot, .se-header__in > .se-header__right { margin-left: auto; }
  #se-audio-toggle.se-audio--slot, .se-icon-btn { width: 34px; height: 34px; }
  .se-account__btn { height: 34px; padding: 0 8px 0 3px; gap: 6px; }
  .se-avatar { width: 28px; height: 28px; }
  .se-lang__btn { height: 32px; }
  .se-nav { order: 6; flex: 1 0 100%; justify-content: space-between; margin-right: 0; gap: 2px; }
  .se-nav a, .se-nav button { flex: 1 1 0; }
  .se-hud { order: 7; padding-top: 2px; padding-bottom: 2px; }
}
/* Visitante en una página de servidor (guía, acceso): «Portada» se esconde en pantallas estrechas (la marca lleva a la portada) y la guía queda en icono */
@container hdr (max-width: 38rem) {
  .se-hdr-landing { display: none; }
}
@container hdr (max-width: 24rem) {
  .se-guest { gap: 6px; }
  .se-guest .se-btn, .se-header__right .se-btn { padding: 0 10px; }
}
@container hdr (max-width: 28rem) {
  .se-hdr-howto span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .se-hdr-howto { padding: 0 10px; min-width: 38px; }
}

/* ---------- HUD: nivel de detalle según el hueco que le queda (container `hud`) ----------
   Anchos MEDIDOS en el peor caso (cinco cifras de 8 dígitos, XP de 7 dígitos; scripts/qa/ux1-sweep.js):
   A (por defecto)  835 px  cifras completas, estrella + barra + texto de XP
   B  <= 53,5 rem   692 px  sin el texto de XP (queda la barra) y pastillas algo más pequeñas
   C  <= 43,5 rem   540 px  cifras abreviadas (3.962.733 -> 3,96 M); el texto completo va en el tooltip
   D  <= 34 rem     474 px  estrella más pequeña, barra corta, pastillas aún más ajustadas
   E  <= 29,75 rem          móvil: solo el número de nivel (la barra de XP pasa a ser una línea fina en el borde de abajo) y pastillas mínimas
   F  <= 21 rem             pantalla muy estrecha (320 px): también sin estrella */
@container hud (max-width: 53.5rem) {
  .se-hud { gap: 10px; }
  .se-level__xp { display: none; }
  .se-level__meta { min-width: 0; width: 56px; }
  .se-res { gap: 4px; }
  .se-res li { gap: 5px; padding: 0 9px 0 4px; font-size: 0.84rem; }
  .se-res li svg { width: 20px; height: 20px; }
}
@container hud (max-width: 43.5rem) {
  .se-num-full { display: none; }
  .se-res li b::after { display: inline; }
}
@container hud (max-width: 34rem) {
  .se-hud { gap: 8px; }
  .se-level { gap: 6px; }
  .se-level__star { width: 32px; height: 32px; }
  .se-level__meta { width: 40px; }
  .se-res { gap: 3px; }
  .se-res li { gap: 4px; padding: 0 7px 0 3px; font-size: 0.8rem; height: 30px; }
  .se-res li svg { width: 18px; height: 18px; }
}
@container hud (max-width: 29.75rem) {
  .se-hud { position: relative; gap: 4px; padding-bottom: 5px; }
  .se-level { gap: 0; }
  .se-level__meta { position: static; width: 0; min-width: 0; }
  .se-level__star { width: 26px; height: 26px; }
  .se-level__n { font-size: 12px; }
  .se-level__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border: 0; border-radius: 2px; }
  .se-level__bar i { border-radius: 2px; }
  .se-res { gap: 1px; }
  .se-res li { gap: 2px; padding: 0 4px 0 2px; font-size: 11px; height: 26px; }   /* en px: aquí ya no cabe más texto aunque el jugador suba el tamaño */
  .se-res li svg { width: 14px; height: 14px; }
}
@container hud (max-width: 21rem) {
  .se-level { display: none; }
}
