/* Shared website control rail for STACK, BLOCKS and the drawing tool. */
html.sudu-tool-page {
  --sudu-tool-footer: calc(52px + env(safe-area-inset-bottom, 0px));
}
html.sudu-tool-page #suduBar {
  --ground: #f3f1ea;
  --ink: #171613;
  color: var(--ink) !important;
  background: var(--ground);
  border-top: var(--sudu-line-rule, 0.5px) solid var(--rule-strong, rgba(23, 22, 19, 0.25));
}
html.sudu-tool-page.dm #suduBar {
  --ground: var(--dm-bg, #121110);
  --ink: #f5f3ec;
  border-top-color: rgba(245, 243, 236, 0.45);
}
html.sudu-tool-page #suduBar #musicPill {
  position: absolute !important;
  top: auto;
  right: auto;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
}
html.sudu-tool-page #suduBar #langSwitch {
  gap: 15px;
}
html.sudu-tool-page #suduBar #langSwitch button:not([hidden]) ~ button:not([hidden])::before {
  left: -8px;
}
html.sudu-tool-page #suduBar button {
  cursor: pointer;
}
html.sudu-tool-page .stack-study,
html.sudu-tool-page .massing-study {
  bottom: var(--sudu-tool-footer);
}
html.sudu-tool-page .stack-note,
html.sudu-tool-page .massing-note {
  bottom: calc(var(--sudu-tool-footer) + 16px);
}
html.sudu-tool-page .stack-instruction,
html.sudu-tool-page .massing-instruction {
  bottom: calc(var(--sudu-tool-footer) + 24px);
}
@media (max-width: 760px) {
  html.sudu-tool-page .stack-players {
    bottom: calc(var(--sudu-tool-footer) + 70px);
  }
  html.sudu-tool-page .sketch-tools-pill {
    bottom: calc(var(--sudu-tool-footer) + 8px);
  }
  html.sudu-tool-page .draw-stage {
    height: max(200px, calc(100svh - var(--sketch-menu-top) - var(--sudu-tool-footer) - 52px));
  }
}
@media (max-width: 640px) {
  html.sudu-tool-page .massing-note {
    bottom: calc(var(--sudu-tool-footer) + 66px);
  }
  html.sudu-tool-page .challenge-ledger {
    bottom: var(--sudu-tool-footer);
  }
}
@media (max-width: 559px) {
  html.sudu-tool-page #suduBar #musicPill {
    position: static !important;
    transform: none;
  }
  html.sudu-tool-page #suduBar #langSwitch,
  html.sudu-tool-page #suduBar #dmSwatches,
  html.sudu-tool-page #suduBar #musicPill {
    gap: 13px;
  }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  html.sudu-tool-page .stack-players {
    bottom: auto;
  }
}

/* Work inherits Sketch's compact website rail at desktop and mobile sizes. */
html.sudu-tool-page.sudu-collapsible-chrome {
  --sudu-tool-footer: calc(24px + env(safe-area-inset-bottom, 0px));
}
.work-site-rail {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 9999;
  bottom: 0;
  left: 0;
  right: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--paper, #f3f1ea);
  color: var(--ink, #171613);
  border-top: var(--sudu-line-rule, 0.5px) solid var(--rule-strong, rgba(23, 22, 19, 0.25));
}
html.sudu-collapsible-chrome #suduBar {
  display: none !important;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar {
  display: flex !important;
  position: relative !important;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 52px;
  padding: 8px var(--sudu-inset, 24px);
  flex-wrap: wrap;
  gap: 18px;
  border: 0;
  border-radius: 0;
  transform: none;
}
.work-site-rail .work-settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  margin: 0;
  align-self: center;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: none;
  flex: none;
  cursor: pointer;
}
.work-settings-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}
.work-settings-toggle[aria-expanded='true'] svg {
  transform: rotate(180deg);
}
.work-settings-toggle:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: -3px;
}
body:has([data-slot='dialog-content'][data-state='open'], .task-panel[data-state='open'])
  .work-site-rail {
  z-index: 40;
}
@media (max-width: 760px) {
  html.sudu-collapsible-chrome #suduBar #musicPill {
    position: static !important;
    transform: none;
  }
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar {
    gap: 12px;
  }
}

/* Work rail revision, 11 September 2026: the collapsed control keeps the 64 × 24 px
   contract but shows a sliders glyph beside the chevron. Expanded, the rail is one
   44 px row where it fits (languages left, audio centre, grounds right), every
   control has a 44 px target and the current language and ground are marked. */
.work-site-rail .work-settings-toggle {
  gap: 6px;
}
.work-settings-toggle .work-settings-glyph {
  width: 14px;
  height: 14px;
}
.work-settings-toggle .work-settings-chevron {
  width: 12px;
  height: 12px;
}
.work-settings-toggle[aria-expanded='true'] .work-settings-glyph {
  transform: none;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar {
  min-height: 44px;
  padding: 0 var(--sudu-inset, 16px);
  gap: 0 8px;
  align-items: center;
  justify-content: space-between;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #langSwitch,
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #dmSwatches,
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #musicPill {
  position: static !important;
  transform: none;
  gap: 0;
  min-height: 44px;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #langSwitch {
  order: 1;
  margin: 0 !important;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #musicPill {
  order: 2;
  margin: 0 !important;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #dmSwatches {
  order: 3;
  margin: 0 !important;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar button {
  min-width: 30px;
  min-height: 44px;
  padding: 0 3px;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.04em;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar button::before {
  display: none;
}
html.sudu-collapsible-chrome
  .work-site-rail.is-open
  #suduBar
  #langSwitch
  button[aria-current='true'] {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #dmSwatches button {
  position: relative;
  width: 30px !important;
  height: 44px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #dmSwatches button::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(23, 22, 19, 0.35);
}
html.sudu-collapsible-chrome
  .work-site-rail.is-open
  #suduBar
  #dmSwatches
  button[aria-pressed='true']::after {
  box-shadow:
    0 0 0 2px var(--paper, #f3f1ea),
    0 0 0 3.5px currentColor;
}
html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #musicPill button {
  min-width: 34px;
}
@media (min-width: 700px) {
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar button {
    min-width: 44px;
    padding: 0 8px;
  }
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #dmSwatches button {
    width: 44px !important;
  }
}
@media (max-width: 699px) {
  /* rail.css gives every footer the site inset; on phones the rail keeps 12px. */
  html.sudu-collapsible-chrome .work-site-rail {
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar {
    padding: 0;
  }
}
@media (max-width: 359px) {
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar {
    justify-content: center;
  }
  html.sudu-collapsible-chrome .work-site-rail.is-open #suduBar #musicPill {
    order: 4;
    flex-basis: 100%;
    justify-content: center;
  }
}
@media (forced-colors: active) {
  html.sudu-collapsible-chrome
    .work-site-rail.is-open
    #suduBar
    #dmSwatches
    button[aria-pressed='true']::after {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}
