:root {
    --bg-dark: #050508;
    --panel-bg: rgba(10, 10, 15, 0.8);
    --neon-purple: #bd00ff;
    --neon-cyan: #00f3ff;
    --neon-pink: #ff0055;
    --text-main: #d1d1ff;
    --text-dim: #5c5c8a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* Фоновый Canvas */
#canvas-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Эффект сканирующих линий (CRT монитор) */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 2;
    pointer-events: none;
}

/* Основной контейнер */
.main-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
    flex-direction: column;
}

/* Аудио-контроллер в углу */
.audio-control {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(20, 20, 30, 0.6);
    border: 1px solid var(--text-dim);
    padding: 8px 15px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 2px;
    z-index: 10;
    opacity: 0;
    animation: fadeInText 1s ease forwards;
    animation-delay: 1.5s;
}

.audio-control.active {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

/* Карточка логина */
.login-card {
    background: var(--panel-bg);
    border: 1px solid rgba(189, 0, 255, 0.2);
    width: 400px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.85), inset 0 0 20px rgba(189, 0, 255, 0.05);
    border-radius: 2px;
    transition: border-color 0.5s ease;

    opacity: 0;
    animation: cardGlitchEntrance 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    animation-delay: 0.3s;
}

.login-card:hover {
    border-color: rgba(0, 243, 255, 0.4);
}

/* Заголовок Системы */
.system-header {
    margin-bottom: 30px;
    text-align: center;
}

.system-header h1 {
    font-size: 22px;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 8px var(--neon-purple);
    margin-bottom: 5px;
    position: relative;
    display: inline-block;
}

.system-header h1::before,
.system-header h1::after {
    content: 'VAULT CORE v1.0';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.system-header h1::before {
    left: 2px;
    text-shadow: -1px 0 var(--neon-cyan);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitchTextEffects 3s infinite linear alternate-reverse;
}

.system-header h1::after {
    left: -2px;
    text-shadow: -1px 0 var(--neon-pink);
    clip: rect(85px, 450px, 140px, 0);
    animation: glitchTextEffects 2s infinite linear alternate-reverse;
}

.system-header p {
    font-size: 11px;
    color: var(--neon-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeInText 0.5s ease forwards;
    animation-delay: 0.8s;
}

/* Поля ввода */
.input-group {
    position: relative;
    margin-bottom: 25px;
    opacity: 0;
    animation: fadeInText 0.4s ease forwards;
}
.input-group:nth-child(1) { animation-delay: 1s; }
.input-group:nth-child(2) { animation-delay: 1.2s; }

.input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.input-group input {
    width: 100%;
    background: rgba(5, 5, 10, 0.8);
    border: 1px solid rgba(92, 92, 138, 0.4);
    padding: 12px 15px;
    color: #fff;
    font-size: 14px;
    letter-spacing: 2px;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.2);
}

/* --- КНОПКА (ФИКС ИСЧЕЗНОВЕНИЯ) --- */
.submit-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--neon-cyan);
    padding: 15px;
    color: var(--neon-cyan);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    position: relative;
    opacity: 0;
}

/* Анимация накладывается только пока у кнопки НЕТ класса .ready */
.submit-btn:not(.ready) {
    animation: buttonEntrance 0.4s ease 1.4s forwards;
}

/* Когда JS добавляет класс .ready, кнопка стабильно зафиксирована в видимости */
.submit-btn.ready {
    opacity: 1;
}

.submit-btn.ready:hover {
    background: var(--neon-cyan);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.6);
    animation: buttonGlitch 0.4s linear infinite;
}

/* Технический лог */
.terminal-log {
    margin-top: 25px;
    font-size: 10px;
    color: var(--text-dim);
    height: 50px;
    overflow: hidden;
    line-height: 1.5;
    border-top: 1px dashed rgba(92, 92, 138, 0.2);
    padding-top: 10px;
    opacity: 0;
    animation: fadeInText 0.5s ease forwards;
    animation-delay: 1.5s;
}

.log-line {
    white-space: nowrap;
}
.log-cyan { color: var(--neon-cyan); }
.log-pink { color: var(--neon-pink); }

/* Анимации */
@keyframes cardGlitchEntrance {
    0% {
        opacity: 0;
        transform: scale(0.9) skewX(-10deg);
        filter: brightness(3) contrast(2) blur(10px);
    }
    40% {
        opacity: 0.8;
        transform: scale(1.03) skewX(15deg);
        filter: brightness(1.5) blur(2px);
        border-color: var(--neon-pink);
    }
    55% {
        opacity: 0.5;
        transform: scale(0.98) skewX(-5deg);
        border-color: var(--neon-cyan);
    }
    70% {
        opacity: 1;
        transform: scale(1.01) skewX(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) skewX(0deg);
        filter: none;
    }
}

@keyframes buttonEntrance {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes glitchTextEffects {
    0% { clip-path: inset(40% 0 61% 0); }
    20% { clip-path: inset(92% 0 1% 0); }
    40% { clip-path: inset(15% 0 80% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(3% 0 92% 0); }
    100% { clip-path: inset(55% 0 43% 0); }
}

@keyframes buttonGlitch {
    0% { transform: translate(0) skew(0deg); }
    20% { transform: translate(-2px, 2px) skew(-2deg); }
    40% { transform: translate(-2px, -2px) skew(3deg); }
    60% { transform: translate(2px, 2px) skew(-1deg); }
    80% { transform: translate(2px, -2px) skew(0deg); }
    100% { transform: translate(0) skew(0deg); }
}

@keyframes fadeInText {
    to { opacity: 1; }
}