/* Quiz theme: answer colours, stage themes, ornament, animations, timer ring, bars. Plain CSS, prefix qz-. */

/* ---------- answer colours: white text, AA contrast in light and dark ---------- */
.qz-c0, .qz-c1, .qz-c2, .qz-c3, .qz-c4, .qz-c5 { --qz-on: #ffffff; background-color: var(--qz-c); color: var(--qz-on); }
.qz-c0 { --qz-c: #0b7a72; }   /* turquoise */
.qz-c1 { --qz-c: #bd4f0d; }   /* apricot orange */
.qz-c2 { --qz-c: #6a48c4; }   /* violet */
.qz-c3 { --qz-c: #b42358; }   /* raspberry */
.qz-c4 { --qz-c: #4f6b17; }   /* steppe olive */
.qz-c5 { --qz-c: #1c66a8; }   /* deep sky */
:root[data-theme="dark"] .qz-c0 { --qz-c: #0d8178; }
:root[data-theme="dark"] .qz-c1 { --qz-c: #c2530f; }
:root[data-theme="dark"] .qz-c2 { --qz-c: #7a5ad4; }
:root[data-theme="dark"] .qz-c3 { --qz-c: #c4366a; }
:root[data-theme="dark"] .qz-c4 { --qz-c: #5b7a1c; }
:root[data-theme="dark"] .qz-c5 { --qz-c: #2875ba; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .qz-c0 { --qz-c: #0d8178; }
    :root:not([data-theme="light"]) .qz-c1 { --qz-c: #c2530f; }
    :root:not([data-theme="light"]) .qz-c2 { --qz-c: #7a5ad4; }
    :root:not([data-theme="light"]) .qz-c3 { --qz-c: #c4366a; }
    :root:not([data-theme="light"]) .qz-c4 { --qz-c: #5b7a1c; }
    :root:not([data-theme="light"]) .qz-c5 { --qz-c: #2875ba; }
}
.qz-shape { width: 1.4em; height: 1.4em; flex: none; vertical-align: middle; }

/* ---------- stage themes (--qz-fg: readable text on the stage, --qz-panel: cards on top) ---------- */
.qz-theme-steppe, .qz-theme-lake, .qz-theme-night, .qz-theme-felt {
    color: var(--qz-fg);
    background-repeat: no-repeat;
}
.qz-theme-steppe {
    --qz-fg: #2a2116; --qz-fg-muted: #5c4a2e; --qz-panel: rgba(255, 252, 244, .86);
    background-color: #f3dfb3;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 110Q220 40 470 100T900 80T1200 70V200H0z' fill='%23b49a52' fill-opacity='.35'/%3E%3Cpath d='M0 150Q300 90 620 140T1200 120V200H0z' fill='%238a8a3c' fill-opacity='.35'/%3E%3C/svg%3E"),
        radial-gradient(circle at 82% 18%, rgba(255, 244, 214, .9) 0 60px, rgba(255, 236, 190, 0) 180px),
        linear-gradient(180deg, #fbefd6 0%, #f3dfb3 55%, #e3c88a 100%);
    background-size: 100% 32%, auto, auto;
    background-position: bottom, 0 0, 0 0;
}
:root[data-theme="dark"] .qz-theme-steppe {
    --qz-fg: #f6ead2; --qz-fg-muted: #d5c3a1; --qz-panel: rgba(40, 32, 44, .82);
    background-color: #3a2c2c;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 110Q220 40 470 100T900 80T1200 70V200H0z' fill='%23000' fill-opacity='.22'/%3E%3Cpath d='M0 150Q300 90 620 140T1200 120V200H0z' fill='%23000' fill-opacity='.25'/%3E%3C/svg%3E"),
        radial-gradient(circle at 82% 18%, rgba(255, 196, 120, .35) 0 50px, rgba(255, 196, 120, 0) 170px),
        linear-gradient(180deg, #2b2235 0%, #4a3328 60%, #5b4128 100%);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .qz-theme-steppe {
        --qz-fg: #f6ead2; --qz-fg-muted: #d5c3a1; --qz-panel: rgba(40, 32, 44, .82);
        background-color: #3a2c2c;
        background-image:
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 110Q220 40 470 100T900 80T1200 70V200H0z' fill='%23000' fill-opacity='.22'/%3E%3Cpath d='M0 150Q300 90 620 140T1200 120V200H0z' fill='%23000' fill-opacity='.25'/%3E%3C/svg%3E"),
            radial-gradient(circle at 82% 18%, rgba(255, 196, 120, .35) 0 50px, rgba(255, 196, 120, 0) 170px),
            linear-gradient(180deg, #2b2235 0%, #4a3328 60%, #5b4128 100%);
    }
}
.qz-theme-lake {
    --qz-fg: #f2fbfc; --qz-fg-muted: #c4e3e8; --qz-panel: rgba(6, 40, 56, .72);
    background-color: #0d5a72;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 240' preserveAspectRatio='none'%3E%3Cpath d='M0 240V170L140 92L230 150L360 52L480 140L600 72L720 150L860 60L980 140L1100 90L1200 140V240z' fill='%23fff' fill-opacity='.09'/%3E%3Cpath d='M340 64L360 52L382 68L368 66zM585 82L600 72L618 86L602 84zM842 72L860 60L882 78L864 74z' fill='%23fff' fill-opacity='.3'/%3E%3Cpath d='M0 240V205Q300 190 600 205T1200 200V240z' fill='%23003a4f' fill-opacity='.35'/%3E%3C/svg%3E"),
        linear-gradient(165deg, #0b3f5c 0%, #0f6a80 50%, #117a73 100%);
    background-size: 100% 38%, auto;
    background-position: bottom, 0 0;
}
.qz-theme-night {
    --qz-fg: #eef1ff; --qz-fg-muted: #b9c0e0; --qz-panel: rgba(22, 24, 52, .78);
    background-color: #141634;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='%23fff'%3E%3Ccircle cx='20' cy='30' r='1.2' opacity='.7'/%3E%3Ccircle cx='90' cy='12' r='.8' opacity='.5'/%3E%3Ccircle cx='160' cy='48' r='1.5' opacity='.8'/%3E%3Ccircle cx='60' cy='95' r='.9' opacity='.45'/%3E%3Ccircle cx='130' cy='120' r='1.1' opacity='.6'/%3E%3Ccircle cx='200' cy='150' r='.8' opacity='.5'/%3E%3Ccircle cx='35' cy='170' r='1.4' opacity='.7'/%3E%3Ccircle cx='110' cy='200' r='.7' opacity='.4'/%3E%3Ccircle cx='185' cy='92' r='.6' opacity='.4'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 50% 120%, rgba(90, 80, 200, .45), rgba(90, 80, 200, 0) 60%),
        linear-gradient(180deg, #0c0e24 0%, #1a1c48 100%);
    background-repeat: repeat, no-repeat, no-repeat;
}
.qz-theme-felt {
    --qz-fg: #fff6e8; --qz-fg-muted: #f0d6b8; --qz-panel: rgba(60, 14, 22, .8);
    background-color: #7a1b29;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='-48 -48 96 96' fill='none' stroke='%23f2c46d' stroke-opacity='.22' stroke-width='5' stroke-linecap='round'%3E%3Cg id='h'%3E%3Cpath d='M0 0C10 -3 17 -10 14 -19C12 -25 4 -24 5 -18'/%3E%3Cpath d='M0 0C-10 -3 -17 -10 -14 -19C-12 -25 -4 -24 -5 -18'/%3E%3C/g%3E%3Cuse href='%23h' transform='rotate(180)'/%3E%3Ccircle r='3' fill='%23f2c46d' fill-opacity='.22' stroke='none'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 50% 40%, rgba(160, 40, 52, .9), rgba(90, 18, 30, 1) 75%);
    background-repeat: repeat, no-repeat;
    background-size: 96px 96px, cover;
}

/* ---------- ornament: tunduk (yurt crown) with ram's-horn curls, tinted by the current text colour ---------- */
.qz-ornament { position: relative; isolation: isolate; }
.qz-ornament::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    pointer-events: none;
    background: currentColor;
    opacity: .08;
    --qz-orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='70' cy='70' r='21'/%3E%3Ccircle cx='70' cy='70' r='16'/%3E%3Cpath d='M56 64Q70 60 84 64M54 70H86M56 76Q70 80 84 76M64 56Q60 70 64 84M70 54V86M76 56Q80 70 76 84'/%3E%3Cg id='r'%3E%3Cpath d='M70 44V36M70 36C76 34 79 29 76 25C74 22 70 24 72 27M70 36C64 34 61 29 64 25C66 22 70 24 68 27'/%3E%3C/g%3E%3Cuse href='%23r' transform='rotate(90 70 70)'/%3E%3Cuse href='%23r' transform='rotate(180 70 70)'/%3E%3Cuse href='%23r' transform='rotate(270 70 70)'/%3E%3Cg id='c'%3E%3Cpath d='M0 0C8 2 12 8 9 13C7 16 3 15 4 12M0 0C2 8 8 12 13 9C16 7 15 3 12 4'/%3E%3C/g%3E%3Cuse href='%23c' transform='translate(140 0) scale(-1 1)'/%3E%3Cuse href='%23c' transform='translate(0 140) scale(1 -1)'/%3E%3Cuse href='%23c' transform='translate(140 140) scale(-1 -1)'/%3E%3C/svg%3E");
    -webkit-mask: var(--qz-orn) 0 0 / 140px 140px repeat;
    mask: var(--qz-orn) 0 0 / 140px 140px repeat;
}

/* ---------- animations ---------- */
@keyframes qz-pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes qz-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes qz-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes qz-rise { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes qz-bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes qz-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes qz-count { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.7); opacity: 0; } }

.qz-pop { animation: qz-pop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
.qz-shake { animation: qz-shake .4s ease-in-out; }
.qz-pulse { animation: qz-pulse 1s ease-in-out infinite; }
.qz-rise { animation: qz-rise .8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom; }
.qz-rise.qz-d1 { animation-delay: .4s; }
.qz-rise.qz-d2 { animation-delay: .8s; }
.qz-rise.qz-d3 { animation-delay: 1.2s; }
.qz-bar-grow { animation: qz-bar-grow .8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom; }
.qz-float { animation: qz-float 3s ease-in-out infinite; }

/* 3-2-1 from QuizFx.countdown */
.qz-count { display: inline-block; font-size: clamp(80px, 22vw, 220px); font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; animation: qz-count 1s ease-out both; }

/* ---------- timer ring from QuizFx.ring ---------- */
.qz-ring { --qz-ring-c: #0b7a72; position: relative; display: inline-grid; place-items: center; width: 84px; height: 84px; }
.qz-ring svg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.qz-ring circle { fill: none; stroke-width: 9; }
.qz-ring-track { stroke: currentColor; opacity: .15; }
.qz-ring-bar { stroke: var(--qz-ring-c); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .4s; }
.qz-ring-num { position: relative; font-size: 1.9em; font-weight: 800; font-variant-numeric: tabular-nums; }
.qz-ring-warm { --qz-ring-c: #d98a14; }
.qz-ring-hot { --qz-ring-c: #d63a3a; animation: qz-pulse .5s ease-in-out infinite; }
.qz-ring-hot .qz-ring-num { color: #d63a3a; }
:root[data-theme="dark"] .qz-ring { --qz-ring-c: #2bb3a6; }
:root[data-theme="dark"] .qz-ring-warm { --qz-ring-c: #f0a73a; }
:root[data-theme="dark"] .qz-ring-hot, :root[data-theme="dark"] .qz-ring-hot .qz-ring-num { --qz-ring-c: #ff6b6b; color: #ff6b6b; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .qz-ring { --qz-ring-c: #2bb3a6; }
    :root:not([data-theme="light"]) .qz-ring-warm { --qz-ring-c: #f0a73a; }
    :root:not([data-theme="light"]) .qz-ring-hot,
    :root:not([data-theme="light"]) .qz-ring-hot .qz-ring-num { --qz-ring-c: #ff6b6b; color: #ff6b6b; }
}

/* ---------- bars from QuizFx.bars: .qz-bars > .qz-bar > .qz-bar-num + .qz-bar-fill ---------- */
.qz-bars { display: flex; align-items: flex-end; justify-content: center; gap: 12px; height: 220px; }
.qz-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; flex: 1 1 0;
    max-width: 120px; height: 100%; background: none; color: inherit; }
.qz-bar-num { font-weight: 800; font-size: 1.3em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.qz-bar-fill { width: 100%; min-height: 6px; height: calc(var(--qz-v, 0) * 85%); border-radius: 8px 8px 3px 3px;
    background: var(--qz-c, currentColor); transition: height .9s cubic-bezier(.2, .8, .2, 1); }
.qz-bars-h { flex-direction: column; align-items: stretch; height: auto; }
.qz-bars-h .qz-bar { flex-direction: row-reverse; justify-content: flex-end; max-width: none; height: 34px; }
.qz-bars-h .qz-bar-num { margin: 0 0 0 8px; }
.qz-bars-h .qz-bar-fill { width: calc(var(--qz-v, 0) * 85%); height: 100%; min-width: 6px; border-radius: 3px 8px 8px 3px;
    transition: width .9s cubic-bezier(.2, .8, .2, 1); }

/* ---------- reduced motion: no movement, just the final state ---------- */
@media (prefers-reduced-motion: reduce) {
    .qz-pop, .qz-shake, .qz-pulse, .qz-rise, .qz-bar-grow, .qz-float, .qz-count, .qz-ring-hot {
        animation: none !important;
    }
    .qz-ring-bar, .qz-bar-fill { transition: none !important; }
}
