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

body {
    background-color: #050505;
    color: #0f0;
    font-family: 'Share Tech Mono', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    overflow-x: hidden;
    overflow-y: auto;
}

/* CRT Scanline Effect */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 999;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

.screen {
    width: 100%;
    max-width: 900px;
    padding: 15px;
    text-align: center;
    z-index: 10;
}

h1 {
    font-size: 1.6rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #0f0;
    padding-bottom: 8px;
    word-break: break-word;
}

h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

/* Game UI */
.hud {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    font-size: 1rem;
}

.hud-item {
    white-space: nowrap;
}

.flex-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: flex-start;
}

.game-container {
    position: relative;
    border: 2px solid #0f0;
    box-shadow: 0 0 15px rgba(0,255,0,0.3);
    background: #000;
    flex-shrink: 0;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.instructions {
    margin-top: 10px;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Touch Controls for Mobile */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    border-top: 1px solid #0f0;
}

.touch-zone {
    flex: 1;
    border-right: 1px solid rgba(0,255,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    user-select: none;
    cursor: pointer;
}

.touch-zone:last-child {
    border-right: none;
}

.touch-zone:active {
    background: rgba(0, 255, 0, 0.3);
}

/* Terminal instructions */
.terminal-instruction {
    margin-top: 20px;
    padding: 12px;
    border: 1px dashed #0f0;
    text-align: left;
}

.terminal-instruction code {
    display: block;
    margin-top: 8px;
    background: #111;
    padding: 8px;
    color: #0ff;
    word-break: break-all;
    font-size: 0.85rem;
}

/* Inputs / Buttons */
.hacker-input {
    margin-top: 20px;
}

.hacker-input input {
    background: #000;
    border: 1px solid #0f0;
    color: #0f0;
    padding: 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    text-align: center;
    width: 80%;
    max-width: 300px;
    margin-top: 8px;
    outline: none;
}

.hacker-input button, .settings-panel button {
    background: #0f0;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    margin-top: 10px;
    cursor: pointer;
}

.hacker-input button:hover, .settings-panel button:hover {
    background: #000;
    color: #0f0;
    border: 1px solid #0f0;
}

/* ===== RESPONSIVO ===== */

/* Mobile: stack tudo vertical, mostrar touch controls */
@media (max-width: 700px) {
    .flex-container {
        flex-direction: column;
        align-items: center;
    }

    #game-leaderboard {
        width: 100% !important;
        max-height: 200px !important;
        height: auto !important;
    }

    .game-container {
        width: 100%;
        max-width: 400px;
    }

    canvas {
        width: 100%;
        height: auto;
    }

    #touch-controls {
        display: flex !important;
    }

    h1 {
        font-size: 1.2rem;
    }

    .hud {
        font-size: 0.8rem;
    }

    .settings-panel {
        padding: 10px;
    }

    .settings-panel label {
        width: 60px;
        font-size: 0.85rem;
    }

    .settings-panel input {
        width: 40px;
    }
}

/* Desktop grande: tudo lado a lado confortável */
@media (min-width: 1200px) {
    .screen {
        max-width: 1100px;
    }
}

/* Tablet */
@media (min-width: 701px) and (max-width: 1199px) {
    .screen {
        max-width: 900px;
    }
    
    #game-leaderboard {
        width: 220px !important;
    }
}
