:root {
  --ink: #2a2a2a;
  --paper: #fbfaf6;
  --accent: #2b6cb0;
  --line: #d9d4c7;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font: 14px/1.4 system-ui, sans-serif; color: var(--ink); background: var(--paper); }
body { display: grid; grid-template-columns: 340px 1fr; }

.side { overflow-y: auto; border-right: 1px solid var(--line); padding: 12px 14px 40px; background: #fff; }
.side h1 { font-size: 18px; margin: 4px 0 8px; }
.side h1 small { display: block; font-weight: normal; color: #6b6b6b; font-size: 12px; }
.side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #555; margin: 14px 0 6px; }
.side section { border-top: 1px solid var(--line); padding-top: 4px; }

label { display: block; margin: 4px 0; }
label.check { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
input, select { width: 100%; padding: 4px 6px; border: 1px solid #bbb; border-radius: 4px; font: inherit; }
input[type=checkbox], input[type=radio] { width: auto; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.row label { margin: 0; }

button, label.button {
  display: inline-block; padding: 5px 10px; border: 1px solid #888; border-radius: 4px;
  background: #f1efe9; color: var(--ink); font: inherit; cursor: pointer;
}
button:hover, label.button:hover { background: #e6e2d6; }
button:disabled { opacity: .5; cursor: default; }

.hint { color: #6b6b6b; font-size: 12px; margin: 4px 0 8px; }
.palette { display: grid; gap: 4px; margin: 6px 0; }
.palette button { text-align: left; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 6px; }
th, td { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: left; }

.stage { position: relative; min-width: 0; min-height: 0; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#msg {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: #fff3cd; border: 1px solid #e0c46b; border-radius: 6px; padding: 6px 12px;
  max-width: 80%; font-size: 13px; pointer-events: none;
}
#msg:empty { display: none; }
#status {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 10px;
  background: rgba(255,255,255,.85); border-top: 1px solid var(--line); font-size: 12px; color: #444;
}

@media (max-width: 760px) {
  body { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  .side { order: 2; border-right: none; border-top: 1px solid var(--line); }
  .stage { order: 1; }
}
