:root {
  --bg: #0e1116;
  --panel: #161b22;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f0b429;
  --accent-text: #1a1300;
  --grid: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { display: flex; flex-direction: column; }

header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
h1 { margin: 0; font-size: 22px; letter-spacing: 0.02em; }
h1 .pi { color: var(--accent); }
.subtitle { margin: 2px 0 0; color: var(--muted); }
.subtitle b { color: var(--text); }

main { flex: 1; display: flex; min-height: 0; }

.panel {
  width: 280px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 8px 16px 16px;
}
.panel section { padding: 10px 0; border-bottom: 1px solid var(--border); }
.panel section:last-child { border-bottom: 0; }
h2 {
  margin: 4px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

label { display: block; margin-bottom: 10px; }
label.check { display: flex; align-items: center; gap: 8px; }

input[type=number], input[type=text], select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }

button {
  padding: 6px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
.row { display: flex; gap: 6px; margin-bottom: 10px; }
.row button:first-child { flex: 1; }

.progress {
  height: 4px;
  margin-top: 10px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
#progressBar { height: 100%; width: 0; background: var(--accent); transition: width 0.1s; }
.muted { color: var(--muted); margin: 6px 0 0; font-size: 12px; }

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
}
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.strip {
  margin-top: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--muted);
  min-height: 2.8em;
}
.strip .cur { color: var(--accent-text); background: var(--accent); border-radius: 2px; }

.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; cursor: grab; }
.stage.dragging { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

@media (max-width: 720px) {
  main { flex-direction: column; }
  .panel { width: auto; max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .stage { min-height: 55vh; }
  .hint { display: none; }
}
