:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --panel: #141414;
  --line: #2e2e2e;
  --text: #e0ddd5;
  --muted: #9a958a;
  --gold: #e8a13f;
  --gold-soft: #e7bd7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}
button, select, input { font: inherit; }
button, select {
  border: 1px solid #3a3a3a;
  background: #1c1c1c;
  color: #d6d2c8;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover, select:hover { border-color: #6b6150; background: #232323; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.primary { background: var(--gold); border-color: var(--gold); color: #17120b; font-weight: 600; }
button.primary:hover { background: #f0b155; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: #111;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 16px; letter-spacing: -0.2px; }
.brand .by { color: var(--muted); font-size: 12px; }
.logo { width: 18px; height: 18px; background: var(--gold); box-shadow: inset 0 0 0 4px #121212, 0 0 0 1px #3a3022; border-radius: 3px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; min-height: 0; }
.tools { border-right: 1px solid var(--line); padding: 18px; display: grid; gap: 12px; align-content: start; background: var(--panel); }
.tools h2 { margin: 6px 0 0; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #8c968f; font-weight: 500; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool-grid button.on { border-color: var(--gold); color: var(--gold-soft); background: #1d1810; }
.row { display: flex; gap: 8px; align-items: center; color: #c9c5bb; }
.stack { display: grid; gap: 6px; color: #c9c5bb; font-size: 13px; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.palette button { aspect-ratio: 1; padding: 0; border-radius: 4px; border: 1px solid #000; }
.palette button.on { outline: 2px solid var(--gold); outline-offset: 1px; }
input[type="color"] { width: 100%; height: 34px; border: 1px solid #3a3a3a; border-radius: 6px; background: #1c1c1c; padding: 2px; }
.current { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
#swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid #000; display: inline-block; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #c9bfae; }

.stage { display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px; min-width: 0; }
#art {
  width: min(78vh, 100%);
  max-width: 640px;
  aspect-ratio: 1;
  height: auto;
  image-rendering: pixelated;
  background:
    conic-gradient(#1b1b1b 25%, #222 0 50%, #1b1b1b 0 75%, #222 0) 0 0 / 16px 16px;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: crosshair;
  touch-action: none;
}
.hint { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.foot { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot a { color: var(--gold-soft); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .tools { border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: 1fr 1fr; }
  .tools h2, .palette, .tool-grid, .current { grid-column: 1 / -1; }
  .stage { padding: 16px; }
}
