:root {
  /* PALETA GLOBAL: cambia estos valores y cambiará toda la app. */
  --bg: #12234f;
  --bg-2: #081432;
  --panel: rgba(13, 26, 59, 0.88);
  --panel-2: rgba(29, 48, 103, 0.72);
  --text: #ffffff;
  --muted: #b8c6ec;
  --line: rgba(255, 255, 255, 0.12);
  --gold: #d8ae55;
  --gold-2: #f1cf7a;
  --glow: rgba(216, 174, 85, 0.18);
  --danger: #ffb4a8;
  --success: #98f0c0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 24px;
  --radius-sm: 14px;
}

/* PALETAS POR MINIJUEGO
   Para cambiar los colores de un juego toca solo su bloque.
   Para crear uno nuevo: añade .theme-tu_juego y pon ese theme_class en includes/games.php. */
.theme-whitegame {
  --bg: #111827;
  --bg-2: #050816;
  --panel: rgba(13, 19, 33, 0.92);
  --panel-2: rgba(32, 41, 63, 0.78);
  --gold: #d8ae55;
  --gold-2: #f1cf7a;
  --muted: #c3c9d8;
  --line: rgba(241, 207, 122, 0.16);
  --glow: rgba(216, 174, 85, 0.2);
}

.theme-bargames {
  --bg: #241127;
  --bg-2: #100714;
  --panel: rgba(46, 22, 52, 0.9);
  --panel-2: rgba(85, 38, 78, 0.68);
  --gold: #ff8f5e;
  --gold-2: #ffd19b;
  --muted: #e9c5dc;
  --line: rgba(255, 209, 155, 0.18);
  --glow: rgba(255, 143, 94, 0.2);
}

.theme-inngame {
  --bg: #1f160e;
  --bg-2: #0d0804;
  --panel: rgba(46, 31, 19, 0.92);
  --panel-2: rgba(87, 58, 32, 0.7);
  --gold: #b9793e;
  --gold-2: #f0c28a;
  --muted: #dac4aa;
  --line: rgba(240, 194, 138, 0.18);
  --glow: rgba(185, 121, 62, 0.22);
}

.theme-xarangame {
  --bg: #0d2730;
  --bg-2: #041216;
  --panel: rgba(12, 50, 59, 0.9);
  --panel-2: rgba(19, 85, 95, 0.7);
  --gold: #4fd1c5;
  --gold-2: #b7fff7;
  --muted: #b9e3e0;
  --line: rgba(183, 255, 247, 0.18);
  --glow: rgba(79, 209, 197, 0.2);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--glow), transparent 32rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 4rem); line-height: 0.96; margin-bottom: 0.6rem; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); margin-bottom: 0.75rem; }
h4 { margin-bottom: 0.25rem; font-size: 1.05rem; }

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: #06112b;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(216, 174, 85, 0.18);
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 700;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.82rem 1.05rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

button:hover, .btn:hover { transform: translateY(-1px); text-decoration: none; }
button:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1b1430; }
.btn.secondary { background: rgba(216, 174, 85, 0.16); color: var(--gold-2); border: 1px solid rgba(216, 174, 85, 0.28); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.12); }
.btn.small { padding: 0.62rem 0.8rem; font-size: 0.9rem; }

.muted { color: var(--muted); }
.tiny { font-size: 0.84rem; }
.center { text-align: center; }
.eyebrow {
  color: var(--gold-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 0.4rem;
}

.hidden { display: none !important; }

.page-auth {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(100%, 430px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-card.wide { width: min(100%, 620px); }

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #141023;
  font-weight: 950;
  margin-bottom: 1.3rem;
}

.auth-footer { margin: 1.2rem 0 0; color: var(--muted); }

.stack { display: grid; gap: 1rem; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.9rem;
  align-items: end;
}

.notice {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  border: 1px solid transparent;
  font-weight: 700;
}
.notice.error { color: #3b0905; background: var(--danger); }
.notice.success { color: #07351c; background: var(--success); }

.page-app, .page-game { padding: clamp(1rem, 3vw, 2rem); }

.app-header, .game-header {
  width: min(1180px, 100%);
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: flex-end; }

.layout {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}
.layout.narrow { width: min(980px, 100%); }
.layout.two-cols { grid-template-columns: 0.85fr 1.15fr; align-items: start; }

.panel, .game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.6vw, 1.45rem);
  box-shadow: var(--shadow);
}

.intro-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.games-grid { display: grid; gap: 1rem; }

.game-card {
  display: grid;
  gap: 1rem;
}

.game-card-disabled {
  opacity: 0.88;
}

.game-action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.disabled-action .btn {
  min-width: 180px;
}

code {
  padding: 0.1rem 0.3rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-2);
}

.game-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  background: rgba(216, 174, 85, 0.16);
  color: var(--gold-2);
  font-size: 0.8rem;
  font-weight: 900;
  border: 1px solid rgba(216, 174, 85, 0.25);
}
.muted-badge { color: var(--muted); background: rgba(255, 255, 255, 0.08); border-color: var(--line); }

.create-server-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.server-list { display: grid; gap: 0.75rem; }

.server-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.empty-state {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.18);
}

.big-number {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 950;
  line-height: 1;
  color: var(--gold-2);
  margin-bottom: 1rem;
}

.players-list { display: grid; gap: 0.7rem; }
.player-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-weight: 800;
}
.player-pill small {
  color: var(--gold-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar.mini {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.player-name-block {
  display: grid;
  gap: 0.12rem;
  line-height: 1.05;
}
.player-name-block strong { font-weight: 900; }
.player-name-block em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 650;
}

.header-actions form { margin: 0; }

@media (max-width: 820px) {
  .app-header, .game-header, .intro-panel, .game-head, .server-card {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions { justify-content: flex-start; }
  .create-server-form, .grid-form, .layout.two-cols, .inline-form { grid-template-columns: 1fr; }
}

.player-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

@media (max-width: 1100px) {
  .player-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-form .btn { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .player-form { grid-template-columns: 1fr; }
}
