/* mobile grok bot 2026-10-05 — Circuit phone stack fix (stacking / position only; colors belong to Social).
   Load: after circuit-hand-setup-tap.css (Social), before account-align-fix.css on /account;
         @import at the top of frame.css right after the Circuit @imports (this is what styles the Circuit iframe).
   1) "Circuit ·" readout wrapped to 2–3 lines (12→62) and ran into the status line (top 56) + Hand setup.
      → one line, fixed 36px band (12→48, 8px gap above status). Full text stays in the status line below.
      The "Pinch to grab" hint sat on the status line too → parked just above the bottom Hands bar.
   2) More sheet (z40) covered Stop hands (z50 but trapped in header's z5 stacking context) and clipped its last rows.
      → sheet ends above the Hands bar + safe area, scrolls inside, never taller than the space under the status line. */
@media (max-width:720px){
  dialog.bl-circuit.bl-circuit--phone-hud .bl-circuit-hud-readout{
    top:calc(12px + env(safe-area-inset-top))!important;
    left:12px!important;
    right:auto!important;
    max-width:calc(100% - 24px)!important;
    box-sizing:border-box!important;
    height:36px!important;
    max-height:36px!important;
    padding:0 12px!important;
    display:block!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    line-height:36px!important;
  }
  /* Hand setup still in the header (before Social's HUD JS moves it): leave room on the right */
  dialog.bl-circuit.bl-circuit--phone-hud:has(> header .bl-hand-setup) .bl-circuit-hud-readout{
    max-width:calc(100% - 24px - 132px)!important;
  }
  dialog.bl-circuit.bl-circuit--phone-hud > header .bl-hand-setup:not([open]){
    position:fixed!important;
    top:calc(8px + env(safe-area-inset-top))!important;
    right:12px!important;
    z-index:26!important;
  }
  dialog.bl-circuit.bl-circuit--phone-hud .bl-circuit-status{
    top:calc(56px + env(safe-area-inset-top))!important;
  }
  /* hint: off the status line, centred just above the Hands bar */
  dialog.bl-circuit.bl-circuit--phone-hud .bl-circuit-hud-hint{
    top:auto!important;
    bottom:calc(96px + env(safe-area-inset-bottom))!important;
    left:50%!important;
    right:auto!important;
    transform:translateX(-50%)!important;
    max-width:calc(100% - 24px)!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    pointer-events:none!important;
  }
  dialog.bl-circuit.bl-circuit--phone-hud:has(.bl-circuit-more[open]) .bl-circuit-hud-hint{display:none!important}

  /* More sheet sits above the bottom HUD (Hands 64px + 18px + gap) and scrolls inside */
  dialog.bl-circuit.bl-circuit--phone-hud .bl-circuit-more[open]{
    top:auto!important;
    bottom:calc(92px + env(safe-area-inset-bottom))!important;
    max-height:min(480px, calc(100dvh - 92px - 136px - env(safe-area-inset-bottom) - env(safe-area-inset-top)))!important;
    padding-bottom:12px!important;
    box-sizing:border-box!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    scroll-padding-bottom:12px;
  }
  dialog.bl-circuit.bl-circuit--phone-hud .bl-circuit-more[open] > summary{
    position:sticky;top:0;z-index:1;background-color:rgb(18,16,24); /* = sheet bg (.bl-circuit-more computed), so rows don't show through */
  }
  /* Belt and braces: Hands bar above the sheet even if a sheet rule wins */
  dialog.bl-circuit.bl-circuit--phone-hud:has(.bl-circuit-more[open]) > header{z-index:45!important}
  dialog.bl-circuit.bl-circuit--phone-hud .bl-more-grid > *{min-height:48px}
}

/* Tablet/laptop (721–1366px; Utah studio-embed-circuit misaligned-edges at 768, 1080, 1280): the header toolbar wrapped
   as free flex rows, so 2nd-row buttons sat 3.9–8.4px off the 1st-row edges. Snap it to a column grid. */
@media (min-width:721px) and (max-width:1366px){
  dialog.bl-circuit > header{
    display:grid!important;
    grid-template-columns:repeat(auto-fill,minmax(128px,1fr))!important;
    gap:8px!important;
    align-items:stretch!important;
  }
  dialog.bl-circuit > header > h2{grid-column:1/-1!important;margin:0!important}
  dialog.bl-circuit > header > button,
  dialog.bl-circuit > header > select,
  dialog.bl-circuit > header > .bl-hand-setup{margin:0!important;min-width:0!important;width:auto!important;justify-self:stretch!important}
  dialog.bl-circuit > header > .bl-hand-setup > summary{width:100%!important;box-sizing:border-box!important}
  dialog.bl-circuit > header > .bl-hand-setup[open]{grid-column:1/-1!important}
  /* Projects panel (inside "Build, convert and saved projects"): mixed-width buttons wrapped off-grid
     (Save to cloud 210.8 vs Company context 216.9). Full-width rows span; buttons/details snap to columns. */
  dialog.bl-circuit .bl-circuit-projects{
    display:grid!important;
    grid-template-columns:repeat(auto-fill,minmax(170px,1fr))!important;
    gap:12px!important;
  }
  dialog.bl-circuit .bl-circuit-projects > span,
  dialog.bl-circuit .bl-circuit-projects > select{grid-column:1/-1!important}
  dialog.bl-circuit .bl-circuit-projects > button,
  dialog.bl-circuit .bl-circuit-projects > details{margin:0!important;justify-self:stretch!important;min-width:0!important}
}

/* v=20261005b — Utah recheck-2032 embed edge: gallery h1 "Good things start somewhere." (left 22) vs Circuit h2 (dialog
   inset + 1px border + padding) Δ 59/27.8/24.59/20.59/1.31 at 1920/1440/1280/1080/768. Snap the (covered) gallery column
   to the dialog's content edge using the same vw geometry as /css/circuit.css (.bl-circuit width 96vw|98vw ≤850, max 1800,
   padding 20|12, border 1). Phone HUD (≤720) hides the h2 → no pair; untouched. Layout only. */
@media (min-width:851px){
  body:has(dialog.bl-circuit[open]:not(.bl-circuit--phone-hud)) main.gallery-main{
    padding-left:calc((100vw - min(96vw, 1800px)) / 2 + 21px)!important;
  }
}
@media (min-width:721px) and (max-width:850px){
  body:has(dialog.bl-circuit[open]:not(.bl-circuit--phone-hud)) main.gallery-main{
    padding-left:calc((100vw - 98vw) / 2 + 13px)!important;
  }
}
