@font-face {
    font-family: 'Pixelify Sans';
    src: url('../assets/fonts/PixelifySans-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height para móviles */

    /* Prevent scrolling/bouncing */
    overscroll-behavior: none;
    overflow: hidden;
    box-sizing: border-box;
}

/* Prevenir tap highlight en todos los elementos */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Prevenir zoom en inputs (si se agregan en el futuro) */
input,
textarea,
select {
    font-size: 16px;
    /* iOS no hace zoom si es >= 16px */
}


/* Mobile-first: Sin glow/aura en móvil */
canvas {
    border: 1px solid #333;
}

/* Solo mostrar glow en desktop */
@media (min-width: 768px) {
    canvas {
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.4);
    }
}

body.mobile {
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height para móviles modernos */
    display: flex;
    align-items: flex-start;
    /* Alinear al inicio para que no haya espacio arriba */
    justify-content: center;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

body.mobile canvas {
    border: none;
    box-shadow: none !important;
    display: block;
}

#game-container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Start with black background */
    background-color: #000000;
    /* Scale to cover like Phaser does - asset is 1082x1922 for 360px canvas */
    background-image: url('../assets/ui/intro-animation-0.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    /* Match MainMenu background cover strategy */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 10001;
    color: #fff;
    font-family: 'Pixelify Sans', monospace;
}

#loader.hidden {
    display: none;
}

.loader-content {
    display: contents;
    /* Let children follow flex parent */
}

/* Logo: Exact fixed match for Phaser (Y=120 Center, Scale=0.24) */
.loader-title {
    display: block;
    position: absolute;
    top: calc(var(--loader-logo-top, 21.5%) - var(--loader-logo-offset, 20px));
    /* Slightly lower */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    margin: 0;
    pointer-events: none;
    text-align: center;
}

.loader-title img {
    /* Logo size controlled by CSS variables to match Phaser */
    width: var(--loader-logo-width, 73vw);
    max-width: var(--loader-logo-max-width, 488px);
    height: auto;
    display: inline-block;
}

.loader-bar-placeholder {
    position: absolute;
    top: calc(40% - 30px);
    /* Match Phaser Y = height * 0.40 (Above head) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    background: none;
    border: none;
}

.loader-bar-placeholder img {
    width: 150px;
    /* Match Phaser scale 1.0 (Original size) */
    height: auto;
    display: block;
}

.loader-version {
    position: absolute;
    bottom: 23px;
    font-size: 18px;
    color: #aaaaaa;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 20px;
    border-radius: 20px;
    margin: 0;
    font-family: monospace;
}

/* Spinner removed */

.loader-text {
    font-size: 4vmin;
    color: #ccc;
    margin-top: 2vmin;
}

#loader-dots {
    display: inline-block;
    min-width: 20px;
}

/* Orientation Lock Overlay */
#orientation-lock {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 20000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffd700;
}

#orientation-lock .icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: rotate-phone 2s infinite ease-in-out;
}

#orientation-lock .message {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    padding: 0 20px;
}

@keyframes rotate-phone {
    0% {
        transform: rotate(-90deg);
    }

    50% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-90deg);
    }
}

/* Show orientation lock only on mobile landscape */
/* Show orientation lock on mobile devices in landscape */
body.mobile.landscape #orientation-lock {
    display: flex;
}

body.mobile.landscape #game-container {
    display: none;
}

/* Fallback media query for CSS-only detection if JS fails or delays */
@media screen and (orientation: landscape) and (max-height: 600px) {
    #orientation-lock {
        display: flex;
    }

    #game-container {
        display: none;
    }
}