/* ══════════════════════════════════════════════════════════════════
   Brainy — mobile shell (arc197)
   Loaded last by index.html. Everything sits inside the media query,
   so desktop and tablet layouts are untouched.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {

  html, body { overscroll-behavior: none; }
  body { padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* ── Trial bar: one compact block instead of three rows ── */
  .tia-bar { font-size: .76rem !important; line-height: 1.3 !important;
    padding: calc(.35rem + env(safe-area-inset-top, 0px)) .7rem .4rem !important;
    gap: .35rem .5rem !important; justify-content: flex-start !important; }
  .tia-bar > span { flex: 1 1 100%; }
  .tia-bar button { font-size: .76rem !important; padding: .32rem .6rem !important; }

  /* ── Header: File · Brainy · (no window buttons on a phone) ── */
  header { height: 46px !important; padding: 0 8px !important;
    grid-template-columns: auto 1fr auto !important; }
  .header-zone.center { justify-self: center; }
  .win-controls, .win-min-tab { display: none !important; }
  .file-btn { padding: 7px 12px !important; font-size: .84rem !important; }
  .brand-bulb { width: 22px; height: 22px; }
  .brand-name { font-size: 1rem !important; }
  .scenario-badge { max-width: 38vw; overflow: hidden; }
  .scenario-badge .sb-eyebrow { display: none; }
  .scenario-badge .sb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* File menu: full-width sheet under the header */
  .file-dropdown { position: fixed !important; left: 8px !important; right: 8px !important;
    top: auto !important; width: auto !important; max-height: 70vh; overflow-y: auto; }
  .file-dropdown .fm-item { min-height: 44px; }

  /* ── Journey ribbon: one swipeable row of the eight modules ── */
  .journey-ribbon { height: auto !important; margin: 6px 6px 0 !important; padding: 4px !important;
    gap: 4px !important; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .journey-ribbon::-webkit-scrollbar { display: none; }
  .journey-ribbon .jr-phase { display: contents; }
  .journey-ribbon .jr-phase-header, .journey-ribbon .jr-arrow, .journey-ribbon .jr-fill { display: none !important; }
  .journey-ribbon .jr-stages { display: contents; }
  .journey-ribbon .jr-stage { flex: 0 0 auto !important; min-width: 0 !important;
    padding: 6px 10px 6px 6px !important; gap: 6px !important; scroll-snap-align: start;
    border: 1px solid #e0f2fe; border-radius: 10px; transform: none !important; }
  .journey-ribbon .jr-stage.on { border-color: #0ea5e9; background: #f0f9ff; }
  .journey-ribbon .jr-stage-num { width: 28px !important; height: 28px !important; min-width: 28px !important; }
  .journey-ribbon .jr-stage-num svg { width: 18px !important; height: 18px !important; }
  .journey-ribbon .jr-stage-name { font-size: .8rem !important; white-space: nowrap; }
  .journey-ribbon .jr-stage-verb { display: none !important; }

  /* ── Workspace: the module gets the full width ── */
  main, main.companion-open { grid-template-columns: 1fr !important; gap: 0 !important; padding: 6px !important; }

  /* Notes: a small button instead of a column; opens as a full-screen sheet */
  .refinery-strip { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 900; writing-mode: horizontal-tb; transform: none; min-width: 0; max-width: none;
    padding: 10px 14px; gap: 6px; border-radius: 999px; }
  .refinery-strip .rs-verb { display: none; }
  main.companion-open { z-index: 9000 !important; }
  body:has(main.companion-open) .tia-bar,
  body:has(main.companion-open) .hb-pill,
  body:has(main.companion-open) .tia-assistant-launcher { display: none !important; }
  main.companion-open .companion { position: fixed; inset: 0; z-index: 9000;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); background: #fff; }
  main.companion-open .companion .glass { border-radius: 0 !important; }
  .companion-close { min-width: 40px; min-height: 40px; font-size: 1.5rem; }

  /* Assistant and help keep clear of the Notes button */
  body:has(main.companion-open) .tia-assistant-launcher,
  body:has(main.companion-open) .tia-assistant,
  body.notes-open .tia-assistant-launcher,
  body.notes-open .tia-assistant { right: 12px !important; }
  .tia-assistant { left: 8px !important; right: 8px !important; width: auto !important; max-width: none !important; }
  .hb-pill { transform: scale(.85); transform-origin: left bottom; }
  .hb-panel { left: 8px !important; right: 8px !important; width: auto !important; max-width: none !important; }
  .pwa-install-btn { display: none !important; }

  /* ── Scenario wall ── */
  .scenario-wall { padding: 20px 14px 40px !important; }
  .sw-title { font-size: 24px !important; }
  .sw-head { margin-bottom: 20px !important; }
  .sw-preview { display: none !important; }   /* hover preview: no hover on a phone */
  .sw-close { top: 0 !important; right: 0 !important; }

  /* ── Workspace gate, sessions, search: full-width sheets ── */
  .ws-gate { align-items: flex-start !important; padding: 12px !important; overflow-y: auto; }
  .ws-gate-card, .ws-gate-main { max-width: 100% !important; }
  .sessions-panel, .project-dropdown { position: fixed !important; left: 8px !important; right: 8px !important;
    width: auto !important; min-width: 0 !important; max-height: 75vh; overflow-y: auto; }
  .gsearch-modal { width: calc(100vw - 16px) !important; max-width: none !important; margin-top: 8px !important; }

  /* Inputs: 16px stops iPhone zooming into fields */
  input, select, textarea { font-size: 16px !important; }
}
