/* Layout Architecture */

#app-shell {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========== Top Bar ========== */
/* Styles moved to components.css for better specificity */
/* #topbar is created by TopBar.ts component */

/* ========== Game Container (Phaser Canvas) ========== */
#game-container {
    position: absolute;
    top: var(--space-12);
    /* 48px - below top bar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-canvas);
    overflow: hidden;
    pointer-events: auto;
}

#game-container canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    /* Prevent browser gestures */
    pointer-events: auto;
}

@media (max-width: 768px) {
    #game-container {
        top: 40px;
        bottom: 64px;
        /* Above bottom nav on mobile */
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    #game-container {
        bottom: 72px;
        /* Tablet bottom nav height */
    }
}

@media (min-width: 1024px) {
    #game-container {
        left: 280px;
        /* Start after entities sidebar */
        bottom: 0;
        /* No bottom nav on desktop */
    }
}

/* ========== Bottom Nav ========== */
/* Styles in bottom-nav.css */
/* Component created by BottomNav.ts */

/* ========== Overlay Container (Sheets, Modals) ========== */
#overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-overlays);
    pointer-events: none;
    /* Allow clicks to pass through to canvas */
}

#overlay-container>* {
    pointer-events: auto;
    /* Children capture clicks */
}

/* ========== Safe Area Support (iOS Notch) ========== */
@supports (padding: env(safe-area-inset-top)) {
    #topbar {
        padding-top: max(0px, env(safe-area-inset-top));
        height: calc(var(--space-12) + env(safe-area-inset-top));
    }

    #game-container {
        top: calc(var(--space-12) + env(safe-area-inset-top));
    }

    #bottom-nav {
        padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
        height: calc(64px + env(safe-area-inset-bottom));
    }

    @media (max-width: 768px) {
        #topbar {
            height: calc(40px + env(safe-area-inset-top));
        }

        #game-container {
            top: calc(40px + env(safe-area-inset-top));
        }
    }
}

/* ========== Scrollbar Styling (Global) ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 100, 150, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 100, 150, 0.7);
}