/* Phone / web build overrides. Loaded after styles.css only in the web build. */
html.web, html.web body { height: 100%; overscroll-behavior: none; }
html.web .app { height: 100dvh; }
/* No native window controls in a browser. */
html.web .topbar { padding-right: 10px; }
/* The built-in browser and voice input need the desktop app. */
html.web #tg-browser, html.web #prov-open, html.web #health-now, html.web kbd { display: none !important; }
html.web .pop-foot { display: none; }
html.web .boot-text { max-width: 320px; text-align: center; line-height: 1.5; padding: 0 20px; }

@media (max-width: 760px) {
  html.web { --col: 100%; }
  html.web body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  /* Sessions: an overlay drawer. */
  html.web .sidebar {
    position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(84vw, 320px);
    margin-left: 0; transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.6);
    padding-top: env(safe-area-inset-top);
  }
  html.web .app.collapsed .sidebar { transform: translateX(-105%); box-shadow: none; margin-left: 0; }
  html.web .app:not(.collapsed)::after {
    content: ""; position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.45);
  }
  html.web #btn-expand, html.web .only-collapsed { display: grid; }
  html.web .sess { padding-top: 10px; padding-bottom: 10px; }
  html.web .sess .del { display: grid; }

  html.web .topbar { padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
  html.web .top-tools .tool-toggle span { display: none; }
  html.web .top-tools .tool-toggle { padding: 0 9px; }
  html.web .title { font-size: 14px; }

  html.web .thread { padding: 12px 14px 28px; }
  html.web .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  html.web .composer textarea { font-size: 16px; } /* 16px stops iOS from zooming into the field */
  html.web .under { flex-wrap: wrap; row-gap: 2px; }
  html.web .app.empty .scroller { flex: 0 0 30vh; }
  html.web .welcome h1 { font-size: 22px; }

  /* Files and terminals: full screen sheets over the chat. */
  html.web .work-body { padding: 0; position: relative; }
  html.web .right-col {
    position: absolute; inset: 0; z-index: 20; width: auto !important; margin: 0; min-width: 0;
    background: var(--bg); padding: 0 6px 6px;
  }
  html.web .right-col .side-panel { border-radius: 12px; }
  html.web #resize-side { display: none !important; }
  html.web .term-panel:not(.in-right) { position: absolute; inset: auto 0 0 0; z-index: 21; height: 55dvh !important; margin: 0; border-radius: 14px 14px 0 0; }
  html.web .files-view { flex-direction: column; }
  html.web .tree { width: auto !important; max-height: 40%; border-right: 0; border-bottom: 1px solid var(--border-soft); }

  html.web .popover { left: 8px !important; right: 8px !important; width: auto; }
  html.web .modal-card, html.web .modal > div { width: calc(100vw - 24px); }
  html.web .codeblock pre { font-size: 12.5px; }
  html.web .to-bottom { right: 14px; }
}

/* Model picker and token stats open as a bottom sheet on the phone, not a floating card. */
@media (max-width: 760px) {
  html.web .popover.sheet {
    position: fixed; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
    width: auto; max-height: 74dvh !important; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 40px rgba(0,0,0,.5), 0 0 0 100vmax rgba(0,0,0,.5);
    animation: sheet-up .22s cubic-bezier(.22,.61,.36,1);
  }
  html.web .popover.sheet::before {
    content: ""; display: block; flex: none; width: 38px; height: 4px; border-radius: 3px;
    background: var(--border); margin: 9px auto 3px;
  }
  html.web #model-pop.sheet .pop-search { border-top: 0; }
  html.web #model-pop.sheet .pop-item, html.web .usage-pop.sheet .us-row { padding-top: 10px; padding-bottom: 10px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Folder picker as a bottom sheet on the phone. */
@media (max-width: 760px) {
  html.web .fp-back { padding: 0; place-items: end stretch; }
  html.web .fp-card.sheet { width: 100%; max-width: 100%; max-height: 82dvh; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .22s cubic-bezier(.22,.61,.36,1); }
  html.web .fp-card.sheet .fp-row { padding-top: 12px; padding-bottom: 12px; }
}

/* ask + folder picker as bottom sheets */
@media (max-width: 760px) {
  html.web .ask-card.sheet { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; margin-top: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation: sheet-up .22s cubic-bezier(.22,.61,.36,1); }
  html.web .fp-back { align-items: flex-end; }
  html.web .comp-btn.vuln span { display: inline; }
}
