:root {
  --bg: #15102b;
  --bg2: #241a4a;
  --fg: #fff6ff;
  --muted: #b7a9d6;
  --card: #ffffff;
  --card-fg: #1b1030;
  --reject: #ff4f6a;
  --receive: #19c6a3;
  --reimagine: #8b5cf6;
  --create: #ffb020;
  --radius: 22px;
  --shadow: 0 12px 0 rgba(0, 0, 0, 0.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 10% -10%, #3b2a7a 0%, transparent 60%),
              radial-gradient(900px 700px at 110% 110%, #4b1d5e 0%, transparent 60%),
              var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* floating blobs */
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .35; animation: drift 18s ease-in-out infinite alternate; }
.blob.b1 { width: 420px; height: 420px; left: -120px; top: 10%; background: var(--reimagine); }
.blob.b2 { width: 360px; height: 360px; right: -100px; top: 30%; background: var(--reject); animation-delay: -6s; }
.blob.b3 { width: 300px; height: 300px; left: 35%; bottom: -120px; background: var(--receive); animation-delay: -12s; }
.blob.b4 { width: 260px; height: 260px; right: 25%; top: -80px; background: var(--create); animation-delay: -3s; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }

.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; flex-direction: column; animation: pop-in .35s cubic-bezier(.2,.9,.3,1.3); }
.screen.active { display: flex; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { margin: 0; line-height: 1.05; letter-spacing: -0.02em; }
.display { font-weight: 900; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  padding: 14px 22px; border-radius: 16px; color: var(--card-fg); background: var(--card);
  box-shadow: 0 6px 0 rgba(0,0,0,.3); transition: transform .08s, box-shadow .08s, filter .15s;
  letter-spacing: .01em;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.btn:disabled { filter: grayscale(.6) brightness(.8); cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #ffd166, #ff7a59); color: #2b1024; }
.btn.ghost { background: rgba(255,255,255,.1); color: var(--fg); box-shadow: 0 6px 0 rgba(0,0,0,.2); }
.btn.big { font-size: 1.3rem; padding: 18px 30px; border-radius: 20px; }

.input {
  font: inherit; font-size: 1.2rem; padding: 14px 18px; border-radius: 16px; border: 3px solid transparent;
  background: var(--card); color: var(--card-fg); width: 100%; outline: none; font-weight: 700;
}
.input:focus { border-color: var(--create); }
.input.code { text-transform: uppercase; letter-spacing: .4em; text-align: center; font-size: 2rem; font-weight: 900; }

.card {
  background: var(--card); color: var(--card-fg); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
}
.card.dark { background: rgba(255,255,255,.07); color: var(--fg); box-shadow: none; border: 1px solid rgba(255,255,255,.1); }

/* ---- choice colors ---- */
.c-reject { --c: var(--reject); }
.c-receive { --c: var(--receive); }
.c-reimagine { --c: var(--reimagine); }
.c-create { --c: var(--create); }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--c); color: #1b1030; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }

/* ---- answer tiles (phone) ---- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; border: 0; cursor: pointer; font: inherit; color: #1b1030; background: var(--c);
  border-radius: 20px; padding: 52px 14px 16px; min-height: 120px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 4px;
  box-shadow: 0 8px 0 rgba(0,0,0,.28); transition: transform .1s, box-shadow .1s, opacity .2s;
  text-align: left; overflow: hidden;
}
.tile .icon { font-size: 2rem; line-height: 1; position: absolute; top: 12px; right: 12px; }
.tile .name { font-weight: 900; font-size: 1.35rem; letter-spacing: -0.02em; }
.tile .q { font-size: .78rem; font-weight: 600; opacity: .85; }
.tile:active, .tile.selected { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.tile.selected::after { content: "✓"; position: absolute; left: 12px; top: 10px; font-weight: 900; font-size: 1.4rem; }
.tiles.has-selection .tile:not(.selected) { opacity: .45; transform: scale(.97); }

/* ---- timer ring ---- */
.ring { width: 120px; height: 120px; position: relative; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .track { stroke: rgba(255,255,255,.12); }
.ring .bar { stroke: var(--create); transition: stroke-dashoffset .9s linear, stroke .3s; }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 2.2rem; }
.ring.hurry .bar { stroke: var(--reject); }
.ring.hurry .num { animation: pulse .5s infinite alternate; color: var(--reject); }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.18); } }

/* ---- reveal bars ---- */
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: end; height: 260px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.bar-col .fill { width: 100%; background: var(--c); border-radius: 16px 16px 6px 6px; transform-origin: bottom; animation: grow 1s cubic-bezier(.2,.9,.3,1.2) both; box-shadow: 0 8px 0 rgba(0,0,0,.25); position: relative; }
.bar-col .count { font-weight: 900; font-size: 2rem; }
.bar-col .label { font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; }
.bar-col.correct .fill { outline: 5px solid #fff; outline-offset: 3px; }
.bar-col.correct .label::after { content: " ✓"; }
.bar-col.accepted .fill { outline: 5px dashed #fff; outline-offset: 3px; }
.bar-col.dim { opacity: .45; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---- leaderboard ---- */
.lb { display: flex; flex-direction: column; gap: 10px; }
.lb-row { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.08); border-radius: 16px; padding: 12px 18px; animation: slide-in .5s both; }
.lb-row:nth-child(1) { animation-delay: .5s; background: linear-gradient(90deg, rgba(255,209,102,.35), rgba(255,255,255,.08)); }
.lb-row:nth-child(2) { animation-delay: .4s; }
.lb-row:nth-child(3) { animation-delay: .3s; }
.lb-row:nth-child(n+4) { animation-delay: .2s; }
.lb-row .rank { font-weight: 900; font-size: 1.4rem; width: 2.2em; text-align: center; }
.lb-row .name { font-weight: 800; font-size: 1.25rem; flex: 1; }
.lb-row .score { font-weight: 900; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.lb-row .delta { font-weight: 800; color: var(--receive); }
@keyframes slide-in { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

/* ---- podium ---- */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: end; margin-top: 20px; height: 320px; }
.pod { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px; height: 100%; }
.pod .name { font-weight: 900; font-size: 1.4rem; text-align: center; }
.pod .score { font-weight: 800; color: var(--muted); }
.pod .block { width: 100%; border-radius: 18px 18px 0 0; display: grid; place-items: center; font-weight: 900; font-size: 3rem; color: #1b1030; animation: grow .9s cubic-bezier(.2,.9,.3,1.2) both; transform-origin: bottom; }
.pod.p1 .block { height: 65%; background: linear-gradient(180deg, #ffd166, #ffb020); animation-delay: .6s; }
.pod.p2 .block { height: 45%; background: linear-gradient(180deg, #e6e9f5, #b7bdd3); animation-delay: .3s; }
.pod.p3 .block { height: 32%; background: linear-gradient(180deg, #f0b07d, #c77d4b); animation-delay: .1s; }

/* ---- confetti ---- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear infinite; }
@keyframes fall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: .8; } }

/* ---- misc fx ---- */
.shake { animation: shake .5s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-8px); } 80% { transform: translateX(8px); } }
.bounce { animation: bounce .7s cubic-bezier(.2,.9,.3,1.4); }
@keyframes bounce { 0% { transform: scale(.4); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.wiggle { display: inline-block; animation: wiggle 1.4s ease-in-out infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.badge { display: inline-block; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,.12); font-weight: 800; font-size: .85rem; }
.badge.x2 { background: linear-gradient(135deg, #ffd166, #ff7a59); color: #2b1024; animation: pulse 1s infinite alternate; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--reject); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); z-index: 10; animation: pop-in .3s; }
.voices { display: flex; flex-direction: column; gap: 8px; }
.voice { background: rgba(27,16,48,.06); border-left: 5px solid var(--reimagine); padding: 10px 14px; border-radius: 10px; font-style: italic; }
.card.dark .voice { background: rgba(255,255,255,.06); }
.tagline { font-style: italic; color: #6b5a8e; font-weight: 600; }
.card.dark .tagline { color: var(--muted); }
.emoji-big { font-size: 4rem; line-height: 1; }

/* ---- polish pass ---- */
:focus-visible { outline: 3px solid var(--create); outline-offset: 3px; }
.btn.primary:hover, .tile:hover { filter: brightness(1.06); }
.card .tagline { font-size: 1.05rem; }
.card p.pitch-text { font-size: clamp(1.05rem, 1.35vw, 1.45rem); line-height: 1.5; }
.card h2.pitch-title { font-size: clamp(1.8rem, 2.8vw, 3rem); }
.voice { font-size: clamp(.95rem, 1.1vw, 1.2rem); }
/* round progress dots */
.progress { display: flex; gap: 6px; align-items: center; }
.progress i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.18); display: block; transition: transform .2s, background .2s; }
.progress i.done { background: var(--receive); }
.progress i.now { background: var(--create); transform: scale(1.5); box-shadow: 0 0 0 4px rgba(255,176,32,.25); }
.progress i.final { border-radius: 3px; }
/* sticky control bars get a fade so they never sit on top of content */
.controls { background: linear-gradient(to top, var(--bg) 60%, transparent); margin-top: 8px; padding-bottom: 8px; }
.lb-row { padding: 14px 22px; }
.lb-row .name { font-size: 1.5rem; }
.lb-row .score, .lb-row .rank { font-size: 1.6rem; }
.lb-row.up .rank::after { content: "▲"; color: var(--receive); font-size: .7em; margin-left: 4px; }
.lb-row.down .rank::after { content: "▼"; color: var(--reject); font-size: .7em; margin-left: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .blob { display: none; }
}
