/* Lazzer files are the licensed ones from the XD project. Marvin (slide numbers) loads only if dropped in /fonts. */
@font-face { font-family: Lazzer; src: url(fonts/Lazzer-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Lazzer; src: url(fonts/Lazzer-Medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Lazzer; src: url(fonts/Lazzer-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: Lazzer; src: url(fonts/Lazzer-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: Marvin; src: local("Marvin"), url(fonts/Marvin.woff2) format("woff2"), url(fonts/Marvin.otf) format("opentype"); font-display: swap; }

:root {
    --red: #c91224;
    --red-dark: #b20f1f;
    --btn: #d9000d;
    --panel: #212121;
    --line: #cfcfcf;
    --green: #3cc35a;
    --ease: cubic-bezier(.2, .9, .3, 1.2);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #111; color: #fff; font-family: Lazzer, "Segoe UI", system-ui, sans-serif; }
h1, h2, h3 { font-weight: 700; }
img, video { display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: #999; }

/* ---------- Red sunburst background (slow spin) ---------- */
.sunburst { position: relative; overflow: hidden; background: var(--red); isolation: isolate; }
.sunburst::before {
    content: ""; position: absolute; inset: -60%; z-index: -1;
    background: repeating-conic-gradient(var(--red) 0 7.5deg, var(--red-dark) 7.5deg 15deg);
    animation: spin 160s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- Entrance animations: add a class, set --d for the delay ---------- */
.a-up, .a-down, .a-left, .a-right, .a-pop, .a-zoom {
    animation-duration: .8s; animation-timing-function: var(--ease);
    animation-fill-mode: both; animation-delay: var(--d, 0s);
}
.a-up { animation-name: a-up; }
.a-down { animation-name: a-down; }
.a-left { animation-name: a-left; }
.a-right { animation-name: a-right; }
.a-pop { animation-name: a-pop; }
.a-zoom { animation-name: a-zoom; animation-duration: 1.1s; }
@keyframes a-up { from { opacity: 0; transform: translateY(70px); } }
@keyframes a-down { from { opacity: 0; transform: translateY(-70px); } }
@keyframes a-left { from { opacity: 0; transform: translateX(-90px); } }
@keyframes a-right { from { opacity: 0; transform: translateX(140px); } }
@keyframes a-pop { 0% { opacity: 0; transform: scale(.3); } 70% { opacity: 1; transform: scale(1.08); } }
@keyframes a-zoom { 0% { opacity: 0; transform: scale(.4) rotate(-10deg); } 60% { opacity: 1; transform: scale(1.06) rotate(2deg); } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 14px;
    background: var(--btn); color: #fff; border: 3px solid #fff; border-radius: 999px;
    padding: 10px 34px; font-size: 32px; font-weight: 500;
    box-shadow: 0 6px 0 rgba(0, 0, 0, .25); transition: scale .15s;
}
.btn:hover { scale: 1.05; }
.btn:disabled { opacity: .45; scale: 1; cursor: default; }
.btn-dark { background: #3a3a3a; }

/* ---------- Big screen ---------- */
.host { position: fixed; inset: 0; display: flex; background: #000; }
.stage-wrap { flex: 1; position: relative; overflow: hidden; }
.stage {
    position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; overflow: hidden;
    transform: translate(-50%, -50%) scale(var(--s, .5));
}
.slide { position: absolute; inset: 0; animation: slide-in .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slide-in { from { opacity: 0; transform: scale(1.05); filter: blur(8px); } }

.panel {
    position: absolute; inset: 40px; background: var(--panel);
    border: 3px solid #111; border-radius: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.panel-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 25px; }
.kenburns { animation: kenburns 20s ease-out both; }
@keyframes kenburns { from { transform: scale(1.12); } }
.btn-next { position: absolute; right: 50px; bottom: 36px; z-index: 4; }

.brand { position: absolute; left: 2px; top: -12px; width: 262px; z-index: 3; display: flex; flex-direction: column; align-items: center; }
.brand-logo { width: 250px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); }
.powered { font-size: 28px; font-weight: 700; margin-top: 4px; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.brand-umana { width: 218px; margin-top: 10px; }

.caption {
    position: absolute; left: 36px; top: 682px; width: 1265px; min-height: 275px; z-index: 2;
    display: flex; align-items: center; padding: 30px 44px;
    background: rgba(28, 28, 28, .93); border: 2px solid #444; border-radius: 24px;
    font-size: 46px; line-height: 1.18;
}

/* Lobby */
.lobby-qr {
    position: absolute; left: 340px; top: 110px; width: 640px; padding: 40px;
    background: #fff; color: #111; border-radius: 32px; text-align: center;
}
.lobby-qr img { width: 460px; margin: 0 auto; image-rendering: pixelated; }
.lobby-scan { font-size: 40px; font-weight: 700; margin: 20px 0 6px; }
.lobby-url { font-size: 26px; margin: 0; word-break: break-all; }
.lobby-players { position: absolute; left: 1040px; right: 60px; top: 110px; bottom: 140px; }
.lobby-players h2 { font-size: 56px; margin: 0; }
.lobby-players h2 b { color: #ff4d57; }
.chips { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.chip { background: var(--btn); border: 2px solid #fff; border-radius: 999px; padding: 8px 22px; font-size: 28px; font-weight: 600; }
.lobby-players .muted { font-size: 30px; }

/* Intro + contacts */
.big-logo { position: absolute; left: 46px; top: 40px; width: 520px; z-index: 2; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .35)); }
.big-powered { position: absolute; left: 620px; top: 150px; z-index: 2; display: flex; align-items: center; gap: 16px; font-size: 22px; font-weight: 700; }
.big-powered img { width: 322px; }
.intro-box {
    position: absolute; left: 320px; top: 230px; width: 1235px; height: 730px; padding: 110px 200px 0 260px;
    background: #fff; color: #111; border-radius: 40px; text-align: center;
    display: flex; flex-direction: column; align-items: center;
}
.intro-box h1 { font-size: 76px; line-height: 1.05; margin: 40px 0 46px; }
.intro-box p { font-size: 40px; font-weight: 500; margin: 0 0 30px; }
.intro-box .strong { font-weight: 700; }
.intro-box .btn { position: absolute; bottom: -34px; left: 50%; translate: -50% 0; }
.intro-presenter { position: absolute; right: 20px; top: 120px; height: 960px; z-index: 1; }

.contact-box { position: absolute; left: 122px; top: 200px; width: 1738px; height: 760px; background: #fff; color: #111; border-radius: 40px; }
.contact-box h2 { position: absolute; top: 170px; left: 330px; width: 1050px; margin: 0; text-align: center; font-size: 64px; }
.contact-social { position: absolute; left: 330px; top: 360px; width: 1110px; }
.contact-links { position: absolute; left: 330px; top: 650px; width: 1050px; display: flex; justify-content: center; gap: 160px; }
.link-pill { color: #fff; border: 3px solid #fff; border-radius: 999px; padding: 10px 40px; font-size: 32px; font-weight: 500; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.link-pill.red { background: var(--btn); }
.link-pill.dark { background: #444; }
.contact-girl { position: absolute; right: 10px; top: 120px; height: 960px; }

/* Team */
.team-img { position: absolute; left: 356px; top: 67px; width: 760px; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .5)); }
.team-tags { position: absolute; left: 356px; top: 560px; width: 760px; display: flex; justify-content: space-around; z-index: 2; }
.tag { background: #111; border: 2px solid #888; border-radius: 10px; padding: 2px 22px; font-size: 40px; font-weight: 700; }

/* How to play */
.howto-title { position: absolute; left: 500px; right: 420px; top: 46px; margin: 0; text-align: center; font-size: 56px; }
.howto { list-style: none; position: absolute; left: 500px; top: 160px; width: 925px; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; }
.howto li { display: flex; align-items: baseline; gap: 18px; padding: 22px 30px; background: #1a1a1a; border: 3px solid #3a3a3a; border-radius: 22px; font-size: 44px; line-height: 1.15; }
.howto small { font-size: 20px; color: #aaa; }
.howto-presenter { position: absolute; right: 30px; bottom: 0; height: 740px; }

/* Skill pills */
.pills { list-style: none; position: absolute; left: 396px; top: 510px; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 30px; }
.we .pills { left: 540px; top: 290px; gap: 26px; }
.pill {
    display: flex; align-items: center; gap: 12px; width: 770px; height: 64px; padding: 0 12px 0 26px;
    background: #1a1a1a; border: 3px solid var(--line); border-radius: 999px;
    font-size: 26px; font-weight: 500; text-transform: uppercase;
}
.pill b { font-weight: 700; }
.pill-check { margin-left: auto; width: 42px; }
.pill.hl { background: var(--btn); border-color: #fff; }
.pill.hl.a-left, .pill.hl.a-pop { animation: a-left .8s var(--ease) var(--d, 0s) both, glow 1.4s ease-in-out 1.6s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 34px 6px rgba(255, 60, 70, .75); } }

/* Empty wallet */
.wallet-title { position: absolute; left: 0; right: 0; top: 50px; margin: 0; text-align: center; font-size: 64px; }
.wallet-text { position: absolute; left: 0; right: 0; top: 150px; margin: 0; text-align: center; font-size: 40px; line-height: 1.25; }
.wallet-corner { position: absolute; right: 60px; top: 40px; width: 300px; }
.wallet-corner.a-pop { animation: a-pop .8s var(--ease) both, float 3s ease-in-out 1s infinite alternate; }

/* Question */
.q-head { position: absolute; left: 300px; top: 58px; right: 260px; display: flex; align-items: baseline; gap: 24px; }
.q-num { font-family: Marvin, Lazzer, sans-serif; font-weight: 700; font-size: 90px; line-height: 1; }
.q-head h1 { margin: 0; font-size: 60px; line-height: 1.05; }
.q-timer { position: absolute; left: 1616px; top: -4px; width: 209px; height: 209px; object-fit: cover; mix-blend-mode: screen; }
.q-lines { position: absolute; left: 447px; right: 260px; top: 190px; margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 28px; font-size: 40px; line-height: 1.15; }
.q-lines dt { font-weight: 700; text-align: right; }
.q-lines dd { margin: 0; }
.q-cards { position: absolute; left: 102px; top: 400px; display: grid; grid-template-columns: repeat(3, 518px); gap: 42px; }
.q-card {
    position: relative; height: 530px; padding: 17px; background: var(--panel);
    border: 3px solid #6a6a6a; border-radius: 22px;
    transition: opacity .6s, filter .6s, scale .6s, border-color .4s, box-shadow .6s;
}
.q-media { position: relative; height: 270px; }
.q-media video { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.q-name { position: absolute; left: 50%; bottom: -24px; translate: -50% 0; padding: 4px 26px; background: #111; border: 2px solid #777; border-radius: 10px; font-size: 28px; font-weight: 700; }
.q-card p { margin: 40px 0 0; font-size: 32px; line-height: 1.15; }
.q-check { position: absolute; right: 14px; bottom: 14px; width: 80px; animation: a-pop .7s var(--ease) .3s both; }
.q-votes { position: absolute; top: -20px; right: -14px; padding: 4px 18px; background: #fff; color: #111; border-radius: 999px; font-size: 26px; font-weight: 700; }
.q-card.wrong { opacity: .35; filter: grayscale(1); scale: .96; }
.q-card.correct { border-color: var(--green); box-shadow: 0 0 0 4px var(--green), 0 0 80px rgba(60, 195, 90, .55); animation: winner 1s var(--ease) both; }
@keyframes winner { 40% { transform: scale(1.07); } }
.q-feedback { position: absolute; left: 102px; right: 400px; bottom: 16px; margin: 0; text-align: center; font-size: 32px; font-weight: 600; color: #8ff0a0; }

/* Skill unlocked */
.unlock-title { position: absolute; left: 0; right: 0; top: 60px; margin: 0; text-align: center; font-size: 76px; }
.unlock-wallet { position: absolute; left: 50%; top: 150px; width: 1100px; margin-left: -550px; mask-image: radial-gradient(closest-side, #000 40%, transparent 72%); }
.unlock-medal {
    position: absolute; left: 50%; top: 170px; width: 300px; margin-left: -150px; z-index: 3;
    filter: drop-shadow(0 0 40px rgba(255, 220, 120, .8));
    animation: medal-fly 3.2s cubic-bezier(.5, 0, .3, 1) .4s both;
}
@keyframes medal-fly {
    0% { opacity: 0; transform: scale(0) rotate(-200deg); }
    25% { opacity: 1; transform: scale(1.15) rotate(0); }
    35%, 55% { transform: scale(1); }
    85% { opacity: 1; transform: translateY(190px) scale(.3); }
    100% { opacity: 0; transform: translateY(210px) scale(.12); }
}
.unlock-pill { position: absolute; left: 0; right: 0; top: 830px; display: flex; justify-content: center; }

/* Skill card */
.skill-wallet { position: absolute; left: 326px; top: 40px; width: 220px; rotate: -6deg; z-index: 2; }
.skill-unlocked { position: absolute; left: 600px; top: 40px; margin: 0; font-size: 56px; }
.skill-box { position: absolute; left: 396px; top: 128px; right: 40px; height: 340px; padding: 40px 50px 0 210px; border: 3px solid var(--line); border-radius: 28px; }
.skill-box h3 { margin: 0 0 18px; font-size: 56px; line-height: 1.05; }
.skill-box p { margin: 0; font-size: 40px; line-height: 1.25; }
.skill-medal { position: absolute; left: 1200px; top: 500px; width: 380px; filter: drop-shadow(0 0 50px rgba(255, 220, 120, .55)); }
.skill-medal.a-zoom { animation: a-zoom 1.1s var(--ease) var(--d) both, float 3s ease-in-out 2s infinite alternate; }
@keyframes float { to { transform: translateY(-18px) rotate(3deg); } }

/* Full wallet */
.wf { position: absolute; left: 290px; right: 560px; top: 40px; bottom: 36px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.wf h2 { margin: 0; font-size: 52px; line-height: 1.1; }
.wf-medals { display: flex; gap: 22px; margin-top: 36px; }
.wf-medals figure { margin: 0; width: 180px; }
.wf-medals img { width: 150px; margin: 0 auto; }
.wf-medals figcaption { margin-top: 8px; font-size: 18px; font-weight: 700; text-transform: uppercase; }
.wf-wallet { width: 250px; margin-top: 20px; }
.wf .btn { margin-top: auto; }
.wf-manager { position: absolute; right: 40px; bottom: 0; height: 900px; }

/* Final ranking */
.rk-logo { position: absolute; left: 6px; top: -30px; width: 500px; }
.rk-powered { position: absolute; left: 753px; top: -6px; width: 320px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 24px; font-weight: 700; }
.rk-powered img { width: 320px; }
.rk-title { position: absolute; left: 0; right: 0; top: 330px; margin: 0; text-align: center; font-size: 64px; }
.rk-list { list-style: none; position: absolute; left: 520px; top: 450px; width: 820px; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.rk-list li { display: flex; align-items: center; gap: 18px; font-size: 40px; }
.rk-medal { width: 84px; font-size: 64px; text-align: center; }
.rk-row { flex: 1; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: #1a1a1a; border: 3px solid #ddd; border-radius: 999px; }
.rk-row b { font-size: 28px; }
.rk1 .rk-row { background: var(--btn); border-color: #fff; scale: 1.06; box-shadow: 0 0 40px rgba(255, 60, 70, .6); }
.rk-checks { margin-left: auto; display: flex; gap: 6px; }
.rk-checks img { width: 40px; }

/* Confetti */
.confetti { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -40px; width: 14px; height: 22px; border-radius: 3px; animation: confetti var(--t) cubic-bezier(.3, .6, .6, 1) var(--d) both; }
@keyframes confetti { to { transform: translate(var(--x), 1150px) rotate(var(--r)); } }

/* Live ranking sidebar */
.side { width: 0; flex: none; overflow: hidden auto; background: #141414; border-left: 0 solid var(--red); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.with-side .side { width: 420px; border-left-width: 4px; }
.side > * { width: 416px; }
.side-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; background: #141414; font-size: 24px; font-weight: 700; text-transform: uppercase; }
.side-head b { padding: 4px 14px; background: var(--btn); border-radius: 999px; font-size: 20px; }
.rank { position: relative; margin: 0 12px 12px; }
.rank-row {
    position: absolute; left: 0; width: 392px; height: 30px; padding: 0 10px; display: flex; align-items: center; gap: 10px;
    background: #232323; border: 1px solid #3a3a3a; border-radius: 8px; font-size: 17px;
    transition: transform .9s cubic-bezier(.3, 1.3, .5, 1), background .4s;
    animation: a-pop .5s var(--ease) both;
}
.rank-n { width: 26px; font-weight: 700; text-align: center; }
.rank-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-mark { font-weight: 700; }
.rank-mark.sent { color: #ffd54a; animation: blink 1s infinite; }
.rank-mark.ok { color: var(--green); }
.rank-mark.ko { color: #ff5a5a; }
.rank-score { color: #bbb; font-size: 15px; }
.pos1 { background: linear-gradient(90deg, #c8961a, #6e520c); border-color: #f0c040; }
.pos2 { background: linear-gradient(90deg, #9aa3ad, #4d545b); border-color: #d0d6dc; }
.pos3 { background: linear-gradient(90deg, #b06a32, #5a3517); border-color: #d89058; }
@keyframes blink { 50% { opacity: .2; } }

.toolbar {
    position: fixed; left: 8px; top: 8px; z-index: 10; display: flex; gap: 6px; align-items: center;
    padding: 6px 10px; background: rgba(0, 0, 0, .8); border-radius: 10px; font-size: 13px;
    opacity: 0; transition: opacity .3s;
}
.toolbar:hover, .toolbar:focus-within { opacity: 1; }
.toolbar button, .toolbar a { padding: 4px 8px; color: inherit; text-decoration: none; background: #333; border: 0; border-radius: 6px; }
.toolbar .danger { background: var(--btn); }

/* ---------- Phone ---------- */
.phone { min-height: 100dvh; display: flex; flex-direction: column; background: var(--panel); }
.ph-head { flex: none; height: 130px; display: flex; align-items: center; justify-content: center; border-bottom: 4px solid #111; }
.ph-head img { height: 112px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.ph-body { flex: 1; display: flex; flex-direction: column; padding: 24px 18px 40px; }
.ph-body h1 { margin: 8px 0; font-size: 28px; line-height: 1.15; }
.ph-body p { margin: 0; font-size: 18px; line-height: 1.35; color: #ddd; }
.ph-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.ph-join { display: flex; flex-direction: column; gap: 16px; margin-top: 12vh; }
.ph-join input { font: inherit; font-size: 20px; padding: 14px 16px; color: #fff; background: #111; border: 2px solid #555; border-radius: 14px; }
.ph-join input:focus { outline: none; border-color: var(--btn); }
.ph-join .btn { justify-content: center; font-size: 24px; }
.ph-icon { width: 110px; height: 110px; display: grid; place-items: center; background: #fff; color: #111; border-radius: 50%; font-size: 60px; font-weight: 700; }
.ph-result { width: 150px; height: 150px; display: grid; place-items: center; border-radius: 50%; font-size: 96px; font-weight: 700; }
.ph-result.ok { background: var(--green); }
.ph-result.ko { background: var(--btn); }
.ph-pos { margin-top: 14px !important; padding: 10px 22px; background: #111; border-radius: 999px; font-size: 22px !important; color: #fff !important; }
.ph-qnum { color: #ff6b6b !important; font-size: 14px !important; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ph-question h1 { font-size: 24px; }
.ph-card {
    width: 100%; margin-top: 12px; padding: 10px; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
    background: #1a1a1a; border: 2px solid #555; border-radius: 16px; text-align: left; font-size: 16px; line-height: 1.3;
    transition: transform .1s, border-color .1s;
}
.ph-card:active { transform: scale(.97); border-color: #fff; }
.ph-card img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.ph-card b { display: block; color: #ff5a5a; font-size: 18px; text-transform: uppercase; }
.ph-medal { width: 180px; }
.ph-trophy { font-size: 110px; }
.spinner { width: 48px; height: 48px; border: 5px solid #444; border-top-color: var(--btn); border-radius: 50%; animation: spin 1s linear infinite; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 40px; background: var(--panel); border: 3px solid #111; border-radius: 28px; }
.login-box img { width: 220px; margin: 0 auto; }
.login-box input { font: inherit; font-size: 20px; padding: 14px 16px; color: #fff; background: #111; border: 2px solid #555; border-radius: 14px; }
.login-box .btn { justify-content: center; }
.sessions-box { width: min(640px, 100%); }
.session-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #111; border-radius: 14px; }
.session-row b { font-size: 24px; letter-spacing: 2px; }
.session-row span { flex: 1; color: #bbb; }
.session-row a, .session-row button { padding: 8px 16px; color: #fff; text-decoration: none; background: #333; border: 0; border-radius: 10px; font: inherit; cursor: pointer; }
.session-row .danger { background: var(--btn); }
.err { margin: 0; color: #ff8a8a; text-align: center; }

/* ---------- Reconnect overlay ---------- */
#components-reconnect-modal { display: none; position: fixed; inset: 0; z-index: 100; place-items: center; background: rgba(0, 0, 0, .65); font-size: 22px; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: grid; }
