/* ============================================================
   SALA EXTREMA — /sala, /login, /registro, /perfil
   Usa los tokens de app.css; la identidad propia de la sala es la
   "bóveda" carmesí con hilos dorados (--xr-* definidos en app.css).
   ============================================================ */

/* ---------- bóveda (cabecera) ---------- */
.xr-vault {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: 8px; padding: clamp(32px, 6vw, 72px) clamp(22px, 5vw, 64px);
  border-radius: var(--r-xl); color: var(--xr-cream);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(184,52,42,.55) 0%, transparent 55%),
    linear-gradient(135deg, #140807 0%, var(--xr-1) 45%, var(--xr-2) 100%);
  box-shadow: inset 0 0 0 1px rgba(212,175,105,.35), 0 24px 60px -30px rgba(0,0,0,.7);
}
.xr-vault::before {       /* marco dorado interior */
  content: ""; position: absolute; inset: 10px; z-index: -1; pointer-events: none;
  border: 1px solid rgba(212,175,105,.18); border-radius: calc(var(--r-xl) - 6px);
}
.xr-vault-inner { position: relative; max-width: 640px; }
.xr-vault-mark {
  position: absolute; right: clamp(-40px, -2vw, 0px); bottom: -60px; z-index: -1;
  width: clamp(220px, 32vw, 420px); color: rgba(212,175,105,.1);
}
.xr-vault-mark svg { width: 100%; height: auto; fill: currentColor; stroke: none; }
.xr-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--xr-brass);
}
.xr-kicker svg { width: 14px; height: 14px; fill: currentColor; stroke-width: 1.2; }
.xr-title {
  margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1; color: #FFF7EA;
}
.xr-sub { margin: 16px 0 0; max-width: 34ch; font-size: var(--t-md); line-height: 1.5; color: rgba(246,238,223,.82); }
.xr-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.xr-note { margin: 18px 0 0; font-size: var(--t-sm); color: rgba(246,238,223,.62); }
.xr-btn-main { --btn-bg: var(--xr-cream); --btn-fg: #2A0B08; --btn-bd: var(--xr-cream); }
.xr-btn-main:hover { --btn-bg: #fff; --btn-bd: #fff; }
.xr-btn-ghost { --btn-bg: transparent; --btn-fg: var(--xr-cream); --btn-bd: rgba(212,175,105,.55); }
.xr-btn-ghost:hover { --btn-bg: rgba(255,255,255,.08); --btn-bd: var(--xr-brass); }
.xr-vault .btn:focus-visible { outline: 2px solid var(--xr-brass); outline-offset: 3px; }

/* ---------- funciones (portada sin sesión) ---------- */
.xr-features {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
}
@media (min-width: 1200px) { .xr-features { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.xr-feature {
  padding: 18px 18px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
}
.xr-feature-ico {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px;
  border-radius: 10px; color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.xr-feature-ico svg { width: 18px; height: 18px; }
.xr-feature h3 { margin: 0 0 4px; font-size: var(--t-base); font-weight: 600; }
.xr-feature p { margin: 0; font-size: var(--t-sm); color: var(--muted); line-height: 1.45; }

.xr-games {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px;
}
.xr-game {
  position: relative; padding: 18px; border-radius: var(--r-lg);
  border: 1px dashed var(--line-2); background: transparent;
}
.xr-game h3 { margin: 12px 0 4px; font-size: var(--t-md); font-family: var(--font-display); font-weight: 600; }
.xr-game p { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.xr-soon { font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; }

.xr-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: clamp(30px, 3vw, 44px); padding: 24px clamp(20px, 3vw, 32px);
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface);
}
.xr-cta h2 { margin: 0; font-size: var(--t-lg); }
.xr-cta .xr-actions { margin: 0; }

/* ---------- ingreso / registro ---------- */
.xr-auth { display: grid; place-items: start center; padding: clamp(8px, 4vw, 48px) 0; }
.xr-auth-card { width: 100%; max-width: 440px; position: relative; overflow: hidden; }
.xr-auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg, var(--xr-1), var(--xr-3));
}
.xr-auth-card .xr-kicker { color: var(--accent-ink); }
.xr-auth-title { margin: 0 0 var(--s-5); font-size: var(--t-2xl); line-height: 1.1; }
.xr-auth-card .notice:focus { outline: none; }
.xr-auth-alt { margin: var(--s-4) 0 0; text-align: center; font-size: var(--t-sm); color: var(--muted); }
.xr-auth-alt a { color: var(--accent-ink); font-weight: 600; }
.xr-pass { position: relative; }
.xr-pass input { width: 100%; padding-right: 92px; }
.field .xr-pass input[type="password"], .field .xr-pass input[type="text"] { padding-right: 92px; }
.xr-pass-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  font: inherit; font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); background: transparent; cursor: pointer;
}
.xr-pass-toggle:hover { background: var(--surface-2); color: var(--ink); }
.xr-pass-toggle:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 1px; }
.field input[type="password"] {
  width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  -webkit-appearance: none; appearance: none; transition: border-color var(--dur), box-shadow var(--dur);
}
.field input[type="password"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- panel del jugador ---------- */
.xr-vault-sm { padding: clamp(22px, 3.5vw, 36px) clamp(20px, 3.5vw, 40px); }
.xr-me { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.xr-me-av { box-shadow: 0 0 0 2px rgba(212,175,105,.7), 0 0 0 6px rgba(212,175,105,.12); }
.xr-me-text { flex: 1 1 240px; min-width: 0; }
.xr-me-text .xr-kicker { margin-bottom: 6px; }
.xr-title-sm { font-size: clamp(2rem, 4vw, 2.9rem); overflow-wrap: anywhere; }
.xr-me-meta { margin: 8px 0 0; font-size: var(--t-sm); color: rgba(246,238,223,.72); }
.xr-me-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.xr-me-actions form { margin: 0; }
.xr-welcome { margin: 16px 0 0; }
.xr-welcome a { color: inherit; font-weight: 600; }

.xr-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.xr-stat { padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.xr-stat-l { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--t-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.xr-stat-l svg { width: 15px; height: 15px; color: var(--accent-ink); }
.xr-stat-v { margin: 8px 0 6px; font-family: var(--font-num); font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.xr-stat-s { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.xr-bar { height: 6px; margin: 4px 0 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.xr-bar span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--xr-2), var(--xr-3)); }

.xr-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.xr-panel-h { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: var(--t-md); font-weight: 600; }
.xr-panel-h svg { width: 18px; height: 18px; color: var(--accent-ink); }
.xr-empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-md); font-size: var(--t-sm); }
.xr-empty p { margin: 0 auto; max-width: 38ch; }
.xr-empty-h { color: var(--ink); font-weight: 600; margin-bottom: 4px !important; }
.xr-empty-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 10px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.xr-empty-ico svg { width: 18px; height: 18px; }

.xr-table-wrap { overflow-x: auto; margin: 0 -4px; }
.xr-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.xr-table th { text-align: left; font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.xr-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.xr-muted { color: var(--muted); }
.xr-result { font-weight: 600; }
.xr-result[data-result="won"] { color: var(--success); }
.xr-result[data-result="lost"] { color: var(--danger); }

.xr-tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 14px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.xr-tabs [role=tab] { min-height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--t-sm); font-weight: 500; color: var(--muted); background: transparent; cursor: pointer; }
.xr-tabs [role=tab][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.2)); }
.xr-tabs [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.xr-rank { list-style: none; margin: 0; padding: 0; }
.xr-rank li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.xr-rank li:last-child { border-bottom: 0; }
.xr-rank li.is-me { background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: var(--r-sm); }
.xr-rank-pos { width: 22px; text-align: right; font-family: var(--font-num); color: var(--muted); }
.xr-rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.xr-rank-name em { font-style: normal; color: var(--muted); font-weight: 400; }
.xr-rank-pts { font-family: var(--font-num); color: var(--ink-2); }

/* ---------- perfil ---------- */
.xr-profile-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: 12px 0 24px; }
.xr-profile-title { margin: 0 0 10px; font-size: var(--t-2xl); line-height: 1.1; overflow-wrap: anywhere; }
.xr-facts { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0; }
.xr-facts dt { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.xr-facts dd { margin: 2px 0 0; font-size: var(--t-sm); color: var(--ink); overflow-wrap: anywhere; }
.xr-numbers {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 0 0 16px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.xr-numbers div { background: var(--surface); padding: 14px 16px; }
.xr-numbers dt { font-size: var(--t-xs); color: var(--muted); }
.xr-numbers dd { margin: 4px 0 0; font-family: var(--font-num); font-size: var(--t-lg); font-weight: 600; color: var(--ink); }
.xr-panel + .xr-panel { margin-top: 16px; }
.xr-grid > .xr-panel { margin-top: 0; }
.xr-avatars { border: 0; margin: 0 0 var(--s-5); padding: 0; min-width: 0; }
.xr-avatars legend { padding: 0; }
.xr-avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.xr-avatar-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 12px; border-radius: var(--r-md); border: 1px solid var(--line); cursor: pointer;
  font-size: var(--t-xs); color: var(--ink-2); text-align: center; transition: border-color var(--dur), background var(--dur);
}
.xr-avatar-opt:hover { border-color: var(--line-2); background: var(--surface-2); }
.xr-avatar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.xr-avatar-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--ink); }
.xr-avatar-opt:has(input:checked)::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.xr-avatar-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.xr-achievements { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.xr-achievements li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); }
.xr-ach-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.xr-ach-ico svg { width: 17px; height: 17px; }
.is-earned .xr-ach-ico { background: color-mix(in srgb, var(--xr-brass) 22%, transparent); color: var(--xr-brass); }
.xr-ach-t { margin: 0; font-weight: 600; font-size: var(--t-sm); }
.is-locked .xr-ach-t { color: var(--ink-2); }
.xr-ach-d { margin: 2px 0 0; font-size: var(--t-xs); color: var(--muted); }
.xr-logout { margin-top: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .xr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xr-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) { .xr-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .xr-actions .btn { flex: 1 1 100%; }
  .xr-me { gap: 14px; }
  .xr-me-actions { width: 100%; }
  .xr-me-actions > * { flex: 1 1 0; }
  .xr-me-actions .btn { width: 100%; }
  .xr-stat { padding: 14px 16px; }
  .xr-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xr-cta .xr-actions { width: 100%; }
}

/* ---------- administración (/sala/admin) ---------- */
.xr-crumbs { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.xr-admin-link-quiet { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--muted); text-decoration: none; }
.xr-admin-link-quiet:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.xr-admin-link-quiet svg { width: 15px; height: 15px; }
.xr-admin-head { margin: 12px 0 20px; }
.xr-admin-head .xr-profile-title { margin-bottom: 4px; }
.xr-admin-head .xr-muted { margin: 0; font-size: var(--t-sm); }
.xr-kicker-ink { color: var(--accent-ink); margin-bottom: 8px; }
.xr-admin-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.xr-admin-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface); color: inherit; text-decoration: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.xr-admin-tile:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
.xr-admin-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xr-admin-tile .xr-feature-ico { margin-bottom: 8px; }
.xr-admin-tile-t { font-weight: 600; }
.xr-admin-tile-d { font-size: var(--t-xs); color: var(--muted); }
.xr-admin-stats { margin-top: 20px; }
.xr-cell-user { display: inline-flex; align-items: center; gap: 8px; }
.xr-levels { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.xr-levels li { display: grid; grid-template-columns: 70px 1fr 36px; align-items: center; gap: 10px; font-size: var(--t-sm); }
.xr-levels-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.xr-levels-bar span { display: block; height: 100%; min-width: 4px; background: linear-gradient(90deg, var(--xr-2), var(--xr-3)); border-radius: inherit; }
.xr-levels-n { text-align: right; font-family: var(--font-num); color: var(--ink-2); }
.xr-subh { margin: 18px 0 8px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.xr-admin-avatars { margin-top: 16px; }
.xr-avatar-list { list-style: none; margin: 0 0 12px; padding: 0; }
.xr-avatar-list .xr-avatar-opt { cursor: default; }
.xr-avatar-list .xr-avatar-opt .xr-muted { font-size: .68rem; }
.xr-empty-lg { padding: 48px 20px; }
.xg-admin-games { margin-top: 16px; }
.xg-admin-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; margin-bottom: 16px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.xg-admin-kpis div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--surface); }
.xg-admin-kpis span { font-size: var(--t-xs); color: var(--muted); }
.xg-admin-kpis strong { font-size: var(--t-md); color: var(--ink); }

/* ---------- tarjetas de juegos en /sala ---------- */
.xr-games-live { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.xr-games-live > li { list-style: none; }
.xr-game-live {
  display: flex; align-items: center; gap: 14px; height: 100%;
  border-style: solid; border-color: var(--line); background: var(--surface);
  color: inherit; text-decoration: none; transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
}
a.xr-game-live:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
a.xr-game-live:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xr-game-live h3 { margin: 0 0 4px; }
.xr-game-main { flex: 1; min-width: 0; }
.xr-game-glyph {
  display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 14px;
  color: var(--xr-cream); background: linear-gradient(145deg, var(--xr-2), var(--xr-1));
  box-shadow: inset 0 0 0 1px rgba(212,175,105,.4);
}
.xr-game-glyph svg { width: 34px; height: 34px; }
.xr-game-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--t-xs); color: var(--muted); }
.xr-game-progress .xr-bar { flex: 1; margin: 0; max-width: 120px; }
.xr-game-go { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.xr-game-go svg { width: 16px; height: 16px; }
.xr-game-live.is-locked { opacity: .92; }

