:root {
    --bg-dark: #05080a;
    --panel-bg: rgba(10, 20, 30, 0.85);
    --border-color: rgba(0, 255, 255, 0.3);
    --accent-cyan: #00f2ff;
    --accent-green: #00ff95;
    --accent-red: #ff3c3c;
    --accent-gold: #ffcc00;
    --text-main: #e0faff;
    --text-dim: #7da5af;
    --neon-glow: 0 0 20px rgba(0, 242, 255, 0.6);
    --neon-magenta: #ff0055;
    --magenta-glow: 0 0 20px rgba(255, 0, 85, 0.6);
    --boot-speed: 1.5s;
}

/* GHOST PROTOCOL / STEALTH MODE */
body.stealth-mode {
    filter: brightness(0.1) contrast(1.2) grayscale(1);
    transition: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.stealth-mode .guardian-container {
    opacity: 0.02;
    pointer-events: none;
}

body.stealth-mode::after {
    content: 'GHOST PROTOCOL ACTIVE';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.1);
    letter-spacing: 10px;
    z-index: 9999;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Rajdhani', sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* --- ELITE SCANNING ANIMATION --- */
.scanning-line {
    position: absolute;
    top: -100px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    box-shadow: 0 0 20px var(--accent-cyan);
    z-index: 1000;
    pointer-events: none;
    animation: scanLine 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    opacity: 0.5;
}

@keyframes scanLine {
    0% {
        top: -10%;
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        top: 110%;
        opacity: 0;
    }
}

/* Smooth Entrance */
.guardian-container {
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* BOOT SEQUENCE ANIMATION */
@keyframes bootUp {
    0% {
        filter: brightness(0) blur(20px);
        opacity: 0;
    }

    50% {
        filter: brightness(2) blur(5px);
        opacity: 0.5;
    }

    100% {
        filter: brightness(1) blur(0);
        opacity: 1;
    }
}

.guardian-container {
    animation: bootUp var(--boot-speed) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* MICRO-GLITCH EFFECT */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-text::before {
    color: var(--accent-cyan);
    z-index: -1;
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch-text::after {
    color: var(--neon-magenta);
    z-index: -2;
    animation: glitch-anim2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes glitch-anim2 {
    0% {
        transform: translate(0);
    }

    25% {
        transform: translate(2px, -2px);
    }

    50% {
        transform: translate(-2px, 2px);
    }

    75% {
        transform: translate(2px, 2px);
    }

    100% {
        transform: translate(0);
    }
}

/* Background grid effect */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    background-position: var(--bg-pos-x, 0) var(--bg-pos-y, 0);
    transition: background-position 0.1s ease-out;
}

.guardian-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(0, 242, 255, 0.05) 0%, transparent 70%);
}

/* Header */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.security-icon {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 10px var(--accent-cyan));
}

.brand {
    display: flex;
    flex-direction: column;
}

.brand-main {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.accent-text {
    color: var(--accent-cyan);
}

.brand-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 4px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 255, 149, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 149, 0.3);
    font-weight: 700;
    font-size: 0.9rem;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.indicator.green {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* HUD Layout */
.hud-main {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 30px;
    align-items: start;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 242, 255, 0.1), 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: var(--accent-cyan);
    box-shadow: inset 0 0 40px rgba(0, 242, 255, 0.15), 0 15px 40px rgba(0, 0, 0, 0.6);
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--accent-cyan), transparent);
    box-shadow: 0 0 10px var(--accent-cyan);
}

.glass-panel h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
}

/* Bio Data Column Left */
.bio-data,
.meta-data {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.val.green {
    color: var(--accent-green);
}

.val.red {
    color: var(--accent-red);
    font-weight: 700;
}

#voice-spectrogram {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 15px;
}

/* Vault Profiles */
.vault-profiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.profile-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-card:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-cyan);
}

.profile-card.active {
    background: rgba(0, 242, 255, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

.profile-card .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 242, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.profile-card span {
    font-size: 0.7rem;
    font-weight: 700;
}

/* Red alert theme enhancements */
body.danger .bar-fill.green {
    background: linear-gradient(90deg, #ff3c3c, #ffae00);
    box-shadow: 0 0 10px var(--accent-red);
}

body.danger .glass-panel::before {
    background: var(--accent-red);
}

body.danger .status-badge {
    background: rgba(255, 60, 60, 0.1);
    border-color: rgba(255, 60, 60, 0.3);
}

body.danger .indicator.green {
    background: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red);
}

.metric-bar {
    margin-bottom: 12px;
}

.metric-bar label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 5px;
    color: var(--text-dim);
}

.bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.5s ease, background-color 0.5s ease;
}

.bar-fill.green {
    background: linear-gradient(90deg, #00ff95, #00f2ff);
    box-shadow: 0 0 10px var(--accent-cyan);
}

/* Center Column: Radar */
.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.radar-container {
    position: relative;
    width: 350px;
    height: 350px;
    margin-bottom: 30px;
}

.radar-circle {
    width: 100%;
    height: 100%;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.05);
}

.radar-circle::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 70%;
    border: 1px dashed var(--border-color);
    border-radius: 50%;
}

.shield-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.halo-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-cyan);
    border-radius: 50%;
    opacity: 0.3;
    box-shadow: 0 0 20px var(--accent-cyan);
    animation: halo-pulse 3s infinite ease-in-out;
}

.halo-ring.ring-2 {
    width: 120%;
    height: 120%;
    border-style: dashed;
    border-width: 1px;
    opacity: 0.15;
    animation: halo-rotate 10s linear infinite;
}

.radar-sweep {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 0;
    right: 0;
    transform-origin: bottom left;
    background: conic-gradient(from 0deg, var(--accent-cyan) 0deg, transparent 90deg);
    border-radius: 100% 0 0 0;
    animation: sweep 4s linear infinite;
    opacity: 0.3;
}

body.danger .halo-ring {
    border-color: var(--accent-red);
    box-shadow: 0 0 30px var(--accent-red);
    animation: alert-blink 0.5s infinite alternate;
}

.auth-seal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.5s ease;
    text-align: center;
}

.auth-seal i {
    font-size: 4rem;
    color: var(--accent-green);
    filter: drop-shadow(0 0 20px var(--accent-green));
}

.auth-seal span {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.confidence-meter {
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 4px;
    border: 1px solid var(--accent-green);
    font-size: 0.9rem;
}

.waveform-container {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.waveform-container::after {
    content: 'NEURAL FREQ MONITOR';
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 0.5rem;
    color: var(--accent-cyan);
    opacity: 0.3;
    letter-spacing: 2px;
}

#main-waveform {
    width: 100%;
    height: 100%;
}

.hud-controls {
    display: flex;
    gap: 15px;
}

button {
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    padding: 12px 25px;
    border-radius: 4px;
    border: 1px solid;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.btn-scan {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.btn-scan:hover {
    background: var(--accent-cyan);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--accent-cyan);
}

.btn-warn {
    background: rgba(255, 204, 0, 0.1);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.btn-warn:hover {
    background: var(--accent-gold);
    color: var(--bg-dark);
}

/* Right Column: Logs */
.logs-container {
    height: 180px;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.log-entry {
    color: var(--text-dim);
}

.log-entry.green {
    color: var(--accent-green);
}

.log-entry.warn {
    color: var(--accent-gold);
    font-weight: 700;
}

.log-entry.red {
    color: var(--accent-red);
    font-weight: 700;
    animation: blink 1s infinite;
}

.meta-item {
    margin-bottom: 8px;
}

.meta-item label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Footer */
.hud-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.shield-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
}

/* Animations */
@keyframes sweep {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

@keyframes halo-pulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

@keyframes halo-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.danger-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    border: 20px solid var(--accent-red);
    box-shadow: inset 0 0 100px rgba(255, 60, 60, 0.5);
    background: rgba(255, 60, 60, 0.1);
    z-index: 1000;
    pointer-events: none;
    animation: alert-blink 0.5s infinite alternate;
}

@keyframes alert-blink {
    from {
        opacity: 0.2;
        border-width: 10px;
    }

    to {
        opacity: 0.8;
        border-width: 30px;
    }
}

.hidden {
    display: none;
}

/* Social Hub */
.social-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.social-input-area input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-main);
    font-size: 0.8rem;
}

.social-input-area button {
    padding: 8px 15px;
    background: var(--accent-cyan);
    color: var(--bg-dark);
    border: none;
    font-weight: 700;
}

.truth-decoder-huds {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.decoder-silo {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.decoder-silo label {
    font-size: 0.65rem !important;
    letter-spacing: 1px;
    color: var(--text-dim) !important;
}

.decoder-silo .val {
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

.verdict-banner {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid var(--accent-cyan);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
}

.verdict-banner.danger {
    background: rgba(255, 60, 60, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.verdict-banner.hybrid {
    background: rgba(255, 204, 0, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* Live Monitor Video */
.video-preview-container {
    position: relative;
    width: 100%;
    height: 160px;
    background: #000;
    border: 1px solid var(--accent-red);
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
}

.video-preview-container label {
    position: absolute;
    top: 5px;
    left: 5px;
    background: red;
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    z-index: 10;
    font-weight: 700;
}

#live-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

#biometric-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 8;
    pointer-events: none;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: scan-vertical 2s linear infinite;
    z-index: 5;
}

@keyframes scan-vertical {
    0% {
        top: 0;
    }

    100% {
        top: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Danger Mode Overrides */
body.danger {
    --accent-cyan: var(--accent-red);
    --border-color: rgba(255, 60, 60, 0.3);
}

body.danger .radar-circle {
    box-shadow: 0 0 50px rgba(255, 60, 60, 0.2);
}

/* --- MOBILE RESPONSIVENESS (Fix para "Tela Travada") --- */
@media screen and (max-width: 1080px) {

    html,
    body {
        overflow-x: hidden !important;
        position: relative;
        width: 100%;
        max-width: 100vw;
    }

    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .guardian-container {
        height: auto;
        min-height: 100vh;
        display: block;
        padding: 10px;
        width: 100%;
        overflow-x: hidden;
    }

    .hud-header {
        flex-direction: column !important;
        text-align: center;
        gap: 20px;
        padding-bottom: 20px;
        margin-bottom: 20px;
        width: 100%;
    }

    .logo-area {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .brand {
        align-items: center;
    }

    .hud-main {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px;
        width: 100%;
        overflow: hidden;
    }

    .hud-side,
    .hud-center {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* ORDEM VISUAL NO MOBILE:
       1. Radar (Centro) - O mais importante
       2. Biometria (Esq)
       3. Logs/Social (Dir)
    */
    .hud-center {
        order: 1;
        margin-bottom: 30px;
    }

    .hud-side.left {
        order: 2;
    }

    .hud-side.right {
        order: 3;
    }

    /* Ajuste de Tamanho do Radar */
    .radar-container {
        width: 280px;
        height: 280px;
        margin: 0 auto 20px auto;
    }

    .glass-panel {
        width: 100%;
        margin-bottom: 15px;
    }

    .hud-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        margin-top: 30px;
    }
}