:root {
  color-scheme: light;
  --paper: #f7f7f4;
  --surface: #ffffff;
  --ink: #171714;
  --muted: #72726c;
  --line: #deded8;
  --line-strong: #c8c8c0;
  --purple: #7658a8;
  --sidebar-width: 176px;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 9px 12px;
  transform: translateY(-150%);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 30px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 50%;
  background: var(--ink);
}
.brand-mark i { width: 2px; border-radius: 3px; background: #fff; }
.brand-mark i:nth-child(1) { height: 6px; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 8px; }

.primary-nav { display: grid; gap: 7px; margin-top: 52px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 580;
  transition: background 160ms ease, color 160ms ease;
}
.nav-item:hover { color: var(--ink); }
.nav-item.is-active { color: var(--ink); background: #ecece7; }
.nav-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-note {
  margin: auto 6px 0;
  color: #9b9b94;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  line-height: 1.5;
}

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.page { display: none; }
.page.is-active { display: block; }

.home-page { min-height: 100vh; padding: 14px; }
.home-image {
  position: relative;
  min-height: calc(100vh - 28px);
  overflow: hidden;
  border-radius: var(--radius);
  background: #dedbd3 url("/assets/home-piano-hero.png") center center / cover no-repeat;
}
.home-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(24, 22, 19, 0.44) 0%, rgba(24, 22, 19, 0.08) 45%, transparent 72%);
}
.home-copy {
  position: absolute;
  z-index: 1;
  left: clamp(32px, 6vw, 88px);
  bottom: clamp(42px, 10vh, 104px);
  max-width: 600px;
  color: #fff;
}
.kicker {
  margin: 0 0 15px;
  color: inherit;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.home-copy h1 {
  max-width: 570px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5vw, 74px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.99;
  text-wrap: balance;
}
.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 34px;
  margin-top: 32px;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}
.home-cta span { font-size: 15px; }
.image-credit {
  position: absolute;
  z-index: 1;
  right: 19px;
  bottom: 15px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.produce-page { min-height: 100vh; padding: 8px clamp(28px, 7vw, 112px) 28px; }
.produce-page.is-active { display: flex; }
.produce-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: min(900px, 100%);
  margin: 0 auto;
}
.produce-heading {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 0 28px;
}
.produce-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}
.prompt-mode-list {
  position: absolute;
  right: 0;
  bottom: 30px;
  left: 0;
  z-index: 1;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1;
}
.mode-toggle {
  --mode-color: var(--purple);
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  padding: 2px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #aaa9a2;
  cursor: pointer;
  text-align: left;
  transition: color 140ms ease, background 140ms ease, opacity 140ms ease;
}
.mode-toggle:hover { color: var(--ink); background: rgba(23, 23, 20, 0.025); }
.mode-toggle.is-selected { color: var(--ink); }
.mode-song { --mode-color: #7959c7; }
.mode-chords { --mode-color: #df6d55; }
.mode-beats { --mode-color: #3d86d6; }
.mode-melody { --mode-color: #3aa16d; }
.mode-bass { --mode-color: #936dde; }
.mode-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--mode-color);
  border-radius: 50%;
  color: var(--mode-color);
  background: transparent;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}
.mode-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mode-toggle.is-selected .mode-icon {
  color: #fff;
  background: var(--mode-color);
  transform: scale(1.04);
}
.prompt-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 520px;
  padding-top: 1px;
}
.prompt-field {
  position: relative;
  display: block;
  flex: 1;
  min-height: 370px;
  border-bottom: 1px solid var(--line-strong);
}
.prompt-field:focus-within { border-color: var(--ink); }
.prompt-field textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 370px;
  resize: vertical;
  padding: 4px 58px 220px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 2.4vw, 31px);
  line-height: 1.43;
}
.prompt-field textarea::placeholder { color: #b3b3ab; }
.prompt-count {
  position: absolute;
  right: 0;
  bottom: 10px;
  color: #a0a099;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.creation-workspace {
  position: relative;
  flex: 1;
  min-height: 430px;
  overflow: hidden;
  border-top: 1px solid rgba(200, 200, 192, 0.72);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.35), rgba(247, 247, 244, 0.72) 76%),
    var(--paper);
}
.produce-shell.is-creating .track-card:not(.is-complete) { display: none; }
.produce-shell.is-creating .produce-heading,
.produce-shell.is-complete .produce-heading { margin-bottom: 14px; }
.produce-shell.is-creating .produce-heading h1,
.produce-shell.is-complete .produce-heading h1 { font-size: clamp(28px, 3.8vw, 46px); }
.produce-shell.is-creating .prompt-field,
.produce-shell.is-complete .prompt-field {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  border-bottom: 0;
}
.produce-shell.is-creating .prompt-field textarea,
.produce-shell.is-complete .prompt-field textarea {
  flex: 0 0 auto;
  height: 78px;
  min-height: 78px;
  resize: none;
  padding: 2px 0 12px;
  font-size: clamp(17px, 1.8vw, 23px);
  line-height: 1.35;
}
.produce-shell.is-creating .prompt-mode-list,
.produce-shell.is-complete .prompt-mode-list,
.produce-shell.is-creating .prompt-count,
.produce-shell.is-complete .prompt-count { display: none; }
.produce-shell.is-creating .creation-workspace,
.produce-shell.is-complete .creation-workspace { display: block; }
.produce-shell.is-creating .prompt-actions,
.produce-shell.is-complete .prompt-actions { padding-top: 10px; }
.produce-shell.is-complete .produce-button { background: transparent; color: var(--ink); }

.capability-graph {
  position: absolute;
  inset: -8%;
  z-index: 0;
  opacity: 0.54;
  cursor: grab;
  filter: saturate(0.9);
}
.capability-graph:active { cursor: grabbing; }
.composition-timeline {
  position: absolute;
  z-index: 1;
  right: 2.5%;
  bottom: 5%;
  left: 2.5%;
  display: flex;
  min-height: 62%;
  flex-direction: column;
  padding: 16px 17px 18px;
  border: 1px solid rgba(200, 200, 192, 0.82);
  border-radius: 15px;
  background: rgba(250, 250, 247, 0.88);
  box-shadow: 0 18px 55px rgba(33, 32, 28, 0.08);
  backdrop-filter: blur(9px);
  pointer-events: none;
}
.timeline-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.timeline-status > div { display: grid; gap: 4px; }
.timeline-eyebrow {
  color: var(--purple);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.timeline-status strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
}
.timeline-progress {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1;
}
.timeline-message {
  min-height: 17px;
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 9px;
}
.timeline-canvas {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 4px 8px;
  min-height: 258px;
  overflow: hidden;
}
.timeline-ruler-label,
.timeline-lane-label {
  display: flex;
  align-items: center;
  color: #76766f;
  font-size: 7px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.timeline-lane-label::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--lane-color, #97978f);
}
.timeline-ruler,
.timeline-lane {
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.timeline-ruler { height: 18px; border-bottom: 1px solid rgba(200, 200, 192, 0.7); }
.timeline-ruler span {
  position: absolute;
  bottom: 3px;
  color: #87877f;
  font-size: 7px;
  transform: translateX(-50%);
}
.timeline-lane {
  height: 24px;
  border-bottom: 1px solid rgba(200, 200, 192, 0.48);
  background-image: linear-gradient(to right, rgba(200, 200, 192, 0.28) 1px, transparent 1px);
  background-size: var(--bar-width, 6.25%) 100%;
}
.timeline-lane.is-phrase-lane {
  height: 34px;
  overflow: visible;
  background-color: rgba(255, 255, 255, 0.34);
}
.timeline-phrase-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 3px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--phrase-color) 72%, white);
  border-radius: 4px;
  background: color-mix(in srgb, var(--phrase-color) 9%, white);
  color: #34332f;
}
.timeline-phrase-marker::before,
.timeline-phrase-marker::after {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--phrase-color);
  content: "";
}
.timeline-phrase-marker::before { left: 0; }
.timeline-phrase-marker::after { right: 0; }
.timeline-phrase-label {
  position: absolute;
  z-index: 1;
  top: 1px;
  right: 4px;
  left: 4px;
  overflow: hidden;
  color: color-mix(in srgb, var(--phrase-color) 72%, #171713);
  font-size: 6px;
  font-weight: 760;
  line-height: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-phrase-segment {
  position: absolute;
  bottom: 2px;
  height: 12px;
  min-width: 2px;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  background: color-mix(in srgb, var(--phrase-color) 68%, white);
  color: #fff;
  font-size: 5.5px;
  line-height: 12px;
  padding: 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 2px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--block-color, #97978f);
  color: #fff;
  font-size: 7px;
  line-height: 16px;
  padding: 0 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-block.is-harmony {
  top: 5px;
  bottom: 5px;
  border-radius: 2px;
  background: rgba(90, 170, 240, 0.74);
  color: #16334b;
}
.timeline-activity {
  position: absolute;
  bottom: 3px;
  width: max(2px, calc(var(--bar-width, 6.25%) - 1px));
  height: var(--activity-height, 10px);
  border-radius: 2px 2px 0 0;
  background: var(--lane-color);
  opacity: calc(0.42 + var(--intensity, 0.5) * 0.5);
}
.timeline-lane.is-active { background-color: rgba(118, 88, 168, 0.045); }
.timeline-lane.is-active::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--lane-color);
}

.prompt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
}
.action-buttons { display: flex; align-items: center; gap: 9px; width: 100%; }
.action-buttons > button { flex: 1; }
.send-button, .produce-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 19px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.send-button { border: 1px solid var(--line-strong); background: transparent; color: var(--ink); }
.produce-button { width: 100%; min-width: 126px; border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.send-button svg, .produce-button svg, .track-download svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.produce-button svg { fill: currentColor; stroke: none; }
.send-button:disabled, .produce-button:disabled { cursor: wait; opacity: 0.5; }
.produce-button.is-loading svg { animation: pulse 950ms ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.82); } }

.track-card {
  display: none;
  grid-template-columns: 94px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 126px;
  padding: 16px 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 18px 60px rgba(32, 29, 24, 0.06);
}
.track-card.is-visible { display: grid; animation: track-in 340ms ease both; }
@keyframes track-in { from { opacity: 0; transform: translateY(-10px); } }
.track-art {
  position: relative;
  width: 94px;
  height: 94px;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(145deg, #d9cced, #7a639e 60%, #282330);
}
.track-disc {
  position: absolute;
  top: 13px;
  right: -25px;
  width: 78px;
  height: 78px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.92) 0 4%, transparent 5% 29%, rgba(255,255,255,.22) 30% 31%, transparent 32% 48%, rgba(255,255,255,.18) 49% 50%, transparent 51%);
}
.track-eq { position: absolute; bottom: 15px; left: 14px; display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.track-eq i { width: 2px; border-radius: 2px; background: rgba(255,255,255,.82); }
.track-eq i:nth-child(1) { height: 12px; }
.track-eq i:nth-child(2) { height: 24px; }
.track-eq i:nth-child(3) { height: 17px; }
.track-eq i:nth-child(4) { height: 29px; }
.track-eq i:nth-child(5) { height: 9px; }
.track-label { color: var(--purple); font-size: 8px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.track-copy h2 { margin: 5px 0 3px; font-family: Georgia, "Times New Roman", serif; font-size: 22px; font-weight: 400; }
.track-copy p { margin: 0; color: var(--muted); font-size: 10px; }
.track-copy audio { display: none; width: min(430px, 100%); height: 30px; margin-top: 9px; }
.track-card.is-complete .track-copy audio { display: block; }
.track-download {
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
}
.track-card.is-complete .track-download { display: grid; }

@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    inset: 0 0 auto 0;
    width: 100%;
    height: 64px;
    flex-direction: row;
    align-items: center;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .primary-nav { display: flex; gap: 3px; margin: 0 0 0 auto; }
  .nav-item { min-height: 36px; padding: 0 10px; }
  .nav-item svg, .sidebar-note { display: none; }
  .app-main { margin-left: 0; padding-top: 64px; }
  .home-page { min-height: calc(100vh - 64px); padding: 9px; }
  .home-image { min-height: calc(100vh - 82px); background-position: 62% center; }
  .home-copy { left: 25px; right: 25px; bottom: 45px; }
  .home-copy h1 { font-size: clamp(38px, 12vw, 58px); }
  .image-credit { display: none; }
  .produce-page { min-height: calc(100vh - 64px); padding: 4px 22px 20px; }
  .produce-heading { margin: 0 0 24px; }
  .prompt-actions { align-items: flex-start; flex-direction: column; margin-top: auto; }
  .action-buttons { width: 100%; }
  .send-button, .produce-button { flex: 1; }
  .track-card { grid-template-columns: 70px minmax(0, 1fr); gap: 14px; padding: 12px; }
  .track-art { width: 70px; height: 70px; }
  .track-download { display: none !important; }
  .produce-shell.is-creating .prompt-field,
  .produce-shell.is-complete .prompt-field { min-height: 500px; }
  .creation-workspace { min-height: 390px; }
  .composition-timeline { right: 1%; bottom: 3%; left: 1%; padding: 12px; }
  .timeline-canvas { grid-template-columns: 52px minmax(0, 1fr); }
  .timeline-status strong { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
