@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/eb-garamond-latin-500-italic.woff2) format("woff2"); }

/* Matchmakers: letterpress programme.
   Cream paper, black ink, red only for "your turn" and crossings-out.
   Square corners, ruled lines instead of cards, sentence-case italic labels. */

:root {
  --paper: #f4ede1;
  --paper-2: #efe6d6;
  --ink: #1d1a17;
  --muted: #6b5f52;
  --rule: #cdbfa9;
  --red: #9b1c1c;
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 19px/1.45 var(--serif);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
main {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0 0 8px; letter-spacing: -0.005em; }
h1 { font-size: 46px; line-height: 1.02; }
h2 { font-size: 30px; line-height: 1.1; }
h3 { font-size: 21px; line-height: 1.2; }
p { margin: 0 0 12px; }
em, i { font-style: italic; }
strong { font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 16px; }
.center { text-align: center; }
.kicker { font-style: italic; color: var(--muted); font-size: 16px; margin: 14px 0 2px; }

/* masthead */
.brand {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 3px double var(--ink); padding-bottom: 8px; margin-bottom: 14px;
}
.brand svg { flex: none; }
.brand span { font-style: italic; font-size: 22px; }

.hero { padding: 26px 0 12px; }
.hero p.lede, p.lede { font-size: 22px; line-height: 1.35; }

/* sections: ruled, not boxed */
.card { border-top: 1px solid var(--ink); padding: 12px 0 4px; margin: 18px 0; }
.card h3 { margin-bottom: 6px; }
.card.you { border-top: 0; border-left: 3px solid var(--red); padding: 2px 0 4px 14px; }
.board-card { padding-top: 6px; }

ol.steps { padding-left: 22px; margin: 0; }
ol.steps li { margin-bottom: 8px; }

/* buttons: square ink plates */
button, .btn {
  appearance: none; cursor: pointer; display: block; width: 100%;
  font: italic 20px/1.2 var(--serif); color: var(--paper);
  background: var(--ink); border: 1.5px solid var(--ink); border-radius: 0;
  padding: 14px 16px; margin: 12px 0; text-align: center; text-decoration: none;
}
button:active { background: #3a332c; }
button:disabled { background: transparent; color: var(--muted); border-color: var(--rule); cursor: default; }
button.secondary { background: transparent; color: var(--ink); }
button.secondary:active { background: var(--paper-2); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px; font-size: 17px; text-decoration: underline; text-underline-offset: 3px; }
button.inline { display: inline-block; width: auto; padding: 4px 6px; margin: 0; font-size: 16px; }

/* fields */
input, textarea {
  width: 100%; font: 20px/1.3 var(--serif); color: var(--ink);
  background: #fbf7ef; border: 1px solid var(--ink); border-radius: 0;
  padding: 11px 12px; margin: 4px 0; outline: none;
}
input:focus, textarea:focus { box-shadow: inset 0 0 0 1px var(--ink); }
input::placeholder { color: #a39684; font-style: italic; }
label { display: block; font-style: italic; color: var(--muted); font-size: 17px; margin-top: 14px; }
input.code-input { letter-spacing: 0.35em; text-align: center; font-size: 30px; }

/* square option boxes (solo/pair, gender, age) */
.segs { display: flex; flex-wrap: wrap; gap: 0; margin: 4px 0 2px; border-left: 1px solid var(--ink); border-top: 1px solid var(--ink); }
.seg {
  position: relative; margin: 0; font: 18px/1 var(--serif); color: var(--ink); font-style: normal;
  padding: 11px 14px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  cursor: pointer; user-select: none; background: #fbf7ef;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg.on { background: var(--ink); color: var(--paper); }

/* the host's QR */
.qr { background: #fff; border: 1px solid var(--ink); padding: 14px; margin: 10px auto; width: min(76vw, 290px); }
.qr svg { display: block; width: 100%; height: auto; }
.bigcode { font-size: 38px; letter-spacing: 0.3em; text-align: center; margin: 4px 0 0; }

/* lists of teams and suitors */
.teams { list-style: none; padding: 0; margin: 0; }
.teams li { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.teams li:last-child { border-bottom: 0; }
.teams .seat { flex: none; width: 26px; font-style: italic; color: var(--muted); }
.teams .seat.hm { color: var(--red); }
.teams .grow { flex: 1; min-width: 0; }
.teams .sub { display: block; font-size: 16px; font-style: italic; color: var(--muted); }
.teams .tick { color: var(--ink); }
.teams li.current .grow { color: var(--red); }
.dot { display: inline-block; width: 6px; height: 6px; background: #b9ab96; margin-left: 7px; vertical-align: middle; }
.dot.on { background: #4a6b45; }

/* the board as a list (votes) */
.board { list-style: none; padding: 0; margin: 0; }
.board li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 20px; }
.board li:last-child { border-bottom: 0; }
.board .amp { font-style: italic; padding: 0 5px; }
.board li.out { color: #a39684; text-decoration: line-through; text-decoration-color: var(--red); font-size: 18px; }
.board li.cut { color: var(--red); text-decoration: line-through; }
.board .tag { font-size: 15px; font-style: italic; color: var(--muted); text-decoration: none; white-space: nowrap; }
.board .count { font-size: 17px; font-style: italic; white-space: nowrap; }

/* choices: ruled rows with a square box */
.choices { border-top: 1px solid var(--ink); margin: 6px 0 4px; }
.choices button {
  display: flex; align-items: center; gap: 12px; text-align: left; margin: 0;
  background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--rule);
  padding: 12px 2px; font: 21px/1.2 var(--serif);
}
.choices button::before { content: ""; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--ink); }
.choices button.picked::before { background: var(--ink); }
.choices.cutting button.picked { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.choices button:last-child { border-bottom-color: var(--ink); }
.choices button:disabled { color: #a39684; }
.choices .hint { margin-left: auto; font-size: 15px; font-style: italic; color: var(--muted); text-decoration: none; }

.timer { font-size: 64px; text-align: center; font-variant-numeric: lining-nums tabular-nums; margin: 4px 0; }
.timer.over { color: var(--red); font-style: italic; font-size: 44px; }

.progress { display: flex; gap: 4px; margin: 2px 0 4px; }
.progress span { flex: 1; height: 3px; background: var(--rule); }
.progress span.done { background: var(--ink); }
.progress span.now { background: var(--red); }

.reveal { text-align: center; padding: 14px 0 4px; }
.reveal .kicker { margin: 0 0 4px; }
.reveal .names { font-size: 44px; line-height: 1.05; margin: 6px 0; }
.reveal .names em { color: var(--red); }
.reveal .names.two { font-size: 32px; text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 11px 16px; font: italic 17px var(--serif);
  max-width: 90vw; z-index: 10;
}
#offline {
  position: fixed; top: 0; left: 0; right: 0; background: var(--ink); color: var(--paper);
  text-align: center; font: italic 16px var(--serif); padding: calc(6px + env(safe-area-inset-top)) 0 6px; z-index: 10;
}
.spacer { height: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row button { margin: 4px 0; }

img.invite { display: block; width: 100%; height: auto; border: 1px solid var(--ink); margin: 14px 0 4px; }

/* read this out loud: a double-ruled box */
.aloud { border: 3px double var(--ink); padding: 12px 16px 4px; margin: 16px 0; background: #fbf7ef; }
.aloud-head { display: flex; align-items: center; gap: 8px; color: var(--red); font-style: italic; font-size: 19px; margin-bottom: 2px; }
.aloud-head svg { width: 20px; height: 20px; }
.aloud-note { font-style: italic; color: var(--muted); font-size: 16px; margin-bottom: 8px; }
.aloud p { font-size: 22px; line-height: 1.42; margin: 0 0 12px; }

/* someone else is reading */
.listen { display: flex; align-items: center; gap: 10px; padding: 4px 0 4px 12px; margin: 14px 0; border-left: 1px solid var(--muted); font-style: italic; color: var(--muted); }
.listen svg { flex: none; color: var(--muted); }
.listen strong { color: var(--ink); font-style: normal; }

/* whose turn: a ruled line that stays at the top */
.turn {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  margin: -14px -20px 10px; padding: max(10px, env(safe-area-inset-top)) 20px 10px;
  border-bottom: 1px solid var(--ink); font-size: 19px; line-height: 1.3;
}
.turn .lead { font-style: italic; }
.turn.mine { color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
.turn.wait { color: var(--muted); font-style: italic; }
.turn.all { color: var(--ink); }

/* the connections board graphic: dots on a ring, names outside, curved lines */
svg.graph { display: block; width: 100%; height: auto; overflow: visible; }
.graph .ln { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.graph .ln.out { stroke: #b9ab96; stroke-width: 1.1; stroke-dasharray: 0.02 0.02; }
.graph .ln.cut { stroke: var(--red); stroke-width: 1.6; stroke-dasharray: 0.02 0.02; }
.graph .ln.win { stroke: var(--red); stroke-width: 3.5; }
.graph .ln.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mm-draw 0.9s ease-out forwards; }
.graph .ln.fade { animation: mm-fade 0.9s ease-out both; }
.graph .x path { stroke: #a39684; stroke-width: 1.8; fill: none; }
.graph .x.cut path { stroke: var(--red); stroke-width: 2.4; }
.graph .node circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.graph .node text { font: 19px var(--serif); fill: var(--ink); }
.graph .node text.sub { font: italic 14px var(--serif); fill: var(--muted); }
.graph .node.mine text:not(.sub) { text-decoration: underline; text-underline-offset: 3px; }
.graph .node.current circle, .graph .node.win circle { fill: var(--red); }
.graph .node.current text:not(.sub), .graph .node.win text:not(.sub) { fill: var(--red); }
.graph .node.from text:not(.sub) { font-style: italic; }
.graph .node.taken { opacity: 0.3; }
.graph .node.pickable { cursor: pointer; }
.graph .node.pickable circle { fill: var(--paper); stroke: var(--red); stroke-width: 2; }
.graph .node.pickable text:not(.sub) { fill: var(--red); }
.graph .node.pickable:focus { outline: none; }
.graph .node.pickable:active circle, .graph .node.pickable:focus circle { fill: var(--red); }
.graph .hit { fill: transparent; }
.graph .node.empty circle { fill: transparent; stroke: #b9ab96; stroke-dasharray: 2 2; stroke-width: 1.4; }
.graph .node.empty text { fill: #a39684; font-style: italic; font-size: 17px; }
.graph .node.empty.current circle { stroke: var(--red); }
.graph .node.empty.current text { fill: var(--red); }
.graph .node.pop { animation: mm-pop 0.7s ease-out both; }

/* ballots: pairs vote one after the other on one phone */
.ballot { margin: 4px 0 12px; }
.ballot + .ballot { border-top: 1px solid var(--rule); padding-top: 12px; }
.ballot h3 .tick { font-size: 16px; font-style: italic; color: var(--muted); margin-left: 6px; }

@keyframes mm-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mm-fade { from { stroke: var(--red); stroke-width: 3; } }
@keyframes mm-pop { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .graph .ln.draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .graph .ln.fade, .graph .node.pop { animation: none; }
}

/* undo: a quiet link under the turn line */
.undo { text-align: right; margin: -6px 0 6px; }
.undo button { font-size: 16px; padding: 2px 0; }
.teams li .ghost.inline { align-self: center; }

/* stats page */
.stats-table { width: 100%; border-collapse: collapse; font-size: 17px; }
.stats-table th, .stats-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th { font-weight: 400; font-style: italic; color: var(--muted); }
.choices.backing button.picked { color: var(--red); }
.qr.small { width: min(52vw, 200px); padding: 10px; }
.rejoin .code { letter-spacing: 0.08em; }
textarea { resize: vertical; }
.tick-row { display: flex; gap: 10px; align-items: flex-start; font-style: normal; color: var(--ink); margin: 12px 0 0; cursor: pointer; }
.tick-row input { width: 20px; height: 20px; padding: 0; margin: 3px 0 0; flex: none; accent-color: var(--ink); }
