/* ============================================================================
   zz_studio_entry.css — Post studio entry: the two CSS-only skeletons and the
   failure surface of the served-closed data drawer (Band S stage S-3b,
   docs/new_content/studio_entry_plan.md §2.5 + §7 decision S6(a); the
   skeleton colours are the DS §8.3 candidate now decided for the studio:
   `#15161C` block + `#22242B` shimmer). Section 4 (stage S-3c) is the
   "Pick your data" entry surface served on the bare route.

   Sections 1-3 add no id and write no prop. Three concerns (+ 1b, S-5c):

   1. PRE-MOUNT skeleton — assets/00_theme_bootstrap.js stamps
      `sp-route-new-content--intent` on <html>/<body> at parse time when the
      URL carries `question_id=` or `explore=` (a `source=` URL serves the
      drawer OPEN, a silhouette would only get in the way). From first paint
      until React commits the studio tree (`#new-content-shell`) the page
      container paints the studio silhouette: the topbar sub-row, the canvas
      toolbar, the 9:16 canvas card and the inspector cards (desktop), or the
      stacked column (tablet / phone). The login page on this route
      (`.login-required-page`, utils/ui_components.py) is excluded — the
      gate renders instead of the studio.

   1b. BODY-ROOT silhouette (Band S stage S-5c, `# S-5c`; plan §3 S-5c, decisions
      D-5c-1 / D-5c-2 / D-5c-4) — under the two-phase mount (S-5a,
      `SP_STUDIO_TWO_PHASE`) `#builder-shell-body` is served EMPTY and the editor
      body lands post-paint (`_mount_editor_body`, ~5–8 s), so between the shell
      commit (the end of skeleton 1, ~1.5 s) and the mount the canvas column was
      a blank ground. This paints the SAME bar + 9:16 canvas the in-tree
      skeleton (2) draws, at the same place, on the empty root's `::before` /
      `::after`, so the mount swaps one for the other without a visible jump
      (probe-proven: 0 gap, 0 overlap). Keyed on ALL of: the served-closed
      marker (S-3a — a `?source=` root is empty too but carries no marker and
      its drawer covers the column, D-5c-4), `#builder-shell-body:empty` (React
      renders no whitespace; with the flag OFF the root always has children ->
      the rules never match) and no alert in `#manual-feedback` (a failure
      reveals the drawer instead, section 3). It sets `position: relative` on
      the empty root only — no display / min-height / padding / background —
      the root keeps zz_new_content.css:1195 (`display: flex !important`,
      `min-height: calc(100vh - 180px)`), which gives the pseudo-elements their
      box. Geometry = the measured in-tree skeleton at the mount (probe
      `tmp/s5c/geometry.js`, 1440 / 700 / 390): the inspector column is
      `opacity: 0` / width 0 and the canvas toolbar `display: none` until the
      visual stage, so — unlike the pre-mount silhouette — neither is drawn
      here (drawing them would make them vanish at the mount).

   2. IN-TREE skeleton — layout.py serves a static, id-less
      `.sp-studio-skeleton` block as the FIRST child of #builder-preview-shell
      in every variant; it paints only while ALL of these hold:
        * the shell carries `sp-studio-served--intent` (S-3a: the drawer was
          served closed for a ?question_id= / ?explore= URL),
        * the studio is still in the data stage — the inspector column is the
          served `opacity: 0` (`_sync_workspace_panel_visibility` writes
          `opacity: 1` once the dataset landed; the same key the mobile
          column tests pin). The plan's `:not(:has(.js-plotly-plot))` key
          cannot work: `retail-graph` is served WITH a placeholder figure, so
          the plot div exists from the mount on,
        * no failure alert has landed in `#manual-feedback`.
      A 45 s safety fade hides it if the load never completes (the drawer is
      still reachable through "← Edit data").

   3. FAILURE SURFACE — the explore channel's rejection alert lands in
      `#manual-feedback`, which lives INSIDE the drawer body (handoff §4). With
      the drawer served closed (S-3a pre-validates the URL, so this is the
      residual case: materialization or auth failing at load time) the alert
      would be invisible; this reveals the panel onboarding-style (no modal
      backdrop, pointer-events only on the panel), exactly the styles.css
      :10939–10963 onboarding state. Guards: the served-closed marker, the
      drawer's own closed class (an open drawer needs nothing) and the data
      stage (inspector `opacity: 0`) — a successful Manual-rows apply also
      writes a green alert into `#manual-feedback` while `df-cache` closes the
      drawer, and must NOT re-reveal it: by then the inspector is `opacity: 1`.
      3b (S-5c, decision D-5c-3 (b), `# S-5c`): under the two-phase mount the
      alert lands in the initial wave (~1.9 s, `_prime_deeplink` has PIC False
      and served Outputs) while `#workspace-right-panel` — the data-stage key —
      does not exist until the mount (measured: revealed 7.4 s after the alert,
      at the mount). A second key, `:has(#builder-shell-body:empty)`, reveals
      the panel pre-mount with the SAME three declaration blocks (pinned equal
      by the test); at the mount `:empty` stops matching and the section-3
      key takes over from the served `opacity: 0` — no flicker. The data-stage
      guard holds trivially pre-mount (no body, no dataset), and the branch can
      never misfire later: a mounted body is not `:empty`.

   Cascade: this file sorts after zz_new_content.css / zz_studio_chrome.css
   ("zz_studio_en" > "zz_studio_ch") and before zz_studio_export_cta.css; the
   reveal overrides styles.css :5103–5153 (0,1,0 / 0,2,0) on specificity, no
   !important anywhere. Reduced motion disables the shimmer.

   GEOMETRY (UX 4.5, 2026-09-15 — all three silhouettes redrawn to the FINAL
   editor, measured tmp/ux_4_5/final_probe.py at 1900×960 / 1440×950 / 1024×800 /
   390×844). Until 4.5 each drew a chip bar + a 436 px canvas centred in the FULL
   root width — the intermediate data-stage layout, where the fixed inspector is
   width 0 — so at the visual stage the canvas jumped ~270 px left (the inspector
   is 540 px, `right_visible_style` in callbacks/workspace_shell.py) and, on an
   explore-born post, the bar vanished (its chip strip is Chart's,
   zz_studio_chart_choice.css). Now every silhouette is the visual stage itself:
     * ≥1181: the stage centred in `100% − 540px` (`left calc(50% − 270px)`: a
       background-position percentage is of container − image, so 50% centres
       the image in the root and −270 shifts it into the column), at the top the
       explore-born editor puts it (shell top + 8 px canvas-column padding; a
       DB-born post's chip row lands above it at the swap — content appearing
       above, not a phantom block vanishing), its height the SAME budget
       assets/studio_preview_scale.js caps the real stage with
       (viewport − stage top 55 − reserve 106 = `100vh − 161px`, ≤ the 775 px
       build height), width 9:16 of that; the 465×58 transport 14 px under it;
       the inspector column's first four cards (449×146, 449×78, 445×318, 445×260 at
       37 px in from the column's edges, as the DATA / CHART / TEXT / OUTPUT cards sit).
     * 641–1180 (stacked): the stage 436×775 centred, the transport under it.
     * ≤640 (phone): the stage at the column's 4 px top, height `100vh − 274px`
       (stage top 144 + reserve 130, zz_studio_preview_scale.css) capped by the
       column's 9:16, the transport 4 px under it.
   All phases share SVG masks for the canvas and transport. Their SVG viewport
   follows the painted box, so the radii stay 16px / 12px at every size. The
   pre-mount header layer has zero height: real header controls appear at mount
   without replacing a full-width shimmering slab.
   ========================================================================== */

/* ---- shared shimmer ------------------------------------------------------ */
@keyframes sp-studio-skeleton-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

@keyframes sp-studio-skeleton-timeout {
  to { opacity: 0; visibility: hidden; }
}

/* ---- 1. pre-mount silhouette --------------------------------------------- */
html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container {
  /* desktop geometry (the studio's fixed panels at ≥1181), container top = viewport top beside
     the desktop navigation rail: the 47 px topbar sub-row, the stage (top 47 + 8) and
     its transport in the column left of the 540 px inspector, the inspector's
     first four cards (column top 47, cards 37 px in) */
  --sp-studio-skel-canvas-h: min(calc(100vh - 161px), 775px);
  --sp-studio-skel-layers:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-masks:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    url("studio-skeleton-canvas-mask.svg"),
    url("studio-skeleton-transport-mask.svg"),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-sizes:
    100% 0px,
    calc(var(--sp-studio-skel-canvas-h) * 9 / 16) var(--sp-studio-skel-canvas-h),
    465px 58px,
    449px 146px,
    449px 78px,
    445px 318px,
    445px 260px;
  --sp-studio-skel-positions:
    left 0 top 0,
    left calc(50% - 270px) top 55px,
    left calc(50% - 270px) top calc(69px + var(--sp-studio-skel-canvas-h)),
    right 54px top 84px,
    right 54px top 240px,
    right 58px top 336px,
    right 58px top 660px;
  position: relative;
  min-height: 100vh;
  background: var(--sp-bg);
}

@media (max-width: 1180px) {
  html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container {
    /* tablet: panels stack — the (wrapped, 83 px) topbar sub-row, the 436×775
       stage centred (the column fits the build width; no height cap there), the
       transport 14 px under it
       (4-value positions only: the 3-value `center top 176px` form is valid for
       background-position but NOT for mask-position, which would drop the whole
       shimmer position list — seen at 700 px in the S-3b probe) */
    --sp-studio-skel-layers:
      linear-gradient(var(--sp-surface), var(--sp-surface)),
      linear-gradient(var(--sp-surface), var(--sp-surface)),
      linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-masks:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    url("studio-skeleton-canvas-mask.svg"),
    url("studio-skeleton-transport-mask.svg");
    --sp-studio-skel-sizes: 100% 0px, 436px 775px, 465px 58px;
    --sp-studio-skel-positions:
      left 0 top 0,
      left 50% top 99px,
      left 50% top 888px;
  }
}

@media (max-width: 640px) {
  html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container {
    /* phone: the one scrolling column (59 px header, 73 px topbar) — the stage at
       the column's top (140 + 4 − 59), the phone height budget capped by the
       column's own 9:16 (root 7 px in on each side, column 12 px in), the
       transport 4 px under it */
    --sp-studio-skel-canvas-h: min(calc(100vh - 274px), calc((100vw - 38px) * 16 / 9));
    --sp-studio-skel-sizes:
      100% 0px,
      calc(var(--sp-studio-skel-canvas-h) * 9 / 16) var(--sp-studio-skel-canvas-h),
      calc(100% - 38px) 58px;
    --sp-studio-skel-positions:
      left 0 top 0,
      left 50% top 85px,
      left 50% top calc(89px + var(--sp-studio-skel-canvas-h));
  }
}

html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container::before,
html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container::before {
  -webkit-mask-image: var(--sp-studio-skel-masks);
  mask-image: var(--sp-studio-skel-masks);
  -webkit-mask-size: var(--sp-studio-skel-sizes);
  mask-size: var(--sp-studio-skel-sizes);
  -webkit-mask-position: var(--sp-studio-skel-positions);
  mask-position: var(--sp-studio-skel-positions);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-image: var(--sp-studio-skel-layers);
  background-size: var(--sp-studio-skel-sizes);
  background-position: var(--sp-studio-skel-positions);
  background-repeat: no-repeat;
}

html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container::after {
  /* the shimmer: one sweeping highlight, masked to the same blocks */
  -webkit-mask-image: var(--sp-studio-skel-masks);
  mask-image: var(--sp-studio-skel-masks);
  -webkit-mask-size: var(--sp-studio-skel-sizes);
  mask-size: var(--sp-studio-skel-sizes);
  -webkit-mask-position: var(--sp-studio-skel-positions);
  mask-position: var(--sp-studio-skel-positions);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-image: linear-gradient(100deg, rgba(34, 36, 43, 0) 30%, var(--sp-chip) 50%, rgba(34, 36, 43, 0) 70%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  animation: sp-studio-skeleton-shimmer 1.8s linear infinite;
}

/* ---- 1b. body-root silhouette (S-5c: the empty #builder-shell-body until the mount) */
#new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty {
  /* desktop (>1080), root top = the shell body's: the stage 8 px down (the canvas
     column's padding) centred in `100% − 540px`, its transport 14 px under it,
     the inspector's first four cards 37 px in from the column's edges — the
     SAME picture the in-tree block (2) draws, so the mount swaps one for the other */
  --sp-studio-skel-canvas-h: min(calc(100vh - 161px), 775px);
  --sp-studio-skel-layers:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-masks:
    url("studio-skeleton-canvas-mask.svg"),
    url("studio-skeleton-transport-mask.svg"),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-sizes:
    calc(var(--sp-studio-skel-canvas-h) * 9 / 16) var(--sp-studio-skel-canvas-h),
    465px 58px,
    449px 146px,
    449px 78px,
    445px 318px,
    445px 260px;
  --sp-studio-skel-positions:
    left calc(50% - 270px) top 8px,
    left calc(50% - 270px) top calc(22px + var(--sp-studio-skel-canvas-h)),
    right 54px top 37px,
    right 54px top 193px,
    right 58px top 289px,
    right 58px top 613px;
  position: relative;
}

@media (max-width: 1180px) {
  #new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty {
    /* tablet: the panels stack — the 436×775 stage centred, the transport under it */
    --sp-studio-skel-layers:
      linear-gradient(var(--sp-surface), var(--sp-surface)),
      linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-masks:
    url("studio-skeleton-canvas-mask.svg"),
    url("studio-skeleton-transport-mask.svg");
    --sp-studio-skel-sizes: 436px 775px, 465px 58px;
    --sp-studio-skel-positions:
      left 50% top 8px,
      left 50% top 797px;
  }
}

@media (max-width: 640px) {
  #new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty {
    /* phone: the stage at the column's 4 px top, the phone height budget capped
       by the column's 9:16 (root 7 px in on each side, column 12 px in), the
       transport 4 px under it */
    --sp-studio-skel-canvas-h: min(calc(100vh - 274px), calc((100vw - 38px) * 16 / 9));
    --sp-studio-skel-layers:
      linear-gradient(var(--sp-surface), var(--sp-surface)),
      linear-gradient(var(--sp-surface), var(--sp-surface));
  --sp-studio-skel-masks:
    url("studio-skeleton-canvas-mask.svg"),
    url("studio-skeleton-transport-mask.svg");
    --sp-studio-skel-sizes:
      calc(var(--sp-studio-skel-canvas-h) * 9 / 16) var(--sp-studio-skel-canvas-h),
      calc(100% - 24px) 58px;
    --sp-studio-skel-positions:
      left 50% top 4px,
      left 50% top calc(8px + var(--sp-studio-skel-canvas-h));
  }
}

#new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty::before,
#new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty::before {
  -webkit-mask-image: var(--sp-studio-skel-masks);
  mask-image: var(--sp-studio-skel-masks);
  -webkit-mask-size: var(--sp-studio-skel-sizes);
  mask-size: var(--sp-studio-skel-sizes);
  -webkit-mask-position: var(--sp-studio-skel-positions);
  mask-position: var(--sp-studio-skel-positions);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-image: var(--sp-studio-skel-layers);
  background-size: var(--sp-studio-skel-sizes);
  background-position: var(--sp-studio-skel-positions);
  background-repeat: no-repeat;
}

#new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty::after {
  -webkit-mask-image: var(--sp-studio-skel-masks);
  mask-image: var(--sp-studio-skel-masks);
  -webkit-mask-size: var(--sp-studio-skel-sizes);
  mask-size: var(--sp-studio-skel-sizes);
  -webkit-mask-position: var(--sp-studio-skel-positions);
  mask-position: var(--sp-studio-skel-positions);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-image: linear-gradient(100deg, rgba(34, 36, 43, 0) 30%, var(--sp-chip) 50%, rgba(34, 36, 43, 0) 70%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  animation: sp-studio-skeleton-shimmer 1.8s linear infinite;
}

/* ---- 2. in-tree skeleton (first child of #builder-preview-shell) ---------- */
#new-content-shell .sp-studio-skeleton {
  display: none;
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  /* Desktop side rail: stage top 55 + transport reserve 106 (no top header). */
  --sp-studio-skel-canvas-h: min(calc(100vh - 161px), 775px);
}

#new-content-shell.sp-studio-served--intent:has(#workspace-right-panel[style*="opacity: 0"]):not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-preview-shell > .sp-studio-skeleton {
  display: flex;
  animation: sp-studio-skeleton-timeout 400ms ease 45s forwards;
}

#new-content-shell .sp-studio-skeleton-canvas,
#new-content-shell .sp-studio-skeleton-transport,
#new-content-shell .sp-studio-skeleton-inspector {
  background-color: var(--sp-surface);
  background-image: linear-gradient(100deg, rgba(34, 36, 43, 0) 30%, var(--sp-chip) 50%, rgba(34, 36, 43, 0) 70%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  animation: sp-studio-skeleton-shimmer 1.8s linear infinite;
}

/* the stage: the height budget, 9:16 of it wide (never wider than the build width) */
#new-content-shell .sp-studio-skeleton-canvas {
  -webkit-mask: url("studio-skeleton-canvas-mask.svg") 0 0 / 100% 100% no-repeat;
  mask: url("studio-skeleton-canvas-mask.svg") 0 0 / 100% 100% no-repeat;
  height: var(--sp-studio-skel-canvas-h);
  aspect-ratio: 9 / 16;
  width: auto;
  max-width: 100%;
}

/* the transport bar under the canvas card (its width, zz_new_content.css:4166) */
#new-content-shell .sp-studio-skeleton-transport {
  -webkit-mask: url("studio-skeleton-transport-mask.svg") 0 0 / 100% 100% no-repeat;
  mask: url("studio-skeleton-transport-mask.svg") 0 0 / 100% 100% no-repeat;
  width: min(465px, 100%);
  height: 58px;
}

/* the inspector column (≥1181 only): the fixed panel is width 0 until the visual
   stage, so the canvas column spans the whole root — the block reserves the
   540 px and draws the panel's first four cards there (the colour and the
   shimmer masked to the cards) */
#new-content-shell .sp-studio-skeleton-inspector {
  display: none;
  position: absolute;
  top: -8px;
  right: -28px;
  width: 540px;
  height: calc(100vh - 47px);
  -webkit-mask-image:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  mask-image:
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface)),
    linear-gradient(var(--sp-surface), var(--sp-surface));
  -webkit-mask-size: 449px 146px, 449px 78px, 445px 318px, 445px 260px;
  mask-size: 449px 146px, 449px 78px, 445px 318px, 445px 260px;
  -webkit-mask-position: left 37px top 37px, left 37px top 193px, left 37px top 289px, left 37px top 613px;
  mask-position: left 37px top 37px, left 37px top 193px, left 37px top 289px, left 37px top 613px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

@media (min-width: 1181px) {
  #new-content-shell .sp-studio-skeleton {
    padding-right: 540px;
  }

  #new-content-shell .sp-studio-skeleton-inspector {
    display: block;
  }
}

@media (max-width: 1180px) {
  /* tablet: the column fits the build width — no height cap, the 775 px build */
  #new-content-shell .sp-studio-skeleton {
    --sp-studio-skel-canvas-h: 775px;
  }
}

@media (max-width: 640px) {
  /* phone: the phone height budget, capped by the column's own 9:16; the
     transport 4 px under the canvas (the phone band's #preview-surface gap) */
  #new-content-shell .sp-studio-skeleton {
    --sp-studio-skel-canvas-h: min(calc(100vh - 274px), calc((100vw - 38px) * 16 / 9));
    gap: 4px;
  }
}

/* ---- 3. failure surface: reveal the served-closed drawer onboarding-style - */
#new-content-shell.sp-studio-served--intent:has(#workspace-right-panel[style*="opacity: 0"]) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

#new-content-shell.sp-studio-served--intent:has(#workspace-right-panel[style*="opacity: 0"]) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) .sp-workspace-export-backdrop {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  cursor: default;
}

#new-content-shell.sp-studio-served--intent:has(#workspace-right-panel[style*="opacity: 0"]) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) .sp-workspace-export-panel {
  transform: translateX(0);
  pointer-events: auto;
}

/* ---- 3b. failure surface, pre-mount (S-5c): the same reveal while the body is still empty */
#new-content-shell.sp-studio-served--intent:has(#builder-shell-body:empty) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

#new-content-shell.sp-studio-served--intent:has(#builder-shell-body:empty) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) .sp-workspace-export-backdrop {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  cursor: default;
}

#new-content-shell.sp-studio-served--intent:has(#builder-shell-body:empty) #workspace-data-drawer:not(.is-open):has(#manual-feedback > *) .sp-workspace-export-panel {
  transform: translateX(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  html.sp-route-new-content--intent:not(:where([data-sp-has~="studio-shell"]):not(#sp-s)):not(:where([data-sp-has~="login-required"]):not(.sp-s)) .sp-app-page-container::after,
  #new-content-shell.sp-studio-served--intent:not(.sp-editor-load-failed):not(:has(#manual-feedback > *)) #builder-shell-body:empty::after,
  #new-content-shell .sp-studio-skeleton-canvas,
  #new-content-shell .sp-studio-skeleton-transport,
  #new-content-shell .sp-studio-skeleton-inspector {
    animation: none;
  }
}


/* ==========================================================================
   4. entry surface — "Pick your data" (Band S stage S-3c; plan §3 S-3c + §4,
   decisions S1 / S3 / S4 / S5). Served by page.layout() for a bare
   /new_content (no data channel in the URL) instead of the editor tree.
   Tokens copied from zz_compare.css:9–33 under their own names so the two
   pages never couple; one 520 px column like /explore; at ≤767 the column
   keeps clear of the app's bottom nav (`--sp-bottom-nav-h` is re-declared
   here because the studio's copy lives on #new-content-shell, which this
   page does not have). Everything keys on `.sp-studio-entry` + descendant
   classes; the ids exist for the filter callback only.
   UX 1.7 (docs/ux/decisions_2026-09-13.md D-1 / D-16, mockup A6, 2026-09-14):
   the surface is a gallery — the orange "New comparison" tile first, the
   saved rows are plain anchors to Chart; the sticky CTA band, the SELECTED
   footer, the selected-row state, the 2-segment progress bar and the bottom
   Explore link are gone. Colours: DS §1 only. Orange = the tile (the only
   orange element, D-1) + the active filter chip; lime = the chosen kind
   card (DS §1.3 rule). `display: none` appears ONLY for `[hidden]` cards /
   the no-match line written by the filter callback and for the empty state.
   ========================================================================== */

.sp-studio-entry {
  --sp-entry-bg: var(--sp-bg);
  --sp-entry-surface: var(--sp-surface);
  --sp-entry-chrome: var(--sp-chrome);
  --sp-entry-track: var(--sp-chip);
  --sp-entry-border: var(--sp-border-strong);
  --sp-entry-border-inset: var(--sp-border);
  --sp-entry-text: var(--sp-text);
  --sp-entry-text-2: var(--sp-text-2);
  --sp-entry-muted: var(--sp-text-3);
  --sp-entry-accent: var(--sp-accent);
  --sp-entry-accent-hover: var(--sp-accent-hover);
  --sp-entry-lime: #B4FF3A;
  --sp-entry-lime-tint: rgba(180, 255, 58, 0.1);
  --sp-entry-display: "Bricolage Grotesque", "Archivo", sans-serif;
  --sp-entry-ui: "Instrument Sans", "Manrope", sans-serif;
  --sp-entry-mono: "Space Mono", ui-monospace, monospace;
  --mantine-font-family: var(--sp-entry-ui);
  /* the app's fixed bottom nav at ≤767 (styles.css:11328): 64 px + safe area */
  --sp-bottom-nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
  min-height: 100%;
  background: var(--sp-entry-bg);
  color: var(--sp-entry-text);
  color-scheme: dark;
  font-family: var(--sp-entry-ui);
}

/* page ground on this route: the body ground is the app theme's and
   #app-container carries an INLINE background-color written by
   assets/00_theme_bootstrap.js (the light app theme's #f2f2f2) — an inline
   style is beaten only by !important (the zz_compare.css:38–45 precedent);
   the studio's own band does the same with var(--feed-bg) */
html:where([data-sp-has~="studio-entry"]):not(#sp-s),
body:where([data-sp-has~="studio-entry"]):not(#sp-s) {
  background: var(--sp-bg); /* html too: the overscroll / bounce area never flashes the light app ground */
}

body:where([data-sp-has~="studio-entry"]):not(#sp-s) #app-container {
  background: var(--sp-bg) !important;
}

/* ---- column ---------------------------------------------------------------- */
.sp-studio-entry .sp-entry-column {
  box-sizing: border-box;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- head: × · eyebrow + title (the step lives in the eyebrow, mockup A6) --- */
.sp-studio-entry .sp-entry-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.sp-studio-entry .sp-entry-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
  color: var(--sp-entry-text);
  font: 400 22px/1 var(--sp-entry-ui);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-close:hover {
  border-color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-eyebrow {
  display: block;
  font: 700 10px/1.2 var(--sp-entry-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-entry-lime);
}

.sp-studio-entry .sp-entry-title {
  margin: 4px 0 0;
  font: 800 26px/1.1 var(--sp-entry-display);
  letter-spacing: -0.02em;
  color: var(--sp-entry-text);
}

/* ---- what to create: two option cards (DS §4 option karta) ----------------- */
.sp-studio-entry .sp-entry-kind-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sp-studio-entry .sp-entry-kind {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  min-height: 64px;
  padding: 12px 34px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  /* I-1: the cards are <button>s (the pane toggle is in-page) — drop the UA button look */
  appearance: none;
  width: 100%;
  margin: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sp-studio-entry .sp-entry-kind:hover {
  border-color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-kind:focus-visible {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

.sp-studio-entry .sp-entry-kind::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font: 400 20px/1 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-kind.is-selected {
  border-color: var(--sp-entry-lime);
  background: var(--sp-entry-lime-tint);
}

.sp-studio-entry .sp-entry-kind.is-selected::after {
  content: "✓";
  font: 700 13px/1 var(--sp-entry-mono);
  color: var(--sp-entry-lime);
}

.sp-studio-entry .sp-entry-kind-title {
  font: 600 15px/1.2 var(--sp-entry-ui);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-kind-sub {
  font: 400 13px/1.3 var(--sp-entry-ui);
  color: var(--sp-entry-text-2);
}

/* ---- "New comparison" tile (D-1: the gallery's first tile, orange = go) ---- */
/* the DS §5 primary CTA colour on an option-card shape; text on orange = the
   page ground colour (DS §1 contrast pair), the "+" and the chevron are decoration */
.sp-studio-entry .sp-entry-new {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  box-sizing: border-box;
  min-height: 64px;
  padding: 12px 34px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--sp-entry-accent);
  background: var(--sp-entry-accent);
  color: var(--sp-bg);
  text-decoration: none;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--sp-accent) 26%, transparent);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-new:hover {
  background: var(--sp-entry-accent-hover);
  border-color: var(--sp-entry-accent-hover);
  color: var(--sp-bg);
}

.sp-studio-entry .sp-entry-new:focus-visible {
  outline: 2px solid var(--sp-entry-text);
  outline-offset: 2px;
}

.sp-studio-entry .sp-entry-new::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font: 400 20px/1 var(--sp-entry-ui);
  color: var(--sp-bg);
}

.sp-studio-entry .sp-entry-new-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(13, 14, 18, 0.18);
  font: 400 24px/1 var(--sp-entry-ui);
  color: var(--sp-bg);
}

.sp-studio-entry .sp-entry-new-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sp-studio-entry .sp-entry-new-title {
  font: 700 15px/1.2 var(--sp-entry-ui);
  color: var(--sp-bg);
}

.sp-studio-entry .sp-entry-new-sub {
  font: 400 13px/1.3 var(--sp-entry-ui);
  color: var(--sp-bg);
  opacity: 0.78;
}

/* ---- data source segment (DS §4 segmentový přepínač) ----------------------- */
.sp-studio-entry .sp-entry-segment {
  display: flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
}

.sp-studio-entry .sp-entry-seg {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font: 600 13px/1 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-seg.is-active {
  background: var(--sp-entry-border);
  color: var(--sp-entry-text);
}

.sp-studio-entry a.sp-entry-seg:hover {
  color: var(--sp-entry-text);
}

/* ---- search (DS §5 pill search) -------------------------------------------- */
/* dcc.Input (Dash 4) renders <div class="dash-input-container dash-input sp-entry-search">
   <input class="dash-input-element" id="studio-entry-search"> — the className sits on the
   WRAPPER, so the wrapper is the pill and the inner input is a transparent text field */
.sp-studio-entry .sp-entry-search {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6A63' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 16px center / 16px 16px no-repeat;
}

.sp-studio-entry .sp-entry-search .dash-input-element {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 16px 0 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sp-entry-text);
  font: 400 14px/1 var(--sp-entry-ui);
  outline: none;
  appearance: none;
}

.sp-studio-entry .sp-entry-search .dash-input-element::placeholder {
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-search:focus-within {
  /* DS §8.2 candidate focus ring (the DS leaves focus undecided; accessibility needs one) */
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* ---- category chips (DS §4 filtr chip: orange = filter) -------------------- */
.sp-studio-entry .sp-entry-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.sp-studio-entry .sp-entry-chip-row::-webkit-scrollbar {
  height: 0;
}

.sp-studio-entry .sp-entry-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  background: transparent;
  color: var(--sp-entry-text-2);
  font: 600 13px/1 var(--sp-entry-ui);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-chip:hover {
  border-color: var(--sp-entry-text);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-chip.is-active {
  background: var(--sp-entry-accent);
  border-color: var(--sp-entry-accent);
  color: var(--sp-bg);
}

.sp-studio-entry .sp-entry-chip:focus-visible {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* ---- the card list (DS §4 option karta; a row = a plain anchor to Chart) --- */
.sp-studio-entry .sp-entry-saved-label {
  display: block;
  margin-top: 2px;
  font: 700 10px/1.2 var(--sp-entry-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-studio-entry .sp-entry-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 24px;
  grid-template-areas:
    "glyph cat mark"
    "glyph title mark"
    "glyph sub mark";
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
  color: var(--sp-entry-text);
  font-family: var(--sp-entry-ui);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* filtered out by the filter callback (el.hidden); the card's own display wins over
   the UA [hidden] rule, so the author rule has to say it */
.sp-studio-entry .sp-entry-card[hidden] {
  display: none;
}

.sp-studio-entry .sp-entry-card:hover {
  border-color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-card:focus-visible {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

.sp-studio-entry .sp-entry-card::after {
  content: "›";
  grid-area: mark;
  justify-self: end;
  font: 400 20px/1 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-card-cat {
  grid-area: cat;
  font: 400 10px/1.2 var(--sp-entry-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-entry-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-studio-entry .sp-entry-card-title {
  grid-area: title;
  font: 600 15px/1.3 var(--sp-entry-ui);
  color: var(--sp-entry-text);
  overflow-wrap: anywhere;
}

.sp-studio-entry .sp-entry-card-sub {
  grid-area: sub;
  font: 400 13px/1.35 var(--sp-entry-ui);
  color: var(--sp-entry-text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* ---- chart-type glyph: card ::before ---------------------------------------- */
.sp-studio-entry .sp-entry-card::before {
  content: "";
  grid-area: glyph;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  /* neutral mark (unknown / empty chart code) */
  background: linear-gradient(var(--sp-text-2), var(--sp-text-2)) center / 14px 3px no-repeat var(--sp-entry-track);
}

.sp-studio-entry .sp-entry-card[data-glyph="line"]::before {
  /* two diagonal strokes: series 1 orange, series 2 lime */
  background:
    linear-gradient(135deg, transparent 40%, var(--sp-accent) 40% 48%, transparent 48% 58%, #B4FF3A 58% 66%, transparent 66%) center / 24px 24px no-repeat
    var(--sp-entry-track);
}

.sp-studio-entry .sp-entry-card[data-glyph="bars"]::before {
  /* three bars on a common baseline */
  background:
    linear-gradient(var(--sp-accent), var(--sp-accent)) 11px 20px / 4px 10px no-repeat,
    linear-gradient(#B4FF3A, #B4FF3A) 18px 13px / 4px 17px no-repeat,
    linear-gradient(var(--sp-accent), var(--sp-accent)) 25px 9px / 4px 21px no-repeat
    var(--sp-entry-track);
}

.sp-studio-entry .sp-entry-card[data-glyph="dots"]::before {
  /* three scattered points */
  background:
    radial-gradient(circle, var(--sp-accent) 0 2.5px, transparent 3px) 10px 22px / 8px 8px no-repeat,
    radial-gradient(circle, #B4FF3A 0 2.5px, transparent 3px) 17px 12px / 8px 8px no-repeat,
    radial-gradient(circle, var(--sp-accent) 0 2.5px, transparent 3px) 24px 17px / 8px 8px no-repeat
    var(--sp-entry-track);
}

/* ---- no match / empty library --------------------------------------------- */
.sp-studio-entry .sp-entry-no-match {
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font: 400 14px/1.5 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-no-match[hidden] {
  display: none;
}

.sp-studio-entry .sp-entry-empty {
  padding: 28px 12px;
  text-align: center;
}

.sp-studio-entry .sp-entry-empty-title {
  margin: 0 0 6px;
  font: 800 20px/1.2 var(--sp-entry-display);
  letter-spacing: -0.02em;
  color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-empty-text {
  margin: 0;
  font: 400 14px/1.5 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
}

.sp-studio-entry.is-empty .sp-entry-search,
.sp-studio-entry.is-empty .sp-entry-chip-row,
.sp-studio-entry.is-empty .sp-entry-saved-label {
  display: none;
}

/* ---- ≤767: the column keeps clear of the app's fixed bottom nav ------------- */
@media (max-width: 767px) {
  .sp-studio-entry .sp-entry-column {
    padding-bottom: calc(var(--sp-bottom-nav-h) + 16px);
  }
}

/* ---- ≤640: the phone column is the full width -------------------------------- */
@media (max-width: 640px) {
  .sp-studio-entry .sp-entry-column {
    max-width: none;
  }
}

/* ---- I-1: the two panes (Stats visual / Question card) ----------------------- */
/* the kind row flips `hidden` on the panes (callbacks/studio_entry.py KIND); a pane is
   a column with the column's own rhythm, so the hidden/shown swap keeps the spacing */
.sp-studio-entry .sp-entry-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-studio-entry .sp-entry-pane[hidden] {
  display: none;
}

/* ---- I-1: the Question card pane (DS §5 fields, §4 chips, the one primary CTA) --- */
.sp-studio-entry .sp-entry-qa-intro {
  margin: 0;
  font: 400 14px/1.5 var(--sp-entry-ui);
  color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-qa-field,
.sp-studio-entry .sp-entry-qa-answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-studio-entry .sp-entry-qa-label {
  display: block;
  font: 700 10px/1.2 var(--sp-entry-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-qa-required {
  color: var(--sp-entry-accent);
}

/* dcc.Input: the className is on the wrapper (see the search above) — the wrapper is the
   field, the inner input a transparent text box; 12 px radius = the option-card radius */
.sp-studio-entry .sp-entry-field {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
}

.sp-studio-entry .sp-entry-field .dash-input-element {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sp-entry-text);
  font: 400 14px/1 var(--sp-entry-ui);
  outline: none;
  appearance: none;
}

.sp-studio-entry .sp-entry-field .dash-input-element::placeholder {
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-field:focus-within {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* dcc.RadioItems (Dash 4) renders <div class="sp-entry-qa-chips" role="listbox">
   <label role="option"><span><input type="radio" class="… sp-entry-qa-radio"></span>
   <span class="… sp-entry-qa-chip">Text</span></label>… — `labelClassName` lands on the
   TEXT span, so the chip is the <label> itself (keyed on the wrapper class + element, never
   on Dash's own classes); the radio is visually hidden and the chosen label is lime
   (DS §1.3: lime = the chosen state) via :has(:checked) */
.sp-studio-entry .sp-entry-qa-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.sp-studio-entry .sp-entry-qa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sp-studio-entry .sp-entry-qa-chips > label {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 36px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  background: transparent;
  color: var(--sp-entry-text-2);
  font: 600 13px/1 var(--sp-entry-ui);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-qa-chips > label:hover {
  border-color: var(--sp-entry-text);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-qa-chips > label:has(.sp-entry-qa-radio:checked) {
  border-color: var(--sp-entry-lime);
  background: var(--sp-entry-lime-tint);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-qa-chips > label:has(.sp-entry-qa-radio:focus-visible),
.sp-studio-entry .sp-entry-qa-segment > label:has(.sp-entry-qa-radio:focus-visible) {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* order = the segment pill of the source row, two segments (same RadioItems markup) */
.sp-studio-entry .sp-entry-qa-segment {
  display: flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-surface);
}

.sp-studio-entry .sp-entry-qa-segment > label {
  position: relative;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 36px;
  margin: 0;
  padding: 0 10px;
  border-radius: 999px;
  font: 600 13px/1 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-qa-segment > label:hover {
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-qa-segment > label:has(.sp-entry-qa-radio:checked) {
  background: var(--sp-entry-border);
  color: var(--sp-entry-text);
}

/* answers: numbered by a CSS counter (a removed middle row never leaves a stale number) */
.sp-studio-entry .sp-entry-qa-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: sp-entry-answer;
}

.sp-studio-entry .sp-entry-qa-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.sp-studio-entry .sp-entry-qa-row::before {
  counter-increment: sp-entry-answer;
  content: counter(sp-entry-answer);
  text-align: center;
  font: 700 13px/1 var(--sp-entry-mono);
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-qa-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--sp-entry-border);
  background: transparent;
  color: var(--sp-entry-muted);
  font: 400 18px/1 var(--sp-entry-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-qa-remove:hover {
  border-color: var(--sp-entry-text);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-qa-add {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px dashed var(--sp-entry-border);
  background: transparent;
  color: var(--sp-entry-text-2);
  font: 600 13px/1 var(--sp-entry-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-qa-add:hover {
  border-color: var(--sp-entry-text);
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-qa-remove:focus-visible,
.sp-studio-entry .sp-entry-qa-add:focus-visible,
.sp-studio-entry .sp-entry-qa-save:focus-visible {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* the pane's one primary CTA — the "New comparison" tile's orange (D-1 holds per pane:
   the tile is hidden while this pane shows, so the Save is the only orange element) */
.sp-studio-entry .sp-entry-qa-save {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: var(--sp-entry-accent);
  color: var(--sp-bg);
  font: 700 15px/1 var(--sp-entry-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-qa-save:hover {
  background: var(--sp-entry-accent-hover);
}

.sp-studio-entry .sp-entry-qa-feedback:empty {
  display: none;
}

.sp-studio-entry .sp-entry-qa-msg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font: 500 14px/1.4 var(--sp-entry-ui);
  color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-qa-msg.is-ok {
  color: var(--sp-entry-lime);
}

.sp-studio-entry .sp-entry-qa-msg.is-error {
  color: var(--sp-entry-accent);
}

.sp-studio-entry .sp-entry-qa-msg-link {
  color: var(--sp-entry-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- C-2: the source segment as buttons + the two sub-panes ------------------ */
/* the segment's "Saved stats" / "Upload file" became <button>s (the sub-pane toggle); the
   <a> "Manual rows" keeps the ?source= link until Band I stage B. One reset so all three
   read identically — the .sp-entry-seg rules above carry the look. */
.sp-studio-entry button.sp-entry-seg {
  margin: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}

.sp-studio-entry button.sp-entry-seg:hover {
  color: var(--sp-entry-text);
}

.sp-studio-entry .sp-entry-seg:focus-visible {
  outline: 2px solid var(--sp-entry-accent);
  outline-offset: 2px;
}

/* the sub-panes of the Stats visual pane (the gallery / the upload form) — same column
   rhythm as .sp-entry-pane, so flipping `hidden` keeps the spacing */
.sp-studio-entry .sp-entry-sub {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-studio-entry .sp-entry-sub[hidden],
.sp-studio-entry .sp-entry-new[hidden] {
  display: none;
}

/* ---- C-2: the Upload file sub-pane ------------------------------------------ */
/* dcc.Upload (Dash 4) renders <div id="studio-entry-up-file"><div class="sp-entry-up-drop">
   <input type="file" hidden>…</div></div> — verified in the browser 2026-09-15: the id is on a
   BARE outer div and the className lands on the INNER one, which is the drop target. Key on the
   class (the id carries no styling hook), exactly as the scaffold convention requires. */
.sp-studio-entry .sp-entry-up-drop {
  box-sizing: border-box;
  width: 100%;
  border-radius: 12px;
  border: 1px dashed var(--sp-entry-border);
  background: var(--sp-entry-surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sp-studio-entry .sp-entry-up-drop:hover {
  border-color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-up-drop-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 92px;
  padding: 16px;
}

.sp-studio-entry .sp-entry-up-drop-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--sp-entry-border);
  color: var(--sp-entry-text-2);
  font: 400 17px/1 var(--sp-entry-ui);
}

.sp-studio-entry .sp-entry-up-drop-text {
  font: 500 14px/1.3 var(--sp-entry-ui);
  color: var(--sp-entry-text-2);
  text-align: center;
}

.sp-studio-entry .sp-entry-up-preview:empty {
  display: none;
}

.sp-studio-entry .sp-entry-up-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--sp-entry-border);
  background: var(--sp-entry-chrome);
}

.sp-studio-entry .sp-entry-up-loaded {
  font: 600 13px/1.3 var(--sp-entry-ui);
  color: var(--sp-entry-lime);
}

/* the preview table: three columns, small mono figures, scrolls sideways rather than
   widening the column (the surface never scrolls horizontally) */
.sp-studio-entry .sp-entry-up-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font: 400 12px/1.4 var(--sp-entry-mono);
  color: var(--sp-entry-text-2);
}

.sp-studio-entry .sp-entry-up-table th {
  padding: 4px 10px 4px 0;
  color: var(--sp-entry-muted);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.sp-studio-entry .sp-entry-up-table td {
  padding: 3px 10px 3px 0;
  white-space: nowrap;
}

.sp-studio-entry .sp-entry-up-more,
.sp-studio-entry .sp-entry-up-hint {
  font: 400 11px/1.4 var(--sp-entry-ui);
  color: var(--sp-entry-muted);
}

.sp-studio-entry .sp-entry-up-hint {
  margin: -6px 0 0;
}

/* ---- Band I stage B: the Manual rows sub-pane ------------------------------- */
/* label · value · second value · × — the row collapses to two lines on a phone rather
   than shrinking the inputs below a tappable width */
.sp-studio-entry .sp-entry-mr-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: sp-mr;
}

.sp-studio-entry .sp-entry-mr-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
}

@media (max-width: 560px) {
  .sp-studio-entry .sp-entry-mr-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  }
  .sp-studio-entry .sp-entry-mr-row .sp-entry-mr-label {
    grid-column: 1 / -1;
  }
}

.sp-studio-entry .sp-entry-mr-row .sp-entry-field {
  height: 40px;
}
