/* Dark neutral palette. No gradients, no external fonts. */
:root {
  color-scheme: dark;
  --bg: #121416;
  --panel: #1a1d21;
  --field: #0f1113;
  --line: #2b3037;
  --text: #d7dade;
  --muted: #8b929a;
  --accent: #8fb3a0;
  --warn: #d9b26a;
  --err: #e0715f;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  display: grid;
  grid-template-columns: 40% 60%;
  height: 100vh;
  min-width: 960px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted { color: var(--muted); }

/* ---- panes ------------------------------------------------------------- */

.pane {
  min-height: 0;
  overflow: auto;
}

.pane-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}

.pane-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.pane-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

h1 { font-size: 18px; font-weight: 600; margin: 0; flex: 1; }
.h2 { font-size: 13px; font-weight: 600; margin: 4px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---- controls ---------------------------------------------------------- */

button {
  font: inherit;
  color: var(--text);
  background: #23282e;
  border: 1px solid #3a4149;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
}

button:hover { background: #2a3038; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea#pattern {
  width: 100%;
  min-height: 320px;
  flex: 0 0 auto;
  font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  resize: vertical;
  tab-size: 4;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-row label { color: var(--muted); }

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.slider-row output {
  min-width: 170px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.banner {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--err);
  background: #2a1a18;
  color: #f2c4bc;
  font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  border-radius: 2px;
}

/* ---- warnings ---------------------------------------------------------- */

.warnings {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.warnings li {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}

.warnings li.none { color: var(--muted); }

/* ---- approximation note ------------------------------------------------- */

.approx {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.approx-title { margin: 0 0 4px; color: var(--text); font-weight: 600; }
.approx ul { margin: 0; padding-left: 16px; }
.approx li { margin-bottom: 2px; }
.approx code { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 11px; }

/* ---- numbers panel ------------------------------------------------------ */

.numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tile {
  background: var(--panel);
  padding: 10px 12px;
  min-width: 0;
}

.tile dt {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile dd {
  margin: 4px 0 0;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gauge {
  margin: 0;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* ---- 3D view ------------------------------------------------------------ */

.view {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  min-width: 0;
  background: #0e1012;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.view-note {
  position: absolute;
  top: 10px;
  left: 12px;
  margin: 0;
  font-size: 12px;
  color: var(--warn);
  pointer-events: none;
}

.legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: 340px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: rgba(20, 22, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}

.legend p { margin: 0; }
.legend-title { color: var(--text); margin-bottom: 4px !important; }
.legend-scale { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 14px; font-variant-numeric: tabular-nums; }
.legend-scale li { display: flex; align-items: center; gap: 6px; }
.legend-note { font-size: 11px; }

.sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid #000;
}
