:root {
  color-scheme: dark;
  font: 14px system-ui, sans-serif;
  color: #eff2fa;
  background: #191d26;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header { padding: 12px 16px; }
h1 { font-size: 17px; margin: 0 0 10px; }
.toolbar, .group, .field, #external, footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar, #external, footer { flex-wrap: wrap; }
.group { gap: 4px; }
.field { padding: 0 5px; }

button {
  font: inherit;
  color: inherit;
  background: #272e3d;
  border: 1px solid #414c62;
  border-radius: 5px;
  padding: 6px 9px;
  cursor: pointer;
}

button:disabled { opacity: 0.48; cursor: default; }
button:enabled:hover { background: #384563; }
button[aria-pressed="true"], button.primary { background: #2957a4; border-color: #6f9df3; }
:focus-visible { outline: 2px solid #a4c5ff; outline-offset: 2px; }
input[type="color"] { width: 36px; height: 28px; padding: 1px; cursor: pointer; }
kbd { font: 12px ui-monospace, monospace; color: #c3d0eb; }
#zoom-level { min-width: 4em; text-align: center; }
#brush-size { width: 72px; accent-color: #81a9ff; cursor: pointer; }
#brush-value { min-width: 3.5em; font: 12px ui-monospace, monospace; }
.brush-field { gap: 4px; }
.canvas-settings, .import-bar { margin-top: 8px; }
.canvas-settings summary { width: fit-content; cursor: pointer; padding: 4px; }
.canvas-settings form { margin-top: 6px; }
input[type="number"] { width: 5em; padding: 4px; font: inherit; }
.hint { color: #c5cede; }

#external {
  background: #3a2b19;
  color: #ffdda6;
  padding: 8px 16px;
}

#viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #101319;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

#viewport.pan-ready { cursor: grab; }
#viewport.panning { cursor: grabbing; }

#art {
  position: absolute;
  pointer-events: none;
  background: conic-gradient(#c9cdd5 25%, #f0f1f3 0 50%, #c9cdd5 0 75%, #f0f1f3 0) 0 0 / 16px 16px;
  box-shadow: 0 0 0 1px #626c7f;
}

#canvas, #pixel-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
#canvas { image-rendering: pixelated; }
#pixel-grid {
  background-image: linear-gradient(to right, #30354146 1px, transparent 1px),
                    linear-gradient(to bottom, #30354146 1px, transparent 1px);
  background-size: var(--pixel) var(--pixel);
}
#brush-preview {
  position: absolute;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px #172031, inset 0 0 0 1px #172031;
}

footer { padding: 8px 16px; color: #c5cede; min-height: 36px; }
#position { font: 12px ui-monospace, monospace; }
.tip { margin-left: auto; }
