/* ============================================================
   iPhone home-screen web app — status bar + safe areas (v0.38)
   ============================================================
   Every page head sets apple-mobile-web-app-status-bar-style
   "black-translucent" and viewport-fit=cover: the page is drawn under the
   status bar, so the Neon Arena dark continues behind the clock.

   env(safe-area-inset-*) is 0 in a normal browser tab, so nothing moves
   there. Loaded last in <head>; it only ever adds safe-area offsets.
   body::before is the arena edge glow (main.css), so the band uses ::after. */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --statusbar-bg: #060A12;
}

/* Overscroll / rubber-band area in the app colour */
html { background-color: var(--statusbar-bg); }

body {
    padding-top: var(--safe-top);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

/* Solid band behind the clock: scrolled content never shows through it */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-top);
    background: var(--statusbar-bg);
    z-index: 2147483000;
    pointer-events: none;
}

/* Sidebar (sticky on desktop, fixed drawer on mobile) starts below the
   clock and keeps its last item above the home indicator */
.sidebar {
    top: var(--safe-top);
    height: calc(100vh - var(--safe-top));
    padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

/* ── v0.40: the page never slides away or gets dragged sideways ──
   In the home-screen app a scroll that hit its end (on the page or in a
   panel) bounced the whole page, so it slid away and showed blank edges.
   The browser tab keeps pull-to-refresh; its overscroll is painted in the
   app colour by the html background above. overflow-x: clip is the safety
   net against anything wider than the screen (iPhone lets you drag such a
   page sideways); wide tables scroll inside their own boxes. */
@media (display-mode: standalone) {
    html,
    body {
        overscroll-behavior: none;
        overflow-x: clip;
    }
}
/* Panels that scroll on their own keep the scroll to themselves */
.sidebar { overscroll-behavior: contain; }
/* Phones: the site switch on Analytics (Vše + 6 sites) was 423 px wide on a
   375 px screen; it now scrolls inside its own pill */
@media (max-width: 640px) {
    .switch {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }
    .switch::-webkit-scrollbar { display: none; }
    .switch a {
        flex: none;
        white-space: nowrap;
    }
}
