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

body {
    background: #0a0e14;
    overflow: hidden;
    font-family: 'IBM Plex Mono', monospace;
    color: #00ff88;
    cursor: crosshair;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

#hud-top {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    font-size: 13px;
    text-shadow: 0 0 8px #00ff88;
    pointer-events: none;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 9px;
    color: #00ff8866;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-value {
    font-size: 16px;
    font-weight: 700;
}

#control-panel {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 20, 0.92);
    border: 1px solid #00ff8833;
    border-radius: 8px;
    padding: 12px 16px;
    display: none;
    gap: 12px;
    align-items: center;
    pointer-events: all;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 95vw;
}

#control-panel.visible {
    display: flex;
}

.ctrl-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ctrl-label {
    font-size: 9px;
    color: #00ff8888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ctrl-btn {
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid #00ff8844;
    color: #00ff88;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.ctrl-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    box-shadow: 0 0 8px #00ff8844;
}

.ctrl-btn:active, .ctrl-btn.active {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

.ctrl-btn.danger {
    border-color: #ff444444;
    color: #ff6644;
}

.ctrl-btn.danger:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.ctrl-btn.land {
    border-color: #44aaff44;
    color: #44aaff;
    animation: pulse-land 1.5s ease infinite;
}

@keyframes pulse-land {
    0%, 100% { box-shadow: 0 0 4px #44aaff22; }
    50% { box-shadow: 0 0 12px #44aaff66; }
}

.ctrl-row {
    display: flex;
    gap: 4px;
}

.heading-display {
    font-size: 18px;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

#message-area {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.game-message {
    font-size: 12px;
    padding: 4px 12px;
    background: rgba(10, 14, 20, 0.85);
    border-radius: 4px;
    border: 1px solid #00ff8833;
    text-shadow: 0 0 6px #00ff88;
    animation: msg-fade 3s ease forwards;
    white-space: nowrap;
}

.game-message.warning {
    color: #ffaa00;
    border-color: #ffaa0033;
    text-shadow: 0 0 6px #ffaa00;
}

.game-message.danger {
    color: #ff4444;
    border-color: #ff444433;
    text-shadow: 0 0 6px #ff4444;
}

@keyframes msg-fade {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    background: radial-gradient(ellipse at center, #0d1520 0%, #060a10 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.start-content {
    text-align: center;
    max-width: 500px;
    padding: 20px;
}

.title-glow {
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 700;
    letter-spacing: 4px;
    color: #00ff88;
    text-shadow: 0 0 20px #00ff8866, 0 0 40px #00ff8833, 0 0 80px #00ff8811;
    margin-bottom: 8px;
    animation: title-pulse 3s ease infinite;
}

@keyframes title-pulse {
    0%, 100% { text-shadow: 0 0 20px #00ff8866, 0 0 40px #00ff8833; }
    50% { text-shadow: 0 0 30px #00ff8888, 0 0 60px #00ff8844, 0 0 100px #00ff8822; }
}

.subtitle {
    font-size: 13px;
    color: #00ff8888;
    letter-spacing: 2px;
    margin-bottom: 40px;
}

.difficulty-select {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.diff-btn {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid #00ff8833;
    color: #00ff8888;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.diff-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
}

.diff-btn.selected {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    color: #00ff88;
    box-shadow: 0 0 12px #00ff8833;
}

.play-button {
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
    color: #00ff88;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    padding: 14px 36px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 2px;
}

.play-button:hover {
    background: rgba(0, 255, 136, 0.25);
    box-shadow: 0 0 20px #00ff8844;
    transform: scale(1.02);
}

.instructions {
    margin-top: 30px;
    font-size: 11px;
    color: #00ff8855;
    line-height: 2;
}

#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    background: rgba(10, 5, 5, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gameover-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

.gameover-title {
    font-size: 28px;
    color: #ff4444;
    text-shadow: 0 0 20px #ff444466;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

#gameover-reason {
    color: #ff8866;
    font-size: 13px;
    margin-bottom: 20px;
}

#gameover-stats {
    color: #00ff8899;
    font-size: 13px;
    line-height: 2;
    margin-bottom: 30px;
}

#footer-link {
    position: fixed;
    bottom: 4px;
    right: 10px;
    z-index: 50;
    font-size: 10px;
}

#footer-link a {
    color: #00ff8844;
    text-decoration: none;
}

#footer-link a:hover {
    color: #00ff88;
}

/* Scanline effect */
#canvas::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 2;
}

@media (max-width: 600px) {
    #control-panel {
        bottom: 5px;
        padding: 8px 10px;
        gap: 8px;
    }
    .ctrl-btn {
        padding: 8px 8px;
        font-size: 11px;
    }
    .hud-value {
        font-size: 13px;
    }
}