/* ==========================================================================
   META/VERCEL ELITE 2026 DESIGN SYSTEM
   ========================================================================== */

   :root {
    /* OLED Black Foundation */
    --bg-dark: #000000;
    --bg-zinc: #09090b;
    --bg-panel: rgba(24, 24, 27, 0.55);
    
    /* Micrometric Borders */
    --border-glass: rgba(255, 255, 255, 0.04);
    --border-glass-highlight: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --text-main: #fafafa;
    --text-muted: #a1a1aa;
    
    /* Accents */
    --accent-blue: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.5);
    
    /* Hardware LEDs */
    --light-green: #22c55e;
    --light-yellow: #eab308;
    --light-red: #ef4444;
    --light-off: rgba(255, 255, 255, 0.08);
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-zinc);
    /* Ultra-subtle ambient mesh gradient */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(255, 255, 255, 0.015) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(37, 99, 235, 0.02) 0%, transparent 25%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    /* High quality typography rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.app-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 95%;
    max-width: 1000px;
    height: 92vh;
}

.app-container.hidden {
    display: none;
}

/* ==========================================================================
   ONBOARDING & LOGIN
   ========================================================================== */
.onboarding-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
}

.onboarding-container.hidden {
    display: none;
}

.onboarding-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease forwards;
    max-height: 90vh;
    overflow-y: auto;
}

.onboarding-brand {
    justify-content: center;
    margin-bottom: 0.5rem;
}

.onboarding-desc {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.onboarding-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.hidden {
    display: none;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"] {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover, 
.form-group input:-webkit-autofill:focus, 
.form-group input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #1a1a1a inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.mode-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    overflow: hidden;
}

.mode-btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.mode-btn input[type="radio"] {
    display: none;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.onboarding-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--light-red);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.onboarding-error.hidden {
    display: none;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

/* ==========================================================================
   FLOATING PILL HEADER
   ========================================================================== */
.status-header {
    background: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: 100px; /* Perfect pill shape */
    box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #fafafa 0%, #a1a1aa 100%);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.brand span {
    color: var(--text-muted);
    font-weight: 500;
}

.header-right-panel {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-indicator h3 {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

/* Precision Hardware LEDs */
.traffic-light-container {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
}

.light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light-off);
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.light.green.active { 
    background: var(--light-green); 
    box-shadow: 0 0 12px var(--light-green), inset 0 1px 2px rgba(255,255,255,0.8);
}
.light.yellow.active { 
    background: var(--light-yellow); 
    box-shadow: 0 0 12px var(--light-yellow), inset 0 1px 2px rgba(255,255,255,0.8);
}
.light.red.active { 
    background: var(--light-red); 
    box-shadow: 0 0 12px var(--light-red), inset 0 1px 2px rgba(255,255,255,0.8);
}

.metrics {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    background: rgba(255,255,255,0.03);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--border-glass);
}

.metric-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.metric-item .label {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.metric-item .value {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-top: 1px solid var(--border-glass-highlight);
    border-radius: 24px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.8);
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    padding: 3rem;
    display: flex;
    flex-direction: column;
}

.content-header {
    margin-bottom: 2rem;
}

.content-header h2 {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.content-body {
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-right: 1.5rem;
}

.content-body p {
    animation: fadeIn 0.4s ease forwards;
}

.content-footer {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    flex-shrink: 1;
    min-height: 0;
    padding-right: 0.5rem;
}

/* Summary Container */
.summary-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.summary-container.hidden {
    display: none;
}

.summary-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 1rem;
}

.summary-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

#game-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
}

#game-container.hidden {
    display: none;
}

/* Elite Scrollbars */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ==========================================================================
   CTA BUTTONS (VERCEL/STRIPE STYLE)
   ========================================================================== */
.btn {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary-btn {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.2), 
        0 4px 12px rgba(37, 99, 235, 0.3);
    color: #ffffff;
    justify-content: center;
    font-weight: 600;
    letter-spacing: 0;
}

.btn.primary-btn:hover {
    background: linear-gradient(180deg, #4f46e5 0%, #3730a3 100%);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.3), 
        0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn.primary-btn:active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.option-letter {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.btn:hover .option-letter {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   LOADING OVERLAY & BIENESTAR
   ========================================================================== */
.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
    border-radius: 24px;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--text-main);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bienestar Final Component */
.bienestar-final {
    background: rgba(255, 255, 255, 0.02);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.8s ease forwards;
}

.bienestar-final h3 {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.ibs-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.ibs-bar {
    height: 100%;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 4px;
}

.ibs-bar.verde { background: var(--light-green); box-shadow: 0 0 10px rgba(34,197,94,0.4); }
.ibs-bar.amarillo { background: var(--light-yellow); box-shadow: 0 0 10px rgba(234,179,8,0.4); }
.ibs-bar.rojo { background: var(--light-red); box-shadow: 0 0 10px rgba(239,68,68,0.4); }

.ibs-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.04em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        height: auto;
        margin: 1rem 0;
    }
    .status-header {
        border-radius: 20px;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .header-right-panel {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    .main-content {
        padding: 1.5rem;
    }
    .desktop-only {
        display: none;
    }
}
