@font-face {
    font-family: 'Druckschrift_BY_WOK';
    src: url('../fonts/Druckschrift_BY_WOK.woff') format('woff');
    font-display: swap;
}

@font-face {
    font-family: 'Dr_hh_1';
    src: url('../fonts/Dr_hh_1.woff') format('woff');
    font-display: swap;
}

* {
    box-sizing: border-box;
}

:root {
    --quiz-spielfeld-text-hoehe: min(33vh, 380px);
    --quiz-antwort-text-hoehe: calc(var(--quiz-spielfeld-text-hoehe) * 0.6833333333);
    --quiz-bild-offset-top: 0px;
    --quiz-bild-offset-bottom: 0px;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    background: #8ed8ff;
    color: #f2f6ff;
}

/* Buttons/Form-Elemente nutzen sonst oft Browser-Standardschrift statt body-Schrift */
#quizshow-app,
#quizshow-app button,
#quizshow-app input,
#quizshow-app select,
#quizshow-app textarea {
    font-family: inherit;
}

#quizshow-app {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 2vh 2.2vw 3vh;
}

#quizshow-ladehinweis {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    font-size: clamp(1.1rem, 2.4vw, 1.8rem);
    font-weight: 700;
    color: #f7fbff;
    background: #0d2e9b;
}

#quizshow-ladehinweis.ausgeblendet {
    display: none;
}

#quizshow-bg-ebene {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

#quizshow-bg-rahmen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    background: #8ed8ff;
    position: relative;
}

#quizshow-bg-bild {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    display: block;
    position: relative;
    z-index: 2;
}

#quizshow-app.quizshow-modus-normal {
    padding: 0;
}

#quizshow-app.quizshow-modus-normal #quizshow-bg-rahmen {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    background: #ffffff;
}

#quizshow-app.quizshow-modus-normal #quizshow-bg-bild {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

#quizshow-app.quizshow-modus-normal #quizshow-spielfeld {
    position: absolute;
    left: 50%;
    bottom: calc(var(--quiz-bild-offset-bottom, 0px) + 1.8vh);
    transform: translateX(-50%);
    z-index: 3;
}

#quizshow-app.quizshow-modus-normal #quizshow-fragenpunkte {
    bottom: calc(var(--quiz-bild-offset-bottom, 0px) + max(0.6vh, env(safe-area-inset-bottom)));
    z-index: 4;
}

#quizshow-fortschritt {
    position: absolute;
    left: var(--quiz-fortschritt-left, 0px);
    top: var(--quiz-fortschritt-top, 0px);
    width: var(--quiz-fortschritt-width, 1px);
    height: var(--quiz-fortschritt-height, 1px);
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    -webkit-clip-path: polygon(
        var(--quiz-fort-p-tl-x, 0%) var(--quiz-fort-p-tl-y, 0%),
        var(--quiz-fort-p-tr-x, 100%) var(--quiz-fort-p-tr-y, 0%),
        var(--quiz-fort-p-br-x, 100%) var(--quiz-fort-p-br-y, 100%),
        var(--quiz-fort-p-bl-x, 0%) var(--quiz-fort-p-bl-y, 100%)
    );
    clip-path: polygon(
        var(--quiz-fort-p-tl-x, 0%) var(--quiz-fort-p-tl-y, 0%),
        var(--quiz-fort-p-tr-x, 100%) var(--quiz-fort-p-tr-y, 0%),
        var(--quiz-fort-p-br-x, 100%) var(--quiz-fort-p-br-y, 100%),
        var(--quiz-fort-p-bl-x, 0%) var(--quiz-fort-p-bl-y, 100%)
    );
}

#quizshow-fortschritt-kacheln {
    width: 100%;
    height: 100%;
    display: block;
}

.quizshow-fortschritt-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.quizshow-fortschritt-svg polygon {
    filter: drop-shadow(0 0 2px rgba(28, 56, 96, 0.35));
}

#quizshow-spielfeld {
    width: min(1180px, calc(var(--quiz-bild-breite, 96vw) * 0.9));
    height: var(--quiz-spielfeld-text-hoehe);
    max-height: var(--quiz-spielfeld-text-hoehe);
    display: grid;
    grid-template-rows: 0.95fr 2.05fr;
    position: relative;
    z-index: 2;
}

#quizshow-fragenpunkte {
    position: absolute;
    left: 50%;
    bottom: max(0.6vh, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    width: min(92vw, 880px);
    pointer-events: none;
}

.quizshow-fragenpunkt {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(244, 252, 255, 0.9);
    box-shadow: 0 0 8px rgba(154, 203, 255, 0.65);
}

@media (max-width: 900px) and (orientation: portrait) {
    #quizshow-app {
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
    }

    #quizshow-fragenpunkte {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        margin: 0.4vh auto 0;
        width: min(94vw, 640px);
    }

    .quizshow-fragenpunkt {
        width: 8px;
        height: 8px;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    .quizshow-fragenpunkt {
        background: rgba(92, 163, 255, 0.95);
        box-shadow: 0 0 8px rgba(68, 140, 255, 0.78);
    }
}

#quizshow-frage {
    width: 100%;
    min-height: clamp(88px, 14vh, 176px);
    margin-bottom: 2.2vh;
    border: 3px solid rgba(184, 209, 255, 0.45);
    border-radius: 22px;
    background: linear-gradient(180deg, #253db8 0%, #0d2e9b 100%);
    box-shadow: inset 0 0 0 2px rgba(230, 239, 255, 0.28), 0 12px 28px rgba(0, 0, 0, 0.5);
    color: #f7fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: clamp(1.25rem, 2.7vw, 2rem);
    font-weight: 700;
    padding: 1.5vh 1.5vw;
}

#quizshow-frage .frage-inhalt {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.8rem;
}

.quizshow-option .option-inhalt {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.8rem;
    overflow: hidden;
}

#quizshow-frage .frage-inhalt p,
.quizshow-option .option-inhalt p {
    margin: 0;
    width: 100%;
    max-width: 100%;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

#quizshow-frage img,
.quizshow-option img,
#quizshow-frage .bild,
.quizshow-option .bild {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

#quizshow-antworten {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 1.7vh 1.2vw;
    min-height: 0;
    height: 100%;
}

.quizshow-option {
    min-height: 0;
    height: 100%;
    border: 3px solid rgba(196, 219, 255, 0.45);
    border-radius: 18px;
    background: linear-gradient(180deg, #1d3cae 0%, #09257f 100%);
    color: #f7fbff;
    box-shadow: inset 0 0 0 2px rgba(227, 236, 255, 0.26), 0 10px 22px rgba(0, 0, 0, 0.44);
    display: flex;
    align-items: center;
    padding: 0.8vh 1vw;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 180ms ease;
}

.quizshow-option:hover {
    transform: translateY(-1px);
}

.quizshow-option:disabled {
    cursor: default;
    opacity: 0.96;
}

.quizshow-buchstabe {
    flex: 0 0 auto;
    width: clamp(36px, 3.8vw, 56px);
    height: clamp(36px, 3.8vw, 56px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.38);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.05rem, 2.2vw, 1.6rem);
    font-weight: 700;
    margin-right: 0.8vw;
}

.quizshow-buchstabe-leer {
    background: white;
    border-color: white;
}

.quizshow-option.korrekt-glow {
    box-shadow: 0 0 14px rgba(0, 255, 110, 0.88), 0 0 34px rgba(0, 255, 110, 0.62), inset 0 0 12px rgba(0, 255, 110, 0.42);
}

.quizshow-option.falsch-glow {
    box-shadow: 0 0 14px rgba(255, 55, 55, 0.88), 0 0 34px rgba(255, 55, 55, 0.62), inset 0 0 12px rgba(255, 55, 55, 0.42);
}

#quizshow-spielfeld .geld-render {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    overflow: hidden;
    gap: 0.6vh 0.6vw;
    padding: 0.6vh 0.6vw;
}

#quizshow-spielfeld .geldteil-wrap {
    position: relative;
    display: block;
}

#quizshow-spielfeld .geldteil-img {
    display: block;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#quizshow-spielfeld .geldteil-img.geld-rot {
    transform: translate(-50%, -50%) rotate(90deg);
}

#quizshow-spielfeld .geldteil-wrap[data-ist-schein="1"] .geldteil-img {
    border-radius: 0;
}

#quizshow-spielfeld .geldrechnen-zeichen > span {
    display: block;
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 700;
}

#quizshow-frage,
#quizshow-antworten .quizshow-option {
    overflow: hidden;
}

#quizshow-frage.quizshow-quadratisch {
    width: clamp(176px, 28vh, 352px);
    height: clamp(176px, 28vh, 352px);
    min-height: clamp(176px, 28vh, 352px);
    max-width: min(92vw, calc(var(--quiz-bild-breite, 96vw) * 0.9));
    aspect-ratio: 1 / 1;
    padding: 1.6vh 1vw;
    margin-left: auto;
    margin-right: auto;
}

#quizshow-frage.quizshow-quadratisch .frage-inhalt {
    flex-direction: column;
}

#quizshow-frage.quizshow-quadratisch .frage-inhalt > * {
    max-height: 90%;
}

#quizshow-antworten.quizshow-antwortbildmodus {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
}

#quizshow-antworten.quizshow-antwortbildmodus .quizshow-option {
    min-height: 0;
    height: 100%;
}

#quizshow-app.quizshow-fragebildmodus #quizshow-spielfeld {
    height: auto;
    max-height: none;
    min-height: 0;
    grid-template-rows: auto var(--quiz-antwort-text-hoehe);
}

#quizshow-antworten.quizshow-antwortbildmodus .quizshow-option .option-inhalt {
    flex-direction: column;
}

#quizshow-abschluss {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 8, 22, 0.88);
    z-index: 200;
    padding: 2vh 2vw;
}

#quizshow-abschluss .quizshow-feuerwerk {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

#quizshow-abschluss .quizshow-feuerwerk-burst {
    position: absolute;
    left: var(--fw-x, 50%);
    top: var(--fw-y, 50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fw-farbe, #ffd34d);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
    animation: quizshow-feuerwerk-kern var(--fw-dauer, 2s) ease-out var(--fw-delay, 0s) infinite;
}

#quizshow-abschluss .quizshow-feuerwerk-burst::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    transform: translate(-50%, -50%) scale(0.2);
    box-shadow:
        0 -28px 0 0 var(--fw-farbe, #ffd34d),
        20px -20px 0 0 var(--fw-farbe, #ffd34d),
        28px 0 0 0 var(--fw-farbe, #ffd34d),
        20px 20px 0 0 var(--fw-farbe, #ffd34d),
        0 28px 0 0 var(--fw-farbe, #ffd34d),
        -20px 20px 0 0 var(--fw-farbe, #ffd34d),
        -28px 0 0 0 var(--fw-farbe, #ffd34d),
        -20px -20px 0 0 var(--fw-farbe, #ffd34d);
    animation: quizshow-feuerwerk-strahlen var(--fw-dauer, 2s) ease-out var(--fw-delay, 0s) infinite;
}

#quizshow-abschluss.aktiv {
    display: flex;
}

.quizshow-abschlussbox {
    width: min(640px, 94vw);
    border-radius: 20px;
    border: 3px solid rgba(203, 224, 255, 0.45);
    background: linear-gradient(180deg, #0f2d92 0%, #06175b 100%);
    box-shadow: inset 0 0 0 2px rgba(233, 242, 255, 0.24), 0 12px 30px rgba(0, 0, 0, 0.5);
    padding: 2.2rem 1.5rem;
    text-align: center;
}

.quizshow-abschlussbox.quizshow-abschlussbox-spezial {
    border: 3px solid rgba(255, 226, 120, 0.72);
    background: linear-gradient(180deg, #3558cf 0%, #142a7e 55%, #0f1f60 100%);
    box-shadow: inset 0 0 0 2px rgba(255, 243, 184, 0.34), 0 0 24px rgba(255, 214, 64, 0.45), 0 12px 30px rgba(0, 0, 0, 0.5);
}

.quizshow-abschlussbox.quizshow-abschlussbox-spezial h2 {
    color: #ffe998;
    text-shadow: 0 0 10px rgba(255, 226, 120, 0.42);
}

.quizshow-abschlussbox.quizshow-abschlussbox-spezial-animiert {
    animation: quizshow-gewinn-reinfliegen 820ms cubic-bezier(0.16, 0.86, 0.22, 1), quizshow-gewinn-drehen 3.8s ease-in-out 900ms infinite;
    transform-origin: center center;
}

@keyframes quizshow-gewinn-reinfliegen {
    0% {
        opacity: 0;
        transform: translate(85vw, -58vh) rotate(0deg) scale(0.55);
    }
    55% {
        opacity: 1;
        transform: translate(-3vw, 2vh) rotate(390deg) scale(1.06);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(360deg) scale(1);
    }
}

@keyframes quizshow-gewinn-drehen {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(1.6deg) scale(1.01);
    }
    50% {
        transform: rotate(0deg) scale(1.02);
    }
    75% {
        transform: rotate(-1.6deg) scale(1.01);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

@keyframes quizshow-feuerwerk-kern {
    0%,
    22% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    65% {
        opacity: 0.55;
        transform: translate(-50%, -50%) scale(0.7);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.15);
    }
}

@keyframes quizshow-feuerwerk-strahlen {
    0%,
    20% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.15);
    }
    38% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.85);
    }
}

.quizshow-abschlussbox h2 {
    margin: 0 0 1rem 0;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
}

.quizshow-fehlerzahl {
    margin: 0 0 1.4rem 0;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.quizshow-abschluss-sticker-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 1rem 0;
}

.quizshow-abschluss-sticker {
    max-width: min(220px, 46vw);
    max-height: min(220px, 24vh);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.quizshow-neustart {
    border: 2px solid rgba(214, 229, 255, 0.55);
    border-radius: 12px;
    padding: 0.7rem 1.15rem;
    font-size: 1rem;
    color: #f9fcff;
    background: linear-gradient(180deg, #2957d0 0%, #0f3aa5 100%);
    cursor: pointer;
}

.quizshow-neustart:hover {
    filter: brightness(1.08);
}

@media (max-width: 840px) and (orientation: portrait) {
    #quizshow-spielfeld {
        width: min(98vw, calc(var(--quiz-bild-breite, 98vw) * 0.9));
        height: auto;
        max-height: none;
    }

    #quizshow-antworten {
        grid-template-columns: 1fr;
    }

    #quizshow-antworten.quizshow-quadratisch {
        grid-template-columns: 1fr;
    }

    #quizshow-antworten.quizshow-antwortbildmodus {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (orientation: portrait) and (max-width: 1024px) {
    #quizshow-app {
        padding: 1.2vh 2vw 2.2vh;
        justify-content: flex-end;
    }

    #quizshow-bg-ebene {
        align-items: flex-start;
        justify-content: center;
        padding-top: max(0px, env(safe-area-inset-top));
    }

    #quizshow-bg-rahmen {
        width: 100%;
    }

    #quizshow-bg-bild {
        max-width: 100vw;
        max-height: 56vh;
    }

    #quizshow-spielfeld {
        width: min(98vw, calc(var(--quiz-bild-breite, 98vw) * 0.98));
        height: min(42vh, 520px);
        max-height: min(42vh, 520px);
        grid-template-rows: auto 1fr;
    }

    #quizshow-frage {
        min-height: clamp(74px, 11vh, 136px);
        margin-bottom: 1.2vh;
    }

    #quizshow-antworten {
        gap: 1vh 1vw;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    #quizshow-bg-bild {
        max-height: 52vh;
    }

    #quizshow-spielfeld {
        height: min(44vh, 560px);
        max-height: min(44vh, 560px);
    }

    #quizshow-antworten {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, minmax(0, 1fr));
    }

    #quizshow-antworten.quizshow-antwortbildmodus {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, minmax(0, 1fr));
    }

    .quizshow-option {
        padding: 0.6vh 1.8vw;
    }
}

@media (orientation: landscape) and (max-width: 900px) and (max-height: 520px) {
    #quizshow-app {
        padding: 1vh 1.5vw 1.4vh;
    }

    #quizshow-bg-bild {
        max-height: 100vh;
    }

    #quizshow-spielfeld {
        width: min(96vw, calc(var(--quiz-bild-breite, 96vw) * 0.88));
        height: min(52vh, 320px);
        max-height: min(52vh, 320px);
        grid-template-rows: auto 1fr;
    }

    #quizshow-frage {
        min-height: clamp(58px, 16vh, 98px);
        margin-bottom: 0.8vh;
        padding: 1vh 1vw;
    }

    #quizshow-antworten {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        gap: 0.9vh 0.9vw;
    }

    #quizshow-antworten.quizshow-antwortbildmodus {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
    }

    .quizshow-option {
        padding: 0.45vh 0.8vw;
    }
}
