:root {
  --bg1: #2a0f4c;
  --bg2: #12082a;
  --card: rgba(255, 255, 255, 0.08);
  --card-solid: #1e1440;
  --accent: #ffd54a;
  --accent2: #ff5da2;
  --text: #f5f2ff;
  --muted: #b6a9d8;
  --ok: #4ade80;
  --err: #ff6b6b;
  --gold: #ffd700;
  --silver: #c0c9d6;
  --bronze: #cd7f32;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% -10%, var(--bg1), var(--bg2));
  min-height: 100vh;
}

a { color: var(--accent); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1, h2 { margin: 0 0 12px; }
.brand { font-size: 28px; }
.brand .emoji { filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0;
  backdrop-filter: blur(6px);
}

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }

input[type=text], input[type=email], input[type=number], textarea, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.25);
  color: var(--text);
  font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }

button, .btn {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  color: #201042;
  background: linear-gradient(180deg, var(--accent), #ffb800);
  transition: transform .08s ease, filter .15s ease;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
button.secondary { background: rgba(255,255,255,.14); color: var(--text); }
button.danger { background: linear-gradient(180deg, #ff8080, #e03434); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

.pin-input {
  font-size: 34px;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 700;
}

.msg { margin: 12px 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg.ok { background: rgba(74,222,128,.15); color: var(--ok); }
.msg.err { background: rgba(255,107,107,.15); color: var(--err); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.person-item, .q-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 12px; background: rgba(0,0,0,.2); margin: 8px 0;
}
.person-meta { min-width: 0; }
.person-edit-fields {
  display: flex; flex: 1 1 260px; gap: 10px; align-items: center; flex-wrap: wrap;
  min-width: 220px;
}
.person-name-edit { flex: 1 1 180px; min-width: 180px; }
.person-photo-edit { flex: 1 1 190px; min-width: 190px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  background: #3a2a66; flex: none;
}
.avatar.lg { width: 220px; height: 220px; }
.avatar.md { width: 130px; height: 130px; }

.pill { background: rgba(255,255,255,.15); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

/* Choice buttons (answer options) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px; border-radius: 14px; background: rgba(0,0,0,.25);
  border: 2px solid transparent; cursor: pointer; text-align: center;
}
.choice.selected { border-color: var(--accent); background: rgba(255,213,74,.12); }
.choice img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }

.progress-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.badge { padding: 6px 10px; border-radius: 999px; font-size: 13px; background: rgba(255,255,255,.12); }
.badge.done { background: rgba(74,222,128,.2); color: var(--ok); }

.phase-tag {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: rgba(255,93,162,.2); color: var(--accent2); font-weight: 700; font-size: 13px;
}

/* ===== Results presentation ===== */
#stage {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 24px; overflow: hidden;
}
.r-counter { position: fixed; top: 16px; left: 20px; color: var(--muted); font-size: 14px; }
.r-help { position: fixed; bottom: 16px; left: 0; right: 0; color: var(--muted); font-size: 14px; }
.r-question { font-size: clamp(28px, 5vw, 56px); font-weight: 800; max-width: 1000px; line-height: 1.15; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 40px; flex-wrap: wrap; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 6px;
        opacity: 0; transform: translateY(30px) scale(.9); transition: all .6s cubic-bezier(.2,.8,.3,1.2); }
.slot.show { opacity: 1; transform: translateY(0) scale(1); }
.slot .name { font-size: 22px; font-weight: 700; }
.slot .votes { font-size: 18px; color: var(--accent); font-weight: 700;
               opacity: 0; transform: scale(.4); transition: all .45s cubic-bezier(.2,.8,.3,1.4); }
.slot .votes.show { opacity: 1; transform: scale(1); }
.trophy { font-size: 54px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }

.slot.winner .trophy { font-size: 84px; animation: bob 2s ease-in-out infinite; }
.slot.winner .avatar { width: 240px; height: 240px; border: 5px solid var(--gold);
                       box-shadow: 0 0 40px rgba(255,215,0,.55); }
.slot.winner .name { font-size: 34px; }
.slot.winner .votes { font-size: 26px; }
.slot.silver .avatar { border: 4px solid var(--silver); box-shadow: 0 0 24px rgba(192,201,214,.4); }
.slot.bronze .avatar { border: 4px solid var(--bronze); box-shadow: 0 0 24px rgba(205,127,50,.4); }

@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.rest { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
        max-width: 900px; opacity: 0; transition: opacity .5s ease; }
.rest.show { opacity: 1; }
.rest .chip { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.28);
              border-radius: 999px; padding: 6px 14px 6px 6px; }
.rest .chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.rest .chip .n { color: var(--accent); font-weight: 700; }

/* confetti */
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; opacity: .9; z-index: 5;
            animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: 1; } }
