*{
    box-sizing:border-box;
}

html,
body{
    margin:0;
    width:100%;
    height:100%;
    overflow:hidden;
    background:#02050a;
    color:#dffcff;
    font-family:'Orbitron',Arial,sans-serif;
    user-select:none;
}

body{
    position:relative;
}

canvas{
    position:fixed;
    inset:0;
    display:block;
    width:100vw!important;
    height:100vh!important;
    z-index:0;
    touch-action:none;
}

/* =================================================
   MENÚ SUPERIOR
================================================= */

.menu-toggle{
    position:fixed;
    top:16px;
    left:18px;

    width:46px;
    height:46px;

    display:grid;
    place-items:center;

    padding:0;

    border:1px solid rgba(0,246,255,.45);

    background:linear-gradient(
        135deg,
        rgba(9,24,32,.96),
        rgba(2,8,13,.96)
    );

    color:#00f6ff;

    font:
        700
        22px/1
        'Orbitron',
        sans-serif;

    cursor:pointer;

    z-index:130;

    box-shadow:
        0 0 22px rgba(0,246,255,.17),
        inset 0 0 14px rgba(0,246,255,.04);

    backdrop-filter:blur(12px);
}

.menu-toggle:hover{
    border-color:#00f6ff;

    box-shadow:
        0 0 26px rgba(0,246,255,.30);
}

.menu-toggle:active{
    transform:scale(.93);
}

/* =================================================
   BOTONES SUPERIORES
================================================= */

.top-game-button{
    position:fixed;
    top:16px;

    height:46px;

    display:flex;
    align-items:center;
    justify-content:center;

    gap:6px;

    padding:0 11px;

    font:
        700
        8px/1
        'Orbitron',
        sans-serif;

    letter-spacing:1px;

    cursor:pointer;

    z-index:129;

    backdrop-filter:blur(12px);

    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        background .15s ease,
        color .15s ease;
}

.top-game-button:active{
    transform:scale(.93);
}

.top-game-button span{
    font-size:15px;
}

.top-game-button small{
    font-size:6px;
    letter-spacing:.5px;
}

/* =================================================
   FIRE
================================================= */

.fire-top{
    left:74px;

    width:82px;

    border:1px solid rgba(255,82,109,.55);

    background:linear-gradient(
        135deg,
        rgba(40,8,15,.96),
        rgba(12,3,7,.96)
    );

    color:#ff526d;

    box-shadow:
        0 0 22px rgba(255,82,109,.16),
        inset 0 0 14px rgba(255,82,109,.04);
}

.fire-top span{
    color:#ff526d;

    text-shadow:
        0 0 10px #ff526d;
}

.fire-top:hover{
    border-color:#ff526d;

    box-shadow:
        0 0 28px rgba(255,82,109,.35);
}

/* =================================================
   AUTO
================================================= */

.auto-top{
    left:164px;

    width:86px;

    border:1px solid rgba(255,191,61,.35);

    background:linear-gradient(
        135deg,
        rgba(35,27,5,.96),
        rgba(12,9,2,.96)
    );

    color:#ffbf3d;

    box-shadow:
        0 0 20px rgba(255,191,61,.10),
        inset 0 0 14px rgba(255,191,61,.03);
}

.auto-top span{
    color:#ffbf3d;

    text-shadow:
        0 0 10px #ffbf3d;
}

.auto-top small{
    color:#8e792f;
}

.auto-top.active{
    color:#ffffff;

    border-color:#40ff9c;

    background:linear-gradient(
        135deg,
        rgba(4,36,22,.96),
        rgba(2,13,9,.96)
    );

    box-shadow:
        0 0 30px rgba(64,255,156,.38),
        inset 0 0 16px rgba(64,255,156,.06);
}

.auto-top.active span,
.auto-top.active small{
    color:#40ff9c;
}

/* =================================================
   BESTIA
================================================= */

.beast-top{
    left:258px;

    min-width:112px;

    border:1px solid rgba(64,255,156,.28);

    background:linear-gradient(
        135deg,
        rgba(7,30,22,.96),
        rgba(2,11,9,.96)
    );

    color:#40ff9c;

    box-shadow:
        0 0 22px rgba(64,255,156,.10);
}

.beast-top span{
    color:#40ff9c;

    font-size:16px;

    text-shadow:
        0 0 10px #40ff9c;
}

.beast-top small{
    color:#668b78;
}

.beast-top.ready{
    color:#ffffff;

    border-color:#40ff9c;

    box-shadow:
        0 0 32px rgba(64,255,156,.45);

    animation:
        beastReadyPulse
        1s
        infinite;
}

.beast-top.ready small{
    color:#40ff9c;
}

.beast-top.active{
    color:#ffffff;

    border-color:#00f6ff;

    background:linear-gradient(
        135deg,
        rgba(0,55,64,.96),
        rgba(2,15,20,.96)
    );

    box-shadow:
        0 0 34px rgba(0,246,255,.45);
}

.beast-top.active span{
    color:#00f6ff;

    text-shadow:
        0 0 14px #00f6ff;
}

.beast-top.active small{
    color:#ffffff;
}

/* =================================================
   PANEL
================================================= */

.control-panel{
    position:fixed;
    top:74px;
    left:18px;

    width:310px;

    max-height:calc(100dvh - 92px);

    overflow-y:auto;
    overflow-x:hidden;

    padding:18px;

    z-index:110;

    background:linear-gradient(
        145deg,
        rgba(8,20,28,.95),
        rgba(2,8,13,.93)
    );

    border:1px solid rgba(0,246,255,.25);

    box-shadow:
        0 0 38px rgba(0,0,0,.60),
        inset 0 0 28px rgba(0,246,255,.025);

    backdrop-filter:blur(18px);

    clip-path:polygon(
        0 12px,
        12px 0,
        100% 0,
        100% calc(100% - 12px),
        calc(100% - 12px) 100%,
        0 100%
    );

    transition:
        transform .32s ease,
        opacity .28s ease;
}

.control-panel.panel-hidden{
    transform:translateX(calc(-100% - 50px));
    opacity:0;
    pointer-events:none;
}

.control-panel::-webkit-scrollbar{
    width:4px;
}

.control-panel::-webkit-scrollbar-thumb{
    background:rgba(0,246,255,.30);
}

/* =================================================
   MARCA
================================================= */

.menu-brand{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:10px;

    padding-bottom:14px;
    margin-bottom:16px;

    border-bottom:1px solid rgba(0,246,255,.12);
}

.brand-main{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}

.brand-dot{
    width:9px;
    height:9px;

    flex:0 0 auto;

    border-radius:50%;

    background:#00f6ff;

    box-shadow:
        0 0 8px #00f6ff,
        0 0 20px #00f6ff;

    animation:
        pulse
        1.5s
        infinite;
}

.brand-text strong{
    display:block;

    color:#ffffff;

    font-size:16px;

    letter-spacing:2px;

    white-space:nowrap;
}

.brand-text small{
    display:block;

    margin-top:4px;

    color:#52777c;

    font-size:6px;

    letter-spacing:1.7px;

    white-space:nowrap;
}

.home-link{
    flex:0 0 auto;

    color:#00f6ff;

    text-decoration:none;

    font-size:8px;

    letter-spacing:1px;
}

.home-link:hover{
    text-shadow:
        0 0 10px #00f6ff;
}

/* =================================================
   ESTADO
================================================= */

.panel-header{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:10px;

    margin-bottom:16px;
}

.status{
    display:flex;
    align-items:center;
    gap:5px;

    color:#40ff9c;

    font-size:6px;

    letter-spacing:1px;
}

.status-dot{
    width:6px;
    height:6px;

    border-radius:50%;

    background:#40ff9c;

    box-shadow:
        0 0 10px #40ff9c;
}

/* =================================================
   MENÚ
================================================= */

.section-title{
    margin:14px 0 7px;

    color:#5f858a;

    font-size:7px;

    letter-spacing:2px;
}

.menu-grid{
    display:grid;

    grid-template-columns:
        1fr
        1fr;

    gap:7px;
}

.menu-button{
    min-height:54px;

    padding:9px 8px;

    border:1px solid rgba(0,246,255,.16);

    background:linear-gradient(
        135deg,
        rgba(13,31,39,.82),
        rgba(4,12,17,.94)
    );

    color:#dffcff;

    font:
        600
        8px/1.25
        'Orbitron',
        sans-serif;

    letter-spacing:.7px;

    cursor:pointer;

    text-align:left;

    transition:.18s ease;
}

.menu-button span{
    display:block;

    margin-bottom:4px;

    color:#00f6ff;

    font-size:15px;
}

.menu-button small{
    display:block;

    margin-top:4px;

    color:#52777c;

    font-size:6px;
}

.menu-button:hover{
    border-color:#00f6ff;

    box-shadow:
        0 0 18px rgba(0,246,255,.12);
}

.menu-button.danger span{
    color:#ff526d;
}

.menu-button.active{
    border-color:rgba(64,255,156,.40);
}

.menu-button.active span,
.menu-button.active small{
    color:#40ff9c;
}

.controls-list{
    display:grid;

    gap:5px;

    padding:10px;

    color:#668b90;

    font-size:7px;

    letter-spacing:.8px;

    line-height:1.5;

    border:1px solid rgba(0,246,255,.08);

    background:rgba(255,255,255,.012);
}

.controls-list b{
    color:#dffcff;
}

/* =================================================
   HUD
================================================= */

.hud{
    position:fixed;

    top:16px;
    right:18px;

    display:flex;

    gap:6px;

    z-index:80;

    pointer-events:none;
}

.hud-box{
    min-width:78px;

    padding:8px 9px;

    border:1px solid rgba(0,246,255,.24);

    background:rgba(2,8,13,.74);

    backdrop-filter:blur(10px);
}

.hud-box small{
    display:block;

    color:#52777c;

    font-size:5px;

    letter-spacing:1.2px;
}

.hud-box strong{
    display:block;

    margin-top:4px;

    color:#00f6ff;

    font-size:13px;
}

.hud-box.score strong{
    color:#40ff9c;
}

.hud-box.warning strong{
    color:#ff526d;
}

/* =================================================
   MENSAJE CENTRAL
================================================= */

.game-message{
    position:fixed;

    left:50%;
    top:50%;

    width:min(
        620px,
        calc(100vw - 40px)
    );

    transform:translate(
        -50%,
        -50%
    );

    padding:28px 24px;

    z-index:75;

    text-align:center;

    background:radial-gradient(
        circle at center,
        rgba(0,246,255,.10),
        rgba(2,8,13,.72) 62%,
        rgba(2,8,13,.18)
    );

    pointer-events:none;

    transition:
        opacity .25s ease,
        transform .25s ease;
}

.game-message.hidden{
    opacity:0;

    transform:
        translate(
            -50%,
            -47%
        )
        scale(.98);
}

.game-message .kicker{
    color:#00f6ff;

    font-size:8px;

    letter-spacing:4px;
}

.game-message h1{
    margin:10px 0 8px;

    color:#ffffff;

    font-size:clamp(
        26px,
        5vw,
        54px
    );

    letter-spacing:5px;

    text-shadow:
        0 0 24px rgba(0,246,255,.45);
}

.game-message p{
    margin:0;

    color:#8bb5ba;

    font-size:9px;

    line-height:1.8;

    letter-spacing:1px;
}

/* =================================================
   CROSSHAIR
================================================= */

.crosshair{
    position:fixed;

    left:50%;
    top:50%;

    width:34px;
    height:34px;

    transform:translate(
        -50%,
        -50%
    );

    z-index:40;

    opacity:.55;

    pointer-events:none;
}

.crosshair::before,
.crosshair::after{
    content:"";

    position:absolute;

    background:#00f6ff;

    box-shadow:
        0 0 8px #00f6ff;
}

.crosshair::before{
    left:50%;
    top:0;

    width:1px;
    height:100%;
}

.crosshair::after{
    top:50%;
    left:0;

    width:100%;
    height:1px;
}

/* =================================================
   TOUCH
================================================= */

.touch-controls{
    display:none;

    position:fixed;

    inset:auto 0 18px 0;

    z-index:90;

    pointer-events:none;
}

.dpad{
    position:absolute;

    left:18px;
    bottom:0;

    width:132px;
    height:132px;
}

.touch-btn{
    position:absolute;

    width:44px;
    height:44px;

    border:1px solid rgba(0,246,255,.38);

    background:rgba(2,8,13,.72);

    color:#00f6ff;

    font:
        700
        18px/1
        'Orbitron',
        sans-serif;

    pointer-events:auto;

    touch-action:none;
}

.touch-up{
    left:44px;
    top:0;
}

.touch-left{
    left:0;
    top:44px;
}

.touch-right{
    right:0;
    top:44px;
}

.touch-down{
    left:44px;
    bottom:0;
}

/* =================================================
   INSTRUCCIONES
================================================= */

.instructions-modal{
    position:fixed;

    inset:0;

    z-index:300;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:20px;

    background:rgba(0,0,0,.72);

    backdrop-filter:blur(8px);
}

.instructions-modal.hidden{
    display:none;
}

.instructions-box{
    width:min(
        680px,
        100%
    );

    max-height:85vh;

    overflow-y:auto;

    padding:22px;

    background:linear-gradient(
        145deg,
        rgba(8,20,28,.96),
        rgba(2,8,13,.96)
    );

    border:1px solid rgba(0,246,255,.28);

    box-shadow:
        0 0 40px rgba(0,0,0,.65),
        0 0 24px rgba(0,246,255,.08);
}

.instructions-header{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:10px;

    margin-bottom:18px;

    padding-bottom:12px;

    border-bottom:1px solid rgba(0,246,255,.14);
}

.instructions-header h3{
    margin:0;

    color:#ffffff;

    font-size:18px;

    letter-spacing:2px;
}

.close-instructions{
    width:38px;
    height:38px;

    border:1px solid rgba(0,246,255,.26);

    background:rgba(0,246,255,.06);

    color:#00f6ff;

    font:
        700
        16px/1
        'Orbitron',
        sans-serif;

    cursor:pointer;
}

.instructions-content{
    color:#b7d7db;

    font-size:12px;

    line-height:1.8;
}

.instructions-section{
    margin-bottom:18px;

    padding:14px;

    border:1px solid rgba(0,246,255,.10);

    background:rgba(255,255,255,.02);
}

.instructions-section h4{
    margin:0 0 10px;

    color:#00f6ff;

    font-size:11px;

    letter-spacing:2px;
}

.instructions-section ul{
    margin:0;

    padding-left:18px;
}

.instructions-section li{
    margin-bottom:6px;
}

.instructions-section strong{
    color:#ffffff;
}

/* =================================================
   ANIMACIONES
================================================= */

@keyframes pulse{

    0%,
    100%{
        opacity:1;
    }

    50%{
        opacity:.38;
    }
}

@keyframes beastReadyPulse{

    0%,
    100%{
        box-shadow:
            0 0 20px rgba(64,255,156,.24);
    }

    50%{
        box-shadow:
            0 0 40px rgba(64,255,156,.70);
    }
}

/* =================================================
   CELULAR
================================================= */

@media(max-width:700px){

    .menu-toggle{
        top:8px;
        left:8px;

        width:42px;
        height:42px;

        font-size:20px;
    }

    .top-game-button{
        top:8px;

        height:42px;

        padding:0 5px;

        font-size:7px;
    }

    .fire-top{
        left:56px;

        width:62px;
    }

    .auto-top{
        left:124px;

        width:68px;
    }

    .beast-top{
        left:198px;

        min-width:90px;
    }

    .beast-top span{
        font-size:12px;
    }

    .beast-top small,
    .auto-top small{
        font-size:5px;
    }

    .control-panel{
        top:60px;
        left:8px;

        width:min(
            330px,
            calc(100vw - 16px)
        );

        max-height:calc(100dvh - 68px);

        padding:15px;
    }

    .hud{
        top:58px;
        right:8px;

        flex-direction:column;

        align-items:flex-end;

        gap:3px;
    }

    .hud-box{
        min-width:68px;

        padding:5px 7px;
    }

    .hud-box small{
        font-size:4px;
    }

    .hud-box strong{
        font-size:10px;
    }

    .touch-controls{
        display:block;
    }

    .game-message{
        top:45%;

        width:calc(100vw - 28px);

        padding:20px 14px;
    }

    .game-message h1{
        font-size:28px;

        letter-spacing:3px;
    }

    .game-message p{
        font-size:8px;
    }

    .instructions-box{
        padding:16px;
    }

    .instructions-header h3{
        font-size:15px;
    }

    .instructions-content{
        font-size:11px;
    }
}

/* =================================================
   CELULAR ANGOSTO
================================================= */

@media(max-width:360px){

    .fire-top{
        left:54px;

        width:58px;
    }

    .auto-top{
        left:116px;

        width:64px;
    }

    .beast-top{
        left:184px;

        min-width:84px;
    }

    .top-game-button{
        font-size:6px;
    }

    .top-game-button span{
        font-size:11px;
    }

    .dpad{
        left:8px;

        transform:scale(.86);

        transform-origin:bottom left;
    }
}