@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
    font-family: 'Orbitron', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00ffff, #0080ff, #8000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    margin-bottom: 10px;
    animation: titleGlow 3s ease-in-out infinite alternate;
    position: absolute;
    top: 20vh;
    z-index: 10;
    display: none; /* Hidden by default, shown only on home screen */
}

@keyframes titleGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.2); }
}

.game-subtitle {
    font-size: 1rem;
    color: #888;
    margin-bottom: 20px;
    text-align: center;
    position: absolute;
    top: 30vh;
    z-index: 10;
    display: none; /* Hidden by default, shown only on home screen */
}

#gameCanvas {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #1a1a1a;
    cursor: crosshair;
    width: 100vw !important;
    height: 100vh !important;
    display: block;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1;
    margin: 0 !important;
    padding: 0 !important;
}

.controls {
    display: none; /* Hidden during gameplay for fullscreen experience */
    gap: 20px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #bbb;
    position: absolute;
    bottom: 20vh;
    z-index: 10;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key {
    background: #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    color: #00ffff;
    border: 1px solid #555;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: #00ffff;
    font-family: 'Press Start 2P', monospace;
    text-transform: uppercase;
    text-align: center;    animation: pulse 2s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

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

.game-stats {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    padding: 12px;
    border-radius: 4px;
    border: 2px solid #00ffff;
    min-width: 220px;
    backdrop-filter: blur(5px);
    font-family: 'Press Start 2P', monospace;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    animation: statsGlow 4s ease-in-out infinite alternate;
}

@keyframes statsGlow {
    0% { 
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
        border-color: #00ffff;
    }
    100% { 
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
        border-color: #00ccff;
    }
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 8px;
    line-height: 12px;
}

.stat-label {
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    color: #00ffff;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 255, 255, 0.6);
    transition: all 0.2s ease;
}

.stat-value.flash {
    color: #00ff00;
    transform: scale(1.1);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
}

/* Additional pixel font styling for UI elements */
.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(45deg, #00ffff, #0080ff, #8000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    margin-bottom: 10px;
    animation: titleGlow 3s ease-in-out infinite alternate;
    font-size: 1.5rem; /* Smaller for pixel font readability */
}

.game-subtitle {
    font-size: 0.6rem;
    color: #888;
    margin-bottom: 20px;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    text-transform: uppercase;
}

/* Control styling with pixel font */
.controls {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    font-family: 'Press Start 2P', monospace;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.5rem;
    color: #888;
}

.key {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    padding: 8px 12px;
    border-radius: 4px;
    color: #00ffff;
    font-weight: bold;
    font-size: 0.4rem;
    text-transform: uppercase;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

/* Opening Animation Styles */
.game-container.opening-animation {
    gap: 0;
}

.game-container.opening-animation .game-title,
.game-container.opening-animation .game-subtitle,
.game-container.opening-animation .controls {
    display: none;
}

#gameCanvas {
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    background: #0a0a0a;
    cursor: crosshair;
    transition: box-shadow 0.3s ease;
}

/* Responsive Design */
@media (max-width: 900px) {
    .game-container {
        padding: 20px;
    }
    
    #gameCanvas {
        width: min(90vw, 800px);
        height: calc(min(90vw, 800px) * 0.75); /* Maintain 4:3 aspect ratio */
        max-width: 800px;
        max-height: 600px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
    }
    
    .controls {
        font-size: 0.8rem;
        gap: 15px;
    }
    
    .game-stats {
        top: 10px;
        left: 10px;
        padding: 10px;
        min-width: 160px;
    }
}

@media (orientation: landscape) and (max-height: 700px) {
    .game-container {
        gap: 10px;
    }
    
    .game-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .game-subtitle {
        margin-bottom: 10px;
    }
}

/* ===== ACCESSIBILITY STYLES ===== */
/* High contrast mode */
body.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .game-container {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.high-contrast .game-stats {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
}

body.high-contrast .stat-value {
    color: #ffff00 !important;
    text-shadow: none !important;
}

body.high-contrast .key {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #ffffff !important;
}

/* Large text mode */
body.large-text {
    font-size: 1.2em;
}

body.large-text .game-title {
    font-size: 3rem;
}

body.large-text .game-subtitle {
    font-size: 0.8rem;
}

body.large-text .stat-label,
body.large-text .stat-value {
    font-size: 16px;
}

body.large-text .controls {
    font-size: 12px;
}

body.large-text .key {
    padding: 6px 10px;
    font-size: 12px;
}
