/* Page-specific studio surfaces; shared colors and chrome come from theme.css. */
.editor-page {
  --editor-bg: var(--bg, #10121c);
  --editor-panel: var(--panel, #181b29);
  --editor-surface: var(--surface, #212536);
  --editor-line: var(--line, #383b50);
  --editor-text: var(--text, #f7f4ff);
  --editor-muted: var(--muted, #b6b5c9);
  --editor-amber: var(--accent, #ffab62);
  --editor-violet: var(--violet, #b9a9ff);
  --control-edge: #686982;
  --studio-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: dark;
  margin: 0;
  color: var(--editor-text);
  background: var(--editor-bg);
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}
.editor-page .site-mark svg { display: block; flex: none; }
.editor-main, .editor-main *, .editor-main *::before, .editor-main *::after { box-sizing: border-box; }
.editor-main [hidden] { display: none !important; }
.editor-main {
  max-width: 87rem;
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(.75rem, 3vw, 2rem) 3rem;
}
.editor-main a { color: var(--editor-violet); text-underline-offset: .2em; }
.editor-main a:hover { color: var(--editor-text); }
.editor-main h1, .editor-main h2, .editor-main h3, .editor-main p { margin: 0 0 .6rem; }
.editor-main h2 { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.2; letter-spacing: -.02em; }
.editor-main h3 { font-size: 1.02rem; line-height: 1.25; }
.editor-intro {
  margin-bottom: 1rem;
  padding: clamp(1rem, 2.5vw, 1.75rem);
  border: 1px solid var(--editor-line);
  border-radius: .9rem;
  background: radial-gradient(ellipse at 86% 0%, #b9a9ff19, transparent 65%), var(--editor-panel);
}
.editor-intro .eyebrow {
  color: var(--editor-amber);
  font: 700 .75rem/1.4 var(--studio-mono);
  text-transform: uppercase;
  letter-spacing: .14em;
}
.editor-intro h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.06; letter-spacing: -.04em; }
.editor-description { max-width: 65ch; color: var(--editor-muted); }
#track { color: var(--editor-violet); font-weight: 700; overflow-wrap: anywhere; }
#track:empty, .editor-main [role=status]:empty { display: none; }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; }
.intro-actions p { margin: 0; }

.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.workspace > section, #local-project {
  min-width: 0;
  padding: clamp(.75rem, 2vw, 1.25rem);
  border: 1px solid var(--editor-line);
  border-radius: .85rem;
  background: var(--editor-panel);
  box-shadow: 0 .5rem 1.5rem #08091336;
}
#local-project { max-width: 58rem; margin-bottom: 1rem; }
.panel-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .35rem 1rem; margin-bottom: .75rem; }
.panel-heading h2 { margin: 0; }
.panel-tag {
  padding: .2rem .45rem;
  border: 1px solid var(--editor-line);
  border-radius: .3rem;
  background: var(--editor-bg);
  color: var(--editor-violet);
  font: 650 .69rem/1.3 var(--studio-mono);
  letter-spacing: .12em;
}

/* Keep the monitor chrome outside the canvas so preview/export pixels stay unchanged. */
.preview-frame { padding: clamp(.25rem, .7vw, .5rem); border: 1px solid var(--editor-line); border-radius: .65rem; background: #0d0e17; }
#preview { display: block; width: 100%; height: auto; border-radius: .3rem; background: #0a0b12; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .65rem; margin: .6rem 0; }
.editor-main label { color: var(--editor-muted); }
.controls label { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-width: 0; }
.controls :is(input, select) { max-width: 100%; }
.playback, .timeline-controls {
  padding: .55rem;
  border: 1px solid var(--editor-line);
  border-radius: .55rem;
  background: var(--editor-bg);
}
#time {
  margin-inline-start: auto;
  padding: .3rem .5rem;
  border: 1px solid var(--editor-line);
  border-radius: .35rem;
  background: #0d0e17;
  color: var(--editor-amber);
  font: 650 .92rem/1.5 var(--studio-mono);
  font-variant-numeric: tabular-nums;
}
.editor-main :is(button, input, select, textarea) { font: inherit; }
.editor-main :where(button, select, input:not([type=checkbox], [type=range]), textarea) {
  min-width: 0;
  max-width: 100%;
  min-height: 2.5rem;
  padding: .45rem .65rem;
  border: 1px solid var(--control-edge);
  border-radius: .4rem;
  background: var(--editor-surface);
  color: var(--editor-text);
}
.editor-main :is(input:not([type=checkbox], [type=range]), textarea) { background: var(--editor-bg); }
.editor-main button { font-weight: 650; cursor: pointer; overflow-wrap: anywhere; }
.editor-main button:not(:disabled):hover { border-color: var(--editor-violet); }
.editor-main button:disabled { opacity: .55; cursor: default; }
.editor-main :is(button.primary, #open-portable) { color: #251408; border-color: var(--editor-amber); background: var(--editor-amber); }
.editor-main :is(button.primary, #open-portable):not(:disabled):hover { background: #ffc08b; border-color: #ffc08b; }
.editor-main :is(#play, #timeline-play) { min-width: 5rem; color: var(--editor-violet); }
.editor-main :is(input[type=range], input[type=checkbox], progress) { accent-color: var(--editor-amber); }
.editor-main :is(input[type=range], input[type=checkbox]) { margin: 0; }
.editor-page :focus-visible { outline: 2px solid var(--editor-amber); outline-offset: 3px; }
.editor-main textarea { display: block; width: 100%; margin: .45rem 0; resize: vertical; }
.editor-main textarea::placeholder { color: var(--editor-muted); opacity: 1; }
.editor-main fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.editor-main fieldset > label { display: grid; gap: .25rem; }
.editor-main fieldset:disabled label { opacity: .7; }
.editor-main summary { cursor: pointer; min-height: 2.5rem; padding: .5rem 0; font-weight: 700; }
.editor-main summary::marker { color: var(--editor-violet); }
.editor-main summary:hover { color: var(--editor-violet); }
.editor-main .hint, .editor-main [role=status] { color: var(--editor-muted); font-size: .9rem; overflow-wrap: anywhere; }
.editor-main progress { width: 100%; }

#open-portable + input + .hint { margin-top: .6rem; }
#local-files { margin-top: .75rem; border-top: 1px solid var(--editor-line); }
#pair-project { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: .65rem; align-items: end; }
#pair-project label { display: grid; gap: .25rem; min-width: 0; }
#pair-project input { width: 100%; }
#pair-project button { justify-self: start; }
.editor-main input::file-selector-button {
  border: 0;
  border-radius: .25rem;
  padding: .3rem .5rem;
  margin-inline-end: .5rem;
  background: var(--editor-surface);
  color: var(--editor-text);
  font: inherit;
  cursor: pointer;
}
.watch > section, .watch > details { margin-top: .65rem; border-top: 1px solid var(--editor-line); }
.watch > section { padding-top: .9rem; }
.editor-main .lyric-style { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .75rem; margin: .65rem 0; }
.lyric-style legend { font-weight: 650; margin-bottom: .25rem; }
.lyric-style input, #cue-text { width: 100%; }
.bounds { align-items: end; }
.bounds label { display: grid; }
.bounds input { width: 7em; }
#lyrics-search { align-items: end; }
#lyrics-search label { display: grid; flex: 1 1 8rem; }
#lyrics-search input { width: 100%; }
#search-results { list-style: none; padding: 0 .3rem; margin: 0; max-height: 17rem; overflow: auto; }
#search-results:empty { display: none; }
#search-results li { display: grid; gap: .2rem; margin-block: .35rem; }
#search-results button { text-align: start; }

/* editor.mjs draws the ruler at 3.5rem and sizes the waveform using the lane offset. */
.timing { --ruler-width: 3.5rem; --wave-width: clamp(4.5rem, 10vw, 7rem); }
.timeline-controls input[type=range] { width: 6.5rem; min-height: 1.5rem; }
.lane-head {
  display: grid;
  grid-template-columns: var(--ruler-width) var(--wave-width) minmax(0, 1fr);
  overflow: hidden;
  scrollbar-gutter: stable;
  border: 1px solid var(--editor-line);
  border-bottom: 0;
  border-radius: .5rem .5rem 0 0;
  background: var(--editor-surface);
  color: var(--editor-muted);
  font: 650 .74rem/1.3 var(--studio-mono);
}
.lane-head span { min-width: 0; padding: .5rem .3rem; overflow-wrap: anywhere; }
.lane-head span + span { border-inline-start: 1px solid var(--editor-line); }
#timeline {
  position: relative;
  height: clamp(290px, 51vh, 650px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #121421;
  border: 1px solid var(--editor-line);
  border-radius: 0 0 .5rem .5rem;
}
#axis { position: relative; min-height: 1px; overflow: hidden; }
#waveform { position: absolute; top: 0; left: 0; width: 100%; pointer-events: none; }
#cue-lane { position: absolute; inset: 0 0 0 calc(var(--ruler-width) + var(--wave-width)); }
.editor-main .cue {
  position: absolute;
  left: .25rem;
  right: .35rem;
  display: flex;
  align-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 0 .5rem;
  border: 0;
  border-radius: .3rem;
  background: #30284b;
  box-shadow: inset 0 0 0 1px #7768ac, inset 3px 0 #9c89ed;
  text-align: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.editor-main .cue:hover { background: #423561; }
.editor-main .cue[aria-pressed=true] { background: #513520; box-shadow: inset 0 0 0 1px var(--editor-amber), inset 3px 0 var(--editor-amber); z-index: 1; }
.editor-main .cue:focus-visible { outline-color: var(--editor-text); outline-offset: -3px; z-index: 2; }
.editor-main .cue.dragging { cursor: grabbing; z-index: 2; }
.cue-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; pointer-events: none; }
.trim { position: absolute; left: 0; right: 0; height: min(8px, 27%); cursor: ns-resize; background: #f7f4ff24; }
.trim:hover { background: #f7f4ff70; }
.trim.start { top: 0; }
.trim.end { bottom: 0; }
#playhead { position: absolute; inset: 0 0 auto 0; height: 0; border-top: 2px solid var(--editor-amber); z-index: 3; pointer-events: none; }
#playhead::after { content: ""; position: absolute; top: -1px; left: 0; border: 5px solid transparent; border-left-color: var(--editor-amber); }
#timing-status { flex-basis: 100%; margin: 0; }
#wave-status { margin-block: .55rem; }
.tray-head { justify-content: space-between; margin-top: 1rem; }
.tray-head h3 { margin: 0; }
#untimed { margin: .4rem 0 .75rem; padding: .25rem .35rem .25rem 1.85rem; max-height: 13rem; overflow: auto; }
#untimed li { margin-bottom: .35rem; }
#untimed li::marker { color: var(--editor-muted); font: .8rem var(--studio-mono); }
#untimed button { width: 100%; text-align: start; }
#untimed button[aria-pressed=true] { border-color: var(--editor-amber); background: #513520; }

@media (max-width: 56rem) { .workspace { grid-template-columns: minmax(0, 1fr); } }
@media (forced-colors: active) {
  .editor-main .cue, .editor-main .cue:hover { box-shadow: inset 0 0 0 1px ButtonText; forced-color-adjust: none; background: ButtonFace; color: ButtonText; }
  .editor-main .cue[aria-pressed=true] { box-shadow: inset 0 0 0 1px HighlightText; background: Highlight; color: HighlightText; }
  .editor-main .cue:focus-visible { outline-color: ButtonText; }
  .editor-main .cue[aria-pressed=true]:focus-visible { outline-color: HighlightText; }
  .editor-main .trim { background: GrayText; }
  #playhead { border-top-color: Highlight; }
  #playhead::after { border-left-color: Highlight; }
  #untimed button[aria-pressed=true] { border-color: Highlight; background: Highlight; color: HighlightText; }
}
