:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #171613;
  --ink-2: #57534a;
  --ink-3: #6b675d;
  --rule: #d9d3c5;
  --rule-strong: #171613;
  --g: #23824b;
  --g-tint: #e3f1e7;
  --y: #f0c02f;
  --y-tint: #fbf1cf;
  --r: #d6402e;
  --r-tint: #f8e0dc;
  --focus: #1f5fd1;
  --radius: 6px;
  --font: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  font-variation-settings: 'wdth' 100;
}

a { color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

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

/* ---------- frame ---------- */

.masthead {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 2px solid var(--rule-strong);
}
.mark {
  text-decoration: none;
  font-weight: 850; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase;
  font-variation-settings: 'wdth' 115;
}
.mark span { color: var(--ink-3); font-weight: 600; }
.byline { font-size: 13px; color: var(--ink-2); letter-spacing: 0.02em; }
.mast-right { min-width: 0; }
.mast-right .who { justify-content: flex-end; margin: 0; }
.mast-right .rename { margin: 0; flex-wrap: nowrap; }
.mast-right .rename input { flex: 0 1 220px; min-width: 0; }

main { flex: 1; width: 100%; outline: none; }


/* ---------- type ---------- */

.kicker {
  margin: 0 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
}
.display {
  margin: 0 0 16px;
  font-weight: 900; font-size: clamp(28px, 4vw, 44px); line-height: 1; letter-spacing: -0.005em;
  font-variation-settings: 'wdth' 112;
  text-transform: uppercase;
  text-wrap: balance;
}
.lede { margin: 0 0 28px; font-size: 17px; color: var(--ink-2); max-width: 60ch; text-wrap: pretty; }
.lede b { color: var(--ink); }
.key { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: -12px 0 28px; padding: 0; font-size: 15px; color: var(--ink-2); }
.key li { display: inline-flex; align-items: center; gap: 7px; }
.key b { color: var(--ink); }
.key i { flex: none; }
.hint { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.aside { margin: 24px 0 0; font-size: 14px; }
.empty { color: var(--ink-3); font-size: 14px; margin: 0; }
.loading { color: var(--ink-2); }
.section-title {
  margin: 0 0 6px;
  font-size: 15px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase;
  font-variation-settings: 'wdth' 110;
}
.label { margin: 0 0 4px; font-size: 15px; font-weight: 800; }

/* ---------- panels + forms ---------- */

.panel { padding: clamp(32px, 6vw, 72px) clamp(16px, 4vw, 48px); margin: 0 auto; }
.panel.narrow { max-width: 600px; box-sizing: content-box; }
.panel.wide { max-width: 1100px; }

.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }

input[type='text'], input[type='password'], input:not([type]), input[list] {
  width: 100%;
  font: inherit; font-size: 17px; color: var(--ink);
  padding: 12px 14px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
}
input:disabled { opacity: 0.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  font: inherit; font-weight: 800; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--paper); background: var(--ink);
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 120ms ease, background-color 120ms ease;
}
.btn:hover { background: #33312b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--card); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn.big { min-height: 58px; padding: 0 36px; font-size: 17px; }

.linkish {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: none; border: 0; padding: 8px 0; min-height: 36px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.linkish:hover { color: var(--ink); }

h1:focus, .takeaways:focus { outline: none; }
.nowrap { white-space: nowrap; }

.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; margin-bottom: 10px; }
.who .kicker { margin: 0; }
.rename { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; max-width: 520px; }
.rename input { flex: 1 1 200px; padding: 8px 12px; font-size: 16px; }



.note { margin: -12px 0 24px; font-size: 14px; color: var(--ink-2); }
.note b { color: var(--ink); }
.resume { margin: 0 0 36px; padding: 16px 18px; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); }
.resume ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.resume a { font-weight: 750; font-size: 17px; }
.resume span { font-size: 14px; color: var(--ink-2); }

.form-error { margin: 0; color: var(--r); font-weight: 600; font-size: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.share { padding: 22px 0; border-top: 1px solid var(--rule); }
.share:first-of-type { margin-top: 12px; }
.share.private {
  margin-top: 8px; padding: 18px; border: 1.5px dashed var(--ink-2); border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(23, 22, 19, 0.03) 10px 20px);
}
.share.private .copyrow input { color: var(--ink-2); }
.lock {
  display: inline-block; width: 11px; height: 9px; margin-right: 8px; vertical-align: 0;
  background: var(--ink); border-radius: 2px; position: relative;
}
.lock::before {
  content: ''; position: absolute; left: 2px; top: -6px; width: 5px; height: 6px;
  border: 2px solid var(--ink); border-bottom: 0; border-radius: 5px 5px 0 0;
}
.copyrow { display: flex; gap: 8px; max-width: 640px; }
.copyrow .btn { min-width: 170px; }
.copyrow input { font-size: 14px; padding: 9px 12px; min-width: 0; background: var(--card); border-width: 1px; }

/* ---------- the sheet ---------- */

.sheet { padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 48px) 64px; max-width: 1240px; margin: 0 auto; }
.sheet-head { margin-bottom: 8px; }
.sheet-head .lede { max-width: none; margin-bottom: 32px; }

.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 0 -8px 18px; padding: 12px 8px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.progress { font-size: 14px; color: var(--ink-2); min-width: 120px; }
.progress strong { color: var(--ink); font-size: 18px; }
.bar { flex: 1 1 140px; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--ink); transition: width 200ms ease; }
.tally { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 3px 8px 3px 5px; border-radius: 99px; background: var(--card); border: 1px solid var(--rule); }
button.chip { font: inherit; font-size: 13px; font-weight: 700; color: inherit; cursor: pointer; }
button.chip:hover { border-color: var(--ink-3); }
button.chip[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip i { width: 12px; height: 12px; border-radius: 50%; }
.c-g i { background: var(--g); } .c-y i { background: var(--y); } .c-r i { background: var(--r); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--ink); }
.save-error { font-size: 12px; font-weight: 600; color: var(--r); }
.save-error:empty { display: none; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px;
}
.grid[data-show='open'] .card:not([data-c='']),
.grid[data-show='g'] .card:not([data-c='g']),
.grid[data-show='y'] .card:not([data-c='y']),
.grid[data-show='r'] .card:not([data-c='r']) { display: none; }

.card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 96px; padding: 12px 12px 10px 14px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(23, 22, 19, 0.06);
  transition: background-color 160ms ease, border-color 160ms ease;
}
.card .word {
  font-weight: 750; font-size: 19px; line-height: 1.1;
  font-variation-settings: 'wdth' 104;
  padding-right: 34px;
  white-space: nowrap; /* fitWords() in app.js shrinks the few that don't fit */
}
.card[data-c='g'] { background: var(--g-tint); border-color: color-mix(in srgb, var(--g) 40%, transparent); }
.card[data-c='y'] { background: var(--y-tint); border-color: color-mix(in srgb, var(--y) 55%, transparent); }
.card[data-c='r'] { background: var(--r-tint); border-color: color-mix(in srgb, var(--r) 40%, transparent); }

.sticker-slot { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; pointer-events: none; }
.sticker-slot .sticker {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0);
  transition: transform 180ms cubic-bezier(.3, 1.6, .5, 1);
}
.card:not([data-c='']) .sticker-slot .sticker { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); }
.card[data-c='g'] .sticker { background: var(--g); }
.card[data-c='y'] .sticker { background: var(--y); }
.card[data-c='r'] .sticker { background: var(--r); }
.sticker, .rcard .sticker {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.picks { display: flex; gap: 6px; }
.pick {
  flex: 1; display: grid; place-items: center;
  height: 36px; padding: 0;
  background: transparent; border: 0; border-radius: 99px;
  cursor: pointer;
}
.pick .dot {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 13px; font-weight: 900; line-height: 1;
}
/* Grey until hovered, focused or picked, so 125 cards don't shout in three colors. */
.pick .dot { background: var(--rule); color: var(--ink-2); transition: background-color 120ms ease, color 120ms ease; }
.p-g:is(:hover, :focus-visible, [aria-pressed='true']) .dot { background: var(--g); color: #fff; }
.p-y:is(:hover, :focus-visible, [aria-pressed='true']) .dot { background: var(--y); color: rgba(23, 22, 19, 0.75); }
.p-r:is(:hover, :focus-visible, [aria-pressed='true']) .dot { background: var(--r); color: #fff; }


.takeaways { margin-top: 48px; padding-top: 24px; border-top: 2px solid var(--rule-strong); max-width: 900px; }
.prompt { border: 0; padding: 0; margin: 22px 0 0; }
.prompt legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 16px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.trio input { font-size: 16px; padding: 10px 12px; border-width: 1px; }

.finish { margin-top: 44px; display: grid; justify-items: start; gap: 12px; }
.finish .hint { margin: 0; }

/* ---------- results ---------- */

.results { padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 48px) 64px; max-width: 1240px; margin: 0 auto; }
.r-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.r-head .display { margin-bottom: 6px; font-size: clamp(30px, 4.6vw, 52px); }
.r-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 10px; }

.people { list-style: none; margin: 18px 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; background: var(--card); border: 1px solid var(--rule); border-radius: 99px;
  font-weight: 650; font-size: 14px;
}
.person em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.person.pending { border-style: dashed; }
.av {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
}

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 28px 0 8px; border-top: 2px solid var(--rule-strong); border-bottom: 1px solid var(--rule);
}
.stats div { padding: 16px 16px 16px 0; display: grid; gap: 2px; }
.stats div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.stats b { font-size: clamp(30px, 5vw, 46px); font-weight: 900; line-height: 1; font-variation-settings: 'wdth' 112; }
.stats span { font-size: 13px; color: var(--ink-2); line-height: 1.3; }

.r-sec { margin-top: 40px; }
.r-sec > .hint { margin-bottom: 16px; }

.rgrid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px;
}
.rgrid.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.rcard {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 88px; padding: 12px 12px 10px 14px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 4px;
  break-inside: avoid;
}
.rcard .word { font-weight: 750; font-size: 18px; line-height: 1.1; font-variation-settings: 'wdth' 104; }
.stickers { display: flex; flex-wrap: wrap; gap: 6px; }
.rcard .sticker, .legend .sticker {
  position: relative; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0));
  font-size: 11px; font-weight: 850; color: #fff; letter-spacing: 0.02em; font-style: normal;
}
.rcard .sticker b { transform: rotate(calc(var(--rot) * -1)); }
/* Symbol badge so the vote reads without color (colorblind viewers, grayscale prints). */
.rcard .sticker i, .legend .sticker i {
  position: absolute; right: -4px; bottom: -3px;
  display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--ink);
  font-size: 9px; font-weight: 900; font-style: normal; line-height: 1; color: var(--ink);
  transform: rotate(calc(var(--rot, 0deg) * -1));
}
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 18px 0 0; font-size: 14px; font-weight: 650; }
.legend > span { display: inline-flex; align-items: center; gap: 10px; }
.legend .sticker { width: 20px; height: 20px; }
.legend .hint { margin: 0; font-weight: 400; }
.section-title .count { margin-left: 6px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.s-g { background: var(--g); } .s-y { background: var(--y); color: var(--ink) !important; } .s-r { background: var(--r); }

.agree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 14px; }
.agree-col h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.agree-col h3 span { margin-left: auto; font-weight: 600; color: var(--ink-3); }
.agree-col .rgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.agree-col .rcard { min-height: 84px; }
.dot-g, .dot-y, .dot-r { width: 14px; height: 14px; border-radius: 50%; }
.dot-g { background: var(--g); } .dot-y { background: var(--y); } .dot-r { background: var(--r); }
.a-g .rcard { background: var(--g-tint); } .a-y .rcard { background: var(--y-tint); } .a-r .rcard { background: var(--r-tint); }

.tks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 32px; margin-top: 14px; }
.tk { padding-top: 12px; border-top: 1px solid var(--rule); }
.tk h3 { margin: 0 0 10px; font-size: 15px; font-weight: 750; }
.tk ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tk li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tk-word { font-weight: 750; font-size: 17px; }
.tk-n { font-size: 12px; font-weight: 800; background: var(--ink); color: var(--paper); padding: 1px 6px; border-radius: 99px; }
.tk-who { font-size: 13px; color: var(--ink-3); }

.plainlist { color: var(--ink-2); font-size: 15px; line-height: 1.8; max-width: 90ch; }

/* ---------- admin ---------- */

.table-wrap { overflow-x: auto; margin-top: 28px; }
.sessions { width: 100%; border-collapse: collapse; font-size: 15px; }
.sessions th { text-align: left; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding: 8px 12px 8px 0; border-bottom: 2px solid var(--rule-strong); }
.sessions td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.sessions td:first-child { font-weight: 750; white-space: normal; }
.sessions .num { text-align: right; }

/* ---------- motion ---------- */

.card.just .sticker-slot .sticker { animation: slap 260ms cubic-bezier(.3, 1.6, .5, 1); }
@keyframes slap {
  0% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--rot) - 20deg)) scale(1.5); opacity: 0; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); opacity: 1; }
}

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

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .agree { grid-template-columns: 1fr; }
  .tks { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .byline { display: none; }
  .lede { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card { min-height: 88px; padding: 12px 10px 8px 12px; }
  .card .word { font-size: 17px; }
  .pick { height: 40px; }
  .trio { grid-template-columns: 1fr; }
  .rgrid, .rgrid.tight, .agree-col .rgrid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rcard .word { font-size: 16px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stats div { padding-right: 8px; }
  .stats div + div { padding-left: 10px; }
  .toolbar { gap: 8px 12px; padding: 10px 8px; }
  .progress { min-width: 0; }
  .bar { display: none; }
  .copyrow { flex-direction: column; }
  .copyrow .btn { width: 100%; }
  .actions .btn { flex: 1 1 100%; }
}

/* ---------- print ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .masthead, .no-print, .toolbar { display: none !important; }
  .results { padding: 0; }
  .rcard, .card { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
