/* Tharvik - safearea.css (2026-11-07). The app opened from the iPhone home screen ("Add to Home Screen") draws UNDER the clock / Dynamic Island (status bar style
   black-translucent) and under the home bar. Without this the header, the first line of every screen and the bottom buttons were partly hidden ("se corta arriba").
   boot.js adds html.ios-pwa (only for that case) and viewport-fit=cover; the app then sits inside the safe area exactly like in the store app (storemode.css).
   --sat / --sab can be set by hand (tests); otherwise the phone's own numbers (env) are used. */
html.ios-pwa, html.ios-pwa body{ overflow:hidden; overscroll-behavior:none; background:var(--bg); }
html.ios-pwa #app{ position:fixed; top:var(--sat, env(safe-area-inset-top, 0px)); bottom:var(--sab, env(safe-area-inset-bottom, 0px)); left:0; right:0; height:auto; }
/* the side menu and every full-screen feature layer reach the true top and bottom of the screen; their content keeps clear of the clock and the home bar */
html.ios-pwa #sidePanel{ position:fixed; inset:0; }
html.ios-pwa .side-sheet{ padding-top:calc(18px + var(--sat, env(safe-area-inset-top, 0px))); padding-bottom:calc(18px + var(--sab, env(safe-area-inset-bottom, 0px))); }
html.ios-pwa #app > [id$="Panel"]:not(#sidePanel){ position:fixed; inset:0; padding-top:var(--sat, env(safe-area-inset-top, 0px)); padding-bottom:var(--sab, env(safe-area-inset-bottom, 0px)); }
html.ios-pwa #planReveal, html.ios-pwa #celebrate{ position:fixed; inset:0; }
html.ios-pwa #consentGate, html.ios-pwa #recoveryGate{ padding-top:calc(16px + var(--sat, env(safe-area-inset-top, 0px))); padding-bottom:calc(16px + var(--sab, env(safe-area-inset-bottom, 0px))); }
html.ios-pwa .lp-modal{ padding-top:calc(20px + var(--sat, env(safe-area-inset-top, 0px))); padding-bottom:calc(20px + var(--sab, env(safe-area-inset-bottom, 0px))); }
/* a few rules inside the app already add the bottom safe area themselves; the container does it now, so they must not add it twice */
html.ios-pwa .su-savebar{ padding-bottom:12px; }
html.ios-pwa .cl-sheet{ padding-bottom:20px; }
html.ios-pwa .cl-toast{ bottom:22px; }
html.ios-pwa .sx-rest{ bottom:16px; }
/* the clock is always white on a translucent bar: in a light theme it sits on a dark band so it stays readable */
html.ios-pwa[data-theme="light"]::before{ content:''; position:fixed; top:0; left:0; right:0; height:var(--sat, env(safe-area-inset-top, 0px)); background:#150F0A; z-index:100002; pointer-events:none; }

/* ---- 2026-11-07: a centred box that is taller than the screen must never lose its top ----
   (`align-items:center` on a scrolling full-screen layer pushes the overflow ABOVE the top edge, where nothing can scroll to it: the first lines were cut.)
   `safe center` centres while it fits and starts at the top when it does not; the margin:auto fallback does the same where `safe` is unknown. */
/* ---- small phones (iPhone SE, a browser with its bars up): the side menu can be taller than the screen; it scrolls instead of pushing its last rows below the edge ---- */
.side-sheet{ overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
@media (max-height:600px){ .side-sheet .side-chats{ flex:1 1 auto; min-height:92px; } }
.side-sheet .side-footer{ flex:none; }

#consentGate, #recoveryGate{ align-items:safe center; }
#consentGate > *, #recoveryGate > *{ margin-block:auto; }
.lp-modal{ place-items:safe center; overflow-y:auto; }
