:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe3e8;
  --ink: #1b1f24;
  --muted: #6b7280;
  --accent: #6c3ce9;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 260px;
  height: 100vh;
  font: 15px/1.45 system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- stage ---------- */

#stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

#wordmark {
  position: absolute;
  top: 16px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--ink);
  user-select: none;
}
#wordmark .mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--ink);
  position: relative;
}
#wordmark .mark::after {
  content: "";
  position: absolute;
  inset: 6px 3px;
  border-radius: 1px;
  background: #ffe600;
}

#canvas {
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  touch-action: none;
}

#dropzone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 56px 72px;
  text-align: center;
  color: var(--muted);
}
#dropzone.over { border-color: var(--accent); background: #fbf9ff; }
#dropzone .big { font-size: 20px; color: var(--ink); margin: 0 0 4px; }
#dropzone .small { margin: 0 0 16px; }

/* ---------- panel ---------- */

#panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
/* Centre the stack vertically without clipping it when the window is short:
   auto margins on the outer children absorb the slack only when there is any. */
#panel > *:first-child { margin-top: auto; }
#panel > *:last-child { margin-bottom: auto; }

.group { display: flex; flex-direction: column; gap: 8px; }
.group.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

label { font-size: 13px; color: var(--muted); }

/* ---------- buttons ---------- */

button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button:hover:not(:disabled) { background: #f1f2f4; }
button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }

/* A disabled control must not keep its call-to-action colour, or it reads as
   clickable when there is nothing loaded to act on. */
button:disabled { cursor: default; color: var(--muted); opacity: .55; }
button.primary:disabled { background: #eef0f2; border-color: var(--line); color: var(--muted); opacity: 1; }

/* Clear acts on everything above it, so it spans the full width. */
#clear { grid-column: 1 / -1; }

/* ---------- swatches ---------- */

.swatches {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 8px;
}
.swatch {
  width: 30px; height: 30px; padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--line);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* ---------- status and legend ---------- */

#status {
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
  margin: 0;
  text-align: center;
}

/* The tool buttons no longer carry their numbers, so this is the only place
   the number shortcuts are documented. */
/* Two content-width columns, each left-aligned internally, with the pair
   centred as a block in the panel. */
#legend {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  justify-items: start;
  gap: 3px 12px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
#legend dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  white-space: nowrap;
}
#legend dd { margin: 0; }
