/* responsive.css (build v12, agent "responsive"): small windows, tablets and phones, and touch.
   Linked last. Every rule sits inside a media query below 1280 px wide (or a short landscape phone),
   so 1280 px and wider render exactly as before. Rules target containers (dock, islands, menus, guide line,
   card panel), not other agents' ids, so pieces added later behave the same way. */

/* ---------------------------------------------------------------- below 1280: nothing may run off the screen */
@media (max-width:1279px){
  .dock.glass{max-width:calc(100vw - 16px)}
  .dock > .split,.dock > .circle,.run-main{flex:none}
  .menu{max-width:calc(100vw - 16px)}
  .step-menu{max-width:calc(100vw - 32px)}
  .toast.glass{max-width:calc(100vw - 24px)}
  .f10-say{text-wrap:balance}
}

/* ---------------------------------------------------------------- touch screens below 1280: 44 px targets */
@media (max-width:1279px) and (pointer:coarse){
  :root{--dock-h:4.5rem}
  .split{height:2.75rem}
  .circle.glass{width:2.75rem;height:2.75rem}
  .split .run-caret{width:34px;height:34px}
  .insp-close{width:2.75rem;height:2.75rem;margin-right:-.375rem}
  .mi{min-height:2.75rem}
  .sm-item{min-height:2.75rem}
  .more{width:2.75rem;height:2.75rem}
  .f10-input{height:2.75rem}
  .f10-go{width:2.75rem;height:2.75rem}
  .f10-link{height:2.75rem}
  /* text fields: 16 px, so a phone or tablet does not zoom the page when one is tapped */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select{font-size:16px}
}

/* ---------------------------------------------------------------- narrow (tablet portrait, small windows) */
@media (max-width:760px){
  /* the dock: the step beads go first (the cards themselves show the same thing) */
  .dock .steps{display:none}
}

/* ---------------------------------------------------------------- phones, portrait (and any window up to 600 px wide) */
@media (max-width:600px){
  :root{
    --island-inset:.75rem; --island-h:3rem; --safe-side:.75rem;
    --safe-top:4.75rem; --safe-bottom:12rem;
    --dock-bottom:.75rem; --dock-h:4.5rem;
  }
  /* header: brand and Live only. The scenario name, the counts and the health words step out. */
  .island-left{padding:0 var(--s-3) 0 var(--s-1)}
  .island-left .hdiv,.island-left .crumbs{display:none}
  .wordmark{font-size:1.125rem;margin-left:var(--s-2)}
  .logo{width:2.25rem;height:2.25rem}
  .island-right{padding:0 var(--s-1)}
  .island-right .ir-sep,.island-right .ir-stat,.island-right .ir-health{display:none}

  /* the dock: Add step, Test run and the result; anything extra hides before Test run can be squeezed */
  .dock.glass{padding:var(--s-3) var(--s-3);gap:var(--s-3);max-width:calc(100vw - 2 * var(--island-inset))}
  .split{height:2.75rem}
  .circle.glass{width:2.75rem;height:2.75rem}
  .run-main{padding:0 var(--s-3) 0 var(--s-4)}
  .dock-result{padding:0 var(--s-2);min-width:0;overflow:hidden}
  .dock-result .metric{display:none}

  /* the guide line: wraps in balanced lines, the name field on its own line, 16 px so the phone does not zoom */
  .f10-say{font-size:.9375rem;line-height:1.375rem;padding:0 var(--s-4);bottom:calc(var(--dock-bottom) + var(--dock-h) + 12px)}
  .f10-form{display:flex;justify-content:center;margin:10px auto 0;width:max-content;max-width:100%}
  .f10-input{width:min(14rem,calc(100vw - 7rem));height:2.75rem;font-size:16px}
  .f10-go{width:2.75rem;height:2.75rem;flex:none}
  .f10-link{display:flex;width:max-content;margin:10px auto 0;height:2.75rem}
  .hint{max-width:calc(100vw - 2rem)}

  /* Fit sits under the header on the right, clear of the dock and the guide line */
  .fit.glass{top:calc(var(--island-inset) + var(--island-h) + 12px);bottom:auto;right:var(--island-inset);width:2.75rem;height:2.75rem}

  /* menus and panels: inside the screen, scroll inside */
  .menu{max-height:calc(100dvh - 2 * var(--island-inset) - var(--island-h) - 16px);overflow-y:auto}
  .menu-run{max-height:calc(100dvh - var(--dock-bottom) - var(--dock-h) - var(--island-inset) - var(--island-h) - 32px)}
  .step-menu{width:calc(100vw - 32px);max-height:min(28rem,calc(100dvh - var(--dock-bottom) - var(--dock-h) - 40px))}

  /* text fields: 16 px, so phones do not zoom the page when one is tapped */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select{font-size:16px}
}
/* ---------------------------------------------------------------- phones and tablets in portrait: the card panel is a bottom sheet
   (the dock floats over its foot, so Test run stays in reach; the camera centres the card above it, responsive.js) */
@media (max-width:600px),(max-width:900px) and (orientation:portrait){
  :root{--sheet-h:min(62dvh,34rem)}
  .inspector{left:0;right:0;top:auto;bottom:0;width:auto;height:var(--sheet-h);border-radius:var(--r-lg) var(--r-lg) 0 0;
    padding:var(--s-6) var(--s-5) calc(var(--dock-bottom) + var(--dock-h) + var(--s-3));transform-origin:50% 100%}
  .inspector .insp-head{touch-action:none}
  .inspector .insp-head::before{content:"";position:absolute;top:8px;left:50%;width:36px;height:4px;margin-left:-18px;border-radius:2px;
    background:rgba(255,255,255,.22);box-shadow:0 0 0 1px rgba(255,255,255,.04)}
  .dock.glass{z-index:26}
  .safe-probe.with-inspector{right:var(--safe-side);bottom:calc(var(--sheet-h) + 8px)}

}

@media (max-width:400px){
  .wordmark{font-size:1rem}
  .island-right .status{padding:0 var(--s-3) 0 var(--s-2)}
  /* very narrow: extra dock pieces (counts and the like) step out; Add step, Test run and the result stay */
  .dock > :not(.circle):not(.split):not(.dock-result):not(.steps){display:none}
}

/* ---------------------------------------------------------------- phones, landscape (short windows) */
@media (max-height:500px) and (orientation:landscape) and (max-width:1279px){
  :root{
    --island-inset:.5rem; --island-h:2.75rem; --safe-side:.75rem;
    --safe-top:3.75rem; --safe-bottom:6.75rem;
    --dock-bottom:.5rem; --dock-h:3.75rem;
  }
  .island-left{padding:0 var(--s-3) 0 var(--s-1)}
  .logo{width:2rem;height:2rem}
  .logo svg{width:1.25rem;height:1.25rem}
  .wordmark{font-size:1.0625rem}
  .island-right .ir-health,.island-right .ir-sep-health{display:none}
  #island-right .status{height:2.25rem}
  .dock.glass{padding:var(--s-2) var(--s-3);gap:var(--s-3)}
  .split{height:2.75rem}
  .circle.glass{width:2.75rem;height:2.75rem}
  .f10-say{font-size:.875rem;line-height:1.25rem;bottom:calc(var(--dock-bottom) + var(--dock-h) + 6px)}
  .f10-input{height:2.5rem;font-size:16px}
  .f10-go{width:2.5rem;height:2.5rem}
  .f10-link{height:2.5rem}
  /* the card panel: a side sheet above the dock, scrolling inside */
  .inspector{top:var(--island-inset);bottom:calc(var(--dock-bottom) + var(--dock-h) + 8px);right:var(--island-inset);width:min(22.5rem,46vw);padding:var(--s-4) var(--s-5)}
  .insp-scroll{margin-top:var(--s-3)}
  :root{--inspector-reserve:calc(min(22.5rem,46vw) + 1.25rem)}
  .fit.glass{top:calc(var(--island-inset) + var(--island-h) + 8px);bottom:auto;right:var(--island-inset)}
  .menu{max-height:calc(100dvh - 2 * var(--island-inset) - var(--island-h) - 16px);overflow-y:auto}
  .menu-run{max-height:calc(100dvh - var(--dock-bottom) - var(--dock-h) - 24px)}
  .step-menu{max-height:calc(100dvh - var(--dock-bottom) - var(--dock-h) - 32px)}
  .hint{bottom:calc(var(--dock-bottom) + var(--dock-h) + 6px)}
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select{font-size:16px}
}

/* panels that other pieces open above the dock (and menus): never taller than the room there; they scroll inside */
@media (max-width:600px),(max-height:500px) and (orientation:landscape) and (max-width:1279px){
  body > .glass-strong:not(.inspector):not(.tip):not(.toast){max-height:calc(100dvh - var(--dock-bottom) - var(--dock-h) - 24px);overflow-y:auto;overscroll-behavior:contain}
}
@media (max-height:500px) and (orientation:landscape) and (max-width:1279px){
  body > .glass-strong:not(.inspector):not(.tip):not(.toast){max-height:calc(100dvh - var(--dock-bottom) - var(--dock-h) - 56px)}
}
