.hero { padding: 20px 0 18px; }
.title-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: 10px 0 8px; }
.title-row h1 { margin: 0; font-family: var(--display); font-size: clamp(34px, 4.4vw, 54px); font-weight: 400; letter-spacing: .03em; }
.title-row .paper-label { transform: rotate(-2.5deg); font-size: 18px; }
.lead { max-width: 880px; color: var(--muted); margin: 0; line-height: 1.75; font-size: 15px; }

/* Preview stays visible while the right-hand recipe lab scrolls independently. */
.play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 460px); gap: 22px; --play-h: clamp(560px, 74vh, 820px); align-items: start; }
.sky-col, .panel { height: var(--play-h); border: 2px solid var(--ink); background: var(--surface); box-shadow: 5px 5px 0 var(--ink); overflow: hidden; }
.sky-col { display: flex; flex-direction: column; min-width: 0; border-radius: 4px 18px 6px 14px; }
.sky-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 2px solid var(--ink); }
.stage-index { font: 12px/1.6 var(--mono); letter-spacing: .12em; color: var(--teal-ink); }
.stage-stats { font: 12px/1.6 var(--mono); color: var(--muted); }
.stage { position: relative; flex: 1 1 auto; min-height: 0; cursor: crosshair; }
#sky { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: rgba(242,238,220,.85); font-family: var(--display); font-size: clamp(18px,2.4vw,26px); letter-spacing: .18em; text-shadow: 0 2px 12px rgba(0,0,0,.5); transition: opacity .8s; }
.stage-hint.is-hidden { opacity: 0; }

.panel { display: flex; flex-direction: column; border-radius: 10px 5px 16px 6px; }
.panel-head { padding: 13px 16px 14px; background: var(--soft-teal); border-bottom: 2px solid var(--ink); }
.panel-title-row { display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.panel-head h2 { margin: 1px 0 0; font: 400 23px/1.2 var(--display); }
.panel-note { max-width: 132px; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: right; }
.panel-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-top: 11px; }
.panel-actions .action-btn { width: 100%; min-width: 0; padding: 7px 3px; border: 2px solid var(--ink); border-radius: 5px; box-shadow: 2px 2px 0 var(--ink); font-size: 11px; text-align: center; }
.panel-actions .action-btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.panel-scroll { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--teal) transparent; }
.panel-tabs { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: 1fr 1fr; padding: 9px 14px; background: rgba(251,249,240,.96); border-bottom: 1px dashed var(--line); backdrop-filter: blur(8px); }
.panel-tab { padding: 7px 10px; border: 2px solid var(--ink); background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; }
.panel-tab:first-child { border-radius: 5px 0 0 5px; }
.panel-tab:last-child { margin-left: -2px; border-radius: 0 5px 5px 0; }
.panel-tab.is-on { position: relative; z-index: 1; background: var(--yellow); color: var(--ink); font-weight: 700; }
.config-box { display: flex; flex-direction: column; gap: 16px; padding: 16px; border-bottom: 2px dashed var(--line); background: var(--surface); }
.control-group { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.group-label { font: 400 15px/1.5 var(--display); color: var(--teal-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip, .action-btn { padding: 6px 12px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform .1s, box-shadow .1s, background .15s; }
.chip:hover, .action-btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.chip:active, .action-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }
.chip.is-on { background: var(--yellow); font-weight: 700; }
.action-btn b { font: 10px/1 var(--mono); color: var(--muted); margin-left: 2px; }
.action-btn.is-on { background: var(--soft-teal); }
.action-btn.is-on b { color: var(--teal-ink); }
.action-btn.is-off { background: var(--soft-teal); }
.action-btn.is-off b { color: var(--teal-ink); }
.action-btn.warn { background: var(--red); color: var(--surface); }

/* Recipe workshop is the primary, always-open controller. */
.workshop { background: var(--surface); }
.ws-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px 9px; }
.ws-tip { color: var(--muted); font-size: 11px; }
.ws-body { display: flex; flex-direction: column; }
.ws-lib { padding: 0 16px 13px; border-bottom: 1px dashed var(--line); background: var(--paper); }
.lib-list { display: flex; gap: 6px; overflow-x: auto; padding: 4px 3px 9px 0; scrollbar-width: thin; }
.lib-item { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); font-size: 12px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
.lib-item small { color: var(--muted); font-size: 9px; }
.lib-item.is-on { background: var(--yellow); }
.ws-io { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-editor { padding: 14px 16px 20px; }
.ed-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: -14px -16px 13px; padding: 11px 16px; background: rgba(251,249,240,.96); border-bottom: 1px dashed var(--line); backdrop-filter: blur(7px); }
.ed-name { flex: 1 1 120px; min-width: 0; padding: 6px 9px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); font: 400 15px/1.4 var(--display); box-shadow: 2px 2px 0 var(--ink); }
.mini-btn { display: inline-block; padding: 5px 9px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.mini-btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.mini-btn.primary { background: var(--yellow); font-weight: 700; }
.mini-btn.danger { background: var(--red); color: var(--surface); }
.import-label { cursor: pointer; }

.stage-form { border: 2px solid var(--ink); border-radius: 5px 10px 5px 8px; padding: 11px; margin-bottom: 12px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.stage-form.is-child { margin: 12px 0 0 10px; background: var(--surface); border-style: dashed; box-shadow: none; }
.sf-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 11px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.sf-title { font: 400 15px/1.5 var(--display); color: var(--teal-ink); }
.sf-head-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.sf-row { display: flex; align-items: center; gap: 9px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sf-section { margin: 0 0 10px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; background: rgba(251,249,240,.74); }
.sf-section:last-of-type { margin-bottom: 0; }
.sf-section-title { margin: 0 0 8px; color: var(--teal-ink); font: 400 12px/1.4 var(--display); letter-spacing: .04em; }
.sf-section-note { margin: -3px 0 8px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.sf-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 10px; }
.sf-grid + .sf-grid, .sf-conditional { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.fld { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.fld-label { color: var(--muted); font-size: 11px; flex: none; }
.fld-sep { color: var(--muted); }
.ws-editor input[type="number"], .stage-form select { width: 58px; padding: 3px 5px; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); font-size: 12px; }
.stage-form select { width: auto; max-width: 116px; cursor: pointer; }
.sf-select-grid { margin-bottom: 10px; }
.numeric-stack { display: grid; gap: 8px; }
.numeric-control { display: grid; grid-template-columns: 76px minmax(78px,1fr) 58px 24px; align-items: center; gap: 7px; min-width: 0; }
.numeric-label { color: var(--muted); font-size: 11px; }
.numeric-control input[type="range"] { width: 100%; min-width: 0; accent-color: var(--teal-ink); cursor: pointer; }
.numeric-control input[type="number"] { width: 58px; min-width: 0; }
.numeric-control small { color: var(--muted); font-size: 9px; }
.numeric-range { display: grid; gap: 6px; padding: 7px; border: 1px dashed var(--line); border-radius: 4px; }
.numeric-range-title { color: var(--teal-ink); font-size: 11px; }
.dual-range-track { --range-start: 0%; --range-end: 100%; position: relative; height: 24px; }
.dual-range-track::before, .dual-range-track::after { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 4px; }
.dual-range-track::before { background: var(--line); }
.dual-range-track::after { left: var(--range-start); right: calc(100% - var(--range-end)); background: var(--teal-ink); }
.dual-range-track input[type="range"] { position: absolute; inset: 0; z-index: 2; width: 100%; height: 24px; margin: 0; appearance: none; background: transparent; pointer-events: none; }
.dual-range-track .range-high { z-index: 3; }
.dual-range-track input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.dual-range-track input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; appearance: none; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); box-shadow: 1px 1px 0 var(--ink); cursor: grab; pointer-events: auto; }
.dual-range-track input[type="range"]::-moz-range-track { height: 4px; background: transparent; }
.dual-range-track input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); box-shadow: 1px 1px 0 var(--ink); cursor: grab; pointer-events: auto; }
.dual-range-values { display: grid; grid-template-columns: auto 58px auto 58px 24px; align-items: center; justify-content: end; gap: 5px; color: var(--muted); font-size: 10px; }
.dual-range-values input[type="number"] { width: 58px; }
.dual-range-values small { font-size: 9px; }
.recipe-settings { border-color: var(--teal); background: var(--soft-teal); }
.swatches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { width: 22px; height: 22px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; cursor: pointer; opacity: .38; transition: opacity .12s,transform .12s; }
.sw:hover { opacity: .75; }
.sw.is-on { opacity: 1; transform: scale(1.14); box-shadow: 1px 1px 0 var(--ink); }

.effect-grid { display: grid; gap: 8px; }
.split-fuse { margin: 10px 0 0; padding: 9px; border: 1px dashed var(--line); border-radius: 5px; background: var(--soft-teal); }
.add-stage { width: 100%; padding: 8px; border: 2px dashed var(--ink); border-radius: 5px; background: transparent; color: var(--teal-ink); font-size: 13px; cursor: pointer; }
.add-stage:hover { background: var(--soft-teal); }
.text-input { width: 130px; padding: 5px 9px; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); font-size: 14px; }
.draw-row { align-items: flex-start; }
.draw-pad { display: block; width: 120px; height: 120px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); cursor: crosshair; touch-action: none; box-shadow: 2px 2px 0 var(--ink); }
.draw-side { display: flex; flex-direction: column; gap: 9px; max-width: 180px; }

/* Fireworks show director */
.show-builder { padding: 16px; }
.show-intro { margin-bottom: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 5px; background: var(--soft-teal); }
.show-intro p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.show-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 7px; align-items: center; }
.show-name { min-width: 0; padding: 7px 9px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); font: 400 16px/1.4 var(--display); box-shadow: 2px 2px 0 var(--ink); }
.show-status { margin: 10px 0; color: var(--muted); font: 11px/1.5 var(--mono); }
.show-status.is-playing { color: var(--teal-ink); font-weight: 700; }
.cue-list { display: grid; gap: 10px; margin-bottom: 10px; }
.cue-card { padding: 10px; border: 2px solid var(--ink); border-radius: 5px 10px 5px 8px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.cue-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cue-index { font: 400 14px/1.4 var(--display); color: var(--teal-ink); }
.cue-actions { display: flex; gap: 5px; }
.cue-actions .mini-btn { padding: 3px 7px; }
.cue-recipe { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: var(--muted); font-size: 11px; }
.cue-recipe select { max-width: 220px; padding: 5px 7px; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); }
.cue-controls { display: grid; gap: 7px; }
.cue-card .numeric-control { grid-template-columns: 76px minmax(70px,1fr) 54px 24px; }
.cue-card input[type="number"] { width: 54px; padding: 3px 5px; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); font-size: 12px; }

.notice { display: flex; align-items: center; gap: 38px; margin: 34px 0 10px; padding: 25px 30px; background: var(--soft-teal); border: 2px solid var(--ink); border-radius: 4px 16px 5px 12px; box-shadow: 4px 4px 0 var(--ink); }
.notice-index { align-self: flex-start; padding-top: 5px; font: 12px/1.6 var(--mono); color: var(--teal-ink); }
.notice p { font: 400 25px/1.6 var(--display); margin: 0; }
.notice small { display: block; font: 400 14px/1.7 var(--font); color: var(--muted); }
.notice-stamp { margin-left: auto; color: var(--blue); font-size: 42px; line-height: 1; }

@media (min-width: 1420px) {
  .shell { width: min(1400px,calc(100% - 96px)); }
  .play { grid-template-columns: minmax(0,1fr) 480px; }
}
@media (max-width: 1050px) {
  .play { grid-template-columns: minmax(0,1fr) 390px; gap: 16px; }
}
@media (max-width: 880px) {
  .play { grid-template-columns: 1fr; --play-h: auto; }
  .sky-col { height: min(58vh,540px); }
  .panel { height: auto; max-height: none; }
  .panel-scroll { overflow: visible; }
  .ed-bar { position: static; }
}
@media (max-width: 700px) {
  .hero { padding: 20px 0 16px; }
  .panel-title-row { align-items: center; }
  .panel-note { display: none; }
  .panel-actions { grid-template-columns: repeat(2,1fr); }
  .sf-grid { grid-template-columns: 1fr; }
  .numeric-control { grid-template-columns: 68px minmax(70px,1fr) 54px 22px; }
  .dual-range-values { grid-template-columns: auto 54px auto 54px 22px; }
  .dual-range-values input[type="number"] { width: 54px; }
  .show-toolbar { grid-template-columns: 1fr 1fr; }
  .show-name { grid-column: 1 / -1; }
  .notice { padding: 20px; flex-wrap: wrap; gap: 8px 20px; }
  .notice p { font-size: 19px; }
  .notice-stamp { font-size: 28px; }
}

/* Compact dual workspace: shared controls stay visible, editors use the full panel. */
.hero { padding: 12px 0 11px; }
.title-row { margin: 5px 0 4px; }
.title-row h1 { font-size: clamp(30px,3.7vw,46px); }
.play { --play-h: clamp(620px,82vh,900px); }
.panel-head { padding: 10px 12px 11px; }
.panel-title-row { align-items: center; }
.panel-head h2 { font-size: 21px; }
.panel-tabs { position: static; padding: 0; margin-top: 8px; border: 0; background: transparent; backdrop-filter: none; }
.panel-tab { padding: 6px 9px; }
.resource-picker { display: grid; grid-template-columns: 68px minmax(0,1fr); align-items: center; gap: 8px; margin-top: 8px; color: var(--teal-ink); font-size: 11px; }
.resource-picker select { width: 100%; min-width: 0; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12px; }
.panel-actions { margin-top: 8px; gap: 6px; }
.panel-actions .action-btn { padding: 6px 2px; }
.workshop { padding: 10px 12px 14px; }
.ws-head { padding: 10px 0 7px; }
.resource-actions { display: flex; gap: 5px; margin-bottom: 8px; }
.resource-actions .mini-btn { flex: 1; text-align: center; padding: 4px 6px; }
.mini-btn:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: 1px 1px 0 var(--ink); }
.ws-editor { padding: 0; }
.ed-bar { position: static; margin: 0 0 8px; padding: 0 0 8px; background: transparent; }
.ed-name { padding: 5px 8px; font-size: 12px; }
.stage-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 7px; padding: 8px; margin-bottom: 9px; box-shadow: 2px 2px 0 var(--ink); }
.stage-form > .sf-head, .stage-form > .sf-basic, .stage-form > .split-fuse, .stage-form > .stage-form { grid-column: 1 / -1; }
.stage-form.is-child { margin: 6px 0 0 8px; }
.sf-head { margin-bottom: 0; padding-bottom: 6px; }
.sf-head-btns .mini-btn { padding: 3px 6px; font-size: 10px; }
.sf-section { margin: 0; padding: 6px; }
.sf-section-title { margin-bottom: 5px; }
.sf-section-note { display: none; }
.sf-select-grid { margin-bottom: 0; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.fld { gap: 3px; }
.fld-label { font-size: 10px; }
.stage-form select { height: 22px; max-width: 92px; padding: 2px 4px; font-size: 11px; }
.numeric-stack, .effect-grid { gap: 5px; }
.effect-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.numeric-control { grid-template-columns: minmax(0,1fr) 56px auto; gap: 5px; }
.numeric-label { font-size: 10px; }
.numeric-control input[type="number"], .ws-editor input[type="number"] { width: 56px; padding: 3px 4px; }
.numeric-range { gap: 3px; padding: 5px; }
.dual-range-track { height: 20px; }
.dual-range-track::before, .dual-range-track::after { top: 9px; }
.dual-range-track input[type="range"] { height: 20px; }
.dual-range-values { grid-template-columns: auto 56px auto 56px auto; justify-content: start; gap: 4px; }
.dual-range-values input[type="number"] { width: 56px; }
.swatches { gap: 4px; }
.sw { width: 18px; height: 18px; border-width: 1px; }
.add-stage { padding: 6px; font-size: 12px; }

.show-builder { padding: 10px 12px 14px; }
.show-intro { margin-bottom: 8px; padding: 7px 9px; }
.show-intro p { margin-top: 2px; }
.show-title-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; margin: 6px 0; }
.show-name { width: 100%; box-sizing: border-box; padding: 5px 8px; font-size: 12px; }
.show-title-row .show-status { margin: 0; text-align: right; }
.cue-list { gap: 7px; margin-bottom: 8px; }
.cue-card { padding: 7px; box-shadow: 2px 2px 0 var(--ink); }
.cue-head { margin-bottom: 6px; padding-bottom: 5px; }
.cue-actions .mini-btn { padding: 2px 5px; font-size: 10px; }
.cue-recipe { margin-bottom: 6px; }
.cue-controls { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 7px; }
.cue-card .numeric-control { grid-template-columns: minmax(0,1fr) 52px auto; gap: 4px; }
.cue-card input[type="number"] { width: 52px; padding: 3px 4px; }

.sf-basic { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 7px; }
.sf-basic > .sf-section-title { grid-column: 1 / -1; }
.sf-basic > .sf-shape-grid { grid-column: 1; align-self: start; }
.sf-basic > .sf-conditional { grid-column: 2; margin: 0; padding: 0; border: 0; align-self: start; }
.sf-basic > .draw-row { grid-column: 1 / -1; }
.sf-basic > .sf-particle-grid, .sf-basic > .numeric-stack { grid-column: 1 / -1; }
.sf-basic > .numeric-stack { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.sf-basic > .sf-subsection { margin: 0; }
.sf-basic .text-input { width: 100%; min-width: 0; box-sizing: border-box; }
.sf-basic .draw-pad { width: 104px; height: 104px; }

/* Stage editor follows a fixed row rhythm: wide / paired / wide / paired. */
.sf-basic { display: block; }
.sf-basic > .sf-section-title { margin-bottom: 7px; }
.sf-basic > .sf-subsection, .sf-basic > .layout-pair, .sf-basic > .transform-line { margin-bottom: 10px; }
.sf-basic > :last-child { margin-bottom: 0; }
.layout-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
.layout-pair > .sf-subsection { margin: 0; background: var(--surface); }
.sf-subsection { padding: 6px 7px; border: 1px dashed var(--line); }
.sf-subsection .sf-section-title { margin-bottom: 5px; }
.layout-color .swatches { min-height: 20px; }
.layout-shape > .sf-subsection { min-height: 52px; }
.shape-options { display: flex; flex-direction: column; justify-content: center; }
.shape-placeholder { color: var(--muted); font-size: 10px; line-height: 1.4; }
.shape-options .text-input { width: 100%; }
.shape-options .draw-row { display: grid; grid-template-columns: 82px minmax(0,1fr); align-items: center; gap: 7px; margin: 0; }
.shape-options .draw-pad { width: 78px; height: 78px; }
.shape-options .mini-btn { align-self: center; }
.layout-pair select, .layout-motion select { width: 100%; max-width: none; }
.compact-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.config-line { min-width: 0; }
.config-line + .config-line { margin-top: 10px; }
.motion-choice-line { display: grid; grid-template-columns: 44px minmax(0,1fr); align-items: center; gap: 6px; }
.motion-number-line { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.motion-number-line .numeric-control { grid-template-columns: minmax(0,1fr) 56px auto; }
.motion-range-line { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.particle-primary-line { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(250px,1.3fr); gap: 10px; }
.particle-choice-line { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,.9fr); gap: 10px; }
.particle-choice-line .choice-field { grid-column: auto; grid-template-columns: 38px minmax(0,1fr); align-items: start; }
.particle-choice-line .choice-field > .fld-label { padding-top: 4px; }
.inline-range { display: grid; grid-template-columns: auto 56px auto 56px auto; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 10px; }
.inline-range input[type="number"] { width: 56px; min-width: 0; }
.inline-range small { font-size: 9px; }
.sf-effects .effect-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.sf-effects .effect-control { grid-template-columns: minmax(0,1fr) 56px; }
.transform-line { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding: 4px 6px; }
.transform-line .numeric-control { grid-template-columns: minmax(0,1fr) 56px auto; }
.layout-wide { width: auto; }
.ed-scale { flex: 0 1 150px; grid-template-columns: auto 50px auto; }
.ed-scale input[type="number"] { width: 50px; }

/* Only the three stage groups use dashed containers. */
.stage-form > .stage-group { grid-column: 1 / -1; padding: 8px; border: 1px dashed var(--line); border-radius: 5px; background: var(--parper); }
.stage-form.is-child { border-style: solid; }
.sf-subsection, .layout-pair > .sf-subsection { padding: 4px 6px; border: 0; background: transparent; }
.numeric-range { padding: 0; border: 0; }
.split-fuse { border: 0; padding: 6px 0 0; background: transparent; }
.add-stage { border: 1px solid var(--ink); }
.layout-pair { gap: 4px 10px; }
.layout-color { padding-top: 0; }
.stage-color-picker { position: relative; display: inline-block; width: 18px; height: 18px; margin: 0; flex: none; cursor: pointer; }
.stage-color-picker input[type="color"] { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.stage-color-picker .add-color-plus { position: absolute; inset: 0; display: flex; box-sizing: border-box; align-items: center; justify-content: center; padding: 0 0 1px; border: 1px solid var(--ink); border-radius: 50%; background: transparent; color: var(--ink); font: 700 14px/18px var(--font); text-align: center; opacity: .58; transition: opacity .12s, transform .12s, box-shadow .12s; }
.stage-color-picker:hover .add-color-plus, .stage-color-picker:focus-within .add-color-plus { opacity: 1; }
.stage-color-picker.is-on .add-color-plus { opacity: 1; transform: scale(1.14); box-shadow: 1px 1px 0 var(--ink); }
.stage-color-well { position: relative; display: inline-block; width: 18px; height: 18px; flex: none; cursor: pointer; }
.stage-color-well input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.stage-color-well > span { display: block; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid var(--ink); border-radius: 50%; box-shadow: 1px 1px 0 var(--ink); }
.stage-color-well > button { position: absolute; z-index: 3; top: -7px; right: -7px; display: none; width: 14px; height: 14px; padding: 0; border: 1px solid var(--ink); border-radius: 50%; background: var(--surface); color: var(--ink); font: 10px/11px var(--font); cursor: pointer; }
.stage-color-well:hover > button, .stage-color-well:focus-within > button { display: block; }
.shape-options { display: block; }
.shape-options.is-direct { display: block; }
.shape-options.is-direct .text-input { width: 100%; height: 22px; box-sizing: border-box; padding: 2px 4px; font-size: 11px; }
.shape-options.is-direct .draw-row { display: block; }
.shape-options.is-direct .draw-pad { width: 100%; height: 104px; }
.shape-preview { display: block; width: 100%; height: 104px; box-sizing: border-box; border: 1px solid var(--ink); border-radius: 5px; background: var(--surface); }
.shape-options .draw-row { display: grid; grid-template-columns: 70px; gap: 4px; }
.shape-options .draw-pad { width: 68px; height: 68px; border-width: 1px; box-shadow: none; }
.shape-options .mini-btn { width: 68px; padding: 2px 4px; }
.shape-clear { width: auto; min-height: 20px; margin-top: 6px; padding: 1px 8px; box-shadow: none !important; font-size: 10px; }
.layout-shape > .sf-subsection:first-child > .numeric-control { margin-top: 6px; grid-template-columns: minmax(0,1fr) 44px auto; }
.layout-shape > .sf-subsection:first-child > .numeric-control input[type="number"] { width: 44px; }
.shape-options > .numeric-control { grid-template-columns: minmax(0,1fr) 44px auto; }
.shape-options > .numeric-control input[type="number"] { width: 44px; }
.choice-field { grid-column: 1 / -1; display: grid; gap: 4px; }
.choice-group { display: flex; flex-wrap: wrap; gap: 4px; }
.choice-item { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.choice-item input { position: absolute; opacity: 0; pointer-events: none; }
.choice-item span { display: block; padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 10px; line-height: 1.2; }
.choice-item input:checked + span { border-color: var(--ink); background: var(--yellow); color: var(--ink); font-weight: 700; }
.choice-item input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }
.panel input:not([type="radio"]):not([type="checkbox"]):not([type="color"]), .panel select { border-width: 1px !important; box-shadow: none; }
.stage-form input[type="number"] { height: 22px; padding: 1px 4px !important; border: 0 !important; border-radius: 3px; outline: 0; background: rgba(91,159,162,.08); line-height: 20px; appearance: textfield; }
.stage-form input[type="number"]:focus { background: rgba(91,159,162,.16); }
.stage-form input[type="number"]::-webkit-inner-spin-button, .stage-form input[type="number"]::-webkit-outer-spin-button { margin: 0; appearance: none; }
.draw-pad, .text-input { border-width: 1px; box-shadow: none; }

/* Control surfaces follow the main site's body type; display type stays on major headings only. */
.panel, .panel button, .panel input, .panel select, .panel textarea { font-family: var(--font); }
.panel .group-label, .panel .sf-title, .panel .sf-section-title, .panel .cue-index { font-family: var(--font); }
.title-row h1, .panel-head h2, .stage-hint { font-family: var(--display); }

@media (max-width: 1050px) {
  .numeric-control { grid-template-columns: minmax(0,1fr) 52px auto; }
}
@media (max-width: 880px) {
  .play { --play-h: auto; }
  .stage-form { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
@media (max-width: 520px) {
  .stage-form { grid-template-columns: 1fr; }
  .stage-form > .sf-section { grid-column: 1; }
  .motion-number-line, .sf-effects .effect-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .motion-range-line, .particle-primary-line, .particle-choice-line { grid-template-columns: 1fr; }
  .effect-grid, .cue-controls, .sf-basic, .sf-basic > .numeric-stack { grid-template-columns: 1fr; }
  .sf-basic > .sf-shape-grid, .sf-basic > .sf-conditional, .sf-basic > .sf-particle-grid, .sf-basic > .numeric-stack, .sf-basic > .sf-section-title, .sf-basic > .draw-row { grid-column: 1; }
  .layout-pair, .compact-grid { grid-template-columns: 1fr; }
  .shape-options { grid-template-columns: 80px minmax(0,1fr); }
}
