/* Estilos compartidos de los juegos nuevos de BelApp (Ahorcado, Ajedrez, Damas, Esquiva Huecos).
   Mismo lenguaje visual que los demás juegos: noche con aurora, paneles de vidrio, Lilita One + Nunito. */
:root {
  color-scheme: dark;
  --sky-top: #060b22;
  --sky-mid: #0d1a3c;
  --sky-low: #12213f;
  --glass: rgba(255, 255, 255, .075);
  --glass-hi: rgba(255, 255, 255, .14);
  --glass-line: rgba(255, 255, 255, .17);
  --ink: #f1f5ff;
  --muted: #a9b5d8;
  --faint: #7f8bb3;
  --aurora-1: #3ef0b0;
  --aurora-2: #3ccaf2;
  --aurora-3: #9a7bff;
  --aurora-4: #ff79c4;
  --gold: #ffd36b;
  --gold-ink: #2b1d00;
  --danger: #ff5d73;
  --ok: #5af0a8;
  --accent: var(--aurora-2);
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--sky-top); -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--sky-top); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 80px;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--aurora-2); }
:focus-visible { outline: 3px solid var(--aurora-2); outline-offset: 2px; border-radius: 10px; }

/* ---------- Fondo ---------- */
.bj-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%); }
.bj-aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bj-aurora i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; mix-blend-mode: screen; will-change: transform; }
.bj-aurora .a1 { width: 70vmax; height: 26vmax; left: -15vmax; top: 2vh; background: radial-gradient(closest-side, var(--aurora-1), transparent); animation: bjDrift1 22s ease-in-out infinite alternate; }
.bj-aurora .a2 { width: 60vmax; height: 22vmax; right: -12vmax; top: 12vh; background: radial-gradient(closest-side, var(--aurora-2), transparent); animation: bjDrift2 26s ease-in-out infinite alternate; }
.bj-aurora .a3 { width: 55vmax; height: 24vmax; left: 20vw; top: -6vh; background: radial-gradient(closest-side, var(--aurora-3), transparent); opacity: .4; animation: bjDrift1 30s ease-in-out infinite alternate-reverse; }
@keyframes bjDrift1 { to { transform: translate(14vw, 6vh) rotate(8deg) scaleX(1.2); } }
@keyframes bjDrift2 { to { transform: translate(-16vw, -4vh) rotate(-10deg) scaleX(.85); } }
.bj-stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 62%, #dfe8ff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 47% 12%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 66% 44%, #cfe0ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 83% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 91% 70%, #e6ecff 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 84%, #fff 50%, transparent 51%), radial-gradient(1.3px 1.3px at 58% 86%, #f2f5ff 50%, transparent 51%); }

.bj-page { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; }

/* ---------- Vidrio y tarjetas ---------- */
.glass { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 22px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08); }
.bj-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.label { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .02em; color: #fff; }
.note { margin: 0; font-size: .86rem; color: var(--muted); }
.empty { margin: 0; font-size: .9rem; color: var(--faint); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; gap: 8px; }
.inline > input { flex: 1; min-width: 0; }

/* ---------- Cabecera ---------- */
.bj-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; }
.pill svg { width: 18px; height: 18px; }
.bj-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.bj-title h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.7rem, 4.6vw, 2.6rem); line-height: 1; letter-spacing: .01em;
  background: linear-gradient(90deg, #fff, var(--gold) 60%, #ffb36b); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .45)); }
.bj-title .sub { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; }
@media (max-width: 640px) {
  .bj-top { gap: 10px; }
  .bj-top .pill { padding: 0 12px; font-size: .85rem; }
  .bj-title .sub { display: none; }
  .bj-title h1 { font-size: clamp(1.45rem, 7vw, 1.9rem); white-space: nowrap; }
}
.icon-btn { flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--glass-line); background: var(--glass); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--glass-hi); }

/* ---------- Distribución ---------- */
.bj-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.bj-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.bj-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 980px) { .bj-layout { grid-template-columns: 1fr; } }

/* ---------- Botones y campos ---------- */
.btn-main, .btn, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; font-weight: 800; font-size: .98rem; text-decoration: none; transition: transform .15s ease, filter .15s ease, background .15s ease; }
.btn-main { background: linear-gradient(180deg, #ffe08e, var(--gold) 55%, #f2b23a); color: var(--gold-ink); box-shadow: 0 8px 24px rgba(255, 196, 70, .35), inset 0 -3px 0 rgba(0, 0, 0, .15); }
.btn-main:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-main:active { transform: translateY(1px); }
.btn { background: rgba(255, 255, 255, .12); border: 1px solid var(--glass-line); color: #fff; }
.btn:hover { background: rgba(255, 255, 255, .2); }
.btn-ghost { background: transparent; border: 1px solid var(--glass-line); color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 700; color: #dfe6ff; }
input[type=text], input[type=password], select { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--glass-line); background: rgba(4, 8, 26, .55); color: #fff; }
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: none; border-color: var(--aurora-2); box-shadow: 0 0 0 3px rgba(60, 202, 242, .25); }
.inline button, form .inline button { min-height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .12); font-weight: 800; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 93, 115, .14); border: 1px solid rgba(255, 93, 115, .4); color: #ffd3da; font-size: .88rem; }

/* Selector segmentado (modos, niveles) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 18px; background: rgba(0, 0, 0, .25); border: 1px solid var(--glass-line); }
.seg button, .seg label { flex: 1 1 0; min-width: 0; line-height: 1.15; min-height: 42px; padding: 4px 8px; border-radius: 13px; border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.seg button[aria-pressed="true"], .seg input:checked + span { color: var(--gold-ink); }
.seg button[aria-pressed="true"] { background: linear-gradient(180deg, #ffe08e, var(--gold)); box-shadow: 0 4px 14px rgba(255, 196, 70, .3); }
.seg button:hover:not([aria-pressed="true"]) { color: #fff; background: rgba(255, 255, 255, .07); }

/* ---------- Mensaje de turno ---------- */
.bj-status { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 58px; }
.bj-status .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 12px currentColor; }
.bj-status b { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; letter-spacing: .01em; }
.bj-status p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- Cuenta ---------- */
.hello { margin: 0; font-size: 1.05rem; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats div { padding: 10px 6px; border-radius: 14px; background: rgba(0, 0, 0, .22); text-align: center; }
.mini-stats b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; line-height: 1.1; color: #fff; }
.mini-stats span { font-size: .75rem; color: var(--muted); font-weight: 700; }
.srv-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 211, 107, .1); border: 1px solid rgba(255, 211, 107, .35); color: #ffe7b0; font-size: .85rem; }

/* ---------- En línea ---------- */
.rooms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rooms li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; background: rgba(0, 0, 0, .22); font-size: .9rem; }
.rooms button { min-height: 38px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--ok); color: #03281a; font-weight: 800; }
.room-code { display: flex; align-items: center; gap: 10px; }
.room-code b { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; letter-spacing: .18em; color: var(--gold); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-right: 8px; box-shadow: 0 0 10px var(--ok); vertical-align: middle; }
.status-dot.wait { background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: bjBlink 1.2s ease-in-out infinite; }
.status-dot.off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
@keyframes bjBlink { 50% { opacity: .3; } }
.side-pick { display: flex; gap: 6px; }

/* ---------- Ranking e historial ---------- */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: r; }
.rank li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: rgba(0, 0, 0, .2); font-size: .92rem; }
.rank li::before { content: counter(r); width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; background: rgba(255, 255, 255, .1); }
.rank li:nth-child(1)::before { background: linear-gradient(180deg, #ffe9a6, #f4b93a); color: #3a2600; }
.rank li:nth-child(2)::before { background: linear-gradient(180deg, #f2f5ff, #aab6cf); color: #1f2738; }
.rank li:nth-child(3)::before { background: linear-gradient(180deg, #ffd0a8, #c9814a); color: #351a05; }
.rank li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li b { font-variant-numeric: tabular-nums; }
.rank li.me { outline: 1px solid var(--gold); }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 12px; background: rgba(0, 0, 0, .2); font-size: .86rem; }
.hist .w { color: var(--ok); font-weight: 800; } .hist .l { color: #ff9aa9; font-weight: 800; } .hist .d { color: var(--gold); font-weight: 800; }
.hist time { color: var(--faint); white-space: nowrap; }
.tabs-mini { display: flex; gap: 6px; }
.tabs-mini button { flex: 1; min-height: 36px; border-radius: 11px; border: 1px solid var(--glass-line); background: transparent; color: var(--muted); font-weight: 800; font-size: .85rem; }
.tabs-mini button[aria-pressed="true"] { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---------- Ventana de resultado ---------- */
.bj-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(3, 6, 20, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: bjFade .25s ease; }
.bj-modal .box { width: min(440px, 100%); padding: 26px 24px 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; animation: bjPop .45s cubic-bezier(.2, 1.4, .4, 1); background: rgba(18, 24, 58, .92); }
.bj-modal .big { font-size: 3.2rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4)); }
.bj-modal h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.05; }
.bj-modal p { margin: 0; color: var(--muted); }
.bj-modal .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
@keyframes bjFade { from { opacity: 0; } }
@keyframes bjPop { from { opacity: 0; transform: scale(.85) translateY(20px); } }

/* Aviso breve */
.bj-toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 90; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 16px; background: rgba(15, 20, 50, .95); border: 1px solid var(--glass-line); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); font-weight: 700; font-size: .95rem; max-width: calc(100vw - 32px); text-align: center; transition: opacity .25s ease, transform .25s ease; }
.bj-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Confeti */
.bj-confetti { position: fixed; inset: 0; z-index: 85; pointer-events: none; }

/* ---------- Reglas ---------- */
.rules { margin-top: 22px; padding: clamp(20px, 3vw, 32px); }
.rules h2 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; }
.rules h3 { margin: 18px 0 6px; font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; color: var(--gold); }
.rules p, .rules li { color: #d4dcf5; }
.rules ul, .rules ol { padding-left: 1.2em; margin: 6px 0; }
.rules li { margin: 4px 0; }
.rules .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0 28px; }
kbd { display: inline-block; padding: 1px 7px; border-radius: 7px; border: 1px solid var(--glass-line); background: rgba(0, 0, 0, .3); font-family: var(--font-body); font-size: .85em; font-weight: 800; }

.bj-foot { margin-top: 26px; text-align: center; font-size: .85rem; color: var(--faint); }
.bj-foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
