/* ==========================================================================
   ESTILOS APP CRONÓMETRO SINCRONIZADO · CLUB ATLETISMO PINTO
   ========================================================================== */

:root {
  /* Colores Corporativos Oficiales Club Atletismo Pinto */
  --azul: #0f2b5c;
  --azul-claro: #1d4ed8;
  --rojo: #dc2626;
  --blanco: #ffffff;
  --gris-fondo: #f8fafc;

  /* Colores Semánticos y Variantes de Interfaz */
  --gris-borde: #e2e8f0;
  --gris-hover: #f1f5f9;
  --texto-oscuro: #1e293b;
  --texto-suave: #64748b;
  --rojo-hover: #b91c1c;
  --azul-hover: #1e40af;
  --azul-claro-hover: #2563eb;
  --verde-exito: #16a34a;
  --verde-hover: #15803d;
  --amarillo-vuelta: #d97706;
  --amarillo-hover: #b45309;

  /* Tipografías */
  --fuente-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fuente-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body.crono-app-body {
  background-color: var(--gris-fondo);
  color: var(--texto-oscuro);
  font-family: var(--fuente-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Cabecera de la App --- */
.crono-app-header {
  height: 64px;
  background-color: var(--blanco);
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(15, 43, 92, 0.05);
}

.crono-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-volver-web {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--azul);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  transition: all 0.2s ease;
}

.btn-volver-web:hover {
  background: #eff6ff;
  border-color: var(--azul-claro);
  color: var(--azul-claro);
}

.crono-brand-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crono-mini-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gris-borde);
}

.crono-mini-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--azul);
}

.crono-mini-title span {
  color: var(--rojo);
}

.crono-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crono-tool-btn {
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  color: var(--texto-suave);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.crono-tool-btn:hover {
  color: var(--azul);
  border-color: var(--azul);
  background: var(--blanco);
}

.crono-tool-btn.activo {
  color: var(--azul-claro);
  border-color: var(--azul-claro);
  background: #eff6ff;
}

/* --- Main y Secciones --- */
.crono-app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.crono-seccion {
  display: none;
  animation: fadeInApp 0.3s ease;
  width: 100%;
}

.crono-seccion.activa {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@keyframes fadeInApp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   VISTA 1: SELECCIÓN DE OPCIONES (CREAR / SINCRONIZAR)
   ========================================================================== */
.crono-hero-intro {
  text-align: center;
  margin: 1rem 0 2rem;
}

.crono-tag {
  display: inline-block;
  background-color: #fee2e2;
  color: var(--rojo);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.crono-hero-intro h1 {
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--azul);
  margin-bottom: 0.6rem;
}

.crono-hero-intro h1 span {
  color: var(--rojo);
}

.crono-intro-sub {
  color: var(--texto-suave);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.opciones-inicio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.opcion-card {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 16px;
  padding: 2.2rem 1.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 6px 20px rgba(15, 43, 92, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.opcion-card:hover {
  transform: translateY(-4px);
  border-color: var(--azul-claro);
  box-shadow: 0 12px 28px rgba(15, 43, 92, 0.1);
}

.opcion-icono {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.icono-crear {
  background: #fee2e2;
  color: var(--rojo);
}

.icono-sync {
  background: #eff6ff;
  color: var(--azul-claro);
}

.opcion-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  color: var(--azul);
}

.opcion-card p {
  color: var(--texto-suave);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 1.75rem;
  flex-grow: 1;
}

.btn-opcion {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.9rem 1.25rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-crear {
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-hover) 100%);
  color: var(--blanco);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.3);
}

.btn-crear:hover {
  background: linear-gradient(135deg, #ef4444 0%, var(--rojo) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.45);
}

.btn-sincronizar {
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--azul) 100%);
  color: var(--blanco);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.3);
}

.btn-sincronizar:hover {
  background: linear-gradient(135deg, var(--azul-claro-hover) 0%, var(--azul-claro) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.45);
}

.crono-delay-info-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: var(--azul);
  font-size: 0.88rem;
  line-height: 1.5;
}

.pill-spark {
  font-size: 1.15rem;
  color: var(--azul-claro);
  flex-shrink: 0;
}

/* ==========================================================================
   VISTA 2A: ESPERANDO SINCRONIZACIÓN (CREADOR)
   ========================================================================== */
.espera-card {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 20px;
  padding: 2.5rem 1.75rem;
  max-width: 620px;
  width: 100%;
  margin: 1.5rem auto;
  box-shadow: 0 10px 30px rgba(15, 43, 92, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.espera-step-badge {
  display: inline-block;
  background: #eff6ff;
  color: var(--azul-claro);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  margin-bottom: 0.75rem;
}

.espera-header h2 {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--azul);
  margin-bottom: 0.5rem;
}

.espera-header p {
  color: var(--texto-suave);
  font-size: 0.95rem;
  max-width: 480px;
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

/* Contenedor del Código de 6 Letras */
.codigo-display-container {
  width: 100%;
  margin-bottom: 2rem;
}

.codigo-letras-wrapper {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.letra-box {
  width: clamp(44px, 11vw, 64px);
  height: clamp(54px, 13vw, 78px);
  background: #eff6ff;
  border: 2px solid var(--azul-claro);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fuente-mono);
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 900;
  color: var(--azul);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.12);
  text-transform: uppercase;
}

.codigo-acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.btn-codigo-accion {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  color: var(--azul);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-codigo-accion:hover {
  background: #eff6ff;
  border-color: var(--azul-claro);
  color: var(--azul-claro);
}

.btn-whatsapp {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

.btn-whatsapp:hover {
  background: #d1fae5;
  border-color: #059669;
}

/* Radar de Espera */
.radar-espera-box {
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.radar-pulso {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulso-centro {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-claro) 100%);
  color: var(--blanco);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 0 16px rgba(29, 78, 216, 0.4);
}

.pulso-onda {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--azul-claro);
  animation: radarWave 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.onda-2 {
  animation-delay: 1.2s;
}

@keyframes radarWave {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

.radar-texto strong {
  display: block;
  font-size: 0.95rem;
  color: var(--azul);
  margin-bottom: 0.35rem;
}

.radar-texto p {
  color: var(--texto-suave);
  font-size: 0.85rem;
  line-height: 1.45;
}

.btn-cancelar {
  background: transparent;
  border: none;
  color: var(--texto-suave);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: color 0.2s ease;
}

.btn-cancelar:hover {
  color: var(--rojo);
}

/* ==========================================================================
   VISTA 2B: INTRODUCIR CÓDIGO (JOINER)
   ========================================================================== */
.form-unirse-codigo {
  width: 100%;
  max-width: 420px;
  margin-bottom: 1.5rem;
}

.input-codigo-wrapper {
  margin-bottom: 1.25rem;
}

#input-codigo-sesion {
  width: 100%;
  height: 76px;
  background: #eff6ff;
  border: 2px solid var(--azul-claro);
  border-radius: 14px;
  color: var(--azul);
  font-family: var(--fuente-mono);
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: 12px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  box-shadow: 0 4px 15px rgba(29, 78, 216, 0.1);
  transition: all 0.2s ease;
}

#input-codigo-sesion:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.2);
}

.btn-conectar-grande {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, var(--azul-claro) 0%, var(--azul) 100%);
  color: var(--blanco);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 43, 92, 0.25);
  transition: all 0.2s ease;
}

.btn-conectar-grande:hover {
  background: linear-gradient(135deg, var(--azul-claro-hover) 0%, var(--azul-claro) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 43, 92, 0.35);
}

.btn-conectar-grande:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.unirse-feedback {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.unirse-feedback.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: var(--rojo);
}

.unirse-feedback.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--azul);
}

/* ==========================================================================
   VISTA 3: CRONÓMETRO ACTIVO Y SINCRONIZADO
   ========================================================================== */
.sesion-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 12px;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 6px rgba(15, 43, 92, 0.04);
  flex-wrap: wrap;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sesion-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--gris-fondo);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--gris-borde);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--texto-suave);
  transition: all 0.2s ease;
}

.sesion-code-pill strong {
  font-family: var(--fuente-mono);
  color: var(--azul);
  letter-spacing: 1px;
}

.sesion-code-pill:hover {
  border-color: var(--azul-claro);
}

.sesion-peer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 0.25s ease;
}

/* Estados de conexión del peer (Requisito 4) */
.peer-status-ok {
  color: var(--verde-exito) !important;
}

.peer-status-ok .peer-dot-live {
  background-color: var(--verde-exito) !important;
  box-shadow: 0 0 8px var(--verde-exito) !important;
  animation: pulsoPeer 2s infinite !important;
}

.peer-status-warning {
  color: var(--amarillo-vuelta) !important;
}

.peer-status-warning .peer-dot-live {
  background-color: #f59e0b !important;
  box-shadow: 0 0 10px #f59e0b !important;
  animation: parpadeoWarning 0.8s infinite alternate !important;
}

.peer-status-error {
  color: var(--rojo) !important;
}

.peer-status-error .peer-dot-live {
  background-color: var(--rojo) !important;
  box-shadow: 0 0 8px var(--rojo) !important;
  animation: none !important;
}

.peer-dot-live {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--verde-exito);
  box-shadow: 0 0 6px var(--verde-exito);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

@keyframes pulsoPeer {
  0% { transform: scale(0.9); opacity: 0.75; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.75; }
}

@keyframes parpadeoWarning {
  0% { opacity: 0.25; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.25); }
}

/* Deshabilitación temporal de controles durante desincronización */
.crono-controles-deshabilitados {
  opacity: 0.45 !important;
  pointer-events: none !important;
  filter: grayscale(0.5) !important;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.pill-delay {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  color: var(--azul-claro);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-delay:hover {
  background: #dbeafe;
}

.delay-lightning {
  color: var(--azul-claro);
}

.btn-desconectar {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: var(--rojo);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-desconectar:hover {
  background: var(--rojo);
  color: var(--blanco);
}

/* Banner de Notificación de Acciones Recientes */
.banner-accion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 0.85rem;
  animation: slideDownBanner 0.25s ease;
  transition: all 0.25s ease;
}

.banner-accion.banner-warning {
  background: #fef3c7 !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

.banner-accion.banner-error {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: var(--rojo) !important;
}

.banner-accion.banner-success {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #065f46 !important;
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cockpit del Cronómetro */
.cronometro-cockpit {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 20px;
  padding: 2.2rem 1.5rem 1.8rem;
  box-shadow: 0 10px 30px rgba(15, 43, 92, 0.08);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crono-display-principal {
  text-align: center;
  margin-bottom: 2rem;
  width: 100%;
}

.crono-numeros-container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--fuente-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.crono-digito {
  font-size: clamp(3.8rem, 13vw, 6.2rem);
  font-weight: 800;
  color: var(--azul);
  min-width: 1.15ch;
  text-align: center;
}

.crono-separador, .crono-punto {
  font-size: clamp(3.2rem, 10vw, 5.2rem);
  font-weight: 700;
  color: var(--texto-suave);
  margin: 0 0.05ch;
}

.crono-digito-centesimas {
  font-size: clamp(2.6rem, 8.5vw, 4.2rem);
  font-weight: 800;
  color: var(--azul-claro);
  min-width: 1.15ch;
  text-align: left;
}

.crono-subtimer-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  border-radius: 50px;
  padding: 0.45rem 1.2rem;
  margin-top: 1rem;
  font-family: var(--fuente-mono);
}

.subtimer-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--texto-suave);
  letter-spacing: 1px;
}

.subtimer-valor {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--rojo);
}

/* Botones de Control del Cronómetro (Grandes para pista) */
.crono-botones-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.crono-botones-grid.con-reiniciar {
  grid-template-columns: 1.2fr 1fr 1fr;
}

.btn-crono-grande {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: clamp(80px, 12vw, 96px);
  border-radius: 16px;
  border: none;
  font-family: var(--fuente-sans);
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 18px rgba(15, 43, 92, 0.12);
}

.btn-crono-grande:active {
  transform: scale(0.96);
}

.btn-crono-grande:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

/* Estado: Iniciar (Verde atlético) */
.btn-estado-iniciar {
  background: linear-gradient(135deg, var(--verde-exito) 0%, var(--verde-hover) 100%);
  color: var(--blanco);
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
}

.btn-estado-iniciar:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e 0%, var(--verde-exito) 100%);
  box-shadow: 0 10px 26px rgba(22, 163, 74, 0.45);
}

/* Estado: Parar (Rojo de Pinto) */
.btn-estado-parar {
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-hover) 100%);
  color: var(--blanco);
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.35);
}

.btn-estado-parar:hover:not(:disabled) {
  background: linear-gradient(135deg, #ef4444 0%, var(--rojo) 100%);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.45);
}

/* Botón: Vuelta / Serie (Ámbar dorado) */
.btn-estado-vuelta {
  background: linear-gradient(135deg, var(--amarillo-vuelta) 0%, var(--amarillo-hover) 100%);
  color: var(--blanco);
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.3);
}

.btn-estado-vuelta:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b 0%, var(--amarillo-vuelta) 100%);
  box-shadow: 0 10px 26px rgba(217, 119, 6, 0.4);
}

/* Botón: Reiniciar (Gris neutro) */
.btn-estado-reiniciar {
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  color: var(--azul);
}

.btn-estado-reiniciar:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: var(--azul);
}

/* ==========================================================================
   SECCIÓN DE VUELTAS / SERIES
   ========================================================================== */
.seccion-vueltas-contenedor {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(15, 43, 92, 0.05);
}

.vueltas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gris-borde);
  margin-bottom: 1rem;
}

.vueltas-titulo-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.vueltas-titulo-wrapper h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--azul);
}

.vueltas-badge-count {
  background: var(--azul);
  color: var(--blanco);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 50px;
}

.vueltas-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-vueltas-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  color: var(--azul);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-vueltas-mini:hover {
  background: #eff6ff;
  border-color: var(--azul-claro);
  color: var(--azul-claro);
}

.btn-danger-mini {
  color: var(--rojo);
  border-color: #fca5a5;
  background: #fee2e2;
}

.btn-danger-mini:hover {
  background: var(--rojo);
  color: var(--blanco);
}

/* Métricas Rápidas */
.vueltas-metricas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.metrica-card {
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  text-align: center;
}

.metrica-label {
  display: block;
  font-size: 0.72rem;
  color: var(--texto-suave);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  font-weight: 700;
}

.metrica-val {
  display: block;
  font-family: var(--fuente-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--azul);
}

#metrica-mejor-serie {
  color: var(--verde-exito);
}

/* Tabla de Vueltas */
.tabla-vueltas-wrapper {
  overflow-x: auto;
  max-height: 380px;
  border-radius: 8px;
}

.vueltas-vacio {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--texto-suave);
  font-size: 0.9rem;
  line-height: 1.5;
}

.vueltas-vacio strong {
  color: var(--azul);
}

.tabla-vueltas {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.tabla-vueltas th {
  padding: 0.75rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gris-borde);
}

.tabla-vueltas td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--gris-borde);
  font-family: var(--fuente-mono);
}

.tabla-vueltas tr:last-child td {
  border-bottom: none;
}

.tabla-vueltas tr.fila-mejor-serie {
  background: #f0fdf4;
  color: var(--verde-exito);
}

.badge-mejor-lap {
  display: inline-block;
  background: #dcfce7;
  color: var(--verde-exito);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.4rem;
}

.dispositivo-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--fuente-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--texto-suave);
  background: var(--gris-fondo);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--gris-borde);
}

/* ==========================================================================
   MODAL DE DIAGNÓSTICO DE DELAY Y RETARDO
   ========================================================================== */
.crono-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeInModal 0.2s ease;
}

.crono-modal.hidden {
  display: none;
}

.crono-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 43, 92, 0.4);
  backdrop-filter: blur(4px);
}

.crono-modal-contenido {
  position: relative;
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(15, 43, 92, 0.25);
  z-index: 2;
}

.modal-cabecera {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.modal-icono-delay {
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--azul-claro);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-cabecera h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--azul);
}

.modal-sub {
  color: var(--texto-suave);
  font-size: 0.82rem;
}

.modal-btn-cerrar {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  color: var(--texto-suave);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.modal-btn-cerrar:hover {
  color: var(--rojo);
}

.delay-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.delay-stat-item {
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.stat-titulo {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--texto-suave);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.stat-numero {
  font-family: var(--fuente-mono);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--azul);
  margin-bottom: 0.2rem;
}

.stat-numero.color-verde {
  color: var(--verde-exito);
}

.stat-desc {
  font-size: 0.72rem;
  color: var(--texto-suave);
}

.delay-explicacion-caja {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.delay-explicacion-caja h4 {
  font-size: 0.88rem;
  color: var(--azul);
  margin-bottom: 0.4rem;
}

.delay-explicacion-caja p {
  color: var(--texto-oscuro);
  font-size: 0.82rem;
  line-height: 1.5;
}

.btn-recalibrar {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  color: var(--azul);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-recalibrar:hover {
  background: #eff6ff;
  border-color: var(--azul-claro);
  color: var(--azul-claro);
}

/* ==========================================================================
   TOAST DE NOTIFICACIONES
   ========================================================================== */
.crono-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--azul);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--blanco);
  padding: 0.75rem 1.25rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(15, 43, 92, 0.25);
  z-index: 2000;
  pointer-events: none;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   MEDIA QUERIES PARA MÓVILES
   ========================================================================== */
@media (max-width: 640px) {
  .opciones-inicio-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .opcion-card {
    padding: 1.5rem 1.25rem;
  }

  .crono-botones-grid.con-reiniciar {
    grid-template-columns: 1fr 1fr;
  }

  .btn-estado-reiniciar {
    grid-column: 1 / -1;
    height: 52px;
  }

  .delay-stats-grid {
    grid-template-columns: 1fr;
  }

  .vueltas-metricas-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .sesion-status-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-left, .status-right {
    justify-content: space-between;
  }
}