:root {
  color-scheme: dark;
  --bg: #0b0c11;
  --fg: #f3f4f8;
  --muted: #9aa0b4;
  --accent: #f0a828;
  --live: #3ddc84;
  --line: rgba(255, 255, 255, 0.1);
  --cell: 12px;
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: radial-gradient(120% 70% at 50% 0%, #1a1f36 0%, var(--bg) 65%) fixed var(--bg);
  color: var(--fg);
}

/* Header */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 16px 20px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 28px;
  height: 28px;
  fill: #29adff;
  filter: drop-shadow(0 0 8px rgba(41, 173, 255, 0.55));
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.artists {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1s infinite;
}

.artists[data-state='live'] .dot {
  background: var(--live);
  animation: pulse 2s infinite;
}

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

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px rgba(61, 220, 132, 0);
  }
}

/* Board. The frame is positioned absolutely so its size never feeds back into the stage's. */

.stage {
  position: relative;
  flex: 1 1 0;
  min-height: 240px;
  margin: 8px 12px;
}

.frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 70px rgba(0, 0, 0, 0.6);
}

.frame canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
  transition: opacity 0.2s;
}

.frame.grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(128, 128, 128, 0.2) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(128, 128, 128, 0.2) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  pointer-events: none;
}

.frame.offline canvas {
  opacity: 0.5;
  cursor: progress;
}

.cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: var(--cell);
  height: var(--cell);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

/* Palette and hints. The bottom padding keeps them clear of the Cloudish badge. */

.tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 52px;
}

.palette {
  display: grid;
  grid-template-columns: repeat(16, 30px);
  gap: 6px;
  min-height: 30px;
}

.swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.08s;
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch[aria-pressed='true'] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-2px);
}

.swatch:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.hints {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.hint-coarse {
  display: none;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link:hover {
  color: var(--fg);
}

@media (max-width: 600px) {
  .bar {
    padding: 12px 14px 4px;
  }

  .palette {
    grid-template-columns: repeat(8, 34px);
  }
}

@media (pointer: coarse) {
  .hint-fine {
    display: none;
  }

  .hint-coarse {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot {
    animation: none !important;
  }
}
