:root {
    --bg-color: #000a00;
    --primary: #00ff00;
    --secondary: #008800;
    --danger: #ff0000;
    --text-main: #00ff00;
    --ui-bg: rgba(0, 10, 0, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Share Tech Mono', monospace;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-main);
    touch-action: none;
}

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

/* Radar Background */
.radar-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 0, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
}

.radar-bg::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 150vw; height: 150vw;
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        inset 0 0 0 100px rgba(0, 255, 0, 0.02),
        inset 0 0 0 300px rgba(0, 255, 0, 0.02);
}

.radar-scanner {
    position: absolute;
    top: 50%; left: 50%;
    width: 150vw; height: 150vw;
    background: conic-gradient(from 0deg, rgba(0,255,0,0) 0deg, rgba(0,255,0,0) 270deg, rgba(0,255,0,0.2) 360deg);
    border-radius: 50%;
    transform-origin: center center;
    animation: scan 4s linear infinite;
    z-index: 0;
    pointer-events: none;
    margin-top: -75vw;
    margin-left: -75vw;
}

@keyframes scan {
    100% { transform: rotate(360deg); }
}

canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    display: block;
}

/* Screen Shake Class */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

#ui-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 5;
    pointer-events: none;
    display: none;
}

#top-bar {
    position: absolute;
    top: 20px; left: 20px;
    display: flex;
    gap: 20px;
}

.hud-box {
    background: rgba(0, 20, 0, 0.7);
    border: 1px solid var(--primary);
    padding: 10px 20px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.hud-box .label {
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 5px;
}

.hud-box .value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
}

.hud-box .value.warning {
    color: var(--danger);
    text-shadow: 0 0 10px var(--danger);
}

.icon-btn {
    position: absolute;
    width: 50px; height: 50px;
    border-radius: 4px;
    background: rgba(0, 20, 0, 0.7);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 20px;
    display: flex; justify-content: center; align-items: center;
    pointer-events: auto; cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 15px var(--primary);
}

#pause-btn { top: 20px; right: 20px; }
#sound-toggle { top: 20px; right: 85px; }

/* Screens */
.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--ui-bg);
    backdrop-filter: blur(5px);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 10;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}

.screen.active {
    opacity: 1; pointer-events: auto;
}

.game-logo {
    width: 120px; height: 120px;
    border-radius: 10px;
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px var(--primary);
    margin-bottom: 20px;
}

h1 {
    font-size: 48px;
    color: var(--primary);
    text-shadow: 0 0 15px var(--primary);
    margin-bottom: 10px; text-align: center;
    letter-spacing: 4px;
}

h2 {
    font-size: 36px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    margin-bottom: 30px; text-align: center;
    letter-spacing: 2px;
}

h2.critical {
    color: var(--danger);
    text-shadow: 0 0 20px var(--danger);
}

.subtitle {
    font-size: 20px;
    color: var(--danger);
    margin-bottom: 40px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

.btn {
    padding: 15px 40px;
    font-size: 20px; font-weight: bold;
    border: none; border-radius: 4px;
    cursor: pointer; margin: 10px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.primary-btn {
    background: rgba(0, 255, 0, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
}

.primary-btn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 30px var(--primary);
}

.secondary-btn {
    background: transparent;
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.secondary-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary);
}

.instruction-content {
    background: rgba(0, 20, 0, 0.8);
    padding: 30px; border-radius: 4px;
    border: 1px solid var(--secondary);
    margin-bottom: 30px;
    max-width: 600px; width: 90%;
}

.instruction-content p {
    margin: 15px 0; font-size: 18px; line-height: 1.5;
}

.stats-panel {
    display: flex; gap: 40px;
    margin-bottom: 30px;
    background: rgba(0, 20, 0, 0.8);
    padding: 20px 40px;
    border: 1px solid var(--danger);
    border-radius: 4px;
}

.final-score, .best-score {
    font-size: 18px; color: var(--secondary);
    text-align: center;
}

.final-score span, .best-score span {
    font-size: 36px; color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    display: block; margin-top: 10px;
}

@media (max-width: 768px) {
    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    .btn { padding: 12px 30px; font-size: 16px; }
    #top-bar { flex-direction: column; gap: 10px; }
    .hud-box .value { font-size: 20px; }
    .stats-panel { flex-direction: column; gap: 20px; padding: 20px; }
}
