:root {
  --bg1: #fff0f6;
  --bg2: #ffe1ee;
  --card: #ffffff;
  --ink: #5b2a48;
  --muted: #a46b8c;
  --pink: #ff7eb6;
  --pink-d: #ef5d9f;
  --pink-l: #ffd3e6;
  --gold: #ffcf5c;
  --yes: #39c78f;
  --yes-l: #d8f7e9;
  --no: #ff6b8b;
  --no-l: #ffe0e7;
  --lav: #c9b6ff;
  --shadow: 0 10px 30px rgba(239, 93, 159, 0.18);
  --r: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: 'Mali', 'Itim', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #ffffffaa 0 8%, transparent 9%),
    radial-gradient(circle at 85% 25%, #ffd9ec 0 12%, transparent 13%),
    radial-gradient(circle at 70% 90%, #f0e4ff 0 15%, transparent 16%),
    linear-gradient(160deg, var(--bg1), var(--bg2) 60%, #f6e8ff);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: '✦  ♡  ✧  ✦  ♡  ✧  ✦  ♡  ✧';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  color: #ffb3d4; opacity: .35; font-size: 22px; letter-spacing: 46px; line-height: 120px;
  word-break: break-all; overflow: hidden;
}
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.wide { max-width: 1180px; }
.brand { text-align: center; margin: 8px 0 18px; }
.brand .crown { font-size: 40px; display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.brand h1 {
  margin: 4px 0 0; font-size: clamp(28px, 7vw, 40px); font-weight: 700;
  background: linear-gradient(90deg, #ef5d9f, #b67cff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { margin: 4px 0 0; color: var(--muted); }
.card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 22px; border: 3px solid #fff; outline: 2px dashed var(--pink-l); outline-offset: -10px;
}
.card + .card { margin-top: 16px; }
h2 { margin: 0 0 12px; font-size: 22px; }
.muted { color: var(--muted); }
.center { text-align: center; }
input[type=text], input[type=password], textarea {
  width: 100%; font: inherit; font-size: 22px; color: var(--ink); padding: 14px 18px; border-radius: 18px;
  border: 3px solid var(--pink-l); background: #fff8fb; outline: none; transition: border-color .2s;
}
input:focus, textarea:focus { border-color: var(--pink); }
input.code { text-align: center; letter-spacing: 2px; font-size: 28px; font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; border: 0; color: #fff;
  padding: 14px 26px; border-radius: 999px; background: linear-gradient(180deg, var(--pink), var(--pink-d));
  box-shadow: 0 6px 0 #d2468a, 0 10px 20px rgba(239,93,159,.3); transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #d2468a; }
.btn:disabled { filter: grayscale(.7) opacity(.55); cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.ghost { background: #fff; color: var(--pink-d); box-shadow: 0 4px 0 var(--pink-l); border: 2px solid var(--pink-l); }
.btn.lav { background: linear-gradient(180deg, #c9b6ff, #a68bf0); box-shadow: 0 6px 0 #8a6fd8; }
.btn.small { font-size: 15px; padding: 8px 14px; }
.err { color: #e23b66; min-height: 1.4em; margin-top: 8px; text-align: center; }

/* character picker */
.grid-chars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.char {
  position: relative; border: 3px solid transparent; border-radius: 20px; background: #fff8fb; padding: 6px 4px 4px;
  cursor: pointer; text-align: center; font: inherit; color: var(--ink); transition: transform .15s, border-color .15s;
}
.char svg, .char .avatar-img { width: 100%; aspect-ratio: 1; display: block; border-radius: 50%; }
.char span { font-size: 13px; display: block; margin-top: 2px; }
.char:hover:not(:disabled) { transform: translateY(-3px); }
.char.sel { border-color: var(--pink); background: var(--pink-l); transform: scale(1.04); }
.char:disabled { opacity: .35; cursor: not-allowed; }
.char:disabled::after { content: '🔒'; position: absolute; top: 4px; right: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 17px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--pink-l); background: #fff; color: var(--ink); transition: all .15s;
}
.chip.sel { background: var(--pink); border-color: var(--pink); color: #fff; }
.chip:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }

.avatar-lg { width: 140px; height: 140px; margin: 0 auto; filter: drop-shadow(0 8px 16px rgba(239,93,159,.25)); }
.avatar-lg svg, .avatar-lg img { width: 100%; height: 100%; border-radius: 50%; }
.me-name { font-size: 26px; font-weight: 700; margin: 10px 0 0; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--pink-l); color: var(--pink-d); font-weight: 700; }

/* players strip */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.pl { text-align: center; position: relative; animation: pop .35s ease; }
.pl .av { width: 64px; height: 64px; margin: 0 auto; }
.pl .av svg, .pl .av img { width: 100%; height: 100%; border-radius: 50%; }
.pl .nm { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl.off { opacity: .4; }
.pl.done .av { outline: 4px solid var(--gold); border-radius: 50%; }
.pl .x { position: absolute; top: -4px; right: 4px; border: 0; background: #fff; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; box-shadow: 0 2px 6px #0002; color: #e23b66; }

/* question */
.qnum { display: inline-block; background: linear-gradient(90deg, #ff9cc8, #c9b6ff); color: #fff; padding: 4px 14px; border-radius: 999px; font-weight: 700; }
.qtext { font-size: clamp(22px, 5.5vw, 30px); font-weight: 700; line-height: 1.35; margin: 14px 0 6px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.ans {
  font: inherit; font-weight: 700; font-size: clamp(26px, 8vw, 40px); border: 0; cursor: pointer; color: #fff;
  border-radius: 28px; padding: 30px 10px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .1s, filter .2s, box-shadow .1s;
}
.ans small { font-size: 16px; opacity: .9; }
.ans.yes { background: linear-gradient(180deg, #5fdcaa, var(--yes)); box-shadow: 0 8px 0 #2a9e70; }
.ans.no { background: linear-gradient(180deg, #ff8fa6, var(--no)); box-shadow: 0 8px 0 #d8476a; }
.ans:active { transform: translateY(5px); }
.ans.dim { filter: grayscale(.6) opacity(.45); }
.ans.picked { outline: 5px solid #fff; outline-offset: -11px; animation: pulse 1.2s ease-in-out infinite; }
.result { font-size: 64px; animation: pop .4s ease; }
.result-txt { font-size: 28px; font-weight: 700; }
.ans-pill { display: inline-block; padding: 10px 28px; border-radius: 999px; font-size: 30px; font-weight: 700; color: #fff; }
.ans-pill.yes { background: var(--yes); } .ans-pill.no { background: var(--no); }

/* leaderboard */
.lb { list-style: none; margin: 0; padding: 0; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; }
.lb li:nth-child(odd) { background: #fff6fa; }
.lb li.me { background: var(--pink-l); }
.lb .rk { width: 32px; text-align: center; font-weight: 700; font-size: 20px; }
.lb .av { width: 44px; height: 44px; flex: none; }
.lb .av svg, .lb .av img { width: 100%; height: 100%; border-radius: 50%; }
.lb .nm { flex: 1; font-weight: 700; }
.lb .sc { font-weight: 700; color: var(--pink-d); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 10px 0 20px; }
.podium .p { text-align: center; width: 30%; max-width: 150px; }
.podium .p .av { width: 76%; margin: 0 auto; }
.podium .p .av svg, .podium .p .av img { width: 100%; border-radius: 50%; display: block; }
.podium .block { border-radius: 16px 16px 6px 6px; color: #fff; font-weight: 700; font-size: 28px; padding-top: 8px; }
.podium .p1 .block { height: 130px; background: linear-gradient(180deg, #ffd96b, #f5b81c); }
.podium .p2 .block { height: 95px; background: linear-gradient(180deg, #ffc3dd, #ff8fbf); }
.podium .p3 .block { height: 70px; background: linear-gradient(180deg, #dccfff, #b49cf5); }
.podium .p .nm { font-weight: 700; font-size: 15px; margin: 4px 0; }

/* admin */
.admin-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.joinbox { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.joinbox .code-big { font-size: clamp(40px, 8vw, 64px); font-weight: 700; letter-spacing: 8px; color: var(--pink-d); line-height: 1; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.split .col { border-radius: 20px; padding: 12px; min-height: 120px; }
.split .col.yes { background: var(--yes-l); } .split .col.no { background: var(--no-l); }
.split .col h3 { margin: 0 0 8px; display: flex; justify-content: space-between; }
.split .col.win { outline: 4px solid var(--gold); }
.split .col.lose { opacity: .55; }
.progress { height: 14px; border-radius: 999px; background: var(--pink-l); overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--pink), #b67cff); transition: width .3s; }
.qedit { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.qedit input { font-size: 16px; padding: 10px 12px; }
.toggle { display: flex; border-radius: 999px; overflow: hidden; border: 2px solid var(--pink-l); }
.toggle button { font: inherit; border: 0; padding: 8px 12px; cursor: pointer; background: #fff; color: var(--muted); font-weight: 700; }
.toggle button.on.yes { background: var(--yes); color: #fff; } .toggle button.on.no { background: var(--no); color: #fff; }
textarea { font-size: 16px; min-height: 90px; }
.ansKey { font-size: 14px; }
details summary { cursor: pointer; font-weight: 700; font-size: 18px; }

.hidden { display: none !important; }
.fade { animation: fade .35s ease; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 10; }
.confetti { position: fixed; top: -40px; z-index: 50; pointer-events: none; animation: fall linear forwards; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }

@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (max-width: 420px) { .grid-chars { grid-template-columns: repeat(3, 1fr); } .ans { min-height: 120px; } }

/* ---------- scoreboard (admin) ---------- */
.sb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sb li {
  display: grid; grid-template-columns: 52px 56px 1fr auto; align-items: center; gap: 12px;
  background: #fff8fb; border-radius: 20px; padding: 8px 14px; border: 2px solid transparent; position: relative;
}
.sb li.r1 { background: linear-gradient(90deg, #fff4c9, #fff8fb 70%); border-color: #ffd45c; }
.sb li.r2 { background: linear-gradient(90deg, #ffe3f0, #fff8fb 70%); border-color: #ffb3d4; }
.sb li.r3 { background: linear-gradient(90deg, #efe7ff, #fff8fb 70%); border-color: #d6c7ff; }
.sb .rk { font-size: 26px; font-weight: 700; text-align: center; }
.sb .av { width: 56px; height: 56px; }
.sb .av svg, .sb .av img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.sb .mid { min-width: 0; }
.sb .nm { font-weight: 700; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb .bar { height: 10px; border-radius: 999px; background: var(--pink-l); margin-top: 6px; overflow: hidden; }
.sb .bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pink), #b67cff); transition: width .6s ease; }
.sb .sc { font-size: 26px; font-weight: 700; color: var(--pink-d); text-align: right; min-width: 70px; }
.sb .mv { font-size: 13px; font-weight: 700; display: block; text-align: right; }
.sb .mv.up { color: #2a9e70; } .sb .mv.down { color: #e23b66; } .sb .mv.same { color: var(--muted); }
.sb .tick { position: absolute; left: -6px; top: -6px; background: var(--gold); color: #fff; border-radius: 50%; width: 22px; height: 22px; font-size: 13px; display: grid; place-items: center; box-shadow: 0 2px 6px #0002; }
.sb li.ok { box-shadow: 0 0 0 3px var(--yes) inset; }
.sb li.bad { opacity: .75; }
.sb .gain { color: #2a9e70; font-size: 14px; font-weight: 700; animation: pop .5s ease; }
.sb li.off { opacity: .45; }
.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.verdict .ans { min-height: 110px; font-size: clamp(22px, 3vw, 30px); }
.btn.end { background: linear-gradient(180deg, #ffd96b, #f5b81c); box-shadow: 0 6px 0 #c98f0a; color: #5b2a48; }
.roundtag { font-size: 18px; }
.sticky { position: sticky; top: 16px; }
.mini-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mini-split .col { border-radius: 16px; padding: 10px; text-align: center; }
.mini-split .col.yes { background: var(--yes-l); } .mini-split .col.no { background: var(--no-l); }
.mini-split .col.win { outline: 4px solid var(--gold); }
.mini-split .n { font-size: 34px; font-weight: 700; }
.mini-split .avs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 6px; }
.mini-split .avs span { width: 30px; height: 30px; }
.mini-split .avs svg, .mini-split .avs img { width: 100%; height: 100%; border-radius: 50%; }

/* ---------- winner hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 32px; padding: 30px 16px 26px; text-align: center;
  background: radial-gradient(circle at 50% 40%, #fff7d6, #ffd6ea 55%, #e6d9ff); box-shadow: var(--shadow); border: 4px solid #fff; }
.hero .rays { position: absolute; left: 50%; top: 42%; width: 1400px; height: 1400px; margin: -700px 0 0 -700px; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, #ffffff88 0deg 8deg, transparent 8deg 22deg); animation: spin 30s linear infinite; }
.hero-in { position: relative; }
.hero-title { display: inline-block; font-size: clamp(30px, 6vw, 52px); font-weight: 700; color: #fff; padding: 2px 28px; border-radius: 999px;
  background: linear-gradient(90deg, #ff7eb6, #b67cff); box-shadow: 0 6px 0 #d2468a; letter-spacing: 2px; animation: pop .6s ease; }
.hero-avs { display: flex; justify-content: center; gap: 18px; margin-top: clamp(64px, 12vw, 96px); flex-wrap: wrap; }
.hero-av { position: relative; width: clamp(140px, 28vw, 220px); aspect-ratio: 1; animation: pop .8s ease .2s both, bob 3s ease-in-out 1s infinite; }
.hero-av svg, .hero-av img { width: 100%; height: 100%; border-radius: 50%; border: 8px solid #fff; box-shadow: 0 0 0 6px #ffd45c, 0 20px 40px rgba(239,93,159,.35); }
.hero-crown { position: absolute; top: -34%; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: clamp(60px, 11vw, 96px); filter: drop-shadow(0 6px 8px #0002); }
.ribbon { margin: 26px auto 0; display: inline-block; position: relative; padding: 10px 40px; background: #ef5d9f; color: #fff;
  font-size: clamp(26px, 5vw, 42px); font-weight: 700; border-radius: 6px; box-shadow: 0 6px 0 #c23d7d; animation: pop .6s ease .5s both; }
.ribbon::before, .ribbon::after { content: ''; position: absolute; top: 12px; border: 24px solid #d2468a; z-index: -1; }
.ribbon::before { left: -30px; border-left-color: transparent; }
.ribbon::after { right: -30px; border-right-color: transparent; }
.hero-score { margin-top: 16px; font-size: 20px; font-weight: 700; color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flipIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- player verdict ---------- */
.verdict-card { border-radius: 32px; padding: 26px 18px 30px; text-align: center; color: #fff; border: 4px solid #fff; box-shadow: var(--shadow); animation: pop .45s ease; }
.verdict-card.good { background: radial-gradient(circle at 50% 30%, #7fe8bd, #2fb67f); }
.verdict-card.bad { background: radial-gradient(circle at 50% 30%, #ff9fb2, #ec4f72); animation: pop .45s ease, shake .5s ease .45s; }
.verdict-card.skip { background: radial-gradient(circle at 50% 30%, #d9cdf7, #a99bd6); }
.verdict-card .qnum { background: #ffffff40; }
.v-emoji { font-size: 96px; line-height: 1.1; margin-top: 10px; }
.v-title { font-size: clamp(44px, 13vw, 64px); font-weight: 700; text-shadow: 0 4px 0 #0002; }
.v-sub { font-size: 20px; font-weight: 700; margin-top: 2px; }
.v-ans { margin-top: 16px; background: #ffffff33; display: inline-block; padding: 8px 16px; border-radius: 999px; font-size: 16px; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
