:root {
  --purple: #2b0a4e;
  --purple2: #4a1072;
  --pink: #ff3d8b;
  --cyan: #22d3ee;
  --gold: #ffc82e;
  --gold2: #ffe27a;
  --lime: #7ee83c;
  --navy: #1b1140;
  --white: #ffffff;
  --red: #ff4757;
  --blue: #2f9bff;
  --orange: #ff9430;
  --green: #2ed573;
  --violet: #a55eff;
  --teal: #12cdbc;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Verdana, Arial, sans-serif;
  background: linear-gradient(160deg, var(--purple2) 0%, var(--purple) 45%, #160639 100%);
  color: var(--white);
  min-height: 100vh;
  padding: 16px;
  overflow-x: hidden;
}

/* drifting color blobs behind everything */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 420px; height: 420px;
  background: var(--pink);
  top: -120px; left: -120px;
  animation: drift1 14s ease-in-out infinite alternate;
}
body::after {
  width: 380px; height: 380px;
  background: var(--cyan);
  bottom: -140px; right: -100px;
  animation: drift2 17s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(70px, 50px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-60px, -60px) scale(1.2); } }

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

.wrap { max-width: 640px; margin: 0 auto; position: relative; z-index: 2; }
.center { text-align: center; }
.logo { display: block; margin: 10px auto 2px; max-width: 320px; filter: drop-shadow(0 4px 0 rgba(0,0,0,0.3)); animation: logobob 3s ease-in-out infinite; }
@keyframes logobob { 0%,100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.04); } }
.tagline {
  color: var(--gold2);
  text-align: center;
  margin-bottom: 22px;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

.card {
  background: rgba(27, 17, 64, 0.82);
  border: 3px solid var(--cyan);
  border-radius: 26px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.35), 0 0 30px rgba(34,211,238,0.15);
}
.card.pink { border-color: var(--pink); box-shadow: 0 8px 0 rgba(0,0,0,0.35), 0 0 30px rgba(255,61,139,0.2); }

h1, h2 {
  font-family: "Arial Black", Verdana, sans-serif;
  letter-spacing: 0.5px;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.4);
  transform: rotate(-1deg);
}
h1 { font-size: 36px; margin-bottom: 12px; color: var(--gold); }
h2 { font-size: 26px; margin-bottom: 10px; color: var(--gold2); }
h3 { font-size: 18px; margin-bottom: 8px; color: var(--cyan); }
p { margin-bottom: 10px; line-height: 1.45; font-size: 17px; }
.muted { color: #c3b3ec; font-size: 14px; }

.btn {
  display: block;
  width: 100%;
  padding: 18px;
  font-size: 20px;
  font-family: "Arial Black", Verdana, sans-serif;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  color: var(--navy);
  margin-top: 12px;
  box-shadow: 0 6px 0 #b8860b, 0 10px 14px rgba(0,0,0,0.35);
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.15s;
}
.btn:hover { transform: scale(1.03) rotate(-0.5deg); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #b8860b; }
.btn.secondary {
  background: linear-gradient(180deg, #ff6fae, var(--pink));
  color: #fff;
  box-shadow: 0 6px 0 #b81e5b, 0 10px 14px rgba(0,0,0,0.35);
}
.btn.secondary:active { box-shadow: 0 1px 0 #b81e5b; }
.btn.small { padding: 12px 18px; font-size: 15px; width: auto; display: inline-block; margin: 6px 8px 0 0; }
.btn.danger { background: linear-gradient(180deg, #ff8a95, var(--red)); color: #fff; box-shadow: 0 6px 0 #a01e28, 0 10px 14px rgba(0,0,0,0.35); }
.btn.danger:active { box-shadow: 0 1px 0 #a01e28; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 16px;
  border: 3px solid var(--violet);
  background: rgba(0,0,0,0.35);
  color: #fff;
  margin-top: 8px;
  outline: none;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 14px rgba(34,211,238,0.45); }
label { display: block; margin-top: 12px; font-size: 14px; font-weight: bold; color: var(--cyan); }

.bigcode {
  font-family: "Arial Black", Verdana, sans-serif;
  font-size: 58px;
  letter-spacing: 12px;
  color: var(--gold);
  text-align: center;
  margin: 14px 0;
  text-shadow: 4px 4px 0 rgba(0,0,0,0.45);
  animation: codepulse 1.6s ease-in-out infinite;
}
@keyframes codepulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.error { color: #ff9aa4; margin-top: 10px; font-size: 15px; min-height: 20px; font-weight: bold; }

.pill {
  display: inline-block;
  background: linear-gradient(180deg, var(--violet), #7c3aed);
  border: 2px solid #d6bcff;
  border-radius: 999px;
  padding: 8px 18px;
  margin: 5px;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 3px 0 rgba(0,0,0,0.35);
  animation: pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

.timerbar {
  height: 18px;
  background: rgba(0,0,0,0.4);
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0;
  border: 2px solid rgba(255,255,255,0.25);
}
.timerbar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--gold), var(--pink));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 999px;
  transition: width 0.3s linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.answer-btn {
  padding: 22px 12px;
  font-size: 19px;
  font-family: "Arial Black", Verdana, sans-serif;
  border: none;
  border-radius: 20px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  cursor: pointer;
  min-height: 78px;
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  transition: transform 0.12s;
}
.answer-btn:nth-child(1) { background: linear-gradient(180deg,#ff7b88,var(--red)); box-shadow: 0 5px 0 #a01e28; animation-delay: 0.02s; }
.answer-btn:nth-child(2) { background: linear-gradient(180deg,#66baff,var(--blue)); box-shadow: 0 5px 0 #0b5cad; animation-delay: 0.08s; }
.answer-btn:nth-child(3) { background: linear-gradient(180deg,#ffbb70,var(--orange)); box-shadow: 0 5px 0 #b35c00; animation-delay: 0.14s; }
.answer-btn:nth-child(4) { background: linear-gradient(180deg,#63e896,var(--green)); box-shadow: 0 5px 0 #137a3e; animation-delay: 0.20s; }
.answer-btn:nth-child(5) { background: linear-gradient(180deg,#c89bff,var(--violet)); box-shadow: 0 5px 0 #5e2da8; animation-delay: 0.26s; }
.answer-btn:nth-child(6) { background: linear-gradient(180deg,#4fe8d9,var(--teal)); box-shadow: 0 5px 0 #08786f; animation-delay: 0.32s; }
.answer-btn:hover { transform: scale(1.05) rotate(1deg); }
.answer-btn:active { transform: translateY(4px); }
.answer-btn:disabled { opacity: 0.6; }
.answer-btn.picked { outline: 5px solid #fff; transform: scale(1.05); }
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.answer-tile {
  padding: 18px 14px;
  border-radius: 18px;
  font-size: 19px;
  font-weight: bold;
  background: rgba(255,255,255,0.1);
  border: 3px solid rgba(255,255,255,0.3);
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.answer-tile.correct {
  background: linear-gradient(180deg,#63e896,var(--green));
  border-color: #baffd4;
  box-shadow: 0 0 24px rgba(46,213,115,0.6);
}

.boardrow {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 16px;
  margin-top: 8px;
  background: rgba(255,255,255,0.92);
  color: var(--navy);
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
  animation: slidein 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.boardrow:nth-child(2) { animation-delay: 0.08s; }
.boardrow:nth-child(3) { animation-delay: 0.16s; }
.boardrow:nth-child(4) { animation-delay: 0.24s; }
.boardrow:nth-child(5) { animation-delay: 0.32s; }
@keyframes slidein { 0% { transform: translateX(-40px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
.boardrow.me { outline: 4px solid var(--pink); }
.boardrow.top1 { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: var(--navy); transform-origin: left; }

.qtext {
  font-family: "Arial Black", Verdana, sans-serif;
  font-size: 28px;
  line-height: 1.4;
  margin: 12px 0;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.4);
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

.hidden { display: none !important; }
a { color: var(--gold2); font-weight: bold; }

.qedit {
  border: 3px dashed var(--violet);
  border-radius: 18px;
  padding: 14px;
  margin-top: 14px;
  background: rgba(0,0,0,0.25);
}
.qedit .row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qedit .row input[type="text"] { margin-top: 0; flex: 1; }
.correct-radio { transform: scale(1.8); accent-color: var(--lime); }
.smallnote { font-size: 13px; color: #c3b3ec; margin-top: 4px; }

.trophy { font-size: 56px; display: block; animation: trophyspin 1.6s ease-in-out infinite; }
@keyframes trophyspin { 0%,100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.15); } }

@media (min-width: 900px) {
  .wrap.screen { max-width: 1100px; }
  .wrap.screen .qtext { font-size: 48px; }
  .wrap.screen .bigcode { font-size: 100px; }
  .wrap.screen .boardrow { font-size: 30px; padding: 16px 22px; }
  .wrap.screen .pill { font-size: 26px; padding: 12px 26px; }
  .wrap.screen .answer-tile { font-size: 28px; padding: 24px; }
  .wrap.screen h1 { font-size: 42px; }
}

/* Vote breakdown on the big screen ("who picked what") */
.votegrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
  text-align: left;
}
.voteopt {
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
  border: 3px solid transparent;
}
.voteopt.correct {
  border-color: #7ee83c;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 0 22px rgba(126,232,60,0.45);
}
.votehead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--navy);
  font-weight: bold;
  font-size: 19px;
}
.votecount {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 17px;
  flex-shrink: 0;
}
.voteopt.correct .votecount { background: #2f9e1e; }
.votenames { margin-top: 8px; line-height: 2; }
.namechip {
  display: inline-block;
  background: #e8e4ff;
  color: var(--navy);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  font-size: 14px;
  font-weight: bold;
}
.namechip.right { background: #d6ffc0; color: #1d6b10; }

/* Leaderboard with many players: two compact columns */
#s-boardlist.many, #s-endlist.many {
  columns: 2;
  column-gap: 12px;
}
#s-boardlist.many .boardrow, #s-endlist.many .boardrow {
  break-inside: avoid;
  font-size: 15px;
  padding: 8px 12px;
  margin-top: 6px;
}
@media (min-width: 900px) {
  .votegrid { gap: 14px; }
}
