:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  background: #101014;
  color: #f7f4ed;
  --accent: #ff6d4a;
  --panel: #1b1b22;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  background:
    radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 38%),
    #101014;
  transition: background-color 180ms ease;
}

button { font: inherit; }

main {
  height: 100dvh;
  max-width: 1100px;
  margin: auto;
  padding: clamp(12px, 2.5vmin, 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2vmin, 18px);
}

header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1 { font-size: clamp(22px, 4vmin, 42px); line-height: 1; margin: 2px 0 4px; letter-spacing: -.04em; }
.eyebrow { color: var(--accent); font: 700 12px/1 monospace; letter-spacing: .16em; margin: 0; }
#hint { color: #b9b6b0; font-size: 14px; margin: 0; }

#reset {
  min-width: 64px;
  min-height: 44px;
  border: 1px solid #4b4a52;
  border-radius: 999px;
  color: inherit;
  background: #202027;
  cursor: pointer;
}

#reset:hover { border-color: var(--accent); }

#surface {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #33333b;
  border-radius: clamp(18px, 4vmin, 34px);
  background: #17171c;
  box-shadow: inset 0 0 50px #0005, 0 18px 50px #0005;
  outline: none;
  touch-action: none;
  cursor: crosshair;
}

#surface:focus-visible, button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
canvas { display: block; width: 100%; height: 100%; }

nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
nav button {
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #77757d;
  cursor: pointer;
}
nav button span { display: block; font: 700 10px monospace; }
nav button b { display: block; font-size: 12px; margin-top: 3px; }
nav button:hover { color: #ddd9d2; background: #ffffff08; }
nav button[aria-current="true"] { color: #101014; background: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 430px) {
  nav button b { font-size: 0; }
  nav button b::first-letter { font-size: 0; }
  nav button { min-height: 46px; }
}

@media (max-height: 430px) {
  main { grid-template-columns: minmax(0, 1fr) 60px; grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
  header { grid-column: 1; }
  h1 { font-size: 20px; }
  #hint { font-size: 12px; }
  #surface { grid-column: 1; }
  nav { grid-column: 2; grid-row: 1 / 3; grid-template-columns: 1fr; gap: 3px; }
  nav button { min-width: 52px; min-height: 44px; padding: 2px; }
  nav button b { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
