:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4efe5;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.14), transparent 20rem),
    radial-gradient(circle at 85% 5%, rgba(236, 72, 153, 0.16), transparent 18rem),
    #f4efe5;
}

button,
a,
input {
  font: inherit;
}

.app-shell {
  width: min(100% - 1.5rem, 1120px);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  border: 2px solid #1f2933;
  border-radius: 1.25rem;
  background: rgba(255, 252, 245, 0.92);
  box-shadow: 8px 8px 0 #1f2933;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: #2563eb;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(6, 2rem);
  gap: 0.35rem;
}

.swatch {
  width: 2rem;
  height: 2rem;
  border: 2px solid #1f2933;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1f2933;
}

.swatch.selected {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.custom-color,
.status {
  border: 2px solid #1f2933;
  border-radius: 999px;
  background: #fffdf7;
  color: #1f2933;
  font-weight: 800;
}

.custom-color {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0.7rem;
}

.custom-color input {
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.status {
  justify-self: end;
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
}

.status[data-state="ok"] {
  background: #dcfce7;
}

.status[data-state="error"] {
  background: #fee2e2;
}

.canvas-panel {
  overflow: auto;
  border: 2px solid #1f2933;
  border-radius: 1.25rem;
  background: #fffdf7;
  box-shadow: 8px 8px 0 #1f2933;
  padding: 0.75rem;
}

canvas {
  display: block;
  width: min(800px, 100%);
  height: auto;
  margin: 0 auto;
  border: 2px solid #1f2933;
  image-rendering: pixelated;
  cursor: crosshair;
}

@media (max-width: 880px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .controls,
  .status {
    justify-self: stretch;
  }

  .controls {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .swatches {
    grid-template-columns: repeat(4, 2rem);
  }

  .toolbar,
  .canvas-panel {
    box-shadow: 4px 4px 0 #1f2933;
  }
}
