@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

body {
    background: #000;
    font-family: 'VT323', monospace;
    color: #00ff00;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.crt-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.crt-screen {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #001a00 0%, #000 100%);
    position: relative;
    overflow: hidden;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 255, 0, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 2;
}

.scanlines::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 255, 0, 0) 0%,
        rgba(0, 255, 0, 0.02) 50%,
        rgba(0, 255, 0, 0) 100%
    );
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.terminal-window {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 3;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 2px solid #00ff00;
    background: rgba(0, 40, 0, 0.8);
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.terminal-title {
    font-size: 24px;
    letter-spacing: 3px;
    text-shadow: 0 0 10px #00ff00;
}

.terminal-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px #00ff00;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.game-stats {
    display: flex;
    gap: 30px;
    padding: 20px;
    background: rgba(0, 20, 0, 0.6);
    border: 1px solid #00ff00;
    margin-bottom: 30px;
    font-size: 20px;
}

.stat-item {
    display: flex;
    gap: 10px;
}

.stat-label {
    color: #00cc00;
    opacity: 0.8;
}

.stat-value {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
    font-weight: bold;
}

.typing-area {
    flex: 1;
    background: rgba(0, 10, 0, 0.4);
    border: 1px solid #00ff00;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.text-display {
    font-size: 24px;
    line-height: 1.8;
    margin-bottom: 40px;
    letter-spacing: 1px;
}

.text-display .char {
    display: inline;
    transition: all 0.1s;
}

.text-display .char.correct {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.text-display .char.incorrect {
    color: #ff0000;
    background: rgba(255, 0, 0, 0.2);
    text-decoration: line-through;
    text-shadow: 0 0 5px #ff0000;
}

.text-display .char.current {
    background: rgba(0, 255, 0, 0.3);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { background: rgba(0, 255, 0, 0.3); }
    51%, 100% { background: transparent; }
}

.input-area {
    display: flex;
    align-items: center;
    font-size: 24px;
    padding: 15px 0;
    border-top: 1px solid #00ff00;
}

.prompt {
    color: #00ff00;
    margin-right: 10px;
    text-shadow: 0 0 5px #00ff00;
}

.typing-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #00ff00;
    font-family: 'VT323', monospace;
    font-size: 24px;
    outline: none;
    text-shadow: 0 0 3px #00ff00;
}

.cursor {
    width: 12px;
    height: 24px;
    background: #00ff00;
    animation: cursor-blink 1s infinite;
    margin-left: 2px;
}

@keyframes cursor-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.game-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.terminal-btn {
    background: rgba(0, 40, 0, 0.8);
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 12px 30px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.terminal-btn:hover {
    background: rgba(0, 60, 0, 0.9);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
    transform: translateY(-2px);
}

.terminal-btn:active {
    transform: translateY(0);
}

/* Distraction Controls */
.distraction-controls {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 20, 0, 0.4);
    border: 1px solid #00ff00;
    display: flex;
    justify-content: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-label {
    color: #00cc00;
    font-size: 16px;
    letter-spacing: 1px;
    min-width: 120px;
}

.terminal-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 6px;
    background: #001a00;
    border: 1px solid #00ff00;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.terminal-slider:hover {
    opacity: 1;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.terminal-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #00ff00;
    border: 2px solid #00cc00;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.terminal-slider::-webkit-slider-thumb:hover {
    background: #00cc00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 1);
}

.terminal-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #00ff00;
    border: 2px solid #00cc00;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
    border-radius: 0;
}

.control-value {
    color: #00ff00;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 5px #00ff00;
    min-width: 50px;
    text-align: center;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #001a00;
    border: 3px solid #00ff00;
    padding: 40px;
    min-width: 500px;
    max-width: 800px;
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #00ff00;
}

.modal-header h2 {
    font-size: 32px;
    text-shadow: 0 0 10px #00ff00;
    letter-spacing: 3px;
}

.close-btn {
    background: transparent;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 20px;
}

.close-btn:hover {
    background: rgba(0, 255, 0, 0.1);
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(0, 40, 0, 0.3);
    border: 1px solid #00ff00;
    font-size: 20px;
}

.leaderboard-entry:nth-child(1) {
    background: rgba(255, 215, 0, 0.1);
    border-color: #ffd700;
    color: #ffd700;
}

.leaderboard-entry:nth-child(2) {
    background: rgba(192, 192, 192, 0.1);
    border-color: #c0c0c0;
    color: #c0c0c0;
}

.leaderboard-entry:nth-child(3) {
    background: rgba(205, 127, 50, 0.1);
    border-color: #cd7f32;
    color: #cd7f32;
}

.rank {
    font-weight: bold;
    min-width: 40px;
}

.player-alias {
    flex: 1;
    text-align: left;
    padding: 0 20px;
}

.player-score {
    min-width: 100px;
    text-align: right;
}

.game-over-stats {
    margin: 30px 0;
}

.final-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 24px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
}

.final-stat span:last-child {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.alias-input-area {
    display: flex;
    gap: 20px;
    margin: 30px 0;
}

#alias-input {
    flex: 1;
    background: rgba(0, 40, 0, 0.3);
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 10px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    outline: none;
}

#alias-input::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

.loading {
    text-align: center;
    font-size: 24px;
    padding: 40px;
    animation: pulse 1s infinite;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 40, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #00ff00;
    border: 1px solid #00cc00;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Hacking Simulation Effects */
.system-alerts {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    z-index: 1001;
    pointer-events: none;
}

.system-alert {
    background: rgba(0, 0, 0, 0.9);
    border-left: 4px solid #ff0000;
    padding: 10px 15px;
    margin-bottom: 10px;
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #ff0000;
    animation: alertSlideIn 0.3s ease-out, alertPulse 1s infinite;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.system-alert.warning {
    border-left-color: #ffff00;
    color: #ffff00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.3);
}

.system-alert.intrusion {
    border-left-color: #ff8800;
    color: #ff8800;
    animation: alertSlideIn 0.3s ease-out, dangerBlink 0.5s infinite;
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.6);
}

.system-alert.critical {
    border-left-color: #ff0000;
    color: #ff0000;
    background: rgba(50, 0, 0, 0.9);
    animation: alertSlideIn 0.3s ease-out, criticalFlash 0.2s infinite;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

.system-alert.success {
    border-left-color: #00ff00;
    color: #00ff00;
    background: rgba(0, 50, 0, 0.9);
    animation: alertSlideIn 0.3s ease-out;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.alert-timestamp {
    opacity: 0.7;
    margin-right: 10px;
}

.alert-message {
    font-weight: bold;
}

@keyframes alertSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes alertPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes dangerBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes criticalFlash {
    0%, 50% { 
        background: rgba(50, 0, 0, 0.9);
        color: #ff0000;
    }
    51%, 100% { 
        background: rgba(100, 0, 0, 0.9);
        color: #ffffff;
    }
}

/* Security Status Display */
.security-status {
    position: absolute;
    top: -60px;
    right: 0;
    display: flex;
    gap: 20px;
    font-size: 18px;
}

.threat-level-low { color: #00ff00; }
.threat-level-medium { color: #ffff00; }
.threat-level-high { color: #ff8800; }
.threat-level-critical { 
    color: #ff0000; 
    animation: threatPulse 0.5s infinite;
}

@keyframes threatPulse {
    0%, 100% { text-shadow: 0 0 5px #ff0000; }
    50% { text-shadow: 0 0 15px #ff0000, 0 0 25px #ff0000; }
}

/* Defense Mode Effects */
.defense-mode .crt-screen {
    animation: defenseMode 0.1s infinite, flicker 0.15s infinite;
    border: 3px solid #ff0000;
    box-shadow: 0 0 30px #ff0000;
}

.defense-mode .terminal-header {
    background: rgba(100, 0, 0, 0.8);
    color: #ffff00;
}

.defense-mode .terminal-title::after {
    content: " - UNDER ATTACK!";
    color: #ff0000;
    animation: urgentBlink 0.3s infinite;
}

@keyframes defenseMode {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(1px); }
}

@keyframes urgentBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Visual Interference Effects */
.char.corrupted {
    color: #ff0000 !important;
    background: rgba(255, 0, 0, 0.2);
    animation: corruptFlicker 0.1s infinite;
    text-shadow: 0 0 5px #ff0000;
}

@keyframes corruptFlicker {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Screen Distortion Effects */
.terminal-window.glitch {
    animation: screenGlitch 0.1s infinite;
}

@keyframes screenGlitch {
    0% { transform: translateX(0); }
    20% { transform: translateX(-2px) scaleX(0.99); }
    40% { transform: translateX(2px) scaleY(0.99); }
    60% { transform: translateY(-1px) scaleX(1.01); }
    80% { transform: translateY(1px) scaleY(1.01); }
    100% { transform: translateX(0); }
}

/* Typing Interference Overlay */
.typing-interference {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.1);
    pointer-events: none;
    animation: interferenceFlash 0.2s infinite;
}

@keyframes interferenceFlash {
    0%, 90% { opacity: 0; }
    91%, 100% { opacity: 1; }
}

/* Phantom Cursor Effects */
.phantom-cursor {
    position: absolute;
    width: 2px;
    height: 20px;
    background: #ff0000;
    animation: phantomBlink 0.5s infinite;
    z-index: 10;
}

@keyframes phantomBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* System Overload Effects */
.system-overload .crt-screen {
    filter: contrast(1.5) brightness(1.2) hue-rotate(20deg);
    animation: overloadPulse 0.3s infinite;
}

@keyframes overloadPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Emergency Alert Banner */
.emergency-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ff0000;
    color: #ffffff;
    text-align: center;
    padding: 10px;
    font-size: 20px;
    font-weight: bold;
    z-index: 1002;
    animation: emergencyScroll 3s linear infinite;
}

@keyframes emergencyScroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Distraction Overlays */
.distraction-popup {
    position: fixed;
    background: rgba(255, 0, 0, 0.9);
    color: #ffffff;
    padding: 20px;
    border: 2px solid #ffff00;
    font-size: 18px;
    z-index: 1003;
    animation: distractionBounce 0.5s ease-out;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

@keyframes distractionBounce {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Fake Error Messages */
.fake-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ff0000;
    color: #ff0000;
    padding: 30px;
    font-size: 24px;
    text-align: center;
    z-index: 1004;
    animation: errorShake 0.5s infinite;
}

@keyframes errorShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-1deg); }
    75% { transform: translate(-50%, -50%) rotate(1deg); }
}

/* Crash Dialog System */
.crash-dialog {
    position: fixed;
    width: 400px;
    background: #f0f0f0;
    border: 2px outset #c0c0c0;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    z-index: 2000;
    animation: dialogAppear 0.3s ease-out;
}

.crash-dialog-header {
    background: linear-gradient(to bottom, #0078d4, #106ebe);
    color: white;
    padding: 5px;
    display: flex;
    align-items: center;
    cursor: grab;
    user-select: none;
}

.crash-dialog-icon {
    margin-right: 8px;
    font-size: 16px;
}

.crash-dialog-title {
    flex: 1;
    font-weight: bold;
}

.crash-dialog-close {
    width: 20px;
    height: 18px;
    background: #c0c0c0;
    border: 1px outset #c0c0c0;
    text-align: center;
    line-height: 16px;
    cursor: pointer;
    font-family: monospace;
}

.crash-dialog-close:hover {
    background: #e0e0e0;
}

.crash-dialog-close:active {
    border: 1px inset #c0c0c0;
}

.crash-dialog-content {
    padding: 20px;
    background: #f0f0f0;
}

.crash-dialog-message {
    margin-bottom: 15px;
    color: #000;
}

.crash-dialog-details {
    font-family: monospace;
    font-size: 10px;
    color: #666;
    margin-bottom: 20px;
    padding: 10px;
    background: #fff;
    border: 1px inset #c0c0c0;
}

.crash-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.crash-btn {
    padding: 5px 15px;
    background: #e0e0e0;
    border: 1px outset #c0c0c0;
    font-size: 11px;
    cursor: pointer;
    min-width: 80px;
}

.crash-btn:hover {
    background: #f0f0f0;
}

.crash-btn:active {
    border: 1px inset #c0c0c0;
    background: #d0d0d0;
}

.crash-btn-primary {
    background: #e0e0e0;
    font-weight: bold;
}

@keyframes dialogAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes dialogFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Nuclear Alert Dialog */
.nuclear-alert-dialog {
    position: fixed;
    width: 500px;
    background: #1a0000;
    border: 3px solid #ff0000;
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
    font-family: 'VT323', monospace;
    z-index: 3000;
    animation: nuclearPulse 0.5s infinite, dialogAppear 0.3s ease-out;
}

.nuclear-alert-header {
    background: linear-gradient(to bottom, #ff0000, #cc0000);
    color: #ffffff;
    padding: 10px;
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
}

.nuclear-alert-icon {
    margin-right: 10px;
    font-size: 24px;
    animation: spin 2s linear infinite;
}

.nuclear-alert-title {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
}

.nuclear-alert-content {
    padding: 30px;
    background: #1a0000;
    color: #ffffff;
    text-align: center;
}

.nuclear-alert-message {
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.nuclear-alert-countdown {
    font-size: 24px;
    color: #ff0000;
    font-weight: bold;
    margin: 20px 0;
    animation: countdownBlink 1s infinite;
}

.countdown-timer {
    font-size: 32px;
    text-shadow: 0 0 10px #ff0000;
}

.nuclear-alert-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.nuclear-btn {
    padding: 15px 30px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    cursor: pointer;
    border: 2px solid;
    background: transparent;
    color: #ffffff;
    transition: all 0.3s;
}

.nuclear-btn-danger {
    border-color: #ff0000;
    color: #ff0000;
}

.nuclear-btn-danger:hover {
    background: #ff0000;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

.nuclear-btn-warning {
    border-color: #ffff00;
    color: #ffff00;
}

.nuclear-btn-warning:hover {
    background: #ffff00;
    color: #000000;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.6);
}

@keyframes nuclearPulse {
    0%, 100% {
        box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
    }
    50% {
        box-shadow: 0 0 60px rgba(255, 0, 0, 1);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes countdownBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}