:root {
  --bg: #fbf7f4;
  --card: #ffffff;
  --ink: #1d1a2b;
  --muted: #6b6678;
  --line: #ebe5e0;
  --brand: #5b3df5;
  --brand-2: #ff4f8b;
  --brand-soft: #efeaff;
  --yes: #12a165;
  --yes-soft: #e3f6ec;
  --no: #e5484d;
  --no-soft: #fde8e8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(29, 26, 43, 0.06), 0 8px 24px rgba(29, 26, 43, 0.08);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 18px; }
.wide { max-width: 1040px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 244, 0.9); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; color: var(--ink); text-decoration: none; }
.logo img { width: 32px; height: 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .08s ease, box-shadow .2s, background .2s;
  background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(91, 61, 245, 0.28);
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .circle:focus-visible { outline: 3px solid rgba(91, 61, 245, 0.35); outline-offset: 2px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; border: 1.5px solid var(--line); }
.btn.soft { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 2px; }

/* Cards & forms */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.label { display: block; font-weight: 700; font-size: 15px; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 14px; }
.field { margin-top: 18px; }
input[type=text], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a49fae; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.error { color: var(--no); font-size: 14px; margin-top: 8px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 15px; user-select: none;
}
.chip[aria-pressed=true], .chip[aria-checked=true] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; text-align: left;
  border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; min-height: 84px;
}
.mode:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 0; }
.mode .e { font-size: 24px; line-height: 1; }
.mode b { font-size: 15px; margin-top: 6px; }
.mode span.s { font-size: 13px; color: var(--muted); line-height: 1.3; }
.mode[aria-checked=true] { border-color: var(--brand); background: var(--brand-soft); }
.mode[aria-checked=true] b { color: var(--brand); }
.mode:focus-visible { outline: 3px solid rgba(91, 61, 245, 0.35); outline-offset: 2px; }

.optlist { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.optlist li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: #faf8f6; border: 1px solid var(--line); }
.optlist .oe { font-size: 20px; width: 26px; text-align: center; flex: none; }
.optlist .on { flex: 1; min-width: 0; }
.optlist .on b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.optlist .on small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; flex: none; }
.x:hover { background: var(--no-soft); color: var(--no); }
.count { font-weight: 700; color: var(--muted); font-size: 14px; }

/* Home */
.hero { padding: 28px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(34px, 8vw, 54px); line-height: 1.04; letter-spacing: -0.035em; margin: 0 0 12px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto; max-width: 30em; }
.trust { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 22px; color: var(--muted); font-size: 14px; font-weight: 600; }
.trust span::before { content: "✓ "; color: var(--yes); }
.steps { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin: 8px 0; }
.step { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.step .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.step h3 { margin: 10px 0 4px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 15px; }
section.block { margin: 44px 0; }
section.block h2 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 14px; }
details { background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
details + details { margin-top: 10px; }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 0; color: var(--muted); }
.recent { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.recent a { display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font-weight: 600; }
.recent a small { color: var(--muted); font-weight: 500; }
footer { color: var(--muted); font-size: 14px; padding: 30px 0 40px; border-top: 1px solid var(--line); margin-top: 40px; }
footer a { color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

/* Pick page */
.pickbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.pickbar h1 { font-size: 20px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.avatar { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.avatar.done::after { content: "✓"; position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--yes); color: #fff; font-size: 10px; display: grid; place-items: center; border: 2px solid var(--bg); }
.people .meta { color: var(--muted); font-size: 14px; font-weight: 600; margin-left: 4px; }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); width: 0; transition: width .3s; }

.stage { position: relative; height: min(62vh, 520px); min-height: 380px; margin: 14px 0 8px; touch-action: none; }
.swipecard {
  position: absolute; inset: 0; border-radius: 26px; background: var(--card); box-shadow: 0 2px 4px rgba(29,26,43,.06), 0 18px 40px rgba(29,26,43,.14);
  overflow: hidden; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; will-change: transform;
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .32s;
}
.swipecard.dragging { transition: none; }
.swipecard.behind { transform: scale(0.95) translateY(14px); opacity: .9; }
.swipecard.behind2 { transform: scale(0.9) translateY(28px); opacity: .6; }
.swipecard .art { flex: 1; display: grid; place-items: center; font-size: 112px; position: relative; min-height: 150px; }
.swipecard .art .mono { font-size: 88px; font-weight: 800; color: rgba(255,255,255,.95); letter-spacing: -0.04em; }
.swipecard .body { padding: 18px 20px 20px; }
.swipecard h2 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.swipecard .sub { color: var(--muted); font-weight: 600; margin-top: 4px; }
.swipecard .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.swipecard .facts span { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #f4f1ee; color: #4a4558; }
.swipecard .hours { margin-top: 8px; color: var(--muted); font-size: 13px; }
.swipecard .maplink { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.92); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; padding: 7px 12px; border-radius: 999px; }
.stamp { position: absolute; top: 26px; font-size: 30px; font-weight: 900; letter-spacing: .04em; padding: 4px 14px; border: 4px solid; border-radius: 12px; opacity: 0; transform: rotate(-12deg); background: rgba(255,255,255,.85); }
.stamp.yes { left: 22px; color: var(--yes); border-color: var(--yes); }
.stamp.no { right: 22px; color: var(--no); border-color: var(--no); transform: rotate(12deg); }

.controls { display: flex; justify-content: center; align-items: center; gap: 22px; padding: 6px 0 4px; }
.circle { width: 68px; height: 68px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; transition: transform .08s; }
.circle:active { transform: scale(.94); }
.circle svg { width: 30px; height: 30px; }
.circle.no { color: var(--no); }
.circle.yes { color: var(--yes); }
.circle.undo { width: 48px; height: 48px; color: var(--muted); }
.circle.undo svg { width: 22px; height: 22px; }
.circle[disabled] { opacity: .4; cursor: default; }
.keys { text-align: center; color: var(--muted); font-size: 13px; margin-top: 4px; }

.invitebar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); margin-bottom: 6px; }
.invitebar p { margin: 0; flex: 1; font-size: 14px; font-weight: 600; color: #3b2aa8; }

.results h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.rank { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.rank li { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #faf8f6; border: 1px solid var(--line); overflow: hidden; }
.rank li .bar { position: absolute; inset: 0 auto 0 0; background: var(--yes-soft); z-index: 0; transition: width .4s; }
.rank li > * { position: relative; z-index: 1; }
.rank li .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li .sc { font-weight: 800; color: var(--yes); font-size: 14px; white-space: nowrap; }
.rank li.match { border-color: var(--yes); }
.waiting { margin-top: 14px; color: var(--muted); font-size: 15px; }
.waiting b { color: var(--ink); }

/* Match overlay */
.overlay { position: fixed; inset: 0; z-index: 50; background: radial-gradient(120% 90% at 50% 0%, #6d4bff 0%, #4b2fd6 45%, #2a1a7a 100%); color: #fff; display: flex; flex-direction: column; overflow: auto; }
.overlay .wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; padding-bottom: 24px; }
.overlay h2 { font-size: clamp(40px, 11vw, 64px); line-height: 1; letter-spacing: -0.04em; margin: 0 0 8px; text-align: center; }
.overlay .lead { text-align: center; font-size: 18px; opacity: .9; margin: 0 0 22px; }
.matchcard { background: #fff; color: var(--ink); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: pop .5s cubic-bezier(.2,1.4,.4,1); }
.matchcard .art { height: 150px; display: grid; place-items: center; font-size: 76px; }
.matchcard .art .mono { font-size: 70px; font-weight: 800; color: #fff; }
.matchcard .body { padding: 16px 20px 20px; }
.matchcard h3 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.matchcard .sub { color: var(--muted); font-weight: 600; }
.matchcard .who { margin-top: 10px; font-weight: 700; color: var(--yes); }
.overlay .actions { display: grid; gap: 10px; margin-top: 18px; }
.overlay .btn { background: #fff; color: var(--brand); box-shadow: none; }
.overlay .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 51; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Sheet / toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; opacity: 0; transition: .25s; z-index: 80; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.center { text-align: center; }
.big-emoji { font-size: 56px; line-height: 1; }
.attrib { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 0 0; }
.attrib a { color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.legal { padding: 10px 0 30px; }
.legal h1 { letter-spacing: -0.02em; }
.legal h2 { font-size: 20px; margin-top: 28px; }

@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .hero { padding-top: 18px; }
  .hero p { font-size: 16px; }
  .panel { padding: 16px; }
  .stage { height: min(54vh, 460px); min-height: 330px; }
}
@media (prefers-reduced-motion: reduce) {
  .swipecard, .confetti i, .matchcard { transition: none !important; animation: none !important; }
}
