:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: rgba(15, 19, 26, 0.86);
  --panel-strong: rgba(18, 24, 33, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f8fb;
  --muted: #99a6b8;
  --cyan: #5fd9ff;
  --violet: #a785ff;
  --coral: #ff7a66;
  --lime: #9cf2c6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(95, 217, 255, 0.18), transparent 31%),
    radial-gradient(circle at 88% 18%, rgba(167, 133, 255, 0.16), transparent 29%),
    #07080b;
  background-size: 46px 46px, 46px 46px, auto, auto, auto;
}

button,
select,
label.upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0 16px;
  background: #f4f7fb;
  color: #0d1219;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

select {
  min-width: 132px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

button.secondary,
label.upload {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

button:focus-visible,
select:focus-visible,
label.upload:focus-within {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

input[type="file"] {
  display: none;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.2;
}

.dashboard {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  margin: 0 auto;
  padding: 14px;
  overflow: hidden;
}

.topbar,
.workbench,
.timeline {
  display: grid;
  gap: 14px;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 10px;
}

.eyebrow,
.kicker {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.workbench {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.stage-card,
.inspector,
.timeline article {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-strong), rgba(9, 12, 17, 0.94));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
}

.stage-card {
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.stage-head,
.inspector-head,
.timeline article > div,
.meter > div {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.stage-head {
  margin-bottom: 10px;
}

.status {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status strong {
  color: var(--text);
  font-size: 21px;
}

.visual-stack {
  position: relative;
  width: min(100%, 910px);
  height: auto;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #080b10;
}

#fieldCanvas,
#spectrumCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#spectrumCanvas {
  mix-blend-mode: screen;
}

.color-chip {
  position: absolute;
  left: 20px;
  bottom: 20px;
  min-width: 250px;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 9, 13, 0.72);
  backdrop-filter: blur(14px);
}

.color-chip span,
.meter span,
.meter small,
.pipeline span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.meter small {
  display: none;
}

.color-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.pulse-orbit {
  position: absolute;
  right: 11%;
  top: 16%;
  width: 190px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  box-shadow:
    0 0 0 26px rgba(255, 255, 255, 0.035),
    0 0 72px rgba(95, 217, 255, 0.28);
  opacity: 0.85;
  transform: scale(var(--pulse-scale, 1));
  transition: transform 90ms linear, border-color 90ms linear;
}

.pulse-orbit::before,
.pulse-orbit::after {
  content: "";
  position: absolute;
  inset: 22%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.pulse-orbit::after {
  inset: 42%;
  background: rgba(255, 255, 255, 0.26);
}

.inspector {
  padding: 14px;
}

.inspector-head {
  margin-bottom: 10px;
}

.meter-grid {
  display: grid;
  gap: 7px;
}

.meter {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
}

.meter strong {
  color: var(--text);
  font-size: 16px;
}

.meter i {
  display: block;
  height: 6px;
  margin: 7px 0 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.meter b {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 100ms linear;
}

.meter[data-key="bass"] b { background: linear-gradient(90deg, #4aa3ff, #5fd9ff); }
.meter[data-key="mid"] b { background: linear-gradient(90deg, #9cf2c6, #5fd9ff); }
.meter[data-key="treble"] b { background: linear-gradient(90deg, #a785ff, #f3f0ff); }
.meter[data-key="onset"] b { background: linear-gradient(90deg, #ff7a66, #ffe2a8); }

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.pipeline span {
  position: relative;
  display: block;
  padding: 7px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.timeline {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.timeline article {
  padding: 8px;
}

.timeline article > div {
  margin-bottom: 7px;
}

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

#waveCanvas,
#featureCanvas,
#colorCanvas,
#miniSpectrumCanvas {
  width: 100%;
  height: 90px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #080b10;
}

@media (max-width: 1100px) {
  .workbench,
  .timeline {
    grid-template-columns: 1fr 1fr;
  }

  .inspector {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dashboard {
    width: min(100% - 24px, 540px);
  }

  .topbar,
  .workbench,
  .timeline {
    grid-template-columns: 1fr;
  }

  .transport {
    justify-content: flex-start;
  }

  .stage-card {
    min-height: 440px;
  }

  .visual-stack {
    height: 340px;
  }

  .pulse-orbit {
    width: 132px;
  }
}
