/* ═══════════════════════════════════════
   SÚPER GATO V2 — Dark + Gold Theme
   ═══════════════════════════════════════ */

:root {
  --gold:       #FFD700;
  --gold-dark:  #C9A800;
  --gold-glow:  rgba(255,215,0,0.25);
  --bg-deep:    #0a0a0f;
  --bg-card:    #12121a;
  --bg-card2:   #1a1a28;
  --border:     rgba(255,215,0,0.2);
  --text:       #e8e8f0;
  --text-dim:   #888899;
  --danger:     #ff4455;
  --success:    #44ff88;
  --x-color:    #FFD700;
  --o-color:    #44aaff;
  --radius:     12px;
  --shadow:     0 8px 32px rgba(0,0,0,0.5);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Exo 2', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px; /* espacio para miniplayer */
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(255,215,0,0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(68,170,255,0.03) 0%, transparent 60%);
}

/* ── VISTAS SPA ───────────────────────── */
.vista { display:none; }
.vista.activa { display:block; }

/* ── UTILIDADES ───────────────────────── */
.hidden { display:none !important; }

/* ── BOTONES ──────────────────────────── */
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  width: 100%;
}
.btn-gold:hover { transform:translateY(-2px); box-shadow:0 6px 20px var(--gold-glow); }
.btn-gold:active { transform:translateY(0); }
.btn-gold:disabled { opacity:0.35; cursor:not-allowed; transform:none; }
.btn-sm { width:auto; padding:8px 18px; font-size:0.85rem; }

.btn-danger {
  background: linear-gradient(135deg, #ff4455, #cc2233);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.btn-danger:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(255,68,85,0.3); }
.btn-danger:disabled { opacity:0.35; cursor:not-allowed; transform:none; }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor:pointer;
  font-family:'Rajdhani',sans-serif;
  font-size:0.85rem;
  letter-spacing:1px;
  transition:all 0.2s;
}
.btn-logout:hover { border-color:var(--danger); color:var(--danger); }

/* ── MENSAJES ─────────────────────────── */
.msg-error {
  background: rgba(255,68,85,0.15);
  border: 1px solid rgba(255,68,85,0.4);
  color: #ff8899;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.msg-ok {
  background: rgba(68,255,136,0.1);
  border: 1px solid rgba(68,255,136,0.3);
  color: var(--success);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ════════════════════════════════════════
   LOGIN / REGISTRO
   ════════════════════════════════════════ */
.login-container {
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.logo-area {
  text-align:center;
  margin-bottom:32px;
  animation: fadeDown 0.6s ease;
}
.cat-icon { font-size:4rem; margin-bottom:8px; }
.logo-area h1 {
  font-family:'Rajdhani',sans-serif;
  font-size:2.5rem;
  font-weight:700;
  color:var(--text);
  letter-spacing:4px;
}
.logo-area h1 .v2 { color:var(--gold); }
.subtitle { color:var(--text-dim); font-size:0.9rem; letter-spacing:2px; margin-top:4px; }

.form-card {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:32px;
  width:100%;
  max-width:400px;
  box-shadow:var(--shadow);
  animation: fadeUp 0.5s ease;
}
.form-card h2 {
  font-family:'Rajdhani',sans-serif;
  font-size:1.5rem;
  font-weight:700;
  margin-bottom:24px;
  color:var(--gold);
  letter-spacing:2px;
  text-align:center;
}

.field-group { margin-bottom:16px; }
.field-group label {
  display:block;
  font-size:0.8rem;
  letter-spacing:1px;
  color:var(--text-dim);
  margin-bottom:6px;
  text-transform:uppercase;
}
.field-group input {
  width:100%;
  background:var(--bg-card2);
  border:1px solid var(--border);
  border-radius:8px;
  padding:12px 14px;
  color:var(--text);
  font-family:'Exo 2',sans-serif;
  font-size:1rem;
  transition:border-color 0.2s;
  outline:none;
}
.field-group input:focus { border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-glow); }

.switch-form {
  text-align:center;
  margin-top:16px;
  font-size:0.85rem;
  color:var(--text-dim);
}
.switch-form a { color:var(--gold); text-decoration:none; font-weight:600; }
.switch-form a:hover { text-decoration:underline; }

/* Foto upload */
.foto-upload-area {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  margin-bottom:20px;
  cursor:pointer;
}
.foto-upload-area img {
  width:80px; height:80px;
  border-radius:50%;
  border:2px solid var(--border);
  object-fit:cover;
  object-position:center;
  display:block;
}
.foto-upload-area span { font-size:0.8rem; color:var(--text-dim); }

/* ════════════════════════════════════════
   LOBBY
   ════════════════════════════════════════ */
.lobby-container {
  max-width:900px;
  margin:0 auto;
  padding:20px 16px;
}

.lobby-header {
  display:flex;
  align-items:center;
  gap:16px;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px 20px;
  margin-bottom:20px;
  flex-wrap:wrap;
  position:relative;
}

.user-profile {
  display:flex;
  align-items:center;
  gap:12px;
  flex:1;
}
.lobby-foto-wrapper {
  position:relative;
  width:52px; height:52px;
  border-radius:50%;
  cursor:pointer;
  flex-shrink:0;
}
.lobby-foto-wrapper img {
  width:52px; height:52px;
  border-radius:50%;
  border:2px solid var(--gold);
  object-fit:cover;
  object-position:center;
  display:block;
}
/* Mini menú foto */
.menu-foto {
  position:absolute;
  top:64px;
  left:0;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  box-shadow:var(--shadow);
  z-index:200;
  min-width:180px;
}
.menu-foto button {
  display:block;
  width:100%;
  padding:12px 16px;
  background:none;
  border:none;
  color:var(--text);
  font-family:'Exo 2',sans-serif;
  font-size:0.9rem;
  cursor:pointer;
  text-align:left;
  transition:background 0.15s;
}
.menu-foto button:hover { background:rgba(255,215,0,0.08); }
.menu-foto button:first-child { border-bottom:1px solid var(--border); }

.lobby-foto-overlay {
  position:absolute;
  inset:0;
  border-radius:50%;
  background:rgba(0,0,0,0.6);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  opacity:0;
  transition:opacity 0.2s;
}
.lobby-foto-wrapper:hover /* Mini menú foto */
.menu-foto {
  position:absolute;
  top:64px;
  left:0;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  box-shadow:var(--shadow);
  z-index:200;
  min-width:180px;
}
.menu-foto button {
  display:block;
  width:100%;
  padding:12px 16px;
  background:none;
  border:none;
  color:var(--text);
  font-family:'Exo 2',sans-serif;
  font-size:0.9rem;
  cursor:pointer;
  text-align:left;
  transition:background 0.15s;
}
.menu-foto button:hover { background:rgba(255,215,0,0.08); }
.menu-foto button:first-child { border-bottom:1px solid var(--border); }

.lobby-foto-overlay { opacity:1; }
.user-info h3 {
  font-family:'Rajdhani',sans-serif;
  font-size:1.2rem;
  font-weight:700;
  color:var(--text);
}
.online-badge {
  font-size:0.75rem;
  color:var(--success);
  letter-spacing:1px;
}

.user-stats {
  display:flex;
  gap:24px;
}
.stat-item {
  display:flex;
  flex-direction:column;
  align-items:center;
}
.stat-num {
  font-family:'Rajdhani',sans-serif;
  font-size:1.6rem;
  font-weight:700;
  color:var(--gold);
  line-height:1;
}
.stat-label {
  font-size:0.7rem;
  color:var(--text-dim);
  text-transform:uppercase;
  letter-spacing:1px;
}

.lobby-title {
  margin-bottom:12px;
}
.lobby-title h2 {
  font-family:'Rajdhani',sans-serif;
  font-size:1.3rem;
  letter-spacing:2px;
  color:var(--gold);
}

.tabla-jugadores-wrapper {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
}
.tabla-jugadores {
  width:100%;
  border-collapse:collapse;
}
.tabla-jugadores thead {
  background:rgba(255,215,0,0.08);
}
.tabla-jugadores th {
  padding:12px 16px;
  font-family:'Rajdhani',sans-serif;
  font-size:0.85rem;
  letter-spacing:2px;
  color:var(--gold);
  text-transform:uppercase;
  text-align:left;
  border-bottom:1px solid var(--border);
}
.tabla-jugadores td {
  padding:12px 16px;
  border-bottom:1px solid rgba(255,215,0,0.05);
  font-size:0.95rem;
}
.tabla-jugadores tr:last-child td { border-bottom:none; }
.tabla-jugadores tr:hover td { background:rgba(255,215,0,0.03); }

.jugador-row-foto {
  display:flex;
  align-items:center;
  gap:10px;
}
.jugador-row-foto img {
  width:36px; height:36px;
  border-radius:50%;
  object-fit:cover;
  border:1px solid var(--border);
}

.cargando { text-align:center; color:var(--text-dim); padding:24px !important; }

/* Botones de invitación */
.btn-invitar {
  background:linear-gradient(135deg,var(--gold),var(--gold-dark));
  color:#000;
  border:none;
  padding:6px 16px;
  border-radius:8px;
  font-family:'Rajdhani',sans-serif;
  font-size:0.85rem;
  font-weight:700;
  cursor:pointer;
  letter-spacing:1px;
  transition:all 0.2s;
}
.btn-invitar:hover { transform:scale(1.05); }
.btn-invitar.parpadeando { animation: parpadeo 0.6s infinite; }
.btn-invitar:disabled { background:#333; color:#666; cursor:not-allowed; transform:none; animation:none; }

.badge-offline { color:var(--text-dim); font-size:0.8rem; }
.badge-jugando { color:#ff9944; font-size:0.8rem; }

/* ════════════════════════════════════════
   MODALES
   ════════════════════════════════════════ */
.modal-overlay {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.8);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
  padding:20px;
  backdrop-filter:blur(4px);
}

.modal-card {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:20px;
  padding:32px;
  max-width:400px;
  width:100%;
  text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,0.7);
  animation:popIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.modal-icon { font-size:3rem; margin-bottom:12px; }
.modal-card h3 {
  font-family:'Rajdhani',sans-serif;
  font-size:1.3rem;
  font-weight:600;
  margin-bottom:24px;
  line-height:1.4;
}
.modal-btns { display:flex; gap:12px; justify-content:center; }
.modal-btns .btn-gold,
.modal-btns .btn-danger { width:auto; }

/* ════════════════════════════════════════
   VENTANA DEL JUEGO
   ════════════════════════════════════════ */
.juego-card {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:20px;
  padding:24px;
  width:100%;
  max-width:480px;
  box-shadow:0 20px 60px rgba(0,0,0,0.8);
  animation:popIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}

/* Marcadores */
.marcadores {
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:16px;
}
.jugador-info {
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
}
.invitado-info { justify-content:flex-end; }
.jugador-info img {
  width:44px; height:44px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid var(--border);
}
.host-info img { border-color:var(--x-color); }
.invitado-info img { border-color:var(--o-color); }

.jugador-info > div {
  display:flex;
  flex-direction:column;
  gap:2px;
}
.text-right { text-align:right; }
.jugador-rol {
  font-size:0.65rem;
  letter-spacing:2px;
  color:var(--text-dim);
  text-transform:uppercase;
}
.jugador-simbolo {
  font-family:'Rajdhani',sans-serif;
  font-size:1.4rem;
  font-weight:700;
  line-height:1;
}
.host-info .jugador-simbolo { color:var(--x-color); }
.invitado-info .jugador-simbolo { color:var(--o-color); }
.jugador-nombre {
  font-family:'Rajdhani',sans-serif;
  font-size:0.95rem;
  font-weight:600;
}
.marcador-num {
  font-family:'Rajdhani',sans-serif;
  font-size:2rem;
  font-weight:700;
  color:var(--gold);
  line-height:1;
}
.vs-center {
  font-family:'Rajdhani',sans-serif;
  font-size:1.2rem;
  font-weight:700;
  color:var(--text-dim);
  letter-spacing:2px;
}

/* Turno */
.turno-indicador {
  text-align:center;
  padding:8px;
  margin-bottom:12px;
  font-family:'Rajdhani',sans-serif;
  font-size:1rem;
  letter-spacing:1px;
  color:var(--text-dim);
  background:rgba(255,215,0,0.05);
  border-radius:8px;
}

/* Tablero */
.tablero-wrapper {
  display:flex;
  justify-content:center;
  margin-bottom:16px;
}
.tablero {
  display:grid;
  /* Columnas de píxeles fijos — nunca ceden al contenido */
  grid-template-columns: 92px 92px 92px;
  grid-template-rows:    92px 92px 92px;
  gap:8px;
  width:300px;
  height:300px;
  position:relative;
  flex-shrink:0;
}
.celda {
  background:var(--bg-card2);
  border:1px solid var(--border);
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:background 0.15s, border-color 0.15s;
  user-select:none;
  /* Tamaño absolutamente fijo */
  width:92px;
  height:92px;
  overflow:hidden;
  box-sizing:border-box;
}
.celda span {
  font-family:'Rajdhani',sans-serif;
  font-size:3rem;
  font-weight:700;
  line-height:1;
  display:block;
  pointer-events:none;
}
.celda:hover { background:rgba(255,215,0,0.07); border-color:var(--gold); }
.celda.x span { color:var(--x-color); animation:popIn 0.2s ease; }
.celda.o span { color:var(--o-color); animation:popIn 0.2s ease; }
.celda.ganadora { background:rgba(255,215,0,0.12); border-color:var(--gold); }
.celda.bloqueada { cursor:not-allowed; }

/* Línea ganadora SVG */
.linea-ganadora {
  position:absolute;
  inset:0;
  pointer-events:none;
  width:100%;
  height:100%;
}
.linea-ganadora line {
  stroke-dasharray:400;
  stroke-dashoffset:400;
  animation:drawLine 0.5s ease forwards;
}

/* Botones juego */
.juego-botones {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.juego-botones .btn-gold,
.juego-botones .btn-danger {
  flex:1;
  min-width:120px;
  font-size:0.85rem;
  padding:10px 12px;
}

/* Mensaje del juego */
.juego-mensaje {
  margin-top:12px;
  padding:12px 16px;
  background:rgba(255,215,0,0.1);
  border:1px solid rgba(255,215,0,0.3);
  border-radius:10px;
  text-align:center;
  font-family:'Rajdhani',sans-serif;
  font-size:1rem;
  color:var(--gold);
  line-height:1.4;
}
.juego-mensaje.win { background:rgba(68,255,136,0.1); border-color:rgba(68,255,136,0.3); color:var(--success); }
.juego-mensaje.lose { background:rgba(255,68,85,0.1); border-color:rgba(255,68,85,0.3); color:var(--danger); }

/* ════════════════════════════════════════
   MINIPLAYER
   ════════════════════════════════════════ */
.miniplayer {
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  height:64px;
  background:var(--bg-card);
  border-top:1px solid var(--border);
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 16px;
  z-index:500;
  box-shadow:0 -4px 20px rgba(0,0,0,0.4);
}

.mp-btn {
  background:linear-gradient(135deg,var(--gold),var(--gold-dark));
  color:#000;
  border:none;
  width:40px; height:40px;
  border-radius:50%;
  font-size:1rem;
  cursor:pointer;
  font-weight:700;
  flex-shrink:0;
  transition:transform 0.15s;
}
.mp-btn:hover { transform:scale(1.1); }

.mp-generos-btn {
  border-radius:20px;
  width:auto;
  padding:0 14px;
  font-family:'Rajdhani',sans-serif;
  font-size:0.8rem;
  letter-spacing:1px;
  flex-shrink:0;
}

.mp-info {
  flex:1;
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
  overflow:hidden;
}
.mp-titulo {
  font-size:0.8rem;
  color:var(--text-dim);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.mp-progress-bar {
  position:relative;
  height:4px;
  background:rgba(255,215,0,0.15);
  border-radius:2px;
}
.mp-progress-fill {
  height:100%;
  background:var(--gold);
  border-radius:2px;
  width:0%;
  pointer-events:none;
}
.mp-seek {
  position:absolute;
  inset:0;
  width:100%;
  opacity:0;
  cursor:pointer;
  height:100%;
}
.mp-tiempo {
  font-size:0.7rem;
  color:var(--text-dim);
}

/* Panel géneros */
.mp-generos-panel {
  position:absolute;
  bottom:70px;
  right:16px;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:20px;
  width:320px;
  max-height:400px;
  overflow-y:auto;
  box-shadow:var(--shadow);
  z-index:600;
}
.mp-generos-panel h4 {
  font-family:'Rajdhani',sans-serif;
  font-size:1rem;
  color:var(--gold);
  margin-bottom:14px;
  letter-spacing:1px;
}
.generos-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-bottom:14px;
}
.genero-item {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:0.85rem;
  cursor:pointer;
  padding:6px 8px;
  border-radius:8px;
  transition:background 0.15s;
}
.genero-item:hover { background:rgba(255,215,0,0.08); }
.genero-item input[type=checkbox] {
  accent-color:var(--gold);
  width:16px; height:16px;
}

/* ════════════════════════════════════════
   ANIMACIONES
   ════════════════════════════════════════ */
@keyframes fadeDown {
  from { opacity:0; transform:translateY(-20px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes fadeUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes popIn {
  from { opacity:0; transform:scale(0.8); }
  to   { opacity:1; transform:scale(1); }
}
@keyframes parpadeo {
  0%,100% { opacity:1; }
  50%      { opacity:0.3; }
}
@keyframes drawLine {
  to { stroke-dashoffset:0; }
}

/* ═══ RESPONSIVE ══════════════════════── */
@media (max-width:480px) {

  /* ── LOBBY TABLA MÓVIL ────────────────── */
  /* Mostrar todas las columnas en móvil, ajustar tamaño */
  .tabla-jugadores th,
  .tabla-jugadores td { padding:8px 6px; font-size:0.82rem; }

  .tabla-jugadores th:nth-child(2),
  .tabla-jugadores th:nth-child(3) { font-size:0.75rem; letter-spacing:1px; }

  .tabla-jugadores td:nth-child(2),
  .tabla-jugadores td:nth-child(3) { font-size:0.9rem; text-align:center; }

  .jugador-row-foto span { font-size:0.82rem; }

  .btn-invitar {
    padding:8px 12px;
    font-size:0.8rem;
    white-space:nowrap;
  }

  /* ── MARCADORES MÓVIL ────────────────── */
  .marcadores {
    flex-direction:row;
    align-items:center;
    gap:6px;
    flex-wrap:nowrap;
  }
  .jugador-info {
    flex:1;
    gap:6px;
    min-width:0;
  }
  .jugador-info img {
    width:32px; height:32px;
    flex-shrink:0;
  }
  .jugador-info > div { gap:1px; }
  .jugador-rol { font-size:0.55rem; letter-spacing:1px; }
  .jugador-simbolo { font-size:1.1rem; }
  .jugador-nombre {
    font-size:0.75rem;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:70px;
  }
  .marcador-num { font-size:1.5rem; }
  .vs-center { font-size:0.9rem; flex-shrink:0; }

  /* ── TABLERO MÓVIL ───────────────────── */
  .tablero {
    width:260px; height:260px;
    grid-template-columns: 78px 78px 78px;
    grid-template-rows:    78px 78px 78px;
  }
  .celda { width:78px; height:78px; }
  .celda span { font-size:2.5rem; }

  /* ── JUEGO CARD MÓVIL ────────────────── */
  .juego-card { padding:16px 12px; }
  .juego-botones .btn-gold,
  .juego-botones .btn-danger { font-size:0.75rem; padding:8px 8px; }

  /* ── LOBBY HEADER MÓVIL ──────────────── */
  .user-stats { gap:12px; }
  .lobby-header { gap:10px; padding:12px; }

  /* ── GÉNEROS PANEL ───────────────────── */
  .mp-generos-panel { width:calc(100vw - 32px); right:0; left:0; margin:0 16px; }
}

/* ── MODAL FOTO PERFIL ────────────────────── */
.modal-foto-preview {
  display:flex;
  justify-content:center;
  margin-bottom:4px;
}
.modal-foto-preview img {
  width:120px; height:120px;
  border-radius:50%;
  object-fit:cover;
  object-position:center;
  border:3px solid var(--gold);
  box-shadow:0 0 20px var(--gold-glow);
}

/* ── FOTO LOADING — GAME STYLE ───────────── */
.foto-loading {
  margin-top:16px;
  text-align:center;
}
.foto-loading-label {
  font-family:'Rajdhani',sans-serif;
  font-size:0.95rem;
  font-weight:700;
  color:var(--gold);
  letter-spacing:2px;
  margin-bottom:8px;
}
.foto-loading-bar {
  position:relative;
  height:20px;
  background:rgba(255,215,0,0.1);
  border:1px solid var(--gold);
  border-radius:4px;
  overflow:hidden;
  margin-bottom:8px;
}
.foto-loading-fill {
  height:100%;
  width:0%;
  background:linear-gradient(90deg, #FFD700, #ff9900, #FFD700);
  background-size:200% 100%;
  animation:goldShimmer 1s infinite linear;
  transition:width 0.3s ease;
  border-radius:3px;
}
.foto-loading-pixels {
  position:absolute;
  inset:0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    rgba(0,0,0,0.2) 8px,
    rgba(0,0,0,0.2) 9px
  );
}
.foto-loading-msg {
  font-size:0.75rem;
  color:var(--text-dim);
  letter-spacing:1px;
  font-family:'Rajdhani',sans-serif;
}
@keyframes goldShimmer {
  0%   { background-position:200% 0; }
  100% { background-position:-200% 0; }
}

/* ── BOTÓN ROTAR FOTO ─────────────────────── */
.btn-rotar {
  background:rgba(255,215,0,0.1);
  border:1px solid var(--gold);
  color:var(--gold);
  padding:8px 24px;
  border-radius:8px;
  font-family:'Rajdhani',sans-serif;
  font-size:1rem;
  font-weight:700;
  cursor:pointer;
  letter-spacing:1px;
  transition:all 0.2s;
}
.btn-rotar:hover { background:rgba(255,215,0,0.2); }

/* ══════════════════════════════════════════
   CHAT DEL JUEGO
══════════════════════════════════════════ */
.chat-juego {
  margin-top:12px;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:rgba(0,0,0,0.2);
}
.chat-mensajes {
  height:120px;
  overflow-y:auto;
  padding:8px 10px;
  display:flex;
  flex-direction:column;
  gap:4px;
  scroll-behavior:smooth;
}
.chat-mensajes::-webkit-scrollbar { width:4px; }
.chat-mensajes::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }

.chat-msg {
  font-family:'Exo 2', sans-serif;
  font-size:0.8rem;
  line-height:1.3;
  padding:3px 8px;
  border-radius:8px;
  max-width:85%;
  word-break:break-word;
}
.chat-msg.mio {
  background:rgba(255,215,0,0.12);
  border:1px solid rgba(255,215,0,0.2);
  align-self:flex-end;
  color:var(--text);
}
.chat-msg.suyo {
  background:rgba(68,170,255,0.1);
  border:1px solid rgba(68,170,255,0.2);
  align-self:flex-start;
  color:var(--text);
}
.chat-msg.sistema {
  background:transparent;
  color:var(--text-dim);
  font-style:italic;
  font-size:0.72rem;
  align-self:center;
  border:none;
}
.chat-msg .chat-autor {
  font-weight:700;
  font-size:0.7rem;
  margin-bottom:1px;
  opacity:0.7;
}
.chat-input-row {
  display:flex;
  border-top:1px solid var(--border);
}
.chat-input {
  flex:1;
  background:transparent;
  border:none;
  outline:none;
  padding:8px 12px;
  color:var(--text);
  font-family:'Exo 2', sans-serif;
  font-size:0.85rem;
}
.chat-input::placeholder { color:var(--text-dim); }
.chat-send-btn {
  background:rgba(255,215,0,0.1);
  border:none;
  border-left:1px solid var(--border);
  color:var(--gold);
  padding:8px 14px;
  cursor:pointer;
  font-size:1rem;
  transition:background 0.15s;
}
.chat-send-btn:hover { background:rgba(255,215,0,0.2); }

@media (max-width:480px) {
  .chat-mensajes { height:90px; }
}

/* ═══════════════════════════════════════════════════ */
/*  HISTORIAL MODAL                                   */
/* ═══════════════════════════════════════════════════ */
.stat-clickable {
  cursor: pointer;
  transition: transform 0.15s;
}
.stat-clickable:hover .stat-num {
  color: #fff;
  text-shadow: 0 0 12px var(--gold);
}
.stat-clickable:hover {
  transform: scale(1.08);
}

.modal-historial {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-historial.hidden { display: none; }

.historial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.historial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.historial-header h2 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 2px;
  color: var(--gold);
  margin: 0;
}
.historial-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.historial-close:hover { color: var(--gold); }

.historial-lista {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.historial-cargando,
.historial-vacio {
  text-align: center;
  color: var(--text-dim);
  padding: 32px;
  font-size: 0.95rem;
}

.historial-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,215,0,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  gap: 12px;
}
.historial-rival {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.historial-rival img {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.historial-rival-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.historial-rival-nombre {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.historial-fecha {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ── TABLERO MINI ─────────────────────── */
.tablero-mini {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 2px;
  flex-shrink: 0;
}
.celda-mini {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}
.celda-mini.x { color: var(--gold); border-color: rgba(255,215,0,0.3); }
.celda-mini.o { color: #44aaff;     border-color: rgba(68,170,255,0.3); }
.tablero-mini-vacio {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

@media (max-width: 480px) {
  .historial-card { max-height: 85vh; border-radius: 16px; }
  .historial-rival-nombre { font-size: 0.9rem; }
  .tablero-mini { grid-template-columns: repeat(3, 24px); grid-template-rows: repeat(3, 24px); }
  .celda-mini { width: 24px; height: 24px; font-size: 0.75rem; }
}

/* ── OJO PASSWORD ─────────────────────────── */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-password-wrap input {
  width: 100%;
  padding-right: 44px !important;
}
.ojo-btn {
  position: absolute;
  right: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  user-select: none;
}
.ojo-btn:hover { opacity: 1; }
.ojo-btn.activo { opacity: 1; filter: drop-shadow(0 0 4px var(--gold)); }
