/* HI 1.1.20 — the Hub bar is 48px (body.kb-on). The editor shop is h-dvh,
   so on a 1366x768 screen the stage ends 48px past the bottom and the
   ground is cut off. Size the editor (.shop-editor) to the space under
   the bar at every width. The lobby (.shop without .shop-editor) still
   scrolls. Inside the Hub frame (kb-framed, padding 0) the shop stays
   100dvh. The result dialog's scroll lock sets padding-top: 0, which
   slides the editor up under the bar. Keep the bar's 48px while it is open. */
html:not(.kb-framed) body.kb-on .shop.shop-editor {
  height: calc(100svh - 48px);
  height: calc(100dvh - 48px);
  max-height: calc(100svh - 48px);
  max-height: calc(100dvh - 48px);
}
html:not(.kb-framed) body.kb-on[data-scroll-locked] {
  padding-top: 48px !important;
}

/* HI 1.1.17 — on a short screen the Studio tip spans the road.
   Dock a slim card in the sky at the side, away from the deck.
   Left in ltr, right in rtl. Never wider than 40%.
   HI 1.1.18 — the plan strip uses the same dock so it leaves the road. */
@media (max-height: 480px) {
  .hi-studio,
  .hi-plan {
    left: 0.75rem !important;
    right: auto !important;
    top: 0.75rem !important;
    bottom: auto !important;
    width: min(40%, 13rem) !important;
    max-width: 40% !important;
    transform: none !important;
    translate: none !important;
  }
  html[dir="rtl"] .hi-studio,
  html[dir="rtl"] .hi-plan {
    left: auto !important;
    right: 0.75rem !important;
  }
  .hi-plan {
    max-height: 2.5rem;
    overflow: hidden;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
  .hi-plan p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Tower cards sit under the height line. Keep Next on the same row so it stays tappable. */
  .shop-editor[data-campaign="tower"] .hi-studio {
    padding: 0.45rem 0.55rem !important;
  }
  .shop-editor[data-campaign="tower"] .hi-studio .mt-2 {
    flex-wrap: nowrap !important;
  }
  .shop-editor[data-campaign="tower"] .hi-studio .mt-2 button {
    min-height: 44px;
  }
  .shop-editor[data-campaign="tower"] .hi-studio .mt-2 button:first-child {
    min-width: 0;
    overflow: hidden;
  }
}

/* HI 1.1.19 — a turn must not keep the board's old pixel height.
   The stage fills its flex cell. An inline width/height from the draw
   loop cannot pin a squeezed size after the phone rotates. */
.shop.shop-editor canvas.hi-stage {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
}

/* HI 1.1.18 — full screen control and the tower turn card. */
.hi-fs {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px 0 0;
  border-radius: 12px;
  border: 1px solid rgba(232, 230, 223, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #f4f1ea;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font: 650 13px/1 Outfit, "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
  cursor: pointer;
}
.hi-fs[hidden] { display: none !important; }
.hi-fs-glyph {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.hi-turn {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(46vw, 16rem);
  min-height: 44px;
  padding: 4px 4px 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(232, 230, 223, 0.45);
  background: rgba(12, 18, 28, 0.88);
  color: #f4f1ea;
  font: 650 13px/1.25 Outfit, "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
  pointer-events: auto;
}
.hi-turn[hidden] { display: none !important; }
.hi-turn button, .hi-fs-hint button, .hi-fs-exit {
  min-width: 44px;
  min-height: 44px;
}
.hi-turn button, .hi-fs-hint button {
  border: 0;
  background: transparent;
  color: inherit;
  font: 700 22px/1 system-ui, sans-serif;
  cursor: pointer;
}
.hi-fs-hint {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  width: min(22rem, calc(100vw - 24px));
  padding: 12px 12px 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(232, 230, 223, 0.45);
  background: rgba(12, 18, 28, 0.94);
  color: #f4f1ea;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font: 650 14px/1.35 Outfit, "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
}
.hi-fs-hint[hidden] { display: none !important; }
.hi-fs-hint p { margin: 8px 0; }
.hi-fs-exit {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 4px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(232, 230, 223, 0.35);
  background: transparent;
  color: inherit;
  text-align: start;
  font: 650 14px/1 Outfit, "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
  cursor: pointer;
}

/* HI 1.1.20 — the It held card stays off the tower.
   Upright phone: bottom sheet above the tool dock.
   Sideways phone: a side panel, left in RTL.
   Desktop: top-right, over the side panel, not the drawing.
   The stage under the sheet or beside the panel is the flex cell;
   fs.js sets the pad so the camera refits into that space. */
html.hi-result .lp-overlay {
  background: transparent !important;
  pointer-events: none !important;
  animation: none !important;
}
html.hi-result .lp-dialog:not([class*="56rem"]) {
  animation: none !important;
  translate: none !important;
  transform: none !important;
  margin: 0 !important;
  pointer-events: auto !important;
  color: #24180f;
  max-width: none !important;
}
html.hi-result .lp-dialog:not([class*="56rem"]) .text-muted-foreground {
  color: #3a2a1c !important;
}
html.hi-result .lp-dialog:not([class*="56rem"]) > button.absolute {
  color: #24180f !important;
  background: #f4f1ea !important;
  border-radius: 10px;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  top: 8px !important;
  right: 8px !important;
  z-index: 2;
}
html.hi-result-sheet .lp-dialog:not([class*="56rem"]) {
  left: 8px !important;
  right: 8px !important;
  top: auto !important;
  bottom: calc(var(--hi-dock-h, 72px) + 8px) !important;
  width: auto !important;
  max-height: 45svh !important;
  max-height: 45dvh !important;
  overflow: auto !important;
}
html.hi-result-sheet .shop.shop-editor > .hi-dock.min-h-0 {
  box-sizing: border-box;
  padding-bottom: calc(var(--hi-sheet-h, 38dvh) + 8px);
}
html.hi-result-sheet .lp-dialog:not([class*="56rem"]) .mt-2.flex {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
html.hi-result-sheet .lp-dialog:not([class*="56rem"]) .mt-2.flex > * {
  min-height: 44px;
}
html.hi-result-sheet:not(.hi-more) .lp-dialog:not([class*="56rem"]) .mt-2.flex > :nth-child(n+3) {
  display: none !important;
}
html.hi-result-sheet .hi-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #24180f;
  background: #24180f;
  color: #f4f1ea;
  font: 700 15px/1 Outfit, "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
  cursor: pointer;
}
html.hi-result-side .lp-dialog:not([class*="56rem"]) {
  top: var(--hi-head, 104px) !important;
  bottom: calc(var(--hi-dock-h, 72px) + 4px) !important;
  right: 8px !important;
  left: auto !important;
  width: min(340px, 42vw) !important;
  max-height: none !important;
  overflow: auto !important;
}
html[dir="rtl"].hi-result-side .lp-dialog:not([class*="56rem"]) {
  left: 8px !important;
  right: auto !important;
}
html.hi-result-side .shop.shop-editor > .hi-dock.min-h-0 {
  box-sizing: border-box;
  padding-inline-end: calc(var(--hi-side-w, 340px) + 12px);
}
html.hi-result-side .lp-dialog:not([class*="56rem"]) .mt-2.flex {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  align-content: start;
}
html.hi-result-side .lp-dialog:not([class*="56rem"]) .mt-2.flex > * {
  min-height: 44px;
}
html.hi-result-desk .lp-dialog:not([class*="56rem"]) {
  top: 108px !important;
  right: 12px !important;
  left: auto !important;
  bottom: auto !important;
  width: min(270px, 17rem) !important;
  max-height: calc(100dvh - 128px) !important;
  overflow: auto !important;
}
