:root {
  --bg-0: #0a1228;
  --bg-1: #0e1a36;
  --bg-2: #16244a;
  --bg-3: #1d2f5e;
  --line: #243a73;
  --line-dim: #1a2a55;
  --ink: #e7ecf7;
  --ink-dim: #9eb0d6;
  --ink-mute: #6a7da7;
  --close: #ff5252;
  --far: #4caf50;
  --opt: #4f9cff;
  --speed: #ff9a3c;
  --angle: #b48cff;
  --warn: #ffcf4a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--ink);
  font: 13px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
  height: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--line-dim);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name {
  font-weight: 700; letter-spacing: 0.16em;
  font-size: 14px; color: var(--ink);
}
.brand-sub {
  font-size: 11px; color: var(--ink-mute); letter-spacing: 0.08em; text-transform: uppercase;
}

.readout { display: flex; gap: 18px; align-items: center; }
.rdo {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 2px 12px; border-left: 1px solid var(--line-dim);
}
.rdo label {
  font-size: 10px; color: var(--ink-mute); letter-spacing: 0.1em; text-transform: uppercase;
}
.rdo span {
  font: 600 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.panel {
  overflow-y: auto;
  padding-right: 4px;
}
.panel details {
  background: var(--bg-1);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 0;
}
.panel summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--ink-dim);
  list-style: none;
  user-select: none;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::before {
  content: "▸"; display: inline-block; width: 14px;
  color: var(--ink-mute); transition: transform 0.15s;
}
.panel details[open] summary::before { transform: rotate(90deg); }

.panel .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  padding: 4px 14px 14px;
}
.panel label {
  display: flex; flex-direction: column;
  font-size: 11px;
  color: var(--ink-dim);
  gap: 4px;
}
.panel label.row-2 { grid-column: span 2; flex-direction: row; align-items: center; gap: 8px; }
.panel label.hint { grid-column: span 2; color: var(--ink-mute); font-style: italic; font-size: 11px; }
.panel input[type="number"], .panel input[type="text"] {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  padding: 5px 7px;
  font: 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 100%;
}
.panel input:focus { outline: none; border-color: var(--opt); }
.panel .slider-row { display: flex; gap: 8px; align-items: center; }
.panel .slider-row input[type="range"] { flex: 1; }
.panel .slider-row output {
  font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink); min-width: 38px; text-align: right;
}

.panel button {
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  font: 600 11px/1.2 ui-sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s;
}
.panel button:hover { background: var(--bg-3); border-color: var(--opt); }
.panel button.primary { background: var(--opt); border-color: var(--opt); color: #051030; }
.panel button.primary:hover { filter: brightness(1.1); }

.lut-out {
  grid-column: span 2;
  background: var(--bg-0);
  border: 1px solid var(--line-dim);
  border-radius: 5px;
  padding: 8px 10px;
  margin: 8px 14px 14px;
  max-height: 240px;
  overflow: auto;
  color: var(--ink-dim);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

.plots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}
.plot-card {
  display: flex; flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
}
.plot-title {
  padding: 10px 14px 4px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 600;
}
.plot { flex: 1; min-height: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-dim); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 280px 1fr; }
  .plots { grid-template-columns: 1fr; }
}
