:root {
  --paper: #f4efe6;
  --card: #fffbf3;
  --ink: #17203a;
  --muted: #6b7080;
  --line: #e3dac8;
  --accent: #d6452b;
  --accent-ink: #fff;
  --good: #1f7a5a;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--paper); }

body {
  margin: 0;
  font-family: 'Heebo', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(120px + env(safe-area-inset-bottom));
}

h1, h2, h3, p { margin: 0; }

button, input { font: inherit; color: inherit; }

/* ---------- pressables ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: #232e50; }
  .btn.accent:hover:not(:disabled) { background: #bf3a22; }
  .btn.ghost:hover:not(:disabled) { background: rgba(23, 32, 58, 0.05); }
}

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

/* ---------- brand / hero ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--ink);
  display: grid; place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; }

.hero { padding: 36px 0 24px; }
.hero h1 {
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 30ch; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card, .section + .section { margin-top: 14px; }
.section-title { font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; margin: 26px 4px 10px; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 16px; /* prevents iOS zoom */
}
.field input:focus { outline: none; border-color: var(--ink); }
.error { color: var(--accent); font-size: 0.9rem; min-height: 1.3em; margin-bottom: 8px; }

.group-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%;
  text-align: start;
  text-decoration: none;
  color: inherit;
  padding: 16px 18px;
}
.group-link strong { font-size: 1.05rem; }
.group-link span { color: var(--muted); font-size: 0.9rem; }

/* ---------- group header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 6px 0; }

.group-head h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.group-head .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(23, 32, 58, 0.07);
  font-size: 0.85rem;
  font-weight: 600;
}
.chip.warn { background: rgba(214, 69, 43, 0.12); color: var(--accent); }
.chip.ok { background: rgba(31, 122, 90, 0.13); color: var(--good); }

/* ---------- tabs ---------- */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 16px;
  border-bottom: 1.5px solid var(--line);
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 12px 4px;
  font-weight: 600;
  color: var(--muted);
  transition: color 160ms ease;
}
.tab[aria-selected='true'] { color: var(--ink); }
.tab-indicator {
  position: absolute; bottom: -1.5px; inset-inline-start: 0;
  width: 33.3333%; height: 3px; background: var(--accent); border-radius: 3px 3px 0 0;
  transform: translateX(calc(var(--i, 0) * -100%));
  transition: transform 220ms var(--ease-in-out);
}

/* ---------- party rows ---------- */
.party-list { display: grid; gap: 8px; }
.party {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.party-name { flex: 1; min-width: 0; font-weight: 600; }
.party-name small { display: block; color: var(--muted); font-weight: 400; font-size: 0.78rem; }

.badge {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.95rem;
  background: var(--c, #444);
  overflow: hidden;
}
.badge.logo {
  width: 64px; height: 44px; background: #fff; border: 1px solid var(--line); padding: 0;
}
.badge.logo.sm { width: 48px; height: 33px; }
.badge img { width: 100%; height: 100%; object-fit: contain; }
.badge.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 0.72rem; }

.stepper { display: flex; align-items: center; gap: 4px; direction: ltr; }
.step-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 36px; height: 36px; border-radius: 11px;
  background: rgba(23, 32, 58, 0.07);
  font-size: 1.3rem; font-weight: 600; line-height: 1;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
  transition: transform 120ms var(--ease-out), background-color 160ms ease;
}
.step-btn:active { transform: scale(0.94); background: rgba(23, 32, 58, 0.14); }
.seats {
  width: 42px; text-align: center;
  border: 0; background: transparent;
  font-size: 1.25rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.seats::-webkit-outer-spin-button, .seats::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.seats:focus { outline: none; background: #fff; border-radius: 8px; }
.seats.zero { color: var(--muted); font-weight: 600; }

/* ---------- sticky save bar ---------- */
.savebar {
  position: fixed; inset-inline: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 70%, transparent);
  pointer-events: none;
}
.savebar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--paper);
  border-radius: 16px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(23, 32, 58, 0.22);
  pointer-events: auto;
}
.total { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.total small { font-weight: 400; opacity: 0.7; font-size: 0.8rem; margin-inline-start: 6px; }
.save-state { font-size: 0.85rem; opacity: 0.8; transition: opacity 200ms ease; }

/* ---------- reveal / members ---------- */
.member { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.member + .member { margin-top: 8px; }
.member-head {
  appearance: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: start;
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
}
.member-head strong { flex: 1; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  font-weight: 800; background: var(--ink); color: var(--paper);
}
.member-guesses {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px;
  padding: 4px 14px 14px;
}
.mg { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.mg b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.mg.zero { color: var(--muted); }

.hint { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }
.me-row { box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- leaderboard ---------- */
.rank {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  width: 100%; text-align: start; cursor: pointer; appearance: none;
}
.rank-bar {
  position: absolute; inset: 0;
  background: rgba(214, 69, 43, 0.1);
  transform-origin: right center;
  transform: scaleX(var(--w, 0));
  transition: transform 600ms var(--ease-out);
}
.rank > *:not(.rank-bar) { position: relative; }
.rank-n { width: 26px; font-weight: 800; font-size: 1.1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank.first .rank-n { color: var(--accent); }
.rank-name { flex: 1; font-weight: 600; }
.rank-pts { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.rank-pts small { font-weight: 400; color: var(--muted); font-size: 0.75rem; margin-inline-start: 3px; }

.breakdown { margin: 4px 0 8px; padding: 6px 14px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.breakdown table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.breakdown th { text-align: start; color: var(--muted); font-weight: 600; padding: 6px 0; }
.breakdown td { padding: 5px 0; border-top: 1px solid var(--line); }
.breakdown td:not(:first-child), .breakdown th:not(:first-child) { text-align: center; }

details.explain { margin-top: 18px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
details.explain summary { cursor: pointer; font-weight: 600; }
details.explain ul { margin: 10px 0 0; padding-inline-start: 20px; color: var(--muted); font-size: 0.92rem; }
details.explain li + li { margin-top: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90vw;
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 0.92rem;
  opacity: 0; transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }

/* ---------- entrance (rare enough to afford a stagger; capped in JS) ---------- */
.enter { animation: enter 320ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .enter { animation: fade 200ms ease both; animation-delay: 0ms; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .tab-indicator, .rank-bar, .toast { transition: opacity 200ms ease; }
  .toast { transform: none; }
  .rank-bar { transform: scaleX(var(--w, 0)); }
}

/* ---------- similarity map ---------- */
.map-card { padding: 14px 14px 16px; background: radial-gradient(120% 90% at 50% 30%, #fffefb 0%, var(--card) 70%); }
.map { width: 100%; height: auto; display: block; touch-action: manipulation; overflow: visible; }

.map-bg circle { fill: none; stroke: var(--line); stroke-width: 1; }
.map-bg circle:nth-child(1) { fill: rgba(214, 69, 43, 0.04); }
.map-bg path { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }

.map-line {
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-opacity: calc(0.14 + var(--k) * 0.5);
  stroke-width: calc(1 + var(--k) * 2.2);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 380ms var(--ease-out) forwards;
  animation-delay: calc(var(--n) * 40ms);
}
.map-line.near { stroke: var(--accent); stroke-opacity: 0.85; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.map-pill rect { fill: var(--ink); }
.map-pill text { fill: var(--paper); font-size: 11px; font-weight: 800; text-anchor: middle; font-variant-numeric: tabular-nums; }
.map-pill { pointer-events: none; animation: pop 260ms var(--ease-out) 220ms both; transform-box: fill-box; transform-origin: center; }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }

.pt { cursor: pointer; outline: none; -webkit-user-select: none; user-select: none; }
.pt-hit { fill: transparent; }
.pt-dot {
  fill: hsl(var(--h) 38% 36%);
  stroke: var(--card); stroke-width: 3;
  transition: transform 200ms var(--ease-out), fill 160ms ease;
  transform-box: fill-box; transform-origin: center;
}
.pt-halo {
  fill: none; stroke: var(--accent); stroke-width: 2.5;
  opacity: 0; transform: scale(0.7);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  transform-box: fill-box; transform-origin: center;
}
.pt.me .pt-dot { fill: var(--good); }
.pt.sel .pt-dot { fill: var(--accent); transform: scale(1.12); }
.pt.sel .pt-halo { opacity: 1; transform: none; }
.pt:active .pt-dot { transform: scale(0.94); }
.pt:focus-visible .pt-halo { opacity: 1; transform: none; stroke: var(--ink); }
.pt-i { fill: #fff; font-weight: 800; font-size: 13px; text-anchor: middle; pointer-events: none; }
.pt-n {
  fill: var(--ink); font-weight: 600; font-size: 11px; text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round;
}
.pt-in { animation: pt-in 340ms var(--ease-out) both; animation-delay: calc(var(--n) * 45ms); transform-box: fill-box; transform-origin: center; }
@keyframes pt-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

.map-caption { margin-top: 12px; font-size: 0.98rem; }

.near-title { margin: 16px 0 8px; font-size: 0.78rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }
.near-title span { color: var(--accent); }
.near-list { display: grid; gap: 7px; }
.near-row { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; animation: enter 280ms var(--ease-out) both; animation-delay: calc(var(--n) * 30ms); }
.avatar.sm { width: 26px; height: 26px; font-size: 0.78rem; background: hsl(var(--h) 38% 36%); }
.near-name { width: 4.6em; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(23, 32, 58, 0.07); overflow: hidden; }
.near-bar i {
  display: block; height: 100%; border-radius: 4px; background: var(--ink);
  transform-origin: right center; transform: scaleX(var(--k));
  animation: grow 460ms var(--ease-out) both; animation-delay: calc(var(--n, 0) * 30ms + 80ms);
}
.near-row:first-child .near-bar i { background: var(--accent); }
@keyframes grow { from { transform: scaleX(0); } }
.near-d { width: 2.4em; text-align: end; font-variant-numeric: tabular-nums; }

@media (hover: hover) and (pointer: fine) {
  .pt:hover .pt-dot { transform: scale(1.08); }
  .pt.sel:hover .pt-dot { transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .map-line { animation: none; stroke-dashoffset: 0; }
  .pt-in, .map-pill { animation: fade 200ms ease both; }
  .near-bar i { animation: none; }
  .pt-dot, .pt-halo { transition: opacity 160ms ease, fill 160ms ease; }
}

.btn.wa {
  display: inline-flex; align-items: center; text-decoration: none;
  padding: 5px 12px; font-size: 0.85rem;
  background: #1fa855; color: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .btn.wa:hover { background: #198f48; }
}

/* ---------- party rows are pressable ---------- */
.party-open {
  appearance: none; background: none; border: 0; padding: 0; text-align: start; cursor: pointer;
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  transition: transform 160ms var(--ease-out);
}
.party-open:active { transform: scale(0.98); }

/* ---------- party dialog ---------- */
.sheet {
  border: 0; padding: 0; color: var(--ink); background: var(--paper);
  width: min(560px, 100vw); max-width: 100vw; max-height: 90dvh;
  margin: auto auto 0; border-radius: 24px 24px 0 0;
  overflow: hidden; position: fixed;
  box-shadow: 0 -12px 40px rgba(23, 32, 58, 0.25);
}
.sheet[open] { animation: sheet-in 340ms var(--ease-drawer, cubic-bezier(0.32, 0.72, 0, 1)); }
.sheet[open]::backdrop { background: rgba(23, 32, 58, 0.45); backdrop-filter: blur(2px); animation: fade-in 240ms ease-out; }
.sheet.closing { animation: sheet-out 200ms var(--ease-out) forwards; }
.sheet.closing::backdrop { animation: fade-out 200ms ease-out forwards; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (min-width: 640px) {
  .sheet { margin: auto; border-radius: 24px; box-shadow: 0 24px 60px rgba(23, 32, 58, 0.3); }
  @keyframes sheet-in { from { transform: translateY(16px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheet-out { to { transform: translateY(8px) scale(0.98); opacity: 0; } }
}
body:has(dialog[open]) { overflow: hidden; }

.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 0; }
.sheet-x {
  position: absolute; inset-block-start: 12px; inset-inline-end: 12px; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(23, 32, 58, 0.08); font-size: 0.95rem;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.sheet-x:active { transform: scale(0.94); }
.sheet-body { overflow-y: auto; max-height: calc(90dvh - 20px); padding: 8px 20px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

.sheet-head { display: flex; align-items: center; gap: 14px; padding: 8px 40px 4px 0; }
.sheet-head h3 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.sheet-head p { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.sheet-head .badge.logo { width: 87px; height: 60px; }
.sheet-lead { margin: 14px 0 16px; font-size: 1.02rem; }

.poll-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.poll-main { display: flex; align-items: center; gap: 14px; }
.poll-main b { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.poll-main span { color: var(--muted); font-size: 0.88rem; line-height: 1.3; }
.strip { width: 100%; height: auto; display: block; margin-top: 10px; direction: ltr; overflow: visible; }
.strip-axis { stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.strip-thr { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 2 3; }
.strip-avg { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.strip-dot { fill: var(--accent); fill-opacity: 0.5; stroke: var(--accent); stroke-opacity: 0.8; animation: dot-in 360ms var(--ease-out) both; animation-delay: calc(120ms + var(--n) * 35ms); transform-box: fill-box; transform-origin: center; }
@keyframes dot-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.strip-t { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.poll-meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.poll-list { margin-top: 10px; font-size: 0.88rem; }
.poll-list summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.poll-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.poll-row span:first-child { width: 4.8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.poll-row span:nth-child(2) { flex: 1; }
.poll-row b { font-variant-numeric: tabular-nums; }

.sheet-h { font-size: 0.78rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.topics { margin-top: 22px; display: grid; gap: 14px; }
.topic h4 { font-size: 0.8rem; font-weight: 800; color: var(--accent); margin: 0 0 3px; letter-spacing: 0.02em; }
.topic p { font-size: 0.97rem; margin: 0; }
.topic p.na { color: var(--muted); font-style: italic; }
.sheet-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; display: grid; gap: 8px; }
.sheet-foot a { color: inherit; text-underline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .sheet[open], .sheet.closing { animation: none; }
  .sheet[open]::backdrop { animation: none; }
  .strip-dot { animation: none; }
}


/* anonymous dots: people who have not revealed to this viewer */
.pt.anon .pt-dot { fill: var(--muted); fill-opacity: 0.45; stroke: var(--card); }

/* ---------- admin dashboard ---------- */
.link-btn { appearance: none; background: none; border: 0; padding: 4px 0; color: var(--muted); font-weight: 600; font-size: 0.85rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn.sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn.danger { color: var(--accent); }
.admin-new { display: flex; gap: 8px; align-items: center; padding: 12px; margin-bottom: 12px; }
.card.admin-new { margin-bottom: 12px; }
form.admin-new:not(.card) { padding: 0; margin-bottom: 0; }
.admin-new input { flex: 1; min-width: 0; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 16px; }
.admin-new input:focus { outline: none; border-color: var(--ink); }
.agroup { padding: 14px 14px 12px; margin-bottom: 10px; }
.agroup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.agroup-head strong { display: block; font-size: 1.05rem; }
.agroup-head span { color: var(--muted); font-size: 0.85rem; }
.agroup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.agroup-actions .btn { display: inline-flex; align-items: center; text-decoration: none; }
.agroup-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); animation: enter 240ms var(--ease-out) both; }
.amember { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.amember-name { flex: 1; font-weight: 600; }
.x-btn { appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; background: rgba(23, 32, 58, 0.07); transition: transform 120ms var(--ease-out); }
.x-btn:active { transform: scale(0.92); }

.agroup-title { min-width: 0; flex: 1; }
.agroup-name { display: flex; align-items: center; gap: 4px; }
.agroup-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pencil {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}
.pencil:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) { .pencil:hover { background: rgba(23, 32, 58, 0.08); color: var(--ink); } }
.rename-inline { display: flex; align-items: center; gap: 6px; animation: enter 180ms var(--ease-out) both; }
.rename-inline input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--ink); background: #fff; font-size: 16px; font-weight: 700; }
.rename-inline input:focus { outline: none; }
.icon-btn {
  appearance: none; border: 0; cursor: pointer; flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(23, 32, 58, 0.07); font-weight: 700; transition: transform 140ms var(--ease-out);
}
.icon-btn.ok { background: var(--ink); color: var(--paper); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- join screen ---------- */
.eyebrow { color: var(--muted); font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.hero .eyebrow + h1 { margin-bottom: 12px; }
.steps { list-style: none; margin: 0 0 14px; padding: 6px 16px; counter-reset: step; }
.steps li { position: relative; padding: 12px 40px 12px 0; font-size: 0.97rem; counter-increment: step; }
.steps li + li { border-top: 1px solid var(--line); }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: auto; right: 0; top: 12px;
  width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem;
}
.steps b { font-weight: 700; }

/* ---------- seat charts ---------- */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; }
.chart-card.pulse { animation: chart-pulse 520ms var(--ease-out); }
@keyframes chart-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.02); } 100% { transform: scale(1); } }
.chart-tabs { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(23, 32, 58, 0.07); }
.chart-tabs button {
  appearance: none; border: 0; cursor: pointer; padding: 6px 16px; border-radius: 9px; background: transparent;
  font-weight: 600; font-size: 0.88rem; color: var(--muted);
  transition: background-color 180ms ease, color 180ms ease, transform 140ms var(--ease-out);
}
.chart-tabs button:active { transform: scale(0.96); }
.chart-tabs button[aria-selected='true'] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(23, 32, 58, 0.12); }

.chart-stage { position: relative; display: grid; place-items: center; margin-top: 6px; }
.chart-stage svg { grid-area: 1 / 1; width: min(100%, 290px); height: auto; overflow: visible; transition: opacity 220ms ease, transform 260ms var(--ease-out); }
.chart-stage svg.off { opacity: 0; transform: scale(0.96); pointer-events: none; }

.dn-track { fill: none; stroke: rgba(23, 32, 58, 0.08); stroke-width: 26; }
.dn-rot { transform: rotate(-90deg); transform-origin: 100px 100px; }
.dn-seg {
  fill: none; stroke-width: 26; transform-box: fill-box;
  transition: stroke-dasharray 340ms var(--ease-out), stroke-dashoffset 340ms var(--ease-out);
}
.dn-n { text-anchor: middle; font-size: 40px; font-weight: 800; fill: var(--ink); font-variant-numeric: tabular-nums; }
.dn-t { text-anchor: middle; font-size: 12px; font-weight: 600; fill: var(--muted); }
.chart-card.done .dn-n { fill: var(--good); }

.hm-dot { fill: rgba(23, 32, 58, 0.1); transition: fill 260ms var(--ease-out), r 260ms var(--ease-out); }
.hm-dot.on { fill: var(--c); }
.chart-actions { display: flex; gap: 8px; margin-top: 10px; }

.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-inline-end: 6px; vertical-align: 1px; }

/* remaining-seats bar */
.savebar-inner.done { background: var(--good); }
.savebar-inner .left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.savebar-inner .left b { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.savebar-inner .left span { font-size: 0.8rem; opacity: 0.8; line-height: 1.2; }
.meter { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); overflow: hidden; min-width: 28px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--paper); transform-origin: right center; transform: scaleX(var(--p)); transition: transform 340ms var(--ease-out); }
.step-btn:disabled { opacity: 0.35; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .chart-card.pulse { animation: none; }
  .dn-seg, .meter i, .hm-dot { transition: none; }
  .chart-stage svg { transition: opacity 160ms ease; }
}

.chart-stage svg.off { position: absolute; top: 0; }
.chart-hint { min-height: 1.3em; margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* remaining bar: counter and save state on top, progress meter underneath */
.savebar-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 8px; column-gap: 12px; }
.savebar-inner .meter { grid-column: 1 / -1; flex: none; min-width: 0; }
.savebar-inner .save-state { text-align: end; }

/* who is signed in, in the group top bar */
.topbar { gap: 10px; }
.whoami { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 12px 3px 4px; border-radius: 999px; background: rgba(23, 32, 58, 0.07); font-weight: 600; font-size: 0.85rem; }
.whoami-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8em; }
.avatar.xs { width: 22px; height: 22px; font-size: 0.72rem; background: hsl(var(--h) 38% 36%); flex: none; }
