:root {
  --bg: #f4f1ea;
  --card: #fbf9f5;
  --raised: #ebe5da;
  --text: #1f1b16;
  --text-2: #5e554a;
  --muted: #776e62;
  --line: rgba(31, 27, 22, 0.1);
  --pencil: #b23f28;
  --btn: #1f1b16;
  --btn-text: #f7f4ee;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --card: #1d1b18;
    --raised: #292622;
    --text: #efe9de;
    --text-2: #aaa398;
    --muted: #8f897f;
    --line: rgba(239, 233, 222, 0.09);
    --pencil: #e2684d;
    --btn: #efe9de;
    --btn-text: #1a1815;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
p { margin: 0; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1040px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* the mark: the name with one pencil line through it */
.top { height: 40px; display: flex; align-items: center; }
.mark {
  position: relative;
  font: 500 22px/1 var(--serif);
  letter-spacing: -0.01em;
}
.mark::after {
  content: "";
  position: absolute;
  left: -3px; right: -4px; top: 54%;
  height: 2px;
  background: var(--pencil);
  border-radius: 2px;
  transform: rotate(-4deg);
}

.main {
  flex: 1;
  display: grid;
  gap: 40px;
  padding: 40px 0 48px;
  align-content: start;
}

h1 {
  margin: 0 0 16px;
  font: 400 36px/1.1 var(--serif);
  letter-spacing: -0.015em;
  max-width: 14ch;
  text-wrap: balance;
}
.lede { color: var(--text-2); max-width: 34rem; text-wrap: pretty; }

.pick {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-hint { color: var(--muted); font-size: 14px; }
@media (hover: none) { .drop-hint { display: none; } }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font: 500 17px/1 var(--sans);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease), opacity 120ms var(--ease);
}
.button:active { transform: scale(0.98); opacity: 0.9; }
.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.pick .button { flex: 1 1 100%; }
.button.small { height: 40px; padding: 0 16px; font-size: 15px; border-radius: 10px; }
.button.quiet { background: var(--raised); color: var(--text); }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; }
.pick:focus-within .button { outline: 2px solid var(--pencil); outline-offset: 3px; }

.promise {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
  max-width: 30rem;
}
.promise svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }

/* results */
.panel { display: grid; gap: 12px; align-content: start; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar[hidden] { display: none; }
.count { color: var(--text-2); font-size: 15px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.results:empty { display: none; }

.card {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  animation: rise 280ms var(--ease) both;
}
.example { position: relative; }
.example::before {
  content: "What comes off";
  display: block;
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.row { display: flex; gap: 16px; align-items: center; }
.thumb {
  flex: none;
  width: 72px; height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}
.thumb img, .thumb svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.info { min-width: 0; flex: 1; }
.name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font: 400 13px/1.5 var(--mono); font-variant-numeric: tabular-nums; }
.meta.bad { color: var(--pencil); font-family: var(--sans); }

.found { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.found li { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: baseline; min-height: 28px; padding: 2px 0; }
.found .k { color: var(--text-2); font-size: 15px; white-space: nowrap; }
.found s {
  position: relative;
  justify-self: start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 3px;
  margin-left: -3px;
  text-decoration: none;
  color: var(--muted);
  font: 400 13px/1.5 var(--mono);
}
.found s:empty::before { content: "removed"; }
/* the signature: a grease-pencil line through what was removed */
.found s::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 52%;
  height: 2px;
  border-radius: 2px;
  background: var(--pencil);
  transform-origin: left center;
  transform: rotate(-1.2deg);
  animation: strike 360ms var(--ease) both;
  animation-delay: calc(160ms + var(--i, 0) * 70ms);
}
.found.clean li { grid-template-columns: 1fr; color: var(--text-2); font-size: 15px; }

.kept { margin-top: 12px; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.actions .button { flex: 1; }
.working .meta::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1s steps(4) infinite; }

@keyframes strike { from { transform: rotate(-1.2deg) scaleX(0); } to { transform: rotate(-1.2deg) scaleX(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.dropveil {
  position: fixed; inset: 12px;
  display: grid; place-items: center;
  border: 2px solid var(--pencil);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  font: 400 28px/1 var(--serif);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--ease);
}
body.dragging .dropveil { opacity: 1; }

@media (min-width: 880px) {
  .page { padding-left: 40px; padding-right: 40px; }
  .main { grid-template-columns: 1fr 440px; gap: 64px; padding: 96px 0 80px; align-items: start; }
  h1 { font-size: 52px; }
  .lede { font-size: 17px; }
  .pick .button { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition: none !important; }
}
