:root {
  color-scheme: dark;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
  color: #ffefea;
  background: #191516;
  --surface: #252021;
  --surface-down: #1d191a;
  --line: #493a3b;
  --muted: #ccb9b4;
  --yellow: #ffd275;
  --red: #d93341;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center -30%, #402630, transparent 63%);
}

button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }

.desk { max-width: 970px; padding: 32px clamp(16px, 4vw, 48px) 44px; margin: auto; }
.top, .piece-head, .tempo, .transport { display: flex; align-items: center; }
.top, .piece-head, .tempo { justify-content: space-between; gap: 12px; }
.top { margin-bottom: 24px; }
.brand { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; }
.brand span { color: var(--yellow); font-size: 1.3rem; }
.meter { color: var(--muted); font-size: .875rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 100px; }
.studio, .piece { border: 1px solid var(--line); background: var(--surface); border-radius: 22px; }
.studio { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); overflow: hidden; }
.generator, .options, .piece { padding: clamp(18px, 4vw, 32px); }
.generator {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 26px;
  min-height: 312px;
  border-right: 1px solid var(--line);
  background: radial-gradient(ellipse at 60% 80%, #45252c, transparent 68%), var(--surface-down);
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 5.4vw, 2.65rem); line-height: 1.08; letter-spacing: -.065em; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; }
p { color: var(--muted); font-size: .93rem; margin-top: .3rem; }

.record {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1px;
  width: clamp(120px, 18vw, 144px);
  aspect-ratio: 1;
  margin: 8px 0 6px 8px;
  color: #fff9f5;
  background: radial-gradient(circle at 35% 26%, #ee525a, #be2437 68%, #9b1c2f);
  border: 1px solid #ff7379;
  border-radius: 50%;
  font-weight: 750;
  box-shadow: 0 4px 0 #761523, 0 0 0 8px #672d36, 0 0 0 10px #39232a, inset 0 1px 4px #ffa6aa80;
  transition: transform .15s ease, filter .15s ease;
}
.record:hover { filter: brightness(1.13); }
.record:active { transform: translateY(3px); }
.record .note { height: 36px; font-size: 2.25rem; line-height: 1; }

.options { display: grid; gap: 17px; align-content: center; }
.fields, .track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 0; }
.field-title, .lock { display: flex; align-items: center; }
.field-title { min-height: 26px; justify-content: space-between; gap: 4px; }
.field-title > label:first-child, legend, .tempo > label:first-child { font-size: .88rem; font-weight: 650; }
.lock { gap: 4px; min-height: 30px; color: var(--muted); font-size: .76rem; white-space: nowrap; cursor: pointer; }
.lock input { inline-size: 14px; block-size: 14px; margin: 0; accent-color: var(--yellow); }
.lock:has(input:checked) { color: var(--yellow); }
.solo-link { color: var(--yellow); text-underline-offset: 4px; font-size: .89rem; }
.field select {
  width: 100%;
  margin-top: 5px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-down);
  padding: 6px 9px;
}
.tempo { justify-content: flex-start; flex-wrap: wrap; gap: 2px 12px; }
.tempo .lock { margin-left: auto; }
.tempo output { color: var(--yellow); font-size: .88rem; font-variant-numeric: tabular-nums; }
.tempo input[type="range"] { flex: 1 1 100%; min-height: 32px; margin: 0; accent-color: var(--yellow); }
.tracks { min-width: 0; padding: 0; border: 0; margin: 0; }
.tracks legend { padding: 0; margin-bottom: 6px; }
.tracks label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-down);
  cursor: pointer;
}
.tracks input { accent-color: var(--yellow); inline-size: 16px; block-size: 16px; margin: 0; }

.piece { margin-top: 14px; }
.transport { flex-wrap: wrap; gap: 6px; }
.transport button {
  border: 1px solid var(--line);
  min-height: 42px;
  padding: 5px 12px;
  border-radius: 10px;
  color: inherit;
  background: var(--surface-down);
}
.transport button:hover:not(:disabled) { border-color: var(--yellow); }

.chords { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; padding: 0; margin: 13px 0 12px; }
.chords li {
  min-width: 0;
  min-height: 59px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-down);
}
.chords li[aria-current="step"] { color: var(--yellow); border-color: var(--yellow); background: #413329; }
.chords li small { color: var(--muted); font-size: .75rem; }
.chords li strong { line-height: 1.15; overflow-wrap: anywhere; font-size: .94rem; }
.timeline { height: 4px; border-radius: 100px; background: #574145; overflow: hidden; }
.timeline span { display: block; height: 100%; width: 100%; background: var(--yellow); transform: scaleX(0); transform-origin: left center; }

@media (max-width: 620px) {
  .desk { padding-top: 18px; }
  .top { margin-bottom: 12px; }
  .studio { grid-template-columns: 1fr; }
  .generator {
    min-height: 0;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 13px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .record { width: 105px; margin: 6px 7px; font-size: .86rem; }
  .record .note { font-size: 1.8rem; height: 30px; }
  .options { gap: 12px; }
  .piece-head { align-items: start; flex-wrap: wrap; }
  .solo-link { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .record { transition: none; }
}

.setup {
  min-width: 0;
  background: var(--surface);
}
.setup > summary {
  padding: 14px 18px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 650;
}
.setup:not([open]) > summary { padding-bottom: 14px; }
.privacy { margin: 14px 2px 0; font-size: .83rem; }
.privacy a { color: var(--muted); }
.chords:has(li:nth-child(9)) {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .chords:has(li:nth-child(9)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .desk { max-width: 1050px; padding: 0 max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .top { display: none; }
  .studio, .piece { margin-top: 6px; border-radius: 12px; }
  .studio { display: block; }
  .generator { min-height: 0; display: flex; gap: 10px; align-items: center; padding: 5px 10px; border-right: 0; }
  .generator h1 { font-size: 1.15rem; letter-spacing: -.04em; }
  .generator p, .generator .solo-link { display: none; }
  .record { display: block; width: auto; aspect-ratio: auto; min-height: 40px; margin: 0 0 0 auto; border-radius: 8px; padding: 0 10px; box-shadow: none; font-size: .85rem; }
  .record .note { display: none; }
  .setup > summary, .setup:not([open]) > summary { padding: 5px 10px 7px; }
  .setup[open] .options { padding: 6px 10px 12px; }
  .piece { padding: 6px 10px 7px; }
  .piece h2 { font-size: .88rem; }
  .piece p { margin-top: 0; font-size: .74rem; }
  .transport button { min-height: 34px; font-size: .76rem; }
  .chords, .chords:has(li:nth-child(9)) {
    display: flex; overflow-x: auto; gap: 4px; margin: 5px 0;
  }
  .chords li { flex: 1 0 66px; min-height: 33px; padding: 3px 5px; }
  .chords li small { font-size: .66rem; }
  .chords li strong { font-size: .76rem; }
  .timeline { height: 2px; }
  .privacy { margin-top: 8px; }
}
