/* ScreenGen beta chrome — only loaded by app-beta / remote-beta / app-beta/home */

:root {
  /* Beta bar height (chip row + padding + border). One value for every surface, since
     js/sg-nav.js draws one bar; the body offset, the panel anchor and the phone
     overrides all derive from it so they cannot drift apart. */
  --sg-bar-h: 48px;
  /* Brand accent (matches vfx.css --accent). The plate --chroma-green is a
     separate, unchanged value: it is what the camera keys against, not brand. */
  --accent: #1f4bff;
  --accent-hi: #3a61ff;
  --accent-text: #7189ff;
  --accent-text-hi: #c9d4ff;
  --accent-dim: #1638b8;
  --accent-soft: rgba(31, 75, 255, 0.16);
  --ok: #17a35c;
}

/* Fixed-height controls shell (beta generator only).
   Regions built at runtime by sg-beta.js ensureControlsLayout():
   handle + header | top (quick actions) | body (menu + content) | foot. */
body.sg-beta-app .controls {
  height: min(72vh, 640px);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
body.sg-beta-app .controls > .sheet-handle,
body.sg-beta-app .controls > .controls-header,
body.sg-beta-app .controls > .sg-controls-top,
body.sg-beta-app .controls > .sg-controls-foot {
  flex-shrink: 0;
}
body.sg-beta-app .controls .sg-controls-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
body.sg-beta-app .sg-controls-menu {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 42%;
  display: flex;
  flex-direction: column;
}
body.sg-beta-app .sg-controls-menu .mode-picker-section {
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}
body.sg-beta-app .sg-controls-menu .mode-picker {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}
body.sg-beta-app .sg-controls-menu .mode-cats {
  flex: 0 0 auto;
}
body.sg-beta-app .sg-controls-menu .mode-grid {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.sg-beta-app .sg-controls-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
body.sg-beta-app .sg-controls-content > .accordion {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.sg-beta-app .sg-controls-content .accordion-item {
  flex: 0 0 auto;
}
body.sg-beta-app .sg-controls-content .accordion-item.open {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.sg-beta-app .sg-controls-content .accordion-item.open > .accordion-head {
  flex: 0 0 auto;
}
body.sg-beta-app .sg-controls-content .accordion-item.open > .accordion-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Footer lost the donate-note border-top once legal notes moved into the pinned foot. */
body.sg-beta-app .sg-controls-foot {
  padding-top: 10px;
  padding-bottom: calc(14px + var(--safe-bottom, 0px));
  border-top: 1px solid var(--panel-border);
}
body.sg-beta-app .sg-controls-foot .legal-note:first-of-type {
  margin-top: 10px;
}
body.sg-beta-app .sg-controls-top .qa-take-lock-note,
body.sg-beta-app .sg-controls-top .hint {
  font-size: 12px;
  text-align: left;
}
body.sg-beta-app .sg-controls-top .hint {
  margin: 0 0 10px;
  padding: 0 2px;
}
/* The quick-actions bar bleeds into the panel padding with negative margins; pin
   it in its own region so that no longer raises a horizontal scrollbar. */
body.sg-beta-app .sg-controls-top > .quick-actions {
  margin-left: 0;
  margin-right: 0;
}

.sg-beta-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: var(--sg-bar-h);
  box-sizing: border-box;
  padding: 6px 10px;
  padding-top: max(6px, env(safe-area-inset-top, 6px));
  padding-left: max(10px, env(safe-area-inset-left, 10px));
  padding-right: max(10px, env(safe-area-inset-right, 10px));
  background: rgba(12, 12, 15, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  overflow-x: auto;
  scrollbar-width: none;
}
.sg-beta-bar::-webkit-scrollbar {
  display: none;
}
.sg-beta-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  margin-right: 2px;
  color: #f6f5f2;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.015em;
}

/* The Wall mark, as a background rather than markup: js/sg-nav.js writes the
   bar into several shells, so keeping the mark in CSS means one place to change
   it. The wordmark stays live text so it inherits the brand face. */
.sg-beta-brand::before {
  content: "";
  flex: 0 0 auto;
  /* The master has the brand's mandated clear space (one tile height) baked into
     its artboard, so the tiles occupy about 65% x 51% of the box. The box is
     sized up to compensate rather than cropping the artboard, which keeps the
     clear-space rule intact. Box aspect matches the artboard's 98:70. */
  width: 42px;
  height: 30px;
  background: url("/img/brand/screengen-mark-dark.svg") center / contain no-repeat;
}
/* The destinations are a real <nav> for assistive tech but must read as one continuous
   chip row, so it inherits the bar's own gap instead of grouping visually. */
.sg-beta-nav {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
.sg-beta-bar-spacer {
  flex: 1 1 auto;
  min-width: 0;
}
.sg-beta-bar-end {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
.sg-beta-bar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
.sg-beta-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f6f5f2;
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 0;
}
.sg-chip {
  appearance: none;
  flex: 0 0 auto;
  display: inline-block;
  min-height: 32px;
  line-height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f6f5f2;
  border-radius: 0;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.sg-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
/* Where you are. Stays a live control — it is the way to reload or reopen a panel —
   but reads as filled so the row tells you the surface without being read aloud. */
.sg-chip-current {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.38);
  font-weight: 500;
}
.sg-panel-scrim {
  position: fixed;
  inset: 0;
  z-index: 10055;
  background: rgba(4, 6, 10, 0.6);
}
.sg-panel-scrim[hidden] {
  display: none;
}
.sg-panel {
  position: fixed;
  z-index: 10060;
  top: calc(var(--sg-bar-h) + 8px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 12px));
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--sg-bar-h) - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background: #101014;
  color: #f6f5f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
}
/* Modal variant: centered rather than anchored under the beta bar. */
.sg-panel.sg-modal {
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
}
.sg-panel:focus-visible,
.sg-panel:focus {
  outline: none;
}
.sg-panel .btn,
.sg-panel .text-input {
  border-radius: 0;
}
.sg-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sg-panel-head h2 {
  margin: 0;
  font-size: 18px;
}
.sg-form {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.sg-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.sg-form .sg-muted,
.sg-muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.68);
}
.sg-form h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #f6f5f2;
}
.sg-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.sg-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}
.sg-list-row em {
  color: rgba(255, 255, 255, 0.62);
  font-style: normal;
  font-size: 12px;
}
.sg-row-more {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 4px 8px;
  line-height: 1;
  font-size: 15px;
}
.sg-scenes-push {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
/* Push targets fill the row on wide panes and collapse to one column on a phone */
.sg-scenes-push .sg-list {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
/* The bar is fixed on every beta surface, so every beta body owes it the same offset */
body.sg-beta-app {
  padding-top: calc(var(--sg-bar-h) + env(safe-area-inset-top, 0px));
}
/* Immersive / native fullscreen: clear the nav so plates reach every edge */
html.fullscreen-active .sg-beta-bar,
body.immersive .sg-beta-bar {
  display: none !important;
}
html.fullscreen-active body.sg-beta-app,
body.sg-beta-app.immersive {
  padding-top: 0 !important;
}
/* The remote's own sticky status bar has to land below the nav, not behind it */
body.remote-page.sg-beta-app .remote-status-bar {
  top: calc(var(--sg-bar-h) + env(safe-area-inset-top, 0px));
}
/* vfx.css frames the preview as a device and centers it in the viewport, which put the
   mock's status bar under the fixed nav chips. Claim the height the bar needs — twice
   over, since centering splits the difference, plus the 12px frame ring — and let
   syncMockFit() shrink the scale to match. Reserving space rather than resizing the
   shell matters: the mock's interior is laid out against a fixed 390x844 box, so
   shortening the box would clip content instead of scaling it. */
html.mock-framed body.sg-beta-app,
html.mock-fit body.sg-beta-app {
  --mock-reserve-y: calc(2 * var(--sg-bar-h) + 32px);
}
/* Immersive hides the bar (see above), so stop paying for it and let the mock have
   the whole viewport. Must follow the rule above: same specificity, source order wins. */
html.fullscreen-active body.sg-beta-app,
body.sg-beta-app.immersive {
  --mock-reserve-y: 0px;
}
/* The shell already pays the safe-area at the top, and now the bar does too */
body.remote-page.sg-beta-app .remote-shell {
  padding-top: 16px;
}

/* Selfie Mode — Camera + Photos (Pro, beta home apps) */
.selfie-camera-app,
.selfie-photos-app {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
  overflow: hidden;
}
.selfie-stage {
  position: absolute;
  inset: 0;
  background: #101014;
}
.selfie-stage.mirrored .selfie-video {
  transform: scaleX(-1);
}
.selfie-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.selfie-unavailable {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  background: #111;
}
.selfie-stage.unavailable .selfie-unavailable {
  display: flex;
}
.selfie-stage.unavailable .selfie-video {
  opacity: 0;
}
.selfie-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.selfie-flash.on {
  opacity: 0.85;
}
.selfie-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top, 10px));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}
.selfie-title {
  font-size: 15px;
  font-weight: 600;
}
.selfie-text-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 6px 4px;
  cursor: pointer;
  min-width: 48px;
  text-align: center;
}
.selfie-text-btn.on {
  color: var(--accent-text);
}
.selfie-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 20px 8px;
}
.selfie-camera-app .and-gesture,
.selfie-camera-app .home-indicator,
.selfie-photos-app .and-gesture,
.selfie-photos-app .home-indicator {
  position: relative;
  z-index: 2;
}
.selfie-shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  padding: 0;
}
.selfie-shutter:active {
  transform: scale(0.94);
  background: #ddd;
}
.selfie-gallery-btn,
.selfie-controls-spacer {
  width: 44px;
  height: 44px;
}
.selfie-gallery-btn {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12) center/cover no-repeat;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}
.selfie-gallery-btn svg {
  width: 22px;
  height: 22px;
}
.selfie-gallery-btn.has-thumb svg {
  display: none;
}
.selfie-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  align-content: start;
  overflow: auto;
  background: #000;
  min-height: 0;
}
.selfie-grid-cell {
  appearance: none;
  border: 0;
  aspect-ratio: 1;
  background: #17171c center/cover no-repeat;
  cursor: pointer;
  padding: 0;
}
.selfie-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
}
.selfie-photos-app.viewer .selfie-viewer {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  background: #000;
}
.selfie-photos-app.viewer .selfie-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.selfie-viewer-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 12px 4px;
  position: relative;
  z-index: 2;
}
.selfie-viewer-actions .btn {
  font-size: 12px;
}

.sg-assets-heading {
  margin: 16px 0 6px;
  font-size: 14px;
}
.sg-btn-danger {
  border-color: #e5484d;
  color: #ff9a9a;
}
.sg-btn-danger:hover {
  background: rgba(232, 93, 93, 0.14);
}
.sg-pro-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f6f5f2;
  background: var(--accent);
  vertical-align: middle;
}
.sg-guide-card-locked {
  border-color: rgba(31, 75, 255, 0.28);
}

/* Locked (Pro-only) mode categories in the generator */
.mode-cat.sg-locked {
  opacity: 0.75;
}
.sg-cat-lock {
  display: inline-block;
  margin-left: 5px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f6f5f2;
  background: var(--accent);
  vertical-align: middle;
}

/* Pair Device host (Projects) + /pair join */
.sg-pair-page .remote-header p {
  max-width: 28em;
}
.sg-pair-joined {
  text-align: center;
  padding: 28px 12px;
}
.sg-pair-joined-msg {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}
body.sg-home-page .pair-overlay-url,
.sg-host-lead .pair-overlay-url {
  font-family: "Spline Sans Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--accent-text);
  margin: 8px 0 4px;
}
.sg-host-lead .pair-code-display,
#sg-host-code {
  font-family: "Spline Sans Mono", monospace;
  font-size: 28px;
  letter-spacing: 0.12em;
  text-align: center;
  margin: 12px 0;
}
.sg-device-card.focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sg-host-steps {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}
.sg-host-project-name {
  font-weight: 700;
  font-size: 16px;
}
.sg-device-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.sg-device-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f6f5f2;
  padding: 8px;
  text-align: left;
  border-radius: 0;
}
.sg-device-select {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sg-device-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.sg-device-card.focus {
  outline: 1px dashed rgba(31, 75, 255, 0.5);
}
.sg-device-card.away {
  opacity: 0.55;
}
.sg-device-preview {
  height: 140px;
  display: grid;
  place-items: center;
  font-size: 11px;
  text-transform: capitalize;
  border: 1px solid rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
}
.sg-preview-pending {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  margin-bottom: 4px;
}
.sg-device-meta {
  display: grid;
  gap: 2px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.sg-device-meta strong {
  font-size: 12px;
}
.sg-device-meta em {
  color: rgba(255, 255, 255, 0.68);
  font-style: normal;
}
.sg-device-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.sg-device-card-actions .btn {
  flex: 1 1 auto;
  font-size: 10px;
  padding: 3px 4px;
}
.sg-assign-select {
  width: 100%;
  margin-top: 6px;
  font-size: 11px;
}
.sg-paired-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10040;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  background: rgba(12, 12, 15, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  color: #f6f5f2;
}
.sg-match-flash {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  color: var(--accent-text);
  font-size: min(40vw, 180px);
  font-weight: 700;
  font-family: "Spline Sans Mono", monospace;
  pointer-events: none;
}
.sg-list-item-btn {
  appearance: none;
  flex: 1;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 4px 0;
}
.sg-list-item-btn:hover {
  color: var(--accent-text);
}
.sg-drag-list .sg-list-row {
  cursor: grab;
}
.sg-drag-list .sg-list-row.dragging {
  opacity: 0.5;
}
.sg-chip-upgrade {
  border-color: var(--accent);
  color: var(--accent-text);
}
/* Save scene while a brand new scene is being built — the one step left to take */
.sg-chip-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: #f6f5f2;
  font-weight: 500;
}
.sg-chip-cta:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}
.sg-context-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.68);
  font-family: "Spline Sans Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

/* Projects home */
body.sg-home-page {
  margin: 0;
  min-height: 100dvh;
  background: #0c0c0f;
  color: #f6f5f2;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
}

/* vfx.css locks html/body scrolling so the generator stage cannot move. The home and
   sign-in pages are ordinary documents, so they scroll in the body instead — without
   this everything below the first viewport is unreachable. */
body.sg-home-page,
body.sg-auth-page {
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.sg-home-plan-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(31, 75, 255, 0.28);
  background: rgba(31, 75, 255, 0.06);
}
.sg-home-plan-strip-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 200px;
}
.sg-home-plan-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-text);
}
.sg-quota-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.sg-home-guide {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .sg-home-guide {
    grid-template-columns: repeat(3, 1fr);
  }
}
.sg-guide-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0;
}
.sg-guide-card strong {
  font-size: 15px;
}
.sg-guide-card > span {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.75);
}
.sg-guide-card .btn,
.sg-guide-card a.btn {
  justify-self: start;
  text-decoration: none;
  margin-top: 4px;
}
.sg-guide-hint {
  margin: 4px 0 0;
  font-size: 12px;
}
.sg-account-plan {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(31, 75, 255, 0.22);
  background: rgba(31, 75, 255, 0.05);
}
.sg-home-root {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
}

/* Two panes: the project list and the open project.
   One at a time below 1024px (body.sg-detail-open picks which), side by side above. */
.sg-home-panes {
  display: grid;
  gap: 20px;
}
body.sg-home-page:not(.sg-detail-open) .sg-home-pane-detail,
body.sg-home-page.sg-detail-open .sg-home-pane-list,
/* On one pane the plan strip and guide would push the open project off screen */
body.sg-home-page.sg-detail-open #sg-home-masthead {
  display: none;
}
.sg-list-row.on {
  border-color: rgba(31, 75, 255, 0.55);
  background: rgba(31, 75, 255, 0.08);
}
.sg-detail-placeholder {
  align-content: center;
  min-height: 220px;
}
.sg-home-card,
.sg-home-section {
  display: grid;
  gap: 12px;
}
.sg-home-card h1,
.sg-home-section-head h1,
.sg-home-section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.sg-home-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.sg-home-section-head h1 {
  flex: 1 1 auto;
  min-width: 120px;
}
.sg-home-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sg-home-toolbar .text-input {
  flex: 1 1 160px;
}
.sg-home-empty {
  padding: 24px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
}
.sg-home-tip {
  margin-top: 20px;
  line-height: 1.5;
}
.sg-home-tip a {
  color: var(--accent-text);
}
.sg-home-detail-actions {
  flex-wrap: wrap;
}
.sg-home-devices {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sg-inline-form {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}
.sg-scene-label {
  flex: 1;
  min-width: 100px;
}
.sg-home-page .toast-host {
  z-index: 10100;
}
.sg-home-page .toast {
  background: #17171c;
  color: #f6f5f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 14px;
  margin: 8px;
  font-size: 13px;
}
.sg-home-page .toast.err {
  border-color: #e5484d;
}
body.sg-home-page .pair-code-display,
body.sg-home-page #sg-host-code {
  font-family: "Spline Sans Mono", monospace;
  font-size: 28px;
  letter-spacing: 0.12em;
  text-align: center;
  margin: 12px 0;
}

.sg-scenes-push h2 {
  font-size: 16px;
  margin: 12px 0 8px;
}

/* ——— Account page (/app-beta/account/) ——— */
.sg-account-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}
.sg-account-block {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.sg-account-block h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.sg-account-block hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sg-account-identity {
  margin: 0;
  line-height: 1.5;
}
.sg-plan-badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
}
.sg-plan-badge.is-pro {
  color: #f6f5f2;
  background: var(--accent);
  border-color: var(--accent);
}
.sg-account-card {
  margin: 0;
  font-family: "Spline Sans Mono", monospace;
  font-size: 13px;
}

/* Quota meters: the head carries the accessible value, the track is decoration. */
.sg-meter {
  display: grid;
  gap: 5px;
}
.sg-meter-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  font-size: 13px;
}
.sg-meter-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.sg-meter-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}
.sg-meter-fill.is-high {
  background: #e8a100;
}

.sg-plan-grid {
  display: grid;
  gap: 10px;
}
.sg-plan-card {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}
.sg-plan-card.is-current {
  border-color: rgba(31, 75, 255, 0.4);
  background: rgba(31, 75, 255, 0.06);
}
.sg-plan-card strong {
  font-size: 15px;
}
.sg-plan-current {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.sg-list-row-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 200px;
}
.sg-danger {
  border-color: rgba(232, 93, 93, 0.32);
}
.sg-danger h2 {
  color: #e88a8a;
}
.sg-danger-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sg-danger-item + .sg-danger-item {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sg-danger-item > .btn {
  flex: 0 0 auto;
}
.sg-danger-form {
  padding: 12px;
  border: 1px solid rgba(232, 93, 93, 0.32);
  background: rgba(232, 93, 93, 0.06);
}
.sg-home-page .btn.sg-btn-danger {
  border-color: rgba(232, 93, 93, 0.6);
  color: #e88a8a;
}
.sg-home-page .btn.sg-btn-danger:hover {
  background: rgba(232, 93, 93, 0.12);
}

/* Wider than the dashboard: two columns of short blocks read better than one long scroll. */
@media (min-width: 1024px) {
  body.sg-account-page .sg-home-root,
  body.sg-account-page .sg-beta-footer {
    max-width: 1040px;
  }
  .sg-account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sg-account-grid > .sg-account-block:first-child,
  .sg-account-grid > .sg-danger {
    grid-column: 1 / -1;
  }
  .sg-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Auth gate splash (app + home) */
html.sg-gate body > *:not(#sg-gate) {
  visibility: hidden !important;
}
html.sg-gate #sg-gate {
  visibility: visible !important;
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 200000;
  background: #0c0c0f;
  color: #f6f5f2;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
}
#sg-gate {
  display: none;
}
#sg-gate .sg-gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.015em;
}
#sg-gate .sg-gate-brand::before {
  content: "";
  flex: 0 0 auto;
  width: 56px;
  height: 40px;
  background: url("/img/brand/screengen-mark-dark.svg") center / contain no-repeat;
}

/* Dedicated sign-in page */
body.sg-auth-page {
  margin: 0;
  min-height: 100dvh;
  background: #0c0c0f;
  color: #f6f5f2;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  /* Override vfx.css body { user-select: none } so MFA secrets are copyable */
  user-select: text;
  -webkit-user-select: text;
}
.sg-auth-root {
  max-width: 400px;
  margin: 0 auto;
  padding: 28px 16px calc(40px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 16px;
}

/* The generator and remote carry the legal footer inside their shells; the home and
   sign-in documents are plain pages, so they get the same three lines as a page footer. */
.sg-beta-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}
/* Sign-in centers its card in the viewport, so the footer has to be pinned by layout
   rather than sitting a screen below the fold */
body.sg-auth-page {
  display: flex;
  flex-direction: column;
}
body.sg-auth-page .sg-auth-root {
  flex: 1 0 auto;
}
body.sg-auth-page .sg-beta-footer {
  flex: 0 0 auto;
}
.sg-auth-card {
  display: grid;
  gap: 12px;
  padding: 20px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0;
}
.sg-auth-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.sg-auth-card .sg-form {
  margin-top: 4px;
}
.sg-auth-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #ff8f8f;
}
.sg-auth-error[hidden] {
  display: none !important;
}
.sg-auth-alt {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  line-height: 1.45;
}
.sg-auth-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.sg-auth-link {
  display: inline;
  color: var(--accent-text);
}

/* Dedicated /signup/ — two steps: pick a plan, then create the account.
   Step one is three cards (Free, Pro Monthly, Pro Annual) so the billing cycle is
   settled before the account exists and a Pro signup can go straight to that
   level's checkout after 2FA. */
body.sg-signup-page .sg-auth-root {
  max-width: 1000px;
}
body.sg-signup-page .sg-auth-root > .sg-auth-card {
  max-width: 400px;
  width: 100%;
  justify-self: center;
}
body.sg-signup-page .sg-beta-footer {
  max-width: 1000px;
}
.sg-signup {
  display: grid;
  gap: 20px;
}
.sg-signup-step {
  margin: 0 0 8px;
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.sg-signup-intro h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
}
.sg-signup-intro .sg-muted {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  max-width: 62ch;
}
.sg-signup-plan-grid {
  display: grid;
  gap: 12px;
}
.sg-signup-plan-card {
  display: grid;
  gap: 10px;
  align-content: start;
  margin: 0;
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  border-radius: 0;
}
.sg-signup-plan-card:hover {
  border-color: rgba(255, 255, 255, 0.28);
}
.sg-signup-plan-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sg-signup-plan-card-pro {
  border-color: rgba(31, 75, 255, 0.35);
  background: rgba(31, 75, 255, 0.04);
}
.sg-signup-plan-card.is-selected {
  border-color: rgba(31, 75, 255, 0.7);
  background: rgba(31, 75, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(31, 75, 255, 0.35);
}
.sg-signup-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sg-signup-plan-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.sg-signup-plan-badge {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border: 1px solid rgba(31, 75, 255, 0.7);
  padding: 3px 7px;
  color: var(--accent-text);
  white-space: nowrap;
}
.sg-signup-plan-price {
  margin: 0;
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #f6f5f2;
}
.sg-signup-plan-features {
  margin: 0;
  padding: 12px 0 0 1.15em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
}
.sg-signup-plan-features li::marker {
  color: var(--accent-text);
}
.sg-signup-plan-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.sg-signup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.sg-signup-actions .btn {
  min-width: 180px;
}

/* Step two: the plan chosen in step one, echoed above the form. */
.sg-signup-chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 75, 255, 0.5);
  background: rgba(31, 75, 255, 0.08);
}
.sg-signup-chosen-label {
  margin: 0 0 2px;
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.sg-signup-chosen-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.sg-signup-chosen-price {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 400;
  color: var(--accent-text);
}
.sg-signup-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}
.sg-signup-form-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
/* Step two is a single narrow column; step one needs the full width. */
body.sg-signup-page .sg-signup-step2 {
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .sg-signup-plan-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
}
@media (min-width: 720px) and (max-width: 899px) {
  .sg-signup-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}
.sg-auth-card .sg-auth-join-row {
  margin-bottom: 0;
}
.sg-auth-card .sg-auth-join-row .btn {
  flex: 1 1 auto;
}

.sg-auth-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}
.sg-field-password {
  display: grid;
  gap: 4px;
}
.sg-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.sg-field-reveal {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}
body.sg-auth-page .toast-host {
  z-index: 10100;
}
body.sg-auth-page .toast {
  background: #17171c;
  color: #f6f5f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 14px;
  margin: 8px;
  font-size: 13px;
}
body.sg-auth-page .toast.err {
  border-color: #e5484d;
}

/* Error text and pairing-code inputs outside the remote page (home, generator, auth) */
.sg-beta-app .join-error,
.sg-home-page .join-error,
.sg-auth-page .join-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid #e5484d;
  border-radius: 0;
  background: transparent;
  color: #ff9a9a;
  font-family: "Spline Sans Mono", monospace;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}
.sg-beta-app .join-error a,
.sg-home-page .join-error a {
  color: var(--accent-text);
}
.sg-beta-app .join-error[hidden],
.sg-home-page .join-error[hidden],
.sg-auth-page .join-error[hidden] {
  display: none !important;
}
.sg-panel .code-input,
.sg-home-page .code-input {
  width: 100%;
  text-align: center;
  font-family: "Spline Sans Mono", monospace;
  font-size: 26px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

/* Controls keep their label.
   The shared `.btn { flex: 1; min-width: 0 }` lets any button in a flex row shrink
   below its uppercase text, which clipped labels in the beta bars, list rows, and
   section heads. `max-content` (not `fit-content`, which still collapses to the space
   available) pins the floor at the label; the rows all wrap, so crowded buttons move
   to a new line instead of squashing. */
.sg-beta-app .btn,
.sg-home-page .btn,
.sg-auth-page .btn {
  min-width: max-content;
  white-space: nowrap;
}
/* Labels sit dead center, whatever element wears the class.
   `.btn` leans on a native <button> to center its own text, so every `<a class="btn">`
   and `<label class="btn">` dropped its label to the top of the 44px box. `.sg-chip` had
   the mirror problem: inline-block, 30px of content in a 32px minimum. Safe to set
   `display` here because vfx.css carries `[hidden] { display: none !important }`. */
.sg-beta-app .btn,
.sg-home-page .btn,
.sg-auth-page .btn,
.sg-beta-app .sg-chip,
.sg-home-page .sg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  text-decoration: none;
}
/* Force the accent primary fill on auth / home / beta (do not rely on load-order alone). */
body.sg-auth-page .btn.primary,
body.sg-home-page .btn.primary,
body.sg-beta-app .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  /* Paper, not black: black on Cobalt 100 is 3.49:1, which fails AA for a label. */
  color: #f6f5f2;
}
body.sg-auth-page .btn.primary:hover,
body.sg-home-page .btn.primary:hover,
body.sg-beta-app .btn.primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}
body.sg-auth-page .btn.primary:active,
body.sg-home-page .btn.primary:active,
body.sg-beta-app .btn.primary:active {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}
/* Same floor for the rows that set their own min-width and out-specify the rule above */
body.sg-beta-app .btn-row.tight .btn,
body.sg-beta-app .remote-trigger-bar .btn,
body.sg-beta-app .remote-controls .row-editor-actions .btn,
body.sg-home-page .btn-row.tight .btn,
body.sg-auth-page .btn-row.tight .btn {
  min-width: max-content;
}
.sg-beta-app .btn-row,
.sg-home-page .btn-row,
.sg-auth-page .btn-row {
  flex-wrap: wrap;
}
/* Rows that hold several full-label buttons must be able to wrap */
body.sg-beta-app .quick-actions,
body.sg-beta-app .header-actions {
  flex-wrap: wrap;
}
/* Row actions sit at their natural size instead of stretching across a wide row */
.sg-list-row > .btn,
.sg-home-plan-strip > .btn,
.sg-home-section-head > .btn,
.sg-panel-head > .btn {
  flex: 0 0 auto;
}

/* Interactive states — the beta shells set [disabled] but nothing rendered differently */
.sg-beta-app .btn:disabled,
.sg-beta-app .sg-chip:disabled,
.sg-home-page .btn:disabled,
.sg-auth-page .btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.sg-beta-app .btn:disabled:hover,
.sg-home-page .btn:disabled:hover {
  background: inherit;
  border-color: inherit;
}
.sg-chip:focus-visible,
.sg-auth-link:focus-visible,
.sg-field-reveal:focus-visible,
.sg-list-item-btn:focus-visible,
.sg-row-more:focus-visible,
.sg-mode-card:focus-visible,
.sg-device-select:focus-visible,
.mode-cat.sg-locked:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sg-auth-link:hover,
.sg-field-reveal:hover {
  /* Brighter than the resting --accent-text, not darker: --accent-hi is a fill
     color and would make the link harder to read on hover, not easier. */
  color: var(--accent-text-hi);
}
.sg-guide-card .btn:hover,
.sg-guide-card a.btn:hover {
  border-color: rgba(31, 75, 255, 0.6);
}

/* Tablets and up: a sign-in card pinned to the top of a tall monitor looks broken.
   The body is a flex column, so the root already fills the space above the footer. */
@media (min-width: 720px) {
  .sg-auth-root {
    align-content: center;
    padding-top: 24px;
  }
  /* Past phone width, action rows read better left-aligned than stretched edge to edge */
  .sg-home-page .btn-row > .btn {
    flex: 0 0 auto;
  }
}

/* Desktop: the Projects dashboard becomes list + open project side by side */
@media (min-width: 1024px) {
  .sg-home-root {
    max-width: 1100px;
    padding: 24px max(24px, env(safe-area-inset-left, 24px))
      calc(40px + env(safe-area-inset-bottom, 0px));
  }
  .sg-home-panes {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
  }
  body.sg-home-page:not(.sg-detail-open) .sg-home-pane-detail,
  body.sg-home-page.sg-detail-open .sg-home-pane-list,
  body.sg-home-page.sg-detail-open #sg-home-masthead {
    display: block;
  }
  /* The sticky offset is measured from the body's content edge, which the bar's
     padding-top has already pushed past the bar — so this is a 16px gap, not 16px
     from the viewport top. The max-height still subtracts the bar. */
  .sg-home-pane-list {
    position: sticky;
    top: 16px;
    max-height: calc(100dvh - var(--sg-bar-h) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* Both panes are on screen, so there is nothing to go back to */
  #sg-back-list {
    display: none;
  }
}

@media (min-width: 1600px) {
  .sg-home-root {
    max-width: 1280px;
  }
  .sg-home-panes {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }
  /* At this width the detail pane itself has room for the two-column host block */
  .sg-home-page .sg-host-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
}

/* Phones on set: keep everything reachable at 360–400px */
@media (max-width: 480px) {
  .sg-panel {
    top: calc(var(--sg-bar-h) + 4px + env(safe-area-inset-top, 0px));
    left: max(8px, env(safe-area-inset-left, 8px));
    right: max(8px, env(safe-area-inset-right, 8px));
    width: auto;
  }
  .sg-panel.sg-modal {
    top: 50%;
    left: 50%;
    right: auto;
    width: calc(100vw - 24px);
  }
  .sg-home-detail-actions .btn,
  .sg-home-section-head .btn {
    flex: 1 1 auto;
  }
  .sg-home-root {
    padding-left: max(12px, env(safe-area-inset-left, 12px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
  }
  /* The wordmark drops to the badge and the row scrolls, rather than chips ellipsizing
     their labels mid-word. Every destination stays reachable by swiping the bar.
     Sign-in has no chips to make room for, so it keeps the whole wordmark. */
  .sg-beta-bar:not(.sg-beta-bar-brand) .sg-beta-brand-word {
    display: none;
  }
  .sg-beta-bar {
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .sg-beta-nav,
  .sg-beta-bar-actions,
  .sg-beta-bar-end {
    gap: 6px;
  }
  /* Once the row scrolls there is no free space to push against */
  .sg-beta-bar-spacer {
    flex: 0 0 0;
  }
  /* iOS Safari zooms the page when a focused input is under 16px */
  .sg-beta-app .text-input,
  .sg-beta-app .select,
  .sg-home-page .text-input,
  .sg-home-page .select,
  .sg-auth-page .text-input,
  .sg-auth-page .select,
  .sg-panel .text-input,
  .sg-panel .select {
    font-size: 16px;
  }
}

/* ===== Generator on a desktop =====
   The panel keeps floating over the stage — the stage is the output, so it stays full
   bleed — but it widens and splits into two panes: mode menu beside the open group.
   Quick actions and the legal footer stay pinned above/below the two-pane body. */
@media (min-width: 1200px) {
  body.sg-beta-app {
    --sg-panel-w: min(720px, 46vw);
  }
  body.sg-beta-app .controls {
    width: var(--sg-panel-w);
    /* Fixed tall sheet so mode/accordion changes do not resize the panel */
    height: calc(100dvh - var(--sg-bar-h) - 32px);
    max-height: calc(100dvh - var(--sg-bar-h) - 32px);
  }
  body.sg-beta-app .controls .sg-controls-body {
    display: grid;
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
    align-items: stretch;
    gap: 12px 14px;
    min-height: 0;
  }
  body.sg-beta-app .sg-controls-menu {
    grid-column: 1;
    max-height: none;
    min-height: 0;
  }
  body.sg-beta-app .sg-controls-menu .mode-picker-section {
    padding-bottom: 0;
    border-bottom: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.sg-beta-app .sg-controls-menu .mode-picker {
    flex: 1 1 auto;
    min-height: 0;
  }
  body.sg-beta-app .sg-controls-content {
    grid-column: 2;
    min-height: 0;
  }
  body.sg-beta-app .sg-controls-content > .accordion {
    gap: 10px;
  }
  body.sg-beta-app .sg-controls-content .accordion-item {
    margin-bottom: 0;
  }
  /* The framed preview is centered in the viewport, so a wide panel would sit on top of
     it. Shift it into the space the panel leaves, but only while the panel is showing.
     Must carry the scale too: transform is one property, so translating alone would
     drop the --mock-fit scale vfx.css applies to the design box. */
  body.sg-beta-app:has(#controls:not(.hidden-panel)) .phone-shell {
    transform: translateX(calc(var(--sg-panel-w) / -2)) scale(var(--mock-fit, 1));
  }
}

@media (min-width: 1700px) {
  body.sg-beta-app {
    --sg-panel-w: min(880px, 44vw);
  }
}

/* vfx.css lays the mode tiles out three across from 900px up, which needs about 340px.
   One mode per row reads better in a column anyway. */
body.sg-beta-app .sg-controls-menu .mode-grid {
  grid-template-columns: minmax(0, 1fr);
}

/* MFA enroll / recovery on sign-in */
.sg-mfa-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  padding: 0.75rem;
  background: #fff;
  border-radius: 8px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.sg-mfa-secret {
  display: grid;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}
.sg-mfa-secret-code,
.sg-mfa-recovery-list code {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.9em;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}
.sg-mfa-secret-code {
  display: block;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.04em;
}
.sg-mfa-choice-row {
  margin-top: 0.5rem;
}
.sg-mfa-recovery-list {
  margin: 0.75rem 0 1.25rem;
  padding-left: 1.25rem;
  user-select: text;
  -webkit-user-select: text;
}
.sg-session-row .btn {
  flex-shrink: 0;
}

/* ===== Stage PNG export (beta generator) ===== */
.export-size-sheet {
  position: fixed;
  inset: 0;
  z-index: 120000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}
.export-size-sheet[hidden] {
  display: none !important;
}
.export-size-sheet-inner {
  width: min(360px, 100%);
  padding: 20px 18px 16px;
  border-radius: 14px;
  background: #101014;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: #f6f5f2;
}
.export-size-sheet-inner h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.export-size-lead {
  margin: 0 0 14px;
  opacity: 0.75;
  font-size: 0.92rem;
}
.export-size-actions {
  margin-bottom: 8px;
}
.export-size-actions .btn {
  flex: 1 1 auto;
}

/* Offscreen host for phone/social rasterization at 360×640 → 1080×1920 */
#sg-export-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 360px;
  height: 640px;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
  background: #010101;
}
#sg-export-placeholder {
  display: none !important;
}
html.sg-exporting #sg-export-host .phone-layer,
html.sg-exporting #sg-export-host .social-layer {
  position: absolute !important;
  inset: 0 !important;
  width: 360px !important;
  height: 640px !important;
  max-width: none !important;
  max-height: none !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: #010101 !important;
  overflow: hidden !important;
}
html.sg-exporting #sg-export-host .phone-shell,
html.sg-exporting #sg-export-host .phone-shell.social-shell,
html.sg-exporting #sg-export-host .social-shell {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  /* The export host sizes the shell itself, so the on-screen preview scale must not
     come along and shrink the rasterised image. */
  transform: none !important;
  --status-band: var(--safe-top) !important;
}
/* Match full-bleed phone padding (not desktop faux-frame insets) */
html.sg-exporting #sg-export-host .ios-home {
  padding-top: calc(12px + var(--safe-top)) !important;
}
html.sg-exporting #sg-export-host .and-home,
html.sg-exporting #sg-export-host .android-home {
  padding-top: calc(10px + var(--safe-top)) !important;
}
/* Hide multiply grade during capture — applied on canvas after rasterize */
html.sg-exporting #sg-export-host .phone-layer .phone-shell::after,
html.sg-exporting #sg-export-host .social-layer .phone-shell.social-shell::after {
  display: none !important;
}
