:root {
  --bg: #f4f1ea;
  --fg: #1d1b18;
  --muted: #6b665d;
  --panel: #ffffff;
  --border: #d8d2c4;
  --accent: #ff5a36;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --fg: #ece8de;
    --muted: #9a9486;
    --panel: #1f1d17;
    --border: #36322a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 32px 16px;
}

header { max-width: 900px; margin: 0 auto 24px; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
header p { margin: 4px 0 0; color: var(--muted); }

main {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 700px) {
  main { grid-template-columns: 1fr; }
}

.board {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 0 var(--border), 0 12px 32px -16px rgb(0 0 0 / 0.25);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: crosshair;
  touch-action: manipulation;
}

#cursor {
  position: absolute;
  pointer-events: none;
  outline: 2px solid var(--fg);
  outline-offset: -1px;
  mix-blend-mode: difference;
}

aside {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 16px;
}

#palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

#palette button {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

#palette button[aria-checked="true"] {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.status {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

#cooldown { color: var(--accent); }

.online { margin: 0; color: var(--muted); font-size: 12px; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fbf71;
  animation: pulse 2s infinite;
}

@keyframes pulse { 50% { opacity: 0.3; } }
