/* Pantalla completa + safe area (notch / barra de estado) */

:root {
    --gi-safe-top: env(safe-area-inset-top, 0px);
    --gi-safe-right: env(safe-area-inset-right, 0px);
    --gi-safe-bottom: env(safe-area-inset-bottom, 0px);
    --gi-safe-left: env(safe-area-inset-left, 0px);
    --gi-chrome-top: 0px;
    --gi-chrome-bottom: 0px;
    --gi-play-top: var(--gi-chrome-top);
    --gi-play-bottom: var(--gi-chrome-bottom);
    --gi-notch-pad: max(10px, var(--gi-safe-top));
    --gi-content-pad-x: max(12px, var(--gi-safe-left), var(--gi-safe-right));
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

html.gi-fill,
body.gi-immersive {
    min-height: 100%;
    min-height: 100dvh;
}

body.gi-immersive {
    padding: 0;
    min-height: 100dvh;
}

body.gi-edge-fullscreen {
    min-height: 100dvh;
    min-height: 100svh;
}

body.gi-edge-fullscreen:not(.gi-game-menu-scroll) {
    overflow: hidden;
}

body.gi-game-menu-scroll {
    overflow: hidden;
}

body.gi-game-menu-scroll #mainContainer {
    position: relative !important;
    inset: auto !important;
    height: 100% !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
}

body.gi-game-menu-scroll #gameScreen {
    overflow: hidden !important;
}

body.gi-game-menu-scroll #gameScreen .game-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

body.gi-game-menu-scroll #gameScreen.active {
    position: fixed !important;
    inset: 0 !important;
    height: 100dvh !important;
    height: 100svh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
}

body.gi-edge-fullscreen .main-footer,
body.gi-splash-open .main-footer {
    display: none !important;
}

body.gi-splash-open {
    overflow: hidden;
}

body.gi-edge-fullscreen:not(.gi-game-menu-scroll) #mainContainer {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    z-index: 2;
    overflow: hidden;
    min-height: 100dvh;
    min-height: 100svh;
    box-sizing: border-box;
}

body.gi-gameplay-active #mainContainer > .screen.active {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Plantillas negras: barra de estado + gestos (PWA / pantalla completa) */
.gi-device-chrome {
    position: fixed;
    inset: 0;
    z-index: 10050;
    pointer-events: none;
    display: none;
}

.gi-device-chrome,
body.gi-use-device-chrome .gi-device-chrome {
    display: none !important;
}

.gi-device-chrome__top,
.gi-device-chrome__bottom {
    position: absolute;
    left: 0;
    right: 0;
    background: #000000;
    overflow: hidden;
}

.gi-device-chrome__top {
    top: 0;
    height: var(--gi-chrome-top);
    min-height: var(--gi-chrome-top);
}

.gi-device-chrome__bottom {
    bottom: 0;
    height: var(--gi-chrome-bottom);
    min-height: var(--gi-chrome-bottom);
}

.gi-device-chrome__top-picture,
.gi-device-chrome__top-art,
.gi-device-chrome__bottom-art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.gi-use-device-chrome.gi-edge-fullscreen #splashScreen {
    top: var(--gi-play-top) !important;
    bottom: var(--gi-play-bottom) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.gi-use-device-chrome.gi-edge-fullscreen #mainContainer {
    top: var(--gi-play-top);
    bottom: var(--gi-play-bottom);
    left: 0;
    right: 0;
    height: auto !important;
    min-height: 0 !important;
}

body.gi-use-device-chrome.gi-edge-fullscreen #mainContainer > .screen.active {
    top: 0;
    bottom: 0;
    height: 100% !important;
    min-height: 0 !important;
}

body.gi-use-device-chrome .sp-bg-photo,
body.gi-use-device-chrome .hs-bg-photo,
body.gi-use-device-chrome #homeScreen .hs-bg {
    top: var(--gi-play-top) !important;
    bottom: var(--gi-play-bottom) !important;
}

body.gi-use-device-chrome.gi-edge-fullscreen {
    background: #000000 !important;
}

html.gi-use-device-chrome-fill {
    background: #000000;
}

body.gi-use-device-chrome .gs-nav-fab,
body.gi-use-device-chrome .gs-nav-fab-anchor {
    top: calc(var(--gi-play-top) + 5px) !important;
}

body.gi-use-device-chrome .gs-mission-nav-persist {
    top: calc(var(--gi-play-top) + 5px) !important;
}

body.gi-edge-fullscreen #mainContainer > .screen.active {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Zona segura: contenido debajo de hora / cámara */
.gi-safe-zone {
    position: relative;
    z-index: 4;
    width: 100%;
    max-width: min(100%, 920px);
    margin-inline: auto;
    padding:
        calc(var(--gi-notch-pad) + 4px)
        var(--gi-content-pad-x)
        max(16px, var(--gi-safe-bottom))
        var(--gi-content-pad-x);
    box-sizing: border-box;
}

.gi-safe-top-veil {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--gi-notch-pad) + 28px);
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(2, 5, 14, 0.92) 0%, rgba(2, 5, 14, 0.55) 55%, transparent 100%);
}

.gi-tmpl-frame {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.85;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

body.gi-device-phone-portrait .gi-tmpl-frame--splash,
body.gi-device-phone-portrait .gi-tmpl-frame--home,
body.gi-device-phone-portrait .gi-tmpl-frame--menu {
    background-image: url('../img/ui/device-tmpl/frame-notch-portrait.svg');
}

body.gi-device-phone-landscape .gi-tmpl-frame--splash,
body.gi-device-phone-landscape .gi-tmpl-frame--home,
body.gi-device-phone-landscape .gi-tmpl-frame--menu {
    background-image: url('../img/ui/device-tmpl/frame-notch-landscape.svg');
}

.splash-screen {
    padding: 0 !important;
    min-height: 100dvh;
    min-height: 100svh;
    height: 100dvh;
    height: 100svh;
}

.splash-screen .sp-content {
    min-height: calc(100dvh - var(--gi-safe-bottom));
    justify-content: center;
    padding:
        calc(var(--gi-notch-pad) + 8px)
        var(--gi-content-pad-x)
        max(20px, var(--gi-safe-bottom))
        var(--gi-content-pad-x);
}

#homeScreen.active {
    min-height: 100dvh !important;
    min-height: 100svh !important;
    padding:
        calc(var(--gi-notch-pad) + 6px)
        var(--gi-content-pad-x)
        max(20px, var(--gi-safe-bottom))
        var(--gi-content-pad-x) !important;
}

body.gi-game-menu-scroll #gameScreen .game-header.gs-hud--command {
    padding-top: max(8px, env(safe-area-inset-top)) !important;
}

body.gi-gameplay-active:not(.gi-use-device-chrome) #gameScreen .game-header.gs-hud--command {
    padding-top: max(8px, env(safe-area-inset-top)) !important;
}

#gameScreen.active .game-header.gs-hud {
    padding-top: calc(var(--gi-notch-pad) + 6px);
    padding-left: max(10px, var(--gi-safe-left));
    padding-right: max(10px, var(--gi-safe-right));
}

body.gi-device-phone-portrait .sp-bg-photo img,
body.gi-device-phone-portrait .hs-bg-photo img {
    object-position: center 32%;
}

body.gi-device-phone-landscape .sp-bg-photo img,
body.gi-device-phone-landscape .hs-bg-photo img,
body.gi-device-phone-landscape .gs-bg-photo img {
    object-position: center center;
}

body.gi-device-tablet .sp-bg-photo img,
body.gi-device-tablet .hs-bg-photo img {
    object-position: center 38%;
}

.gi-tmpl-bg img {
    object-fit: cover;
}

/* Móvil: menos animación de fondo y sin capas “cyber” que parpadean encima */
body.mobile-touch-device picture.sp-bg-photo,
body.mobile-touch-device picture.hs-bg-photo,
body.mobile-touch-device picture.gs-bg-photo {
    animation: none !important;
    transform: none !important;
    will-change: auto;
}
body.mobile-touch-device #splashScreen .sp-cyber-crime,
body.mobile-touch-device #homeScreen .hs-cyber-crime {
    display: none !important;
}
body.mobile-touch-device .sp-orb,
body.mobile-touch-device .hs-bg-orb,
body.mobile-touch-device .gs-bg-orb {
    animation-duration: 24s !important;
    opacity: 0.45 !important;
}

html:fullscreen,
html:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background: #000 !important;
}
html:fullscreen body,
body.gi-native-fullscreen,
body.vg-play-fs {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}
html:fullscreen #gameScreen,
html:fullscreen #vsGuardiansContainer,
body.gi-native-fullscreen #gameScreen,
body.gi-native-fullscreen #vsGuardiansContainer {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
}
