/* =============================================
   PUNTAJE PRO — Leandrouno
   Sistema de diseño con tema claro/oscuro
   (clases y nombres en español)
============================================= */

:root {
  --bg: #0b0f1a;
  --bg-radial: radial-gradient(circle at 50% -10%, #131b2e 0%, #0b0f1a 55%);
  --surface: #131a2a;
  --surface-2: #1a2236;
  --surface-3: #212b42;
  --border: #2a3450;
  --border-soft: #1e273c;
  --accent: #c9992f;
  --accent-bright: #e6b84f;
  --accent-dim: #7a5f22;
  --accent-ink: #17130a;
  --text: #eef1f8;
  --text-muted: #8b93ac;
  --text-faint: #545f7d;
  --success: #35d68e;
  --danger: #ef5757;
  --warning: #f0b429;
  --grid-opacity: 0.035;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-lift: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono: 'Space Grotesk', 'Inter', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
}

:root[data-theme="claro"] {
  --bg: #f3f4f8;
  --bg-radial: radial-gradient(circle at 50% -10%, #ffffff 0%, #f3f4f8 60%);
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #ebedf4;
  --border: #dde1eb;
  --border-soft: #e6e9f1;
  --accent: #b3801f;
  --accent-bright: #c9992f;
  --accent-dim: #8a6a24;
  --accent-ink: #ffffff;
  --text: #171b2b;
  --text-muted: #5c657e;
  --text-faint: #9098ac;
  --success: #17a874;
  --danger: #dd3f3f;
  --warning: #c9862a;
  --grid-opacity: 0.05;
  --shadow-lift: 0 16px 40px -22px rgba(30, 35, 60, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-radial), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* textura sutil de grilla para dar profundidad */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 70%);
  z-index: 0;
}

.contenedor-app {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 18px 0;
}

/* ---------- ENCABEZADO ---------- */
.encabezado-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
}

.marca {
  display: flex;
  align-items: center;
  gap: 14px;
}

.marca-icono {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  box-shadow: 0 8px 20px -6px rgba(201, 153, 47, 0.45);
  flex-shrink: 0;
}

.marca-texto h1 {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 3px;
  margin: 0;
  line-height: 1;
  color: var(--text);
}

.marca-texto p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.boton-icono-encabezado {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.boton-icono-encabezado:hover {
  color: var(--accent-bright);
  border-color: var(--accent-dim);
}

/* ---------- DISTRIBUCIÓN ---------- */
.distribucion {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 760px) {
  .distribucion {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
  .distribucion.una-columna {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin: 0 auto;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px 20px 24px;
  box-shadow: var(--shadow-lift);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.oculto {
  display: none !important;
}

.panel-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-tiempo .panel-cabecera { cursor: pointer; user-select: none; }

.panel-cabecera h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1.5px;
  margin: 0;
  color: var(--text);
}

.contador-jugadores {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-bright);
  background: rgba(201, 153, 47, 0.12);
  border: 1px solid rgba(201, 153, 47, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
}

.boton-flecha {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.2s ease;
  flex-shrink: 0;
}

.boton-flecha i { transition: transform 0.3s ease; }
.boton-flecha.rotado i { transform: rotate(180deg); }
.boton-flecha:hover { color: var(--accent-bright); }

/* ---------- CONTENIDO DEL TEMPORIZADOR (plegable) ---------- */
.contenido-temporizador {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}

.contenido-temporizador.abierto {
  max-height: 640px;
  opacity: 1;
  margin-top: 20px;
}

.panel-jugadores .panel-cabecera { margin-bottom: 18px; }

/* ---------- SELECTOR DE MODO (tabs) ---------- */
.selector-modo {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  width: 100%;
}

.boton-modo {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.boton-modo:hover { color: var(--text); }

.boton-modo.activo {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 10px -4px rgba(0, 0, 0, 0.3);
}

/* ---------- TEMPORIZADOR — estilo tipográfico limpio ---------- */
.pantalla-tiempo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 24px 0 4px;
  padding: 26px 14px 20px;
}

.estado-temporizador {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.estado-temporizador .punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.estado-temporizador.corriendo .punto {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(53, 214, 142, 0.18);
}

.estado-temporizador.corriendo { color: var(--success); }

.estado-temporizador.finalizado .punto {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 87, 87, 0.18);
}

.estado-temporizador.finalizado { color: var(--danger); }

.valor-temporizador {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(46px, 13vw, 72px);
  letter-spacing: 2px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.pantalla-tiempo.esta-finalizado .valor-temporizador { color: var(--danger); }

.progreso-temporizador {
  width: 100%;
  max-width: 320px;
  height: 5px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 4px;
  display: none;
}

.progreso-temporizador.visible { display: block; }

.progreso-temporizador-relleno {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: var(--accent-bright);
  transition: width 0.25s linear, background 0.25s ease;
}

.pantalla-tiempo.esta-finalizado .progreso-temporizador-relleno { background: var(--danger); }

/* ---------- CONFIGURACIÓN DE CUENTA REGRESIVA ---------- */
.configuracion-cuenta-regresiva {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 6px;
}

.configuracion-cuenta-regresiva.visible { display: flex; }

.chips-preestablecidos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.ficha {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ficha:hover, .ficha.activo {
  color: var(--accent-ink);
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

.tiempo-personalizado {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tiempo-personalizado input {
  width: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
}

.tiempo-personalizado span { color: var(--text-faint); font-family: var(--font-mono); }

/* ---------- CONTROLES / BOTONES ---------- */
.controles-tiempo {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.boton {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.2px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.boton:active { transform: scale(0.97); }
.boton:disabled { opacity: 0.4; cursor: not-allowed; }

.boton-primario {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
  box-shadow: 0 8px 18px -8px rgba(201, 153, 47, 0.5);
}

.boton-contorno {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.boton-contorno:hover { border-color: var(--accent-dim); color: var(--accent-bright); }

.boton-peligro-fantasma {
  background: transparent;
  color: var(--danger);
  border-color: rgba(239, 87, 87, 0.35);
}
.boton-peligro-fantasma:hover { background: rgba(239, 87, 87, 0.1); }

.boton-fantasma {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-soft);
  font-size: 12.5px;
  padding: 8px 14px;
}
.boton-fantasma:hover { border-color: var(--accent-dim); }

.boton-texto {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  justify-content: center;
  padding: 8px 10px;
}
.boton-texto:hover { color: var(--text); }
.boton-texto.peligro:hover { color: var(--danger); }

.acciones-reinicio {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.acciones-reinicio .boton-texto { flex: 1; }

/* ---------- JUGADORES ---------- */
.lista-jugadores {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
}

.lista-jugadores::-webkit-scrollbar { width: 6px; }
.lista-jugadores::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }

.tarjeta-jugador {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tarjeta-jugador.es-lider {
  border-color: rgba(201, 153, 47, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 153, 47, 0.15), 0 8px 20px -12px rgba(201, 153, 47, 0.45);
}

.avatar-jugador {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  position: relative;
}

.tarjeta-jugador.es-lider .avatar-jugador::after {
  content: "\f521";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: -9px;
  right: -6px;
  font-size: 11px;
  color: var(--accent-bright);
  background: var(--surface);
  border-radius: 50%;
  padding: 2px;
}

.info-jugador {
  flex: 1;
  min-width: 0;
}

.nombre-jugador {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.puntaje-jugador {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent-bright);
  line-height: 1.1;
}

.acciones-jugador {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.input-cantidad {
  width: 44px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 2px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
}

.boton-icono {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: var(--surface-3);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.boton-icono:active { transform: scale(0.92); }
.boton-icono.sumar:hover { background: var(--success); color: #08130e; border-color: var(--success); }
.boton-icono.restar:hover { background: var(--warning); color: #1a1200; border-color: var(--warning); }
.boton-icono.reiniciar:hover { background: var(--surface); color: var(--accent-bright); }
.boton-icono.eliminar:hover { background: var(--danger); color: #1a0808; border-color: var(--danger); }

.estado-vacio {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 10px;
  color: var(--text-faint);
}

.estado-vacio.visible { display: flex; }
.estado-vacio i { font-size: 26px; opacity: 0.5; }
.estado-vacio p { margin: 0; font-size: 13px; }

.agregar-jugador {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.agregar-jugador input {
  flex: 1;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}

.agregar-jugador input:focus, .tiempo-personalizado input:focus {
  outline: none;
  border-color: var(--accent-dim);
}

/* ---------- MODAL DE CONFIGURACIÓN ---------- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-fondo.abierto { display: flex; }

.modal-caja {
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 20px;
}

.modal-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-cabecera h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
}

.fila-configuracion {
  margin-bottom: 16px;
}

.fila-configuracion:last-child { margin-bottom: 0; }

.fila-configuracion label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.segmentado {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.boton-segmento {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.boton-segmento.activo {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
}

.ayuda-configuracion {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.4;
}

.selector-sonido {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.selector-sonido:focus { outline: none; border-color: var(--accent-dim); }

.fila-sonido-acciones {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.fila-sonido-acciones .boton { flex: 1; justify-content: center; }

/* ---------- PIE ---------- */
footer.pie-app {
  margin-top: 40px;
  padding: 22px 10px 10px;
  text-align: center;
  border-top: 1px solid var(--border-soft);
}

footer.pie-app .marca-pie {
  font-family: var(--font-display);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

footer.pie-app .marca-pie:hover { color: var(--accent-bright); }

.social-pie {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.boton-social {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  text-decoration: none;
}

.boton-social:hover {
  color: var(--accent-ink);
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

/* ---------- MÓVIL ---------- */
@media (max-width: 480px) {
  .contenedor-app { padding: 22px 12px 0; }
  .controles-tiempo .boton { flex: 1 1 auto; justify-content: center; }
  .marca-texto h1 { font-size: 26px; }
}