:root {
  --bg: #0b0b0b;
  --surface: #171717;
  --surface-2: #222222;
  --line: #2c2c2c;
  --text: #f7f5f2;
  --muted: #9b9791;
  --ink: #141210;
  --gold: #f7b731;
  --orange: #ee7a2e;
  --coral: #e9745b;
  --pink: #e58aa8;
  --grad: linear-gradient(100deg, #f7b731 0%, #ee7a2e 38%, #e4564f 66%, #c77a97 100%);
  --r-lg: 30px;
  --r-md: 22px;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: -20% -20% auto -20%; height: 70vh;
  background:
    radial-gradient(40% 50% at 15% 30%, rgba(247,183,49,.16), transparent 70%),
    radial-gradient(40% 50% at 85% 20%, rgba(228,86,79,.16), transparent 70%),
    radial-gradient(40% 40% at 60% 60%, rgba(199,122,151,.10), transparent 70%);
  pointer-events: none; z-index: 0;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px; margin: 0 auto;
  min-height: 100dvh;
  padding: calc(14px + var(--safe-t)) 16px calc(16px + var(--safe-b));
}
.screen { min-height: calc(100dvh - 30px - var(--safe-t) - var(--safe-b)); display: flex; flex-direction: column; animation: screenIn .45s cubic-bezier(.2,.8,.2,1); }
.screen.center { align-items: center; justify-content: center; gap: 18px; text-align: center; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.demo-banner {
  position: sticky; top: 0; z-index: 50;
  background: var(--gold); color: var(--ink);
  font-size: 12px; font-weight: 800; text-align: center;
  padding: calc(6px + var(--safe-t)) 12px 6px;
  letter-spacing: .01em;
}

/* ── type ── */
.mega { font-family: var(--display); font-weight: 900; font-size: clamp(50px, 16.5vw, 76px); line-height: .92; letter-spacing: -.035em; margin: 14px 0 12px; }
.mega .grad, .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h1 { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 8.4vw, 36px); line-height: 1.02; letter-spacing: -.03em; margin: 8px 0 6px; }
.h2 { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.02em; margin: 0; }
.h3 { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; margin: 0; }
.lede { color: #cfcac3; font-size: 16.5px; margin: 0 0 10px; max-width: 32ch; }
.muted { color: var(--muted); margin: 0; }
.tiny { font-size: 12.5px; }
.center-text { text-align: center; }
.big-emoji { font-size: 64px; line-height: 1; }

/* ── logos ── */
.logo-dyn { width: min(78%, 300px); height: auto; }
.logo-dyn.sm { width: 150px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.98); } }
.powered { margin-top: auto; padding-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.powered img { width: 104px; opacity: .92; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 58px; padding: 0 24px; border-radius: 999px;
  font-weight: 800; font-size: 17px; letter-spacing: -.005em;
  transition: transform .15s ease, opacity .2s, background .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-white { background: var(--text); color: var(--ink); }
.btn-ghost { color: var(--muted); padding: 0 18px; }
.btn-outline { border: 1.5px solid #3a3a3a; color: var(--text); }
.btn-xl { height: 64px; font-size: 18px; width: 100%; }
.grow { flex: 1; }
.icon-btn {
  width: 48px; height: 48px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid #3a3a3a; color: var(--text);
  transition: transform .15s, background .2s;
}
.icon-btn:active { transform: scale(.92); background: #1d1d1d; }
.icon-btn.ghost { border-color: transparent; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); color: #d9d4cd; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.chip.dark { background: rgba(20,18,16,.88); color: #fff; }
.chip.soft { background: rgba(20,18,16,.12); color: var(--ink); }

/* ── loader ── */
.loader { display: inline-flex; gap: 7px; }
.loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); animation: bob 1s infinite ease-in-out; }
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-8px); opacity: 1; } }

/* ── HOME ── */
.home-top { display: flex; justify-content: flex-start; padding-top: 6px; }
.home-top .logo-dyn { width: min(70%, 270px); }
.status-pill {
  margin-top: 26px; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 14px 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700;
}
.status-pill i { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: ping 1.8s infinite; }
.status-pill.r2 i { background: var(--gold); box-shadow: 0 0 0 0 rgba(247,183,49,.6); }
.status-pill.off i { background: #ef4444; animation: none; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }

.fan { position: relative; height: 214px; margin: 18px 0 22px; }
.fan-card {
  position: absolute; left: 0; right: 0;
  height: 122px; padding: 14px 16px;
  border-radius: 26px; color: var(--ink);
  display: flex; align-items: flex-start; gap: 12px;
  box-shadow: 0 -10px 30px rgba(0,0,0,.35);
  animation: fanIn .7s cubic-bezier(.2,1.2,.4,1) both;
}
.fan-card .fc-emoji { width: 40px; height: 40px; border-radius: 50%; background: rgba(20,18,16,.9); display: grid; place-items: center; font-size: 20px; flex: none; }
.fan-card .fc-title { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.1; letter-spacing: -.02em; padding-top: 8px; }
.fan-card:nth-child(1) { top: 0; transform: scale(.9) rotate(-2deg); animation-delay: .05s; }
.fan-card:nth-child(2) { top: 46px; transform: scale(.95) rotate(1.5deg); animation-delay: .15s; }
.fan-card:nth-child(3) { top: 92px; animation-delay: .25s; }
@keyframes fanIn { from { opacity: 0; translate: 0 30px; } }

.home-cta { display: flex; flex-direction: column; gap: 12px; }

/* ── top bar ── */
.bar { display: flex; align-items: center; gap: 12px; padding: 2px 0 14px; position: sticky; top: calc(var(--safe-t) * 0); z-index: 5; }
.bar-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar-title { font-family: var(--display); font-weight: 700; font-size: 16px; }
.step-count { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--muted); }
.step-count b { color: var(--text); font-size: 20px; margin-right: 4px; }
.segments { display: flex; gap: 4px; width: 100%; max-width: 240px; }
.segments i { flex: 1; height: 5px; border-radius: 5px; background: #2a2a2a; transition: background .3s; }
.segments i.done { background: #6d6a66; }
.segments i.now { background: var(--c, #fff); }

/* ── VOTE card ── */
.stage { flex: 1; display: flex; flex-direction: column; }
.vcard {
  --c: var(--coral);
  background: var(--c); color: var(--ink);
  border-radius: var(--r-lg); padding: 18px 16px 18px;
  position: relative;
  animation: cardIn .42s cubic-bezier(.2,.9,.25,1.15);
}
.vcard.back { animation-name: cardInBack; }
@keyframes cardIn { from { opacity: 0; transform: translateX(40px) rotate(2deg); } to { opacity: 1; transform: none; } }
@keyframes cardInBack { from { opacity: 0; transform: translateX(-40px) rotate(-2deg); } to { opacity: 1; transform: none; } }
.vcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.emoji-bubble { width: 52px; height: 52px; border-radius: 50%; background: rgba(20,18,16,.9); display: grid; place-items: center; font-size: 26px; flex: none; }
.vtitle { font-family: var(--display); font-weight: 800; font-size: clamp(27px, 8.2vw, 34px); line-height: 1.02; letter-spacing: -.03em; margin: 18px 4px 8px; }
.vdesc { margin: 0 4px 18px; font-size: 15.5px; font-weight: 600; opacity: .78; max-width: 30ch; }

.field {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff;
  border-radius: 22px; height: 62px; padding: 0 8px 0 18px;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s;
}
.field:focus-within { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.field svg.lead { flex: none; opacity: .55; }
.field input {
  flex: 1; min-width: 0; height: 100%;
  background: transparent; border: 0; outline: 0; color: #fff;
  font: 700 18px/1 var(--body); letter-spacing: -.005em;
}
.field input::placeholder { color: #7d7973; font-weight: 600; }
.field .clear { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #aaa; flex: none; }
.field .ok { width: 34px; height: 34px; border-radius: 50%; background: #4ade80; color: var(--ink); display: grid; place-items: center; flex: none; margin-right: 4px; animation: pop .3s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.suggest { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.suggest:empty { display: none; }
.suggest button {
  width: 100%; min-height: 52px; padding: 8px 16px;
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: rgba(20,18,16,.12); color: var(--ink); border-radius: 18px;
  font-weight: 600; font-size: 16.5px;
  transition: background .15s, transform .12s;
}
.suggest button:active { transform: scale(.98); background: rgba(20,18,16,.24); }
.suggest button b { font-weight: 800; }
.suggest .av { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.suggest .tag { margin-left: auto; font-size: 11.5px; font-weight: 800; opacity: .6; }
.hint { margin: 12px 4px 0; font-size: 13px; font-weight: 700; opacity: .7; display: flex; gap: 6px; align-items: center; }
.hint.warn { opacity: 1; }

.cands { display: flex; flex-direction: column; gap: 8px; }
.cand {
  position: relative;
  height: 62px; border-radius: 22px; padding: 0 18px;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff;
  font-weight: 800; font-size: 17.5px; text-align: left;
  transition: transform .15s, background .2s, color .2s;
}
.cand:active { transform: scale(.98); }
.cand .radio { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #555; flex: none; display: grid; place-items: center; }
.cand.on { background: #fff; color: var(--ink); }
.cand .radio svg { opacity: 0; transform: scale(.4); transition: .2s; }
.cand.on .radio svg { opacity: 1; transform: none; }
.cand.on .radio { border-color: var(--ink); background: var(--ink); color: #fff; }
.r2-note { margin: 0 4px 14px; font-size: 13.5px; font-weight: 700; opacity: .75; }

.dock {
  position: sticky; bottom: 0; z-index: 6;
  display: flex; gap: 10px; align-items: center;
  margin: auto -16px 0; padding: 14px 16px calc(6px + var(--safe-b) * 0);
  background: linear-gradient(to top, var(--bg) 70%, rgba(11,11,11,0));
}
.vote .stage { padding-bottom: 12px; }

/* ── REVIEW ── */
.picks { list-style: none; padding: 0; margin: 18px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.pick {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 10px 14px 10px 10px; text-align: left;
  transition: transform .12s;
}
.pick:active { transform: scale(.985); }
.pick .pe { width: 44px; height: 44px; border-radius: 14px; background: var(--c); display: grid; place-items: center; font-size: 21px; flex: none; }
.pick .pt { flex: 1; min-width: 0; }
.pick .pt small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .pt strong { display: block; font-size: 16.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .pt strong.skip { color: #6b6863; font-weight: 600; font-style: italic; }
.pick .edit { color: var(--muted); flex: none; }

/* ── BOARD ── */
.board-top { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.done-hero { text-align: center; padding: 26px 0 8px; display: flex; flex-direction: column; align-items: center; }
.check-badge { width: 76px; height: 76px; border-radius: 50%; background: #4ade80; color: var(--ink); display: grid; place-items: center; animation: pop .5s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 0 0 10px rgba(74,222,128,.12), 0 0 0 22px rgba(74,222,128,.06); margin-bottom: 14px; }
.check-badge svg { width: 38px; height: 38px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.board-list { display: flex; flex-direction: column; gap: 12px; }
.lb {
  --c: var(--coral);
  background: var(--c); color: var(--ink);
  border-radius: var(--r-lg); padding: 16px 14px 14px;
  animation: screenIn .4s both;
}
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.lb-title { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1.06; letter-spacing: -.02em; margin: 6px 4px 12px; }
.lb-rows { display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: flex; gap: 6px; align-items: stretch; }
.lb-bar { position: relative; flex: 1; min-width: 0; height: 46px; border-radius: 16px; background: rgba(20,18,16,.10); overflow: hidden; display: flex; align-items: center; }
.lb-bar .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 16px; background: rgba(255,255,255,.55); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.lb-bar .lab { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--ink); font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row.lead .fill { background: var(--ink); }
.lb-row.lead .lab { color: #fff; }
.lb-num { flex: none; min-width: 78px; height: 46px; padding: 0 10px; border-radius: 16px; background: rgba(20,18,16,.88); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.lb-empty, .lb-locked { font-weight: 700; opacity: .75; padding: 6px 4px 4px; font-size: 14.5px; }
.board-msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px; text-align: center; color: #cfcac3; }
.board-msg .big-emoji { font-size: 44px; margin-bottom: 8px; }

.closed .logo-dyn { width: 220px; margin-bottom: 24px; }
.closed .powered { margin-top: 30px; }

/* ── overlay / toast ── */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(5,5,5,.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.sending-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 28px 30px; display: flex; flex-direction: column; align-items: center; gap: 16px; font-weight: 700; }
.sending-card p { margin: 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 120;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 420px); width: max-content;
  background: #fff; color: var(--ink); font-weight: 800; font-size: 14.5px;
  padding: 13px 18px; border-radius: 16px; box-shadow: 0 12px 30px rgba(0,0,0,.4);
  transition: opacity .25s, transform .3s cubic-bezier(.2,1.2,.4,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  .app { padding-top: 28px; }
}
@media (max-height: 680px) {
  .fan { height: 184px; margin: 8px 0 14px; }
  .fan-card { height: 100px; }
  .fan-card:nth-child(2) { top: 42px; }
  .fan-card:nth-child(3) { top: 84px; }
  .mega { margin-top: 8px; }
  .status-pill { margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
