/* Human Firewall - Main Styles */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #000000;
    color: #00FF41;
    overflow: hidden;
}

/* Game container */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Screen management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.screen.hidden {
    display: none;
}

/* Game canvas - Full screen */
#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #000000;
    z-index: 1;
    display: block;
    pointer-events: auto;
    cursor: crosshair;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
}

/* Game screen layout - Full screen */
#game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 0;
    overflow: hidden;
}

#game-screen.hidden {
    display: none;
}

/* Canvas container - Full screen */
#game-screen canvas {
    width: 100vw !important;
    height: 100vh !important;
}

/* Instructions Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

#instructions-content {
    max-width: 600px;
    width: 90%;
    padding: 40px;
    border: 2px solid #00BFFF;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.1), rgba(0, 0, 0, 0.9));
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 191, 255, 0.3);
    text-align: center;
    animation: fadeInScale 0.8s ease-out;
}

#instructions-header h2 {
    font-size: 2rem;
    color: #00BFFF;
    text-shadow: 0 0 15px #00BFFF;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.instruction-subtitle {
    font-size: 1rem;
    color: #00FF41;
    text-shadow: 0 0 8px #00FF41;
    letter-spacing: 1px;
    margin-bottom: 30px;
}

#instructions-body {
    text-align: left;
    margin: 30px 0;
}

.instruction-section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid rgba(0, 255, 65, 0.3);
    background: rgba(0, 255, 65, 0.05);
    border-radius: 5px;
}

.instruction-section h3 {
    font-size: 1.2rem;
    color: #00BFFF;
    text-shadow: 0 0 8px #00BFFF;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
}

.instruction-section p {
    color: #00FF41;
    text-shadow: 0 0 5px #00FF41;
    line-height: 1.5;
    font-size: 0.95rem;
}

.control-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 15px;
}

.control-key {
    background: rgba(0, 191, 255, 0.2);
    border: 1px solid #00BFFF;
    color: #00BFFF;
    text-shadow: 0 0 5px #00BFFF;
    padding: 5px 12px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
}

.control-desc {
    color: #00FF41;
    text-shadow: 0 0 5px #00FF41;
    font-size: 0.9rem;
}

.instruction-button {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.3), rgba(0, 255, 65, 0.3));
    border: 2px solid #00BFFF;
    color: #00BFFF;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 15px 30px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px #00BFFF;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
    border-radius: 5px;
}

.instruction-button:hover {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.5), rgba(0, 255, 65, 0.5));
    border-color: #00FF41;
    color: #00FF41;
    text-shadow: 0 0 15px #00FF41;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    transform: scale(1.05);
}

.instruction-button:active {
    transform: scale(0.98);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Basic styling */
h1 {
    color: #00BFFF;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px #00BFFF;
}

/* HUD Interface Styles */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Ensure HUD doesn't block canvas clicks */
#hud * {
    pointer-events: none;
}

/* Only allow pointer events on interactive HUD elements */
#hud button,
#hud .interactive {
    pointer-events: auto;
}

/* Grid overlay for retro aesthetic */
#grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
    animation: gridPulse 4s ease-in-out infinite alternate;
}

/* Canvas area background effects */
#game-canvas::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(0, 255, 65, 0.2) 0%, 
        rgba(0, 191, 255, 0.2) 25%, 
        rgba(0, 255, 65, 0.2) 50%, 
        rgba(0, 191, 255, 0.2) 75%, 
        rgba(0, 255, 65, 0.2) 100%);
    background-size: 40px 40px;
    animation: borderScan 3s linear infinite;
    z-index: -1;
    border-radius: 2px;
}

/* Spawn area indicators (subtle visual cues) */
.spawn-indicator {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(0, 191, 255, 0.6);
    border-radius: 50%;
    animation: spawnPulse 2s ease-in-out infinite;
    z-index: 3;
}

.spawn-indicator.top {
    top: -2px;
    animation-delay: 0s;
}

.spawn-indicator.left {
    left: -2px;
    animation-delay: 0.5s;
}

.spawn-indicator.right {
    right: -2px;
    animation-delay: 1s;
}

/* Canvas animations */
@keyframes gridPulse {
    0%, 100% { 
        opacity: 0.3;
        background-size: 20px 20px;
    }
    50% { 
        opacity: 0.6;
        background-size: 22px 22px;
    }
}

@keyframes borderScan {
    0% { 
        background-position: 0 0;
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
    100% { 
        background-position: 40px 40px;
        opacity: 0.3;
    }
}

@keyframes spawnPulse {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.5);
    }
}

/* Compact Top HUD bar - Single line layout */
#hud-top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;  /* Reduced height for compact single-line layout */
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 100%);
    border-bottom: 2px solid rgba(0, 255, 65, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    z-index: 100;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

/* HUD sections layout - Single line horizontal */
#hud-left-section, #hud-center-section, #hud-right-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

#hud-left-section {
    flex: 1;
    justify-content: flex-start;
}

#hud-center-section {
    flex: 1.5;
    justify-content: center;
}

#hud-right-section {
    flex: 1;
    justify-content: flex-end;
}

#system-status, #phase-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#system-label, #phase-label {
    color: #00BFFF;
    font-weight: bold;
    text-shadow: 0 0 5px #00BFFF;
}

#status-message {
    color: #00FF41;
    font-weight: bold;
    text-shadow: 0 0 5px #00FF41;
    animation: flicker 2s infinite alternate;
}

#current-phase {
    color: #00FF41;
    font-weight: bold;
    text-shadow: 0 0 5px #00FF41;
    padding: 2px 8px;
    border: 1px solid #00FF41;
    background: rgba(0, 255, 65, 0.1);
}

#phase-timer {
    color: #00BFFF;
    font-weight: bold;
    text-shadow: 0 0 5px #00BFFF;
}

/* Side HUD panel removed - all content moved to top */

/* Corruption meter - Compact horizontal layout */
#corruption-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

#corruption-label {
    color: #00BFFF;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 0 0 5px #00BFFF;
    letter-spacing: 1px;
    white-space: nowrap;
}

#corruption-meter-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}

#corruption-meter {
    flex: 1;
    height: 16px;  /* Slightly smaller for compact layout */
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00FF41;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    min-width: 100px;
}

#corruption-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00FF41 0%, #FFD700 50%, #FF4500 100%);
    transition: width 0.3s ease;
    position: relative;
}

#corruption-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: scan 2s infinite linear;
}

#corruption-percentage {
    color: #00FF41;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 5px #00FF41;
    min-width: 30px;
}

/* Firewall status indicators - Compact horizontal layout */
#firewall-status {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #00FF41;
    text-shadow: 0 0 3px #00FF41;
    white-space: nowrap;
}

.status-indicator {
    width: 6px;  /* Smaller for compact layout */
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active {
    background: #00FF41;
    box-shadow: 0 0 8px #00FF41;
    animation: pulse 1.5s infinite;
}

.status-indicator.warning {
    background: #FFD700;
    box-shadow: 0 0 8px #FFD700;
    animation: pulse 1s infinite;
}

.status-indicator.error {
    background: #FF4500;
    box-shadow: 0 0 8px #FF4500;
    animation: pulse 0.5s infinite;
}

/* Animations */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes glitch {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px); }
    20% { transform: translateX(2px); }
    30% { transform: translateX(-1px); }
    40% { transform: translateX(1px); }
    50% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
    90% { transform: translateX(-2px); }
}

/* Visual Feedback Animations */
@keyframes successPulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(0, 255, 65, 0);
        transform: scale(1.1);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0);
        transform: scale(1);
    }
}

@keyframes failurePulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 68, 68, 0);
        transform: scale(1.1);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
        transform: scale(1);
    }
}

@keyframes clickRipple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes objectHitFlash {
    0%, 100% { 
        border-color: transparent;
        box-shadow: none;
    }
    50% { 
        border-color: #00FF41;
        box-shadow: 0 0 20px #00FF41;
    }
}

@keyframes corruptionAlert {
    0%, 100% { 
        background-color: rgba(255, 68, 68, 0.1);
        border-color: #FF4444;
    }
    50% { 
        background-color: rgba(255, 68, 68, 0.3);
        border-color: #FF6666;
    }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px); }
    20% { transform: translateX(2px); }
    30% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    50% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
    70% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    90% { transform: translateX(-2px); }
}

/* Flickering effect for system messages */
.flicker-text {
    animation: flicker 0.5s infinite alternate;
}

.glitch-text {
    animation: glitch 0.3s infinite;
}

/* Visual Feedback Classes */
.success-feedback {
    animation: successPulse 0.5s ease-out;
}

.failure-feedback {
    animation: failurePulse 0.5s ease-out;
}

.click-ripple {
    animation: clickRipple 0.5s ease-out;
}

.object-hit {
    animation: objectHitFlash 0.3s ease-out;
}

.corruption-alert {
    animation: corruptionAlert 1s ease-in-out infinite;
}

.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

/* Corruption meter feedback states */
#corruption-meter.warning {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#corruption-meter.danger {
    border-color: #FF4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.7);
    animation: corruptionAlert 0.5s ease-in-out infinite;
}

#corruption-meter.critical {
    border-color: #FF0000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.9);
    animation: corruptionAlert 0.3s ease-in-out infinite;
}

/* Status message feedback */
#status-message.success {
    color: #00FF41;
    text-shadow: 0 0 10px #00FF41;
    animation: successPulse 1s ease-out;
}

#status-message.warning {
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
    animation: pulse 1s ease-in-out infinite;
}

#status-message.error {
    color: #FF4444;
    text-shadow: 0 0 10px #FF4444;
    animation: failurePulse 0.5s ease-out infinite;
}

/* Start Screen Styles */
#start-screen {
    background-image: url('../assets/TitleArt.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#start-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.start-button {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.3), rgba(0, 255, 65, 0.3));
    border: 3px solid #00BFFF;
    color: #00BFFF;
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: bold;
    padding: 20px 60px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-shadow: 0 0 15px #00BFFF;
    box-shadow: 0 0 30px rgba(0, 191, 255, 0.5);
    border-radius: 10px;
    backdrop-filter: blur(5px);
    white-space: nowrap;
    min-width: fit-content;
    pointer-events: auto;
    z-index: 100;
}

.start-button:hover {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.5), rgba(0, 255, 65, 0.5));
    border-color: #00FF41;
    color: #00FF41;
    text-shadow: 0 0 20px #00FF41;
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.7);
    transform: scale(1.1);
}

.start-button:active {
    transform: scale(1.05);
}

.start-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.start-button:hover::before {
    left: 100%;
}

/* Main Menu Styles */
#main-menu {
    background-image: url('../assets/TitleArt.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    justify-content: center;
    align-items: center;
    position: relative;
}

#main-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.9) 70%);
    z-index: 1;
}

#menu-content {
    text-align: center;
    max-width: 800px;
    width: 100%;
    padding: 40px;
    z-index: 10;
    position: relative;
    margin: 0 auto;
}

#title-section {
    margin-bottom: 40px;
}

#main-title {
    font-size: 4rem;
    color: #00BFFF;
    text-shadow: 0 0 20px #00BFFF, 0 0 40px #00BFFF;
    letter-spacing: 4px;
    margin-bottom: 20px;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

#activation-text {
    font-size: 1.2rem;
    color: #00FF41;
    text-shadow: 0 0 10px #00FF41;
    letter-spacing: 2px;
    animation: typewriter 2s steps(12) infinite;
}

#narrative-section {
    margin: 40px 0;
    padding: 30px;
    border: 2px solid #00FF41;
    background: rgba(0, 255, 65, 0.05);
    border-radius: 5px;
}

.narrative-text p {
    color: #00FF41;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    text-shadow: 0 0 5px #00FF41;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.narrative-text p:nth-child(1) { animation-delay: 0.5s; }
.narrative-text p:nth-child(2) { animation-delay: 1s; }
.narrative-text p:nth-child(3) { animation-delay: 1.5s; }
.narrative-text p:nth-child(4) { animation-delay: 2s; }

#menu-controls {
    margin: 40px 0;
}

.menu-button {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.2), rgba(0, 255, 65, 0.2));
    border: 2px solid #00BFFF;
    color: #00BFFF;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 20px 40px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px #00BFFF;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
}

.menu-button:hover {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.4), rgba(0, 255, 65, 0.4));
    border-color: #00FF41;
    color: #00FF41;
    text-shadow: 0 0 15px #00FF41;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    transform: scale(1.05);
}

.menu-button:active {
    transform: scale(0.98);
}

.menu-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.menu-button:hover::before {
    left: 100%;
}

.button-text {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.button-subtext {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: normal;
}

#system-info {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 255, 65, 0.3);
}

.info-line {
    color: #00FF41;
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-shadow: 0 0 5px #00FF41;
    opacity: 0.8;
}

/* Menu background grid */
#menu-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 191, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 191, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    z-index: 5;
}

/* Menu Animations */
@keyframes titleGlow {
    0%, 100% { 
        text-shadow: 0 0 20px #00BFFF, 0 0 40px #00BFFF;
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 30px #00BFFF, 0 0 60px #00BFFF, 0 0 80px #00BFFF;
        transform: scale(1.02);
    }
}

@keyframes typewriter {
    0%, 50% { content: 'ACTIVATING...'; }
    51%, 100% { content: 'ACTIVATING'; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Responsive design for start screen */
@media (max-width: 768px) {
    .start-button {
        font-size: 1.5rem;
        padding: 15px 40px;
        letter-spacing: 2px;
    }
    
    #start-content {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .start-button {
        font-size: 1.2rem;
        padding: 12px 30px;
        letter-spacing: 1px;
    }
    
    #start-content {
        padding: 10px;
    }
}

/* For very tall screens */
@media (min-height: 800px) {
    #start-content {
        padding: 30px;
    }
}

/* For very short screens */
@media (max-height: 600px) {
    #start-content {
        padding: 10px;
    }
    
    .start-button {
        font-size: 1.5rem;
        padding: 12px 40px;
    }
}

/* Responsive design for menu */
@media (max-width: 768px) {
    #main-title {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }
    
    #menu-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .narrative-text p {
        font-size: 0.9rem;
    }
    
    .menu-button {
        padding: 15px 30px;
        font-size: 1rem;
    }
}

/* Game Over Overlay Styles */
#game-over {
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    animation: fadeIn 1s ease-out;
}

#game-over-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    border: 2px solid #FF4500;
    background: linear-gradient(135deg, rgba(255, 69, 0, 0.1), rgba(0, 0, 0, 0.9));
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(255, 69, 0, 0.3);
    z-index: 100;
    position: relative;
}

#game-over.success #game-over-content {
    border-color: #00BFFF;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.1), rgba(0, 0, 0, 0.9));
    box-shadow: 0 0 50px rgba(0, 191, 255, 0.3);
}

#game-over-header {
    margin-bottom: 30px;
}

#game-over-title {
    font-size: 2.5rem;
    color: #FF4500;
    text-shadow: 0 0 20px #FF4500;
    letter-spacing: 3px;
    margin-bottom: 10px;
    animation: flicker 0.5s infinite alternate;
}

#game-over.success #game-over-title {
    color: #00BFFF;
    text-shadow: 0 0 20px #00BFFF;
}

#game-over-subtitle {
    font-size: 1.2rem;
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
    letter-spacing: 2px;
}

#game-over.success #game-over-subtitle {
    color: #00FF41;
    text-shadow: 0 0 10px #00FF41;
}

#game-over-message {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid rgba(255, 69, 0, 0.3);
    background: rgba(255, 69, 0, 0.05);
    border-radius: 5px;
}

#game-over.success #game-over-message {
    border-color: rgba(0, 191, 255, 0.3);
    background: rgba(0, 191, 255, 0.05);
}

#primary-message {
    font-size: 1.4rem;
    color: #FF4500;
    text-shadow: 0 0 10px #FF4500;
    margin-bottom: 15px;
    font-weight: bold;
}

#game-over.success #primary-message {
    color: #00BFFF;
    text-shadow: 0 0 10px #00BFFF;
}

#secondary-message {
    font-size: 1rem;
    color: #FFD700;
    text-shadow: 0 0 5px #FFD700;
    line-height: 1.5;
}

#game-over.success #secondary-message {
    color: #00FF41;
    text-shadow: 0 0 5px #00FF41;
}

#game-over-stats {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid rgba(0, 255, 65, 0.3);
    background: rgba(0, 255, 65, 0.05);
    border-radius: 5px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

.stat-label {
    color: #00FF41;
    text-shadow: 0 0 5px #00FF41;
}

.stat-value {
    color: #00BFFF;
    text-shadow: 0 0 5px #00BFFF;
    font-weight: bold;
}

#game-over-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-over-button {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.2), rgba(0, 255, 65, 0.2));
    border: 2px solid #00BFFF;
    color: #00BFFF;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    padding: 15px 25px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px #00BFFF;
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
    border-radius: 5px;
}

.game-over-button:hover {
    background: linear-gradient(45deg, rgba(0, 191, 255, 0.4), rgba(0, 255, 65, 0.4));
    border-color: #00FF41;
    color: #00FF41;
    text-shadow: 0 0 15px #00FF41;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.5);
    transform: scale(1.05);
}

.game-over-button:active {
    transform: scale(0.98);
}

.game-over-button .button-text {
    display: block;
    font-size: 1rem;
    margin-bottom: 3px;
}

.game-over-button .button-subtext {
    display: block;
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: normal;
}

/* Glitch and screen effects */
#glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 69, 0, 0.1) 2px,
        rgba(255, 69, 0, 0.1) 4px
    );
    animation: screenFlicker 0.1s infinite;
    pointer-events: none;
    z-index: 50;
}

#game-over.success #glitch-overlay {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 191, 255, 0.1) 2px,
        rgba(0, 191, 255, 0.1) 4px
    );
}

#data-flood {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(255, 69, 0, 0.1) 0%, 
        rgba(255, 215, 0, 0.1) 25%, 
        rgba(255, 69, 0, 0.1) 50%, 
        rgba(255, 215, 0, 0.1) 75%, 
        rgba(255, 69, 0, 0.1) 100%);
    background-size: 20px 20px;
    animation: dataFlood 2s linear infinite;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
}

#game-over.failure #data-flood {
    opacity: 0.3;
}

/* Game Over Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes screenFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes dataFlood {
    0% { transform: translateX(-20px) translateY(-20px); }
    100% { transform: translateX(0) translateY(0); }
}

/* Responsive design for game over */
@media (max-width: 768px) {
    #game-over-content {
        padding: 20px;
        max-width: 90%;
    }
    
    #game-over-title {
        font-size: 2rem;
    }
    
    #game-over-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .game-over-button {
        width: 100%;
        max-width: 250px;
    }
}

/* Responsive design for instructions overlay */
@media (max-width: 768px) {
    #instructions-content {
        padding: 25px;
        width: 95%;
    }
    
    #instructions-header h2 {
        font-size: 1.5rem;
    }
    
    .instruction-section {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .instruction-section h3 {
        font-size: 1.1rem;
    }
    
    .control-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .control-key {
        min-width: auto;
        width: fit-content;
    }
    
    .instruction-button {
        font-size: 1rem;
        padding: 12px 25px;
    }
}

@media (max-width: 480px) {
    #instructions-content {
        padding: 20px;
        width: 98%;
    }
    
    #instructions-header h2 {
        font-size: 1.3rem;
        letter-spacing: 1px;
    }
    
    .instruction-subtitle {
        font-size: 0.9rem;
    }
    
    .instruction-section p,
    .control-desc {
        font-size: 0.85rem;
    }
    
    .instruction-button {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

/* Responsive design for compact top HUD */
@media (max-width: 768px) {
    #hud-top {
        height: 45px;
        padding: 6px 15px;
        font-size: 11px;
        gap: 10px;
    }
    
    #hud-left-section, #hud-center-section, #hud-right-section {
        gap: 8px;
    }
    
    #corruption-meter-container {
        min-width: 120px;
    }
    
    #corruption-label {
        font-size: 9px;
    }
    
    #corruption-percentage {
        font-size: 9px;
    }
    
    .status-line {
        font-size: 8px;
        gap: 3px;
    }
    
    #firewall-status {
        gap: 8px;
    }
    
    /* Canvas remains full screen */
    #game-screen canvas {
        width: 100vw !important;
        height: 100vh !important;
    }
}

@media (max-width: 480px) {
    #hud-top {
        height: 40px;  /* Very compact for mobile */
        padding: 4px 10px;
        font-size: 9px;
        gap: 5px;
    }
    
    #hud-left-section, #hud-center-section, #hud-right-section {
        gap: 5px;
    }
    
    #hud-left-section {
        flex: 0.8;
    }
    
    #hud-center-section {
        flex: 1.4;
    }
    
    #hud-right-section {
        flex: 0.8;
    }
    
    #corruption-meter {
        height: 12px;
    }
    
    #corruption-meter-container {
        min-width: 80px;
    }
    
    #corruption-label {
        font-size: 8px;
    }
    
    .status-indicator {
        width: 4px;
        height: 4px;
    }
    
    .status-line {
        font-size: 7px;
        gap: 2px;
    }
    
    #firewall-status {
        gap: 4px;
    }
    
    /* Hide some status indicators on very small screens */
    .status-line:nth-child(3) {
        display: none;
    }
    
    /* Canvas remains full screen on mobile */
    #game-screen canvas {
        width: 100vw !important;
        height: 100vh !important;
    }
    
    /* Reduce grid overlay on mobile for performance */
    #grid-overlay {
        background-size: 30px 30px;
        opacity: 0.5;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    #hud-top {
        height: 35px;  /* Very compact for landscape */
        font-size: 9px;
        padding: 4px 15px;
    }
    
    #hud-left-section, #hud-center-section, #hud-right-section {
        gap: 8px;
    }
    
    #corruption-meter-container {
        min-width: 100px;
    }
    
    /* Canvas remains full screen in landscape */
    #game-screen canvas {
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .status-line {
        font-size: 7px;
    }
    
    #corruption-label {
        font-size: 7px;
    }
    
    #corruption-meter {
        height: 10px;
    }
    
    .status-indicator {
        width: 4px;
        height: 4px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .start-button,
    .menu-button,
    .game-over-button,
    .instruction-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase touch targets */
    .start-button {
        padding: 20px 50px;
    }
    
    .menu-button {
        padding: 20px 35px;
    }
    
    /* Remove hover effects on touch devices */
    .start-button:hover,
    .menu-button:hover,
    .game-over-button:hover,
    .instruction-button:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .start-button:active,
    .menu-button:active,
    .game-over-button:active,
    .instruction-button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}/* Respo
nsive design for start screen */
@media (max-width: 768px) {
    .start-button {
        font-size: 1.5rem;
        padding: 15px 40px;
        letter-spacing: 2px;
    }
    
    #start-content {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .start-button {
        font-size: 1.2rem;
        padding: 12px 30px;
        letter-spacing: 1px;
    }
    
    #start-content {
        padding: 10px;
    }
}

/* For very tall screens */
@media (min-height: 800px) {
    #start-content {
        padding: 30px;
    }
}

/* For very short screens */
@media (max-height: 600px) {
    #start-content {
        padding: 10px;
    }
    
    .start-button {
        font-size: 1.5rem;
        padding: 12px 40px;
    }
}
/* E
nhanced Audio and Visual Effects */

/* Corruption meter enhanced animations */
@keyframes corruptionRise {
    0% { 
        transform: scaleY(0);
        filter: brightness(1);
    }
    50% {
        transform: scaleY(1.1);
        filter: brightness(1.3);
    }
    100% { 
        transform: scaleY(1);
        filter: brightness(1);
    }
}

@keyframes corruptionPulse {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 25px rgba(255, 68, 68, 0.9);
        transform: scale(1.02);
    }
}

@keyframes systemAlertFlash {
    0%, 100% { 
        background-color: rgba(255, 215, 0, 0.1);
        border-color: #FFD700;
        color: #FFD700;
    }
    25% { 
        background-color: rgba(255, 68, 68, 0.2);
        border-color: #FF4444;
        color: #FF4444;
    }
    50% { 
        background-color: rgba(255, 215, 0, 0.3);
        border-color: #FFD700;
        color: #FFD700;
    }
    75% { 
        background-color: rgba(255, 68, 68, 0.2);
        border-color: #FF4444;
        color: #FF4444;
    }
}

@keyframes phaseTransition {
    0% { 
        opacity: 1;
        transform: translateX(0);
    }
    25% { 
        opacity: 0.5;
        transform: translateX(-10px);
    }
    50% { 
        opacity: 0;
        transform: translateX(0);
    }
    75% { 
        opacity: 0.5;
        transform: translateX(10px);
    }
    100% { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gameOverGlitch {
    0%, 100% { 
        transform: translateX(0);
        filter: hue-rotate(0deg);
    }
    10% { 
        transform: translateX(-5px);
        filter: hue-rotate(90deg);
    }
    20% { 
        transform: translateX(5px);
        filter: hue-rotate(180deg);
    }
    30% { 
        transform: translateX(-3px);
        filter: hue-rotate(270deg);
    }
    40% { 
        transform: translateX(3px);
        filter: hue-rotate(360deg);
    }
    50% { 
        transform: translateX(-2px);
        filter: hue-rotate(180deg);
    }
    60% { 
        transform: translateX(2px);
        filter: hue-rotate(90deg);
    }
    70% { 
        transform: translateX(-1px);
        filter: hue-rotate(270deg);
    }
    80% { 
        transform: translateX(1px);
        filter: hue-rotate(0deg);
    }
    90% { 
        transform: translateX(-1px);
        filter: hue-rotate(45deg);
    }
}

@keyframes successCelebration {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    25% { 
        transform: scale(1.1) rotate(2deg);
        filter: brightness(1.3);
    }
    50% { 
        transform: scale(1.05) rotate(-1deg);
        filter: brightness(1.5);
    }
    75% { 
        transform: scale(1.08) rotate(1deg);
        filter: brightness(1.2);
    }
}

@keyframes dataStreamIntensify {
    0% { 
        background-size: 20px 20px;
        opacity: 0.3;
    }
    50% { 
        background-size: 15px 15px;
        opacity: 0.7;
    }
    100% { 
        background-size: 10px 10px;
        opacity: 0.5;
    }
}

@keyframes corruptionSpread {
    0% { 
        background: linear-gradient(90deg, #00FF41 0%, #00FF41 100%);
    }
    25% { 
        background: linear-gradient(90deg, #00FF41 0%, #FFD700 25%, #00FF41 100%);
    }
    50% { 
        background: linear-gradient(90deg, #00FF41 0%, #FFD700 50%, #00FF41 100%);
    }
    75% { 
        background: linear-gradient(90deg, #00FF41 0%, #FFD700 50%, #FF4500 75%, #00FF41 100%);
    }
    100% { 
        background: linear-gradient(90deg, #00FF41 0%, #FFD700 30%, #FF4500 70%, #FF0000 100%);
    }
}

/* Enhanced corruption meter states */
#corruption-fill.rising {
    animation: corruptionRise 0.5s ease-out;
}

#corruption-meter.pulsing {
    animation: corruptionPulse 1s ease-in-out infinite;
}

#corruption-meter.spreading #corruption-fill {
    animation: corruptionSpread 2s ease-in-out;
}

/* System alert animations */
.system-alert {
    animation: systemAlertFlash 0.5s ease-in-out infinite;
}

.system-critical {
    animation: systemAlertFlash 0.3s ease-in-out infinite, screenShake 0.1s ease-in-out infinite;
}

/* Phase transition effects */
.phase-changing {
    animation: phaseTransition 1s ease-in-out;
}

/* Game over enhanced effects */
#game-over.glitch-effect {
    animation: gameOverGlitch 0.2s ease-in-out infinite;
}

#game-over.success .success-celebration {
    animation: successCelebration 2s ease-in-out;
}

/* Data stream intensity effects */
#grid-overlay.intense {
    animation: dataStreamIntensify 3s ease-in-out infinite;
}

/* Audio feedback visual indicators */
.audio-feedback {
    position: relative;
}

.audio-feedback::after {
    content: '♪';
    position: absolute;
    top: -10px;
    right: -10px;
    color: #00BFFF;
    font-size: 12px;
    animation: audioIndicator 0.5s ease-out;
    pointer-events: none;
}

@keyframes audioIndicator {
    0% { 
        opacity: 0;
        transform: scale(0.5) translateY(0);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2) translateY(-5px);
    }
    100% { 
        opacity: 0;
        transform: scale(1) translateY(-10px);
    }
}

/* Enhanced click feedback */
.click-success {
    animation: successPulse 0.3s ease-out, audioIndicator 0.5s ease-out;
}

.click-failure {
    animation: failurePulse 0.3s ease-out, screenShake 0.2s ease-out;
}

.click-miss {
    animation: pulse 0.2s ease-out;
}

/* Screen flash effects for audio feedback */
.screen-flash-success {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 65, 0.1);
    pointer-events: none;
    z-index: 9999;
    animation: screenFlashSuccess 0.2s ease-out;
}

.screen-flash-failure {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 68, 68, 0.2);
    pointer-events: none;
    z-index: 9999;
    animation: screenFlashFailure 0.3s ease-out;
}

.screen-flash-phase {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 191, 255, 0.15);
    pointer-events: none;
    z-index: 9999;
    animation: screenFlashPhase 0.8s ease-out;
}

@keyframes screenFlashSuccess {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes screenFlashFailure {
    0% { opacity: 0; }
    25% { opacity: 1; }
    50% { opacity: 0; }
    75% { opacity: 0.5; }
    100% { opacity: 0; }
}

@keyframes screenFlashPhase {
    0% { opacity: 0; }
    20% { opacity: 1; }
    40% { opacity: 0; }
    60% { opacity: 0.7; }
    80% { opacity: 0; }
    100% { opacity: 0; }
}

/* Enhanced HUD animations */
#status-message.audio-enhanced {
    animation: pulse 0.5s ease-in-out, audioIndicator 0.5s ease-out;
}

#current-phase.phase-change-audio {
    animation: phaseTransition 1s ease-in-out, audioIndicator 0.8s ease-out 0.2s;
}

/* Corruption meter audio-visual sync */
#corruption-percentage.corruption-audio {
    animation: corruptionPulse 0.5s ease-out, audioIndicator 0.3s ease-out 0.1s;
}

/* Game over audio-visual effects */
#game-over-title.audio-enhanced {
    animation: gameOverGlitch 0.5s ease-in-out 3, audioIndicator 1s ease-out;
}

#game-over.success #game-over-title.audio-enhanced {
    animation: successCelebration 2s ease-in-out, audioIndicator 0.8s ease-out 0.5s;
}

/* Performance optimizations for animations */
.reduce-motion {
    animation-duration: 0.1s !important;
    animation-iteration-count: 1 !important;
}

/* Accessibility: Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .flicker-text,
    .glitch-text,
    .system-alert,
    .system-critical {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #corruption-fill {
        background: linear-gradient(90deg, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
    }
    
    .status-indicator.active {
        background: #00FF00;
        box-shadow: 0 0 10px #00FF00;
    }
    
    .status-indicator.warning {
        background: #FFFF00;
        box-shadow: 0 0 10px #FFFF00;
    }
    
    .status-indicator.error {
        background: #FF0000;
        box-shadow: 0 0 10px #FF0000;
    }
}