:root {
  color-scheme: dark;
  --bg: #11141b;
  --panel: #171d2b;
  --panel-2: #1d2536;
  --panel-3: #121827;
  --line: #2e3a55;
  --line-hot: #455a83;
  --text: #f3f6fb;
  --muted: #a6b0c3;
  --quiet: #68748a;
  --red: #e84d68;
  --yellow: #e7b83f;
  --green: #36d06d;
  --blue: #4da3ff;
  --violet: #9a72ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(77, 163, 255, .12), transparent 300px),
    linear-gradient(180deg, #151929 0%, var(--bg) 36%, #0e1118 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 38px;
}

.app-header {
  height: 118px;
  display: grid;
  grid-template-columns: 118px minmax(260px, 1fr) minmax(150px, auto);
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  overflow: hidden;
}

.brand-mark {
  width: 118px;
  height: 118px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-readout {
  min-width: 0;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}

.session-readout span:first-child,
.session-readout span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.readout-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(54, 208, 109, .12);
}

.transport,
.load-panel,
.mixer-panel,
.tracks-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 43, .94);
  box-shadow: var(--shadow);
}

.transport {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.transport-buttons,
.channel-buttons,
.track-actions,
.load-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.mini-button,
.text-button,
.add-track button {
  border: 1px solid #3b4864;
  border-radius: 8px;
  background: #20283a;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, opacity .15s;
}

.icon-button:hover,
.mini-button:hover,
.text-button:hover,
.add-track button:hover {
  border-color: var(--line-hot);
  background: #28334a;
}

.icon-button:disabled,
.mini-button:disabled,
.text-button:disabled,
.add-track button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.icon-button.primary {
  background: #244e38;
  border-color: #34724e;
}

.icon-button.primary:hover {
  background: #2c6745;
}

.icon-button.remove {
  width: 32px;
  height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--quiet);
  font-size: 23px;
}

.icon-button.remove:hover {
  color: #ff8fa0;
  background: rgba(232, 77, 104, .1);
}

.pause-glyph,
.is-playing .play-glyph {
  display: none;
}

.is-playing .pause-glyph {
  display: inline;
}

.timeline {
  min-width: 0;
}

.time-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.time-row strong {
  color: var(--text);
}

.seek {
  width: 100%;
  accent-color: var(--green);
}

.master-strip {
  min-width: 240px;
  display: grid;
  grid-template-columns: auto 96px 84px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.horizontal-meter {
  height: 14px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, var(--green) 0 var(--meter, 0%), #222b3e var(--meter, 0%) 100%);
  border: 1px solid #303b54;
}

.master-strip input {
  width: 84px;
  accent-color: var(--violet);
}

.load-panel {
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: none;
}

.add-track {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 220px) auto;
  gap: 10px;
}

.add-track input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.add-track input:focus {
  border-color: var(--blue);
}

.add-track input::placeholder {
  color: #5f6b7f;
}

.add-track button {
  padding: 10px 16px;
  background: #703047;
  border-color: #97425e;
  white-space: nowrap;
}

.load-actions {
  justify-content: space-between;
  margin-top: 10px;
  color: var(--quiet);
  font-size: 13px;
}

.sample-loader {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-button {
  padding: 7px 10px;
  color: #cad5e8;
  background: #161e2d;
  font-size: 13px;
}

.text-button.danger {
  color: #ff9aaa;
}

.status-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.probe-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.probe-status:empty {
  display: none;
}

.probe-status.is-loading::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid #3a465f;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.mixer-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.mixer {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.channel {
  width: 106px;
  min-width: 106px;
  min-height: 338px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding: 10px 7px;
  border: 1px solid #28344d;
  border-radius: 8px;
  background: var(--panel-2);
}

.channel-name {
  width: 100%;
  height: 72px;
  box-sizing: border-box;
  display: block;
  padding: 7px;
  border-radius: 6px;
  background: rgba(6, 10, 18, .72);
  overflow: hidden;
}

.channel-name-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  width: 100%;
  min-width: 0;
  color: #dbe4f2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-color,
.track-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.vu-meter {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 112px;
}

.vu-bar {
  width: 11px;
  height: 100%;
  border-radius: 4px;
  border: 1px solid #28344d;
  background:
    linear-gradient(0deg,
      var(--green) 0 var(--level, 0%),
      #141b29 var(--level, 0%) 100%);
  overflow: hidden;
}

.channel-volume {
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: slider-vertical;
  width: 30px;
  height: 106px;
  accent-color: var(--violet);
}

.db-label {
  min-height: 13px;
  color: var(--quiet);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
}

.mini-button {
  width: 28px;
  height: 23px;
  padding: 0;
  color: #8f9bb1;
  font-size: 10px;
  font-weight: 800;
}

.mini-button.is-muted {
  background: var(--red);
  border-color: #ff8296;
  color: #fff;
}

.mini-button.is-solo {
  background: var(--yellow);
  border-color: #ffd66e;
  color: #11141b;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 0;
  color: var(--quiet);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tracks {
  display: grid;
  gap: 8px;
  padding: 12px 16px 16px;
}

.empty-state {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed #354158;
  border-radius: 8px;
  color: var(--quiet);
  text-align: center;
}

.empty-state strong {
  color: var(--muted);
}

.track-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #28344d;
  border-radius: 8px;
  background: var(--panel-2);
}

.track-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.track-heading > div {
  min-width: 0;
}

.track-title,
.track-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-title {
  color: var(--text);
  font-size: 14px;
}

.track-meta {
  margin-top: 3px;
  color: var(--quiet);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.loop-check {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: #c4ccda;
  font-size: 11px;
  white-space: nowrap;
}

.loop-check.is-visible {
  display: inline-flex;
}

.loop-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--violet);
}

.waveform-wrap {
  position: relative;
  height: 58px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #293650;
  background: var(--panel-3);
}

.waveform {
  width: 100%;
  height: 100%;
  display: block;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 1px;
  background: rgba(255, 255, 255, .8);
  opacity: .72;
  pointer-events: none;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 14px;
  }

  .app-header {
    height: 116px;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-rows: 84px 20px;
    align-items: center;
    gap: 10px 12px;
  }

  .brand-mark {
    width: 84px;
    height: 84px;
  }

  .session-readout {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .transport,
  .add-track,
  .track-row {
    grid-template-columns: 1fr;
  }

  .load-actions,
  .sample-loader,
  .status-stack {
    align-items: stretch;
    flex-direction: column;
  }

  .master-strip {
    min-width: 0;
    grid-template-columns: auto minmax(90px, 1fr) 96px;
  }

  .track-actions {
    justify-content: flex-end;
  }
}
