/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --surface:   #161922;
  --panel:     #1c2030;
  --border:    #2a3045;
  --accent:    #4fc3f7;
  --accent2:   #ab47bc;
  --accent3:   #66bb6a;
  --accent4:   #ffa726;
  --text:      #e0e6f0;
  --muted:     #6b7799;
  --danger:    #ef5350;
  --radius:    8px;
  --font:      'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

header h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

header h1 span {
  color: var(--muted);
  font-weight: 400;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 3px;
}

.mode-tab {
  padding: 4px 12px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-tab.active {
  background: var(--panel);
  color: var(--text);
}

.mode-tab:hover:not(.active) { color: var(--text); }

.spacer { flex: 1; }

.header-stat {
  color: var(--muted);
  font-size: 11px;
}

.header-stat strong {
  color: var(--accent);
  font-size: 12px;
}

/* ─── Layout ───────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Canvas ───────────────────────────────────────────────── */
#canvas-wrap {
  flex: 1;
  position: relative;
  background: var(--bg);
}

canvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}

canvas.grab   { cursor: grab; }
canvas.grabbing { cursor: grabbing; }

.canvas-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.6;
}

/* ─── Side Panel ───────────────────────────────────────────── */
#panel {
  width: 230px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.panel-section {
  border-bottom: 1px solid var(--border);
  padding: 12px;
}

.panel-section:last-child { border-bottom: none; }

.panel-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ─── Sliders ──────────────────────────────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.slider-row label {
  width: 72px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(79,195,247,0.5);
}

.slider-row .val {
  width: 32px;
  text-align: right;
  font-size: 11px;
  color: var(--accent);
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  text-align: center;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

.btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.btn-full {
  width: 100%;
  margin-top: 4px;
}

/* ─── Color swatches ───────────────────────────────────────── */
.swatch-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: white; }

/* ─── Stats scroll ─────────────────────────────────────────── */
#stats-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

#stats-section::-webkit-scrollbar { width: 4px; }
#stats-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
}

.stat-item span:first-child { color: var(--muted); }
.stat-item span:last-child  { color: var(--text); }

/* ─── FPS graph ────────────────────────────────────────────── */
#fps-canvas {
  width: 100%;
  height: 36px;
  display: block;
  border-radius: 4px;
  margin-top: 8px;
  background: var(--bg);
}
