@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --bg: #0a0a0a;
    --green: #00ff41;
    --green-dim: #008f11;
    --red: #ff3333;
    --red-dim: #cc0000;
    --white: #c0c0c0;
    --glow-green: 0 0 10px var(--green), 0 0 20px rgba(0, 255, 65, 0.2);
    --glow-red: 0 0 10px var(--red), 0 0 20px rgba(255, 51, 51, 0.2);
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    color: var(--green);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

canvas {
    touch-action: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--green-dim);
    background: var(--bg);
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 255, 65, 0.05);
    border-bottom: 1px solid var(--green-dim);
    font-size: 13px;
    letter-spacing: 1px;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: var(--glow-green);
}

.blink {
    animation: blink 1s step-end infinite;
}

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

.hud-right {
    display: flex;
    gap: 20px;
    color: var(--green-dim);
}

.hud-right span:first-child {
    color: var(--green);
}

.canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    background: var(--bg);
    width: 100%;
    height: 100%;
}

/* JOYSTICK */
.joystick {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

@media (pointer: coarse) {
    .joystick { display: block; }
    .controls-desk { display: none; }
    .controls-mob { display: inline; }
}

@media (pointer: fine) {
    .controls-desk { display: inline; }
    .controls-mob { display: none; }
}

.joystick-base {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(0, 255, 65, 0.04);
    border: 1px solid rgba(0, 143, 17, 0.4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.joystick-base::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    border: 1px solid rgba(0, 143, 17, 0.15);
}

.joystick-knob {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--green-dim);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: none;
    touch-action: none;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.15);
}

.joystick-knob.active {
    border-color: var(--green);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
    background: rgba(0, 255, 65, 0.15);
}

.controls {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: var(--green-dim);
    border-top: 1px solid var(--green-dim);
    letter-spacing: 3px;
}

.controls span {
    color: var(--green);
    text-shadow: var(--glow-green);
}

/* GAME OVER OVERLAY */
.gameover-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.gameover-overlay.visible {
    display: flex;
}

.gameover-box {
    background: #000;
    border: 2px solid var(--red);
    box-shadow: 0 0 30px rgba(255, 51, 51, 0.3);
    max-width: 450px;
    width: 90%;
    animation: pulse-border 1.5s ease-in-out infinite alternate;
}

@keyframes pulse-border {
    from { box-shadow: 0 0 20px rgba(255, 51, 51, 0.3); }
    to { box-shadow: 0 0 50px rgba(255, 51, 51, 0.6); }
}

.gameover-header {
    padding: 12px 15px;
    background: rgba(255, 51, 51, 0.1);
    border-bottom: 1px solid var(--red);
    color: var(--red);
    text-align: center;
    letter-spacing: 2px;
    font-size: 14px;
    animation: blink 0.8s step-end infinite;
}

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

.ascii-skull {
    color: var(--red);
    font-size: 10px;
    line-height: 1.1;
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(255, 51, 51, 0.3);
}

.gameover-score {
    color: var(--green);
    font-size: 18px;
    margin: 10px 0;
    letter-spacing: 3px;
}

.gameover-wave {
    color: var(--green-dim);
    font-size: 13px;
    margin: 5px 0 15px;
    letter-spacing: 2px;
}

.terminal-btn {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 14px;
    padding: 10px 25px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 10px;
}

.terminal-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: var(--glow-green);
}
