* { box-sizing: border-box; }
:root {
  --bg: #120b2e;
  --card: #1f1650;
  --card2: #2a1f6b;
  --text: #f4f1ff;
  --muted: #a99fd6;
  --accent: #ff4fa3;
  --accent2: #ffd23f;
  --good: #3ddc97;
  --bad: #ff5d5d;
  --radius: 18px;
}
html, body { margin: 0; }
html { background: var(--bg); }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 20% 0%, #3b1f8f 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
}
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.hidden-el { display: none !important; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 8px 30px #0005; }
.logo { font-size: 30px; font-weight: 900; text-align: center; margin: 10px 0 24px; }
.logo span { color: var(--accent); }

label { display: block; font-weight: 700; margin: 14px 0 6px; }
input[type=text], input[type=number] {
  width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--card2);
  background: #140d38; color: var(--text); font-size: 17px; outline: none;
}
input:focus { border-color: var(--accent); }
.prefix-input { display: flex; align-items: center; gap: 8px; }
.prefix-input span { white-space: nowrap; color: var(--muted); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin-top: 14px; }
.check input { width: 22px; height: 22px; }

button {
  font: inherit; font-weight: 800; cursor: pointer; border: none; border-radius: 14px;
  padding: 14px 18px; background: var(--accent); color: white; font-size: 17px;
  transition: transform .08s, opacity .2s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--card2); }
button.ghost { background: transparent; color: var(--muted); font-weight: 600; padding: 8px; }
button.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
button.good { background: var(--good); color: #062; }
button.bad { background: var(--bad); }
.full { width: 100%; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-picker button { background: var(--card2); font-size: 24px; padding: 6px 8px; border: 2px solid transparent; }
.emoji-picker button.sel { border-color: var(--accent2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--card2); color: var(--text); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; }
.error-msg { color: var(--bad); font-weight: 700; margin-top: 10px; min-height: 1em; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-weight: 700; }
.pill { background: var(--card2); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.notice { background: var(--accent2); color: #2a1f00; font-weight: 700; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.secret { background: linear-gradient(90deg, var(--accent), #8b5cf6); padding: 12px 14px; border-radius: 12px; font-weight: 800; margin-bottom: 16px; text-align: center; }

.question { font-size: 26px; font-weight: 900; text-align: center; margin: 6px 0 18px; }
.round-no { text-align: center; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.step-title { font-weight: 800; margin: 16px 0 8px; }
.step-title small { color: var(--muted); font-weight: 600; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pick-grid button { background: var(--card2); font-size: 15px; padding: 12px 8px; border: 3px solid transparent; }
.pick-grid button .e { display: block; font-size: 26px; }
.pick-grid button.sel { border-color: var(--accent2); background: #4a2fa8; }
.waiting { text-align: center; font-size: 20px; padding: 26px 0; }
.waiting .big { font-size: 54px; display: block; margin-bottom: 8px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

.qlist { list-style: none; padding: 0; margin: 0; }
.qlist li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--card2); }
.qlist li:last-child { border-bottom: none; }
.badge { font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 999px; white-space: nowrap; background: var(--card2); }
.badge.approved { background: var(--good); color: #052; }
.badge.used { background: var(--accent2); color: #2a1f00; }
.badge.rejected, .badge.removed { background: var(--bad); }

.leaderboard { list-style: none; padding: 0; margin: 0; }
.leaderboard li { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.leaderboard li:nth-child(odd) { background: #ffffff08; }
.leaderboard li.me { outline: 2px solid var(--accent2); }
.leaderboard li span:nth-child(2) { flex: 1; }
.leaderboard .rank { width: 24px; color: var(--muted); font-weight: 800; }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; min-height: 280px; margin: 10px 0; }
.podium-col { flex: 1; max-width: 220px; display: flex; flex-direction: column; align-items: stretch; transition: opacity .5s, transform .6s cubic-bezier(.2, 1.6, .4, 1); }
.podium-col.hidden { opacity: 0; transform: translateY(40px) scale(.9); }
.podium-col.empty { visibility: hidden; }
.podium-names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.podium-person { text-align: center; }
.podium-emoji { font-size: 40px; }
.podium-name { font-weight: 900; font-size: 18px; word-break: break-word; }
.podium-votes { color: var(--muted); font-size: 13px; font-weight: 600; }
.podium-block { border-radius: 12px 12px 0 0; display: flex; justify-content: center; padding-top: 10px; font-size: 34px; }
.place-1 .podium-block { height: 150px; background: linear-gradient(#ffd23f, #e0a800); }
.place-2 .podium-block { height: 110px; background: linear-gradient(#d9dde8, #9aa3b5); }
.place-3 .podium-block { height: 80px; background: linear-gradient(#e59a5c, #b4652a); }
.podium-empty { text-align: center; font-size: 22px; padding: 40px 0; }
.points { text-align: center; font-size: 20px; font-weight: 800; margin-top: 10px; }

.confetti { position: fixed; top: -40px; pointer-events: none; z-index: 99; animation: fall 3s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--good); color: #052; font-weight: 800; padding: 12px 18px; border-radius: 12px; transition: .3s; z-index: 100; max-width: 90vw; text-align: center; }
.toast.error { background: var(--bad); color: white; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* host screen */
.host { display: flex; min-height: 100vh; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.stage .question { font-size: clamp(32px, 4.5vw, 64px); max-width: 1100px; }
.stage .podium { min-height: 380px; width: min(900px, 100%); }
.stage .podium-emoji { font-size: 64px; }
.stage .podium-name { font-size: 28px; }
.stage .podium-votes { font-size: 18px; }
.stage .place-1 .podium-block { height: 220px; font-size: 54px; }
.stage .place-2 .podium-block { height: 160px; font-size: 54px; }
.stage .place-3 .podium-block { height: 110px; font-size: 54px; }
.join-box { font-size: clamp(20px, 2.5vw, 32px); }
.join-code { font-size: clamp(60px, 10vw, 140px); font-weight: 900; letter-spacing: .12em; color: var(--accent2); line-height: 1; margin: 10px 0; }
.player-cloud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px; max-width: 1000px; }
.player-cloud span { background: var(--card); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 20px; animation: pop .4s; }
@keyframes pop { from { transform: scale(0); } }
.progress { width: min(600px, 90%); height: 18px; background: var(--card); border-radius: 999px; overflow: hidden; margin: 20px auto 8px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.vote-count { font-size: 24px; font-weight: 800; }
.stage-board { width: min(500px, 100%); margin-top: 24px; text-align: left; }

.panel { width: 380px; background: #0c0724; padding: 18px; overflow-y: auto; max-height: 100vh; position: sticky; top: 0; }
.panel h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 22px; }
.panel .qlist li { font-size: 14px; }
.blur { filter: blur(6px); cursor: pointer; user-select: none; }
.panel-toggle { position: fixed; top: 12px; right: 12px; z-index: 10; }
.host.panel-hidden .panel { display: none; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.qactions { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 900px) {
  .host { flex-direction: column; }
  .panel { width: 100%; max-height: none; position: static; }
}

.lang-toggle { position: fixed; top: 12px; left: 12px; z-index: 20; }
.wrap { padding-top: 60px; }
