:root {
  --bg: #ffffff;
  --bg-dark: #111111;
  --bg-page: #111111;
  --text: #000000;
  --text-subtle: #737373;
  --text-muted: rgba(38, 38, 38, 0.32);
  --volt: #dbf530;
  --border: #dcdcdc;
  --border-dark: #2a2a2a;
  --space-sm: 14px;
  --space-md: 20px;
  --space-lg: 28px;
  --space-xl: 40px;
  --sans: 'Alliance No.2', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
::selection { background: var(--volt); color: #000; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

/* Layout */
.app { display: flex; min-height: 100vh; align-items: flex-start; }
.canvas-col { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0; }
.canvas-col-header { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 20px; }
.title { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--text-subtle); letter-spacing: 0.04em; text-transform: uppercase; }

/* Stage / canvases */
.stage-wrap { flex: 1; overflow: hidden; }
.stage { position: relative; width: 100%; height: 100vh; }
.stage canvas { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
#output { z-index: 1; }
#interaction { z-index: 2; cursor: crosshair; }

/* Side panel */
.panel {
  flex: 0 0 340px;
  min-height: 100vh;
  background: var(--bg-dark);
  color: #e4e4e7;
  border-left: 1px solid var(--border-dark);
  padding: var(--space-lg) var(--space-md);
  overflow-y: auto;
}

.section { border-top: 1px solid var(--border-dark); }
.section:first-child { border-top: none; }
.section-head {
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  padding: var(--space-md) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-head .chev { color: var(--text-muted); font-family: var(--mono); }
.section-body { padding-bottom: var(--space-md); display: none; }
.section.open .section-body { display: block; }
.section.open .chev::before { content: '−'; }
.section:not(.open) .chev::before { content: '+'; }

/* Form rows */
.field { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: 10px; }
.field label { flex: 0 0 90px; font-family: var(--mono); font-size: 11px; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.04em; }
.field .grow { flex: 1; }
.field .val { font-family: var(--mono); font-size: 11px; color: #a1a1aa; min-width: 36px; text-align: right; }

/* Range inputs */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; flex: 1; height: 18px; }
input[type=range]::-webkit-slider-runnable-track { background: var(--border-dark); height: 1px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; background: var(--volt); width: 10px; height: 10px; border: 1px solid #000; margin-top: -5px; }
input[type=range]::-moz-range-track { background: var(--border-dark); height: 1px; }
input[type=range]::-moz-range-thumb { background: var(--volt); width: 10px; height: 10px; border: 1px solid #000; border-radius: 0; }

/* Other inputs */
select, input[type=number], input[type=text], input[type=file] {
  background: transparent;
  color: #e4e4e7;
  border: 1px solid var(--border-dark);
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 0;
  outline: none;
  min-width: 0;
  color-scheme: dark;
}
select:focus-visible, input:focus-visible { border-color: #e4e4e7; }
input[type=number] { width: 64px; text-align: center; -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
input[type=file] { font-family: var(--sans); }
input[type=color] { background: transparent; border: 1px solid var(--border-dark); width: 28px; height: 22px; padding: 0; cursor: pointer; }
input[type=checkbox] { accent-color: var(--volt); width: 14px; height: 14px; }

/* Buttons */
button {
  background: transparent;
  color: #e4e4e7;
  border: 1px solid var(--border-dark);
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 13px;
  border-radius: 0;
  cursor: pointer;
  transition: color 150ms, border-color 150ms, background-color 150ms;
}
button:hover { color: var(--volt); border-color: #e4e4e7; }
button.primary { background: #000; color: #fff; border-color: #000; position: relative; overflow: hidden; }
button.primary:hover { color: #000; }
button.primary .__pf-text { position: relative; z-index: 2; pointer-events: none; }
button.primary .__pf-overlay { position: absolute; inset: 0; pointer-events: none; }
button.icon { padding: 4px 8px; font-family: var(--mono); }

/* Colorama ramp */
.ramp-stop { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ramp-stop .val { font-family: var(--mono); font-size: 11px; color: #a1a1aa; min-width: 32px; }

/* Toggle rows */
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); }
.toggle-row .label { font-family: var(--mono); font-size: 11px; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.04em; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* Misc */
#dispThumb { display: block; max-width: 100%; max-height: 90px; border: 1px solid var(--border-dark); margin-top: 6px; }
.hint { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin: 6px 0; }
.pair { display: flex; gap: 8px; }
.pair > * { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
