:root {
  color-scheme: dark;
  --ink: #f7f4ef;
  --muted: #b9bec5;
  --panel: rgba(19, 22, 27, 0.86);
  --panel-strong: rgba(31, 35, 42, 0.94);
  --line: rgba(255, 255, 255, 0.13);
  --teal: #4dd7c7;
  --coral: #ff8a72;
  --violet: #b7a4ff;
  --gold: #f1cc72;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 18%, rgba(77, 215, 199, 0.18), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(255, 138, 114, 0.18), transparent 25rem),
    linear-gradient(135deg, #111317 0%, #181b21 42%, #202026 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
}

.studio {
  width: min(1120px, 100%);
  display: grid;
  gap: 18px;
}

.studio-header,
.transport,
.control-surface {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  border-radius: 8px;
}

.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: clamp(18px, 3vw, 28px);
}

.eyebrow,
.metric-label,
.control-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.status-pill {
  min-width: 108px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(241, 204, 114, 0.13);
}

.status-pill.live .status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(77, 215, 199, 0.16);
}

.status-pill.error .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 138, 114, 0.16);
}

.stage {
  position: relative;
  min-height: clamp(240px, 42vw, 430px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(77, 215, 199, 0.09) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(145deg, rgba(255, 138, 114, 0.18), rgba(183, 164, 255, 0.12) 42%, rgba(77, 215, 199, 0.12));
  background-size: 72px 72px, 72px 72px, auto;
  box-shadow: var(--shadow);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage-overlay {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(128px, 1fr));
  gap: 12px;
  pointer-events: none;
}

.stage-overlay > div {
  min-width: 128px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 11, 14, 0.62);
}

.stage-overlay strong {
  display: block;
  margin-top: 3px;
  font-size: clamp(1.35rem, 4vw, 2.6rem);
  line-height: 1;
}

.pitch-note {
  display: inline-block;
  margin-top: 6px;
  color: var(--teal);
  font-weight: 800;
}

.transport {
  display: grid;
  grid-template-columns: 1fr minmax(118px, 180px);
  gap: 12px;
  padding: 12px;
}

.primary-action,
.ghost-action,
.presets button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.primary-action {
  background: linear-gradient(135deg, var(--teal), #8ae0a0);
  color: #071111;
  font-weight: 800;
}

.primary-action.active {
  background: linear-gradient(135deg, var(--coral), var(--gold));
}

.ghost-action,
.presets button {
  background: rgba(255, 255, 255, 0.05);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(77, 215, 199, 0.45);
  outline-offset: 2px;
}

.control-surface {
  display: grid;
  gap: 16px;
  padding: clamp(14px, 3vw, 22px);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(126px, 190px) 1fr;
  align-items: center;
  gap: 16px;
}

.control-row > * {
  min-width: 0;
}

.control-title {
  display: block;
  font-weight: 780;
}

input[type="range"] {
  display: block;
  min-width: 0;
  width: 100%;
  accent-color: var(--teal);
}

.presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.presets legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.presets button.active {
  border-color: rgba(77, 215, 199, 0.78);
  background: rgba(77, 215, 199, 0.14);
}

@media (max-width: 760px) {
  .app-shell {
    place-items: start center;
    padding: 12px;
  }

  .studio-header,
  .control-row {
    grid-template-columns: 1fr;
  }

  .studio-header {
    display: grid;
  }

  .status-pill {
    justify-self: start;
  }

  .transport,
  .presets {
    grid-template-columns: 1fr 1fr;
  }

  .stage-overlay {
    inset: auto 10px 10px 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stage-overlay > div {
    min-width: 0;
    padding: 10px;
  }

  .stage-overlay strong {
    font-size: clamp(1rem, 5vw, 1.35rem);
  }

  .pitch-note {
    margin-top: 4px;
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .transport,
  .presets {
    grid-template-columns: 1fr;
  }

  .control-surface {
    gap: 14px;
  }

  .control-row {
    gap: 10px;
  }

}
