@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root{
  --bg1:#4527a0; --bg2:#7b2ff7; --card:#ffffff; --ink:#1c1330;
  --red:#ef476f; --blue:#118ab2; --yellow:#ffd166; --green:#06d6a0;
  --purple:#7b2ff7; --orange:#ff7a45;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
}
*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0; font-family:'Nunito',sans-serif; color:var(--ink);
  background: radial-gradient(circle at 20% 10%, #5b2fc9, #2c1466 60%);
  min-height:100vh; display:flex; flex-direction:column;
}
h1,h2,h3,.brand{ font-family:'Baloo 2', sans-serif; }
.brand{ color:#fff; font-weight:800; letter-spacing:.5px; text-shadow:0 3px 0 rgba(0,0,0,.15); }
.wrap{ max-width:920px; margin:0 auto; padding:24px; width:100%; flex:1; display:flex; flex-direction:column;}
.center{ display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; flex:1;}
.card{ background:var(--card); border-radius:20px; box-shadow:var(--shadow); padding:28px; }
input[type=text]{
  width:100%; padding:16px 18px; border-radius:14px; border:3px solid #e4defa;
  font-size:1.1rem; font-weight:700; text-align:center; outline:none; font-family:inherit;
}
input[type=text]:focus{ border-color:var(--purple); }
button{
  font-family:'Baloo 2', sans-serif; font-weight:700; font-size:1.05rem;
  border:none; border-radius:14px; padding:14px 22px; cursor:pointer;
  color:#fff; background:var(--purple); box-shadow:0 6px 0 #4c1fb0; transition:.08s transform;
}
button:active{ transform:translateY(4px); box-shadow:0 2px 0 #4c1fb0; }
button.secondary{ background:#f0edfb; color:var(--purple); box-shadow:0 6px 0 #d8d0f5; }
button.wide{ width:100%; }
button:disabled{ opacity:.5; cursor:not-allowed; }
.code-display{
  font-family:'Baloo 2',sans-serif; font-size:3.2rem; letter-spacing:.25em; font-weight:800;
  background:#fff; color:var(--purple); border-radius:16px; padding:14px 28px; box-shadow:var(--shadow);
}
.pill{ display:inline-block; padding:6px 14px; border-radius:999px; background:#f0edfb; color:var(--purple); font-weight:700; font-size:.85rem;}
.timerbar-track{ height:10px; background:#eee; border-radius:6px; overflow:hidden; margin:10px 0 20px;}
.timerbar-fill{ height:100%; background:linear-gradient(90deg,var(--green),var(--yellow),var(--red)); width:100%; transition:width .2s linear;}
.playerlist{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:18px;}
.chip{ background:#fff; border-radius:999px; padding:8px 16px; font-weight:800; box-shadow:0 4px 12px rgba(0,0,0,.15); display:flex; align-items:center; gap:8px;}
.dot{ width:10px; height:10px; border-radius:50%; }
.quiz-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:10px;}
@media (max-width:520px){ .quiz-grid{ grid-template-columns:1fr; } }
.quiz-opt{
  border-radius:16px; padding:22px 16px; font-size:1.05rem; font-weight:800; color:#fff;
  box-shadow:0 6px 0 rgba(0,0,0,.2); text-align:left; display:flex; align-items:center; gap:10px;
}
.opt-0{ background:var(--red); box-shadow:0 6px 0 #b02f4f;}
.opt-1{ background:var(--blue); box-shadow:0 6px 0 #0b6280;}
.opt-2{ background:var(--yellow); color:#4a3600; box-shadow:0 6px 0 #cf9f10;}
.opt-3{ background:var(--green); box-shadow:0 6px 0 #039470;}
.opt-shape{ font-size:1.3rem; }
.leaderboard{ list-style:none; padding:0; margin:16px 0 0; width:100%; max-width:520px;}
.leaderboard li{ display:flex; justify-content:space-between; background:#fff; border-radius:12px; padding:12px 18px; margin-bottom:8px; font-weight:800; box-shadow:0 3px 10px rgba(0,0,0,.1);}
.leaderboard li:nth-child(1){ background:linear-gradient(90deg,#fff6d8,#ffe9a8); }
.rank{ color:var(--purple); margin-right:10px;}
canvas{ background:#fff; border-radius:16px; touch-action:none; box-shadow:var(--shadow); }
.toolbar{ display:flex; gap:10px; margin-top:12px; justify-content:center; flex-wrap:wrap;}
.color-dot{ width:34px; height:34px; border-radius:50%; border:3px solid #fff; box-shadow:0 0 0 2px #ccc; cursor:pointer;}
.color-dot.active{ box-shadow:0 0 0 3px var(--purple);}
.muted{ color:#6b6383; font-weight:600;}
.badge-drawer{ background:var(--orange); color:#fff; padding:4px 12px; border-radius:999px; font-weight:800; font-size:.85rem;}
.footer-note{ color:rgba(255,255,255,.6); text-align:center; font-size:.8rem; padding:14px;}
.guessfeed{ max-height:180px; overflow-y:auto; width:100%; max-width:460px; margin-top:14px; text-align:left;}
.guessfeed div{ padding:6px 12px; border-radius:10px; background:#f5f2fd; margin-bottom:6px; font-weight:700;}
.guessfeed div.correct{ background:#d3f9ee; color:#037a5c;}
.vote-opt{ background:#fff; border-radius:14px; padding:16px; margin-bottom:10px; font-weight:700; box-shadow:0 4px 12px rgba(0,0,0,.15); text-align:left; cursor:pointer; border:3px solid transparent;}
.vote-opt.selected{ border-color:var(--purple); }
.vote-opt .bar{ height:8px; background:var(--purple); border-radius:6px; margin-top:8px; width:0%; transition:width .4s;}
