:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --panel: #ffffff;
  --ink: #101010;
  --soft-ink: #555555;
  --muted: #9a9a9a;
  --line: #e6e6e3;
  --line-dark: #d4d4d0;
  --fill: #f6f6f3;
  --accent-live: #111111;
  --rail: #d8d8d4;
  --radius: 0;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Songti SC", "STSong", serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .52;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 800;
  letter-spacing: 0;
}

svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 498px minmax(0, 1fr);
  grid-template-rows: auto auto;
  background: var(--bg);
}

.control-rail {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  align-content: start;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
}

.eyebrow,
.block-heading span,
.library-head p {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .36em;
  text-transform: uppercase;
}

.status {
  min-height: 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .22em;
  line-height: 1.65;
  text-transform: uppercase;
}

.status.success {
  color: var(--soft-ink);
}

.status.error {
  color: #111;
}

.input-status {
  min-height: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.5;
  text-transform: none;
}

.control-block {
  display: grid;
  gap: 15px;
  padding: 28px 22px 30px;
  border-bottom: 1px solid var(--line);
}

.block-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.block-heading strong {
  color: var(--soft-ink);
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-label,
.control-field > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .18em;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input[type="text"],
input[type="number"],
input:not([type]) {
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: #fff;
  outline: 0;
  padding: 0 13px;
  font-size: 16px;
  transition: border-color 140ms ease, background 140ms ease;
}

input[type="number"] {
  width: 100%;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  background: #fff;
}

input:focus {
  border-color: #111;
}

.primary-button,
.icon-button,
.menu-button,
.segmented button,
.preset-grid button {
  min-height: 44px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  color: var(--ink);
  background: #fff;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.primary-button:hover,
.icon-button:hover,
.menu-button:hover,
.segmented button:hover,
.preset-grid button:hover {
  border-color: #111;
  background: #111;
  color: #fff;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border-color: #111;
  background: #111;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  white-space: nowrap;
}

.primary-button:hover {
  background: #fff;
  color: #111;
}

.primary-button.compact {
  min-width: 92px;
}

.icon-button,
.menu-button {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
}

.palette-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
}

.palette-button svg {
  width: 18px;
  height: 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 12px;
}

.control-field {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.span-2 {
  grid-column: 1 / -1;
}

.range-field {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
}

.range-field > span {
  grid-column: 1;
  grid-row: 1;
}

.range-field .range-value {
  grid-column: 2;
  grid-row: 1;
}

.range-field input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
}

input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  outline: 0;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 0;
  background:
    linear-gradient(90deg, var(--accent-live) 0 var(--fill, 50%), var(--rail) var(--fill, 50%) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 20px;
  margin-top: -9px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--rail);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--accent-live);
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 18px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
}

.range-value {
  min-width: 38px;
  padding: 1px 6px;
  color: #111;
  background: #f2f2ef;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
  text-align: center;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--soft-ink);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

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

.switch span {
  position: relative;
  width: 27px;
  height: 14px;
  border: 1px solid var(--line-dark);
  background: #fff;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 6px;
  height: 6px;
  background: var(--muted);
  transition: transform 140ms ease, background 140ms ease;
}

.switch input:checked + span::after {
  background: #111;
  transform: translateX(13px);
}

.segmented,
.preset-grid {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button,
.preset-grid button {
  min-height: 38px;
  font-size: 14px;
  font-weight: 800;
}

.segmented button.active,
.preset-grid button.active {
  border-color: #111;
  background: #111;
  color: #fff;
}

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

.main-panel {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.studio-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 42px 62px 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar p {
  color: #757575;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .24em;
}

.preview-toolbar .primary-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  gap: 7px;
}

.preview-toolbar .primary-button svg {
  width: 18px;
  height: 18px;
}

.playlist-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.playlist-card::after {
  content: "LIVE";
  align-self: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .22em;
}

.playlist-card img {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line-dark);
  object-fit: cover;
  background: #f5f5f2;
}

.playlist-card p,
.playlist-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.playlist-card h2 {
  margin: 5px 0;
  overflow: hidden;
  font-size: 25px;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 620px;
  padding: 34px;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid #f0f0ed;
  pointer-events: none;
}

.canvas-backdrop {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 38px, #f2f2ef 38px 39px),
    repeating-linear-gradient(90deg, transparent 0 38px, #f2f2ef 38px 39px);
  opacity: .64;
}

canvas {
  position: relative;
  z-index: 1;
  width: min(100%, 900px);
  height: auto;
  aspect-ratio: var(--canvas-ratio, 1 / 1);
  border: 1px solid #eeeeea;
  background: #f7f8f4;
}

.track-panel {
  grid-column: 2;
  grid-row: 2;
  margin: 38px 62px 56px;
  border: 1px solid var(--line);
  background: #fff;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 28px 30px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.library-head::after {
  content: "展开";
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .24em;
}

.library-head[aria-expanded="true"]::after {
  content: "收起";
}

.library-head[data-can-expand="false"]::after {
  content: "";
}

.library-head p {
  margin-bottom: 8px;
  letter-spacing: .32em;
}

.library-head h2 {
  font-size: 34px;
}

.library-head > span {
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: .18em;
}

.track-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  border-top: 0;
}

.track-list[hidden] {
  display: none;
}

.track-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.track-card img {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.track-card div {
  min-width: 0;
}

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

.track-card strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.track-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

body.is-loading .status {
  opacity: .58;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 390px minmax(0, 1fr);
  }

  .studio-stage {
    padding-left: 42px;
    padding-right: 42px;
  }

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

  .track-panel {
    margin-left: 42px;
    margin-right: 42px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .control-rail {
    order: 2;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-panel {
    order: 1;
  }

  .track-panel {
    order: 3;
  }

  .studio-stage {
    padding-top: 36px;
  }
}

@media (max-width: 620px) {
  .control-block,
  .studio-stage {
    padding-left: 18px;
    padding-right: 18px;
  }

  .studio-stage {
    padding-top: 24px;
  }

  .control-grid,
  .preset-grid,
  .segmented {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .canvas-wrap {
    min-height: 380px;
    padding: 12px;
  }

  .track-panel {
    margin-left: 18px;
    margin-right: 18px;
  }

  .library-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px 18px;
  }

  .preview-toolbar {
    align-items: center;
    flex-direction: row;
    padding-bottom: 18px;
  }

  .preview-toolbar .primary-button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }
}

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