:root {
  color-scheme: light;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  background: #ff4e66;
  color: #050505;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    repeating-radial-gradient(circle at 20% 15%, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 4px),
    linear-gradient(135deg, #0b55ff 0%, #ff65b7 31%, #ff4638 55%, #fff200 76%, #75ff1f 100%);
  background-attachment: fixed;
}

.app {
  width: min(100%, 980px);
}

.brand-banner {
  display: block;
  width: 100%;
  height: auto;
  border: 5px solid #050505;
  border-radius: 8px;
  box-shadow: 10px 10px 0 #050505;
  margin-bottom: 24px;
}

.workspace {
  position: relative;
  padding: clamp(18px, 4vw, 34px);
  border: 5px solid #050505;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 242, 0, 0.92), rgba(71, 255, 105, 0.88) 34%, rgba(49, 139, 255, 0.88) 67%, rgba(255, 102, 190, 0.92)),
    #ffffff;
  box-shadow: 12px 12px 0 #050505;
  overflow: hidden;
}

.workspace::after {
  content: "+";
  position: absolute;
  font-family: monospace;
  font-size: 46px;
  line-height: 1;
  color: #050505;
  pointer-events: none;
}

.workspace::after {
  left: 22px;
  bottom: 18px;
  color: #ffffff;
}

.topbar {
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.intro {
  max-width: 760px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 3px solid #050505;
  border-radius: 8px;
  background: #d9ff32;
  font-size: 0.76rem;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 #050505;
}

h1 {
  margin: 0 0 6px;
  max-width: 100%;
  font-size: clamp(2.2rem, 7vw, 5.4rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #ffffff;
}

p {
  margin: 0;
  max-width: 100%;
  color: #050505;
  font-size: 1rem;
  line-height: 1.5;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

.tool-panel {
  display: grid;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  padding: 12px;
  color: #050505;
  background: rgba(255, 255, 255, 0.86);
  border: 4px solid #050505;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 6px 6px 0 #050505;
}

.color-control,
.size-control,
.view-control {
  display: grid;
  gap: 8px;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(8, 36px);
  gap: 8px;
  max-width: 100%;
}

.color-swatch {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid #050505;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  box-shadow: 3px 3px 0 rgba(5, 5, 5, 0.85);
  color: #050505;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    1px 1px 0 #ffffff,
    -1px 1px 0 #ffffff,
    1px -1px 0 #ffffff,
    -1px -1px 0 #ffffff;
}

.color-swatch.is-selected {
  outline: 4px solid #ffffff;
  outline-offset: 2px;
  transform: translate(-1px, -1px);
}

.color-swatch:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 2px;
}

.size-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.size-option {
  min-width: 68px;
  height: 36px;
  padding: 0 10px;
  border: 3px solid #050505;
  border-radius: 4px;
  background: #ffffff;
  color: #050505;
  box-shadow: 3px 3px 0 rgba(5, 5, 5, 0.85);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
}

.size-option.is-selected {
  background: #d9ff32;
  outline: 4px solid #ffffff;
  outline-offset: 2px;
  transform: translate(-1px, -1px);
}

.size-option:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 2px;
}

.toggle-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 156px;
  height: 42px;
  padding: 0;
  border: 3px solid #050505;
  border-radius: 4px;
  background: #ffffff;
  color: #050505;
  box-shadow: 3px 3px 0 rgba(5, 5, 5, 0.85);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  overflow: hidden;
}

.toggle-option {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  height: 100%;
  pointer-events: none;
}

.toggle-knob {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: 4px;
  width: calc(50% - 6px);
  height: calc(100% - 8px);
  border: 3px solid #050505;
  border-radius: 3px;
  background: #d9ff32;
  box-shadow: 2px 2px 0 rgba(5, 5, 5, 0.85);
  transition: transform 160ms ease;
}

.toggle-switch.is-selected .toggle-knob {
  transform: translateX(calc(100% + 4px));
}

.toggle-switch:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 2px;
}

.draw-area {
  display: grid;
  justify-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.canvas-wrap {
  width: min(100%, 610px);
  padding: 14px;
  background: #050505;
  border-radius: 8px;
  box-shadow: 10px 10px 0 rgba(255, 255, 255, 0.78), 18px 18px 0 #050505;
}

.pixel-grid {
  --grid-size: 4;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(var(--grid-size), minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1;
  background: #ffffff;
  border: 4px solid #050505;
  touch-action: none;
  user-select: none;
}

.pixel {
  display: grid;
  place-items: center;
  appearance: none;
  border: 1px solid #96a0aa;
  background: #ffffff;
  color: #050505;
  cursor: pointer;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  font: inherit;
  font-size: clamp(0.55rem, calc(12rem / var(--grid-size)), 2.2rem);
  font-weight: 900;
  line-height: 1;
  image-rendering: pixelated;
  touch-action: none;
}

.pixel-grid.show-numbers .pixel {
  background: #ffffff !important;
}

.pixel:hover,
.pixel:focus-visible {
  outline: 4px solid #d9ff32;
  outline-offset: -3px;
  z-index: 1;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.button {
  min-height: 46px;
  border: 4px solid #050505;
  border-radius: 8px;
  padding: 0 20px;
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 5px 5px 0 #050505;
}

.button-primary {
  background: #d9ff32;
  color: #050505;
}

.button-secondary {
  background: #ff63bd;
  color: #050505;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 6px 6px 0 #050505;
}

@media (max-width: 720px) {
  body {
    padding: 16px;
    place-items: start center;
  }

  .topbar {
    margin-bottom: 18px;
  }

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

  .tool-panel {
    width: fit-content;
  }

  .color-swatch {
    width: 34px;
    height: 34px;
  }

  .canvas-wrap {
    padding: 10px;
    box-shadow: 7px 7px 0 rgba(255, 255, 255, 0.78), 12px 12px 0 #050505;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: clamp(2rem, 16vw, 3.6rem);
  }
}

@media (min-width: 760px) {
  h1 {
    width: max-content;
    white-space: nowrap;
  }

  .intro p {
    width: max-content;
    white-space: nowrap;
  }
}
