/* Tharvik - tablet.css (2026-11-10). Loaded LAST.
   The app always fills the whole screen, whatever the device: a small phone, a big phone, a phone turned sideways, an iPad (any size, either way up),
   a split-screen window or a desktop browser. It used to be a 640px column floating in the middle of a tablet with black bars on both sides ("forma rara").
   Now backgrounds, glow and panels are full-bleed, and only the CONTENT keeps a comfortable reading column (--col) centred in the screen, like the Claude /
   ChatGPT apps. Nothing is scaled and nothing is cut.
   --gut is the side room that centres a column of --col; a screen that wants a narrower column redeclares both (a var() inside a custom property is
   resolved where the property is declared, so --gut has to be redeclared next to --col). */

html, body{ overflow-x:hidden; }

/* the frame: the true visible height (100% first - old iOS reads 100vh as taller than the screen, which pushed the input bar below it - then dvh where known);
   `overflow:clip` (unlike `hidden`) cannot be scrolled even by a script (scrollIntoView / focus), which is what shifted whole screens up; js/tablet.js is the
   fallback for browsers without it */
#app{ min-width:0; width:100%; max-width:none; height:100%; height:100dvh; border-left:0; border-right:0; overflow:hidden; overflow:clip; }

/* a phone turned sideways in the installed / store app: keep clear of the notch on both sides (the top and bottom are handled in safearea.css / storemode.css) */
html.ios-pwa #app, html.store-app #app{ left:var(--sal, env(safe-area-inset-left, 0px)); right:var(--sar, env(safe-area-inset-right, 0px)); }
html.ios-pwa #app > [id$="Panel"]:not(#sidePanel), html.store-app #app > [id$="Panel"]:not(#sidePanel){ padding-left:var(--sal, env(safe-area-inset-left, 0px)); padding-right:var(--sar, env(safe-area-inset-right, 0px)); }

/* the suggestion row scrolls sideways on a narrow screen: its close button stays in reach instead of scrolling away with the chips */
.suggest-strip .sg-x{ position:sticky; right:0; z-index:1; background:var(--panel); border:1px solid var(--line); box-shadow:-10px 0 12px -4px var(--bg); }

/* the smallest phones (320-350px wide: iPhone SE 1st gen, a folded foldable): the input bar gets its room back so its placeholder fits on one line */
@media (max-width:350px){
  #inputRow{ margin-left:12px; margin-right:12px; padding-left:12px; }
  #chat{ padding-left:16px; padding-right:16px; }
  #msgInput::placeholder{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}

/* a phone turned sideways (or any window that is short): the chat needs the height, so the header slims down and the extras step aside */
@media (max-height:520px){
  #app > header{ padding-top:8px; padding-bottom:8px; }
  #app > header .tagline{ display:none; }
  #app #sxToday, #app #chatSuggest{ display:none !important; }
  #app #inputRow{ margin-bottom:8px; }
  #app #chat{ padding-top:10px; padding-bottom:10px; gap:10px; }
}

@media (min-width:700px){
  #app{ --col:820px; --gut:max(24px, calc((100% - var(--col)) / 2)); }
  /* narrower screens inside the app: their own wrappers are 520-560px */
  #app #caloriePanel, #app #bodyScanPanel, #app #cyclePanel, #app #forYouPanel{ --col:600px; --gut:max(24px, calc((100% - var(--col)) / 2)); }
  #app #setup{ --col:640px; --gut:max(24px, calc((100% - var(--col)) / 2)); padding-left:var(--gut); padding-right:var(--gut); }
  #app .q-back{ right:max(24px, calc((100% - 640px) / 2)); }
  #app #calendarPanel{ --col:760px; --gut:max(24px, calc((100% - var(--col)) / 2)); }

  /* the reading column: every screen's header, scrolling area and input sit in it; the colour reaches both edges */
  #app > header{ padding-left:var(--gut); padding-right:var(--gut); }
  #app #chat{ padding-left:var(--gut); padding-right:var(--gut); }
  #app .typing-row{ padding-left:var(--gut); padding-right:var(--gut); }
  #app #attachPreview{ margin-left:var(--gut); margin-right:var(--gut); }
  #app #inputRow{ margin-left:var(--gut); margin-right:var(--gut); }
  #app #sxToday{ margin-left:var(--gut); margin-right:var(--gut); }
  #app #chatSuggest{ margin-left:var(--gut); margin-right:var(--gut); }
  #app .settings-head{ padding-left:var(--gut); padding-right:var(--gut); }
  #app .settings-body{ padding-left:var(--gut); padding-right:var(--gut); }

  /* the side menu stays a drawer, a little wider and never a third of the screen */
  .side-sheet{ width:360px; max-width:42%; }
}

@media (min-width:1100px){
  #app{ --col:900px; }
}
