:root {
    --bg-color: #050505;
    --card-bg: #111111;
    --primary-red: #FF3B30;
    --text-main: #ffffff;
    --text-dim: #888888;
    --accent-green: #32D74B;
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* 1. RESET BÁSICO Y TIPOGRAFÍA */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden; /* CRÍTICO: Mata el scroll horizontal en móviles */
}

body {
    /* Fondo Premium: Degradado sutil en lugar de negro plano */
    background: radial-gradient(circle at 50% 0%, #1a1a1a 0%, var(--bg-color) 80%);
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* 2. HEADER RESPONSIVE (Estilo Vidrio) */
header {
    width: 100%;
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(5, 5, 5, 0.85); /* Más transparencia */
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); /* Soporte Safari */
    position: sticky;
    top: 0;
    z-index: 1000;
}
.logo { font-weight: 900; letter-spacing: 2px; font-size: 1.1rem; text-transform: uppercase; }
.badge { 
    background: var(--primary-red); 
    color: white; 
    padding: 3px 6px; 
    border-radius: 4px; 
    font-size: 0.6rem; 
    vertical-align: middle; 
    font-weight: 700;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.4); /* Glow rojo */
}

/* 3. SECCIÓN PRINCIPAL */
main {
    width: 100%;
    max-width: 1000px; /* Ancho contenido para lectura cómoda */
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1; /* Empuja el footer hacia abajo si hay poco contenido */
}

.tool-section { 
    text-align: center; 
    padding: 50px 0; 
    width: 100%; 
}

/* Título Premium y Seguro */
.main-title { 
    /* Clamp: Mínimo 1.8rem, Preferido 5vw, Máximo 3rem */
    font-size: clamp(1.8rem, 5vw, 3rem); 
    font-weight: 800;
    margin-bottom: 15px; 
    line-height: 1.1;
    letter-spacing: -1px;
    
    /* SEGURIDAD MÓVIL: Parte la palabra si es muy larga */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.subtitle { 
    color: var(--text-dim); 
    margin-bottom: 40px; 
    font-size: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* 4. CAJA DE ESTADO */
#status-box {
    background: #0f0f0f;
    border: 1px solid #222;
    padding: 12px 25px;
    border-radius: 50px; /* Pill shape (más moderno) */
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    transition: all 0.3s ease;
    flex-wrap: wrap; /* Si el texto es largo, baja */
    justify-content: center;
}
.status-connected { 
    border-color: var(--accent-green) !important; 
    color: var(--accent-green); 
    background: rgba(50, 215, 75, 0.05) !important;
    box-shadow: 0 0 20px rgba(50, 215, 75, 0.15); 
}
.hint { font-size: 0.7rem; color: #666; text-transform: uppercase; letter-spacing: 1px; }

/* 5. VISUALIZADOR Y DRIFT METER */

/* --- PROBABILIDAD DE DRIFT (HUD STYLE) --- */
.drift-meter-box {
    text-align: center;
    margin: 0 auto 50px auto; /* Centrado automático */
    padding: 30px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* Sombra profunda */
}

.drift-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--text-dim);
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.drift-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(3rem, 10vw, 5rem); /* Gigante pero escalable */
    font-weight: 900;
    line-height: 1;
    color: var(--accent-green);
    text-shadow: 0 0 25px rgba(50, 215, 75, 0.4); /* Glow fuerte */
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.drift-instruction {
    display: block;
    margin-top: 15px;
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
}

/* Radares */
.visualizer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    width: 100%;
}

.stick-wrapper { 
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

canvas {
    background: #080808;
    border-radius: 50%;
    border: 1px solid #333;
    /* Responsive perfecto */
    width: 250px;
    height: 250px;
    max-width: 70vw; /* Nunca más ancho que el 70% de la pantalla móvil */
    max-height: 70vw;
    box-shadow: inset 0 0 30px #000, 0 0 20px rgba(0,0,0,0.5);
}

.data-readout {
    margin-top: 15px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--text-dim);
    font-size: 0.9rem;
    background: #111;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #222;
}

/* --- CORRECCIÓN DEFINITIVA DE CENTRADO CTA --- */

.cta-section {
    width: 100%; /* Ocupa todo el ancho disponible */
    
    /* CENTRADO FLEXBOX: Esto es lo que asegura que la tarjeta quede al medio */
    display: flex;
    justify-content: center; /* Centra horizontalmente */
    align-items: center;     /* Centra verticalmente */
    
    /* Estilos de fondo y espaciado */
    background: linear-gradient(180deg, var(--bg-color) 0%, #150505 100%);
    padding: 60px 20px; /* Un poco menos de padding vertical para móvil */
    border-top: 1px solid #222;
    margin-top: 40px;
    box-sizing: border-box; /* Vital */
}

/* LA TARJETA NEGRA CON BORDE ROJO */
.cta-card {
    
    
    text-align: center;  /* Centra el texto y botones por dentro */
    
    /* Estilos visuales */
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.05), rgba(0,0,0,0));
    border: 1px solid rgba(255, 59, 48, 0.2);
    padding: 30px 20px;  /* Padding interno ajustado */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    box-sizing: border-box; /* Vital */
}

/* Ajuste para el título dentro de la tarjeta */
.cta-card h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    word-wrap: break-word; /* Evita que una palabra larga rompa el diseño */
}

/* Ajuste para el texto dentro de la tarjeta */
.cta-card p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 25px;
}
.cta-card h2 { font-size: 1.5rem; margin-bottom: 15px; }

/* Botones con estilo Apple/Google */
/* CONTENEDOR DE LOS BOTONES */
.store-buttons {
    display: flex;
    justify-content: center;
    gap: 15px; /* Espacio entre los dos botones */
    margin-top: 30px;
    flex-wrap: wrap;
}

/* EL BOTÓN BLANCO (RECTÁNGULO) */
.btn-store {
    display: inline-flex;  /* Vital para alinear icono y texto en fila */
    align-items: center;   /* Centra verticalmente el icono con el texto */
    justify-content: center;
    
    /* ESPACIO ENTRE EL LOGO Y EL TEXTO */
    gap: 12px;             
    
    padding: 14px 28px;
    background: white;
    color: black;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    min-width: 160px;
    box-shadow: 0 5px 15px rgba(255,255,255,0.1);
}

.btn-store:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 25px rgba(255,255,255,0.2);
}

/* EL LOGO (IMAGEN) DENTRO DEL BOTÓN */
.store-icon {
    width: 24px;        /* Tamaño fijo para que no se vea gigante */
    height: 24px;
    object-fit: contain; /* Evita que el logo se deforme */
    display: block;
}

/* 7. CONTENIDO SEO (Limpio y legible) */
.seo-content {
    width: 100%;
    max-width: 750px;
    padding: 60px 20px;
    line-height: 1.8;
    color: #bbb;
    text-align: left;
    font-size: 1.05rem;
    
    /* SEGURIDAD MÓVIL */
    margin: 0 auto;
    overflow-wrap: break-word;
}
.seo-content h2 { 
    color: white; 
    margin-top: 50px; 
    margin-bottom: 20px;
    font-size: 1.4rem; 
    border-left: 3px solid var(--primary-red);
    padding-left: 15px;
}
.seo-content ul { padding-left: 20px; }
.seo-content li { margin-bottom: 15px; }

/* Tabla Técnica */
.tech-specs {
    margin-top: 40px; 
    border: 1px solid #333; 
    border-radius: 12px; 
    overflow: hidden; 
    background: #0a0a0a;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

footer {
    padding: 40px 20px;
    text-align: center;
    color: #555;
    font-size: 0.8rem;
    border-top: 1px solid #151515;
    width: 100%;
    margin-top: auto;
}

/* CLASES DE ESTADO (JS) */
.drift-warning {
    color: #FFD60A !important;
    text-shadow: 0 0 25px rgba(255, 214, 10, 0.4) !important;
}

.drift-danger {
    color: var(--primary-red) !important;
    text-shadow: 0 0 30px rgba(255, 59, 48, 0.5) !important;
}

/* 8. MEDIA QUERIES (Ajustes finos finales) */
@media (max-width: 600px) {
    .main-title { font-size: 2rem; }
    
    .visualizer-container { gap: 30px; }
    
    .drift-meter-box { padding: 20px; width: 100%; }
    
    /* Los botones ocupan todo el ancho en móvil para fácil click */
    .store-buttons { flex-direction: column; width: 100%; }
    .btn-store { width: 100%; }
    
    /* Reducimos padding lateral en secciones grandes */
    .cta-section, .seo-content { padding-left: 15px; padding-right: 15px; }
}

/* Agrega esto al final de tu style.css */
.status-connected {
    border-color: #32D74B !important; /* Verde Apple */
    color: #32D74B !important;
    box-shadow: 0 0 15px rgba(50, 215, 75, 0.2);
    transition: all 0.3s ease;
}

.status-waiting {
    /* Estado por defecto (ya lo tienes, pero asegúrate que contraste) */
    opacity: 0.8;
}

.ad-container {
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 10px;
    
    /* ESTO ES IMPORTANTE: */
    min-height: 280px; /* Reserva el espacio aunque el anuncio tarde en cargar */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}