:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --text: #0b0b0d;
  --text-muted: #6b6b73;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 18px 40px rgba(0, 0, 0, 0.10);
  --accent: #0b0b0d;
  --rep: #c8242e;
  --rep-soft: rgba(200, 36, 46, 0.10);
  --dem: #1a4e8a;
  --dem-soft: rgba(26, 78, 138, 0.10);
  --ind: #6b6b73;
  --ind-soft: rgba(107, 107, 115, 0.10);
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --surface: #161618;
    --surface-2: #1f1f23;
    --text: #f5f5f7;
    --text-muted: #9a9aa3;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.4);
    --accent: #f5f5f7;
    --rep: #ff5a64;
    --rep-soft: rgba(255, 90, 100, 0.15);
    --dem: #5b9bff;
    --dem-soft: rgba(91, 155, 255, 0.15);
    --ind: #b0b0b8;
    --ind-soft: rgba(176, 176, 184, 0.15);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.01em;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.015em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--dem), var(--rep));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}
.brand-name { color: var(--text); }
.brand-name span { color: var(--text-muted); font-weight: 500; }

.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.progress-bar {
  width: 60px;
  height: 4px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  border-radius: 99px;
  transition: width var(--transition);
}

/* Screens */
.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; animation: fade 280ms ease both; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Start screen */
.hero {
  text-align: center;
  margin: 24px auto;
  max-width: 560px;
}
.hero h1 {
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 14px;
}
.hero p {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0 0 28px;
}
.hero .preview {
  display: flex;
  justify-content: center;
  gap: -8px;
  margin: 24px 0 28px;
}
.hero .preview .avatar {
  width: 44px;
  height: 44px;
  border: 3px solid var(--bg);
  margin-left: -10px;
}
.hero .preview .avatar:first-child { margin-left: 0; }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: var(--shadow);
}
.cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.cta:active { transform: translateY(0); opacity: 0.9; }
.cta.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.start-meta {
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}
.start-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Voting screen */
.matchup-header {
  text-align: center;
  margin: 8px 0 18px;
}
.matchup-header .label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.matchup-header h2 {
  font-size: clamp(22px, 4.5vw, 30px);
  margin: 6px 0 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.matchup {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  flex: 1;
  position: relative;
}
.matchup .vs {
  align-self: center;
  justify-self: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: -8px auto;
  z-index: 2;
  box-shadow: var(--shadow);
}

@media (min-width: 760px) {
  .matchup {
    grid-template-columns: 1fr auto 1fr;
    gap: 18px;
  }
  .matchup .vs { margin: 0; }
}

.card {
  position: relative;
  perspective: 1400px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.card:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: var(--radius); }
.card-inner {
  position: relative;
  flex: 1;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card.flipped { cursor: default; }

.card-face {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 22px 18px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:not(.flipped):hover .card-face.front {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.card-face.front::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, transparent);
  transition: background var(--transition);
  pointer-events: none;
}
.card.picked .card-face.front { border-color: var(--text); }
.card.picked .card-face.front::before {
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.04));
}
.card.dimmed { opacity: 0.45; transform: scale(0.985); }

.card-face.back {
  transform: rotateY(180deg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  align-items: stretch;
  padding: 18px 20px 20px;
}

/* Info / flip-back buttons */
.info-btn,
.flip-back-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.info-btn:hover,
.flip-back-btn:hover { color: var(--text); border-color: var(--text); }
.info-btn:focus-visible,
.flip-back-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.flip-back-btn { left: 12px; right: auto; font-size: 13px; width: auto; padding: 0 12px; height: 30px; border-radius: 999px; gap: 4px; }

/* Back content */
.back-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 30px 0 14px;
  padding-right: 6px;
}
.back-section { margin: 0 0 14px; }
.back-section:last-of-type { margin-bottom: 12px; }
.back-section-label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 5px;
}
.back-section p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.back-policy {
  margin: 0;
  padding-left: 18px;
}
.back-policy li {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 4px;
}
.back-resume {
  margin: 0;
  padding: 0;
  list-style: none;
}
.back-resume li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  padding: 2px 0;
}
.back-resume li + li {
  border-top: 1px solid var(--surface-2);
}
.back-moment {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 6px;
}
.back-moment p {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.45;
}
.back-links {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.link-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.link-btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.link-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.link-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 30px;
  color: #fff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.4);
}
.avatar.sm { width: 38px; height: 38px; font-size: 13px; }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4); }

.avatar.party-R { background: linear-gradient(140deg, #e0626a, var(--rep)); }
.avatar.party-D { background: linear-gradient(140deg, #6ea6e8, var(--dem)); }
.avatar.party-I { background: linear-gradient(140deg, #9a9aa3, var(--ind)); }

.avatar.has-photo { overflow: hidden; padding: 0; }
.avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
}

.card-name {
  margin: 16px 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.card-role {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 2px;
  font-weight: 500;
}
.card-age {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 14px;
  font-weight: 500;
  opacity: 0.85;
}
.card-hook {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 14px;
  max-width: 32ch;
  font-weight: 500;
}
.card-resume {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  width: 100%;
  max-width: 34ch;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.card-resume li {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 3px 0 3px 14px;
  position: relative;
}
.card-resume li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--text-muted);
  font-weight: 700;
}
.card-resume li:first-child { color: var(--text); }

@media (min-width: 760px) {
  .card-resume { display: block; }
}

.tap-more {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 8px;
  font-weight: 600;
}

.party-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.party-chip.party-R { background: var(--rep-soft); color: var(--rep); }
.party-chip.party-D { background: var(--dem-soft); color: var(--dem); }
.party-chip.party-I { background: var(--ind-soft); color: var(--ind); }
.party-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.skip-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  font-weight: 600;
  transition: border-color var(--transition), color var(--transition), background var(--transition), transform var(--transition);
}
.back-btn:hover { border-color: var(--text); transform: translateY(-1px); }
.back-btn:active { transform: translateY(0); }
.back-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.back-icon { font-size: 16px; line-height: 1; color: var(--text-muted); }
.skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 10px 18px;
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: border-color var(--transition), color var(--transition), background var(--transition), transform var(--transition);
}
.skip-btn:hover { border-color: var(--text); color: var(--text); transform: translateY(-1px); }
.skip-btn:active { transform: translateY(0); }
.skip-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.skip-icon {
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
}
.skip-label {
  font-weight: 600;
  color: var(--text);
}
.skip-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Stat overlay after vote */
.stat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease, background 220ms ease;
}
.stat-overlay.show {
  opacity: 1;
  background: rgba(0,0,0,0.32);
  pointer-events: auto;
}
@media (prefers-color-scheme: dark) {
  .stat-overlay.show { background: rgba(0,0,0,0.55); }
}
.stat-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 22px 24px;
  width: min(420px, calc(100% - 32px));
  box-shadow: var(--shadow-hover);
  border: 1px solid var(--border);
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.stat-overlay.show .stat-card { transform: translateY(0) scale(1); }
.stat-headline {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.stat-bar {
  display: flex;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-2);
}
.stat-bar .seg { transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.stat-bar .seg.party-R { background: var(--rep); }
.stat-bar .seg.party-D { background: var(--dem); }
.stat-bar .seg.party-I { background: var(--ind); }
.stat-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.stat-row .you { color: var(--text); font-weight: 600; }
.stat-faces {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.stat-face {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.stat-face.right { flex-direction: row-reverse; }
.stat-foot {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Results screen */
.results-hero {
  text-align: center;
  margin: 12px 0 22px;
}
.results-hero .label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.results-hero h2 {
  font-size: clamp(28px, 6vw, 40px);
  margin: 8px 0 4px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.results-hero p {
  color: var(--text-muted);
  margin: 6px 0 0;
  font-size: 15px;
}

.podium {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.rank-row:hover { transform: translateY(-1px); }
.rank-row.top { padding: 16px 18px; }
.rank-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
  width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.rank-row.top .rank-num { color: var(--text); font-size: 26px; }
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rank-row.top .rank-name { font-size: 18px; }
.rank-role {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-section {
  margin: 22px 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.share-preview {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.6;
  overflow-x: auto;
}
.share-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.share-actions .cta { flex: 1; min-width: 140px; padding: 12px 18px; font-size: 15px; }

.results-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.toggle-full {
  margin: 18px auto 0;
  text-align: center;
}
.toggle-full button {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
}
.toggle-full button:hover { color: var(--text); }

.full-ranking { display: none; margin-top: 14px; }
.full-ranking.show { display: block; }

/* Keep-ranking CTA (opt-in to extended round) */
.keep-ranking {
  margin: 20px auto 4px;
  text-align: center;
  padding: 18px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.keep-ranking button {
  width: auto;
  min-width: 200px;
}
.keep-ranking-blurb {
  margin: 10px auto 0;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 36ch;
  line-height: 1.45;
}

/* Extended (long-tail) ranking results */
.extended-ranking {
  margin: 22px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.extended-label {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.extended-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Footer */
.foot {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.foot a { color: inherit; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  box-shadow: var(--shadow-hover);
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Results-screen back-sheet (reuses back content) */
.rank-row { cursor: pointer; }
.rank-row[aria-expanded="true"] { border-color: var(--text); }

.detail-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease, background 220ms ease;
}
.detail-sheet.show {
  opacity: 1;
  background: rgba(0, 0, 0, 0.32);
  pointer-events: auto;
}
@media (prefers-color-scheme: dark) {
  .detail-sheet.show { background: rgba(0, 0, 0, 0.55); }
}
.detail-sheet-panel {
  width: min(560px, 100%);
  max-height: 82vh;
  background: var(--surface);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: var(--shadow-hover);
  padding: 18px 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(24px);
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
  position: relative;
}
.detail-sheet.show .detail-sheet-panel { transform: translateY(0); }
.detail-sheet-handle {
  width: 38px;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 0 auto 14px;
}
.detail-sheet-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-sheet-header .detail-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.detail-sheet-header .detail-role {
  font-size: 13px;
  color: var(--text-muted);
}
.detail-sheet-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.detail-sheet-close:hover { color: var(--text); border-color: var(--text); }

/* Desktop polish — bigger images, type, and breathing room on wide screens */
@media (min-width: 900px) {
  .app { max-width: 1100px; padding: 28px 32px 56px; }

  /* Hero */
  .hero { max-width: 720px; margin: 40px auto 32px; }
  .hero p { font-size: 19px; margin-bottom: 32px; }
  .hero .preview { margin: 28px 0 32px; }
  .hero .preview .avatar { width: 56px; height: 56px; border-width: 4px; }
  .cta { padding: 16px 32px; font-size: 17px; }
  .start-meta { font-size: 14px; gap: 22px; }

  /* Matchup */
  .matchup { gap: 28px; }
  .matchup-header { margin: 12px 0 24px; }
  .matchup-header .label { font-size: 13px; }
  .matchup .vs {
    width: 52px;
    height: 52px;
    font-size: 14px;
  }

  /* Cards — taller, more padding, larger media + type */
  .card { min-height: 560px; }
  .card-face { padding: 32px 30px 26px; }
  .card-face.back { padding: 26px 28px 28px; }

  .avatar { width: 180px; height: 180px; font-size: 52px; box-shadow: inset 0 0 0 5px rgba(255,255,255,0.4); }
  .card-name { font-size: 27px; margin: 24px 0 6px; letter-spacing: -0.025em; }
  .card-role { font-size: 14px; margin-bottom: 3px; }
  .card-age { font-size: 12.5px; margin-bottom: 18px; }
  .party-chip { font-size: 11.5px; padding: 5px 12px; margin-bottom: 14px; }
  .card-hook { font-size: 16.5px; line-height: 1.55; max-width: 34ch; margin-bottom: 18px; }
  .tap-more { font-size: 11.5px; padding-top: 12px; }

  /* Info button slightly larger */
  .info-btn { width: 36px; height: 36px; font-size: 16px; top: 14px; right: 14px; }
  .flip-back-btn { top: 14px; left: 14px; height: 32px; font-size: 13.5px; padding: 0 14px; }

  /* Back face content */
  .back-name { font-size: 22px; margin-top: 32px; margin-bottom: 18px; }
  .back-section { margin-bottom: 18px; }
  .back-section-label { font-size: 11px; margin-bottom: 6px; }
  .back-section p { font-size: 14.5px; line-height: 1.55; }
  .back-policy li, .back-resume li { font-size: 14px; line-height: 1.55; }
  .back-moment p { font-size: 13.5px; }
  .link-btn { font-size: 13.5px; padding: 10px 14px; }

  /* Skip / back row */
  .skip-row { margin-top: 24px; gap: 14px; }
  .back-btn, .skip-btn { font-size: 15px; padding: 11px 20px; }

  /* Results */
  .results-hero { margin: 18px 0 28px; }
  .results-hero p { font-size: 16px; }
  .podium { gap: 12px; margin: 22px 0; }
  .rank-row { padding: 14px 18px; gap: 16px; }
  .rank-row.top { padding: 20px 22px; }
  .rank-num { font-size: 24px; width: 32px; }
  .rank-row.top .rank-num { font-size: 30px; }
  .rank-name { font-size: 17px; }
  .rank-row.top .rank-name { font-size: 21px; }
  .rank-role { font-size: 14px; }
  /* Top podium row uses the full-size avatar; nudge non-top rows up a touch */
  .podium .avatar.sm { width: 44px; height: 44px; font-size: 15px; }

  .share-section { padding: 22px; margin: 28px 0 14px; }
  .share-preview { font-size: 14px; padding: 16px 18px; }
  .share-actions .cta { font-size: 15.5px; padding: 13px 20px; }

  /* Extended ranking & detail sheet */
  .extended-ranking { margin-top: 28px; padding-top: 22px; }
  .detail-sheet-panel { width: min(640px, 100%); padding: 22px 24px 28px; }
}

/* Wide desktop — let the photos really fill the cards */
@media (min-width: 1280px) {
  .app { max-width: 1240px; padding: 32px 40px 64px; }

  .matchup { gap: 36px; }
  .matchup .vs { width: 60px; height: 60px; font-size: 15px; }

  .card { min-height: 620px; }
  .card-face { padding: 40px 36px 30px; }

  .avatar { width: 220px; height: 220px; font-size: 62px; }
  .card-name { font-size: 30px; margin-top: 26px; }
  .card-role { font-size: 14.5px; }
  .card-age { font-size: 13px; }
  .card-hook { font-size: 17px; max-width: 36ch; }

  /* Top podium avatar matches front-card scale */
  .rank-row.top .avatar { width: 140px; height: 140px; font-size: 40px; }
  .rank-row.top { padding: 24px; gap: 20px; }
  .rank-row.top .rank-num { font-size: 34px; }
  .rank-row.top .rank-name { font-size: 24px; }
  .podium .avatar.sm { width: 52px; height: 52px; font-size: 17px; }
}

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

/* Country badge on start screen + leaderboard on results screen — added
   in Phase 2-4 frontend hookup. */
.country-badge {
  margin: 14px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 99px;
  padding: 4px 12px;
}

.country-leaderboard {
  margin: 22px 0 8px;
  padding: 18px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.country-leaderboard .extended-rows {
  margin-top: 10px;
}
.country-comparison-note {
  margin: 14px 2px 0;
  font-size: 13px;
  color: var(--text-muted);
}
