/* One accent colour, large tap targets, phone first. Later gates build on this. */
:root {
  --bg: #fbfaf7;
  --ink: #1f1d1a;
  --muted: #6b665f;
  --line: #e4e0d8;
  --card: #ffffff;
  --accent: #1f6f5f;
  --accent-ink: #ffffff;
  --like: #2e7d4f;
  --unsure: #b8860b;
  --dislike: #b23a3a;
  --free: #2e7d4f;
  --taken: #b23a3a;
  --close: #b8860b;
  --pending: #9a948b;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --ink: #f1ede6;
    --muted: #a39d94;
    --line: #2e2b27;
    --card: #211f1c;
    --accent: #3fa58d;
  }
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
nav.tabs { display: flex; gap: 6px; padding: 8px 16px; max-width: 640px; margin: 0 auto; }
nav.tabs a {
  flex: 1; text-align: center; padding: 10px 8px; border-radius: var(--radius);
  text-decoration: none; color: var(--muted); border: 1px solid var(--line);
}
nav.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button, .button {
  font: inherit; padding: 12px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); min-height: 48px; cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select {
  font: inherit; width: 100%; padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: .95rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem;
  border: 1px solid var(--line); color: var(--muted); background: transparent;
}
.badge.free { color: var(--free); border-color: var(--free); }
.badge.taken { color: var(--taken); border-color: var(--taken); }
.badge.close { color: var(--close); border-color: var(--close); }
.badge.pending, .badge.manual, .badge.error { color: var(--pending); border-color: var(--pending); }
.placeholder { border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; }

/* Gate 1: PIN, founder picker and the names list. */
.error { color: var(--dislike); }
button.wide { width: 100%; margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
button.founder { font-size: 1.2rem; min-height: 64px; }
.who { margin: 4px 0 8px; }
ul.names { list-style: none; margin: 0; padding: 0; }
.name-row .name-title { font-size: 1.1rem; margin-bottom: 4px; }
.name-row .note { margin: 4px 0 8px; }
.name-row .badges { margin: 6px 0; }
.name-row .tally { margin: 0; }
.badge-link { text-decoration: none; }
.retired-reason { color: var(--dislike); margin: 4px 0; }
details summary { cursor: pointer; padding: 12px 0; color: var(--muted); }

/* Gate 2: swipe deck, vote chips and the board. */
.invisible { visibility: hidden; }
.chip {
  display: inline-block; min-width: 2em; padding: 1px 8px; border-radius: 999px;
  font-size: .85rem; text-align: center; color: #fff; background: var(--pending);
}
.chip.like { background: var(--like); }
.chip.unsure { background: var(--unsure); }
.chip.dislike { background: var(--dislike); }
.chip.none { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.progress { margin: 0 0 8px; }
.deck { position: relative; height: min(58vh, 440px); margin: 8px 0 16px; }
.deck .placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; }
.swipe-card {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 24px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08); cursor: grab;
  /* The card owns the gesture: no scrolling, zooming or text selection while dragging. */
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .25s ease, opacity .25s ease;
}
.swipe-card.peek { z-index: 0; transform: translateY(12px) scale(.95); opacity: .6; pointer-events: none; }
.swipe-card.dragging { transition: none; cursor: grabbing; }
.swipe-card.leaving { z-index: 2; pointer-events: none; }
.swipe-card .card-name { font-size: clamp(1.8rem, 8vw, 2.6rem); line-height: 1.1; margin: 0 0 8px; overflow-wrap: anywhere; }
.swipe-card .card-meta { margin: 0 0 12px; }
.swipe-card .card-note {
  margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.swipe-card .badges { margin: 0 0 12px; }
.swipe-label {
  position: absolute; top: 18px; padding: 2px 10px; border: 3px solid currentColor; border-radius: 8px;
  font-size: 1.3rem; font-weight: 800; letter-spacing: .08em; opacity: 0; pointer-events: none;
}
.swipe-label.like { left: 18px; color: var(--like); transform: rotate(-12deg); }
.swipe-label.nope { right: 18px; color: var(--dislike); transform: rotate(12deg); }
.swipe-label.unsure { top: auto; bottom: 18px; left: 50%; color: var(--unsure); transform: translateX(-50%); }
.vote-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vote-buttons button { min-height: 56px; border: none; color: #fff; font-weight: 600; touch-action: manipulation; }
.vote-buttons .vote-dislike { background: var(--dislike); }
.vote-buttons .vote-unsure { background: var(--unsure); }
.vote-buttons .vote-like { background: var(--like); }
.undo-row { display: flex; justify-content: center; margin-top: 10px; }

.toggle { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--muted); cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 0; padding: 0; accent-color: var(--accent); }
ul.board { list-style: none; margin: 0; padding: 0; }
details.board-row { padding: 0; }
details.board-row summary {
  display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 10px; align-items: start;
  padding: 14px 16px; color: var(--ink); list-style: none;
}
details.board-row summary::-webkit-details-marker { display: none; }
.board-row .rank { font-size: 1.2rem; font-weight: 700; color: var(--muted); }
.board-row .score { font-size: 1.3rem; font-weight: 700; text-align: right; }
.board-row .row-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.board-row .row-name { font-size: 1.1rem; overflow-wrap: anywhere; }
.board-detail { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.board-detail ul { margin: 0; padding: 0; list-style: none; }
.board-detail li { margin: 0 0 8px; }
