:root {
  --paper: #e9edf0;
  --ink: #17263a;
  --muted: #5b6b7e;
  --line: #b9c3cd;
  --computer: #0f766e;
  --computer-tint: #d5ece8;
  --not: #b45309;
  --not-tint: #f6e3cc;
  --good: #15803d;
  --bad: #b91c1c;
  --chip: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a24;
    --ink: #e6ecf2;
    --muted: #93a3b5;
    --line: #2f3d4d;
    --computer: #4fd1c0;
    --computer-tint: #12332f;
    --not: #f0a95a;
    --not-tint: #3a2a14;
    --good: #5ad17f;
    --bad: #ff8a8a;
    --chip: #1d2937;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

.top, main { max-width: 56rem; margin: 0 auto; }

h1 {
  margin: 0;
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.tagline { margin: 0.5rem 0 1.75rem; color: var(--muted); font-size: 1.1rem; }

h2 { margin: 0 0 0.6rem; font-size: 1.1rem; font-weight: 700; }

.count {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.45em;
  margin-left: 0.3em;
  border-radius: 99px;
  background: var(--line);
  color: var(--ink);
  font-size: 0.85em;
  text-align: center;
}

.dropzone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-content: flex-start;
  min-height: 7.5rem;
  padding: 0.75rem;
  border: 2px dashed var(--line);
  border-radius: 0.75rem;
  transition: background 0.12s, border-color 0.12s;
}

.dropzone.over { border-style: solid; background: color-mix(in srgb, var(--ink) 8%, transparent); }

.bins {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.bin.computer h2 { color: var(--computer); }
.bin.computer .dropzone { border-color: var(--computer); background: var(--computer-tint); min-height: 14rem; }
.bin.not h2 { color: var(--not); }
.bin.not .dropzone { border-color: var(--not); background: var(--not-tint); min-height: 14rem; }
.bin .dropzone.over { border-style: solid; filter: brightness(0.96); }

.hint { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.9rem; }

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 7.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--chip);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
  cursor: grab;
  user-select: none;
  touch-action: manipulation;
}

.chip img, .chip .image-fallback {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.35rem;
  background: var(--line);
  pointer-events: none;
}

.chip .image-fallback {
  display: grid;
  place-items: center;
  font-size: 3.5rem;
  line-height: 1;
}

.chip:active { cursor: grabbing; }
.chip.dragging { opacity: 0.4; }
.chip[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.chip:focus-visible, .dropzone:focus-visible, button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.chip.right { border-color: var(--good); }
.chip.wrong { border-color: var(--bad); border-width: 2px; }
.chip .mark { font-weight: 800; }
.chip.right .mark { color: var(--good); }
.chip.wrong .mark { color: var(--bad); }

.actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

button {
  padding: 0.7rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--ink); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.results {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 0.75rem;
}

.results h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.results ul { margin: 0; padding-left: 1.2rem; }
.results li { margin: 0.35rem 0; }

@media (max-width: 36rem) {
  .bins { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
}

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