@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #f6f3ec;
  --paper-deep: #eee9df;
  --surface: rgba(255, 253, 248, 0.92);
  --surface-solid: #fffdf8;
  --ink: #1f2023;
  --ink-soft: #626166;
  --ink-faint: #8f8c89;
  --line: #ded9cf;
  --line-strong: #c9c2b7;
  --red: #d9473e;
  --red-deep: #ac2e2c;
  --red-soft: #f7ddda;
  --blue: #276f91;
  --blue-soft: #d9ecf4;
  --green: #2d7657;
  --green-soft: #dcece3;
  --shadow: 0 18px 60px rgba(52, 42, 31, 0.08);
  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .8, .25, 1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 11% 2%, rgba(217, 71, 62, .06), transparent 28rem),
    radial-gradient(circle at 95% 28%, rgba(39, 111, 145, .055), transparent 30rem),
    var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  content: "";
  pointer-events: none;
}

button,
input,
summary {
  font: inherit;
}

button,
summary,
label,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button,
[role="button"],
summary {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(39, 111, 145, .35);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 14px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform .2s;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: min(1420px, calc(100% - 48px));
  height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(31, 32, 35, .12);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--red);
}

.brand-edition {
  margin-left: 2px;
  padding-left: 12px;
  color: var(--ink-faint);
  border-left: 1px solid var(--line-strong);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: .18em;
}

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.connection-dot {
  width: 7px;
  height: 7px;
  background: #d39334;
  border-radius: 99px;
  box-shadow: 0 0 0 4px rgba(211, 147, 52, .12);
  animation: connection-pulse 1.6s ease-in-out infinite;
}

.connection.is-ready .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(45, 118, 87, .12);
  animation: none;
}

.connection.is-error .connection-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(217, 71, 62, .12);
  animation: none;
}

main {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
}

.hero {
  display: block;
  padding: 96px 2.5vw 82px;
}

.eyebrow,
.section-kicker,
.process-eyebrow {
  margin: 0;
  color: var(--red);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .17em;
}

.eyebrow span {
  padding: 0 5px;
  color: var(--line-strong);
}

.hero h1 {
  max-width: 1080px;
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: clamp(64px, 8vw, 112px);
  font-weight: 760;
  line-height: .92;
  letter-spacing: -.065em;
}

.hero h1 em {
  color: var(--red);
  font-style: normal;
}

.hero-lede {
  max-width: 540px;
  margin: 28px 0 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 1.5vw, 20px);
  font-weight: 650;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 13px 28px;
  padding: 0;
  margin: 44px 0 0;
  list-style: none;
}

.hero-features li {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding-left: 17px;
}

.hero-features li::before {
  position: absolute;
  left: 0;
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  content: "";
}

.hero-features strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-bottom: 100px;
}

.panel {
  background: var(--surface);
  border: 1.5px solid rgba(31, 32, 35, .12);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.setup-panel,
.process-panel,
.result-panel {
  padding: clamp(28px, 2.7vw, 38px);
}

.setup-panel {
  position: sticky;
  top: 20px;
}

.output-column {
  display: grid;
  gap: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: clamp(28px, 2.7vw, 38px);
  line-height: 1.08;
  letter-spacing: -.045em;
}

.step-chip,
.status-chip {
  flex: none;
  padding: 7px 10px;
  color: var(--ink-faint);
  background: var(--paper-deep);
  border-radius: 99px;
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .13em;
}

.status-chip.is-active {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-chip.is-complete,
.complete-chip {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.is-error {
  color: var(--red-deep);
  background: var(--red-soft);
}

.form-section {
  padding: 2px 0 20px;
}

.split-rule {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

label,
legend,
.group-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.field-hint,
.field-note {
  color: var(--ink-faint);
  font-size: 10.5px;
}

.dropzone {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background:
    radial-gradient(circle at 50% 30%, rgba(217, 71, 62, .12), transparent 58%),
    rgba(246, 243, 236, .72);
  border: 1.5px solid rgba(217, 71, 62, .2);
  border-radius: var(--radius-md);
  transition: color .22s, background-color .22s, transform .22s var(--ease);
}

.dropzone:hover,
.dropzone.is-dragging {
  color: var(--red);
  background-color: rgba(247, 221, 218, .38);
  transform: translateY(-2px);
}

#file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
}

.drop-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.drop-subtitle {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.source-card {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.source-info {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.file-badge {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 50%;
  font-weight: 800;
}

.file-copy {
  min-width: 0;
}

.file-copy strong,
.file-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy strong {
  font-size: 12px;
}

.file-copy span {
  color: var(--ink-faint);
  font-size: 10px;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.icon-button:hover {
  color: var(--red);
  background: var(--red-soft);
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

audio {
  display: block;
  width: 100%;
  height: 38px;
  color-scheme: light;
}

.field-error {
  margin: 8px 0 0;
  color: var(--red-deep);
  font-size: 11px;
  font-weight: 650;
}

.field-group {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.field-group legend {
  padding: 0;
  margin-bottom: 11px;
}

.course-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 4px;
  background: var(--paper-deep);
  border-radius: 13px;
}

.course-selector label {
  position: relative;
}

.course-selector input {
  position: absolute;
  opacity: 0;
}

.course-selector span {
  display: flex;
  min-height: 55px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  transition: color .18s, background .18s, box-shadow .18s;
}

.course-selector small {
  margin-bottom: 1px;
  color: var(--ink-faint);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 9px;
  font-weight: 650;
}

.course-selector input:checked + span {
  color: var(--red-deep);
  background: var(--surface-solid);
  border-color: rgba(217, 71, 62, .14);
  box-shadow: 0 4px 14px rgba(52, 42, 31, .07);
}

.course-selector input:focus-visible + span {
  outline: 3px solid rgba(39, 111, 145, .35);
  outline-offset: 2px;
}

.two-column-fields,
.parameter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.value-output {
  color: var(--red-deep);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 750;
}

.model-select {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}

.model-select:hover {
  border-color: var(--line-strong);
}

.model-select:focus-visible {
  outline: 3px solid rgba(39, 111, 145, .35);
  outline-offset: 1px;
}

/* Known limitations of the selected model / difficulty. Rendered verbatim from
   the server's /api/capabilities, which reads the model card. */
.model-notices {
  padding: 12px 14px;
  margin-top: 10px;
  color: var(--red-deep);
  background: var(--red-soft);
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.5;
}

.model-notices strong {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.model-notices ul {
  padding-left: 16px;
  margin: 0;
}

.model-notices li + li {
  margin-top: 5px;
}

.model-notices .notice-section {
  margin-right: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 750;
  opacity: .75;
}

.range {
  --range-progress: 88.89%;
  width: 100%;
  height: 18px;
  padding: 0;
  margin: 3px 0;
  appearance: none;
  background: transparent;
}

.range::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, var(--red) var(--range-progress), var(--line) var(--range-progress));
  border-radius: 99px;
}

.range::-moz-range-track {
  height: 3px;
  background: linear-gradient(90deg, var(--red) var(--range-progress), var(--line) var(--range-progress));
  border-radius: 99px;
}

.range::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -7px;
  appearance: none;
  background: var(--surface-solid);
  border: 4px solid var(--red);
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(31, 32, 35, .2);
}

.range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--surface-solid);
  border: 4px solid var(--red);
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(31, 32, 35, .2);
}

.range:disabled {
  opacity: .4;
}

.range:disabled::-webkit-slider-thumb {
  border-color: var(--ink-faint);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--ink-faint);
  font-size: 9px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.input-with-unit:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 111, 145, .12);
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  padding: 10px 4px 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.input-with-unit span {
  flex: none;
  padding: 0 11px;
  color: var(--ink-faint);
  font-size: 9px;
}

.toggle-list {
  display: grid;
  gap: 8px;
}

.toggle-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "copy switch";
  gap: 16px;
  align-items: center;
  padding: 12px 13px;
  background: rgba(246, 243, 236, .65);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color .2s, background .2s;
}

.toggle-card:hover {
  background: var(--paper);
  border-color: var(--line);
}

.toggle-card > span:first-child {
  grid-area: copy;
}

.toggle-card strong,
.toggle-card small {
  display: block;
}

.toggle-card strong {
  font-size: 12px;
}

.toggle-card small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 500;
}

.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  grid-area: switch;
  width: 37px;
  height: 21px;
  background: var(--line-strong);
  border-radius: 99px;
  transition: background .2s;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(31, 32, 35, .2);
  content: "";
  transition: transform .22s var(--ease);
}

.toggle-card input:checked + .switch {
  background: var(--red);
}

.toggle-card input:checked + .switch::after {
  transform: translateX(16px);
}

.toggle-card input:focus-visible + .switch {
  outline: 3px solid rgba(39, 111, 145, .35);
  outline-offset: 3px;
}

.advanced {
  padding-bottom: 20px;
}

.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary strong,
.advanced summary small {
  display: block;
}

.advanced summary strong {
  font-size: 13px;
}

.advanced summary small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 10px;
}

.advanced summary svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  transition: transform .22s;
}

.advanced[open] summary svg {
  transform: rotate(180deg);
}

.advanced-body {
  padding-top: 16px;
}

.advanced-body > .toggle-card {
  margin-top: 8px;
}

.toggle-card.compact {
  padding: 11px 12px;
}

.parameter-grid {
  margin-top: 20px;
  transition: opacity .2s;
}

.parameter-grid[aria-disabled="true"] {
  opacity: .48;
}

.drum-volume-field {
  padding-top: 21px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.field-note {
  margin: 6px 0 0;
}

.primary-button,
.secondary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 13px;
  font-weight: 750;
  transition: background .2s, color .2s, transform .2s var(--ease), box-shadow .2s;
}

.primary-button {
  min-height: 64px;
  color: white;
  background: var(--red);
  border: 1px solid var(--red);
  box-shadow: 0 10px 22px rgba(172, 46, 44, .2);
}

.primary-button:hover:not(:disabled) {
  background: var(--red-deep);
  border-color: var(--red-deep);
  box-shadow: 0 12px 26px rgba(172, 46, 44, .28);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: .6;
}

.primary-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.primary-button.is-running svg {
  animation: button-arrow 1s ease-in-out infinite;
}

.submit-note {
  margin: 9px 0 0;
  color: var(--ink-faint);
  font-size: 9.5px;
  text-align: center;
}

.process-panel {
  overflow: hidden;
}

.stage-canvas {
  position: relative;
  overflow: hidden;
  aspect-ratio: 13 / 7;
  color: var(--red);
  background:
    radial-gradient(circle at 32% 38%, rgba(217, 71, 62, .18), transparent 45%),
    radial-gradient(circle at 72% 64%, rgba(39, 111, 145, .12), transparent 48%),
    linear-gradient(145deg, #f7eee7, #f1eee9 55%, #e9eee9);
  border: 1px solid rgba(201, 194, 183, .72);
  border-radius: 22px;
}

.stage-canvas::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%);
  content: "";
  pointer-events: none;
  transform: translateX(-120%);
}

.stage-canvas.is-running::after {
  animation: canvas-sheen 4s ease-in-out infinite;
}

.stage-visual {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  transform: scale(.98);
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility 0s .35s;
}

.stage-visual.is-active {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  transform: scale(1);
  transition-delay: 0s;
}

.stage-visual svg {
  width: 100%;
  height: 100%;
}

.process-copy {
  padding: 18px 2px 0;
}

.process-title-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.process-eyebrow {
  display: none;
}

.process-title-row h3 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
  letter-spacing: -.035em;
}

.progress-number {
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.process-copy > p {
  min-height: 2.8em;
  margin: 9px 0 22px;
  color: var(--ink-soft);
  font-size: 12px;
}

.progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), #ed7b53);
  border-radius: inherit;
  transition: width .5s var(--ease);
}

.queue-row {
  display: flex;
  min-height: 28px;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
  color: var(--ink-faint);
  font-size: 9.5px;
}

.text-button {
  padding: 2px 0;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--red);
}

.process-error {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 14px;
  padding: 14px 16px;
  margin-top: 20px;
  color: var(--red-deep);
  background: var(--red-soft);
  border-radius: 12px;
  font-size: 11px;
}

.process-error strong,
.process-error span {
  grid-column: 1;
}

.process-error .text-button {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--red-deep);
}

/* Loading */
.loading-orbit,
.loading-dot,
.loading-core,
.metronome,
.beat-pulses circle,
.plan-cursor,
.note,
.export-sheet,
.mix-wave,
.mix-drum,
.mix-spark,
.complete-rings,
.complete-check,
.confetti {
  transform-box: fill-box;
  transform-origin: center;
}

.is-active .orbit-a { animation: orbit-spin 9s linear infinite; }
.is-active .orbit-b { animation: orbit-spin-reverse 6s linear infinite; }
.is-active .loading-core { animation: core-breathe 1.7s ease-in-out infinite; }
.is-active .dot-a { animation: dot-breathe 1.2s ease-in-out infinite; }
.is-active .dot-b { animation: dot-breathe 1.2s .3s ease-in-out infinite; }

/* Audio */
.audio-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.is-active .audio-line { animation: draw-line 2.4s var(--ease) infinite; }
.audio-playhead { transform: translateX(24px); }
.is-active .audio-playhead { animation: audio-scan 2.4s var(--ease) infinite; }

/* Beat */
.metronome { transform-origin: 0 100%; }
.is-active .metronome { animation: metronome 1s ease-in-out infinite alternate; }
.is-active .beat-pulses circle { animation: beat-pulse 2s ease-out infinite; }
.is-active .beat-pulses circle:nth-child(2) { animation-delay: -.4s; }
.is-active .beat-pulses circle:nth-child(3) { animation-delay: -.8s; }
.is-active .beat-pulses circle:nth-child(4) { animation-delay: -1.2s; }
.is-active .beat-pulses circle:nth-child(5) { animation-delay: -1.6s; }

/* Plan */
.plan-bars rect { fill: currentColor; opacity: .13; }
.plan-bars .plan-climax { fill: var(--red); opacity: .42; }
.is-active .plan-bars rect { animation: plan-rise 1.9s var(--ease) infinite alternate both; transform-box: fill-box; transform-origin: center bottom; }
.is-active .plan-bars rect:nth-child(2) { animation-delay: .12s; }
.is-active .plan-bars rect:nth-child(3) { animation-delay: .24s; }
.is-active .plan-bars rect:nth-child(4) { animation-delay: .36s; }
.is-active .plan-bars rect:nth-child(5) { animation-delay: .48s; }
.is-active .plan-bars rect:nth-child(6) { animation-delay: .6s; }
.is-active .plan-bars rect:nth-child(7) { animation-delay: .72s; }
.is-active .plan-bars rect:nth-child(8) { animation-delay: .84s; }
.plan-path { stroke-dasharray: 520; stroke-dashoffset: 520; }
.is-active .plan-path { animation: plan-draw 2.2s var(--ease) infinite; }
.is-active .plan-cursor { animation: plan-cursor 2.2s var(--ease) infinite; }

/* Generate */
.note { fill: var(--red); transform: translate(560px, 140px); }
.note .ka,
.export-dots .ka { fill: var(--blue); }
.is-active .note { animation: note-travel 3.2s linear infinite; }
.is-active .note-2 { animation-delay: -.64s; }
.is-active .note-3 { animation-delay: -1.28s; }
.is-active .note-4 { animation-delay: -1.92s; }
.is-active .note-5 { animation-delay: -2.56s; }
.is-active .generate-gate { animation: gate-pulse 1.05s ease-out infinite; transform-box: fill-box; transform-origin: center; }

/* Export */
.export-lines { opacity: .28; stroke-dasharray: 120; stroke-dashoffset: 120; }
.is-active .export-sheet { animation: sheet-float 2.4s ease-in-out infinite; }
.is-active .export-lines { animation: export-write 2.2s var(--ease) infinite; }
.is-active .export-arrow { animation: export-arrow 1.4s ease-in-out infinite; }

/* Mix */
.mix-wave { stroke-dasharray: 35 12; }
.wave-top { opacity: .65; }
.wave-bottom { color: var(--blue); opacity: .65; }
.is-active .wave-top { animation: wave-flow 2s linear infinite; }
.is-active .wave-bottom { animation: wave-flow-reverse 2.4s linear infinite; }
.is-active .mix-drum { animation: drum-hit 1.2s var(--ease) infinite; }
.is-active .mix-spark { animation: spark-pulse 1.2s var(--ease) infinite; }

/* Complete */
.complete-rings { transform: scale(.65); opacity: 0; }
.complete-check { stroke-dasharray: 82; stroke-dashoffset: 82; }
.confetti { opacity: 0; }
.is-active .complete-rings { animation: complete-pop .7s var(--ease) forwards; }
.is-active .complete-check { animation: check-draw .45s .35s var(--ease) forwards; }
.is-active .confetti { animation: confetti-pop .8s .25s var(--ease) forwards; }

.result-panel {
  animation: result-enter .55s var(--ease) both;
}

.audition-card {
  padding: 18px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--red-soft), #f7e8d9);
  border: 1px solid rgba(217, 71, 62, .18);
  border-radius: var(--radius-md);
}

.audition-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 13px;
}

.audition-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--red);
  background: rgba(255, 253, 248, .7);
  border-radius: 50%;
}

.audition-icon svg {
  width: 27px;
}

.audition-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.audition-icon path {
  fill: currentColor;
}

.audition-heading strong,
.audition-heading small {
  display: block;
}

.audition-heading strong {
  font-size: 13px;
}

.audition-heading small {
  color: var(--ink-soft);
  font-size: 9.5px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 28px;
}

.metric {
  min-width: 0;
  padding: 13px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric dt,
.metric dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric dt {
  color: var(--ink-faint);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.metric dd {
  margin-top: 4px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 760;
}

/* Sentence-valued metrics (the bar timeline report). They take the whole row
   and wrap, because a truncated "tempo changes are NOT represented" would be
   worse than not showing it at all. */
.metric--wide {
  grid-column: 1 / -1;
}

.metric--wide dd {
  overflow: visible;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.5;
  text-overflow: clip;
  white-space: normal;
}

.preview-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.preview-tab {
  position: relative;
  padding: 10px 1px 11px;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 750;
}

.preview-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--red);
  content: "";
  transform: scaleX(0);
  transition: transform .2s var(--ease);
}

.preview-tab.is-active {
  color: var(--ink);
}

.preview-tab.is-active::after {
  transform: scaleX(1);
}

.preview-frame {
  display: grid;
  min-height: 260px;
  max-height: 470px;
  overflow: auto;
  place-items: center;
  margin-top: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.preview-frame > div {
  width: 100%;
}

.preview-frame img {
  width: 100%;
  height: auto;
}

.preview-empty {
  padding: 70px 20px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}

.download-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.download-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: center;
  padding: 14px 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}

.download-button:hover {
  background: var(--surface-solid);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.download-button strong,
.download-button small {
  display: block;
}

.download-button strong {
  font-size: 11px;
}

.download-button small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 8.5px;
}

.download-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.primary-download {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.primary-download:hover {
  color: white;
  background: #313238;
  border-color: #313238;
}

.primary-download small {
  color: rgba(255, 255, 255, .62);
}

.secondary-button {
  min-height: 46px;
  margin-top: 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 11px;
}

.secondary-button:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(217, 71, 62, .22);
}

footer {
  width: min(1420px, calc(100% - 48px));
  min-height: 100px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 30px;
  align-items: center;
  margin: 0 auto;
  color: var(--ink-faint);
  border-top: 1px solid var(--line-strong);
  font-size: 10px;
}

footer > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

footer p {
  margin: 0;
}

footer a {
  justify-self: end;
  color: var(--ink-soft);
  text-decoration: none;
}

footer a:hover {
  color: var(--red);
}

@keyframes connection-pulse {
  50% { opacity: .45; }
}

@keyframes button-arrow {
  50% { transform: translateX(4px); }
}

@keyframes canvas-sheen {
  0%, 45% { transform: translateX(-120%); }
  75%, 100% { transform: translateX(120%); }
}

@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes orbit-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes core-breathe { 50% { opacity: .55; transform: scale(.72); } }
@keyframes dot-breathe { 50% { opacity: .3; transform: scale(.6); } }

@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  55%, 100% { stroke-dashoffset: 0; }
}

@keyframes audio-scan {
  0% { transform: translateX(24px); opacity: 0; }
  10% { opacity: 1; }
  80% { transform: translateX(496px); opacity: 1; }
  100% { transform: translateX(496px); opacity: 0; }
}

@keyframes metronome {
  from { transform: rotate(-28deg); }
  to { transform: rotate(28deg); }
}

@keyframes beat-pulse {
  0%, 18% { opacity: 1; transform: scale(1.6); }
  48%, 100% { opacity: .16; transform: scale(.75); }
}

@keyframes plan-rise {
  0% { opacity: .12; transform: scaleY(.45); }
  100% { opacity: .35; transform: scaleY(1); }
}

@keyframes plan-draw {
  0% { stroke-dashoffset: 520; }
  75%, 100% { stroke-dashoffset: 0; }
}

@keyframes plan-cursor {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 1; }
  12% { transform: translate(0, 0); }
  23% { transform: translate(54px, -23px); }
  34% { transform: translate(108px, -13px); }
  45% { transform: translate(162px, -62px); }
  56% { transform: translate(216px, -40px); }
  67% { transform: translate(270px, -83px); }
  78% { transform: translate(324px, -114px); }
  89%, 100% { transform: translate(378px, -49px); opacity: 1; }
}

@keyframes note-travel {
  from { transform: translate(560px, 140px); }
  to { transform: translate(-36px, 140px); }
}

@keyframes gate-pulse {
  0% { opacity: 1; transform: scale(.92); }
  70%, 100% { opacity: .25; transform: scale(1.12); }
}

@keyframes sheet-float {
  50% { transform: translateY(-7px) rotate(-1deg); }
}

@keyframes export-write {
  0% { stroke-dashoffset: 120; }
  45%, 100% { stroke-dashoffset: 0; }
}

@keyframes export-arrow {
  50% { transform: translateY(8px); }
}

@keyframes wave-flow { to { stroke-dashoffset: -94; } }
@keyframes wave-flow-reverse { to { stroke-dashoffset: 94; } }
@keyframes drum-hit {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(.88); }
  28% { transform: scale(1.08); }
}
@keyframes spark-pulse {
  0%, 100% { opacity: 0; transform: scale(.6); }
  20% { opacity: .8; transform: scale(1.2); }
}

@keyframes complete-pop {
  to { opacity: 1; transform: scale(1); }
}
@keyframes check-draw { to { stroke-dashoffset: 0; } }
@keyframes confetti-pop {
  0% { opacity: 0; transform: scale(.5) rotate(-8deg); }
  55%, 100% { opacity: .75; transform: scale(1) rotate(0); }
}
@keyframes result-enter {
  from { opacity: 0; transform: translateY(15px); }
}

@media (max-width: 1040px) {
  .hero {
    padding-top: 68px;
  }

  .hero-features {
    display: flex;
  }

  .hero-features li {
    padding-right: 0;
  }

  .studio-grid {
    grid-template-columns: minmax(360px, .8fr) minmax(430px, 1.2fr);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .site-header,
  main,
  footer {
    width: min(100% - 30px, 680px);
  }

  .site-header {
    height: 72px;
  }

  .hero {
    padding: 58px 0 60px;
  }

  .hero-features {
    display: flex;
  }

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    position: static;
  }

  .output-column {
    grid-row: 2;
  }

  footer {
    grid-template-columns: 1fr auto;
  }

  footer p {
    display: none;
  }
}

@media (max-width: 520px) {
  .site-header,
  main,
  footer {
    width: calc(100% - 22px);
  }

  .brand-edition {
    display: none;
  }

  .hero {
    padding: 42px 3px 38px;
  }

  .hero h1 {
    font-size: clamp(50px, 15vw, 68px);
    line-height: .92;
  }

  .hero-lede {
    margin-top: 20px;
    font-size: 15px;
  }

  .hero-features {
    display: none;
  }

  .panel {
    border-radius: 20px;
  }

  .setup-panel,
  .process-panel,
  .result-panel {
    padding: 22px 18px;
  }

  .panel-heading {
    margin-bottom: 25px;
  }

  .course-selector span {
    min-height: 52px;
    font-size: 11px;
  }

  .two-column-fields,
  .parameter-grid,
  .download-group {
    grid-template-columns: 1fr;
  }

  .two-column-fields {
    gap: 18px;
  }

  .toggle-card {
    padding: 11px 9px;
  }

  .metrics-grid {
    gap: 6px;
  }

  .metric {
    padding: 11px 9px;
  }

  .preview-frame {
    min-height: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .complete-rings,
  .complete-check,
  .confetti {
    opacity: 1;
    transform: none;
    stroke-dashoffset: 0;
  }
}
