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

body {
    background: #000;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

#objective {
    color: #fff;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    letter-spacing: 2px;
}

#level-display {
    color: #c9b458;
    font-size: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

#key-display {
    color: #ffd700;
    font-size: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    letter-spacing: 2px;
}

#key-display.complete {
    color: #4a9;
    animation: key-pulse 1s infinite;
}

@keyframes key-pulse {
    0%, 100% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(68, 170, 153, 0.5); }
    50% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px rgba(68, 170, 153, 0.8); }
}

/* Stats Sidebar */
#stats-sidebar {
    position: absolute;
    top: 60px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(201, 180, 88, 0.3);
    padding: 10px 15px;
    min-width: 140px;
    z-index: 15;
    font-size: 12px;
}

.sidebar-title {
    color: #c9b458;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(201, 180, 88, 0.3);
    padding-bottom: 4px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(201, 180, 88, 0.2);
    margin: 10px 0;
}

.stat-item {
    display: flex;
    align-items: center;
    margin: 6px 0;
    color: #aaa;
}

.stat-icon {
    width: 20px;
    height: 20px;
    background: rgba(201, 180, 88, 0.2);
    border: 1px solid rgba(201, 180, 88, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c9b458;
    font-weight: bold;
    font-size: 11px;
    margin-right: 8px;
}

.stat-label {
    flex: 1;
    color: #888;
}

.stat-value {
    color: #fff;
    font-weight: bold;
}

#upgrades-list {
    max-height: 200px;
    overflow-y: auto;
}

.no-upgrades {
    color: #555;
    font-style: italic;
    font-size: 11px;
}

.upgrade-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    padding: 4px;
    background: rgba(68, 170, 153, 0.1);
    border-left: 2px solid #4a9;
}

.upgrade-icon {
    width: 16px;
    height: 16px;
    background: rgba(68, 170, 153, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a9;
    font-size: 10px;
    margin-right: 6px;
}

.upgrade-name {
    color: #4a9;
    font-size: 10px;
}

/* Speed boost indicator */
#stats-sidebar.speed-boost .stat-value#speed-stat {
    color: #0f0;
    animation: speed-pulse 0.3s infinite;
}

@keyframes speed-pulse {
    0%, 100% { text-shadow: 0 0 5px #0f0; }
    50% { text-shadow: 0 0 15px #0f0; }
}

/* Entity warning overlay */
.entity-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    animation: entity-pulse 0.5s infinite;
}

@keyframes entity-pulse {
    0%, 100% { box-shadow: inset 0 0 50px rgba(255, 0, 0, 0); }
    50% { box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.3); }
}

/* Entity near warning - red vignette */
#game-container.entity-near::before {
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 40%,
        rgba(100, 0, 0, 0.4) 100%
    ) !important;
    animation: entity-vignette 0.8s infinite;
}

@keyframes entity-vignette {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

#timer-display {
    color: #fff;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    letter-spacing: 2px;
}

#timer-display.hidden {
    display: none;
}

#timer-display.warning {
    color: #f90;
    animation: pulse-warning 1s infinite;
}

#timer-display.critical {
    color: #f44;
    animation: pulse-critical 0.5s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-critical {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* Pickup Message */
#pickup-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #4a9;
    padding: 20px 40px;
    font-size: 24px;
    letter-spacing: 3px;
    border: 2px solid #4a9;
    z-index: 60;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#pickup-message.hidden {
    display: none;
}

#pickup-message.show {
    display: block;
    opacity: 1;
}

/* Audio Controls */
#audio-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 15;
    pointer-events: auto;
}

.audio-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(201, 180, 88, 0.5);
    color: #c9b458;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-btn:hover {
    background: rgba(201, 180, 88, 0.2);
    border-color: #c9b458;
}

#minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

#minimap {
    display: block;
}

#minimap-container.hidden {
    display: none;
}

#minimap-container.fullscreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid rgba(255, 255, 255, 0.5);
    z-index: 50;
}

#crosshair {
    display: none;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a1a0a 0%, #0d0d05 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#start-content {
    text-align: center;
    color: #c9b458;
}

#start-content h1 {
    font-size: 64px;
    letter-spacing: 10px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(201, 180, 88, 0.5);
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
    52% { opacity: 0.85; }
    54% { opacity: 0.95; }
}

.subtitle {
    font-size: 24px;
    color: #8a7a3a;
    margin-bottom: 30px;
    letter-spacing: 3px;
}

.description {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

#controls-info {
    margin: 40px 0;
    padding: 20px;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    display: inline-block;
}

#controls-info p {
    color: #888;
    font-size: 14px;
    margin: 5px 0;
}

#controls-info strong {
    color: #c9b458;
}

#controls-info .hint {
    color: #4a9;
    margin-top: 15px;
    font-style: italic;
}

#start-button, #restart-button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    background: transparent;
    border: 2px solid #c9b458;
    color: #c9b458;
    cursor: pointer;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

#start-button:hover, #restart-button:hover {
    background: #c9b458;
    color: #0d0d05;
}

/* Win Screen */
#win-screen {
    position: absolute;
    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: 100;
}

#win-content {
    text-align: center;
    color: #4a9;
}

#win-content h1 {
    font-size: 72px;
    letter-spacing: 15px;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(68, 170, 153, 0.5);
}

#win-content p {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
}

#win-screen.hidden {
    display: none;
}

#start-screen.hidden {
    display: none;
}

/* Upgrade Screen */
#upgrade-screen {
    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: 100;
}

#upgrade-screen.hidden {
    display: none;
}

#upgrade-content {
    text-align: center;
    color: #4a9;
}

#upgrade-content h1 {
    font-size: 48px;
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(68, 170, 153, 0.5);
}

.upgrade-subtitle {
    font-size: 20px;
    color: #666;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

#upgrade-options {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.upgrade-option {
    background: rgba(68, 170, 153, 0.1);
    border: 2px solid #4a9;
    color: #4a9;
    padding: 30px 25px;
    width: 220px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.upgrade-option:hover {
    background: #4a9;
    color: #0d0d05;
    transform: scale(1.05);
}

.upgrade-name {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.upgrade-desc {
    font-size: 14px;
    opacity: 0.8;
}

/* Game Over Screen */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#game-over-screen.hidden {
    display: none;
}

#game-over-content {
    text-align: center;
    color: #c44;
}

#game-over-content h1 {
    font-size: 64px;
    letter-spacing: 10px;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(204, 68, 68, 0.5);
    animation: flicker 2s infinite;
}

#game-over-content p {
    font-size: 18px;
    color: #888;
    margin-bottom: 10px;
}

#game-over-level {
    color: #c9b458;
    font-size: 24px !important;
    margin-bottom: 20px !important;
}

#retry-button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    background: transparent;
    border: 2px solid #c44;
    color: #c44;
    cursor: pointer;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

#retry-button:hover {
    background: #c44;
    color: #0d0d05;
}

/* Scanline effect overlay */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 5;
}

/* Vignette effect */
#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 6;
}
