@font-face {
  font-family: 'Chunky';
  src: url('/chunky.ttf') format('truetype');
  font-display: swap;
  font-weight: 900;
}

:root {
  --bg-top: #fffcf8;
  --bg-mid: #fdf8f2;
  --bg-bottom: #faf3ea;
  --surface: #ffffff;
  --card-surface: #fef8f3;
  --border-soft: #eae3da;
  --border-card: #ebe2d7;
  --ink: #111115;
  --ink-soft: #4b4954;
  --ink-muted: #6e6c76;
  --dashed: #9ca3af;
  --purple: #8b2cf5;
  --purple-hover: #7820dc;
  --purple-pressed: #6719c2;
  --purple-soft: #f3e8ff;
  --purple-mid: #e4d0fe;
  --mint: #10b981;
  --mint-dark: #047857;
  --mint-soft: #ecfdf5;
  --coral: #ef4444;
  --coral-dark: #dc2626;
  --coral-soft: #fef2f2;
  --font-display: 'Outfit', 'Fredoka', 'Chunky', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-mid);
  background-image: linear-gradient(170deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

main {
  position: relative;
  z-index: 1;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* =========================================================================
   TOP BAR & BRANDING
   ========================================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 12px;
  margin-bottom: 4px;
  min-height: 44px;
}
body:not([data-phase]) .topbar { display: none; }

.brand-wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.brand-wordmark .brand-logo-img {
  display: block;
  object-fit: contain;
}
.brand-wordmark.join-lg .brand-logo-img {
  height: clamp(56px, 14vw, 72px);
  max-width: min(290px, 78vw);
  width: auto;
}
.brand-wordmark.sm .brand-logo-img {
  height: 30px;
  width: auto;
}

.brand-logo-fallback {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.brand-letters {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: normal;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 0.92;
}
.brand-purple-bar {
  display: block;
  width: 60%;
  background: var(--purple);
  border-radius: 999px;
}
.brand-wordmark.join-lg .brand-letters { font-size: clamp(44px, 12vw, 56px); }
.brand-wordmark.join-lg .brand-purple-bar { height: 7px; }
.brand-wordmark.sm .brand-letters { font-size: 24px; }
.brand-wordmark.sm .brand-purple-bar { height: 4px; }

.room-code-chip {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--purple);
  background: var(--purple-soft);
  padding: 6px 14px;
  border-radius: 999px;
}
.room-code-chip:empty { display: none; }

#screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =========================================================================
   TYPOGRAPHY, PILLS & ACCENTS
   ========================================================================= */
.disp {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.04;
  transform: none;
}

.soft-note {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.38;
}

.purple-bar {
  width: 96px;
  height: 6px;
  background: var(--purple);
  border-radius: 999px;
  margin: 7px auto 8px;
}

.round-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--purple-soft);
  color: var(--purple);
  border-radius: 999px;
  padding: 5px 15px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.host-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--purple);
  color: #ffffff;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
}

/* =========================================================================
   LOW-POLY FLOATING ANIMALS (ZERO BLOBS, ZERO ENCLOSING BOXES!)
   ========================================================================= */
.avatar-alive {
  animation: avatarBreathe 3.2s ease-in-out var(--av-delay, 0s) infinite;
  transform-origin: center bottom;
}
@keyframes avatarBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2.5px) scale(1.025); }
}

.av-head {
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 5px 9px rgba(17, 17, 21, 0.09));
}
.av-head.sm { width: 44px; height: 44px; flex-shrink: 0; }
.av-head.md { width: 58px; height: 58px; flex-shrink: 0; }

/* =========================================================================
   JOIN SCREEN — ULTRA-CLEAN OPEN CREAM CANVAS
   ========================================================================= */
.join-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin: 6px 0 16px;
}

.join-tagline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 4.4vw, 19px);
  color: var(--ink);
  letter-spacing: -0.01em;
}

#join {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 0.88fr 1.32fr;
  gap: 12px;
}
.field-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

label,
.picker-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 6px 2px;
}
.picker-selected-name {
  color: var(--purple);
  font-weight: 900;
}

input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-soft);
  border-radius: 14px;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 900;
  font-size: 22px;
  text-align: center;
  outline: none;
  box-shadow: 0 3px 10px rgba(17, 17, 21, 0.03);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input::placeholder { color: #c4bec8; }

#room {
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--ink);
}

input:focus-visible {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

/* 2x5 Open Canvas Low-Poly Animal Picker Grid */
.picker-block { margin-top: 2px; }

.avatar-grid,
.switcher-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 8px;
  padding: 4px 0;
}

.av-tile,
.sw-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: transparent;
  border: 2.5px solid transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  cursor: pointer;
  user-select: none;
  transition: transform 110ms ease, opacity 110ms ease;
}

.av-tile:active:not(.taken),
.sw-tile:active:not(.taken) {
  transform: scale(0.93);
}

.av-tile-img,
.sw-tile-img {
  position: relative;
  z-index: 1;
  width: 94%;
  height: 94%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 7px rgba(17, 17, 21, 0.10));
}

/* Selected animal: crisp electric-purple halo + circular checkmark */
.av-tile.selected,
.sw-tile.selected {
  background: var(--purple-soft);
  border-color: var(--purple);
  box-shadow: 0 6px 16px rgba(139, 44, 245, 0.22);
  transform: scale(1.05);
}

.av-check {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 3;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--purple);
  color: #ffffff;
  border: 2px solid var(--bg-mid);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
}
.av-tile.selected .av-check,
.sw-tile.selected .av-check { display: flex; }

.av-taken-tag {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(17, 17, 21, 0.78);
  color: #ffffff;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  display: none;
}

.av-tile.taken,
.sw-tile.taken {
  opacity: 0.28;
  filter: grayscale(0.45);
  cursor: not-allowed;
  transform: none;
}
.av-tile.taken .av-taken-tag { display: inline-block; }

/* Primary Electric-Purple Pill CTA */
button {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 800;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  transform: none;
  transition: transform 90ms ease, background 120ms ease;
}
button:active:not(:disabled) { transform: scale(0.985); }
button:disabled { opacity: 0.38; cursor: not-allowed; }

.primary-wrap {
  width: 100%;
  margin-top: 10px;
}

.primary {
  width: 100%;
  min-height: 54px;
  padding: 12px 24px;
  background: var(--purple);
  color: #ffffff;
  border-radius: 999px;
  text-transform: uppercase;
  font-size: clamp(19px, 5.2vw, 22px);
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 22px rgba(139, 44, 245, 0.26);
}
.primary:hover:not(:disabled) { background: var(--purple-hover); }
.primary:disabled { box-shadow: none; }

.tv-link-wrap {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.tv-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 800;
  font-size: 14px;
  padding: 4px 2px;
  transition: color 120ms ease;
}
.tv-link:hover { color: var(--purple); }

/* =========================================================================
   WAITING / LOBBY / HOT SEAT
   ========================================================================= */
.wait-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 4px;
}

.hero-avatar-btn,
.hero-avatar-ring {
  position: relative;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--purple-soft);
  box-shadow: 0 0 0 3px rgba(139, 44, 245, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  margin: 4px auto 10px;
}
.hero-avatar-ring.winner {
  box-shadow: 0 0 0 3.5px var(--purple), 0 12px 26px rgba(139, 44, 245, 0.18);
}

.hero-avatar {
  width: 96%;
  height: 96%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(17, 17, 21, 0.11));
}

.wait-title {
  margin: 2px 0 2px;
  font-size: clamp(26px, 7.6vw, 34px);
  overflow-wrap: anywhere;
}

.wait-sub {
  margin: 6px 0 10px;
  font-size: 15px;
}

.host-banner {
  margin: 4px 0 4px;
}

/* Open Animal Switcher Strip */
.switcher-open {
  width: 100%;
  padding: 12px 0 8px;
  margin: 10px 0 6px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.switcher-open.pulse { animation: stripPulse 380ms ease; }
@keyframes stripPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.switcher-head {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 6px;
  text-align: center;
}

/* Mini Horizontal Player Heads Row on Phone Lobby / Waiting */
#people.heads-row {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 12px;
}

.mini-head-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  gap: 4px;
  text-align: center;
}
.mini-head-visual {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.mini-head-slot.waiting .mini-head-visual {
  border: 2px dashed var(--dashed);
  padding: 4px;
}
.mini-head-slot.waiting img {
  opacity: 0.42;
}
.mini-head-visual img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(17, 17, 21, 0.09));
}
.mini-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--purple);
  color: #ffffff;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border: 1.5px solid var(--bg-mid);
}
.mini-badge.done {
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--mint);
}
.mini-kick {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-soft);
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mini-kick:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: #ffffff;
}
.mini-head-name {
  width: 100%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-head-slot.waiting .mini-head-name { color: var(--ink-muted); }

/* =========================================================================
   RANKING & GUESSING — CLEAN OPEN LOW-POLY ITEM CARDS
   ========================================================================= */
.screen-head {
  text-align: center;
  margin-bottom: 6px;
}
.screen-head h2 {
  margin: 0;
  font-size: clamp(24px, 6.8vw, 31px);
  overflow-wrap: anywhere;
}

.r3-kicker {
  font-size: clamp(26px, 7.2vw, 34px);
  color: var(--ink);
}

.subject-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sub-kicker {
  margin: 2px 0 4px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-muted);
}

.section-kicker {
  text-align: center;
  font-size: 16px;
  color: var(--purple);
  margin: 12px 0 6px;
}

.axis {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 4px;
  margin: 2px 0;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.axis.top {
  color: var(--mint-dark);
  border-bottom: 1.5px dashed rgba(16, 185, 129, 0.36);
}
.axis.bottom {
  margin: 4px 0 6px;
  color: var(--coral-dark);
  border-top: 1.5px dashed rgba(239, 68, 68, 0.34);
}

ul#cards,
ol.reveal-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

ul#cards.is-dragging {
  position: relative;
}

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  background: var(--card-surface);
  border: 1.5px solid var(--border-card);
  border-radius: 16px;
  color: var(--ink);
  padding: 8px 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: 0 4px 12px rgba(17, 17, 21, 0.045);
  transition: transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1), border-color 120ms ease, background 120ms ease, box-shadow 140ms ease;
}

.card:hover:not(.pick-card):not(.dragging) {
  border-color: rgba(139, 44, 245, 0.36);
}

.card.dragging {
  z-index: 25;
  cursor: grabbing;
  background: #ffffff;
  border-color: var(--purple);
  box-shadow: 0 18px 36px rgba(139, 44, 245, 0.22), 0 6px 14px rgba(17, 17, 21, 0.12);
  transition: border-color 120ms ease, background 120ms ease, box-shadow 140ms ease;
  will-change: transform;
}

.card.dragging .grip {
  color: var(--purple);
}

body.card-dragging,
body.card-dragging * {
  cursor: grabbing !important;
}

.card .grip {
  color: #a89fb2;
  font-size: 18px;
  line-height: 1;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  pointer-events: none;
}

.card .rank-num {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 900;
  font-size: 14px;
  color: #ffffff;
  background: var(--rc, var(--purple));
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
  transition: background-color 140ms ease;
}

.card-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card strong {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: normal;
}

.moves {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.card .moves button {
  padding: 0;
  min-height: 24px;
  min-width: 28px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card .moves button:active {
  color: var(--purple);
  transform: scale(1.2);
}

/* Round 3 Radio Cards */
.card.pick-card {
  cursor: pointer;
  padding: 12px 14px;
}
.card .radio-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--dashed);
  background: transparent;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card.selected {
  background: var(--purple-soft);
  border-color: var(--purple);
  box-shadow: 0 6px 16px rgba(139, 44, 245, 0.14);
}
.card.selected .radio-dot {
  border-color: var(--purple);
}
.card.selected .radio-dot::after {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--purple);
}

/* =========================================================================
   REVEAL — HUGE BOLD PURPLE SCORE + ILLUSTRATED CHECKLIST
   ========================================================================= */
.score-stamp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 2px 0 14px;
}

.score-stamp {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 900;
  font-size: clamp(54px, 15vw, 72px);
  line-height: 0.96;
  color: var(--purple);
  letter-spacing: -0.02em;
}
.score-stamp.zero { color: var(--ink-muted); }

.match-summary {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

.reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--card-surface);
  border: 1.5px solid var(--border-card);
  border-radius: 14px;
}
.reveal-row.hit {
  background: var(--mint-soft);
  border-color: rgba(16, 185, 129, 0.42);
}
.reveal-row.hated {
  background: var(--coral-soft);
  border-color: rgba(239, 68, 68, 0.36);
}

.reveal-row .rev-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--rc, var(--purple));
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}

.reveal-row strong {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.rev-mark {
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 17px;
  min-width: 26px;
  text-align: center;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.rev-mark.hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--mint);
  color: #ffffff;
  font-size: 14px;
}

.pick-note {
  margin-top: 10px;
  text-align: center;
  font-size: 15px;
}

/* =========================================================================
   STANDINGS & FINAL
   ========================================================================= */
.winner-status-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.winner-status-mini strong {
  color: var(--purple);
  font-weight: 900;
}

.roster-stack,
.board-stack {
  width: 100%;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.person-row,
.board-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border-radius: 14px;
  background: transparent;
}
.board-row.leader {
  background: var(--purple-soft);
  border: 1.5px solid rgba(139, 44, 245, 0.25);
}

.board-rank {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  min-width: 30px;
  color: var(--ink-muted);
}
.board-row.leader .board-rank,
.board-row.leader .board-score { color: var(--purple); }

.board-name,
.person-row .p-name {
  flex: 1;
  min-width: 0;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-row.is-me .board-name { color: var(--purple); }

.board-score,
.person-row .p-pts {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--ink);
  flex-shrink: 0;
}
.person-row .p-pts.earned { color: var(--purple); }
.person-row .p-pts.zero { color: var(--ink-muted); }

#error {
  margin: 12px 0 0;
  text-align: center;
  color: #ffffff;
  background: var(--coral);
  border-radius: 14px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
}
#error:empty { display: none; }

button:focus-visible,
.card:focus-visible,
.av-tile:focus-visible {
  outline: 2.5px solid var(--purple);
  outline-offset: 2px;
}

/* Narrow phones (320px iPhone SE!) — keep long words unbroken and zero overflow */
@media (max-width: 350px) {
  main { padding-left: 10px; padding-right: 10px; }
  .card { gap: 6px; padding: 8px 8px; }
  .card .grip { display: none; }
  .card .rank-num { width: 24px; height: 24px; font-size: 13px; }
  .card-thumb { width: 32px; height: 32px; }
  .card strong { font-size: 16px; }
  .card .moves button { min-width: 24px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-height: 500px) and (min-width: 550px) {
  main { max-width: 720px; padding-top: 8px; }
  .hero-avatar-btn,
  .hero-avatar-ring { width: 92px; height: 92px; }
  .moves { flex-direction: row; }
  .card { min-height: 50px; }
}
