/* The new studio (BACKLOG B17, mock 1 approved 2026-09-25): the app frame
   with its sidebar, the feed of runs, and the composer docked at the
   bottom, behind the STUDIO switch. Round 4's tokens; Higgsfield and fal
   for function only. Every rule sits under a studio class, so nothing
   here reaches the marketing pages or the old workspace, and the old
   rules it overrides lose on specificity, not on file order (Propshaft
   links stylesheets alphabetically). */

:root {
  /* 296, not 256 (2026-10-02): with scroll bars set to show always (the
     owner's Mac) the sidebar's bar takes 15px, and the padlock marks
     (option C) about 12px more. Measured: the longest row, Furnish Empty
     Room with its Pro mark, needs 233px; a tool row is the sidebar less
     44px, less 15px under such a bar. */
  --studio-side: 296px;
  --studio-max: 96rem;
}

.studio-body {
  background: var(--paper);
}

.studio {
  display: grid;
  grid-template-columns: var(--studio-side) minmax(0, 1fr);
  min-height: 100dvh;
}

.studio-scrim { display: none; }

.studio-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ---------- the sidebar ---------- */
.studio-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 14px;
  background: var(--paper-card);
  border-right: 1px solid var(--line);
}

/* The sidebar scrolls when it is taller than the screen; its items keep
   their size instead of being squeezed to fit (on a phone the New design
   button was pressed to about 26px, the owner's "weak" read). */
.studio-side > * { flex-shrink: 0; }

.studio-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px;
}

.studio-side-close { display: none; }

/* New design (owner QC 2026-09-25: read weak; the button research):
   taller than the nav rows under it, heavier type, a lit top edge. Navy,
   not orange: the composer's render button is the screen's one orange
   action, and two would compete. */
.studio-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: var(--radius-pill);
  background: var(--deep);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  box-shadow: 0 16px 32px -14px rgba(20, 32, 42, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.studio-new:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.studio-nav,
.studio-tools {
  display: grid;
  gap: 2px;
}

.studio-nav a,
.studio-tools a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.studio-nav a {
  height: 38px;
  padding: 0 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.studio-nav a:hover,
.studio-tools a:hover { background: var(--paper); color: var(--ink); }
.studio-nav a.is-on { background: var(--tint); color: var(--ink); }

.studio-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-mute);
}

.studio-side-label {
  margin: 0 0 -10px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.studio-tools a {
  height: 32px;
  padding: 0 10px;
  gap: 8px;
  font-size: 14px;
}

.studio-tools a .tool-icon {
  width: 17px;
  height: 17px;
  margin: 0;
  color: var(--ink-soft);
}

.studio-tools a.is-on { background: var(--accent-soft); }
.studio-tools a.is-on .tool-icon { color: var(--accent); }
.studio-tools-gap { height: 8px; }

.studio-pro {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-soft);
  background: #fff6f1;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* A locked tool (option C, owner 2026-10-02): the padlock in the plan
   mark, and the tool's own icon a shade lighter. The name stays at full
   strength: the tool is for sale, not broken. */
.studio-pro-lock { width: 10px; height: 10px; stroke-width: 2.4; }
.studio-tools a.is-locked .tool-icon,
.studio-opt.is-locked .studio-opt-icon { color: var(--ink-mute); }

.composer-note.is-locked { display: flex; align-items: center; gap: 8px; }
.composer-note.is-locked b { color: var(--ink); font-weight: 600; }
.composer-lock { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }

.studio-side-foot {
  margin-top: auto;
  display: grid;
  /* The column may shrink below its content, so a long email ends in an
     ellipsis instead of widening the foot past the sidebar (a sideways
     scroll bar on the owner's Mac, 2026-10-02). */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.studio-usage {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.studio-usage b { display: block; font-size: 14px; font-weight: 600; }
.studio-usage span span { display: block; font-size: 12.5px; color: var(--ink-mute); }

.studio-ring { width: 34px; height: 34px; flex: 0 0 auto; }
.studio-ring circle { fill: none; stroke-width: 4; }
.studio-ring-track { stroke: var(--tint); }
.studio-ring-arc { stroke: var(--accent); stroke-linecap: round; }

.studio-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.studio-me:hover { background: var(--paper); }

.studio-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.studio-me-text { min-width: 0; flex: 1; }
.studio-me-text b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-me-text span { display: block; font-size: 12.5px; color: var(--ink-mute); }
.studio-me .studio-icon { width: 15px; height: 15px; color: var(--ink-mute); }

/* ---------- the page ---------- */
.studio-main { min-width: 0; }
.studio-top { display: none; }

/* Full width up to a generous cap, centered past it (the responsive
   research, 2026-09-25: fal keeps its working canvas modest even at
   2545px); a 1920 screen fills, a 2560 or ultra-wide one centers. */
.studio-page {
  max-width: var(--studio-max);
  margin-inline: auto;
  padding: 22px 40px 280px;
}

.studio-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 16px;
}

.studio-head h1 {
  font-size: 22px;
  letter-spacing: -0.015em;
}

.studio-sub { color: var(--ink-mute); font-size: 14px; }

.studio-flash {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  font-size: 14px;
}

.studio-flash.is-alert { border-color: var(--accent); color: var(--accent-deep); }

.studio-link {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.studio-more { text-align: center; margin-top: 8px; }
.studio-more a { color: var(--ink-soft); font-size: 14px; }

/* ---------- the feed: one row per run (fal's row) ---------- */
.studio-feed {
  display: grid;
  gap: 16px;
}

.studio-run {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  border-radius: 20px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.studio-run-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.studio-run-before {
  position: relative;
  margin: 0;
}

.studio-run-before img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--tint);
}

.studio-run-before figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 23, 0.62);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
}

.studio-run-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14.5px;
}

.studio-run-tool .tool-icon,
.studio-run-tool .studio-icon {
  width: 18px;
  height: 18px;
  margin: 0;
  color: var(--accent);
}

.studio-run-line { display: none; }

.studio-run-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 0;
  font-size: 13px;
}

.studio-run-facts dt { color: var(--ink-mute); }
.studio-run-facts dd { margin: 0; min-width: 0; }

.studio-run-note {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.studio-run-when { font-size: 12.5px; color: var(--ink-mute); }

/* Use settings: a quiet link at the foot of the facts, not a button
   competing with the design's own (owner QC, 2026-09-25). */
.studio-run-reuse {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  margin-top: auto;
  padding: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.studio-run-reuse:hover { color: var(--accent); }
.studio-run-reuse:hover span { text-decoration: underline; text-underline-offset: 3px; }
.studio-run-reuse .studio-icon { width: 15px; height: 15px; }

/* The design's own toolbar over the picture on a pointer device (mock
   frame D1), fading in on hover or focus and staying while a menu is
   open. Only opacity moves: a transform on hover re-layered the buttons
   in Safari and nudged their icons (2026-09-24). Touch keeps the toolbar
   under the design. */
@media (hover: hover) {
  :is(.studio-run, .studio-lib-grid) .generation-card { position: relative; }

  :is(.studio-run, .studio-lib-grid) .generation-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 3;
    opacity: 0;
    will-change: opacity;
    transition: opacity 160ms ease-out;
  }

  :is(.studio-run, .studio-lib-grid) .generation-card:hover .generation-toolbar,
  :is(.studio-run, .studio-lib-grid) .generation-card:focus-within .generation-toolbar,
  :is(.studio-run, .studio-lib-grid) .generation-toolbar:has(details[open]) { opacity: 1; }

  :is(.studio-run, .studio-lib-grid) .generation-toolbar .btn-ghost {
    background: rgba(255, 255, 255, 0.94);
    border-color: transparent;
    box-shadow: 0 4px 12px -4px rgba(15, 20, 23, 0.4);
  }
}

.studio-run-designs {
  display: grid;
  gap: 12px;
  align-content: start;
  align-items: start;
}

.studio-run-designs.is-1 { grid-template-columns: minmax(0, 46rem); }
.studio-run-designs.is-2,
.studio-run-designs.is-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.studio-run-designs.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* The cards inside a run: the row already says the photo and the time,
   so the card keeps the design, its name and its actions. */
.studio-run .generation-card {
  box-shadow: none;
  border-radius: 14px;
}

/* A tall design (a portrait phone photo) stays inside the screen,
   letterboxed, never cropped, now that the page runs the full width. */
.studio-run .generation-photo {
  max-height: max(20rem, calc(100svh - 16rem));
  object-fit: contain;
  background: var(--paper-card);
}

.studio-run .generation-when,
.studio-run .generation-before,
.studio-run .generation-before-thumb,
.studio-run .generation-before-peek {
  display: none;
}

/* ---------- the unlock (slice 3, mock frames D4 and P4) ---------- */
.studio-unlock {
  padding: 28px 0 8px;
  scroll-margin-top: 70px;
}

.studio-unlock-head {
  max-width: 44rem;
  margin: 0 auto 22px;
  text-align: center;
}

.studio-unlock-head h2 {
  font-size: clamp(1.625rem, 1.2rem + 1.2vw, 2.25rem);
  letter-spacing: -0.02em;
}

.studio-unlock-head p {
  margin-top: 8px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.studio-unlock .rl-ladder-head { justify-content: center; }
.studio-unlock-pass { max-width: 40rem; margin: 0 auto 26px; }
.studio-unlock-pass .starter-offer.is-lead { margin-top: 0; }

/* A real deadline, ticking (the offer banner). */
.studio-banner {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 9px 16px;
  background: var(--deep);
  color: #fff;
  font-size: 14px;
  text-align: center;
}

.studio-clock {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.studio-banner-go {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.studio-banner-go:hover { background: #fff; color: var(--ink); }

/* ---------- My designs (mock frame D5) ---------- */
.studio-lib-head { flex-wrap: wrap; }

.studio-lib-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.studio-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--tint);
}

.studio-seg a {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}

.studio-seg a.is-on {
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 20, 23, 0.08);
}

.studio-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-mute);
}

.studio-zoom input { width: 110px; accent-color: var(--ink); }
.studio-lib-usage { margin: -8px 0 12px; }

.studio-day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.studio-day-head span { font-weight: 400; font-size: 13px; color: var(--ink-mute); }

.studio-lib-grid.generations {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--lib-min, 17rem), 100%), 1fr));
  gap: 14px;
  align-items: start;
  max-width: none;
  margin: 0;
}

.studio-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 20px;
  border: 1.5px dashed var(--line);
  border-radius: 20px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- a tool before a photo (mock frame D6) ---------- */
.studio-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 22px;
  border-radius: 22px;
  background: var(--paper-card);
  border: 1px solid var(--line);
}

.studio-intro-pair {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: var(--tint);
}

.studio-intro-pair img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-intro-pair .is-after { clip-path: inset(0 0 0 50%); }

.studio-intro-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 16px 3px rgba(255, 255, 255, 0.6);
}

.studio-intro-label {
  position: absolute;
  bottom: 12px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 23, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.studio-intro-label.is-left { left: 12px; }
.studio-intro-label.is-right { right: 12px; }

.studio-intro-copy h2 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.studio-intro-copy > p {
  margin-top: 10px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.studio-intro-next { font-size: 15px; }

.studio-drop {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 22px;
  border: 1.5px dashed #b3bcc6;
  border-radius: 18px;
  text-align: center;
}

.studio-drop > span { font-size: 13px; color: var(--ink-mute); }
.studio-drop .studio-icon { width: 24px; height: 24px; color: var(--ink-soft); }
.studio-drop-form { margin-top: 4px; }

/* ---------- the composer (Higgsfield's bar, docked) ---------- */
.composer-dock {
  position: fixed;
  left: var(--studio-side);
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 70px 40px calc(24px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--paper) 50%, rgba(238, 240, 243, 0));
  pointer-events: none;
}

.composer {
  pointer-events: auto;
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px;
  border-radius: 24px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-deep);
}

/* New design's spotlight (studio_controller, owner 2026-10-02): the page
   dims under the dock and the composer beats twice, an accent ring
   leaving it, so the eye lands where a design starts. The dock's own
   fade is dropped while it lasts, or a pale band would sit over the
   scrim. */
.studio-spot-scrim {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(15, 20, 23, 0.46);
  animation: spot-in 240ms var(--ease-out) both;
}

.studio-spot-scrim.is-off { animation: spot-out 240ms var(--ease-out) both; }

@keyframes spot-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spot-out { from { opacity: 1; } to { opacity: 0; } }

.composer-dock.is-spotlit { background: none; }

.composer-dock.is-spotlit .composer {
  animation: composer-beat 1100ms var(--ease-out) 2;
}

@keyframes composer-beat {
  0% { transform: scale(1); box-shadow: var(--shadow-deep), 0 0 0 0 rgba(194, 65, 12, 0.6); }
  14% { transform: scale(1.012); }
  28% { transform: scale(1); }
  42% { transform: scale(1.007); }
  60% { transform: scale(1); }
  100% { transform: scale(1); box-shadow: var(--shadow-deep), 0 0 0 22px rgba(194, 65, 12, 0); }
}

.composer-bar,
.composer-sheet-head,
.composer-scrim { display: none; }

.composer-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "photos note go" "photos chips go";
  align-items: center;
  gap: 10px 14px;
}

.composer-form { display: contents; }

.composer-photos {
  grid-area: photos;
  align-self: stretch;
  display: flex;
  gap: 8px;
}

.composer-photo { display: flex; }

.composer-photo-btn {
  position: relative;
  width: 96px;
  min-height: 84px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.composer-photo-btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-photo.is-empty .composer-photo-btn {
  border: 1.5px dashed var(--accent);
  background: #fff6f1;
  color: var(--accent);
}

.composer-photo-swap {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 23, 0.66);
  color: #fff;
  font-size: 11px;
  opacity: 0;
  transition: opacity 160ms;
}

.composer-photo-btn:hover .composer-photo-swap,
.composer-photo-btn:focus-visible .composer-photo-swap { opacity: 1; }

.composer-error {
  position: absolute;
  margin: 0;
  transform: translateY(-120%);
  font-size: 12.5px;
  color: var(--accent-deep);
}

.composer-note {
  grid-area: note;
  width: 100%;
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
}

.composer-note::placeholder { color: var(--ink-mute); }
.composer-note.is-static { color: var(--ink-soft); font-size: 14.5px; }

.composer-chips {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.studio .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  font: 500 14px/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms;
}

.studio .chip:hover { border-color: var(--ink-soft); }
.studio .chip:disabled { opacity: 0.5; cursor: not-allowed; }

.studio .chip .tool-icon,
.studio .chip .studio-icon,
.studio .chip > svg {
  width: 17px;
  height: 17px;
  margin: 0;
  color: var(--ink-soft);
}

.studio .chip .chip-chev { width: 14px; height: 14px; color: var(--ink-mute); }
.chip-wrap { display: inline-flex; }

/* The room chip is a native select, so the phone's own wheel opens. */
.studio .chip-select { position: relative; padding-right: 10px; cursor: default; }

.chip-select select {
  field-sizing: content;
  appearance: none;
  border: 0;
  padding: 0 18px 0 0;
  margin-right: -18px;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  outline: 0;
}

.chip-select:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-select .chip-chev { pointer-events: none; }

.chip-detail {
  width: 120px;
  margin-left: 4px;
  padding: 0 0 0 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font: inherit;
  outline: 0;
}

/* The styles chip: the picks' own tiles, then the first name and a count. */
.chip-thumbs { display: inline-flex; }
.chip-thumbs:empty { display: none; }
.chip-thumbs .board-chip { display: inline-flex; margin: 0 0 0 -7px; padding: 0; border: 0; background: none; box-shadow: none; }
.chip-thumbs .board-chip:first-child { margin-left: -4px; }
.chip-thumbs .board-chip span { display: none; }

.chip-thumbs .board-chip img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid var(--paper-card);
}

.composer-go {
  grid-area: go;
  align-self: stretch;
  min-width: 184px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 18px 36px -14px rgba(194, 65, 12, 0.7);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), background 200ms;
}

.composer-go b { font-size: 17px; font-weight: 600; }
.composer-go[hidden] { display: none; }
.composer-go.is-unlock { text-decoration: none; text-align: center; }
.composer-go.is-unlock:hover { color: #fff; background: var(--accent-hover); transform: translateY(-1px); }
.composer-go-arrow { display: none; }
.composer-go span { font-size: 12.5px; opacity: 0.92; }
.composer-go span:empty { display: none; }
.composer-go:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }

/* Clicked: the words say what is happening until the page moves on. */
.composer-go.is-busy {
  pointer-events: none;
  cursor: progress;
  animation: composer-busy 1.1s ease-in-out infinite alternate;
}

@keyframes composer-busy {
  to { box-shadow: 0 18px 44px -10px rgba(194, 65, 12, 0.95); filter: brightness(1.08); }
}

.composer-go:disabled {
  background: var(--tint);
  color: var(--ink-mute);
  box-shadow: none;
  cursor: not-allowed;
}

/* ---------- the chips' lists (one popover pattern) ---------- */
.studio-pop {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 320px;
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 20, 23, 0.06), 0 22px 50px -18px rgba(20, 32, 42, 0.45);
}

.studio-pop.is-wide { width: 420px; }

.studio-pop-search {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px -6px 6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink-mute);
}

.studio-pop-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
}

.studio-pop-group,
.studio-pop-title {
  margin: 0;
  padding: 8px 10px 4px;
  font-size: 12px;
  color: var(--ink-mute);
}

.studio-pop-list { display: grid; gap: 1px; }

.studio-opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.studio-opt:not(:has(.studio-opt-icon)) { grid-template-columns: minmax(0, 1fr) auto; }
.studio-opt[hidden],
.studio-pop-group[hidden] { display: none; }
.studio-opt:hover,
.studio-opt.is-on,
.studio-opt:has(input:checked) { background: var(--paper); }
.studio-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

.studio-opt-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
}

.studio-opt-icon .tool-icon { width: 18px; height: 18px; margin: 0; }
.studio-opt.is-on .studio-opt-icon { background: var(--accent-soft); color: var(--accent); }
.studio-opt-text b { display: block; font-size: 14px; font-weight: 600; }
.studio-opt-text span { display: block; font-size: 12.5px; color: var(--ink-mute); }
.studio-opt-tick { width: 18px; height: 18px; color: var(--accent); visibility: hidden; }

.studio-opt.is-on .studio-opt-tick,
.studio-opt:has(input:checked) .studio-opt-tick { visibility: visible; }

/* The room list: the rooms as a grid, Other opening a line to type. */
.studio-rooms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 2px 4px 6px;
}

.studio-room span {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

.studio-room:hover span { background: var(--paper); }
.studio-room:has(input:checked) span { background: var(--accent-soft); font-weight: 600; }
.studio-room:has(input:focus-visible) span { outline: 2px solid var(--accent); outline-offset: -2px; }

.studio-room-detail {
  width: calc(100% - 12px);
  margin: 2px 6px 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  outline: 0;
}

.studio-room-detail:focus { border-color: var(--ink-soft); }

/* ---------- the style picker: a panel over the feed ---------- */
/* A popover the composer's width, rising from it (style_board places it
   when it opens); the composer stays in view below, so each pick prices
   the button at once. */
.studio-styles {
  position: fixed;
  inset: auto;
  width: 900px;
  max-height: 70vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 20, 23, 0.06), 0 30px 70px -24px rgba(20, 32, 42, 0.5);
}

.studio-styles:popover-open { display: flex; flex-direction: column; }

.studio-styles-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.studio-styles-head h2 { font-size: 22px; letter-spacing: -0.015em; }
.studio-styles-head p { color: var(--ink-mute); font-size: 14px; }

.studio-styles-head .studio-pop-search {
  position: static;
  width: 280px;
  margin: 0 0 0 auto;
  padding: 0 14px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.composer-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-card);
  color: var(--ink);
  cursor: pointer;
}

.studio-styles-grid {
  /* Its own height first, then shrink to what the panel allows: a zero
     basis (flex: 1) resolves against the panel's content height, which
     Safari reads as nothing left for the grid (owner report, 2026-09-25). */
  flex: 1 1 auto;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  /* The panel caps its height; the grid is what scrolls. */
  min-height: 0;
  /* A tile clips its picture, so its minimum height reads as zero and a
     scrolling grid would squash every row to fit the screen. */
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  padding: 14px 18px 18px;
}

.studio-style {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: var(--tint);
  cursor: pointer;
}

.studio-style[hidden] { display: none; }

.studio-style img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 400ms var(--ease-out);
}

.studio-style:hover img { transform: scale(1.03); }

.studio-style::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(to top, rgba(15, 20, 23, 0.72), transparent);
  pointer-events: none;
}

.studio-style-name {
  position: absolute;
  left: 12px;
  right: 40px;
  bottom: 10px;
  z-index: 1;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.studio-style-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.studio-style-tick {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 26px;
  height: 26px;
  padding: 4px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 160ms, transform 200ms var(--ease-out);
}

.studio-style:has(input:checked) { box-shadow: 0 0 0 3px var(--accent); }
.studio-style:has(input:checked) .studio-style-tick { opacity: 1; transform: none; }
.studio-style:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.studio-style:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }

.studio-styles-foot { display: none; }

/* ---------- a phone (mock frames P1 to P3) ---------- */
@media (max-width: 899px) {
  .studio { grid-template-columns: minmax(0, 1fr); }

  .studio-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 280ms var(--ease-out);
    box-shadow: 0 0 60px -10px rgba(15, 20, 23, 0.4);
  }

  .studio.is-menu .studio-side { transform: none; }

  .studio-side-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
  }

  .studio.is-menu .studio-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(15, 20, 23, 0.38);
  }


  .studio-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .studio-menu-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper-card);
    color: var(--ink);
    cursor: pointer;
  }

  .studio-top-link {
    margin-left: auto;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-soft);
  }

  .studio-page { padding: 14px 12px 150px; }
  .studio-banner { top: 61px; font-size: 13px; padding: 8px 12px; }
  .studio-unlock .rl-ladder-stage { width: 100%; }
  .studio-lib-tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .studio-zoom { display: none; }
  .studio-lib-grid.generations { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .studio-head { margin-bottom: 12px; }

  .studio-run {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
  }

  .studio-run-meta {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 1px;
    align-items: center;
  }

  .studio-run-before { grid-row: span 3; }
  .studio-run-before img { border-radius: 8px; }
  .studio-run-before figcaption,
  .studio-run-facts,
  .studio-run-note { display: none; }
  .studio-run-line { display: block; font-size: 12.5px; color: var(--ink-mute); }
  .studio-run-line:empty { display: none; }
  .studio-run-tool { font-size: 14px; }
  .studio-run-when { font-size: 12px; }
  /* A small pill at the head's right on a phone. */
  .studio-run-meta { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .studio-run-reuse {
    grid-column: 3;
    grid-row: 1 / span 3;
    align-self: center;
    margin: 0;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 12.5px;
  }
  .studio-run.is-video .studio-run-meta { grid-template-columns: minmax(0, 1fr); }

  /* One design a row on a phone: two across left a card 160px wide,
     narrower than its own four-button toolbar. */
  .studio-run-designs.is-1,
  .studio-run-designs.is-2,
  .studio-run-designs.is-3,
  .studio-run-designs.is-4 { grid-template-columns: minmax(0, 1fr); gap: 10px; }

  .studio-intro { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px; }
  .studio-intro-copy h2 { font-size: 24px; }

  /* The composer: one bar at rest, a sheet once tapped. */
  .composer-dock { left: 0; padding: 36px 10px calc(12px + env(safe-area-inset-bottom, 0px)); }

  .composer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 22px;
  }

  .composer-bar {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .composer-bar-photo {
    width: 52px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 10px;
    overflow: hidden;
    background: #fff6f1;
    border: 1.5px dashed var(--accent);
    color: var(--accent);
  }

  .composer-bar-photo:has(img) { border: 0; }
  .composer-bar-photo img { width: 100%; height: 100%; object-fit: cover; }
  .composer-bar-text { min-width: 0; }

  .composer-bar-text b {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
  }

  .composer-bar-text b .tool-icon,
  .composer-bar-text b .studio-icon { width: 16px; height: 16px; margin: 0; color: var(--accent); }

  .composer-bar-text span {
    display: block;
    font-size: 12.5px;
    color: var(--ink-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .composer-panel { display: block; flex: 0 0 auto; }

  .composer-dock:not(.is-open) .composer-photos,
  .composer-dock:not(.is-open) .composer-note,
  .composer-dock:not(.is-open) .composer-chips { display: none; }

  .composer-go {
    min-width: 0;
    height: 50px;
    padding: 0 16px;
    border-radius: 16px;
  }

  .composer-go b { font-size: 15px; }
  .composer-go span { font-size: 11.5px; }
  /* At rest the button is a round arrow; its words stay for screen
     readers, clipped rather than hidden. */
  .composer-dock:not(.is-open) .composer-go {
    width: 50px;
    min-width: 50px;
    padding: 0;
    border-radius: 50%;
  }

  .composer-dock:not(.is-open) .composer-go b,
  .composer-dock:not(.is-open) .composer-go span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .composer-dock:not(.is-open) .composer-go-arrow { display: block; width: 22px; height: 22px; }
  .composer-bar-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .composer-dock.is-open .composer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(15, 20, 23, 0.38);
    pointer-events: auto;
  }

  .composer-dock.is-open { padding: 0; background: none; }

  .composer-dock.is-open .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 12px 16px 16px;
    border-radius: 24px 24px 0 0;
  }

  .composer-dock.is-open .composer-bar { display: none; }

  .composer-dock.is-open .composer-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "photos" "chips" "note" "go";
    gap: 12px;
  }

  .composer-dock.is-open .composer-sheet-head {
    grid-area: head;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .composer-sheet-head h2 { font-size: 20px; }
  .composer-dock.is-open .composer-photo-btn { width: 112px; min-height: 84px; }

  .composer-dock.is-open .composer-note {
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .composer-dock.is-open .composer-chips { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
  .composer-dock.is-open .chip-wrap { display: flex; }

  .composer-dock.is-open .composer-chips .chip {
    width: 100%;
    height: 50px;
    border-radius: 14px;
  }

  .composer-dock.is-open .chip .chip-chev { margin-left: auto; }
  .composer-dock.is-open .chip-select select { flex: 1; margin-right: 0; }
  .composer-dock.is-open .composer-go { height: 56px; width: 100%; }

  .studio-pop,
  .studio-pop.is-wide { width: min(360px, calc(100vw - 16px)); }

  /* On a phone the panel takes the screen (style_board's placement is
     for a wide composer), and Done is pinned. */
  .studio-styles:popover-open {
    inset: 0 !important;
    width: auto !important;
    /* The browser sizes a popover to its content; the screen, here. */
    height: auto !important;
    max-height: none !important;
    border: 0;
    border-radius: 0;
  }

  .studio-styles-head { flex-wrap: wrap; padding: 14px 14px 10px; gap: 8px 12px; }
  .studio-styles-head p { flex: 1; }
  .studio-styles-head .studio-pop-search { order: 3; width: 100%; }
  .studio-styles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 14px 100px; }

  .studio-styles-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: block;
    padding: 14px 14px 18px;
    background: linear-gradient(to top, var(--paper-card) 60%, rgba(255, 255, 255, 0));
  }

  .studio-styles-foot .btn { width: 100%; justify-content: center; }
  .studio-rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .composer-go.is-busy { animation: none; }
  .composer-dock.is-spotlit .composer { animation: none; box-shadow: var(--shadow-deep), 0 0 0 3px var(--accent); }
  .studio-spot-scrim, .studio-spot-scrim.is-off { animation: none; }
  .studio-side,
  .studio-style img,
  .studio-style-tick,
  .composer-go { transition: none; }
}

/* Browsers without the popover API (the research, 2026-09-25: about 7
   percent, iOS before 17 among them): the lists and the style panel open
   by class instead (popover_controller, style_board). There the popover
   attribute means nothing, so the closed state is ours to hide. */
@supports not selector(:popover-open) {
  .studio-pop:not(.is-open),
  .studio-styles:not(.is-open) { display: none; }

  .studio-pop.is-open,
  .studio-styles.is-open { z-index: 80; }

  .studio-styles.is-open { display: flex; flex-direction: column; }

  @media (max-width: 899px) {
    .studio-styles.is-open {
      inset: 0 !important;
      width: auto !important;
      height: auto !important;
      max-height: none !important;
      border: 0;
      border-radius: 0;
    }
  }
}
