/* Marcellus (SIL Open Font License 1.1) alojada en el propio sitio: la CSP no admite CDN de fuentes */
@font-face {
  font-family: 'Marcellus';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/marcellus-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
/* Crom: fuente de los títulos de página (estilo Conan Exiles). Solo dibuja letras y cifras: los acentos, la ñ, el apóstrofe y la puntuación salen en blanco,
   y el navegador no los sustituye solo. Por eso unicode-range la limita a lo que sí dibuja y el resto cae a Marcellus (--font-title). */
@font-face {
  font-family: 'Crom';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/crom.ttf') format('truetype');
  unicode-range: U+0030-0039, U+0041-005A, U+0061-007A;
}
/* Orejita's Exiles Reworked — Dark Exiles Theme (Conan Exiles aesthetic) */
:root {
  --font-display: 'Marcellus', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-title: 'Crom', var(--font-display);   /* títulos de página: Crom (mayúsculas) y, para lo que no trae, Marcellus */
  color-scheme: dark;
  /* Fondo y superficies */
  --bg: #0f0b09;
  --bg-accent: radial-gradient(circle at 20% 0%, rgba(153, 101, 21, 0.15), transparent 45%),
               radial-gradient(circle at 85% 15%, rgba(110, 50, 40, 0.10), transparent 40%);
  --surface: #1c1610;
  --surface-2: #241c15;
  --surface-3: #2e241b;

  /* Bordes (piedra / bronce oxidado) */
  --border: #4a3a2e;
  --border-strong: #6b4f3b;
  --border-accent: #c9974b;

  /* Texto */
  --text: #e8dccf;
  --text-strong: #f5eadf;
  --muted: #a8927f;
  --muted-dark: #a89580;   /* >=4.5:1 sobre todas las superficies (antes 3.7:1) */

  /* Acentos (bronce / oro quemado / sangre) */
  --accent: #d4a34d;
  --accent-hover: #e8b86b;
  --accent-dim: rgba(201, 151, 75, 0.15);
  --bronze: #b8860b;
  --gold: #d4af37;

  /* Estados */
  --ok: #7fb069;
  --ok-dim: rgba(127, 176, 105, 0.15);
  --warn: #d9a441;
  --warn-dim: rgba(217, 164, 65, 0.15);
  --danger: #9b3a3a;
  --danger-text: #e8928f;  /* texto de estados de peligro: 7:1 sobre --bg */
  --danger-dim: rgba(155, 58, 58, 0.15);
  /* Tonos de estadística (rangos, perfil): más vivos que los estados, solo para cifras e iconos */
  --tone-gold: #e0b44a;
  --tone-red: #d65a4f;
  --tone-green: #6fb05a;
  --info: #8fb0d4;         /* acero apagado: estado «respondido» / informativo (antes un índigo ajeno a la paleta) */
  --info-dim: rgba(143, 176, 212, 0.15);
  --steam: #1b2838;
  --steam-hover: #2a475e;

  /* Escala tipográfica del cuerpo y la interfaz (rem) */
  --fs-2xs: .72rem;   /* micro: contadores, pies de dato */
  --fs-xs: .8rem;     /* etiquetas, metadatos, cabeceras de tabla */
  --fs-sm: .88rem;    /* texto auxiliar, pestañas, campos */
  --fs-md: .95rem;    /* texto de interfaz por defecto (botones, avisos) */
  --fs-base: 1rem;    /* texto de lectura */
  --fs-lg: 1.1rem;    /* destacados dentro de tarjeta */
  /* Títulos (tipografía --font-display): un solo escalón por nivel en todo el sitio */
  --fs-h1: clamp(1.8rem, 1.2vw + 1.4rem, 2.4rem);   /* título de página */
  --fs-h2: clamp(1.45rem, 1vw + 1.15rem, 1.8rem);   /* sección */
  --fs-h3: 1.3rem;                                  /* tarjeta / panel */
  --fs-h4: 1.1rem;                                  /* subtítulo dentro de tarjeta */

  /* Geometría: controles 6 · superficies 8 · contenedores grandes 12 */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }
/* Los enlaces dentro de texto no pueden depender solo del color (WCAG 1.4.1) */
p a:not(.btn), li a:not(.btn), .alert a:not(.btn), .muted a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 1rem; top: 1rem; width: auto; height: auto; overflow: visible;
  padding: .6rem 1rem; z-index: 200;
  background: var(--accent); color: #0b0805; border-radius: var(--radius-sm); font-weight: 700;
}

.wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }
main { flex: 1; padding: 2rem 0 3.5rem; }
/* .wrap (declarada antes) ponía padding: 0 1.25rem y anulaba el de «main»: el contenido tocaba la cabecera y el pie */
main.wrap { padding-block: 2rem 3.5rem; }

/* Navbar */
.nav {
  background: rgba(12, 9, 7, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; gap: 1rem; flex-wrap: wrap; padding: 0.5rem 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  font-weight: 800; font-size: var(--fs-lg); letter-spacing: 1.2px; color: var(--text-strong);
}
.brand img {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  object-fit: cover;
}
.brand b { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.nav-item {
  color: var(--muted); font-size: var(--fs-sm); font-weight: 600;
  padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-item:hover, .nav-item.active { background: var(--surface-2); color: var(--accent); border-color: var(--border-accent); }

/* Hero */
.hero {
  position: relative;
  background: linear-gradient(135deg, rgba(12, 9, 7, 0.92), rgba(8, 6, 5, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2rem;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url('/site/banner');
  background-size: cover;
  background-position: center;
  opacity: 0.45;
  pointer-events: none;
  border-radius: var(--radius-lg);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-kicker {
  display: inline-block; font-size: var(--fs-xs); font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.7rem;
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin-bottom: 0.75rem; color: var(--text-strong); }
.hero p { color: var(--muted); max-width: 600px; font-size: var(--fs-lg); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.5rem; }

.status-panel {
  background: rgba(12, 9, 7, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  min-width: 250px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.status-count { font-size: 2rem; font-weight: 800; margin-top: 0.55rem; color: var(--text-strong); }
.status-count span { font-size: 1rem; font-weight: 600; color: var(--muted); }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.4rem; margin-bottom: 1.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-strong); }
.card-title {
  font-size: var(--fs-lg); font-weight: 800; margin-bottom: 1.15rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap;
  color: var(--text-strong);
  letter-spacing: 0.5px;
}
/* Páginas públicas: el título de tarjeta usa la misma voz (--font-display) que el panel, el acceso y los títulos de página */
body:not(.pg-admin):not(.pg-auth) .card-title { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-h3); letter-spacing: .01em; }
body:not(.pg-admin):not(.pg-auth) h1.card-title { font-size: var(--fs-h1); }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted-dark); }
.stat-val { font-size: 1.8rem; font-weight: 800; margin-top: 0.35rem; color: var(--text); }
.muted { color: var(--muted); font-size: var(--fs-md); }

/* Letra de Crom con su tilde o virgulilla encima (Crom no dibuja marcas; ver crom_html() en lib_site.php) */
.cx { position: relative; display: inline; }
.cx::after { content: attr(data-a); position: absolute; left: 50%; top: -.2em; translate: -50% 0; font: 400 1.2em/1 var(--font-display); -webkit-text-stroke: .05em currentColor; text-transform: none; letter-spacing: 0; }
.cx[data-a='~']::after { top: -.08em; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.8rem; border-radius: 999px; font-size: var(--fs-xs); font-weight: 800;
  letter-spacing: 0.4px;
}
.badge-ok { background: var(--ok-dim); color: var(--ok); border: 1px solid rgba(127, 176, 105, 0.35); }
.badge-warn { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(217, 164, 65, 0.35); }
.badge-no { background: var(--danger-dim); color: var(--danger-text); border: 1px solid rgba(155, 58, 58, 0.35); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* IP Box */
.ip-box {
  display: flex; align-items: center; gap: 0.65rem;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); margin-top: 0.95rem;
}
.ip-box code { flex: 1; font-size: var(--fs-lg); color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.25rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; font-size: var(--fs-md); cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #0b0805; }
.btn-primary:hover { background: var(--accent-hover); color: #0b0805; }
.btn-gold-outline { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); }
.btn-gold-outline:hover { background: var(--accent); color: #0b0805; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-dim); color: #f5c2c2; border-color: rgba(155, 58, 58, 0.35); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok-dim); color: #bfe3b2; border-color: rgba(127, 176, 105, 0.35); }
.btn-ok:hover { background: var(--ok); color: #1d2e17; }
.btn-steam { background: var(--steam); color: #c7d5e0; border-color: #66c0f4; }
.btn-steam:hover { background: var(--steam-hover); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* Forms */
.auth-card { max-width: 440px; margin: 2.4rem auto; }
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--muted-dark); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  padding: 0.65rem 0.9rem; border-radius: var(--radius-sm); font: inherit; width: 100%;
  transition: var(--transition);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212, 163, 77, 0.45); }
.form-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.form-row input, .form-row select { width: auto; flex: 1; min-width: 170px; }
.inline-form { display: inline-flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }

/* Aviso de cookies */
.cookie-notice { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 80; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: 960px; margin: 0 auto; padding: .8rem 1rem; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .55); font-size: var(--fs-sm); }
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0; flex: 1 1 320px; }
.cookie-notice a { color: var(--accent-hover); }

/* Barra del modo «ver como usuario» */
.imp-bar { position: sticky; top: 0; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; padding: .55rem 1rem; background: var(--warn); color: #1a1205; font-size: var(--fs-sm); }
.imp-bar strong { color: #000; }

/* Notificaciones (campana del menú) */
.notif { position: relative; }
.notif > summary { list-style: none; }
.notif > summary::-webkit-details-marker { display: none; }
.notif-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); cursor: pointer; background: var(--surface-2); }
.notif-btn:hover, .notif[open] .notif-btn { border-color: var(--border-accent); color: var(--accent-hover); }
.notif-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notif-count { position: absolute; top: -6px; right: -6px; min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: var(--fs-2xs); font-weight: 700; line-height: 1.1rem; text-align: center; }
.notif-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60; width: min(360px, calc(100vw - 1.5rem)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.notif-actions { display: inline-flex; gap: .25rem; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .75rem; color: var(--text); text-decoration: none; font-size: var(--fs-sm); }
.notif-list a:hover { background: var(--surface-2); }
.notif-list li.unread a { position: relative; background: var(--accent-dim); padding-left: 1.5rem; }
.notif-list li.unread a::before { content: ""; position: absolute; left: .65rem; top: 1rem; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.notif-list li.unread .notif-title { color: var(--text-strong); font-weight: 600; }
.notif-date { font-size: var(--fs-xs); }
.notif-empty { margin: 0; padding: 1rem .75rem; text-align: center; }
/* La cabecera sale en todas las páginas: sus estilos van aquí, no en las hojas de perfil o amigos */
.notif-all { display: block; padding: .6rem .75rem; text-align: center; border-top: 1px solid var(--border); color: var(--accent); text-decoration: none; }
.notif-all:hover { background: var(--surface-2); }
.nav-badge { display: inline-block; min-width: 1.15rem; margin-left: .3rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: #0b0805; font-size: var(--fs-2xs); font-weight: 800; line-height: 1.15rem; text-align: center; }

/* Alerts */
.alert {
  padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.35rem;
  font-size: var(--fs-md); border: 1px solid transparent;
}
.alert-ok { background: var(--ok-dim); border-color: rgba(127, 176, 105, 0.35); color: #bfe3b2; }
.alert-err { background: var(--danger-dim); border-color: rgba(155, 58, 58, 0.35); color: #f5c2c2; }
.alert-warn { background: var(--warn-dim); border-color: rgba(217, 164, 65, 0.35); color: #f0cf9b; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead th { color: var(--muted-dark); font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.5px; padding: 0.75rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border-strong); }
tbody td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
code { background: rgba(148, 122, 94, 0.12); padding: 0.15rem 0.45rem; border-radius: 5px; font-family: ui-monospace, monospace; font-size: var(--fs-sm); color: var(--accent); }

/* Steps list */
.steps { list-style: none; counter-reset: st; display: grid; gap: 0.9rem; }
.steps li {
  counter-increment: st; display: flex; gap: 0.85rem; align-items: flex-start;
  background: var(--surface-2); padding: 0.95rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.steps li::before {
  content: counter(st); flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--fs-sm);
}

/* Terminal RCON */
.terminal {
  background: #0a0705; color: #bfe3b2; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: var(--fs-sm); overflow-x: auto; white-space: pre-wrap; max-height: 380px;
}
.quick-cmds { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* Tabs in Admin */
.tabs { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.85rem; }
.tab-btn {
  padding: 0.5rem 1rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-weight: 700; font-size: var(--fs-sm); cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active, .tab-btn:hover { color: var(--accent); border-color: var(--border-accent); background: var(--accent-dim); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; background: rgba(8, 6, 5, 0.7); margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; font-size: var(--fs-sm); }

/* Focus visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===================== PERFIL ===================== */
.profile-card { max-width: 700px; margin: 0 auto 2rem auto; }
.profile-header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 2rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  margin-bottom: 1.5rem;
}
.profile-avatar {
  width: 110px; height: 110px; border-radius: 50%;
  border: 3px solid var(--accent); object-fit: cover;
  background: var(--border); box-shadow: 0 0 20px rgba(201,151,75,0.35);
}
.profile-info h1 { font-size: 1.5rem; margin: 0 0 .25rem 0; color: var(--text-strong); letter-spacing: .5px; }
.profile-info .badge { margin-top: .1rem; }

.profile-stats { margin-bottom: 1.5rem; }

/* Formularios de perfil */
.profile-card form { margin-top: 1rem; }

/* Plataformas vinculadas */
.platforms-list { display: flex; flex-wrap: wrap; gap: .75rem; }
.platform-item {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .6rem .9rem;
}
.platform-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: var(--radius-sm);
  font-weight: 800; font-size: var(--fs-sm); color: #0b0805;
}
.platform-item code { font-size: var(--fs-sm); color: var(--accent); background: transparent; padding: 0; }
.platform-item .inline { margin-left: auto; }

.platform-form { margin-top: 1rem; }

/* Solicitud manual */
.profile-card .card + .card { margin-top: 1.25rem; }

/* ===================== CONFIGURACIÓN ADMIN ===================== */
.config-tab-btn {
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--muted);
  background: var(--surface); font-weight: 700; font-size: var(--fs-sm);
  transition: var(--transition);
}
.config-tab-btn.active, .config-tab-btn:hover {
  color: var(--accent); border-color: var(--border-accent);
  background: var(--accent-dim);
}
.config-tab-btn:first-child { margin-left: 0; }

/* Editor home */
#home-content-editor { font-family: ui-monospace, SFMono-Regular, monospace; font-size: var(--fs-sm); }

/* Alertas en perfil */
.profile-card .alert { margin-top: 1rem; }

/* ===================== TICKETS ===================== */
.badge-open { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(201, 151, 75, 0.35); }
.badge-progress { background: var(--ok-dim); color: var(--ok); border: 1px solid rgba(127, 176, 105, 0.35); }
.badge-answered { background: var(--info-dim); color: var(--info); border: 1px solid rgba(143, 176, 212, 0.35); }
.badge-closed { background: rgba(155, 58, 58, 0.15); color: var(--danger-text); border: 1px solid rgba(155, 58, 58, 0.35); }

.ticket-reply {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--surface-2);
}
.ticket-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.ticket-reply-author { font-weight: 700; font-size: var(--fs-sm); color: var(--text); }
.ticket-reply-date { font-size: var(--fs-xs); color: var(--muted); }
.ticket-reply-content { font-size: var(--fs-sm); color: var(--text); line-height: 1.5; }

/* ===================== USUARIOS ADMIN ===================== */
.user-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 800;
}
.user-status-approved { background: var(--ok-dim); color: var(--ok); border: 1px solid rgba(127, 176, 105, 0.35); }
.user-status-pending { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(217, 164, 65, 0.35); }
.user-status-banned { background: var(--danger-dim); color: var(--danger-text); border: 1px solid rgba(155, 58, 58, 0.35); }
.user-status-unverified { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--surface-3);
  border: 1px solid var(--border);
  margin: 0.15rem;
}

/* ===================== BAN INFO (PERFIL) ===================== */
.ban-info-card { max-width: 700px; margin: 1.5rem auto 2rem auto; }
.ban-info-card table th { background: var(--surface-3); }

/* ===================== UTILIDADES ===================== */
[hidden] { display: none !important; }
.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; }
.wrap-anywhere { overflow-wrap: anywhere; }
.small { font-size: var(--fs-xs); }
.center { text-align: center; }
.mt-025 { margin-top: .25rem; } .mt-05 { margin-top: .5rem; } .mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.narrow { max-width: 800px; margin: 0 auto; }
.form-narrow { max-width: 600px; }
.card-flush { margin-bottom: 0; }
.stat-row { margin-top: .45rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.stat-sub { font-size: 1rem; }
.tabs-bar { margin: 1.25rem 0 .5rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.tabs-bar .tabs { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.input-sm { width: 140px; padding: .4rem .6rem; }
.select-narrow { max-width: 180px; }
.select-sm { width: auto; padding: .4rem .6rem; }
.mono { width: 100%; font-family: ui-monospace, SFMono-Regular, monospace; font-size: var(--fs-sm); }
.preview-box { margin-top: 1rem; padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.field-group { border: 1px solid var(--border); padding: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 1rem; }
.subhead { margin: 1.1rem 0 .5rem; color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.platform-toggle { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: .75rem; }
.platform-toggle .badge { margin-left: auto; }
.badge-sm { font-size: var(--fs-xs); padding: .2rem .55rem; }
.secret-code { font-size: var(--fs-lg); letter-spacing: .08em; user-select: all; }
.qr-code { display: block; width: 220px; max-width: 100%; height: auto; border-radius: 8px; }
.pager { margin-top: 1rem; display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.config-subtabs { margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: .5rem; display: flex; gap: .5rem; flex-wrap: wrap; }
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
td, .stat-val { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
/* La cabecera fija no debe tapar el destino de un ancla (#2fa, #privacidad…) */
[id] { scroll-margin-top: 5.5rem; }
button, a, summary, label, input, select, textarea { touch-action: manipulation; }

/* Acciones por fila: paneles desplegables en flujo normal (no se recortan dentro de la tabla con scroll) */
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; align-items: flex-start; }
details.row-action > summary { list-style: none; cursor: pointer; }
details.row-action > summary::-webkit-details-marker { display: none; }
details.row-action[open] { flex-basis: 100%; }
details.row-action[open] > summary { border-color: var(--accent); }
.action-panel { margin-top: .5rem; padding: 1rem; max-width: 340px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.action-panel .field { margin-bottom: .8rem; }

/* Plataformas: colores por atributo (sin estilos en línea) */
.platform-badge { color: #fff; }
[data-platform="steam"].platform-badge { background: #1b2838; }
[data-platform="epic"].platform-badge { background: #5f13bf; }
[data-platform="microsoft"].platform-badge, [data-platform="xbox"].platform-badge { background: #107c10; }
[data-platform="playstation"].platform-badge { background: #004499; }
[data-platform="discord"].platform-badge { background: #5865f2; }
.user-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(201, 151, 75, .5); text-underline-offset: 3px; }
.user-link:hover, .user-link:focus-visible { color: #e3b768; text-decoration-color: currentColor; }
.up-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.up-avatar { width: 64px; height: 64px; border-radius: 50%; }
.up-email { margin: 0 0 .4rem; font-size: 1.3rem; }
.up-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.kv { display: grid; grid-template-columns: minmax(9rem, 30%) 1fr; gap: .5rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted, #8a7a5e); font-size: var(--fs-sm); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.up-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.up-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid rgba(255, 255, 255, .07); flex-wrap: wrap; }
.up-link { display: grid; gap: .6rem; max-width: 26rem; }
.platform-chip .inline-form { display: inline; margin-left: .3rem; }
.chip-x { background: none; border: 0; padding: 0 .25rem; color: var(--muted, #8a7a5e); font-size: 1rem; line-height: 1; cursor: pointer; border-radius: 4px; }
.chip-x:hover, .chip-x:focus-visible { color: #f1a89c; background: rgba(192, 89, 74, .18); }
[data-platform="steam"].platform-chip { border-color: #66c0f4; }
[data-platform="epic"].platform-chip { border-color: #8f4ae0; }
[data-platform="microsoft"].platform-chip, [data-platform="xbox"].platform-chip { border-color: #3fae3f; }
[data-platform="playstation"].platform-chip { border-color: #3d7fd9; }
[data-platform="discord"].platform-chip { border-color: #5865f2; }

/* Diálogo de edición de tickets */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0, 0, 0, 0.7); overscroll-behavior: contain; }
.modal-box { width: 100%; max-width: 500px; max-height: 100%; overflow: auto; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.modal-title { margin: 0 0 1rem; font-size: 1.2rem; }
body.modal-open { overflow: hidden; }

@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* ===================== AJAX: TOASTS ===================== */
#toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 100;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: min(380px, calc(100vw - 2rem));
}
.toast {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-3);
  color: var(--text-strong); box-shadow: var(--shadow); font-size: var(--fs-sm);
  animation: toast-in .2s ease;
}
.toast-ok { border-color: rgba(127, 176, 105, 0.6); }
.toast-warn { border-color: rgba(217, 164, 65, 0.6); }
.toast-err { border-color: rgba(155, 58, 58, 0.8); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.btn[disabled] { opacity: .55; cursor: wait; }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.out { animation: none; transition: none; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 640px) {
  .hero { padding: 2rem 1.5rem; flex-direction: column; align-items: stretch; text-align: center; }
  .hero-actions { justify-content: center; }
  .status-panel { min-width: auto; width: 100%; }
  .grid, .grid-4 { grid-template-columns: 1fr; }
  .nav-inner { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .nav-links { justify-content: center; width: 100%; }
  .brand { justify-content: center; }
}

/* =====================================================================
   COMPONENTES COMPARTIDOS (una sola definición para todo el sitio)
   ===================================================================== */

/* ---------- Casillas y opciones: aspecto propio, sin el control nativo del navegador ---------- */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none;
  display: inline-grid; place-content: center;
  width: 1.2rem; height: 1.2rem; padding: 0; margin: 0;
  background: var(--bg); border: 1.5px solid var(--border-strong); border-radius: 5px;
  cursor: pointer; transition: var(--transition);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ''; width: .68rem; height: .68rem; background: #0b0805; transform: scale(0); transition: transform .12s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="radio"]::before { content: ''; width: .56rem; height: .56rem; border-radius: 50%; background: #0b0805; transform: scale(0); transition: transform .12s ease; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover:not(:disabled), input[type="radio"]:hover:not(:disabled) { border-color: var(--accent); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(212, 163, 77, 0.45); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .45; cursor: not-allowed; }

/* Fila de casilla con su texto (el texto hereda un tamaño normal aunque esté dentro de un título de tarjeta) */
.check { display: flex; align-items: center; gap: .6rem; width: fit-content; max-width: 100%; margin: .5rem 0; cursor: pointer;
  color: var(--text); font-size: var(--fs-md); font-weight: 500; line-height: 1.4; letter-spacing: 0; text-transform: none; }
.check:hover { color: var(--text-strong); }
.check-inline { display: inline-flex; margin: 0; }

/* ---------- Rejillas de formulario: los campos se alinean por abajo aunque una etiqueta ocupe dos líneas ---------- */
.form-grid, .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.2rem; align-items: end; margin-top: .9rem; }
.form-grid > .field, .grid-2 > .field { min-width: 0; }
.field-hint { margin-top: .3rem; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }
.field-label { display: block; margin-bottom: .4rem; font-size: var(--fs-sm); font-weight: 700; color: var(--muted-dark); text-transform: uppercase; letter-spacing: .4px; }
.fieldset { min-width: 0; margin: 0 0 1rem; padding: .9rem 1rem .2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fieldset legend { padding: 0 .4rem; font-weight: 700; color: var(--text-strong); }
.sep { border: 0; border-top: 1px solid var(--border); margin: 1.4rem 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.1rem; }

/* ---------- Barra de herramientas dentro de una tarjeta ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; font-size: var(--fs-md); font-weight: 500; }

/* ---------- Lista de estado (Configuración → Mapa y vigilancia) ---------- */
.status-list { list-style: none; display: grid; gap: .55rem; margin: 0 0 1rem; padding: 0; }
.status-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .65rem .9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.status-name { min-width: 9.5rem; font-weight: 700; color: var(--text-strong); }

/* ---------- Diálogos: acciones y tamaño ancho ---------- */
.modal-wide .modal-box { max-width: 880px; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Selector de avatar (perfil y panel de usuarios) ---------- */
.pf-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .7rem; border: 0; padding: 0; margin: 0 0 .9rem; }
.pf-av { position: relative; display: block; cursor: pointer; }
.pf-av input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border-radius: 50%; }
.pf-av img, .pf-av-auto { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; object-fit: cover; background: var(--surface-3); font-size: var(--fs-xs); font-weight: 700; text-align: center; transition: var(--transition); }
.pf-av:hover img, .pf-av:hover .pf-av-auto { border-color: var(--border-strong); }
.pf-av input:checked + img, .pf-av input:checked + .pf-av-auto { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212, 163, 77, .35); }
.pf-av input:focus-visible + img, .pf-av input:focus-visible + .pf-av-auto { outline: 3px solid var(--accent-hover); outline-offset: 2px; }

/* ---------- Páginas de acceso (login, registro, recuperar) ---------- */
.auth-lead { margin-bottom: 1.15rem; }
.auth-foot { margin-top: 1.1rem; text-align: center; }
.auth-resend { margin: 0 0 1rem; }
.pf-resend { margin: .6rem 0 1rem; }
.sub-title { font-size: 1rem; margin: 1.2rem 0 .3rem; }

/* ---------- Tickets (jugador y staff) ---------- */
.ticket-empty { padding: 1rem; }
.ticket-card { padding: 1.1rem 1.2rem; margin-bottom: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.ticket-head-lg { gap: 1rem; margin-bottom: 1rem; line-height: 1.7; }
.ticket-meta { font-size: var(--fs-xs); }
.ticket-text { margin-bottom: .8rem; }
.ticket-reply-form { margin-top: .9rem; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.ticket-status { text-align: right; }
.ticket-original { padding: 1rem 1.1rem; margin-bottom: 1.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ticket-subtitle { margin: 0 0 .8rem; font-size: 1rem; color: var(--text-strong); }

/* El aviso de cookies fijo no debe tapar el final de la página */
body.has-cookie-notice { padding-bottom: 6rem; }
/* Aviso para administradores mientras el modo mantenimiento está activo */
.maint-bar { padding: .5rem 1rem; text-align: center; font-size: var(--fs-sm); color: #1a1209; background: var(--warn); }
.maint-bar a { color: inherit; font-weight: 700; text-underline-offset: 3px; margin-left: .35rem; }

/* Modal de confirmación común (assets/app.js → OE.confirm): sustituye a window.confirm */
.cfm { z-index: 1100; }
.cfm-box { max-width: 460px; }
.cfm-msg { margin: 0 0 .4rem; white-space: pre-line; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }

/* ===================== Idiomas ===================== */
.lang-sw { position: relative; }
/* Selector «placa Exiles» (DESIGN.md §33): Marcellus y esquinas doradas opuestas, como el marco del campeón del ranking */
.lang-sw > summary { position: relative; display: inline-flex; align-items: center; gap: .55rem; min-height: 2.4rem; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface-3), var(--surface)); box-shadow: inset 0 0 0 1px rgba(224, 180, 74, .14); color: var(--text-strong); font: 400 var(--fs-md)/1 var(--font-display); letter-spacing: .02em; cursor: pointer; list-style: none; }
.lang-sw > summary::-webkit-details-marker { display: none; }
.lang-sw > summary::before, .lang-sw > summary::after { content: ""; position: absolute; width: 9px; height: 9px; border: 0 solid var(--tone-gold); pointer-events: none; }
.lang-sw > summary::before { left: -2px; top: -2px; border-width: 2px 0 0 2px; }
.lang-sw > summary::after { right: -2px; bottom: -2px; border-width: 0 2px 2px 0; }
.lang-sw > summary:hover, .lang-sw[open] > summary { border-color: var(--border-accent); color: var(--accent-hover); }
.lang-sw > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lang-code { display: none; font: 800 var(--fs-xs)/1 system-ui, sans-serif; letter-spacing: .04em; }
.lang-chev { width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.lang-sw[open] .lang-chev { transform: translateY(1px) rotate(225deg); }
.lang-sw ul { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 70; min-width: 12rem; margin: 0; padding: .35rem; list-style: none; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(224, 180, 74, .18), var(--shadow); }
.lang-sw ul::before { content: ""; position: absolute; left: .9rem; top: -1px; width: 40px; height: 3px; background: var(--tone-gold); }
.lang-sw li + li { border-top: 1px solid var(--border); }
.lang-sw li a { display: flex; align-items: center; gap: .55rem; min-height: 44px; padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--text); font: 400 var(--fs-base)/1.2 var(--font-display); text-decoration: none; }
.lang-flag { flex: none; width: 21px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }
.lang-sw li a:hover { background: var(--surface-3); color: var(--accent-hover); }
.lang-sw li a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lang-sw li a[aria-current] { background: var(--accent-dim); color: var(--accent-hover); }
.lang-sw li a[aria-current]::after { content: ""; width: 7px; height: 7px; margin-left: auto; background: var(--tone-gold); transform: rotate(45deg); }
.au-stage .lang-sw { position: absolute; top: 1.2rem; right: 1.2rem; z-index: 5; }
.au-stage:has(.lang-sw[open]) { overflow: visible; z-index: 5; } /* en móvil la imagen es baja y recortaría el menú */
@media (max-width: 640px) { .lang-name { display: none; } .lang-code { display: inline; } }
@media (pointer: coarse) { .lang-sw > summary { min-height: 44px; } }
.lang-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.tr-row label { text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.tr-row textarea { resize: vertical; }
