:root {
    --bg-dark: #f1f5f9;
    --panel-bg: rgba(255, 255, 255, 0.75);
    --panel-border: rgba(99, 102, 241, 0.12);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --cyan: #0891b2;
    --magenta: #d946ef;
    --emerald: #10b981;
    --gold: #f59e0b;
    --text-main: #0f172a;
    --text-muted: #475569;
    --font-hud: 'Share Tech Mono', monospace;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Cosmic Canvas Background */
#cosmicCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* --- SECURITY SIREN OVERLAY --- */
.siren-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 123, 0.15);
    border: 15px solid var(--magenta);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    animation: alarmPulse 0.5s infinite alternate;
}

@keyframes alarmPulse {
    0% { border-color: rgba(255, 0, 123, 0.4); background: rgba(255, 0, 123, 0.08); }
    100% { border-color: rgba(255, 0, 123, 1); background: rgba(255, 0, 123, 0.25); box-shadow: inset 0 0 100px rgba(255, 0, 123, 0.8); }
}

.siren-content {
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.siren-icon {
    font-size: 80px;
    color: white;
    text-shadow: 0 0 20px var(--magenta);
    margin-bottom: 20px;
}
.alarm-title {
    font-family: var(--font-hud);
    font-size: 42px;
    font-weight: 900;
    color: white;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}
.alarm-msg {
    font-size: 16px;
    color: #ffd2e5;
    margin-bottom: 20px;
    font-weight: 500;
}
.siren-timer {
    font-family: var(--font-hud);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- CHROMATIC REFLECTION LIGHTNING FLASH OVERLAY --- */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 998;
    background: transparent;
    pointer-events: none;
    transition: background 0.1s ease;
}
.lightning-point {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transform: scale(0.1);
    transition: all 0.08s ease;
    mix-blend-mode: screen;
}

/* --- HUD CONTAINER LAYOUT --- */
.hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
}

.glass-panel {
    pointer-events: auto;
    background: var(--panel-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.05);
    transition: var(--transition);
}
.glass-panel:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.08), 0 0 15px rgba(217, 70, 239, 0.05);
}

/* --- HUD HEADER --- */
.hud-header {
    height: 70px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-color: rgba(255, 255, 255, 0.05);
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-text {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-main);
}
.logo-text .highlight {
    color: var(--magenta);
    text-shadow: 0 0 10px rgba(255, 0, 123, 0.5);
}
.eye-badge {
    background: rgba(255, 0, 123, 0.15);
    color: var(--magenta);
    border: 1px solid rgba(255, 0, 123, 0.3);
    font-size: 11px;
    font-weight: 800;
    font-family: var(--font-hud);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-hud);
}
.secure-pulse {
    width: 10px;
    height: 10px;
    background: var(--magenta);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px var(--magenta);
}
.secure-pulse::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px solid var(--magenta);
    border-radius: 50%;
    animation: pulseRadar 1.5s linear infinite;
}

.status-lbl {
    color: var(--text-muted);
    font-size: 13px;
}
.status-val {
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1px;
}

.time-panel {
    text-align: right;
    font-family: var(--font-hud);
}
.time-panel .date {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}
.time-panel .clock {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-main);
}

/* --- MAIN HUD --- */
.hud-main {
    flex: 1;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    overflow: hidden;
}

.hud-sidebar {
    width: 310px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}
.panel-header h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 1px;
}
.panel-header h2 i {
    margin-right: 6px;
    color: var(--cyan);
}

/* --- LEFT SIDEBAR: DIAGNOSTICS DECK --- */
.diag-metrics {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}
.diag-metric-card {
    padding: 12px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.diag-metric-card .metric-lbl {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.diag-metric-card .metric-val {
    font-size: 14px;
    font-weight: bold;
    font-family: var(--font-hud);
}

.progress-bar-container {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.bg-cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.bg-magenta { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }

.diag-log-wrapper {
    flex: 1;
    overflow-y: auto;
    background: rgba(99, 102, 241, 0.03);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(99, 102, 241, 0.06);
}
.diag-logs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--font-hud);
    font-size: 11px;
}
.diag-log-item {
    line-height: 1.4;
    color: var(--text-main);
    animation: feedSlideIn 0.2s ease-out;
}
.log-tag {
    font-size: 9px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
}
.tag-sys { background: rgba(0, 242, 255, 0.1); color: var(--cyan); border: 1px solid rgba(0, 242, 255, 0.2); }
.tag-bio { background: rgba(255, 0, 123, 0.1); color: var(--magenta); border: 1px solid rgba(255, 0, 123, 0.2); }
.tag-err { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

/* --- CENTER PANEL: CAMERA SCANNING --- */
.hud-center-deck {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 10px;
}

/* Prompt Card Above Camera */
.prompt-card {
    width: 100%;
    max-width: 620px;
    padding: 10px 16px;
    text-align: center;
    border-color: rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 50;
}
.prompt-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-hud);
    font-size: 12px;
    font-weight: bold;
}
.countdown-badge {
    background: rgba(255, 0, 123, 0.15);
    color: var(--magenta);
    border: 1px solid rgba(255, 0, 123, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.prompt-text-wrapper {
    position: relative;
    padding: 8px 0;
    background: rgba(99, 102, 241, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.06);
}

/* Floating Eye Tracker Pointer (Moves left to right to test horizontal gaze tracking) */
.eye-tracker-pointer {
    position: absolute;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--magenta);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--magenta);
    z-index: 10;
    pointer-events: none;
    display: none; /* Active only during step 1 */
}

.prompt-text {
    font-family: var(--font-hud);
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(99,102,241,0.05);
    user-select: none;
}
.prompt-text.reading {
    color: var(--cyan);
}

.prompt-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Webcam octagonal frame grid - made responsive and guaranteed perfect square */
.camera-hex-wrapper {
    position: relative;
    width: 100%;
    max-width: 270px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 4px auto;
    z-index: 40;
}

/* Futuristic Target circular neon glow - multi-color rotating border */
.camera-grid-frame {
    position: absolute;
    top: -6px;
    left: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    border-radius: 50%;
    background: conic-gradient(
        var(--cyan) 0deg,
        var(--magenta) 72deg,
        var(--gold) 144deg,
        var(--emerald) 216deg,
        #9333ea 288deg,
        var(--cyan) 360deg
    );
    pointer-events: none;
    box-shadow: 
        0 0 15px rgba(0, 242, 255, 0.3), 
        0 0 25px rgba(255, 0, 123, 0.3);
    animation: 
        circularNeonRotate 4s linear infinite,
        circularNeonPulse 2s infinite alternate ease-in-out;
}

@keyframes circularNeonRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes circularNeonPulse {
    0% {
        opacity: 0.8;
        box-shadow: 
            0 0 12px rgba(0, 242, 255, 0.2), 
            0 0 20px rgba(255, 0, 123, 0.2);
    }
    100% {
        opacity: 1;
        box-shadow: 
            0 0 25px rgba(0, 242, 255, 0.6), 
            0 0 40px rgba(255, 0, 123, 0.6);
    }
}

.camera-oct-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #080a10;
    border-radius: 50%; /* Rounded circular cybernetic eye viewbox */
    border: 3px solid rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 35px rgba(99, 102, 241, 0.08), 0 0 15px rgba(217, 70, 239, 0.05);
    overflow: hidden;
}
.camera-oct-frame.active {
    border-color: var(--magenta);
    box-shadow: 0 0 45px rgba(99,102,241,0.12), 0 0 25px rgba(217, 70, 239, 0.15);
}

.camera-oct-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera feed */
}

/* Sound Wave overlay */
#visualizerCanvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 15;
    pointer-events: none;
}

/* Scanning line running down */
.scanner-laser {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--magenta), transparent);
    box-shadow: 0 0 12px var(--magenta);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    top: 0%;
}
.scanner-laser.scanning {
    opacity: 0.8;
    animation: scanLaser 4s linear infinite;
}

@keyframes scanLaser {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* Overlaid face tracking mesh canvas */
#faceMeshCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    transform: scaleX(-1); /* Align with mirrored webcam feed */
}

.scan-status-lbl {
    position: absolute;
    width: 100%;
    text-align: center;
    bottom: 20px;
    font-family: var(--font-hud);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    z-index: 25;
    font-weight: bold;
}

/* Captcha triggers */
.action-btn-deck {
    z-index: 50;
    pointer-events: auto;
}
.btn-cyber {
    background: var(--primary);
    border: 1px solid var(--primary-hover);
    color: white;
    box-shadow: 0 5px 15px rgba(126, 34, 206, 0.3);
    padding: 12px 28px;
    font-weight: bold;
    letter-spacing: 1.5px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}
.btn-cyber:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(126, 34, 206, 0.5), 0 0 10px var(--magenta);
}

/* --- RIGHT SIDEBAR: STEPS --- */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.step-card {
    padding: 12px;
    background: rgba(99, 102, 241, 0.02);
    border: 1px solid rgba(99, 102, 241, 0.06);
    border-radius: 12px;
    transition: var(--transition);
}
.step-card.active {
    border-color: var(--cyan);
    background: rgba(0, 242, 255, 0.02);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.05);
}
.step-card.success {
    border-color: var(--emerald);
    background: rgba(16, 185, 129, 0.02);
}

.step-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.step-num {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-hud);
    font-size: 11px;
    font-weight: bold;
}
.bg-cyan-dim { background: rgba(0, 242, 255, 0.15); color: var(--cyan); }
.bg-blue-dim { background: rgba(126, 34, 206, 0.15); color: #c084fc; }
.bg-magenta-dim { background: rgba(255, 0, 123, 0.15); color: var(--magenta); }

.step-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
}

.step-status-icon {
    font-size: 12px;
    color: var(--text-muted);
}
.step-card.active .step-status-icon { color: var(--cyan); }
.step-card.success .step-status-icon { color: var(--emerald); }

.step-card-body {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.4;
    padding-left: 34px;
}

/* --- BOTTOM WARNING MARQUEE --- */
.hud-footer {
    height: 48px;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 20px;
    border-color: rgba(99, 102, 241, 0.1);
}
.cyber-warnings-feed {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}
.feed-marquee {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 30s linear infinite;
    font-family: var(--font-hud);
    font-size: 11px;
    font-weight: bold;
}
.warning-alert {
    margin-right: 50px;
}

@keyframes marquee {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Custom Scrollbars */
.scrollbar-custom::-webkit-scrollbar {
    width: 4px;
}
.scrollbar-custom::-webkit-scrollbar-track {
    background: transparent;
}
.scrollbar-custom::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
}
.scrollbar-custom::-webkit-scrollbar-thumb:hover {
    background: var(--magenta);
}

.text-magenta { color: var(--magenta); }
.text-cyan { color: var(--cyan); }
.text-emerald { color: var(--emerald); }

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseRadar {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2.0); opacity: 0; }
}

/* Responsive Layouts (Mobile, Tablet, Desktop) */
@media (max-width: 1120px) {
    .hud-sidebar {
        width: 260px;
        padding: 14px;
    }
    .prompt-text {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .hud-container {
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding: 10px;
        pointer-events: auto;
    }
    
    .hud-header {
        height: auto;
        min-height: 60px;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        text-align: center;
    }
    
    .time-panel {
        display: none; /* Hide date/time on small mobile to maximize workspace */
    }
    
    .hud-main {
        flex-direction: column;
        overflow: visible;
        height: auto;
        gap: 12px;
    }
    
    .hud-sidebar {
        width: 100%;
        height: auto;
        flex: none;
        padding: 16px;
    }
    
    .diag-log-wrapper {
        max-height: 120px; /* Keep diagnostic scrolling logs compact on mobile */
    }
    
    .steps-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 8px;
    }
    
    .step-card {
        padding: 10px;
    }
    
    .hud-center-deck {
        padding: 10px 0;
        order: -1; /* Place scanner deck at top for mobile priority */
    }
    
    .prompt-card {
        max-width: 100%;
        padding: 10px 14px;
    }
    
    .prompt-text {
        font-size: 18px;
    }
    
    .camera-hex-wrapper {
        width: 100%;
        max-width: 270px;
        height: auto;
        aspect-ratio: 1 / 1;
        margin: 5px auto;
    }
}

