:root {
    --purple: #46178f;
    --purple-dark: #33106b;
    --a0: #e21b3c;
    --a1: #1368ce;
    --a2: #d89e00;
    --a3: #26890c;
    --ink: #1f1f2b;
    --muted: #6b6b80;
    --bg: #f3f2f8;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

h1 { margin: 0 0 .4em; line-height: 1.15; }
a { color: inherit; }
.muted { color: var(--muted); }
.error { color: #c8102e; font-weight: 600; margin: .3em 0; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    padding: .65em 1.2em; border-radius: 10px; border: 0; cursor: pointer;
    font: inherit; font-weight: 700; text-decoration: none; color: var(--ink);
    background: #e4e2ef; transition: transform .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(.95); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #26890c; color: #fff; box-shadow: 0 4px 0 #1a6108; }
.btn.white { background: #fff; color: var(--purple); box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.btn.danger { background: #fde8ec; color: #b00020; }
.btn.ghost-light { background: rgba(255,255,255,.15); color: #fff; }
.btn.big { font-size: 1.4rem; padding: .7em 1.6em; }
.btn.small { padding: .3em .6em; }
.btn.add { width: 100%; margin: 1em 0 3em; padding: 1em; background: #fff; border: 2px dashed #b5b0cf; }
.link { background: none; border: 0; font: inherit; cursor: pointer; color: var(--muted); text-decoration: underline; padding: .5em; }
.link.light { color: rgba(255,255,255,.7); }

/* ---------- generic full screens ---------- */
.screen { min-height: 100vh; min-height: 100dvh; padding: 1.2rem; }
.screen.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem; }
.screen.purple { background: var(--purple); color: #fff; }
.screen.right { background: #26890c; color: #fff; }
.screen.wrong { background: #e21b3c; color: #fff; }
.gap { font-size: 1.15rem; font-weight: 700; background: rgba(0,0,0,.2); padding: .5em 1em; border-radius: 999px; margin: .2rem 0; }
.big-emoji { font-size: 5rem; line-height: 1; }
.points { font-size: 3.5rem; font-weight: 800; }
.score-line { font-size: 1.3rem; font-weight: 700; opacity: .95; }
.rank-badge { width: 6rem; height: 6rem; border-radius: 50%; background: #fff; color: var(--purple); font-size: 3.5rem; font-weight: 800; display: grid; place-items: center; }
.logo { font-size: 3rem; font-weight: 800; margin-bottom: .4rem; }

.card { background: #fff; color: var(--ink); border-radius: 16px; padding: 1.4rem; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.card.join, .card.login { width: min(92vw, 380px); display: flex; flex-direction: column; gap: .8rem; text-align: center; }
.card input { width: 100%; padding: .8em; font: inherit; font-size: 1.2rem; text-align: center; border: 2px solid #cfcbe3; border-radius: 10px; }
.card input:focus { outline: 3px solid #8a63d2; border-color: transparent; }
.pin-input { font-size: 2rem !important; letter-spacing: .15em; font-weight: 700; }
.card.login { text-align: left; }
.card.login input { text-align: left; }

.spinner { width: 3rem; height: 3rem; border: 5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--purple); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- answer colours & shapes ---------- */
.a0 { background: var(--a0); } .a1 { background: var(--a1); } .a2 { background: var(--a2); } .a3 { background: var(--a3); }
.shape { width: 1.6em; height: 1.6em; flex: none; }

.answer {
    display: flex; align-items: center; gap: .7em; color: #fff; font-weight: 700; border: 0;
    border-radius: 10px; padding: .8em 1em; font-size: 1.2rem; text-align: left; font-family: inherit;
    box-shadow: 0 5px 0 rgba(0,0,0,.25);
}
button.answer { cursor: pointer; }
button.answer:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.answer span { flex: 1; overflow-wrap: anywhere; }

/* ---------- player answer screen ---------- */
.answer-screen { display: flex; flex-direction: column; gap: .8rem; padding: .8rem; background: #2b1060; }
.q-small { color: #fff; font-weight: 700; font-size: 1.15rem; text-align: center; padding: .2rem .4rem; }
.answer-screen .answer-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: .8rem; }
.answer-screen .answer { flex-direction: column; justify-content: center; text-align: center; font-size: 1.35rem; min-height: 7rem; }
.answer-screen .answer .shape { width: 2.6em; height: 2.6em; }
.answer-screen .answer span { flex: 0 1 auto; }
.answer-grid.n2 { grid-template-columns: 1fr !important; }
.answer-grid.n3 button.answer:nth-child(3) { grid-column: 1 / -1; }

.timebar { height: 12px; background: rgba(255,255,255,.2); border-radius: 6px; overflow: hidden; }
.timebar > div { height: 100%; width: 100%; background: #fff; transform-origin: left; animation-name: drain; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.timebar.host { height: 16px; margin: 0 0 .8rem; }

/* ---------- host screens ---------- */
.host-lobby { background: radial-gradient(ellipse at 50% -10%, #7a35d6 0%, #3a127a 50%, #1b0640 100%) !important; display: flex; flex-direction: column; gap: 1.2rem; align-items: center; }
.lobby-top { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: center; margin-top: 1rem; }
.join-info { text-align: center; }
.join-line { font-size: 1.6rem; }
.pin-label { opacity: .8; margin-top: .6rem; }
.pin { background: #fff; color: var(--ink); font-size: clamp(3.5rem, 11vw, 7rem); font-weight: 800; letter-spacing: .08em; padding: .05em .4em; border-radius: 16px; }
.qr { width: min(38vw, 260px); min-width: 170px; background: #fff; border-radius: 16px; padding: 10px; }
.qr svg { width: 100%; height: auto; display: block; }
.lobby-count { font-size: 1.6rem; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; max-width: 1100px; }
.chip { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 999px; padding: .5em 1em; font: inherit; font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.chip i { font-style: normal; opacity: 0; margin-left: .3em; }
.chip:hover { background: rgba(255,255,255,.3); } .chip:hover i { opacity: .9; }
.host-actions { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: auto; padding-top: 1rem; }

.host-q { display: flex; flex-direction: column; gap: 1rem; background: #f3f2f8; }
.host-q-top { display: flex; justify-content: space-between; }
.pill { background: #fff; padding: .4em 1em; border-radius: 999px; font-weight: 700; box-shadow: 0 2px 0 rgba(0,0,0,.1); }
.host-q-text { background: #fff; padding: 1rem 1.4rem; border-radius: 14px; font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 800; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
.host-q-mid { flex: 1; display: flex; align-items: center; justify-content: space-between; min-height: 6rem; }
.countdown { width: clamp(5rem, 14vw, 9rem); height: clamp(5rem, 14vw, 9rem); border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 800; margin: 0 auto; }
.host-q-mid .btn { position: absolute; right: 1.2rem; }
.answer-grid.host { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.answer-grid.host .answer { font-size: clamp(1.1rem, 2.6vw, 2rem); padding: 1em; }

.result-bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; align-items: stretch; min-height: 340px; }
.result-bars.n2 { grid-template-columns: repeat(2, 1fr); } .result-bars.n3 { grid-template-columns: repeat(3, 1fr); }
.result { display: flex; flex-direction: column; gap: .5rem; }
.result.no { opacity: .45; }
.bar-wrap { flex: 1; display: flex; align-items: flex-end; min-height: 200px; }
.bar { width: 100%; border-radius: 10px 10px 0 0; display: flex; justify-content: center; padding-top: .3rem; color: #fff; font-size: 2rem; transition: height .5s; }
.result .answer { font-size: clamp(1rem, 2vw, 1.5rem); }
.result .answer em { font-style: normal; font-size: 1.6em; }

.host-board { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.board { list-style: none; padding: 0; margin: 0; width: min(100%, 800px); display: flex; flex-direction: column; gap: .6rem; }
.board li { display: flex; align-items: center; gap: 1rem; background: #fff; color: var(--ink); padding: .7em 1.2em; border-radius: 12px; font-size: 1.6rem; font-weight: 700; }
.board .r { width: 2ch; color: var(--purple); }
.board .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .gain { color: #26890c; font-size: 1.1rem; }
.board.small li { font-size: 1.2rem; padding: .45em 1em; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: .8rem; width: min(100%, 800px); min-height: 280px; }
.step { flex: 1; background: rgba(255,255,255,.18); border-radius: 14px 14px 0 0; text-align: center; padding: 1rem .4rem; }
.step.s1 { min-height: 280px; background: #d89e00; } .step.s2 { min-height: 210px; background: #8f98a6; } .step.s3 { min-height: 160px; background: #b5703a; }
.medal { font-size: 3rem; } .pname { font-size: 1.6rem; font-weight: 800; overflow-wrap: anywhere; } .pscore { font-size: 1.2rem; opacity: .9; }

/* ---------- mascot: Master Quiz ---------- */
.mascot { height: clamp(240px, 52vh, 600px); width: auto; flex: none; transform-origin: 50% 100%; filter: drop-shadow(0 10px 16px rgba(0,0,0,.3)); user-select: none; -webkit-user-drag: none; }
.mascot.enter { animation: mascotIn .8s cubic-bezier(.2,1.3,.4,1) var(--d, 0s) both, bob 3.6s ease-in-out calc(var(--d, 0s) + .8s) infinite; }
@keyframes mascotIn { from { opacity: 0; transform: translateY(40px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: rotate(-1.2deg) translateY(0); } 50% { transform: rotate(1.2deg) translateY(-6px); } }
.stage { display: flex; align-items: flex-end; justify-content: center; gap: clamp(1rem, 3vw, 3rem); width: 100%; max-width: 1500px; }
.stage > .board, .stage > .podium { flex: 1 1 0; min-width: 0; max-width: 800px; width: auto; }
.lobby-stage { align-items: center; flex: 1; }
.lobby-main { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; flex: 1 1 0; min-width: 0; }
@media (max-width: 1000px) { .stage > .mascot, .stage > .mascot-spot { display: none; } }

/* the quizmaster stands on a little stage floor under a spotlight (host screen) */
.mascot-spot { --floor-h: clamp(46px, 8.5vh, 86px); position: relative; flex: none; display: flex; align-items: flex-end; justify-content: center;
    padding: 0 clamp(1.4rem, 4vw, 4rem) calc(var(--floor-h) * .5); }
.mascot-spot .mascot { position: relative; z-index: 2; }
.spot-cone { position: absolute; z-index: 0; left: 50%; top: -60vh; width: 110%; height: calc(60vh + 100% - var(--floor-h) * .5); transform: translateX(-50%); pointer-events: none;
    clip-path: polygon(41% 0, 59% 0, 100% 100%, 0 100%); mix-blend-mode: screen;
    background: linear-gradient(to bottom, rgba(255, 240, 190, 0) 0%, rgba(255, 238, 180, .10) 35%, rgba(255, 236, 170, .30) 100%);
    animation: coneIn 1.2s var(--d, 0s) both, conePulse 5s ease-in-out calc(var(--d, 0s) + 1.2s) infinite; }
@keyframes coneIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes conePulse { 0%, 100% { opacity: 1; } 50% { opacity: .78; } }
.spot-pool { position: absolute; z-index: 0; left: 50%; bottom: calc(var(--floor-h) * -.35); width: 150%; height: calc(var(--floor-h) * 2.4); transform: translateX(-50%); pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(ellipse at 50% 50%, rgba(255, 236, 170, .55) 0%, rgba(255, 225, 140, .18) 45%, transparent 70%); animation: coneIn 1.2s var(--d, 0s) both; }
/* the floor: a round stage with a gold rim and some thickness */
.floor { position: absolute; z-index: 1; left: 50%; bottom: 0; width: 118%; height: var(--floor-h); transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(ellipse at 50% 38%, #b98cff 0%, #7a3fd6 38%, #3d1584 78%, #2a0b5e 100%);
    box-shadow: 0 0 0 4px #ffc933, 0 0 0 6px #8a5a00, 0 9px 0 6px #7a4f00, 0 14px 0 6px #2a1b00, 0 22px 28px 4px rgba(0, 0, 0, .55), inset 0 0 18px rgba(255, 255, 255, .25);
    animation: floorIn .8s cubic-bezier(.2, 1.3, .4, 1) var(--d, 0s) both; }
.floor::after { content: ""; position: absolute; inset: 12% 14%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .22); }
@keyframes floorIn { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------- phone screens: the four quiz shapes floating in colour gradients ---------- */
.screen.shapes { position: relative; overflow: hidden; }
.screen.purple.shapes { background: radial-gradient(ellipse at 50% 0%, #6a2bc2 0%, #46178f 55%, #2a0b5e 100%); }
.screen.shapes::before { content: ""; position: absolute; inset: -6%; pointer-events: none; z-index: 0; background: url("bg-shapes.svg") center / cover no-repeat;
    animation: drift 26s ease-in-out infinite alternate; }
.screen.shapes.light::before { background-image: url("bg-shapes-light.svg"); }
.screen.shapes > * { position: relative; z-index: 1; }
.screen.shapes > .mute-btn { position: fixed; }
@keyframes drift { from { transform: translate(-1.5%, -1%) rotate(-1.5deg) scale(1.02); } to { transform: translate(1.5%, 1.2%) rotate(1.5deg) scale(1.07); } }
.mascot.small { height: min(40vh, 330px); }
.mascot.logo-mascot { height: min(24vh, 210px); margin-bottom: -.2rem; }

/* ---------- cover: the front of the game box (start page) ---------- */
.cover { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 22px 14px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 110%, #5a1fb0 0%, #2a0b5e 45%, #12042c 100%); color: #fff; }
.cover-beams { position: absolute; inset: -20% -10% 0; pointer-events: none; opacity: .9;
    background:
        conic-gradient(from 168deg at 18% -6%, transparent 0 6%, rgba(255, 214, 120, .13) 8% 15%, transparent 17% 100%),
        conic-gradient(from 192deg at 82% -6%, transparent 0 6%, rgba(255, 214, 120, .13) 8% 15%, transparent 17% 100%);
    animation: beams 7s ease-in-out infinite alternate; transform-origin: 50% 0; }
@keyframes beams { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }

.box { position: relative; width: min(100%, 470px); height: min(calc(100dvh - 44px), 860px); min-height: 520px; display: flex; flex-direction: column; gap: .5rem;
    padding: 20px 18px 18px; border-radius: 30px; isolation: isolate;
    background: radial-gradient(ellipse at 50% 38%, #9a55f0 0%, #5a22b4 42%, #301070 100%);
    border: 6px solid #ffc933; box-shadow: inset 0 0 0 3px #8a5a00, inset 0 0 60px rgba(20, 0, 60, .55), 0 0 0 4px #8a5a00, 0 24px 60px rgba(0, 0, 0, .6), 0 0 80px rgba(255, 200, 60, .25); }
.box-bulbs { position: absolute; inset: -22px; border-radius: 44px; border: 11px dotted #fff3b0; pointer-events: none; z-index: -1;
    filter: drop-shadow(0 0 7px #ffc933) drop-shadow(0 0 14px rgba(255, 200, 60, .7)); animation: bulbs 1.6s steps(1) infinite; }
@keyframes bulbs { 0% { opacity: 1; } 50% { opacity: .5; } }

/* title: gold lettering, a red ribbon with the slogan */
.box-title { text-align: center; flex: none; }
.title { margin: 0; line-height: .86; font-family: "Arial Rounded MT Bold", "Segoe UI Black", "Arial Black", system-ui, sans-serif; font-weight: 900; text-transform: uppercase; letter-spacing: .02em;
    animation: titleDrop .9s cubic-bezier(.2, 1.4, .4, 1) both; }
.title span { display: block; background: linear-gradient(180deg, #fffbd0 0%, #ffd24a 45%, #f09a00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    -webkit-text-stroke: 2px #4a1a94; paint-order: stroke fill; filter: drop-shadow(0 3px 0 #8a4b00) drop-shadow(0 6px 0 #4a1a94) drop-shadow(0 12px 10px rgba(0, 0, 0, .45)); }
.t-master { font-size: clamp(2.3rem, 11vw, 3.4rem); }
.t-quiz { font-size: clamp(3.8rem, 20vw, 6.2rem); margin-top: .02em; }
@keyframes titleDrop { from { opacity: 0; transform: translateY(-40px) scale(.9); } to { opacity: 1; transform: none; } }

.ribbon { display: inline-block; margin-top: .55rem; padding: .42em 2.1em; font-weight: 800; font-size: clamp(.78rem, 3.6vw, 1rem); letter-spacing: .06em; text-transform: uppercase; color: #fff;
    background: linear-gradient(#ff3f5d, #c8102e); clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%); transform: rotate(-2deg);
    text-shadow: 0 2px 0 rgba(0, 0, 0, .3); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)); animation: fadeUp .7s .25s both; }
.ribbon span { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px) rotate(-2deg); } to { opacity: 1; transform: rotate(-2deg); } }

/* stage with the quizmaster */
.box-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.spot-glow { position: absolute; left: 50%; bottom: -4%; width: 130%; height: 92%; transform: translateX(-50%); border-radius: 50%; pointer-events: none;
    background: radial-gradient(ellipse at 50% 55%, rgba(255, 236, 160, .55) 0%, rgba(255, 220, 120, .18) 42%, transparent 68%); }
.host-man { position: relative; height: 100%; width: auto; max-width: 78%; object-fit: contain; object-position: bottom; transform-origin: 50% 100%;
    filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .45)); user-select: none; -webkit-user-drag: none;
    animation: mascotIn .9s cubic-bezier(.2, 1.3, .4, 1) var(--d, 0s) both, bob 3.8s ease-in-out calc(var(--d, 0s) + .9s) infinite; }
.float { position: absolute; width: clamp(26px, 8.5vw, 40px); height: clamp(26px, 8.5vw, 40px); opacity: .95; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .3)); animation: floaty 4s ease-in-out infinite; }
.float .shape { width: 100%; height: 100%; }
.f0 { color: var(--a0); left: 7%; top: 30%; --r: -14deg; } .f1 { color: var(--a1); right: 6%; top: 26%; --r: 16deg; animation-delay: -1s; }
.f2 { color: var(--a2); left: 10%; bottom: 20%; --r: 8deg; animation-delay: -2s; } .f3 { color: var(--a3); right: 9%; bottom: 36%; --r: -10deg; animation-delay: -3s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-10px) rotate(calc(var(--r, 0deg) + 6deg)); } }

.sticker { position: absolute; width: clamp(78px, 24vw, 104px); aspect-ratio: 1; display: grid; place-content: center; text-align: center; line-height: 1.05; color: #4a1a94; font-weight: 900;
    --burst: polygon(50.0% 0.0%, 59.6% 8.1%, 71.7% 5.0%, 76.8% 16.4%, 89.1% 18.8%, 88.7% 31.3%, 98.7% 38.9%, 93.0% 50.0%, 98.7% 61.1%, 88.7% 68.7%, 89.1% 81.2%, 76.8% 83.6%, 71.7% 95.0%, 59.6% 91.9%, 50.0% 100.0%, 40.4% 91.9%, 28.3% 95.0%, 23.2% 83.6%, 10.9% 81.2%, 11.3% 68.7%, 1.3% 61.1%, 7.0% 50.0%, 1.3% 38.9%, 11.3% 31.3%, 10.9% 18.8%, 23.2% 16.4%, 28.3% 5.0%, 40.4% 8.1%);
    background: #fff; clip-path: var(--burst);
    animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
/* white outer burst (the element) with a smaller coloured burst inside it */
.sticker::before { content: ""; position: absolute; inset: 5%; z-index: -1; background: #ffd24a; clip-path: var(--burst); }
.s-right::before { background: #ff6b81; }
.sticker b { font-size: clamp(1.15rem, 5.2vw, 1.55rem); letter-spacing: -.02em; }
.sticker span { font-size: clamp(.6rem, 2.7vw, .78rem); text-transform: uppercase; letter-spacing: .04em; padding: 0 .4em; }
.sticker i { font-style: normal; font-size: clamp(1.3rem, 6vw, 1.8rem); }
.s-left { left: -2%; top: 4%; --r: -12deg; transform: rotate(-12deg); animation-delay: 1s; }
.s-right { right: -2%; bottom: 7%; --r: 11deg; transform: rotate(11deg); animation-delay: 1.25s; color: #fff; }
.s-right span { font-size: clamp(.58rem, 2.5vw, .72rem); }
@keyframes pop { from { opacity: 0; scale: .2; } to { opacity: 1; scale: 1; } }

/* the bottom strip of the box: enter the game code here */
.box-strip { flex: none; padding: .8rem .9rem .85rem; border-radius: 20px; text-align: center;
    background: linear-gradient(#fffaf0, #ffe9a8); border: 4px solid #ffc933; box-shadow: 0 6px 0 #8a5a00, 0 12px 24px rgba(0, 0, 0, .35); animation: fadeIn .6s .5s both; }
.strip-label { display: block; margin-bottom: .35rem; color: #4a1a94; font-weight: 900; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; }
.strip-input { width: 100%; padding: .65em .6em; border-radius: 14px; border: 3px solid #b9a5e6; background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 1.35rem; text-align: center; }
.strip-input.pin-input { font-size: 1.9rem; letter-spacing: .22em; padding-left: .8em; }
.strip-input::placeholder { color: #a89cc4; letter-spacing: .03em; font-weight: 600; }
.strip-input:focus { outline: 4px solid #8a63d2; border-color: transparent; }
.strip-go { display: block; width: 100%; margin-top: .6rem; padding: .7em; border: 0; border-radius: 14px; cursor: pointer; font: inherit; font-weight: 900; font-size: 1.3rem; letter-spacing: .04em; text-transform: uppercase; color: #fff;
    background: linear-gradient(#3fc431, #1f8a10); box-shadow: 0 5px 0 #13620a, 0 8px 14px rgba(0, 0, 0, .25); transition: transform .08s; }
.strip-go:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #13620a; }
.strip-go:disabled { opacity: .55; }
.strip-back { display: block; margin: .55rem auto 0; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: #6a4aa8; text-decoration: underline; }
.strip-error { margin: .45rem 0 0; color: #c8102e; font-weight: 700; }
.strip-skeleton { height: 140px; }

/* keyboard open on a small phone: the box shrinks, so drop the decoration first */
@media (max-height: 640px) { .sticker, .float { display: none; } .t-quiz { font-size: clamp(2.6rem, 14vw, 4rem); } }
@media (max-height: 520px) { .box-stage { display: none; } .box { min-height: 0; height: auto; } }
@media (min-width: 900px) { .box { width: 500px; } }
@media (prefers-reduced-motion: reduce) { .cover-beams, .box-bulbs, .float, .host-man, .sticker, .title, .ribbon, .box-strip { animation: none !important; } }

/* ---------- question pictures ---------- */
.host-q-mid.has-img { justify-content: center; position: relative; gap: 1.5rem; min-height: 0; }
.host-q-mid.has-img .btn { z-index: 2; }
.host-q-mid.has-img .countdown { position: absolute; left: 0; top: 0; margin: 0; width: clamp(4rem, 9vw, 6.5rem); height: clamp(4rem, 9vw, 6.5rem); font-size: clamp(2rem, 5vw, 3.6rem); z-index: 2; }
/* with a picture the question screen is exactly one screen high: the picture takes whatever room is left between question and answers */
.host-q.q-fixed { height: 100vh; height: 100dvh; overflow: hidden; }
.q-img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); }
.host-q-mid.has-img { overflow: hidden; align-items: stretch; }

.sound-card { background: #faf8ff; border: 2px solid #e2dcf5; }
.sound-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .9rem; }
.sound-grid label { display: flex; align-items: flex-start; gap: .55rem; padding: .5rem .6rem; background: #fff; border-radius: 10px; cursor: pointer; line-height: 1.3; }
.sound-grid input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: none; accent-color: var(--purple); }
.sound-grid span b { display: block; }
@media (max-width: 640px) { .sound-grid { grid-template-columns: 1fr; } }

.img-box { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.img-box img { max-height: 110px; max-width: 200px; border-radius: 8px; border: 1px solid #d8d4e8; }
.img-pick { cursor: pointer; background: #f1eefb; border: 2px dashed #b5b0cf; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---------- royal standings & finale ---------- */
.royal { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% -10%, #7a35d6 0%, #3a127a 50%, #1b0640 100%); }
.royal > * { position: relative; z-index: 1; }
.royal-title { font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 800; color: #ffd75e; letter-spacing: .03em;
    text-shadow: 0 3px 0 #8a5a00, 0 0 34px rgba(255,215,94,.55); animation: titleIn .8s cubic-bezier(.2,1.2,.4,1) both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(-30px) scale(.9); } to { opacity: 1; transform: none; } }

.royal-board li { animation: rowIn .6s cubic-bezier(.2,1.25,.4,1) both; animation-delay: var(--d, 0s); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-90px) scale(.92); } to { opacity: 1; transform: none; } }
.royal-board li.first {
    background: linear-gradient(90deg, #fff0b0, #ffc83d); color: #3a2600; font-size: 2.1rem;
    box-shadow: 0 0 0 3px #fff3c2, 0 0 40px rgba(255,200,60,.65);
    animation: firstIn .8s cubic-bezier(.2,1.4,.4,1) both, glow 1.8s ease-in-out infinite;
    animation-delay: var(--d, 0s), calc(var(--d, 0s) + .8s);
}
@keyframes firstIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 3px #fff3c2, 0 0 30px rgba(255,200,60,.5); } 50% { box-shadow: 0 0 0 3px #fff3c2, 0 0 60px rgba(255,200,60,.95); } }
.royal-board .r { font-size: 1.15em; }
.mv { font-size: 1.1rem; font-weight: 800; }
.mv.up { color: #26a30c; } .mv.down { color: #d6203f; }
.royal-board li.first .mv.up { color: #1b7a07; }

.late { animation: fadeIn .6s both; animation-delay: var(--d, 0s); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.finale .spot { position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: conic-gradient(from 180deg at 50% -5%, transparent 0 40%, rgba(255,230,150,.18) 45% 55%, transparent 60% 100%);
    animation: sweep 6s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.finale .podium { margin-top: 1.5rem; align-items: flex-end; }
.finale .step { position: relative; animation: rise .8s cubic-bezier(.2,1.15,.4,1) both; animation-delay: var(--d, 0s); border-radius: 16px 16px 0 0; }
.finale .step.empty { background: none; animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(70px); } to { opacity: 1; transform: none; } }
.finale .step.s1 { background: linear-gradient(180deg, #ffe28a, #d89e00); color: #3a2600; box-shadow: 0 0 50px rgba(255,200,60,.5); }
.finale .step.s2 { background: linear-gradient(180deg, #dfe5ee, #8f98a6); color: #1f2530; }
.finale .step.s3 { background: linear-gradient(180deg, #e0a070, #a8612c); color: #2e1704; }
.finale .step.s1 .pname { font-size: 2.2rem; }
.finale .step.multi .pname { font-size: 1.25rem; }
.finale .step.s1.multi .pname { font-size: 1.6rem; }
.crown { position: absolute; left: 50%; top: -4.2rem; font-size: 4.5rem; line-height: 1; transform-origin: 50% 100%;
    animation: crownDrop 1s cubic-bezier(.3,1.5,.5,1) both, crownWobble 2.4s ease-in-out infinite; animation-delay: var(--d, 0s), calc(var(--d, 0s) + 1s); margin-left: -2.2rem; filter: drop-shadow(0 4px 12px rgba(255,200,60,.8)); }
@keyframes crownDrop { from { opacity: 0; transform: translateY(-160px) rotate(-25deg) scale(1.4); } to { opacity: 1; transform: none; } }
@keyframes crownWobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.confetti-field { position: absolute; inset: 0; pointer-events: none; z-index: 2 !important; overflow: hidden; }
.confetti-field i { position: absolute; top: -3vh; width: 10px; height: 16px; border-radius: 2px; animation: fall linear infinite backwards; }
@keyframes fall { from { transform: translateY(-5vh) rotate(0); } to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
    .screen.shapes::before, .spot-cone, .spot-pool, .floor, .mascot.enter, .royal-board li, .finale .step, .crown, .confetti-field i, .finale .spot, .royal-board li.first { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
    .confetti-field { display: none; }
}

.mute-btn { position: fixed; top: .6rem; right: .6rem; z-index: 50; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 1.3rem; cursor: pointer; }
.mute-btn:hover { background: rgba(0,0,0,.55); }

/* ---------- admin ---------- */
.admin-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; background: var(--purple); color: #fff; padding: .8rem 1.4rem; }
.admin-bar .brand { font-weight: 800; font-size: 1.3rem; text-decoration: none; }
.admin-bar .brand span { font-weight: 400; opacity: .7; font-size: 1rem; }
.admin-bar nav { display: flex; gap: 1.2rem; }
.admin-bar nav a { text-decoration: none; opacity: .9; } .admin-bar nav a:hover { opacity: 1; text-decoration: underline; }
.admin-body { max-width: 900px; margin: 0 auto; padding: 1.4rem 1rem; }
.admin-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.admin-head h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.notice { background: #e8f8e4; border: 2px solid #8fd37f; color: #1b5e10; padding: .6rem 1rem; border-radius: 10px; font-weight: 700; margin: 1rem 0; }
.quiz-list { display: flex; flex-direction: column; gap: .7rem; }
.quiz-row { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.quiz-row h3 { margin: 0 0 .2rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; font-weight: 700; }
.field input, .q-text, .a-row input[type=text], .a-row input:not([type]), select {
    padding: .7em .8em; font: inherit; border: 2px solid #cfcbe3; border-radius: 10px; background: #fff; width: 100%;
}
.q-card { background: #fff; border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: .7rem; }
.q-head { display: flex; align-items: center; justify-content: space-between; }
.q-head h3 { margin: 0; }
.q-text { font-size: 1.15rem; font-weight: 600; }
.inline { display: flex; align-items: center; gap: .6rem; font-weight: 600; } .inline select { width: auto; }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.a-row { display: flex; align-items: center; gap: .5rem; padding: .5rem; border-radius: 10px; color: #fff; }
.a-row .shape { width: 1.8rem; height: 1.8rem; }
.a-row input[type=radio] { width: 1.3rem; height: 1.3rem; accent-color: #fff; }
.correct { display: flex; align-items: center; gap: .3rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.alert { background: #fff4e5; border: 2px solid #f0b866; border-radius: 12px; padding: .8rem 1.2rem; margin-bottom: 1rem; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }

@media (max-width: 640px) {
    .a-grid { grid-template-columns: 1fr; }
    .result-bars { min-height: 260px; }
    .answer-grid.host { grid-template-columns: 1fr; }
}

/* ---------- blazor chrome ---------- */
#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }


