:root {
  color-scheme: dark;
  --base: #0d0c15;
  --surface: #151320;
  --border: #2a2738;
  --text: #f5f1ff;
  --muted: #a39ab8;
  --faint: #8d83a4;
  --purple: #a286ff;
  --mint: #72edbd;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Space Grotesk", "DM Sans", sans-serif;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--base);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible + .switch {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}
button, a { -webkit-tap-highlight-color: transparent; }
svg.lucide { display: block; width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
.shell { width: min(1216px, calc(100% - 96px)); margin: 0 auto; }

.topbar { min-height: 69px; background: #100e19; border-bottom: 1px solid #252232; }
.topbar-inner { min-height: 69px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(8px, 2.5vw, 16px); padding-block: 9px; }
.brand { display: block; min-width: 0; color: var(--text); text-decoration: none; }
.brand h1 { margin: 0; }
.brand-logo { display: block; width: clamp(125px, 25vw, 178px); max-width: 100%; height: auto; }
.headphone-tip { display: flex; align-items: center; gap: 10px; }
.headphone-tip svg { width: 24px; height: 24px; color: var(--purple); }
.headphone-tip-title { margin: 0; font: 700 clamp(1.25rem, 3vw, 1.5rem)/1.15 var(--display); }
.headphone-tip-note { margin: 3px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.3; }
.header-settings-button { flex: none; }

.main { padding: 28px 0 24px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.intro p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.button { color: var(--text); border: 1px solid transparent; border-radius: 9px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; font-size: .875rem; line-height: 1.25; font-weight: 700; white-space: nowrap; transition: border-color .15s, background-color .15s, color .15s; }
.primary { color: #160e29; background: #a989ff; border-color: #b596ff; box-shadow: 0 2px 9px #9673fa24; }
.primary:hover:enabled { background: #c2a9ff; border-color: #c2a9ff; }
.upload-button { min-height: 45px; padding: 0 17px; margin-bottom: 2px; }
.song-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.song-actions .song-select-wrap { min-width: 0; max-width: min(235px, 100%); margin-bottom: 2px; }
.song-actions .song-select-wrap select { min-height: 45px; padding: 4px 31px 4px 34px; border-radius: 9px; background: #1b1729; color: var(--text); border-color: #3a304e; font-size: .875rem; }
.song-actions .song-select-wrap select:hover:enabled { border-color: #5c487c; }
.song-actions .song-select-wrap .song-select-icon { right: auto; left: 11px; width: 15px; height: 15px; color: #b69dff; }
.secondary, .icon-button { background: #211c32; border-color: #362d4d; }
.secondary:hover:enabled, .icon-button:hover:enabled { background: #2d2543; border-color: #5c487c; }
.icon-button { width: 42px; padding: 0; }
.icon-slot { display: inline-flex; }
.notice { margin: -12px 0 18px; background: #231d30; color: #e1ceff; padding: 11px 15px; border: 1px solid #45365a; border-radius: 9px; font-size: .875rem; }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 284px; align-items: start; gap: 16px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; }
.roll-panel { overflow: hidden; }
.panel-header { min-height: 74px; padding: 14px 17px; display: flex; align-items: center; gap: 12px; }
.track-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 9px; border: 1px solid #43345f; background: #271e3b; color: #bda0ff; }
.track-icon svg { width: 19px; height: 19px; }
.track-details { min-width: 0; flex: 1; }
.track-details h2 { color: var(--text); overflow-wrap: anywhere; margin: 0; font: 600 1.08rem/1.25 var(--display); }
.track-details p { margin: 4px 0 0; color: var(--faint); font-size: .81rem; line-height: 1.2; }
.track-details p span { margin-inline: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: flex-end; color: #b7aecb; font-size: .81rem; white-space: nowrap; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-midi { width: 12px; height: 8px; border-radius: 2px; background: #956bfa; }
.legend-voice { width: 12px; height: 2px; border-radius: 2px; background: var(--mint); position: relative; }
.legend-voice::after { position: absolute; content: ""; width: 6px; height: 6px; border-radius: 50%; top: -2px; left: 3px; background: var(--mint); }
.track-picker { display: flex; align-items: center; gap: 12px; padding: 0 17px 12px; color: var(--muted); font-size: .875rem; }
.track-picker .select-wrap { min-width: 0; max-width: min(76%, 420px); }
.roll-root { --pitch-roll-height: 394px; background: #100d1b; border-block: 1px solid var(--border); min-height: var(--pitch-roll-height); }
.transport { min-height: 73px; display: flex; align-items: center; gap: 10px; padding: 13px 17px; }
.play-button { width: 90px; }
.play-button.recording { background: #f090a5; border-color: #f4a6b6; color: #280d1d; box-shadow: none; }
.play-button.recording:hover { background: #ffb0c0; }
.play-button svg { width: 15px; height: 15px; fill: currentColor; stroke-width: 1.45; }
.timecode { margin-left: 5px; display: inline-flex; gap: 7px; align-items: center; color: var(--faint); white-space: nowrap; font: 500 .8rem/1 var(--mono); font-variant-numeric: tabular-nums; }
#elapsed { color: #e2daf3; }
.time-divider { color: #665c7d; }
.tempo-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; flex: none; align-items: center; gap: 0 8px; width: clamp(126px, 15vw, 174px); max-width: 100%; padding: 4px 9px 2px; border: 1px solid #3a304e; border-radius: 8px; background: #1b1729; }
.tempo-control label { color: var(--muted); font-size: .81rem; line-height: 1.1; }
.tempo-control output { color: #dfccff; font: 600 .75rem/1 var(--mono); text-align: end; white-space: nowrap; }
.tempo-control input { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 22px; margin: 0; accent-color: var(--purple); cursor: pointer; }
.tempo-control input:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.tempo-control input:disabled { cursor: default; opacity: .55; }
.sidebar { display: grid; gap: 14px; }
.sidebar .panel { padding: 16px; }
.side-heading, .side-title { display: flex; align-items: center; gap: 8px; }
.side-heading { justify-content: space-between; }
.side-title h2 { font: 600 1rem/1.25 var(--display); margin: 0; white-space: nowrap; }
.side-title svg { width: 17px; height: 17px; color: #ad92f6; }
.live-panel { background: radial-gradient(ellipse at 50% 48%, #201a34 0%, #171423 61%, #151320 100%); }
.live-panel .side-title svg { color: var(--mint); }
.live-status { border: 1px solid #3a3149; border-radius: 20px; padding: 4px 7px; display: inline-flex; align-items: center; gap: 5px; color: #b5acc6; font: 500 .75rem/1.2 var(--mono); white-space: nowrap; }
.live-status > :first-child { flex: none; width: 5px; height: 5px; border-radius: 50%; background: #8a7caa; }
.live-status.active { color: var(--mint); border-color: #3e6258; background: #153c342e; }
.live-status.active > :first-child { background: var(--mint); }
.pitch-readout { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-block: 15px 17px; }
.pitch-note { font: 600 3.2rem/.96 var(--display); letter-spacing: -.06em; color: #dfd4fa; min-height: 49px; }
.pitch-note.voiced { color: var(--mint); }
.pitch-hz { font: 400 .75rem/1.2 var(--mono); color: #ada1c7; min-height: 15px; }
.pitch-match { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-block: 8px; border-top: 1px solid var(--border); color: #c6b9dd; font-size: .875rem; }
.pitch-match-value { color: #ddcafa; font: 600 1.7rem/1 var(--display); }
.pitch-match-value span:last-child { margin-left: 2px; font-size: .8em; }
.pitch-match.match .pitch-match-value { color: var(--mint); }
.pitch-tuning-track { position: relative; height: 5px; margin-inline: 2px; border-radius: 10px; background: #4c3c67; }
.pitch-tuning-track::before { position: absolute; top: -2px; left: calc(50% - 1px); width: 2px; height: 9px; border-radius: 2px; background: #af94f7; content: ''; }
.tuning-needle { position: absolute; left: 50%; width: 4px; height: 15px; transform: translateX(-50%); background: var(--mint); border-radius: 3px; box-shadow: 0 0 10px #6df9ba70; }
.pitch-tuning-track .tuning-needle { top: -4px; height: 13px; }
.tuning-labels { display: flex; justify-content: space-between; color: #9b90b2; font: 400 .75rem/1 var(--mono); margin-top: 7px; }
.pitch-feedback { min-height: 18px; color: var(--muted); text-align: center; margin: 11px 0 0; font-size: .81rem; }
.pitch-feedback.match { color: var(--mint); }
.setup-heading { margin-bottom: 11px; }
.mic-button { width: 100%; min-height: 37px; color: #e3d6ff; }
.mic-button svg { width: 16px; height: 16px; }
.mic-button.ready { color: var(--mint); background: #173329; border-color: #2c5143; opacity: 1; }
.setup-control { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 11px; color: #b5abc9; font-size: .875rem; }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap select { color: #e1d6f6; background: #1d182b; border: 1px solid #382f49; border-radius: 7px; appearance: none; width: 100%; min-height: 32px; padding: 4px 27px 4px 8px; text-overflow: ellipsis; font-size: .81rem; font-weight: 600; cursor: pointer; }
.select-wrap svg { pointer-events: none; width: 13px; height: 13px; color: #b9a8d4; position: absolute; top: 50%; right: 8px; transform: translateY(-50%); }
.score-body { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; margin-top: 11px; }
.score-value { color: #d6c5f8; white-space: nowrap; font: 600 2rem/1 var(--display); letter-spacing: -.07em; }
.score-percent { margin-left: 2px; color: #a590c9; font-size: .95rem; }
.score-body p { margin: 0; color: #a79abf; font-size: .78rem; line-height: 1.35; }
.score-panel.scored .score-value, .score-panel.scored .score-percent { color: var(--mint); }
.replay-controls { display: grid; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.replay-button { width: 100%; min-height: 36px; color: #e3d6ff; }
.download-status { margin: 0; color: var(--muted); font-size: .81rem; line-height: 1.4; }
.vocal-volume { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 8px; color: #c3b9d7; font-size: .81rem; }
.vocal-volume output { color: #d9caf8; font: 500 .75rem/1 var(--mono); }
.vocal-volume input { grid-column: 1 / -1; width: 100%; min-width: 0; margin: 0; accent-color: var(--purple); cursor: pointer; }
.vocal-volume input:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.instrumental-control { position: relative; display: inline-flex; align-items: center; justify-self: start; gap: 7px; cursor: pointer; color: #c3b9d7; font-size: .81rem; white-space: nowrap; }
.instrumental-control input { width: 1px; height: 1px; opacity: 0; position: absolute; }
.switch { width: 30px; height: 17px; background: #322b43; border: 1px solid #554969; border-radius: 20px; padding: 2px; display: flex; align-items: center; transition: background .15s; }
.switch::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #a89dbb; transform: translateX(0); transition: transform .15s; }
.instrumental-control input:checked + .switch { background: #9265f0; border-color: #b291ff; }
.instrumental-control input:checked + .switch::after { transform: translateX(13px); background: #fff6ff; }
.instrumental-control:has(input:disabled) { opacity: .55; cursor: default; }

.take-result-dialog {
  width: min(540px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  padding: clamp(52px, 9vw, 66px) clamp(20px, 5vw, 42px) clamp(32px, 7vw, 48px);
  color: var(--text);
  background: radial-gradient(ellipse at 50% 0%, #322644, transparent 74%), var(--surface);
  border: 1px solid #55446d;
  border-radius: 20px;
  box-shadow: 0 22px 84px #000a;
  text-align: center;
}
.take-result-dialog::backdrop { background: #090712d6; }
.take-result-close { position: absolute; top: 12px; right: 12px; margin: 0; }
.take-result-dialog h2 { margin: 0; font: 600 clamp(1.35rem, 4.5vw, 2rem)/1.15 var(--display); letter-spacing: -.035em; }
.take-result-score {
  margin: 14px 0 0;
  color: var(--mint);
  font: 700 clamp(4rem, 18vw, 8.5rem)/.95 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.07em;
}
.take-result-coverage { margin: 10px 0 18px; color: var(--muted); font-size: .875rem; }
.take-result-song { margin: 0; color: #ddd1f2; font: 600 clamp(1.1rem, 3.4vw, 1.55rem)/1.25 var(--display); overflow-wrap: anywhere; }
.take-result-detail { margin: 12px 0 0; color: var(--muted); font-size: .875rem; }
.take-result-download { margin-top: 24px; min-width: min(170px, 100%); }
.take-result-dialog .download-status { margin-top: 10px; }
.settings-dialog { padding: 0; width: min(690px, calc(100% - 24px)); max-height: calc(100% - 24px); color: var(--text); background: var(--surface); border: 1px solid #4a3b64; border-radius: 15px; box-shadow: 0 14px 65px #0009; }
.settings-dialog::backdrop { background: #090712c9; }
.dialog-inner { padding: 24px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin: 0; font: 600 1.65rem/1.1 var(--display); letter-spacing: -.035em; }
.settings-dialog .notice { margin: 14px 0 0; }
.settings-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; margin-top: 16px; }
.settings-panels .panel { padding: 14px; background: #1b1729; }

@media (max-width: 1040px) {
  .shell { width: calc(100% - 56px); }
  .studio { grid-template-columns: minmax(0, 1fr) 255px; gap: 13px; }
  .sidebar .panel { padding: 14px; }
  .transport { padding-inline: 13px; }
}
@media (max-width: 800px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .roll-root { --pitch-roll-height: 370px; }
  .main { padding-top: 26px; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); }
  .topbar, .topbar-inner { min-height: 60px; }
  .topbar-inner { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .headphone-tip { grid-area: 2 / 1 / 3 / -1; justify-self: center; padding: 0 0 4px; }
  .main { padding-top: 20px; }
  .intro { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 18px; }
  .upload-button { min-height: 40px; }
  .song-actions .song-select-wrap select { min-height: 40px; }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-panel { grid-row: span 2; }
  .transport { flex-wrap: wrap; }
  .roll-root { --pitch-roll-height: 335px; }
  .panel-header { padding: 10px 12px; min-height: 63px; gap: 9px; }
  .legend { gap: 5px 10px; }
  .settings-dialog .dialog-inner { padding: 15px; }
  .settings-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .legend { flex-direction: column; font-size: .75rem; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .live-panel { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
