/* Calm single-page composition, with optional tools and a persistent compact history. */
:root {
  color-scheme: light;
  --ink: #252436;
  --muted: #82808d;
  --line: #e9e7ef;
  --accent: #7357d8;
  --soft: #f1edfc;
  --paper: #fff;
  --bg: #f8f7fa;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
.file-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
button:hover,
.file-button:hover {
  background: var(--soft);
  border-color: #d7ccef;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
input:focus,
textarea:focus,
select:focus,
summary:focus-visible {
  outline: 3px solid #ded3ff;
  outline-offset: 2px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 14px;
}
.topbar {
  height: 76px;
  max-width: 1420px;
  margin: auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 17px;
}
.brand span {
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 500;
  border-left: 1px solid #d8d5e1;
  padding-left: 17px;
  color: var(--muted);
}
.company {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.studio-layout {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 56px;
  padding: 42px 32px 36px;
}
.creation {
  min-width: 0;
}
.intro {
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
h1 {
  font-size: 30px;
  line-height: 1.4;
  letter-spacing: -1px;
  margin: 9px 0;
}
.intro p {
  color: var(--muted);
}
.case-entry {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--soft);
  padding: 17px 20px;
  border-radius: 12px;
  margin-bottom: 28px;
}
.case-entry strong {
  font-size: 13px;
}
.case-entry p {
  font-size: 11px;
  color: #8b80a6;
  margin-top: 4px;
}
.case-entry button {
  white-space: nowrap;
  border-color: #e0d6f5;
  background: white;
  color: var(--accent);
  font-size: 12px;
}
.form-section {
  margin-bottom: 24px;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
}
.step {
  height: 23px;
  width: 23px;
  display: grid;
  place-items: center;
  background: #ebe7f3;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #6f6684;
}
.required,
.optional {
  font-size: 10px;
  vertical-align: middle;
  color: #928b9b;
  font-weight: 400;
  margin-left: 6px;
}
.optional {
  padding: 2px 7px;
  background: #ebe9f0;
  border-radius: 4px;
}
label {
  display: block;
  font-weight: 550;
  font-size: 13px;
  margin: 16px 0 7px;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  border: 1px solid #e2dfeb;
  background: var(--paper);
  border-radius: 9px;
  padding: 12px 14px;
  color: var(--ink);
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: #b0acba;
}
textarea {
  line-height: 1.8;
}
.style-chips {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 11px;
  color: var(--muted);
}
.style-chips button {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: transparent;
}
.melody-section {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.melody-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 9px;
}
.melody-choices button,
.melody-choices .file-button {
  font-size: 12px;
  margin: 0;
  font-weight: 500;
  padding: 9px 12px;
}
.muted {
  color: var(--muted);
  font-size: 11px;
}
details {
  margin-top: 12px;
}
summary {
  cursor: pointer;
  color: #7d738e;
  font-size: 12px;
}
#melody-editor {
  padding: 13px 15px;
  background: #f0eef4;
  border-radius: 9px;
}
#melody-state {
  float: right;
  color: var(--accent);
  font-size: 11px;
}
#melody-editor .hint {
  margin: 10px 0;
}
.code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  background: white;
}
.score-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}
.score-toolbar button {
  font-size: 11px;
}
.score-preview {
  background: white;
  border-radius: 8px;
  margin-top: 10px;
  padding: 12px;
  overflow: auto;
  font-size: 11px;
  color: var(--muted);
}
.score-preview svg {
  max-width: 100%;
  height: auto;
}
.advanced {
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.submit-area {
  margin-top: 25px;
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.primary:hover {
  background: #6244ca;
  color: white;
}
.submit-area .primary {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  box-shadow: 0 5px 16px #7357d81c;
}
.submit-area p {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
}
.notice {
  padding: 13px 16px;
  background: #ede7ff;
  border-left: 3px solid var(--accent);
  margin-bottom: 17px;
  border-radius: 5px;
  font-size: 12px;
}
.recordings {
  border-left: 1px solid var(--line);
  padding-left: 25px;
  min-width: 0;
}
.recordings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}
.recordings-head .eyebrow {
  font-size: 10px;
  letter-spacing: 0.7px;
}
.recordings-head h2 {
  margin-top: 7px;
}
.recordings-head h2 span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.retention {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 16px;
}
#history-list {
  max-height: 1100px;
  overflow: auto;
  padding-right: 4px;
}
.record {
  padding: 17px 0;
  border-top: 1px solid var(--line);
}
.record-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}
.record-head h3 {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}
.record > small {
  display: block;
  font-size: 10px;
  margin-top: 7px;
}
.status {
  font-size: 10px;
  white-space: nowrap;
  color: #928b9e;
}
.status.completed {
  color: #45917b;
}
.status.running,
.status.waiting,
.status.queued {
  color: var(--accent);
}
.status.failed {
  color: #bb7c79;
  white-space: normal;
}
.record p.status {
  margin-top: 7px;
}
.record audio {
  width: 100%;
  height: 33px;
  margin: 12px 0 5px;
}
.record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
}
.record-actions button,
.record-actions a {
  font-size: 10px;
  padding: 3px 0;
  border: 0;
  background: none;
  color: #817491;
}
.record-actions a {
  color: var(--accent);
}
.record summary {
  font-size: 10px;
  color: #a19aaa;
}
.record pre {
  font-size: 10px;
}
.empty {
  padding: 38px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed #dcd6e8;
  border-radius: 12px;
}
.system-status {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 32px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 21px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.status-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #666071;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8d7ab6;
}
.system-status strong {
  margin-left: 7px;
  font-size: 13px;
  color: #6c627e;
}
.system-status small {
  font-size: 10px;
  margin-left: 7px;
}
.system-status em {
  font-style: normal;
  font-size: 10px;
}
.nodes {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 10px;
}
.system-status > a {
  font-size: 10px;
  margin-left: auto;
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 30px;
  width: min(640px, 90vw);
  max-height: 85vh;
  color: var(--ink);
  box-shadow: 0 20px 100px #29203922;
}
dialog::backdrop {
  background: #30264255;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin: 6px 0 15px;
}
dialog p {
  margin-bottom: 12px;
}
dialog .actions {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}
.dialog-close {
  position: absolute;
  right: 16px;
  top: 12px;
  background: transparent;
  border: 0;
}
.library-dialog {
  width: min(1050px, 94vw);
  padding-top: 40px;
}
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.filters input {
  flex: 2;
  min-width: 150px;
}
.filters select {
  flex: 1;
  min-width: 100px;
}
.filters span {
  width: 100%;
  font-size: 11px;
  color: var(--muted);
}
.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.case-card {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
}
.case-card:hover {
  background: var(--soft);
}
.case-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0;
}
.case-card h3 {
  margin: 5px 0;
}
.case-card button {
  font-size: 11px;
  margin-top: 8px;
}
.case-card small,
.badge {
  font-size: 10px;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
}
dialog audio {
  width: 100%;
  margin: 12px 0;
}
#login-error {
  color: #a65764;
  font-size: 12px;
}
#login-dialog input {
  margin-top: 10px;
}
/* Keep history below the composer on narrow screens without adding navigation. */
@media (min-width: 1500px) {
  .studio-layout {
    max-width: 1320px;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 70px;
  }
}
@media (max-width: 900px) {
  .studio-layout {
    gap: 25px;
    padding: 28px 24px;
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .recordings {
    padding-left: 18px;
  }
  .topbar {
    padding: 0 24px;
  }
  .company {
    display: none;
  }
  #unlock {
    margin-left: auto;
  }
  .case-entry {
    align-items: flex-start;
    flex-direction: column;
  }
}
@media (max-width: 680px) {
  .studio-layout {
    display: block;
    padding: 24px 20px;
  }
  .recordings {
    border-left: 0;
    padding: 30px 0 0;
    border-top: 1px solid var(--line);
    margin-top: 35px;
  }
  .topbar {
    height: 65px;
    padding: 0 20px;
  }
  .brand {
    font-size: 28px;
  }
  .brand span {
    font-size: 11px;
  }
  h1 {
    font-size: 25px;
  }
  .case-entry {
    flex-direction: row;
  }
  .case-entry p {
    max-width: 190px;
  }
  .case-grid {
    grid-template-columns: 1fr 1fr;
  }
  .system-status {
    padding: 20px;
    gap: 12px;
  }
  .recordings-head {
    margin-top: 0;
  }
  #history-list {
    max-height: 700px;
  }
  .system-status > a {
    margin-left: 0;
  }
  .melody-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .melody-choices #plan {
    grid-column: 1/-1;
  }
  dialog {
    padding: 25px 18px;
  }
}
[hidden] {
  display: none !important;
}

/* Compact records open complete, live details instead of crowding the creation page. */
.history-item {
  width: 100%;
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 16px;
  margin-bottom: 10px;
  background: #fff;
  position: relative;
}
.history-item strong {
  font-size: 13px;
  padding-right: 35px;
  font-weight: 600;
}
.history-item small {
  font-size: 10px;
}
.history-arrow {
  font-size: 10px;
  color: #a399b7;
  justify-self: end;
}
#job-detail .record {
  border: 0;
  padding-top: 18px;
}
#job-detail .record-head h3 {
  font-size: 21px;
}
#job-detail .record > small {
  font-size: 12px;
}
#job-detail audio {
  height: 45px;
  margin: 20px 0;
}
#job-detail .record-actions {
  gap: 16px;
  margin: 20px 0;
}
#job-detail .record-actions button,
#job-detail .record-actions a {
  font-size: 12px;
}
#job-detail .record-actions .primary {
  padding: 9px 14px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
}

/* Compact cards retain accessible playback and action controls. */
.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.history-item:focus-visible {
  outline: 2px solid var(--accent);
}
.history-item audio {
  width: 100%;
  min-width: 0;
  height: 32px;
  margin: 8px 0;
}
.input-history pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
}
