/* =========================================================================
   BASE STYLES, FONTS, BACKGROUNDS & ULTRA-SMOOTH NATIVE PAGE TRANSITIONS
   ========================================================================= */

@font-face {
    font-family: 'GameFont';
    src: url('../../assets/font.ttf') format('truetype'),
         url('/assets/font.ttf') format('truetype');
    font-display: swap;
}

*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #080a18;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(125, 95, 255, 0.12) 0%, transparent 60%);
    color: #fff;
    font-family: 'GameFont', 'Orbitron', 'Rajdhani', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Background Media & Atmospheric Vignette */
#bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    opacity: 0.55;
    transform: translateZ(0);
    pointer-events: none;
}

#bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -3;
    opacity: 0.8;
    transform: translateZ(0);
    pointer-events: none;
}

/* =========================================================================
   PAGES CONTAINER & NATIVE SLIDE TRANSITIONS (60FPS HARDWARE ACCELERATED)
   ========================================================================= */
.pages-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: pan-y;
    z-index: 10;
}

.page-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: 56px;
    padding-bottom: 90px;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(24px, 0, 0);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity;
}

.page-slide.active-page {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    z-index: 2;
}

.page-slide.slide-left {
    transform: translate3d(-24px, 0, 0);
    opacity: 0;
}

#tab-game {
    overflow: hidden;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

#tab-hub, #tab-tasks {
    justify-content: flex-start;
}

/* =========================================================================
   SUB-GAMES SLIDE-IN OVERLAYS (DAILY, STAR, MINES)
   ========================================================================= */
.subgame-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transform: translate3d(100%, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease;
    will-change: transform, opacity;
    background: linear-gradient(180deg, rgba(10, 14, 30, 0.97) 0%, rgba(5, 7, 18, 0.99) 100%);
    padding-top: 56px;
    padding-bottom: 90px;
}

.subgame-overlay.open {
    transform: translate3d(0, 0, 0);
    opacity: 1;
    pointer-events: auto;
}

/* --- SUBGAME TOP BAR & INLINE BACK BUTTON --- */
.subgame-page-wrapper {
    background: #080a18 !important;
    padding-top: 52px !important;
    padding-bottom: 84px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
}

.subgame-top-bar {
    width: 92%;
    max-width: 360px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    flex-shrink: 0;
    margin-bottom: 8px;
    z-index: 10;
}

.subgame-header-title {
    font-size: 17px;
    font-weight: 900;
    color: #00d2ff;
    text-shadow: 0 0 16px rgba(0, 210, 255, 0.8);
    letter-spacing: 1px;
    text-align: center;
}

.back-nav-inline {
    background: rgba(18, 28, 56, 0.95);
    border: 1.5px solid rgba(0, 210, 255, 0.5);
    color: #00d2ff;
    font-weight: 900;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'GameFont', sans-serif;
    font-size: 11px;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.15s, background 0.2s;
}

.back-nav-inline:active {
    transform: scale(0.92);
    background: rgba(0, 210, 255, 0.35);
}

/* Legacy Back Navigation Button */
.back-nav {
    position: absolute;
    top: 56px;
    left: 16px;
    z-index: 700;
    background: rgba(18, 28, 56, 0.9);
    border: 1.5px solid rgba(0, 210, 255, 0.45);
    color: #00d2ff;
    font-weight: 900;
    padding: 7px 15px;
    border-radius: 18px;
    cursor: pointer;
    font-family: 'GameFont', sans-serif;
    font-size: 11px;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.15s, background 0.2s;
}

.back-nav:active {
    transform: scale(0.92);
    background: rgba(0, 210, 255, 0.3);
    color: #fff;
}

/* Loader Screen */
#loader-screen {
    position: fixed;
    inset: 0;
    background: #050714;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loader-video-mp4,
#loader-video-element {
    display: none;
    max-width: 200px;
    max-height: 200px;
    margin-bottom: 20px;
    object-fit: contain;
}

.default-loader {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 210, 255, 0.15);
    border-top: 4px solid #00d2ff;
    border-radius: 50%;
    animation: spin-loader 0.8s linear infinite;
    filter: drop-shadow(0 0 10px #00d2ff);
    display: none;
    margin-bottom: 20px;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.attempts-badge {
    display: none !important;
}
