:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  --bg: #070a0f;
  --panel: #0d121a;
  --panel-2: #111924;
  --line: #243143;
  --line-soft: #182231;
  --text: #e8eef7;
  --muted: #8f9cad;
  --accent: #45d7b0;
  --accent-2: #2aa888;
  --danger: #ff6d76;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
}

.toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  padding: 0 18px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  background: linear-gradient(180deg, #121a25 0%, #0c121a 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 24px rgb(0 0 0 / 24%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  color: #f4f8ff;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.12em;
  border-right: 1px solid var(--line);
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 16px rgb(69 215 176 / 80%);
}

.fixed-parameter,
.slider-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
}

.fixed-parameter strong,
.slider-control output {
  min-width: 50px;
  color: #f7fbff;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.parameter-label,
.unit {
  color: var(--muted);
  font-size: 12px;
}

.unit {
  margin-left: -5px;
}

.slider-control input[type="range"] {
  width: 138px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: ew-resize;
}

.toolbar-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-chip::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f1b84b;
  box-shadow: 0 0 10px rgb(241 184 75 / 55%);
  content: "";
}

.status-chip[data-state="ready"]::before {
  background: var(--accent);
  box-shadow: 0 0 10px rgb(69 215 176 / 55%);
}

.status-chip[data-state="error"] {
  color: #ffabb0;
}

.status-chip[data-state="error"]::before {
  background: var(--danger);
  box-shadow: 0 0 10px rgb(255 109 118 / 55%);
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  color: #07120f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background 120ms ease,
    transform 120ms ease;
}

.download-button:hover:not(:disabled) {
  background: #68e5c4;
}

.download-button:active:not(:disabled) {
  transform: translateY(1px);
}

.download-button:disabled {
  color: #6e7986;
  background: #202a35;
  cursor: not-allowed;
}

.download-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 34px;
  min-width: 0;
  min-height: 0;
  background: #070a0f;
}

.viewer {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #05070b;
}

.frequency-axis {
  display: block;
  flex: 0 0 38px;
  width: 100%;
  height: 38px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.waterfall-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.scroll-viewport {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-color: #405169 #101722;
  scrollbar-width: thin;
  background: #05070b;
  outline: none;
}

.scroll-viewport:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.scroll-spacer {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.waterfall-canvas {
  position: sticky;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  background: #05070b;
}

.message-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  background: rgb(5 7 11 / 84%);
  pointer-events: none;
  transition: opacity 150ms ease;
}

.message-overlay[hidden] {
  display: none;
}

.message-overlay[data-state="error"] {
  color: #ffabb0;
}

.message-overlay[data-state="error"] .loader {
  display: none;
}

.loader {
  width: 17px;
  height: 17px;
  border: 2px solid #2d3a49;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  overflow: hidden;
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.info-separator {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.info-grow {
  flex: 1 1 auto;
}

.color-legend {
  width: 90px;
  height: 7px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 99px;
  background: linear-gradient(
    90deg,
    #070818 0%,
    #173d73 22%,
    #07888b 44%,
    #45bc67 64%,
    #e8d43a 83%,
    #ff542f 100%
  );
}

@media (max-width: 850px) {
  .toolbar {
    gap: 14px;
  }

  .slider-control input[type="range"] {
    width: 105px;
  }

  .info-bar > :nth-child(2),
  .info-bar > :nth-child(3),
  .info-bar > :nth-child(4),
  .info-bar > :nth-child(5) {
    display: none;
  }
}

