* {
    box-sizing: border-box;
}

:root {
    --hintergrund: #182133;
    --karte: #25324a;
    --karte-hell: #31405c;
    --schrift: #f8f2d5;
    --gelb: #ffd447;
    --glas: rgba(206, 236, 255, 0.25);
    --glas-rand: rgba(222, 245, 255, 0.92);
}

html {
    min-height: 100%;
    background: var(--hintergrund);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--schrift);
    font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 212, 71, 0.10), transparent 28%),
        radial-gradient(circle at 85% 30%, rgba(74, 163, 255, 0.11), transparent 25%),
        linear-gradient(180deg, #1b263a, #111827);
    overscroll-behavior: none;
}

button {
    font: inherit;
}

.spiel {
    width: min(100%, 820px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 14px 30px;
    position: relative;
}

.kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

h1 {
    margin: 0;
    color: var(--gelb);
    font-size: clamp(1.65rem, 7vw, 2.7rem);
    line-height: 1;
    text-shadow: 3px 3px 0 #8d5d00;
    transform: rotate(-1deg);
}

.mini-titel {
    margin: 0 0 4px;
    opacity: 0.75;
    font-size: 0.82rem;
}

.kleiner-knopf,
.grosser-knopf {
    border: 3px solid #111827;
    border-radius: 13px;
    background: var(--gelb);
    color: #172033;
    font-weight: 900;
    box-shadow: 0 5px 0 #9e6f00;
    cursor: pointer;
    touch-action: manipulation;
}

.kleiner-knopf {
    min-width: 105px;
    padding: 9px 11px;
}

.kleiner-knopf:active,
.grosser-knopf:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #9e6f00;
}

.anleitung,
.status-bereich {
    background: var(--karte);
    border: 3px solid #111827;
    border-radius: 14px;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.28);
}

.anleitung {
    padding: 11px 13px;
    line-height: 1.35;
    font-size: 0.96rem;
}

.status-bereich {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--karte-hell);
}

.status-text {
    min-height: 1.4em;
    font-weight: 700;
}

.zuganzeige {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 10px;
    background: #111827;
    color: var(--gelb);
    font-weight: 900;
}

.roehren-bereich {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    min-height: 430px;
    margin: 14px 0 4px;
    padding: 8px 0 14px;
}

.roehren-platz {
    min-width: 0;
    height: 400px;
    border: 0;
    padding: 0;
    position: relative;
    background: transparent;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.roehren-platz:focus-visible {
    outline: 4px dashed var(--gelb);
    outline-offset: 2px;
    border-radius: 18px;
}

.roehren-nummer {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border: 3px solid #111827;
    border-radius: 50%;
    background: #f4f0df;
    color: #111827;
    font-weight: 900;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.32);
    z-index: 5;
}

.schwebeplatz {
    position: absolute;
    top: 54px;
    left: 50%;
    width: clamp(60px, 20vw, 92px);
    height: clamp(60px, 20vw, 92px);
    transform: translateX(-50%);
    display: grid;
    place-items: center;
}

.roehre {
    position: absolute;
    left: 50%;
    bottom: 14px;
    width: clamp(82px, 25vw, 126px);
    height: 270px;
    transform: translateX(-50%);
    border: clamp(7px, 2vw, 10px) solid var(--glas-rand);
    border-top: 0;
    border-radius: 0 0 38px 38px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.28), transparent 25%, transparent 72%, rgba(255,255,255,0.15)),
        var(--glas);
    box-shadow:
        inset 0 -10px 18px rgba(80, 170, 220, 0.16),
        0 9px 0 rgba(0, 0, 0, 0.20);
}

.roehre::before,
.roehre::after {
    content: "";
    position: absolute;
    top: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--glas-rand);
}

.roehre::before {
    left: -10px;
}

.roehre::after {
    right: -10px;
}

.kugel-platz {
    position: absolute;
    left: 50%;
    width: clamp(60px, 19vw, 92px);
    height: clamp(60px, 19vw, 92px);
    transform: translateX(-50%);
    display: grid;
    place-items: center;
}

.kugel-platz-unten {
    bottom: 9px;
}

.kugel-platz-mitte {
    bottom: 88px;
}

.kugel-platz-oben {
    bottom: 167px;
}

.kugel {
    width: 88%;
    height: 88%;
    border: 4px solid #111827;
    border-radius: 50%;
    box-shadow:
        inset 10px 12px 0 rgba(255, 255, 255, 0.26),
        inset -8px -10px 0 rgba(0, 0, 0, 0.18),
        0 5px 0 rgba(0, 0, 0, 0.28);
    animation: plopp 180ms ease-out;
}

.kugel.rot,
.mini-kugel.rot {
    background: #ef4c4c;
}

.kugel.gruen,
.mini-kugel.gruen {
    background: #51d36b;
}

.kugel.blau,
.mini-kugel.blau {
    background: #4aa3ff;
}

.kugel.schwebt {
    animation: schweben 700ms ease-in-out infinite alternate;
}

.roehren-platz.ausgewaehlt .roehre {
    filter: drop-shadow(0 0 13px rgba(255, 212, 71, 0.9));
}

.roehren-platz.voll-wackeln .roehre {
    animation: wackeln 260ms ease-in-out;
}

.farb-legende {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 4px;
    font-weight: 800;
}

.farb-legende span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-kugel {
    width: 19px;
    height: 19px;
    display: inline-block;
    border: 2px solid #111827;
    border-radius: 50%;
}

.gewonnen-fenster {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 10, 20, 0.78);
    backdrop-filter: blur(4px);
}

.gewonnen-fenster.versteckt {
    display: none;
}

.gewonnen-inhalt {
    width: min(100%, 430px);
    padding: 28px 22px;
    text-align: center;
    background: #f7f0d2;
    color: #172033;
    border: 5px solid #111827;
    border-radius: 22px;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.35);
    transform: rotate(-1deg);
    animation: gewonnenRein 350ms ease-out;
}

.gewonnen-inhalt h2 {
    margin: 4px 0 8px;
    color: #ef4c4c;
    font-size: 2.5rem;
}

.sternchen {
    color: #e2a800;
    font-size: 2rem;
    letter-spacing: 5px;
}

.gewonnen-zuege {
    margin-bottom: 20px;
}

.grosser-knopf {
    padding: 12px 20px;
    font-size: 1.1rem;
}

@keyframes plopp {
    from {
        opacity: 0;
        transform: scale(0.72);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes schweben {
    from {
        transform: translateY(0) rotate(-2deg);
    }
    to {
        transform: translateY(-8px) rotate(2deg);
    }
}

@keyframes wackeln {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-4deg); }
    75% { transform: translateX(-50%) rotate(4deg); }
}

@keyframes gewonnenRein {
    from {
        opacity: 0;
        transform: rotate(-4deg) scale(0.7);
    }
    to {
        opacity: 1;
        transform: rotate(-1deg) scale(1);
    }
}

@media (min-width: 650px) {
    .spiel {
        padding-top: 28px;
    }

    .roehren-bereich {
        gap: 30px;
    }

    .roehren-platz {
        height: 430px;
    }

    .roehre {
        height: 300px;
    }

    .kugel-platz-unten {
        bottom: 10px;
    }

    .kugel-platz-mitte {
        bottom: 98px;
    }

    .kugel-platz-oben {
        bottom: 186px;
    }
}

@media (max-height: 700px) and (orientation: landscape) {
    .spiel {
        padding-top: 10px;
    }

    .anleitung {
        display: none;
    }

    .roehren-bereich {
        min-height: 330px;
        margin-top: 4px;
    }

    .roehren-platz {
        height: 320px;
    }

    .roehre {
        height: 220px;
    }

    .kugel-platz {
        width: 66px;
        height: 66px;
    }

    .kugel-platz-unten {
        bottom: 7px;
    }

    .kugel-platz-mitte {
        bottom: 72px;
    }

    .kugel-platz-oben {
        bottom: 137px;
    }

    .schwebeplatz {
        top: 40px;
        width: 66px;
        height: 66px;
    }
}
