:root {
  --bg: #0f1418;
  --surface: #151b20;
  --border: #2b333a;
  --text: #e6edf3;
  --muted: #9aa6b2;
  --accent: #3da9fc;
  --accent2: #ffb74d;
  --ok: #4caf50;
  --bad: #ff6b6b;
  --radius: 14px;
  --pad: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

/* ================= HEADER / FOOTER ================= */
.app-header,
.app-footer {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #12171c, #0f1418);
}
.app-footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  opacity: 0.85;
}
.app-header h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.app-header .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

/* ================= MAIN LAYOUT ================= */
.layout {
  height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.no-scroll {
  overflow: hidden;
}

/* ================= CONTROLS ================= */
.controls {
  align-items: stretch;
  justify-content: flex-start;
}

.group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex: 0 0 auto;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 30px;
}
.row label {
  flex: 1 1 auto;
  color: var(--muted);
}
.row input[type="range"] {
  flex: 1 1 100%;
  accent-color: var(--accent);
  min-width: 140px;
}
.row input.num {
  flex: 0 0 90px;
  min-width: 0;
  padding: 5px 6px;
  background: #0f1418;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.row .wide {
  flex: 0 0 110px;
}

.buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
button {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1418;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.06s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, background 0.2s ease;
  font-size: 12px;
}
button:hover {
  transform: translateY(-1px);
  border-color: #3a4651;
}
#reset {
  background: var(--accent);
  border-color: #2f82c4;
  color: #03141f;
}

/* ================= PRESET BUTTONS ================= */
.preset-btn {
  background: #162027;
}
.preset-btn.active {
  background: #1d2a34;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 169, 252, 0.25) inset,
    0 4px 18px rgba(61, 169, 252, 0.12);
  color: #d8f1ff;
}

/* ================= PATTERN BUTTONS ================= */
.pattern-btn {
  background: #1c2024;
  color: #e6edf3;
}
.pattern-btn.active {
  background: #243038;
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px rgba(255, 183, 77, 0.25) inset,
              0 4px 18px rgba(255, 183, 77, 0.12);
  color: #ffe7c1;
}

/* ================= RANDOMIZE BUTTON ================= */
#randomize {
  background: #222a1e;
  color: #c1f5c1;
}
#randomize:hover {
  background: #2b3528;
}

/* ================= CANVAS / VIZ ================= */
.viz {
  position: relative;
}
#stage {
  width: 100%;
  height: 100%;
  background: #0b1014;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.info {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  background: rgba(15, 20, 24, 0.35);
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(43, 51, 58, 0.6);
}

/* HUD near the circle */
.hud {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 14, 18, 0.85);
  color: var(--text);
  border: 1px solid rgba(43, 51, 58, 0.8);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 11px;
  white-space: nowrap;
  transform: translate(10px, -30px);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .controls {
    height: 38vh;
  }
  .viz {
    height: 62vh;
  }
}

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