:root {
  --bg: #0a0a0a;
  --a: #171717;
  --b: #121212;
  --on: #ece7dc;
  --on2: #ddd7ca;
  --cell: 64px;
  --cols: 8;
  --pad: 24px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  transition: background-color 1.4s ease;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
}

#board {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#board.gone {
  opacity: 0;
  transform: scale(0.985);
}

.c {
  background: var(--a);
  transition: background-color 0.34s ease var(--d, 0ms);
  cursor: pointer;
}

.c.k { background: var(--b); }
.c.on { background: var(--on); }
.c.k.on { background: var(--on2); }

@media (hover: hover) {
  .c:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on) 30%, transparent); }
}

#bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(var(--cols) * var(--cell));
  height: 44px;
  margin-top: 4px;
  color: var(--on);
  transition: color 1.4s ease;
}

#bar button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 -8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.32;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

#bar button:hover { opacity: 0.7; }
#bar button:focus-visible { outline: 1px solid currentColor; outline-offset: -4px; }
#bar button:disabled { opacity: 0.08; cursor: default; }

#bar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#pips {
  display: flex;
  gap: 10px;
}

#pips i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.3;
  transition: background-color 0.6s ease, opacity 0.6s ease;
}

#pips i.done {
  background: currentColor;
  opacity: 0.65;
}

@media (prefers-reduced-motion: reduce) {
  body,
  #board,
  .c { transition-duration: 0.01s; }
}
