:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050805;
  color: #e9f5ea;
  --black: #050805;
  --panel: #0c110d;
  --panel-soft: #121914;
  --line: #263329;
  --line-strong: #40ff72;
  --green: #39ff6a;
  --green-soft: #b7ffc9;
  --text: #e9f5ea;
  --muted: #9dac9f;
  --field: #080c09;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--black);
}

.shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  height: 100vh;
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset -1px 0 0 rgba(57, 255, 106, 0.16);
}

h1 {
  margin: 0 0 18px;
  font-size: 24px;
  color: var(--green);
}

h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--green-soft);
}

section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 5px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.checkLabel {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
select,
button {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

progress {
  width: 100%;
  height: 12px;
  margin-top: 10px;
  accent-color: var(--green);
}

progress[hidden] {
  display: none;
}

input,
select {
  padding: 6px 8px;
  background: var(--field);
  color: var(--text);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(57, 255, 106, 0.55);
  outline-offset: 1px;
}

button {
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--green);
  color: #020402;
  border-color: var(--green);
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--green-soft);
  border-color: var(--green-soft);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.checkLabel input {
  width: auto;
  min-height: auto;
}

.classSwatch {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status,
.muted {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.metaGrid {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
}

.metaGrid dt {
  font-weight: 700;
  color: var(--green-soft);
}

.metaGrid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.histogram {
  margin: 8px 0;
}

.histogram canvas {
  display: block;
  width: 100%;
  height: 82px;
  border: 1px solid var(--line);
  background: var(--field);
}

.histStats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.histStats span {
  white-space: nowrap;
}

.bandGroup {
  padding: 8px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.inputChannel {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.inputChannel:first-of-type {
  border-top: 0;
}

.inputChannelTitle {
  margin-bottom: 8px;
  color: var(--green-soft);
  font-size: 13px;
  font-weight: 700;
}

.sourceBandGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 10px;
  margin-bottom: 8px;
}

.viewerWrap {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: #020402;
}

#viewer {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#viewer.dragging {
  cursor: grabbing;
}

.viewerHud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(5, 8, 5, 0.9);
  color: var(--green);
  border: 1px solid rgba(57, 255, 106, 0.5);
  font-size: 12px;
}

.hudButton {
  width: auto;
  min-height: 24px;
  margin: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .viewerWrap {
    height: 52vh;
  }
}
