:root {
  --bg: #080b18;
  --surface: #12172d;
  --surface-2: #181e39;
  --text: #f7f8ff;
  --muted: #abb3cf;
  --line: rgba(255,255,255,.11);
  --accent: #ffd447;
  --accent-2: #ff8b4a;
  --success: #5be0a4;
  --danger: #ff8d9a;
  --shadow: 0 18px 60px rgba(0,0,0,.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 90% 8%, rgba(255,139,74,.17), transparent 28%),
    radial-gradient(circle at 10% 30%, rgba(87,104,255,.16), transparent 32%),
    var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-shell { width: min(100%, 560px); margin: 0 auto; min-height: 100vh; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; color: #151515; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px rgba(255,173,70,.25); }
.brand strong { display: block; letter-spacing: .08em; font-size: .92rem; }
.brand small { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; }

.card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(25,31,59,.94), rgba(15,20,40,.96)); border-radius: 26px; box-shadow: var(--shadow); }
.hero { padding: 26px 22px; position: relative; overflow: hidden; }
.hero::after { content: "234"; position: absolute; right: -10px; bottom: -35px; font-size: 7rem; font-weight: 950; color: rgba(255,255,255,.035); }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .1em; font-size: .73rem; }
h1 { margin: 12px 0 10px; font-size: clamp(1.75rem, 7vw, 2.5rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 1.16rem; }
p { color: var(--muted); line-height: 1.55; }
.hero p { margin-bottom: 18px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px 15px; color: #d8def3; font-size: .78rem; }

.survey-card { margin-top: 16px; padding: 22px 18px 20px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.section-heading p { margin: 4px 0 0; font-size: .84rem; }
.step-badge { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,212,71,.15); color: var(--accent); border: 1px solid rgba(255,212,71,.38); font-weight: 800; }
.leader-heading { margin-top: 28px; }
.field-label { display: block; margin: 0 0 8px; color: #dce1f6; font-size: .86rem; font-weight: 650; }
.text-input { width: 100%; border: 1px solid var(--line); background: #0b1022; color: var(--text); border-radius: 15px; padding: 14px 15px; outline: none; min-height: 50px; }
.text-input:focus { border-color: rgba(255,212,71,.75); box-shadow: 0 0 0 4px rgba(255,212,71,.10); }
.text-input::placeholder { color: #717a9a; }

.leader-grid { margin: 0; padding: 0; border: 0; display: grid; gap: 11px; }
.leader-card { position: relative; display: grid; grid-template-columns: 28px 64px 1fr 24px; align-items: center; gap: 10px; min-height: 94px; padding: 12px; border-radius: 18px; border: 1px solid var(--line); background: rgba(8,12,28,.72); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.leader-card:has(input:checked) { border-color: var(--accent); background: linear-gradient(90deg, rgba(255,212,71,.12), rgba(255,139,74,.08)); transform: translateY(-1px); }
.leader-card input { position: absolute; opacity: 0; pointer-events: none; }
.leader-number { width: 25px; height: 25px; border-radius: 9px; display: grid; place-items: center; font-size: .75rem; font-weight: 800; background: rgba(255,255,255,.07); color: var(--muted); }
.leader-avatar { width: 62px; height: 62px; border-radius: 15px; display: grid; place-items: center; font-weight: 900; color: #111; background: linear-gradient(135deg, #fff3ad, var(--accent-2)); }
.leader-copy strong, .leader-copy small { display: block; }
.leader-copy strong { font-size: .98rem; }
.leader-copy small { color: var(--muted); margin-top: 4px; font-size: .76rem; }
.choice-ring { width: 20px; height: 20px; border: 2px solid #5f688b; border-radius: 50%; }
.leader-card:has(input:checked) .choice-ring { border: 6px solid var(--accent); }

.conditional-field { margin-top: 14px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.035); }
.optional-panel { margin: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 15px 0; }
.optional-panel summary { cursor: pointer; color: #dce1f6; font-weight: 650; }
.optional-grid { display: grid; gap: 13px; margin-top: 16px; }
.optional-grid label > span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 7px; }
.consent-row { display: grid; grid-template-columns: 23px 1fr; gap: 10px; align-items: flex-start; color: #d6dcf2; font-size: .84rem; line-height: 1.45; }
.consent-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.error-text { min-height: 16px; color: var(--danger); font-size: .78rem; margin: 6px 2px 0; }

.primary-button, .secondary-button, .ghost-button { border: 0; border-radius: 15px; font-weight: 800; min-height: 48px; padding: 12px 16px; }
.primary-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; color: #171714; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 30px rgba(255,170,55,.2); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.secondary-button { width: 100%; color: #12151f; background: var(--success); }
.ghost-button { color: #e8ebfa; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.full-width { width: 100%; margin-top: 10px; }
.fine-print { margin: 14px 2px 0; text-align: center; font-size: .68rem; color: #7f88a8; }

.success-card { margin-top: 16px; text-align: center; padding: 32px 22px; }
.success-icon { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: #07150f; font-size: 2rem; font-weight: 900; background: var(--success); box-shadow: 0 12px 35px rgba(91,224,164,.22); }
.success-card h2 { font-size: 1.5rem; margin-top: 8px; }

footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin: 22px 0 4px; color: #69728e; font-size: .69rem; }
footer a { color: #9099b8; }

.ad-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 14px; background: #050710; }
.ad-frame { width: min(100%, 520px); height: min(92vh, 900px); display: grid; grid-template-rows: auto 1fr auto auto; border-radius: 28px; overflow: hidden; background: #11172a; border: 1px solid rgba(255,255,255,.15); box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.sponsored-label { padding: 10px 14px; text-align: center; letter-spacing: .14em; font-size: .66rem; color: #c1c7dc; background: #080b14; }
.ad-visual { min-height: 0; background-position: center; background-size: cover; display: grid; place-items: center; position: relative; }
.ad-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(5,7,16,.85)); pointer-events: none; }
.ad-fallback { width: 100%; height: 100%; min-height: 420px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; padding: 30px; background: radial-gradient(circle at 30% 20%, #7658ff, transparent 34%), linear-gradient(145deg, #ff844f, #252b77 62%, #0a0e1d); }
.ad-fallback span { letter-spacing: .22em; font-size: .75rem; font-weight: 850; }
.ad-fallback strong { max-width: 360px; font-size: clamp(2rem, 10vw, 3.4rem); line-height: 1; }
.ad-fallback small { color: rgba(255,255,255,.78); }
.ad-bottom { position: relative; z-index: 2; margin-top: -2px; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; background: #0a0e1c; }
.ad-bottom p { margin: 4px 0 0; font-size: .78rem; }
.ad-actions { display: flex; align-items: center; gap: 9px; }
.ad-cta { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 12px; text-decoration: none; color: #111; background: #fff; font-size: .72rem; font-weight: 850; }
.countdown { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; font-weight: 900; color: #141414; background: var(--accent); }
.progress-track { height: 6px; background: #202742; }
.progress-bar { height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

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

@media (min-width: 620px) {
  .app-shell { padding-left: 0; padding-right: 0; }
  .optional-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Final participant-results upgrade */
.leader-avatar {
  overflow: hidden;
  position: relative;
  background: #202642;
}
.leader-avatar img,
.result-leader-photo img,
.selected-choice-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.image-fallback-text {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #111;
  background: linear-gradient(135deg, #fff3ad, var(--accent-2));
}
.already-voted-note { margin-bottom: 16px; }
.already-voted-note p { margin-bottom: 0; }

.selected-choice-card {
  margin: 22px 0 18px;
  padding: 13px;
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 13px;
  align-items: center;
  text-align: left;
  border-radius: 20px;
  border: 1px solid rgba(255,212,71,.35);
  background: linear-gradient(100deg, rgba(255,212,71,.13), rgba(255,139,74,.07));
}
.selected-choice-photo {
  width: 66px;
  height: 66px;
  overflow: hidden;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,.2);
  background: #222841;
}
.selected-choice-copy span,
.selected-choice-copy strong,
.selected-choice-copy small { display: block; }
.selected-choice-copy span {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: .67rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.selected-choice-copy strong { font-size: 1.12rem; }
.selected-choice-copy small { margin-top: 4px; color: var(--muted); }

.participant-results {
  margin: 0 0 19px;
  padding: 17px 13px 14px;
  text-align: left;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(5,8,21,.58);
}
.results-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}
.results-heading h3 {
  margin: 5px 0 0;
  font-size: 1.08rem;
  line-height: 1.3;
}
.results-heading > strong {
  align-self: center;
  color: #111;
  background: var(--accent);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: .68rem;
  white-space: nowrap;
}
.results-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .11em;
}
.results-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(91,224,164,.11);
}
.result-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 15px 0 9px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
}
.result-tab {
  min-height: 39px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: .75rem;
  font-weight: 800;
}
.result-tab.active {
  color: #151515;
  background: var(--accent);
}
.results-context {
  margin: 7px 2px 13px;
  color: #dce1f6;
  font-size: .74rem;
  font-weight: 700;
}
.participant-result-list { display: grid; gap: 10px; }
.participant-result-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.028);
}
.participant-result-row.chosen-result {
  border-color: rgba(255,212,71,.44);
  background: rgba(255,212,71,.055);
}
.result-leader-photo {
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 14px;
  background: #222841;
}
.result-leader-data { min-width: 0; }
.result-leader-line {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 7px;
}
.result-leader-line strong,
.result-leader-line small { display: block; }
.result-leader-line > div:first-child { min-width: 0; }
.result-leader-line > div:first-child strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
}
.result-leader-line > div:first-child small {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: .64rem;
}
.result-figure { text-align: right; }
.result-figure strong { color: var(--accent); font-size: .88rem; }
.result-figure small { color: var(--muted); font-size: .62rem; }
.participant-bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #242b47;
}
.participant-bar-track span {
  display: block;
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .55s ease;
}
.result-disclaimer {
  margin: 13px 2px 0;
  color: #7f88a8;
  font-size: .65rem;
  line-height: 1.45;
}
.empty-results {
  margin: 0;
  padding: 20px 10px;
  text-align: center;
  font-size: .78rem;
}

@media (max-width: 390px) {
  .leader-card { grid-template-columns: 25px 44px 1fr 20px; gap: 8px; padding: 10px; }
  .leader-avatar { width: 42px; height: 42px; border-radius: 13px; }
  .leader-copy strong { font-size: .9rem; }
  .leader-copy small { font-size: .69rem; }
  .results-heading { grid-template-columns: 1fr; }
  .results-heading > strong { justify-self: start; }
}
.credit-list { display: grid; gap: 12px; margin-top: 22px; }
.credit-list .conditional-field { margin-top: 0; }
.credit-list p { margin: 7px 0; font-size: .82rem; }
.credit-list a { color: var(--accent); font-size: .8rem; font-weight: 750; }


/* Clear, face-forward portrait treatment */
.leader-photo-ajith {
  object-position: 50% 35%;
  transform: scale(1.14);
  transform-origin: center;
}
.leader-card .leader-copy strong { font-size: 1.02rem; }
@media (max-width: 390px) {
  .leader-card { grid-template-columns: 26px 56px 1fr 22px; gap: 8px; padding: 10px; }
  .leader-avatar { width: 54px; height: 54px; border-radius: 15px; }
}


/* V4 cinematic live leaderboard */
.leaderboard-hero { margin-bottom: 13px; }
.cinematic-leader-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(255,212,71,.38);
  border-radius: 22px;
  background:
    linear-gradient(125deg, rgba(255,212,71,.14), transparent 38%),
    radial-gradient(circle at 82% 12%, rgba(255,139,74,.28), transparent 32%),
    linear-gradient(145deg, #111933, #080b18 72%);
  box-shadow: 0 18px 45px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.07);
}
.leaderboard-glow {
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 180px;
  right: -58px;
  top: -80px;
  border-radius: 50%;
  background: rgba(255,212,71,.15);
  filter: blur(20px);
}
.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: .64rem;
  font-weight: 950;
  letter-spacing: .12em;
}
.leaderboard-rank i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(91,224,164,.11), 0 0 18px rgba(91,224,164,.6);
  animation: leaderboardPulse 1.6s ease-in-out infinite;
}
.leaderboard-main {
  display: grid;
  grid-template-columns: 78px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
}
.leaderboard-photo {
  position: relative;
  width: 78px;
  height: 94px;
  overflow: hidden;
  border-radius: 20px;
  border: 2px solid rgba(255,212,71,.64);
  background: #222841;
  box-shadow: 0 12px 28px rgba(0,0,0,.36);
}
.leaderboard-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.leaderboard-crown {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #151515;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  font-size: .7rem;
}
.leaderboard-copy { min-width: 0; }
.leaderboard-copy small { color: #9ba5ca; font-size: .58rem; font-weight: 850; letter-spacing: .11em; }
.leaderboard-copy h4 { margin: 4px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.16rem; line-height: 1.1; }
.leaderboard-copy p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .7rem; }
.leaderboard-score { text-align: right; }
.leaderboard-score strong { display: block; color: var(--accent); font-size: 1.62rem; line-height: 1; letter-spacing: -.04em; text-shadow: 0 5px 22px rgba(255,212,71,.18); }
.leaderboard-score span { display: block; margin-top: 5px; color: var(--muted); font-size: .58rem; white-space: nowrap; }
.leaderboard-margin {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,.09);
}
.leaderboard-margin span { color: #e9ecf8; font-size: .68rem; font-weight: 750; }
.leaderboard-margin strong { color: #111; background: linear-gradient(135deg, var(--accent), #ffac4a); padding: 5px 8px; border-radius: 999px; font-size: .58rem; white-space: nowrap; }
.countdown { width: 64px; height: 64px; line-height: 1; }
.countdown strong, .countdown small { display: block; text-align: center; }
.countdown strong { font-size: 1.35rem; }
.countdown small { margin-top: 2px; font-size: .45rem; letter-spacing: .12em; }
@keyframes leaderboardPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.72); opacity: .58; } }
@media (max-width: 390px) {
  .leaderboard-main { grid-template-columns: 68px minmax(0,1fr) auto; gap: 9px; }
  .leaderboard-photo { width: 68px; height: 84px; border-radius: 17px; }
  .leaderboard-copy h4 { font-size: 1rem; }
  .leaderboard-score strong { font-size: 1.3rem; }
  .leaderboard-margin { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .leaderboard-rank i { animation: none; } }

.privacy-hint { margin: 7px 2px 13px; color: #7f88a8; font-size: .68rem; line-height: 1.45; }
