/* =================================================
   RESET
================================================= */

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

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

body{
    touch-action:none;
}

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

#game-shell{
    position:fixed;
    inset:0;
    z-index:1;
    pointer-events:none;
}


/* =================================================
   BOTÓN MENÚ
================================================= */

.menu-toggle{
    position:fixed;
    top:14px;
    left:16px;
    width:48px;
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(3,11,18,.95);
    border:1px solid rgba(0,246,255,.45);
    color:#00f6ff;
    font:700 25px/1 'Orbitron',sans-serif;
    cursor:pointer;
    pointer-events:auto;
    z-index:160;
    box-shadow:
        0 0 22px rgba(0,246,255,.15),
        inset 0 0 15px rgba(0,246,255,.03);
    backdrop-filter:blur(12px);
    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

.menu-toggle:hover{
    border-color:#00f6ff;
    box-shadow:
        0 0 30px rgba(0,246,255,.32);
}

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


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

.top-game-button{
    position:fixed;
    top:14px;
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:0 10px;
    background:rgba(3,11,18,.95);
    font:700 8px/1 'Orbitron',sans-serif;
    letter-spacing:1px;
    cursor:pointer;
    pointer-events:auto;
    z-index:155;
    backdrop-filter:blur(12px);
    transition:.15s ease;
}

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

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


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

.fire-top{
    left:72px;
    width:78px;
    color:#ff526d;
    border:1px solid rgba(255,82,109,.55);
}

.fire-top span{
    color:#ff526d;
    text-shadow:
        0 0 10px #ff526d;
}


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

.auto-top{
    left:158px;
    width:84px;
    color:#ffbf3d;
    border:1px solid rgba(255,191,61,.42);
}

.auto-top.active{
    color:#40ff9c;
    border-color:#40ff9c;
    box-shadow:
        0 0 26px rgba(64,255,156,.32);
}


/* =================================================
   PULSO
================================================= */

.pulse-top{
    left:250px;
    min-width:112px;
    color:#40ff9c;
    border:1px solid rgba(64,255,156,.42);
}

.pulse-top.ready{
    color:#40ff9c;
    border-color:#40ff9c;
    animation:
        pulseGlow
        1.2s
        infinite;
}

.pulse-top.cooldown{
    color:#718a99;
    border-color:rgba(113,138,153,.30);
    animation:none;
}


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

.top-hud{
    position:fixed;
    top:14px;
    right:16px;
    display:flex;
    gap:5px;
    z-index:120;
    pointer-events:none;
}

.hud-stat{
    min-width:73px;
    padding:6px 7px;
    text-align:center;
    background:rgba(2,8,14,.88);
    border:1px solid rgba(0,246,255,.28);
    box-shadow:
        0 0 20px rgba(0,246,255,.05);
    backdrop-filter:blur(10px);
}

.hud-stat small{
    display:block;
    font-size:6px;
    color:#758b99;
    letter-spacing:1px;
}

.hud-stat span{
    display:block;
    margin-top:4px;
    color:#00f6ff;
    font-size:10px;
    font-weight:bold;
}


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

.control-panel{
    position:fixed;
    top:74px;
    left:16px;
    bottom:16px;
    width:340px;
    padding:20px;
    background:linear-gradient(
        145deg,
        rgba(4,17,25,.96),
        rgba(2,9,14,.96)
    );
    border:1px solid rgba(0,246,255,.30);
    box-shadow:
        0 0 35px rgba(0,246,255,.06),
        0 0 45px rgba(0,0,0,.55);
    overflow-y:auto;
    overflow-x:hidden;
    pointer-events:auto;
    z-index:145;
    backdrop-filter:blur(16px);
    transition:
        transform .30s ease,
        opacity .30s ease;
    clip-path:polygon(
        0 14px,
        14px 0,
        100% 0,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        0 100%
    );
}

.control-panel.panel-hidden{
    transform:translateX(-390px);
    opacity:0;
    pointer-events:none;
}

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

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


/* =================================================
   CABECERA IGUAL A SPACE JOURNEY
================================================= */

.menu-brand{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:2px 0 16px;
    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:10px;
    height:10px;
    flex:0 0 auto;
    border-radius:50%;
    background:#00f6ff;
    box-shadow:
        0 0 8px #00f6ff,
        0 0 20px #00f6ff;
    animation:
        brandPulse
        1.35s
        infinite;
}

.brand-text{
    min-width:0;
}

.brand-text strong{
    display:block;
    color:#fff;
    font-size:20px;
    font-weight:700;
    letter-spacing:2px;
    white-space:nowrap;
    text-shadow:
        0 0 10px rgba(255,255,255,.08);
}

.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;
    white-space:nowrap;
}

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


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

.panel-status{
    display:flex;
    align-items:center;
    gap:6px;
    margin-bottom:18px;
    color:#40ff9c;
    font-size:7px;
    letter-spacing:1px;
}

.status-dot{
    width:6px;
    height:6px;
    flex:0 0 auto;
    border-radius:50%;
    background:#40ff9c;
    box-shadow:
        0 0 8px #40ff9c,
        0 0 15px rgba(64,255,156,.55);
    animation:
        statusPulse
        1.5s
        infinite;
}

#status-text{
    color:#40ff9c;
}


/* =================================================
   TÍTULOS SECCIONES
================================================= */

.section-title{
    margin:14px 0 8px;
    color:#5f858a;
    font-size:7px;
    letter-spacing:2px;
}


/* =================================================
   MISIÓN
================================================= */

.mission{
    padding:12px;
    border:1px solid rgba(0,246,255,.13);
    background:rgba(255,255,255,.015);
    color:#779ca1;
    font-size:8px;
    line-height:1.75;
}

.mission strong{
    color:#00f6ff;
}


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

.action-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:7px;
}

.action{
    min-height:66px;
    padding:10px 9px;
    border:1px solid rgba(0,246,255,.20);
    background:linear-gradient(
        135deg,
        rgba(13,31,39,.80),
        rgba(4,12,17,.92)
    );
    color:#dffcff;
    font:600 8px/1.2 'Orbitron',sans-serif;
    letter-spacing:.6px;
    cursor:pointer;
    text-align:left;
    transition:.16s ease;
}

.action span{
    display:block;
    margin-bottom:5px;
    color:#00f6ff;
    font-size:17px;
}

.action small{
    display:block;
    margin-top:5px;
    color:#52777c;
    font-size:6px;
    letter-spacing:.5px;
}

.action:hover{
    border-color:#00f6ff;
    background:linear-gradient(
        135deg,
        rgba(0,246,255,.12),
        rgba(4,12,17,.96)
    );
    box-shadow:
        0 0 18px rgba(0,246,255,.10);
}

.action.primary span{
    color:#00f6ff;
}

.action.danger span{
    color:#ff526d;
}


/* =================================================
   CONTROLES
================================================= */

.controls-list{
    display:grid;
    gap:7px;
    color:#668b90;
    font-size:7px;
    letter-spacing:.6px;
    line-height:1.45;
}

.controls-list b{
    margin-right:5px;
    color:#dffcff;
    font-weight:600;
}


/* =================================================
   LEYENDA
================================================= */

.legend{
    display:grid;
    gap:8px;
    padding-bottom:5px;
    color:#7f949f;
    font-size:8px;
}

.dot{
    display:inline-block;
    width:8px;
    height:8px;
    margin-right:8px;
    border-radius:50%;
}

.energy{
    background:#00f6ff;
    box-shadow:
        0 0 10px #00f6ff;
}

.core{
    background:#ffd45b;
    box-shadow:
        0 0 10px #ffd45b;
}

.enemy{
    background:#ff526d;
    box-shadow:
        0 0 10px #ff526d;
}


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

.message-layer{
    position:fixed;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:90;
    pointer-events:none;
    transition:.25s;
}

.message-layer.hidden{
    opacity:0;
    visibility:hidden;
}

.message-card{
    width:min(
        580px,
        calc(100vw - 40px)
    );
    padding:34px;
    background:rgba(3,10,18,.92);
    border:1px solid rgba(0,246,255,.35);
    text-align:center;
    box-shadow:
        0 0 70px rgba(0,246,255,.10),
        0 0 60px rgba(0,0,0,.60);
    backdrop-filter:blur(14px);
}

.message-kicker{
    color:#00f6ff;
    font-size:8px;
    letter-spacing:3px;
}

.message-card h2{
    margin:14px 0;
    color:#fff;
    font-size:clamp(
        28px,
        5vw,
        50px
    );
    letter-spacing:3px;
}

.message-card p{
    color:#9dafbb;
    font-size:13px;
    line-height:1.6;
}

.message-card strong{
    color:#40ff9c;
}


/* =================================================
   POWER
================================================= */

.power-banner{
    position:fixed;
    top:80px;
    left:50%;
    transform:translateX(-50%);
    padding:8px 16px;
    background:rgba(30,20,2,.92);
    border:1px solid #ffd45b;
    color:#ffd45b;
    font-size:9px;
    letter-spacing:1px;
    z-index:125;
    box-shadow:
        0 0 25px rgba(255,212,91,.25);
    pointer-events:none;
}


/* =================================================
   COMBO
================================================= */

.combo-banner{
    position:fixed;
    top:45%;
    left:50%;
    transform:translateX(-50%);
    color:#40ff9c;
    font-size:34px;
    font-weight:bold;
    letter-spacing:2px;
    text-align:center;
    z-index:130;
    text-shadow:
        0 0 18px rgba(64,255,156,.70);
    pointer-events:none;
}


/* =================================================
   OCULTAR
================================================= */

.hidden{
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
}


/* =================================================
   MODAL
================================================= */

.modal{
    position:fixed;
    inset:0;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:18px;
    background:rgba(0,3,8,.88);
    pointer-events:auto;
    z-index:220;
    backdrop-filter:blur(8px);
}

.modal-card{
    position:relative;
    width:min(
        620px,
        calc(100vw - 30px)
    );
    max-height:85vh;
    overflow-y:auto;
    padding:28px;
    background:#06111b;
    border:1px solid rgba(0,246,255,.40);
    line-height:1.6;
    box-shadow:
        0 0 50px rgba(0,0,0,.70),
        0 0 30px rgba(0,246,255,.08);
}

.modal-card h2{
    margin-bottom:18px;
    color:#fff;
    letter-spacing:2px;
}

.modal-card p{
    margin-top:12px;
    color:#9eafb9;
    font-size:11px;
}

.modal-card strong{
    color:#fff;
}

.modal-close{
    position:absolute;
    top:10px;
    right:14px;
    width:36px;
    height:36px;
    border:1px solid rgba(0,246,255,.25);
    background:rgba(0,246,255,.04);
    color:#00f6ff;
    font-size:24px;
    cursor:pointer;
}


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

.touch-controls{
    display:none;
    position:fixed;
    left:15px;
    right:15px;
    bottom:15px;
    z-index:135;
    pointer-events:none;
}

.touch-pad{
    position:relative;
    width:150px;
    height:150px;
    pointer-events:auto;
}

.touch-pad button{
    position:absolute;
    width:48px;
    height:48px;
    border:1px solid rgba(0,246,255,.40);
    background:rgba(3,12,20,.85);
    color:#00f6ff;
    font:700 17px 'Orbitron',sans-serif;
    box-shadow:
        0 0 14px rgba(0,246,255,.05);
    touch-action:none;
}

.touch-pad button:active{
    background:rgba(0,246,255,.15);
    transform:scale(.92);
}

.touch-pad button[data-dir="up"]{
    left:51px;
    top:0;
}

.touch-pad button[data-dir="left"]{
    left:0;
    top:51px;
}

.touch-pad button[data-dir="down"]{
    left:51px;
    top:102px;
}

.touch-pad button[data-dir="right"]{
    left:102px;
    top:51px;
}


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

@keyframes brandPulse{

    0%,
    100%{
        opacity:1;
        transform:scale(1);
        box-shadow:
            0 0 8px #00f6ff,
            0 0 20px #00f6ff;
    }

    50%{
        opacity:.45;
        transform:scale(.82);
        box-shadow:
            0 0 4px #00f6ff,
            0 0 9px #00f6ff;
    }
}

@keyframes statusPulse{

    0%,
    100%{
        opacity:1;
    }

    50%{
        opacity:.35;
    }
}

@keyframes pulseGlow{

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

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


/* =================================================
   PANTALLAS MEDIANAS
================================================= */

@media(max-width:1250px){

    .top-hud{
        top:70px;
        right:10px;
        flex-direction:column;
    }

    .hud-stat{
        min-width:72px;
    }
}


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

@media(max-width:700px){

    .menu-toggle{
        top:8px;
        left:8px;
        width:42px;
        height:42px;
    }


    .top-game-button{
        top:8px;
        height:42px;
        padding:0 5px;
        font-size:6px;
    }

    .fire-top{
        left:56px;
        width:58px;
    }

    .auto-top{
        left:120px;
        width:64px;
    }

    .pulse-top{
        left:190px;
        min-width:86px;
    }

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


    .control-panel{
        top:58px;
        left:8px;
        bottom:8px;
        width:min(
            340px,
            calc(100vw - 16px)
        );
        padding:18px;
    }


    .brand-text strong{
        font-size:17px;
    }

    .brand-text small{
        font-size:5px;
        letter-spacing:1.2px;
    }

    .home-link{
        font-size:6px;
    }


    .top-hud{
        top:58px;
        right:7px;
        gap:3px;
    }

    .hud-stat{
        min-width:61px;
        padding:5px;
    }

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

    .hud-stat span{
        font-size:8px;
    }


    .touch-controls{
        display:block;
    }

    .touch-pad{
        transform:scale(.88);
        transform-origin:bottom left;
    }


    .message-card{
        padding:24px 16px;
    }

    .message-card p{
        font-size:10px;
    }


    .power-banner{
        top:56px;
        padding:7px 10px;
        font-size:7px;
    }

    .combo-banner{
        font-size:24px;
    }


    .modal-card{
        padding:24px 17px;
    }

    .modal-card h2{
        font-size:17px;
    }

    .modal-card p{
        font-size:9px;
    }
}


/* =================================================
   CELULARES PEQUEÑOS
================================================= */

@media(max-width:390px){

    .menu-toggle{
        left:6px;
        width:40px;
        height:40px;
    }

    .top-game-button{
        height:40px;
        font-size:5px;
    }

    .fire-top{
        left:51px;
        width:55px;
    }

    .auto-top{
        left:110px;
        width:61px;
    }

    .pulse-top{
        left:175px;
        min-width:80px;
    }

    .top-hud{
        top:54px;
        right:5px;
    }

    .hud-stat{
        min-width:57px;
    }

    .control-panel{
        padding:15px;
    }

    .brand-text strong{
        font-size:15px;
    }

    .touch-pad{
        transform:scale(.78);
    }
}


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

@media(hover:none),(pointer:coarse){

    .touch-controls{
        display:block;
    }
}