/* Studio shell. The shared component and sound styles remain in styles.css. */
.studio-page {
  --studio-canvas: #f4f4f0;
  --studio-surface: #fff;
  --studio-sidebar: #fafaf7;
  --studio-line: #e3e3db;
  --studio-ink: #292925;
  --studio-muted: #747468;
  --studio-radius: 12px;
  height: 100dvh;
  overflow: hidden;
  background: var(--studio-canvas);
  color: var(--studio-ink);
  font-size: 13px;
  line-height: 1.5;
}
.studio-page button, .studio-page select, .studio-page input { font-family: inherit; }
.studio-page :is(button, select, input, a, [tabindex]):focus { outline: none; }
.studio-page [hidden] { display: none !important; }

/* Header and library */
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--studio-line);
  background: var(--studio-sidebar);
}
.studio-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: flex; align-items: center; gap: 3px; width: 23px; height: 24px; }
.brand-mark i { width: 3px; height: 9px; border-radius: 2px; background: #34342f; }
.brand-mark i:nth-child(2) { height: 20px; }
.brand-mark i:nth-child(3) { height: 14px; }
.studio-brand strong { font-size: 17px; font-weight: 580; letter-spacing: -.6px; }
.brand-divider { width: 1px; height: 16px; margin: 0 2px; background: #dcdcd3; }
.studio-brand .studio-title { margin: 0; color: #77776b; font-size: 13px; line-height: 20px; font-weight: 400; }
.studio-actions { display: flex; align-items: center; gap: 22px; }
.gallery-link { color: #6f6f62; font-size: 12px; text-decoration: none; }
.gallery-link:hover { color: #292925; }
.studio-page .sound-control {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid #deded4;
  background: #fff;
  color: #555549;
  font-size: 12px;
  box-shadow: 0 1px 2px #20201803;
}
.studio-page .sound-control .icon { width: 14px; height: 14px; }
.studio-page .sound-control[aria-pressed=false] { background: transparent; }
.studio-page .sound-control:disabled { opacity: .6; }
.studio-layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 284px;
  height: calc(100dvh - 56px);
  min-height: 0;
}
.library-panel {
  min-width: 0;
  padding: 24px 12px;
  overflow: auto;
  border-right: 1px solid var(--studio-line);
  background: var(--studio-sidebar);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 10px 16px; }
.panel-heading h2 { margin: 0; font-size: 12px; line-height: 18px; font-weight: 550; }
.library-panel .panel-heading h2 { color: #747467; }
.library-list { display: flex; flex-direction: column; gap: 4px; }
.library-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #707063;
  text-align: left;
}
.library-item:hover { background: #efefe8; }
.library-item[aria-pressed=true] { border-color: #deded4; background: #fff; color: #303029; box-shadow: 0 1px 2px #20201803; }
.library-icon { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; color: #858576; }
.library-item[aria-pressed=true] .library-icon { color: #565649; }
.library-icon .icon { width: 18px; height: 18px; stroke-width: 1.45; }
.library-copy strong { font-size: 12px; font-weight: 450; }
.library-item[aria-pressed=true] strong { font-weight: 550; }

/* Workspace: the curve, waveform, and live component */
.studio-main {
  display: grid;
  grid-template-rows: minmax(272px, .85fr) minmax(300px, 1fr);
  gap: 18px;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  place-items: stretch;
  overflow: auto;
  background: var(--studio-canvas);
}
.signal-panel { display: flex; min-width: 0; min-height: 0; }
.signal-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; flex: 1; min-width: 0; min-height: 0; }
.signal-pane, .component-panel { border: 1px solid var(--studio-line); border-radius: var(--studio-radius); background: var(--studio-surface); box-shadow: 0 1px 3px #20201803; }
.signal-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px; }
.signal-pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; margin-bottom: 12px; }
.signal-pane-heading h2 { margin: 0; font-size: 13px; line-height: 19px; font-weight: 550; letter-spacing: -.1px; }
.signal-readout { color: var(--studio-muted); font: 10px/16px var(--font-stack-mono); white-space: nowrap; }
.curve-reset { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 4px 7px; border-radius: 6px; background: transparent; color: #77776a; font-size: 11px; }
.curve-reset:hover { background: #f3f3ed; color: #37372e; }
.curve-reset .icon { width: 12px; height: 12px; }
.signal-plot { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.signal-canvas { position: relative; flex: 1; min-width: 0; min-height: 140px; }
.signal-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.signal-svg[data-view=curve] { touch-action: none; user-select: none; }
.plot-grid { stroke: #edede6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.plot-baseline { stroke: #d7d7cc; stroke-width: 1; vector-effect: non-scaling-stroke; }
.wave-area { fill: rgb(var(--wave-mood,133,133,116)); fill-opacity: .28; stroke: color-mix(in srgb, rgb(var(--wave-mood,133,133,116)) 48%, #747461); stroke-width: .65; vector-effect: non-scaling-stroke; }
.wave-detail { stroke: color-mix(in srgb, rgb(var(--wave-mood,133,133,116)) 40%, #6f6f5c); stroke-opacity: .4; stroke-width: .6; vector-effect: non-scaling-stroke; }
.wave-label { display: none; }
.plot-axis-label { position: absolute; top: var(--plot-y); left: 0; transform: translateY(-50%); color: #767668; font: 10px/1 var(--font-stack-mono); pointer-events: none; user-select: none; }
.motion-fill { fill: url(#motion-gradient); }
.motion-line { fill: none; stroke: #5a5a4d; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.curve-handle { fill: #fff; stroke: #666657; stroke-width: 1.3; cursor: ns-resize; vector-effect: non-scaling-stroke; }
.curve-hit { fill: transparent; cursor: ns-resize; touch-action: none; }
.curve-endpoint { fill: #727263; }
.curve-point:focus-visible { outline: none; }
.playhead { stroke: #414136; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.playhead-dot { fill: #414136; pointer-events: none; }
.graph-scale { position: relative; height: 16px; margin: 12px 4.2% 0; color: #79796b; font: 10px/16px var(--font-stack-mono); }
.graph-scale span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.graph-scale span:first-child { left: 0; transform: none; }
.graph-scale span:nth-child(2) { left: 25%; }
.graph-scale span:nth-child(3) { left: 50%; }
.graph-scale span:nth-child(4) { left: 75%; }
.graph-scale span:last-child { right: 0; transform: none; }
.component-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 22px 0; }
.component-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.component-heading h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 550; letter-spacing: -.15px; }
.studio-specimens { display: flex; align-items: stretch; justify-content: center; flex: 1; min-width: 0; min-height: 170px; }
.studio-specimens .specimen { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-width: 0; }
.studio-specimens .surface { width: 100%; height: 100%; min-height: 170px; padding: 20px 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.studio-specimens .specimen-caption, .studio-specimens .save-orbit { display: none; }
.studio-specimens .press-composition { padding-top: 0; }
.studio-specimens .save-button { min-width: 184px; min-height: 48px; font-size: 13px; }
.component-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-top: 1px solid #eeeee7; color: #757569; font-size: 11px; line-height: 16px; }
.component-footer > span:last-child { flex-shrink: 0; padding: 3px 7px; border-radius: 5px; background: #f4f4ee; color: #747464; font: 10px/16px var(--font-stack-mono); letter-spacing: .02em; }

/* Inspector: mood first, with compact property rows below */
.inspector { min-width: 0; min-height: 0; overflow: auto; padding: 20px 20px 18px; border-left: 1px solid var(--studio-line); background: var(--studio-sidebar); scrollbar-width: thin; scrollbar-color: #d7d7ca transparent; }
.inspector > .panel-heading { margin: 0 0 18px; }
.inspector > .panel-heading h2 { font-size: 13px; line-height: 20px; font-weight: 600; }
.inspector-section { margin: 0; padding: 16px 0; border: 0; border-top: 1px solid var(--studio-line); min-width: 0; }
.inspector-section:first-of-type { padding-top: 0; border-top: 0; }
.control-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.control-heading h3 { margin: 0; font-size: 12px; line-height: 18px; font-weight: 550; }
.studio-select { appearance: none; width: 100%; height: 34px; margin-bottom: 10px; padding: 0 36px 0 10px; border: 1px solid #dcdcd1; border-radius: 6px; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%237c7c70' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 14px 14px; background-position: right 12px center; color: #555549; font-size: 12px; cursor: pointer; }
.range-field { display: grid; grid-template-columns: 52px minmax(0, 1fr) 46px; align-items: center; column-gap: 8px; min-height: 36px; }
.range-field + .range-field { margin-top: 4px; }
.inspector-label { display: contents; }
.inspector-label > span { grid-column: 1; grid-row: 1; color: #737365; font-size: 12px; line-height: 18px; }
.inspector-label output { grid-column: 3; grid-row: 1; color: #555548; font: 11px/18px var(--font-stack-mono); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.studio-page input.studio-range { grid-column: 2; grid-row: 1; position: relative; display: block; appearance: none; width: 100%; min-width: 0; height: 28px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.studio-page input.studio-range::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, #656557 0 var(--fill,50%), #e4e4d9 var(--fill,50%) 100%); }
.studio-page input.studio-range::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 1px solid #b8b8a8; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #2020180a; }
.studio-page input.studio-range:hover::-webkit-slider-thumb { border-color: #858575; }
.studio-page input.studio-range::-moz-range-track { height: 3px; border-radius: 3px; background: #e4e4d9; }
.studio-page input.studio-range::-moz-range-progress { height: 3px; background: #656557; }
.studio-page input.studio-range::-moz-range-thumb { width: 11px; height: 11px; border: 1px solid #b8b8a8; border-radius: 50%; background: #fff; }
.reset-tuning { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 34px; border: 1px solid #deded2; border-radius: 7px; background: transparent; color: #757565; font-size: 11px; }
.reset-tuning:hover { background: #eeeee6; color: #414136; }
.reset-tuning .icon { width: 12px; height: 12px; }

/* The quadrant keeps the same coordinates and keyboard behavior. */
.mood-section { position: relative; }
.mood-field { z-index: 0; }
.mood-field:before {
  content: '';
  position: absolute;
  inset: -50%;
  z-index: -1;
  background: radial-gradient(ellipse 68% 72% at var(--glow-x,50%) var(--glow-y,50%),
    rgba(var(--mood-glow,193,196,183),var(--glow-alpha,.12)) 0%,
    rgba(var(--mood-glow,193,196,183),calc(var(--glow-alpha,.12) * .58)) 32%,
    rgba(var(--mood-glow,193,196,183),calc(var(--glow-alpha,.12) * .16)) 62%,
    rgba(var(--mood-glow,193,196,183),0) 84%);
  pointer-events: none;
}
.mood-pad { position: relative; isolation: isolate; width: 100%; aspect-ratio: 1.2; overflow: hidden; border: 1px solid #ddddd1; border-radius: 8px; background: #f7f7f3; cursor: crosshair; touch-action: none; user-select: none; }
.mood-field { position: absolute; inset: 25px 14px; }
.mood-cross { position: absolute; background: #d7d8cd9c; pointer-events: none; }
.mood-cross-horizontal { top: 50%; right: 0; left: 0; height: 1px; }
.mood-cross-vertical { top: 0; bottom: 0; left: 50%; width: 1px; }
.mood-energy-label { position: absolute; right: 0; left: 0; color: #aaa99d; font-size: 10px; font-weight: 350; line-height: 1; text-align: center; pointer-events: none; }
.mood-energy-high { top: 9px; }
.mood-energy-low { bottom: 9px; }
.mood-point { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; transform: translate(-50%,-50%); border: 2px solid #fff; border-radius: 50%; background: #46463b; box-shadow: 0 1px 3px #20201824, 0 0 0 5px #ffffff65; pointer-events: none; }
.mood-valence-axis { position: absolute; top: 50%; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; height: 16px; transform: translateY(-23px); color: #aaa99d; font-size: 10px; font-weight: 350; line-height: 16px; pointer-events: none; }
.mood-description { min-height: 34px; margin: 8px 0 0; color: #7b7b6c; font-size: 11px; line-height: 17px; }
.mood-description strong { color: #555547; font-weight: 550; }
.studio-page input.mood-axis-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (min-width: 1600px) {
  .studio-layout { grid-template-columns: 208px minmax(0,1fr) 300px; }
  .studio-main { padding: 28px; gap: 20px; }
  .signal-pair { gap: 20px; }
  .signal-pane { padding: 20px; }
}
@media (min-width: 881px) and (max-width: 1100px) {
  .studio-layout { grid-template-columns: 164px minmax(0,1fr) 264px; }
  .studio-main { grid-template-rows: 430px minmax(280px,1fr); padding: 20px; gap: 16px; }
  .signal-pair { grid-template-columns: minmax(0,1fr); grid-template-rows: repeat(2,minmax(0,1fr)); gap: 12px; }
  .signal-pane { padding: 12px 16px; }
  .signal-pane-heading { margin-bottom: 6px; min-height: 26px; }
  .signal-canvas { min-height: 95px; }
  .graph-scale { margin-top: 8px; }
  .inspector { padding-right: 16px; padding-left: 16px; }
  .range-field { grid-template-columns: 48px minmax(0,1fr) 43px; column-gap: 6px; }
  .inspector-label > span { font-size: 11px; }
}
@media (min-width: 881px) and (max-height: 820px) {
  .inspector { padding-top: 16px; padding-bottom: 14px; }
  .inspector > .panel-heading { margin-bottom: 14px; }
  .inspector-section { padding-top: 12px; padding-bottom: 12px; }
  .inspector-section:first-of-type { padding-top: 0; }
  .control-heading { margin-bottom: 8px; }
  .mood-pad { aspect-ratio: 1.35; }
  .mood-description { min-height: 32px; }
  .studio-select { margin-bottom: 8px; }
}
@media (max-width: 880px) {
  .studio-page { height: auto; overflow: visible; }
  .studio-header { position: sticky; top: 0; z-index: 10; padding: 0 18px; }
  .studio-brand { gap: 9px; }
  .studio-actions { gap: 12px; }
  .gallery-link { display: none; }
  .studio-layout { display: grid; grid-template-columns: minmax(0,1fr); height: auto; }
  .library-panel { padding: 18px 16px 0; border: 0; background: transparent; overflow: visible; }
  .library-panel .panel-heading { margin: 0 2px 10px; }
  .library-list { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
  .library-item { justify-content: center; gap: 6px; min-height: 42px; padding: 8px; }
  .library-icon { width: 20px; height: 20px; }
  .library-icon .icon { width: 17px; height: 17px; }
  .library-copy strong { font-size: 12px; }
  .studio-main { grid-template-rows: auto 290px; height: auto; min-height: 0; gap: 16px; padding: 16px; overflow: visible; }
  .signal-pair { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .signal-pane { height: 250px; padding: 16px; }
  .signal-canvas { min-height: 120px; }
  .component-panel { padding: 16px 20px 0; }
  .component-toolbar { min-height: 26px; }
  .studio-specimens, .studio-specimens .surface { min-height: 160px; }
  .component-footer { min-height: 44px; font-size: 11px; }
  .inspector { margin: 0 16px 20px; padding: 20px; border: 1px solid var(--studio-line); border-radius: var(--studio-radius); background: #fff; overflow: visible; }
  .inspector > .panel-heading { margin-bottom: 18px; }
  .inspector > .panel-heading h2 { font-size: 14px; }
  .mood-pad { max-width: 300px; aspect-ratio: 1.12; margin-inline: auto; }
  .mood-valence-axis { max-width: 300px; margin-inline: auto; font-size: 10px; }
  .mood-energy-label { font-size: 10px; }
  .mood-field { inset: 27px 18px; }
  .mood-point { width: 16px; height: 16px; }
  .mood-description { min-height: 0; margin-top: 10px; font-size: 12px; line-height: 18px; }
  .range-field { grid-template-columns: 58px minmax(0,1fr) 50px; min-height: 44px; column-gap: 10px; }
  .inspector-label > span { font-size: 12px; }
  .inspector-label output { font-size: 11px; }
  .studio-page input.studio-range { height: 36px; }
  .studio-page input.studio-range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6.5px; }
  .studio-page input.studio-range::-moz-range-thumb { width: 15px; height: 15px; }
  .studio-select { height: 38px; }
  .reset-tuning { min-height: 38px; font-size: 12px; }
}
@media (max-width: 600px) {
  .library-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .library-item { min-height: 42px; }
  .signal-pair { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .signal-pane { height: 216px; }
  .signal-pane-heading { margin-bottom: 8px; }
  .signal-canvas { min-height: 100px; }
  .graph-scale { margin-top: 10px; }
  .studio-main { grid-template-rows: auto 280px; }
  .component-panel { padding-right: 18px; padding-left: 18px; }
  .component-footer { align-items: center; gap: 8px; font-size: 11px; }
}
@media (min-width: 601px) and (max-width: 880px) {
  .inspector { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 24px; }
  .inspector > .panel-heading { grid-column: 1 / -1; }
  .inspector .mood-section { grid-column: 1; grid-row: 2 / span 3; padding: 0; }
  .inspector-section[aria-labelledby=motion-heading] { grid-column: 2; grid-row: 2; padding-top: 0; border-top: 0; }
  .inspector-section[aria-labelledby=sound-heading] { grid-column: 2; grid-row: 3; }
  .reset-tuning { grid-column: 2; grid-row: 4; align-self: end; }
}
@media (max-width: 360px) {
  .studio-header { padding: 0 14px; }
  .studio-brand { gap: 8px; }
  .studio-brand strong { font-size: 16px; }
  .studio-brand .studio-title { font-size: 12px; }
  .studio-page .sound-control { gap: 7px; padding: 0 10px; font-size: 11px; }
  .library-panel { padding-right: 12px; padding-left: 12px; }
  .library-item { padding: 7px 5px; gap: 4px; }
  .graph-scale { font-size: 9px; }
  .studio-main { padding: 12px; gap: 12px; }
  .inspector { margin-right: 12px; margin-left: 12px; padding: 16px; }
}

/* Optional full-duration sound mapping; the existing controls keep their layout. */
.curve-follow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:36px;margin-top:8px;border-radius:6px;color:#737365;font-size:12px;cursor:pointer}.curve-follow>span{pointer-events:none}.curve-follow-input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.curve-follow-track{position:relative;flex-shrink:0;width:28px;height:16px;border:1px solid #c8c8ba;border-radius:20px;background:#e6e6dc}.curve-follow-track:after{content:'';position:absolute;left:1px;top:1px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #20201818}.curve-follow-input:checked+.curve-follow-track{border-color:#57574a;background:#57574a}.curve-follow-input:checked+.curve-follow-track:after{transform:translateX(12px)}
@media(max-width:880px){.curve-follow{min-height:40px}}
