* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0a;
  font-family: -apple-system, 'Inter', 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ── Canvas ── */
#canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  overflow: hidden;
  position: relative;
}

#canvas-container canvas {
  display: block;
}

/* ── Panel ── */
#controls {
  width: 272px;
  min-width: 272px;
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  color: #1a1a1a;
  padding: 0;
  font-size: 11px;
  line-height: 1.45;
  border-left: 1px solid #e8e8e8;
}

.panel-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #111;
}

/* ── Sections ── */
.section {
  border-bottom: 1px solid #f0f0f0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.section-head:hover {
  background: #fafafa;
}

.section-head h3 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin: 0;
}

.chevron {
  transition: transform 0.2s;
  color: #bbb;
}

.section-head.collapsed .chevron {
  transform: rotate(-90deg);
}

.section-body {
  padding: 0 16px 12px;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.section-body.collapsed {
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

/* ── Control rows ── */
.ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ctrl-label {
  font-size: 11px;
  color: #666;
  min-width: 52px;
  flex-shrink: 0;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ── Inputs ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: #e0e0e0;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
  border: none;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #111;
  transform: scale(1.15);
}

input[type="number"],
input[type="text"] {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid #e4e4e4;
  border-radius: 5px;
  font-size: 11px;
  background: #fafafa;
  color: #222;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

input[type="number"]:focus,
input[type="text"]:focus {
  border-color: #aaa;
}

input[type="color"] {
  width: 28px;
  height: 28px;
  border: 2px solid #e8e8e8;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: none;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #e4e4e4;
  border-radius: 5px;
  font-size: 11px;
  background: #fafafa;
  color: #222;
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: #aaa;
}

/* ── Toggle switch ── */
.switch {
  position: relative;
  width: 34px;
  height: 18px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: #ddd;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch .slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .slider {
  background: #222;
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

/* ── Value display ── */
.val {
  font-size: 10px;
  color: #aaa;
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* ── Character input ── */
.char-input {
  flex: 1;
  width: auto;
  text-align: left;
}

/* ── Buttons ── */
.row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.btn {
  padding: 6px 14px;
  border: 1px solid #e4e4e4;
  border-radius: 6px;
  background: #fafafa;
  color: #333;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.btn:hover {
  background: #eee;
}

.btn.accent {
  background: #111;
  color: #fff;
  border-color: #111;
}

.btn.accent:hover {
  background: #333;
}

.btn-sm {
  padding: 4px 10px;
  border: 1px solid #e4e4e4;
  border-radius: 5px;
  background: #fafafa;
  color: #444;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.12s;
}

.btn-sm:hover {
  background: #eee;
}

.full-w {
  width: 100%;
  text-align: center;
}

.times {
  color: #ccc;
  font-size: 11px;
}

/* ── Utility ── */
.hidden {
  display: none !important;
}

.hint {
  font-size: 9px;
  color: #bbb;
  margin-top: 6px;
  line-height: 1.5;
  text-align: center;
}

.footer {
  font-size: 9px;
  color: #ddd;
  text-align: center;
  padding: 12px 0;
}

/* ── Export progress ── */
#exportProgress {
  margin-top: 8px;
}

#exportBar {
  width: 100%;
  height: 3px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

#exportBarFill {
  height: 100%;
  width: 0%;
  background: #111;
  transition: width 0.1s;
}

#exportStatus {
  font-size: 9px;
  color: #aaa;
}

/* ── Scrollbar ── */
#controls::-webkit-scrollbar {
  width: 3px;
}

#controls::-webkit-scrollbar-track {
  background: transparent;
}

#controls::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 2px;
}
