/* Neon party theme, mobile-first. */
:root {
  --bg: #0a0614;
  --ink: #f4f0ff; --muted: #a79fc4;
  --pink: #ff2e88; --cyan: #22e4ff; --violet: #9b5cff; --lime: #b6ff3b; --gold: #ffd23f; --red: #ff4d5e;
  --glass: rgba(255, 255, 255, .06); --line: rgba(255, 255, 255, .13);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); min-height: 100dvh; overflow-x: hidden;
}
/* slowly drifting neon blobs behind everything */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(90px); opacity: .35; pointer-events: none;
}
body::before { background: var(--pink); top: -30vmax; left: -25vmax; animation: drift 18s ease-in-out infinite alternate; }
body::after { background: var(--violet); bottom: -35vmax; right: -30vmax; animation: drift 22s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(12vmax, 8vmax) scale(1.15); } }

main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(28px + var(--safe-b)); }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ---------- headings ---------- */
.logo { display: block; text-align: center; text-decoration: none; margin: 8px 0 18px; line-height: 1.05; }
.logo b { display: block; font-size: clamp(30px, 10vw, 44px); font-weight: 900; letter-spacing: 1px; }
.logo .t { color: var(--cyan); text-shadow: 0 0 8px var(--cyan), 0 0 24px rgba(34, 228, 255, .6); }
.logo .d { color: var(--pink); text-shadow: 0 0 8px var(--pink), 0 0 24px rgba(255, 46, 136, .6); animation: flicker 4s infinite; }
.logo i { font-style: normal; font-size: 15px; color: var(--muted); letter-spacing: 3px; }
.logo.small b { font-size: 24px; display: inline; }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: .45; } 98% { opacity: .7; } }
h2 { margin: 0 0 12px; font-size: 18px; }

/* ---------- panels ---------- */
.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: rise .35s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; font-weight: 700; border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; min-height: 48px;
  cursor: pointer; background: rgba(255, 255, 255, .08); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  transition: transform .12s, box-shadow .2s, opacity .2s; touch-action: manipulation; user-select: none;
}
button:active:not(:disabled), .btn:active { transform: scale(.96); }
button:disabled { opacity: .35; cursor: not-allowed; }
.btn-main { background: linear-gradient(135deg, var(--violet), var(--pink)); border: 0; box-shadow: 0 6px 24px rgba(255, 46, 136, .35); }
.btn-big { width: 100%; font-size: 19px; padding: 16px; min-height: 60px; margin-top: 10px; }
.btn-ok { background: linear-gradient(135deg, #18d38b, var(--lime)); color: #08130a; border: 0; box-shadow: 0 6px 24px rgba(182, 255, 59, .3); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn-danger { color: #ffb3bd; border-color: rgba(255, 77, 94, .4); background: rgba(255, 77, 94, .1); }
.btn-ghost { background: transparent; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 46, 136, 0), 0 0 32px rgba(255, 46, 136, .55); } }

/* the two big choice tiles */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  flex-direction: column; min-height: 150px; border-radius: 24px; font-size: 20px; border: 2px solid; gap: 8px;
  animation: rise .35s ease-out both;
}
.choice span { font-size: 44px; line-height: 1; }
.choice.truth { border-color: var(--cyan); background: rgba(34, 228, 255, .1); color: var(--cyan); box-shadow: 0 0 22px rgba(34, 228, 255, .35), inset 0 0 22px rgba(34, 228, 255, .15); }
.choice.dare { border-color: var(--pink); background: rgba(255, 46, 136, .1); color: var(--pink); box-shadow: 0 0 22px rgba(255, 46, 136, .35), inset 0 0 22px rgba(255, 46, 136, .15); animation-delay: .08s; }

/* ---------- form fields (16px avoids iOS zoom) ---------- */
input[type=text], input[type=password], select, textarea {
  font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; border-radius: 14px; min-height: 48px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--ink);
}
select option { background: #1a1230; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 228, 255, .2); }
::placeholder { color: #776f94; }
label.lbl { display: block; font-weight: 700; margin: 14px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; min-height: 40px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-weight: 700; cursor: pointer; user-select: none;
  transition: all .18s;
}
.chip input { display: none; }
.chip.on { background: rgba(155, 92, 255, .25); border-color: var(--violet); box-shadow: 0 0 14px rgba(155, 92, 255, .45); }
.chip .x { min-height: 0; padding: 0 0 0 4px; border: 0; background: none; font-size: 18px; color: var(--muted); }
.chip-pop { animation: chipPop .3s ease-out; }
@keyframes chipPop { from { transform: scale(.6); opacity: 0; } }

/* ---------- turn banner ---------- */
.turn { text-align: center; font-size: 20px; margin: 8px 0 16px; animation: slideIn .35s ease-out; }
.turn b { color: var(--gold); text-shadow: 0 0 12px rgba(255, 210, 63, .7); font-size: 26px; display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } }

/* ---------- flipping card ---------- */
.flip { perspective: 1200px; }
.qcard {
  position: relative; min-height: 260px; border-radius: 26px; transform-style: preserve-3d;
  animation: flipIn .7s cubic-bezier(.2, .8, .3, 1.2) both;
}
@keyframes flipIn { from { transform: rotateY(-180deg) scale(.85); } to { transform: rotateY(0) scale(1); } }
.qcard .face {
  position: absolute; inset: 0; border-radius: 26px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 26px 20px; text-align: center;
}
.qcard .front { position: relative; min-height: 260px; background: linear-gradient(160deg, #1d1236, #120a22); border: 2px solid; } /* front sets the height for long text */
.qcard .back { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #2a1650 0 14px, #1d1038 14px 28px); border: 2px solid var(--violet); font-size: 64px; }
.qcard.truth .front { border-color: var(--cyan); box-shadow: 0 0 30px rgba(34, 228, 255, .45), inset 0 0 30px rgba(34, 228, 255, .12); }
.qcard.dare .front { border-color: var(--pink); box-shadow: 0 0 30px rgba(255, 46, 136, .45), inset 0 0 30px rgba(255, 46, 136, .12); }
.qcard .tag { padding: 6px 16px; border-radius: 999px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; color: #0a0614; }
.qcard.truth .tag { background: var(--cyan); }
.qcard.dare .tag { background: var(--pink); color: #fff; }
.qcard .text { font-size: clamp(20px, 6vw, 26px); font-weight: 800; line-height: 1.35; }
.qcard .meta { color: var(--muted); font-size: 13px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.two .btn-big { margin-top: 0; }

/* ---------- room ---------- */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.code-chip { font-size: 22px; letter-spacing: 5px; font-weight: 900; color: var(--cyan); text-shadow: 0 0 10px rgba(34, 228, 255, .7);
  padding: 6px 14px; border-radius: 14px; border: 1px dashed rgba(34, 228, 255, .5); background: rgba(34, 228, 255, .07); min-height: 48px; }
.players { display: flex; gap: 10px; overflow-x: auto; padding: 14px 10px 12px; margin: -8px -10px 6px; scrollbar-width: none; } /* padding leaves room for crown + glow */
.players::-webkit-scrollbar { display: none; }
.pl { flex: 0 0 auto; width: 64px; text-align: center; font-size: 12px; position: relative; transition: opacity .3s; }
.pl .av { width: 48px; height: 48px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 20px;
  color: #0a0614; border: 2px solid transparent; transition: all .3s; }
.pl .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl.now .av { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 210, 63, .35), 0 0 20px rgba(255, 210, 63, .8); transform: scale(1.08); }
.pl.off { opacity: .35; }
.pl .crown { position: absolute; top: -8px; right: 6px; font-size: 16px; }
.pl .me { color: var(--gold); }
.status { text-align: center; min-height: 20px; color: var(--muted); font-size: 14px; }
.wait { text-align: center; padding: 30px 10px; }
.wait .big { font-size: 46px; animation: bob 1.6s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* bottom action bar, thumb-reachable */
.bar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0 calc(8px + var(--safe-b));
  margin-top: 18px; }
.bar button { flex: 1; background: rgba(20, 12, 38, .92); }
.bar .btn-danger { background: rgba(60, 14, 30, .92); }

/* vote */
.vote-box { text-align: center; }
.ring { position: relative; width: 120px; height: 120px; margin: 4px auto 14px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: rgba(255, 255, 255, .1); }
.ring .fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 327; filter: drop-shadow(0 0 6px var(--gold));
  animation: ring var(--dur, 20s) linear forwards; }
@keyframes ring { from { stroke-dashoffset: var(--from, 0); } to { stroke-dashoffset: 327; } }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; font-weight: 900; }
.ring.low .fg { stroke: var(--red); filter: drop-shadow(0 0 6px var(--red)); }
.ring.low .num { color: var(--red); animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.15); } }
.vote-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote-btns button { min-height: 96px; flex-direction: column; font-size: 18px; border-radius: 22px; border-width: 2px; }
.vote-btns button span { font-size: 36px; }
.v-yes { color: var(--lime); border-color: var(--lime) !important; background: rgba(182, 255, 59, .08); }
.v-no { color: var(--red); border-color: var(--red) !important; background: rgba(255, 77, 94, .08); }
.v-yes.picked { background: var(--lime); color: #0a0614; box-shadow: 0 0 26px rgba(182, 255, 59, .6); }
.v-no.picked { background: var(--red); color: #fff; box-shadow: 0 0 26px rgba(255, 77, 94, .6); }
.mini-card { font-size: 15px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, .3); margin: 0 0 14px; border-left: 4px solid; text-align: left; }
.mini-card.truth { border-color: var(--cyan); }
.mini-card.dare { border-color: var(--pink); }

/* result overlay */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5, 2, 12, .78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn .2s ease-out; padding: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
.result { text-align: center; animation: zoom .5s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes zoom { from { transform: scale(.3); opacity: 0; } }
.result .big { font-size: clamp(44px, 15vw, 72px); font-weight: 900; letter-spacing: 2px; }
.result.pass .big { color: var(--lime); text-shadow: 0 0 14px var(--lime), 0 0 40px rgba(182, 255, 59, .6); }
.result.fail .big { color: var(--red); text-shadow: 0 0 14px var(--red), 0 0 40px rgba(255, 77, 94, .6); animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }
.result .who { font-size: 20px; margin-top: 6px; }
.result .score { color: var(--muted); margin-top: 8px; }
.confetti { position: fixed; top: -20px; width: 10px; height: 16px; border-radius: 3px; z-index: 21; pointer-events: none;
  animation: fall var(--t, 2.4s) cubic-bezier(.3, .6, .6, 1) forwards; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 720deg)); opacity: .8; } }

/* scoreboard bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 15; background: rgba(5, 2, 12, .7); display: flex; align-items: flex-end; animation: fadeIn .2s; }
.sheet-body { width: 100%; max-width: 520px; margin: 0 auto; max-height: 82dvh; overflow-y: auto; background: #140c26;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 10px 16px calc(20px + var(--safe-b));
  animation: up .3s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes up { from { transform: translateY(100%); } }
.grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px;
  border-radius: 16px; background: rgba(255, 255, 255, .05); animation: rise .3s ease-out both; }
.board-row .rank { font-size: 22px; text-align: center; font-weight: 900; color: var(--muted); }
.board-row .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat { text-align: center; font-size: 12px; color: var(--muted); min-width: 58px; }
.stat b { display: block; font-size: 18px; }
.stat.t b { color: var(--cyan); }
.stat.d b { color: var(--pink); }
.board-row.me { outline: 1px solid var(--gold); }

/* ---------- home ---------- */
.mode { display: block; text-decoration: none; position: relative; overflow: hidden; }
.mode .ico { font-size: 40px; }
.mode h2 { margin: 6px 0 4px; font-size: 22px; }
.mode::after { content: "➜"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--pink); transition: transform .2s; }
.mode:active::after { transform: translate(6px, -50%); }
.code-in { text-transform: uppercase; letter-spacing: 6px; font-weight: 900; text-align: center; font-size: 22px !important; }

/* ---------- admin ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: rgba(0, 0, 0, .2); }
.item.off { opacity: .45; }
.item .text { margin-bottom: 8px; }
.badge { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-weight: 700; }
.badge.truth { background: rgba(34, 228, 255, .18); color: var(--cyan); }
.badge.dare { background: rgba(255, 46, 136, .18); color: var(--pink); }

#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); background: #241640;
  border: 1px solid var(--violet); color: #fff; padding: 12px 18px; border-radius: 14px; opacity: 0; transition: all .25s;
  pointer-events: none; max-width: 90vw; z-index: 30; box-shadow: 0 0 20px rgba(155, 92, 255, .5); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
