:root {
  --bg1: #46178f; --bg2: #2a0d5c; --card: rgba(255,255,255,.12); --ink: #fff; --dim: rgba(255,255,255,.7);
  --c0: #e21b3c; --c1: #1368ce; --c2: #d89e00; --c3: #26890c; --c4: #864cbf; --c5: #0aa3a3;
  --good: #26890c; --bad: #e21b3c;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink);
  background: radial-gradient(circle at 30% 20%, var(--bg1), var(--bg2)); background-attachment: fixed;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
#timer { position: fixed; top: 0; left: 0; right: 0; height: 10px; background: rgba(0,0,0,.25); z-index: 10; }
#timer i { display: block; height: 100%; width: 0; background: #fff; }
#app { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px 90px; gap: 18px; text-align: center; }
h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 0; }
h2 { font-size: clamp(1.4rem, 3.4vw, 2.6rem); margin: 0; }
p { margin: 0; color: var(--dim); font-size: 1.15rem; }
.big { font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 800; line-height: 1.05; }
.card { background: var(--card); border-radius: 16px; padding: 18px 22px; }
input, button { font: inherit; }
input[type=text], input[type=number], input[type=password] {
  width: 100%; max-width: 380px; padding: 16px; border: 0; border-radius: 12px; font-size: 1.4rem; text-align: center; color: #222;
}
.btn { background: #fff; color: #222; border: 0; border-radius: 12px; padding: 14px 28px; font-weight: 800; font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.btn.ghost { background: var(--card); color: #fff; box-shadow: none; }
.err { color: #ffd0d6; font-weight: 700; min-height: 1.4em; }

/* answer options */
.opts { display: grid; gap: 12px; width: 100%; max-width: 1100px; grid-template-columns: 1fr 1fr; }
.opts.one { grid-template-columns: 1fr; }
.opt { display: flex; align-items: center; gap: 14px; padding: 22px 18px; border: 0; border-radius: 12px; color: #fff; font-weight: 800; font-size: clamp(1.1rem, 2.6vw, 2rem); text-align: left; box-shadow: 0 5px 0 rgba(0,0,0,.3); position: relative; }
button.opt { cursor: pointer; }
button.opt:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.opt .shape { font-size: 1.4em; width: 1.4em; text-align: center; flex: none; }
.opt .label { flex: 1; }
.opt.sel { outline: 6px solid #fff; }
.opt.dim { opacity: .35; }
.opt.right::after { content: '✓'; font-size: 1.6em; }
.opt .count { font-size: 1.1em; opacity: .95; }
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); }
.c3 { background: var(--c3); } .c4 { background: var(--c4); } .c5 { background: var(--c5); }
.bar { position: absolute; left: 0; bottom: 0; height: 8px; background: rgba(255,255,255,.7); border-radius: 0 0 0 12px; transition: width .6s; }

/* host */
.qtext { font-size: clamp(1.8rem, 4.6vw, 3.6rem); font-weight: 800; background: #fff; color: #222; border-radius: 14px; padding: 18px 28px; max-width: 1100px; width: 100%; }
.qimg { max-height: 36vh; max-width: 100%; border-radius: 12px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1000px; }
.chip { background: var(--card); border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 1.3rem; cursor: default; animation: pop .3s; }
.chip.off { opacity: .45; }
.chip button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 1rem; margin-left: 6px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.join { display: flex; gap: 36px; align-items: center; justify-content: center; flex-wrap: wrap; }
.join .url { font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 800; background: #fff; color: #222; border-radius: 14px; padding: 12px 24px; }
#qr { background: #fff; padding: 12px; border-radius: 12px; line-height: 0; }
.board { width: 100%; max-width: 760px; display: grid; gap: 10px; }
.brow { display: flex; justify-content: space-between; align-items: center; background: #fff; color: #222; border-radius: 10px; padding: 14px 22px; font-weight: 800; font-size: clamp(1.1rem, 2.6vw, 2rem); animation: pop .35s backwards; }
.brow .d { color: var(--good); font-size: .7em; margin-left: 10px; }
.podium { display: flex; align-items: flex-end; gap: 14px; justify-content: center; height: 42vh; min-height: 260px; }
.pl { width: clamp(100px, 22vw, 240px); background: var(--card); border-radius: 14px 14px 0 0; padding: 10px; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; font-weight: 800; animation: rise 1s backwards; }
.pl .medal { font-size: 3rem; }
.pl .nm { font-size: 1.5rem; word-break: break-word; }
.pl.p1 { height: 100%; background: #d89e00; animation-delay: 1.6s; } .pl.p2 { height: 72%; animation-delay: .8s; } .pl.p3 { height: 52%; animation-delay: .1s; }
@keyframes rise { from { transform: translateY(120%); } to { transform: none; } }
.controls { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 18px; background: rgba(0,0,0,.35); }
.controls .info { color: var(--dim); font-weight: 700; }
#secs { font-size: 3rem; font-weight: 800; background: #fff; color: #222; border-radius: 999px; width: 1.9em; height: 1.9em; display: grid; place-items: center; }

/* player */
.banner { width: 100%; max-width: 520px; border-radius: 16px; padding: 30px 16px; font-weight: 800; font-size: 2.2rem; }
.banner.good { background: var(--good); } .banner.bad { background: var(--bad); } .banner.neutral { background: var(--card); }
.stat { font-size: 1.4rem; font-weight: 700; }
#status { position: fixed; top: 12px; right: 12px; background: #d89e00; color: #222; font-weight: 800; padding: 6px 12px; border-radius: 8px; z-index: 20; display: none; }

/* avatars + join flow */
.avi { width: 1.6em; height: 1.6em; border-radius: 50%; background: #fff; vertical-align: middle; flex: none; }
.avi.lg { width: 96px; height: 96px; }
.chip { display: inline-flex; align-items: center; gap: 10px; }
.brow .who { display: flex; align-items: center; gap: 12px; }
.avs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 400px; }
.av { background: rgba(255,255,255,.14); border: 4px solid transparent; border-radius: 18px; padding: 4px; cursor: pointer; }
.av.sel { border-color: #fff; background: rgba(255,255,255,.4); transform: scale(1.06); }
.av img { width: 100%; display: block; border-radius: 12px; }
.pin { font-size: clamp(2.4rem, 7vw, 5rem); font-weight: 800; letter-spacing: .12em; background: #fff; color: #222; border-radius: 14px; padding: 6px 26px; font-variant-numeric: tabular-nums; }
input.pininput { font-size: 2rem; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.credits { position: fixed; bottom: 6px; left: 0; right: 0; font-size: .7rem; color: var(--dim); padding: 0 12px; }
.words { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1000px; }
.word { background: #fff; color: #222; border-radius: 12px; padding: 10px 18px; font-weight: 800; font-size: clamp(1.1rem, 2.4vw, 1.8rem); }
.word.ok { background: var(--good); color: #fff; } .word.no { opacity: .7; }
.word small { opacity: .7; margin-left: 6px; }
.warn { max-width: 700px; background: #d89e00; color: #222; font-weight: 700; white-space: pre-line; }
.warn.bad { background: var(--bad); color: #fff; text-align: left; }
.textin { width: 100%; max-width: 420px; padding: 16px; border: 0; border-radius: 12px; font-size: 1.4rem; text-align: center; color: #222; }

/* voting on open answers */
.votes { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 900px; }
.vcard { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #fff; color: #222; border: 0; border-radius: 12px; padding: 14px 22px; font: inherit; font-weight: 800; font-size: clamp(1.1rem, 2.4vw, 1.9rem); text-align: left; transition: transform .3s; width: 100%; }
.vcard .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #ffd166; opacity: .65; transition: width .4s ease; z-index: 0; }
.vcard > span { position: relative; z-index: 1; }
.vcard .n { font-size: 1.15em; white-space: nowrap; }
.vcard small { display: block; font-weight: 600; opacity: .65; font-size: .55em; }
.vcard.win { outline: 6px solid #ffd166; }
button.vcard { cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
button.vcard:active { transform: translateY(3px); }
button.vcard.sel { background: #ffd166; outline: 4px solid #fff; }
button.vcard.mine { opacity: .45; cursor: default; }
.vlist { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 520px; }

/* explanation text shown with the question, and the reading countdown */
.note { font-size: clamp(1.1rem, 2.4vw, 1.7rem); color: #fff; max-width: 900px; font-weight: 600; }

/* join address + PIN badge on the host screen */
#pinbar { position: fixed; top: 16px; right: 14px; z-index: 9; display: none; background: rgba(0,0,0,.4); border-radius: 12px; padding: 6px 14px; text-align: right; line-height: 1.25; }
#pinbar small { display: block; color: var(--dim); font-weight: 700; }
#pinbar b { font-size: 1.5rem; letter-spacing: .06em; }

/* your own row on the phone leaderboard */
.brow.me { outline: 5px solid #ffd166; background: #fff3c4; }

/* reset confirmation on the host screen */
#modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); padding: 16px; }
#modal .box { background: #2a0d5c; border: 2px solid rgba(255,255,255,.3); border-radius: 18px; padding: 26px; max-width: 520px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 14px; }
#modal .col { display: flex; flex-direction: column; gap: 12px; }
