:root {
  color-scheme: dark;
  --paper: #0f1512;
  --ink: #e8eee8;
  --muted: #a2afa6;
  --line: #343f38;
  --white: #19211d;
  --raised: #222d26;
  --lime: #c4efa6;
  --coral: #fa967e;
  --violet: #c4bcff;
  --gold: #ecc88b;
  --mint: #9ddcd0;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --lane-label: 164px;
  accent-color: var(--lime);
}
* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper) radial-gradient(ellipse at 30% 0, #19251b 0, transparent 54rem) no-repeat;
  font: 15px/1.45 "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .43; cursor: default; }
:is(button, a, input, select, svg, summary):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { font-family: Manrope, system-ui, sans-serif; margin: 0; line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: clamp(26px, 3vw, 38px); }
h3 { font-size: 17px; }
p { margin: 0; color: var(--muted); }
p + p { margin-top: 9px; }
.wrap { max-width: 1320px; margin: auto; padding: 0 clamp(18px, 4vw, 56px) max(42px, env(safe-area-inset-bottom)); }
.top { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.brand, .brand a, .studio-nav { display: inline-flex; align-items: center; }
.brand { gap: 16px; font-size: 28px; letter-spacing: -.075em; font-weight: 800; }
.brand a { gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { border: 1px solid #465542; border-radius: 10px; }
.brand > span { padding-left: 16px; border-left: 1px solid #4a574d; color: var(--muted); font: 500 15px "DM Sans", sans-serif; letter-spacing: 0; }
.studio-nav { gap: 16px; }
.chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 11px/1.3 var(--mono); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.chip.ok::before { background: var(--lime); box-shadow: 0 0 0 3px #c4efa60f; }
.chip.warn { color: var(--coral); }
.chip.warn::before { background: currentColor; }
.studio-loading { display: grid; align-content: center; justify-items: center; gap: 14px; min-height: min(510px, 64vh); }
.studio-loading img { border-radius: 12px; }
.row, .transport { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.micro { font-size: 12px; color: var(--muted); }
.card, .songs li { border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 15px; background: var(--white); }
input:not([type="checkbox"]):not([type="range"]), select {
  min-height: 42px; min-width: 0; max-width: 100%; border: 1px solid #4b584f; border-radius: 7px;
  padding: 8px 11px; color: var(--ink); background: #111915;
}
input[type="checkbox"] { width: 19px; height: 19px; }
input[type="range"] { min-height: 28px; padding: 0; max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; min-width: 0; }
.field input, .field select { font-size: 14px; }
.button, .toggle, .icon-button, .footer-action {
  display: inline-flex; justify-content: center; align-items: center; gap: 9px; touch-action: manipulation;
  border: 1px solid transparent; font-weight: 600; text-decoration: none; color: var(--ink);
}
.button, .toggle { min-height: 44px; padding: 9px 15px; border-radius: 8px; background: var(--lime); color: #1d2b18; font-size: 14px; }
.button.small { padding: 6px 12px; min-height: 40px; font-size: 13px; }
.button.outline, .toggle { background: #202a24; border-color: var(--line); color: var(--ink); }
.button.record, .button.danger { background: var(--coral); color: #321c15; }
.icon-button { flex: 0 0 auto; width: 44px; height: 44px; padding: 9px; background: transparent; border-radius: 8px; }
.icon-button svg, .studio-icon { flex: none; pointer-events: none; }
.icon-button[aria-pressed=true], .button[aria-pressed=true], .toggle.on { background: var(--lime); border-color: var(--lime); color: #1d2b18; }
.delete-track { color: var(--coral); }
@media (hover:hover) {
  .icon-button:hover:enabled, a.icon-button:hover, .button.outline:hover:enabled { background: #344139; }
  .icon-button[aria-pressed=true]:hover:enabled, .button[aria-pressed=true]:hover:enabled,
  .button:not(.outline):not(.record):not(.danger):hover:enabled { background: #d6f8bd; color: #192318; }
  .button.record:hover:enabled, .button.danger:hover:enabled { background: #ffac94; }
}
.symbol-field { display: inline-flex; gap: 7px; align-items: center; min-width: 0; color: var(--muted); }
.symbol-field svg { flex: none; }
.symbol-field input[type=number] { width: 68px; }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Song and transport sit above both the track sheet and the six studio tools. */
.studio-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: clamp(20px, 3vw, 38px) 0 18px; }
.session-title { display: flex; align-items: center; gap: 5px; min-width: 0; }
.session-title h2 { overflow-wrap: anywhere; font-weight: 650; }
.session-title .icon-button { color: var(--muted); }
.studio-heading > .icon-button { border-color: var(--line); background: var(--white); }
.studio-deck {
  display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); min-height: 78px; padding: 12px 18px;
  border: 1px solid #465446; border-radius: 12px; background: linear-gradient(102deg, #2b382c, #222c25 46%, #1d2720);
}
.deck-transport, .deck-readouts { display: flex; align-items: center; gap: 7px; }
.deck-transport .icon-button { width: 48px; height: 46px; border: 1px solid #51604f; background: #18211a; }
.deck-transport .transport-play { color: var(--lime); }
.deck-transport .transport-record { color: var(--coral); }
.deck-transport .transport-stop { color: var(--ink); }
.deck-clock { border-left: 1px solid #4b594c; padding-left: clamp(14px, 2.4vw, 34px); color: var(--lime); }
#studio-time { font: 500 clamp(23px, 3vw, 35px)/1.12 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.08em; }
.deck-readouts { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; column-gap: clamp(10px, 2vw, 24px); color: #c2cec4; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.deck-readouts > * { display: inline-flex; align-items: center; gap: 7px; }
.deck-readouts svg { width: 16px; height: 16px; color: #a0ac9f; }
.studio-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 14px; }
.studio-workspace > * { min-width: 0; }
.wrap:has(.studio-session) { max-width: none; }
.studio-launchers { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; }
.studio-launch {
  --tool: var(--lime);
  min-width: 0; min-height: 97px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  text-align: center; padding: 10px 6px; border: 1px solid #404b43; border-radius: 10px; color: var(--tool);
  background: linear-gradient(146deg, #252f28, #1b241f); box-shadow: inset 0 1px #ffffff06; touch-action: manipulation;
}
.studio-launch svg { width: 28px; height: 28px; }
.studio-launch[data-tool=record] { --tool: var(--coral); }
.studio-launch[data-tool=keys] { --tool: var(--violet); }
.studio-launch[data-tool=sequence] { --tool: var(--gold); }
.studio-launch[data-tool=mix] { --tool: var(--mint); }
.studio-launch[data-tool=import] { --tool: #adcaec; }
.studio-launch .tool-label { font-size: 12px; font-weight: 600; color: var(--ink); }
.studio-launch[aria-pressed=true] { border-color: var(--tool); background: color-mix(in srgb, var(--tool) 13%, #19211d); }
@media (hover:hover) { .studio-launch:hover:enabled { background: #2b382f; border-color: var(--tool); } }
.arrangement { padding: 0; overflow: hidden; }
.studio-workspace .arrangement { margin: 0; }
.timeline-toolbar { padding: 2px 10px 2px 16px; min-height: 52px; border-bottom: 1px solid var(--line); }
.timeline-toolbar .row { gap: 3px; }
.timeline-heading { color: var(--muted); }
.timeline-heading h3 { margin-left: 5px; font: 600 14px Manrope, sans-serif; letter-spacing: -.01em; color: var(--ink); }
.timeline-zoom .icon-button { width: 40px; height: 40px; color: var(--muted); }
.timeline-zoom svg { width: 17px; }
.timeline-scroll { overflow: auto; overscroll-behavior-x: contain; }
.timeline-content { position: relative; }
.arrangement + .studio-deck { margin-top: 12px; }
.arrange-lane { position: relative; display: flex; overflow: hidden; min-width: 0; }
.arrange-lane .track-surface { touch-action: pan-y; cursor: grab; user-select: none; }
.arrange-lane .track-surface:active { cursor: grabbing; }
.clip-end { position: absolute; bottom: 0; transform: translateX(-100%); min-width: 44px; height: 44px; border: 0; border-right: 3px solid var(--track); background: linear-gradient(90deg, transparent, #1d3025cc); color: var(--track); cursor: ew-resize; touch-action: pan-y; }
.arrange-length { display: flex; align-items: center; gap: 6px; color: var(--muted); font: 11px var(--mono); }
.arrange-length input { width: clamp(52px, 12vw, 150px); height: 44px; padding: 0; accent-color: var(--mint); }
.timeline-toolbar { flex-wrap: wrap; }
.timeline-zoom { flex-wrap: wrap; }
.arrange-lane { background: repeating-linear-gradient(90deg,#141f18 0 calc(6.25% - 1px),#283329 calc(6.25% - 1px) 6.25%); }
.arrange-lane .track-surface { position: absolute; height: 74px; min-width: 5px; touch-action: none; border: 1px solid var(--track); border-radius: 5px; }
.arrange-lane .track-drawing { height: 100%; }
.arrange-lane .track-surface[data-selected=true] { outline: 2px solid var(--track); outline-offset: -3px; }
.take-caption { position: absolute; top: 2px; left: 5px; pointer-events: none; color: var(--ink); font: 11px var(--mono); white-space: nowrap; }
.arrange-lane .clip-end { bottom: auto; height: 34px; margin-top: 10px; user-select: none; }
.new-take-lane { text-align: center; padding: 6px; color: var(--muted); border-block: 1px dashed var(--line); }
.drop-active { box-shadow: inset 0 0 0 2px var(--mint); background-color: #293c30; }
.arrange-lane.drop-active::after { content: ''; position: absolute; inset-block: 2px; left: var(--drop-left); width: var(--drop-width, 0); border-radius: 5px; background: #aeedab38; pointer-events: none; }
@media (pointer:coarse) {
  .arrangement .song-ruler, .arrangement .ruler-row .timeline-label { height: 44px; }
  .arrange-lane .clip-end { margin-top: 0; height: 44px; }
  .new-take-lane { min-height: 44px; }
}
.timeline-row { display: grid; grid-template-columns: var(--lane-label) minmax(0, 1fr); min-height: 90px; border-bottom: 1px solid var(--line); }
.timeline-row:last-of-type { border-bottom: 0; }
.ruler-row { min-height: 33px; align-items: center; background: #19241d; }
.empty-arrangement .ruler-row { grid-template-columns: 1fr; }
.empty-arrangement .ruler-row .timeline-label { display: none; }
.empty-arrangement .song-marker-layer { left: 0; }
.timeline-label { position: sticky; left: 0; z-index: 2; background: var(--white); border-right: 1px solid var(--line); padding: 6px 10px; min-width: 0; }
.ruler-row .timeline-label { height: 32px; display: flex; align-items: center; background: #1d2920; color: #abbbaf; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.track-name { min-height: 32px; display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; }
.track-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; }
.track-actions .icon-button { width: 100%; height: auto; min-height: 44px; padding: 3px 2px; flex-direction: column; justify-content: start; gap: 3px; }
.track-actions .icon-button svg { width: 17px; height: 17px; flex: none; }
.track-actions .icon-button span { font: 600 10px/1.2 Manrope,sans-serif; overflow-wrap: anywhere; }
.track-actions .cue-scope { grid-column: 1 / 3; text-align: center; font-size: 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
.track-actions .icon-button { grid-row: 2; }
.control-hint { position: fixed; inset: auto; margin: 0; max-width: min(22rem,calc(100vw - 8px)); padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: #26352a; color: var(--ink); font: 13px/1.4 Manrope,sans-serif; pointer-events: none; }
.language-choice { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.language-choice select { width: auto; max-width: 13rem; }
/* Song time, piano pitch, and stereo position increase to the physical right. */
.timeline-content, .editor-surface, .piano-keys, .pedal-chain { direction: ltr; }
[dir=rtl] .timeline-label { direction: rtl; }
[dir=rtl] .track-name { text-align: start; }
.timeline-row[data-kind] { --track: var(--mint); }
.timeline-row[data-kind=keys] { --track: var(--violet); }
.timeline-row[data-kind=drums] { --track: var(--gold); }
.timeline-row[data-kind] .timeline-label { box-shadow: inset 3px 0 var(--track); }
.track-surface, .empty-tracks { background-color: #131d17; background-image: linear-gradient(to right, #95af8b17 1px, transparent 1px); background-size: 6.25% 100%; }
.track-surface { width: 100%; min-width: 0; padding: 0; border: 0; overflow: hidden; text-align: left; touch-action: pan-x pan-y; }
.track-drawing { display: block; width: 100%; height: 84px; }
.song-ruler { width: 100%; height: 28px; display: block; cursor: crosshair; touch-action: none; }
.ruler-ink { stroke: #718274; fill: var(--muted); stroke-width: 1; }
.ruler-ink text { stroke: none; font: 10px var(--mono); }
.clip-area { fill: color-mix(in srgb, var(--track, var(--mint)) 15%, #142018); }
.wave-peaks, .wave-center { stroke: var(--track, var(--mint)); }
.wave-raw { stroke: #a0b2a2; opacity: .32; }
.wave-center { stroke-width: .5; opacity: .4; }
.wave-loading { fill: var(--muted); font-size: 12px; }
.thumbnail-note.normal { fill: var(--track, var(--violet)); }
.thumbnail-note.adjusted { fill: color-mix(in srgb, var(--track, var(--violet)), white 28%); }
.song-marker-layer { position: absolute; z-index: 1; inset: 0 0 0 var(--lane-label); overflow: hidden; pointer-events: none; }
.song-playhead { position: absolute; inset: 0; width: 100%; border-left: 2px solid var(--gold); }
.song-playhead::before { content: ""; position: absolute; top: 0; left: -4px; width: 8px; height: 7px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.empty-tracks {
  min-height: 220px; display: grid; place-items: center; padding: 20px; text-align: center;
  background-image: linear-gradient(to right, #8ca48317 1px, transparent 1px), linear-gradient(to bottom, #8ca48313 1px, transparent 1px);
  background-size: 6.25% 100%, 100% 25%;
}
.starter-card {
  display: grid; width: min(318px,100%); padding: 14px 16px 12px; gap: 14px;
  background: linear-gradient(120deg,#2f3831,#242d27); color: var(--ink); border: 1px solid #56624f; border-radius: 10px;
  box-shadow: 0 5px 0 #0b130e, inset 0 1px #ffffff0b;
}
.starter-caption { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 13px; font-weight: 600; }
.starter-caption svg { color: var(--gold); }
.starter-signature { margin-left: auto; border: 1px solid #5c685b; padding: 1px 5px; border-radius: 3px; color: #c4d0c5; font: 10px/1.4 var(--mono); }
.starter-grid { display: block; width: 100%; height: auto; }
.step-rest { fill: #465147; }
.step-hit.drum-42 { fill: var(--mint); }
.step-hit.drum-38 { fill: var(--violet); }
.step-hit.drum-36 { fill: var(--coral); }
@media (hover:hover) { .starter-card:hover:enabled { border-color: var(--gold); } }
@media (hover:hover) { .track-surface:hover:enabled { background-color: #1b2a20; } }
.record-panel, .mix-panel, .master-panel { scroll-margin-top: 12px; }
.mix-channels { display: grid; gap: 8px; }
.meter { height: 6px; border-radius: 3px; background: #0e1711; overflow: hidden; margin: 10px 0; }
.meter i { display: block; width: 100%; height: 100%; background: var(--lime); transform-origin: left; transform: scaleX(0); }
.status, .error, .notice { font-size: 14px; }
.status:empty { display: none; }
.error { white-space: pre-wrap; color: #ffb5a1; margin: 10px 0; }
.notice { padding: 12px 14px; margin-top: 14px; border-left: 3px solid #728a6c; background: #212e24; border-radius: 6px; }
.report dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; }
.report dt { color: var(--muted); }
.report dd { margin: 0; }
.songs, .history { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.songs li, .history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.songs li { margin-top: 0; }
.history li { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
summary { width: fit-content; color: var(--ink); font-size: 14px; padding: 5px 0; }
.working { display: block; width: 100%; height: 4px; margin: 12px 0; }
.studio-footer { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.footer-bar, .device-links, .footer-bar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; }
.footer-bar { justify-content: space-between; gap: 0 20px; }
.footer-bar a, .footer-action { min-height: 42px; display: inline-flex; align-items: center; font-size: 12px; }
.footer-action, .footer-bar a { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: none; }
.footer-bar a:hover, .footer-action:hover { color: var(--ink); text-decoration: underline; }
.studio-heading .library-button, .icon-button:has(.tool-label) { width: auto; padding-inline: 13px; font-size: 13px; }
.studio-launch[aria-expanded=true] { border-color: var(--tool); background: color-mix(in srgb, var(--tool) 13%, #19211d); }
.symbol-field.field { flex-direction: row; }
.panel-title { display: flex; align-items: center; gap: 9px; color: var(--ink); font: 600 15px Manrope, sans-serif; }
.panel-title svg { color: var(--muted); }
.record-panel .panel-title svg, .record-panel .transport-record { color: var(--coral); }
.mix-panel .panel-title svg { color: var(--mint); }
.master-panel .panel-title svg { color: var(--lime); }
.record-panel > .row, .master-panel > .row { margin-top: 12px; }
.transport .micro { display: inline-flex; align-items: center; gap: 7px; }
details.card { padding: 0 18px; }
details.card[open] { padding-bottom: 16px; }
details.card > summary { display: flex; justify-content: flex-start; align-items: center; gap: 10px; width: 100%; min-height: 50px; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; margin-right: 5px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
details.card[open] > summary::after { transform: rotate(225deg); }
.mix-channels { grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); margin-top: 12px; }
.mix-channel { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 7px 13px 10px; background: #151d18; }
.mix-channel strong { overflow-wrap: anywhere; }
.mix-channel .mixer-mute { width: auto; max-width: 100%; gap: 6px; padding-inline: 8px; font-size: 12px; }
.mixer-mute svg { width: 17px; height: 17px; }
.mix-control { display: grid; align-items: center; grid-template-columns: 1fr auto; column-gap: 8px; margin-block-start: 8px; }
.mix-control-name { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.mix-control-name svg { color: var(--mint); flex: none; }
.mix-control output { text-align: end; color: var(--muted); font: 12px var(--mono); }
.mix-control input { grid-column: 1 / -1; width: 100%; margin: 0; }
.song-library { padding-top: 30px; }
.song-library h2 { gap: 12px; }
.songs li > div { overflow-wrap: anywhere; min-width: 0; }

/* The editor keeps the current tool set and its actual polytouch keyboard in one dialog. */
dialog { color: var(--ink); background: var(--white); border: 1px solid #49584c; border-radius: 14px; box-shadow: 0 24px 70px #0008; }
dialog::backdrop { background: #080d0ac9; }
.track-editor { width: min(1120px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 28px); padding: 18px; overflow: auto; overscroll-behavior: contain; }
.editor-header { display: flex; align-items: center; gap: 5px; margin: -6px 0 12px; position: sticky; top: -18px; z-index: 5; padding: 8px 0; border-bottom: 1px solid var(--line); background: var(--white); }
input.editor-name:not([type]) { min-width: 20px; width: 100%; flex: 1; background: transparent; border-color: transparent; font: 650 19px Manrope, sans-serif; }
.editor-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.editor-controls .field { flex-direction: row; align-items: center; }
.instrument-button { max-width: 100%; white-space: normal; }
.editor-surface { display: block; width: 100%; height: clamp(245px, 38vh, 390px); border: 1px solid #4a5850; border-radius: 8px; background: #16211a; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.editor-status { min-height: 22px; margin: 8px 0; }
.editor-details { display: grid; gap: 12px; }
.editor-details .row { gap: 8px; }
.editor-details input[type=range] { max-width: 180px; }
.timing-details, .editor-help { padding: 7px 0; border-top: 1px solid var(--line); }
.timing-details > .row { margin-top: 8px; }
.editor-help p { margin: 8px 0; }
.grid-row { fill: #25332a; stroke: #38473d; stroke-width: .5; }
.grid-row.black-key { fill: #19251e; }
.key-label { font: 11px var(--mono); fill: #cbd9cb; pointer-events: none; }
.grid-line { stroke: #405246; stroke-width: 1; }
.grid-bar { stroke: #728776; stroke-width: 1.5; }
.grid-beat { fill: #bfccbe; font: 12px var(--mono); pointer-events: none; }
.note { fill: var(--violet); stroke: #e5dfff; stroke-width: 1; }
.note.selected-note { fill: var(--gold); stroke: #fff4c2; stroke-width: 2; }
.velocity { fill: #766793; pointer-events: none; }
.velocity.adjusted { fill: #976c23; }
.note-value, .handle-label { fill: #1b2921; font-size: 10px; pointer-events: none; }
.selection-box { fill: #ecc88b22; stroke: var(--gold); stroke-dasharray: 4 3; pointer-events: none; }
.trim-line { stroke: var(--lime); stroke-width: 2; }
.trim-handle { fill: var(--lime); }
.handle-label { font-size: 13px; font-weight: bold; }
.fade-handle, .gain-point { fill: var(--gold); stroke: #ffebae; stroke-width: 2; }
.fade-label { fill: var(--gold); font-size: 12px; }
.gain-curve { fill: none; stroke: var(--gold); stroke-width: 2; }
.editor-playhead { stroke: var(--gold); stroke-width: 2; pointer-events: none; }
.voice-picker, .editor-prompt { width: min(500px, calc(100vw - 24px)); padding: 18px; max-height: 86dvh; }
.voice-picker > input { margin: 12px 0; width: 100%; }
.voice-list { display: grid; gap: 3px; max-height: 55dvh; overflow: auto; overscroll-behavior: contain; }
.voice-choice { padding: 12px; text-align: left; background: #1e2921; border: 1px solid transparent; border-radius: 6px; color: var(--ink); font-size: 14px; }
.voice-choice:hover, .voice-choice[aria-pressed=true] { background: #34463b; border-color: #4c6251; }
.editor-prompt > .field, .editor-prompt > .row, .editor-prompt > p, .editor-prompt > .button { margin-top: 12px; }
.editor-performance { margin: 14px 0; }
.editor-performance [data-test=record-notes] { color: var(--coral); background: #362a24; border-color: #63463a; }
.instrument-keys { margin: 12px 0; }
.instrument-keys > .row { margin-bottom: 8px; justify-content: flex-start; gap: 5px; color: var(--violet); }
.instrument-keys > .row :nth-child(2) { margin-left: auto; }
.piano-keys {
  display: grid; grid-template-columns: repeat(14, minmax(38px,1fr)); overflow-x: auto; overscroll-behavior-x: contain;
  padding: 3px 2px 12px; border-radius: 8px; background: #101713; scrollbar-width: thin;
}
.piano-key, .drum-pad { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; user-select: none; -webkit-user-select: none; }
.piano-key {
  grid-row: 1; grid-column: calc(var(--white-key) + 1); position: relative; height: 126px; min-width: 0; padding: 6px 1px;
  color: #303a33; background: linear-gradient(#cbd3c9, #edf1e9 55%); border: 1px solid #666f65;
  border-bottom: 5px solid #b2bcae; border-radius: 0 0 5px 5px; touch-action: pan-x; font: 10px var(--mono);
}
.piano-key.sharp {
  align-self: start; justify-self: end; z-index: 1; width: 63%; height: 79px; transform: translateX(50%); color: #ecf1eb;
  background: linear-gradient(#111813 5%,#283229 77%,#3a463d); border-color: #0a110c; border-bottom: 5px solid #121b15;
  box-shadow: 2px 3px 2px #09110a42;
}
.piano-key.pressed { background: var(--violet); color: #241d32; border-bottom-color: #a699ce; }
.piano-key.sharp.pressed { background: #8d84af; }
.piano-key:focus-visible, .drum-pad:focus-visible { outline-offset: -3px; outline-color: #826317; }
.drum-pads { display: grid; grid-template-columns: repeat(6,1fr); gap: 7px; }
.drum-pad { min-height: 70px; border: 1px solid #63684b; border-bottom-width: 3px; border-radius: 8px; color: #e9dfbe; background: #32362a; padding: 10px 5px; font-size: 12px; touch-action: none; }
.drum-pad.pressed { color: #282419; background: var(--gold); }
.instrument-keys kbd { display: none; font: 9px/1.4 var(--mono); }
@media (pointer:fine) { .instrument-keys kbd { display: block; padding-inline: 3px; border: 1px solid currentColor; border-radius: 3px; opacity: .7; } }
.editor-effects { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.pedal-chain { display: flex; gap: 14px; overflow-x: auto; padding: 12px 3px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.pedal { flex: 0 0 260px; max-width: 100%; padding: 12px; border: 1px solid var(--pedal-color); border-bottom-width: 4px; border-radius: 10px; background: linear-gradient(145deg,#303d33,#1b261e); color: var(--ink); scroll-snap-align: start; }
.pedal.bypassed { border-style: dashed; }
.pedal strong, .pedal-switch { color: var(--pedal-color); }
.pedal-switch { width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; background: #19251c; font-size: 23px; }
.pedal-switch[aria-pressed=true] { background: #304136; }
.pedal-knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; margin: 15px 0; }
.pedal-control { display: flex; align-items: center; flex-direction: column; min-width: 0; gap: 6px; font-size: 12px; text-align: center; }
.pedal-control input, .pedal-control select { width: 100%; min-width: 0; accent-color: var(--pedal-color); }
.pedal-control output { color: var(--muted); font: 11px var(--mono); }
.pedal-control.wet-dry { grid-column: 1/-1; }
.knob-face { width: 34px; height: 34px; border: 2px solid #8b9b8c; border-radius: 50%; background: #152118; transform: rotate(var(--turn)); position: relative; }
.knob-face::before { content: ""; position: absolute; width: 3px; height: 12px; top: 2px; left: 14px; border-radius: 2px; background: var(--pedal-color); }
.input-pedals { width: min(1000px,calc(100vw - 24px)); max-height: 90dvh; padding: 20px; overflow: auto; }
@media (max-width: 760px) {
  .wrap { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .top { min-height: 62px; }
  .studio-workspace { grid-template-columns: 1fr; }
  .studio-launchers { grid-row: 1; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
  .studio-launch { min-height: 74px; gap: 5px; }
  .studio-launch svg { width: 23px; height: 23px; }
  .studio-deck { min-height: 65px; padding: 8px 10px; }
  .empty-tracks { min-height: 170px; }
  .deck-readouts { gap: 12px; }
  .chip { font: 11px "DM Sans",sans-serif; }
}
@media (max-width: 540px) {
  :root { --lane-label: 144px; }
  .brand { gap: 10px; font-size: 25px; }
  .brand a { gap: 7px; }
  .brand img { width: 34px; height: 34px; }
  .brand > span { font-size: 13px; padding-left: 10px; }
  .studio-nav { gap: 4px; }
  .chip { max-width: 92px; }
  .studio-heading { padding: 18px 0 12px; }
  .studio-heading .library-button { min-width: 44px; padding: 9px; }
  .studio-deck { gap: 10px; flex-wrap: wrap; }
  .deck-transport { gap: 4px; }
  .deck-transport .icon-button { width: 42px; height: 42px; }
  .deck-clock { padding-left: 10px; }
  .deck-readouts { gap: 5px 10px; font-size: 11px; }
  .deck-readouts > * { gap: 3px; }
  .deck-readouts svg { width: 14px; height: 14px; }
  .studio-launchers { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .studio-launch { flex-direction: row; min-height: 52px; gap: 6px; border-radius: 8px; }
  .studio-launch svg { width: 20px; height: 20px; }
  .studio-launch .tool-label { font-size: 11px; }
  .timeline-label { padding-inline: 5px; }
  .track-editor { width: 100%; height: 100dvh; max-height: 100dvh; max-width: 100%; border: 0; border-radius: 0; padding: 10px; margin: 0; }
  .editor-header { top: -10px; gap: 0; }
  .editor-header .icon-button { width: 36px; padding: 7px; }
  input.editor-name:not([type]) { font-size: 15px; padding-inline: 5px; }
  .editor-controls { gap: 2px; }
  .editor-controls .icon-button { width: 40px; }
  .editor-surface { height: 290px; }
  .drum-pads { grid-template-columns: repeat(4,1fr); }
  .card:not(.arrangement):not(details) { padding: 14px; }
  .studio-footer { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
.processing-dialog { width: min(34rem, calc(100vw - 20px)); max-height: 90dvh; padding: 18px; overflow: auto; }
.processing-dialog summary { padding: 12px 0; cursor: pointer; }
.processing-dialog details { border-block-start: 1px solid var(--line); padding-bottom: 5px; }
.processing-toggle { display: flex; align-items: center; gap: 9px; margin: 12px 0; }
.processing-control { display: grid; grid-template-columns: minmax(0,1fr) 5.5rem 1.8rem; gap: 8px; align-items: center; margin-bottom: 8px; }
.processing-control label { display: grid; gap: 4px; color: var(--ink); font-size: 13px; }
.processing-control input, .eq-band input { width: 100%; min-width: 0; }
.processing-control small, .eq-band label { color: var(--muted); font-size: 12px; }
.eq-band { display: grid; grid-template-columns: 1.2rem repeat(3,minmax(0,1fr)) 44px; gap: 8px; align-items: center; }
.processing-dialog form > .button { margin-top: 10px; }

/* ---- text size: a pinch on anything you READ -------------------------------
   A pinch, a trackpad pinch or ctrl+wheel on text resizes the text instead of
   magnifying the page (studio-text-size.js, text-size.js); A− / A+ in the footer
   reach the same sizes. Two numbers arrive on <html> and this block alone says
   which element takes which, with `zoom`: lengths scale, the box it sits in does
   not, and the content lays out again in the narrower space.
     --tz     READING zones: messages, status, panels, lists, dialog contents.
     --tz-ui  CHROME: the header, the song title, the transport, the six tools,
              the footer bar, dialog title bars and search boxes. It follows at a
              fifth of the way (1.2 at 200%), so controls never take the screen.
   Kept OUT of every zone, on purpose: the timeline (its drags are measured in
   its own px, and a pinch there still does what it did before), the note grid
   and waveform editor (its own pinch and ctrl+wheel), the playable keys and
   pads, and the focus hint (placed from JS in its own px). Chrome 153 scales
   vw/vh/dvh inside `zoom` too, so a zoomed box that is capped by the viewport
   divides its cap by the zoom it is in. */
:root { --tz: 1; --tz-ui: 1; --tz-rest: 1;
  --tz-hud-bg: #26352a; --tz-hud-ink: var(--ink); --tz-hud-line: #56624f; --tz-hud-btn: #344139; }
#view > p, #view > .studio-loading, .song-library > :not(.session-title):not(form),
.studio-session > :is(.error, .notice, .working, .studio-feedback),
.studio-session > .card:not(.arrangement) > *, #install-help,
dialog:not(.track-editor):not(.shortcut-dialog):not(.voice-picker) > :not(.tz-hud):not(.studio-context-menu),
.voice-picker > .voice-list, .shortcut-dialog > .shortcut-list,
.track-editor > :is(.editor-status, .editor-details, .editor-effects), .studio-context-menu > * { zoom: var(--tz); }
.top, .studio-heading, .studio-deck, .studio-launchers, .song-library > :is(.session-title, form), .footer-bar,
.voice-picker > :not(.voice-list):not(.tz-hud):not(.studio-context-menu),
.shortcut-dialog > :not(.shortcut-list):not(.tz-hud):not(.studio-context-menu),
.track-editor > :is(.editor-header, .editor-controls), .editor-performance > .row, .instrument-keys > .row { zoom: var(--tz-ui); }
/* Controls that live inside a reading zone go back to the chrome's scale: a
   pedal is a panel of knobs, and a row's trailing button is not what you read. */
.pedal, .songs li > .icon-button, .history li .button, .command-keys { zoom: calc(var(--tz-ui) / var(--tz)); }
/* A dialog's title bar is its chrome: at the text's scale a 26px heading was 52px
   at 200% and pushed its own close button onto the next line. */
dialog:not(.track-editor):not(.shortcut-dialog):not(.voice-picker) > .row.between:first-child { zoom: var(--tz-ui); }
:is(.processing-dialog > form, .input-pedals > div) > .row.between:first-child { zoom: calc(var(--tz-ui) / var(--tz)); }
html.tz-up :is(dialog, .processing-dialog > form, .input-pedals > div) > .row.between:first-child > :is(h2, h3) { flex: 1 1 0; min-width: 0; }
.voice-picker > .voice-list { max-height: calc(55dvh / var(--tz)); }
/* A row in a grid list may shrink below its one-line name: the name ends in an
   ellipsis instead of widening the page (measured: a history row 366px wide in
   a 324px card at 200%, which widened a 390px phone's layout viewport to 417). */
.songs > li, .history > li { min-width: 0; }
/* The header has no room to give on a phone: brand, status and three buttons
   use 336 of the 362px a 390px phone gives them (260 of 292 at 320px). At ×1.2
   it ran 27px past a 390px screen and widened the layout viewport to 417, so
   there it may only get smaller with the text. */
@media (max-width: 540px) { .top { zoom: min(1, var(--tz-ui)); } }
.track-editor > .editor-header { top: calc(-18px / var(--tz-ui)); }
@media (max-width: 540px) { .track-editor > .editor-header { top: calc(-10px / var(--tz-ui)); } }
/* LARGER, IN A LIST: the name keeps one line and the row keeps its height.
   Above 100% a name ends in an ellipsis instead of wrapping; from 125% a song
   takes the whole first line and its details and Open button share the second. */
html.tz-up :is(.songs li b, .songs li .micro, .history li > span:first-child, .voice-choice, .command-name,
  .studio-context-menu button > span:not(.command-keys)) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
html.tz-up .voice-choice { display: block; width: 100%; }
html.tz-up .history li > span:first-child { flex: 1 1 auto; }
html.tz-up .command-keys { flex-wrap: nowrap; }
html[data-tz="large"] .songs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding-block: 14px; }
html[data-tz="large"] .songs li > div { display: contents; }
html[data-tz="large"] .songs li b { grid-column: 1 / -1; grid-row: 1; }
html[data-tz="large"] .songs li .micro { grid-column: 1; grid-row: 2; }
html[data-tz="large"] .songs li > .icon-button { grid-column: 2; grid-row: 2; }
/* LARGE, IN THE PROCESSING DIALOG: name and number share the first line and the
   slider takes the whole second one. Side by side at 200% on a 390px phone a
   slider was 67px wide (316 now) and an EQ band's three numbers were 48px boxes
   beside its switch and delete button (95 now, on a line of their own). */
html[data-tz="large"] .processing-control { grid-template-columns: minmax(0, 1fr) 4.5rem 1.8rem; row-gap: 4px; }
html[data-tz="large"] .processing-control > label { display: contents; }
html[data-tz="large"] .processing-control > input { grid-column: 2; grid-row: 1; padding-inline: 6px; }
html[data-tz="large"] .processing-control > small { grid-column: 3; grid-row: 1; }
html[data-tz="large"] .processing-control input[type=range] { grid-column: 1 / -1; grid-row: 2; }
html[data-tz="large"] .eq-band { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 4px; }
html[data-tz="large"] .eq-band > input[type=checkbox] { grid-column: 1; grid-row: 1; }
html[data-tz="large"] .eq-band > .icon-button { grid-column: 3; grid-row: 1; justify-self: end; }
html[data-tz="large"] .eq-band > label { display: grid; gap: 2px; grid-row: 2; }
html[data-tz="large"] .eq-band input:not([type=checkbox]) { padding-inline: 6px; }
/* On these surfaces two fingers belong to the text: panning stays native, the
   page pinch is what is given up. Not on the session itself: touch-action
   intersects with ancestors and would reach the timeline. */
.top, #view > .studio-loading, #view > p, .song-library, .studio-session > :not(.arrangement), .studio-footer,
dialog, .studio-context-menu { touch-action: pan-x pan-y; }
.text-size-choice { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.tz-control { display: inline-flex; align-items: center; gap: 4px; }
.tz-control button { min-width: 44px; min-height: 42px; padding: 0 10px; border: 1px solid #4b584f; border-radius: 7px;
  background: #111915; color: var(--ink); font-weight: 700; line-height: 1; touch-action: manipulation; }
.tz-control .tz-less { font-size: 12px; }
.tz-control .tz-more { font-size: 16px; }
.tz-control output { min-width: 3.4em; text-align: center; color: var(--ink); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
@media (hover:hover) { .tz-control button:hover:enabled { background: #344139; } }
