/* Shell interaction fixes apply to mouse, keyboard and touch alike. The empty
   window layer must not intercept the desktop; only real windows receive input. */
.window-layer { pointer-events: none; }
.window { pointer-events: auto; }
.win-body { min-height: 0; min-width: 0; }
.win-title { touch-action: none; }
.ocm-canvas-wrap canvas { touch-action: none; }
/* Informational notifications must not cover working controls. */
.toasts { pointer-events: none; }
button, a, summary { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}
.origin-menu {
  max-width: calc(100vw - 24px);
  max-height: calc(100% - var(--hud-h) - var(--tb-h) - 20px);
  display: flex;
  flex-direction: column;
}
.origin-menu[hidden] { display: none; }
.om-apps { min-height: 0; flex: 1; }
.om-header, .om-footer { flex-shrink: 0; }

@media (max-width: 860px) {
  :root {
    --hud-h: calc(56px + env(safe-area-inset-top, 0px));
    --tb-h: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  .hud {
    padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
    gap: 8px;
  }
  .hud-left { flex-shrink: 0; }
  .hud-right { display: none; }
  .hud-center { flex: 1; }
  .hud-chip { flex-shrink: 0; }
  .origin-btn, .taskbar-origin { min-height: 44px; flex-shrink: 0; }
  .taskbar {
    gap: 8px;
    padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
  }
  .taskbar-apps { min-width: 0; }
  .tb-app { min-height: 44px; flex-shrink: 0; }
  /* Phones and tablets: the desktop is a normal vertical scroll region rather
     than a fixed stage. Home-screen items (the clock card, then the icon
     grid) sit in that flow, so no floating panel can permanently cover a
     control. Overscroll is contained so the shell never drags the page
     behind it into a pull-to-refresh. */
  .desktop {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
  }
  /* Pin the window layer to the viewport: an open app must not scroll away
     with the desktop underneath it. */
  .window-layer { position: fixed; top: var(--hud-h); right: 0; bottom: var(--tb-h); left: 0; }
  .icon-field {
    position: static;
    inset: auto;
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    grid-auto-flow: row;
    grid-auto-rows: 104px;
    align-content: start;
    gap: 8px;
    padding: 16px max(14px, env(safe-area-inset-right, 0px)) 24px max(14px, env(safe-area-inset-left, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .desk-icon { width: 100%; height: 104px; min-height: 104px; padding: 12px 4px; }
  .desk-icon .di-label { font-size: 12px; }
  .desk-icon:active, .om-app:active, .tb-app:active { background: rgba(111, 211, 255, .14); }
  .window {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    border-radius: 0;
  }
  .window.window-fullscreen {
    top: var(--hud-h) !important;
    bottom: var(--tb-h) !important;
    height: auto !important;
  }
  .win-title { flex-shrink: 0; padding: 4px 8px; gap: 8px; cursor: default; }
  .win-name { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  .win-pdh { display: none; }
  .win-controls { flex-shrink: 0; }
  .win-ctl { width: 44px; height: 44px; font-size: 16px; }
  .win-body { padding: 16px max(14px, env(safe-area-inset-right, 0px)) 24px max(14px, env(safe-area-inset-left, 0px)); overscroll-behavior: contain; }
  .win-body :is(input, textarea, select):not([type="checkbox"]):not([type="radio"]) { font-size: 16px; max-width: 100%; min-width: 0; }
  .win-body :is(button, summary) { min-height: 44px; }
  .win-body :is(input[type="checkbox"], input[type="radio"]) { width: 22px; height: 22px; flex-shrink: 0; }
  .win-body input[type="range"] { min-height: 44px; }
  .grid-2, .ll-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv .v { margin-bottom: 8px; overflow-wrap: anywhere; }
  .slider-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 6px 12px; }
  .slider-row label { width: auto; grid-column: 1 / -1; }
  .slider-row input { width: 100%; }
  .ll-inline { flex-wrap: wrap; }
  .ll-inline input { min-width: 0; }
  .term-row input { min-width: 0; }
  .pdh-block, .term-out, .rule-box { overflow-wrap: anywhere; }
  .coin-ring-wrap svg { max-width: 100%; height: auto; }
  .origin-menu { left: max(8px, env(safe-area-inset-left, 0px)); bottom: calc(var(--tb-h) + 8px); width: min(400px, calc(100vw - 16px)); }
  .om-app { min-height: 56px; }
  .om-desc { overflow-wrap: anywhere; }
  .om-footer { padding: 8px 14px; }
  .boot { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .boot-tagline { padding: 0; }
  .boot-links a { min-height: 44px; display: inline-flex; align-items: center; }
  .boot-log { overflow-wrap: anywhere; }
  .boot-skip { min-height: 44px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; color: var(--ice); }
  .void-banner { max-height: calc(100% - var(--hud-h) - var(--tb-h) - 20px); overflow-y: auto; }
  .void-inner { gap: 8px; padding: 12px; }
  .void-sigil { display: none; }
  .toasts { right: 8px; width: min(400px, calc(100vw - 16px)); max-height: 35%; overflow: hidden; }
  /* Keep Ground-0 navigation compact so it doesn't consume a phone's entire
     workspace. Its main pane remains the independently scrollable reader. */
  .g0-shell { flex-direction: column; }
  .g0-rail {
    width: 100%; flex-direction: row; flex-wrap: nowrap;
    border-right: 0; border-bottom: 1px solid var(--g0-line);
    padding: 8px; gap: 6px; overflow-x: auto; overflow-y: hidden;
    align-items: center;
  }
  .g0-rail-brand, .g0-rail-group, .g0-rail-foot { display: none; }
  .g0-rail-btn { width: auto; flex-shrink: 0; white-space: nowrap; }
  .g0-main { min-height: 0; padding: 16px 14px 24px; }
  .g0-logic-grid, .g0-cards2, .g0-spec-layout { grid-template-columns: minmax(0, 1fr); }
  .gi-app { padding: 16px 12px; }
  .gi-tab { padding-inline: 8px; }
  .ocm-routing-hud {
    padding: 6px 8px;
    gap: 4px;
    bottom: 6px;
    left: 6px;
    right: 6px;
  }
  .orh-top { gap: 6px; }
  .orh-metric { display: none; }
  .orh-step-sub { display: none; }
  .orh-seq { padding: 4px 6px; gap: 3px; }
  .orh-step-title { font-size: 7.5px; }
}

@media (pointer: coarse) {
  .win-ctl { width: 44px; height: 44px; }
  .btn, .chip-toggle, .ll-model-chip, .om-app, .tb-app { min-height: 44px; }
}

/* Mobile and tablet: the clock/calendar widget is the first item in the
   desktop's scroll flow, so the – control can fade its panel away while leaving
   a compact restore target. Its card layout lives with the rest of the widget
   in css/uts.css; only the touch-target size belongs here. */
@media (max-width: 860px) {
  .home-time-widget .home-widget-toggle { min-width: 38px; min-height: 34px; }
}

/* ── Oct 2026: Mobile graceful notice + guided demo survival + truncated copy sweep ── */
.mobile-notice { display: block; }
.mobile-notice[hidden] { display: none !important; }
@media (min-width: 861px) {
  .mobile-notice { display: none !important; }
}

/* Truncated copy sweep: ensure rule-boxes, panels, cards wrap on mobile */
@media (max-width: 860px) {
  .win-body .rule-box,
  .win-body .panel,
  .win-body .card,
  .win-body .h1,
  .win-body .h2,
  .win-body .sub,
  .win-body p,
  .win-body li,
  .win-body .mono,
  .win-body pre,
  .win-body code {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }
  .win-body pre { white-space: pre-wrap; }
  /* Guided demo specific: keep paced pitch readable on small screens */
  .win-body .step-box { padding: 12px; border-radius: 10px; }
  .win-body .step-box .st-title { font-size: 12px !important; line-height: 1.5; }
  .win-body .step-box .st-body { font-size: 12px; line-height: 1.6; }
  .win-body .step-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .win-body .step-nav .btn { min-height: 44px; padding: 8px 12px; }
  .win-body .step-dots { display: flex; gap: 4px; }
  .win-body .step-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-hi); display: inline-block; }
  .win-body .step-dots i.on { background: var(--gold); }
  .win-body .adv-results { max-height: none; overflow: visible; }
  .win-body .ul { padding-left: 0; }
  .win-body .li { padding-left: 18px; font-size: 12.5px; }
  /* Three-lane audit view already stacked via ground0.css, ensure touch targets */
  .g0-three-lane { padding: 12px; }
  .g0-lane-grid { grid-template-columns: 1fr; }
  .g0-lane-card { padding: 12px; }
  .g0-lane-badge .g0-phase-badge { font-size: .75em; }
}
