:root {
  color-scheme: light;
  font-family: 'Trebuchet MS', system-ui, sans-serif;
  color: #16324f;
  background: #fff2e6;
  --sky: #1b6ca8;
  --ink: #16324f;
  --muted: #486581;
  --paper: #fff;
  --tint: #f3f9ff;
  --line: #dbeaf7;
  --gold: #ffd166;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(12px, 4vw, 42px);
  background:
    radial-gradient(circle, #1b6ca81a 1px, transparent 1.5px) 0 0 / 23px 23px,
    linear-gradient(170deg, #ffe8d6, #fff7ea 45%, #e3f2fd);
}

.app {
  width: min(100%, 680px);
  margin: 0 auto;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 25px;
  background: var(--paper);
  box-shadow: 0 8px 0 #16324f10, 0 20px 44px #16324f18;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(12px, 4vw, 26px);
  color: white;
  background: radial-gradient(ellipse at 98% 120%, #2986ba, transparent 65%), var(--sky);
}

.brand {
  margin: 0 0 3px;
  color: #ffe3a1;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(1.2rem, 4.4vw, 2rem); line-height: 1.1; }

.mascots { display: flex; padding-inline-start: 3px; }

.mascots span {
  display: grid;
  place-items: center;
  width: clamp(24px, 7vw, 40px);
  aspect-ratio: 1;
  margin-inline-start: -3px;
  border: 2px solid #a9dfff;
  border-radius: 50%;
  background: #fff7e3;
  font-size: clamp(.77rem, 3vw, 1.3rem);
}

.mascots span:nth-child(2) { transform: translateY(-4px); background: #e8f6ff; }

.toolbar, .canvas-tools, .stickers {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 12px 16px;
}

.toolbar, .stickers { padding: 13px clamp(12px, 4vw, 24px); }
.toolbar { border-bottom: 1px solid var(--line); }
.control-group { display: grid; gap: 7px; }
.row, .palette { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.control-label {
  margin: 0;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 5px 10px;
  border: 1px solid #e2eef8;
  border-radius: 11px;
  background: var(--tint);
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .16s ease, transform .16s ease;
}

button[aria-pressed='true']:not(.swatch) {
  border-color: #e8961e;
  background: #ffc153;
  color: #533104;
}

button.clear { background: var(--paper); }
button.clear:hover { background: var(--tint); }
button.clear svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button:hover { transform: translateY(-2px); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

.canvas-wrap { padding: 12px clamp(10px, 3vw, 20px) 15px; background: var(--tint); }
.canvas-tools { margin: 0 2px 10px; align-items: center; }
.palette { gap: clamp(4px, 1.4vw, 9px); }

.swatch {
  position: relative;
  width: clamp(28px, 7vw, 38px);
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
}

.swatch::before {
  content: '';
  position: absolute;
  inset: 2px;
  border: 2px solid var(--paper);
  border-radius: inherit;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #16324f29;
}

.swatch[aria-pressed='true']::before { box-shadow: 0 0 0 2px var(--ink); }
.hint { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 700; }

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  outline: 1px solid #9cc9ec;
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 3px 0 #dbeaf7;
  touch-action: none;
  cursor: crosshair;
}

.stickers { justify-content: flex-start; align-items: center; border-top: 1px solid var(--line); }
.sticker-heading { display: grid; gap: 4px; }
.sticker-row { gap: 7px; }
.sticker-btn { width: 42px; padding: 3px; border-color: #f4d285; background: #fff8e7; font-size: 1.2rem; }
.sticker-btn:hover { background: #ffecb8; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 450px) {
  .toolbar, .stickers { gap: 10px; }
  .canvas-tools { gap: 8px; }
  .sticker-row { gap: 6px; }
  .sticker-btn { width: 38px; }
}

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