/* ══════════════════════════════════════════════════════════════════════
   arc308 · phone layer for the Fluent shell
   The Fluent skin (fluent-shell.css, loaded last, every rule forced) pins the
   module rail to the left and the workspace beside it, which leaves a phone
   with a squeezed canvas, overlapping header buttons and a trial bar in the
   way. This sheet loads after it and, on narrow screens only, lays the shell
   out for a thumb: rail along the bottom, workspace full width, header in
   two rows, start screen in one column.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  :root { --fl-rail: 0px !important; }
  html, body { overscroll-behavior: none; }

  /* trial bar: one line of text, buttons on the next line */
  html body .tia-bar { height: auto !important; min-height: 0 !important; flex-wrap: wrap !important; padding: 5px 10px !important; gap: 4px 8px !important; justify-content: flex-start !important; line-height: 1.3 !important; }
  html body .tia-bar > span { flex: 1 1 100%; }

  /* header: File and the two badges on one row, wrapping if needed */
  html body > header { height: auto !important; min-height: 44px !important; display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: 6px !important; padding: 5px 8px !important; }
  html body > header .brand-name, html body > header .brand-text { font-size: 14px !important; }
  html body > header .win-controls, html body > header .win-min-tab { display: none !important; }
  html body > header .scenario-badge { height: 28px !important; padding: 0 8px !important; max-width: 46vw; overflow: hidden; }
  html body > header .scenario-badge .sb-eyebrow { display: none !important; }
  html body > header .scenario-badge .sb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* rail along the bottom: one swipeable row of the modules */
  html body .journey-ribbon {
    position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
    width: 100% !important; height: 62px !important; margin: 0 !important; padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important; flex-direction: row !important; align-items: center !important; gap: 4px !important;
    overflow-x: auto !important; overflow-y: hidden !important; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    background: #ffffff !important; border-top: 1px solid #e3e7ed !important; border-right: 0 !important; box-shadow: 0 -4px 14px rgba(15,23,42,.08) !important; z-index: 40 !important;
  }
  html body .journey-ribbon::-webkit-scrollbar { display: none; }
  html body .journey-ribbon .jr-phase, html body .journey-ribbon .jr-stages { display: contents !important; }
  html body .journey-ribbon .jr-phase-header, html body .journey-ribbon .jr-arrow, html body .journey-ribbon .jr-fill, html body .journey-ribbon .jr-progress { display: none !important; }
  html body .journey-ribbon .jr-stage { flex: 0 0 auto !important; width: 60px !important; height: 52px !important; padding: 2px 0 !important; gap: 2px !important; }
  html body .journey-ribbon .jr-stage::before { left: 4px !important; top: -4px !important; width: 22px !important; height: 3px !important; }
  html body .journey-ribbon .jr-stage-num { width: 28px !important; height: 28px !important; min-width: 28px !important; }
  html body .journey-ribbon .jr-stage-num svg, html body .journey-ribbon .jr-stage.on .jr-stage-num svg { width: 16px !important; height: 16px !important; }
  html body .journey-ribbon .jr-stage-name { font-size: 9.5px !important; max-width: 60px !important; }
  html body .journey-ribbon .jr-more-trigger { width: 56px !important; height: 44px !important; }
  html body .journey-ribbon .jr-more-menu { left: 8px !important; right: 8px !important; bottom: 70px !important; top: auto !important; }

  /* workspace: full width, room for the bar below */
  html body main#main, html body main#main.companion-open { margin-left: 0 !important; grid-template-columns: 1fr !important; gap: 0 !important; padding: 4px 4px calc(66px + env(safe-area-inset-bottom, 0px)) !important; }
  html body .workspace { min-width: 0 !important; }
  html body .frame-wrap, html body .frame-wrap iframe { width: 100% !important; max-width: 100% !important; touch-action: auto; }
  html body .companion { position: fixed !important; inset: 0 !important; z-index: 9000 !important; }

  /* floating pills keep clear of the bar */
  html body .hb-pill, html body .tia-assistant-launcher, html body .refinery-strip, html body .pwa-install-btn { bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; }
  html body .pwa-install-btn { display: none !important; }

  /* start screen: one column, the field first */
  html body .scenario-wall { padding: 8px !important; }
  html body .scenario-wall .sw-card { padding: 14px 12px 16px !important; }
  html body .scenario-wall .sw-close { top: 6px !important; right: 6px !important; }
  html body .sw-start { padding: 12px !important; }
  html body .sw-start-row { grid-template-columns: 1fr !important; }
  html body .sw-start-ta { min-height: 110px !important; }
  html body .sw-start-side { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; }
  html body .sw-start-go { flex: 1 1 100% !important; }
  html body .sw-tools { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  html body .sw-tool { padding: 9px 10px !important; }
  html body .sw-suggest { grid-template-columns: 1fr !important; grid-template-areas: "sketch" "pics" "start" "scenario" "diagram" "modules" "plan" !important; gap: 10px !important; }
  html body .sw-sg-doodles { grid-template-columns: 1fr !important; }
  html body .sw-plan { columns: 1 !important; }
  html body .sw-grid { grid-template-columns: 1fr 1fr !important; }
  html body .sw-sk-actions { gap: 6px !important; }
  input, select, textarea { font-size: 16px !important; }
}

/* ── phone, finished (arc308) ─────────────────────────────────────────── */
@media (max-width: 760px) {
  /* the trial bar: one row, no sentence; the start screen starts under it */
  html body .tia-bar { padding: 4px 44px 4px 8px !important; min-height: 44px !important; align-items: center !important; }
  html body .tia-bar > span { display: none !important; }
  html body .tia-bar button.go { font-size: 12px !important; padding: 5px 9px !important; }
  html body .tia-bar .x { right: 4px !important; }
  html body:has(.tia-bar) .scenario-wall { top: 44px !important; height: auto !important; bottom: 0 !important; }
  /* floating pills: small round buttons in the bottom corners, above the module rail */
  html body .hb-pill { left: 10px !important; right: auto !important; width: 46px !important; height: 46px !important; padding: 0 !important; border-radius: 50% !important; justify-content: center !important; }
  html body .hb-pill span { display: none !important; }
  html body .hb-pill svg { width: 22px !important; height: 22px !important; margin: 0 !important; }
  html body .refinery-strip { right: 10px !important; left: auto !important; width: 46px !important; height: 46px !important; padding: 0 !important; border-radius: 50% !important; justify-content: center !important; }
  html body .refinery-strip .rs-label { font-size: 0 !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; }
  html body .refinery-strip .rs-emoji { font-size: 20px !important; }
  html body .refinery-strip .rs-count, html body .refinery-strip .rs-sub { display: none !important; }
}
