body {
    background-color: #050508;
    color: #d1d5db;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* PANTALLA DE LOGIN ESTILO WOW */
#login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#portal-ascii {
    color: #ff3366;
    font-size: 11px;
    line-height: 1.1;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.6);
    margin-bottom: 10px;
}

.auth-box {
    background: #161b22;
    border: 2px solid #f1c40f;
    padding: 20px;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.3);
    min-width: 280px;
    border-radius: 4px;
}

input[type="text"], input[type="password"] {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #39ff14;
    padding: 8px;
    font-family: monospace;
    margin: 6px 0;
    width: 90%;
    text-align: center;
}

input:focus {
    outline: none;
    border-color: #f1c40f;
}

/* PANTALLA DEL JUEGO */
#ui-bar {
    width: 800px;
    background: #161b22;
    border: 1px solid #30363d;
    border-bottom: none;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    color: #39ff14;
    font-size: 13px;
}

canvas {
    border: 1px solid #30363d;
    background-color: #000;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.15);
}

#controls {
    width: 800px;
    background: #161b22;
    border: 1px solid #30363d;
    border-top: none;
    padding: 8px;
    box-sizing: border-box;
    color: #8b949e;
    font-size: 11px;
    text-align: center;
}

#craft-menu, #chest-menu, #extractor-menu {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #161b22;
    border: 2px solid #58a6ff;
    padding: 20px;
    box-shadow: 0 0 25px rgba(0,0,0,0.9);
    color: #fff;
    z-index: 100;
    text-align: center;
    min-width: 320px;
}

.chest-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    border-bottom: 1px solid #21262d;
    padding-bottom: 5px;
}

button {
    background: #21262d;
    color: #39ff14;
    border: 1px solid #30363d;
    padding: 8px 12px;
    cursor: pointer;
    font-family: monospace;
    margin: 4px 0;
    width: 100%;
}

button:hover { 
    background: #30363d; 
}

.stat-btn {
    background: #f1c40f;
    color: #000;
    font-weight: bold;
    border: none;
    padding: 2px 6px;
    margin: 0 2px;
    width: auto;
    cursor: pointer;
}
.stat-btn:hover {
    background: #fff;
}

/* Si la pantalla es táctil o chica, muestra los botones de celular */
@media (max-width: 768px) {
    #touch-controls {
        display: flex !important;
    }
    #gameCanvas {
        width: 100% !important;
        height: auto !important;
    }
}

/* OCULTO POR DEFECTO PARA PC / ESCRITORIO */
#touch-controls {
    display: none !important;
}

/* SOLO SE ACTIVA EN CELULARES O TABLETS TÁCTILES */
@media (max-width: 768px) and (pointer: coarse), (hover: none) {
    #touch-controls {
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        margin-top: 15px;
        padding: 10px;
        background: #0d1117;
        border: 1px solid #30363d;
        border-radius: 8px;
    }

    #dpad {
        display: grid;
        grid-template-columns: repeat(3, 45px);
        gap: 5px;
    }

    #dpad button {
        width: 45px;
        height: 45px;
        font-size: 18px;
        background: #21262d;
        color: #58a6ff;
        border: 1px solid #30363d;
        border-radius: 6px;
    }

    #touch-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #touch-actions button {
        padding: 12px 18px;
        font-size: 14px;
        border-radius: 6px;
        border: none;
    }

    /* Ocultar barra de texto de controles en PC si está en celular */
    #controls {
        display: none !important;
    }
}