:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1d1f22;
  --muted: #5d6268;
  --line: #e3ddd2;
  --accent: #1f7a63;
  --accent-press: #186250;
  --accent-ink: #ffffff;
  --accent-soft: #e0f0e9;
  --accent-soft-ink: #145443;
  --plain-soft: #eeeae3;
  --error: #b3261e;
  --error-soft: #fbe9e7;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 6px 20px rgb(0 0 0 / 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --surface: #1d1f22;
    --ink: #ecebe8;
    --muted: #a6aab0;
    --line: #2f3236;
    --accent: #4cc39f;
    --accent-press: #3fae8c;
    --accent-ink: #0b261d;
    --accent-soft: #163a2f;
    --accent-soft-ink: #92e2c6;
    --plain-soft: #272a2e;
    --error: #ff8a80;
    --error-soft: #3a1d1b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
}

.top { text-align: center; margin-bottom: 22px; }
.mark { display: block; margin: 0 auto 10px; }
h1 { font-size: 1.85rem; line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0 auto; max-width: 30em; color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The big "Pick photos" area */
.pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  border: 2px dashed var(--line);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.pick:hover, .pick.over { border-color: var(--accent); }
.pick:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.pick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 14px 20px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.2rem;
  font-weight: 700;
}
.pick:active .pick-btn { background: var(--accent-press); }
.pick-btn svg { width: 28px; height: 28px; flex: none; }
.pick-sub { color: var(--muted); font-size: 0.95rem; }
.desk { display: none; }
@media (hover: hover) and (pointer: fine) { .desk { display: inline; } }

.steps {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.num {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-weight: 700;
  font-size: 0.95rem;
}
.steps li > span:last-child { padding-top: 2px; }

/* Results */
.results { margin-top: 24px; }
.summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 12px;
}
.summary .check {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
.summary .check svg { width: 18px; height: 18px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--plain-soft);
  overflow: hidden;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.info { min-width: 0; }
.name {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.chip {
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--plain-soft);
  color: var(--muted);
}
.chip.good { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; }
.chip.error { background: var(--error-soft); color: var(--error); font-weight: 600; }
.save-one {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  display: grid;
  place-items: center;
}

/* Bottom action bar stays on screen while scrolling the list */
.actions {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  margin: 16px -16px 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}
.btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 2px solid var(--accent);
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { background: var(--accent-press); border-color: var(--accent-press); }
.btn.big { min-height: 60px; font-size: 1.15rem; }
.btn.secondary { background: var(--surface); color: var(--accent); font-size: 1rem; min-height: 52px; }
.btn.secondary:active { background: var(--accent-soft); }
.btn svg { width: 26px; height: 26px; flex: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.link {
  justify-self: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
}
.btn:focus-visible, .link:focus-visible, .save-one:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.hint {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

.foot {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}
.foot svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.25);
  z-index: 10;
}
