/* Grundlayout */

.kst-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    background: #04160f;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    padding: 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    color: #fff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    touch-action: manipulation;
    position: relative;
}

/* Oben: Zeit + Buttons */

.kst-panel-top {
    flex: 0 0 auto;
    text-align: center;
    padding-bottom: 4px;
}

.kst-timer {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.kst-main-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.kst-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 3px 0 rgba(0,0,0,0.25);
    text-transform: uppercase;
}

.kst-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.kst-btn-start {
    background: #d62828;
}

.kst-btn-restart {
    background: #2ecc71; /* grün */
}

/* Spielerbuttons */

.kst-player-buttons {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 8px 0;
}

.kst-player-btn {
    background: #1d3557;
    border-radius: 999px;
    padding: 4px 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    color: #fff;
    min-height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kst-player-btn span {
    display: block;
    line-height: 1.1;
}

.kst-player-btn .kst-player-label {
    font-weight: 600;
}

.kst-player-btn .kst-player-time {
    font-size: 0.7rem;
    opacity: 0.9;
}

.kst-player-btn.kst-player-active {
    background: #d62828; /* rot, gut sichtbar */
}

.kst-player-btn.kst-player-done {
    opacity: 0.8;
}

/* Spielfeld */

.kst-playfield-wrapper {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    margin-top: 4px;
}

.kst-playfield {
    flex: 1 1 auto;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
    /* Urwald-Hintergrund Fallback */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.06) 0, transparent 40%),
        radial-gradient(circle at 80% 0%, rgba(255,255,255,0.08) 0, transparent 50%),
        linear-gradient(135deg, #0b5d38, #032b1a);
}

/* Schatzkisten im Spielfeld */

.kst-chest {
    position: absolute;
    width: 60px;
    height: 48px;
    cursor: pointer;
    background: none;
    background-color: transparent;
    border: none;
    box-shadow: none;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.kst-chest::before,
.kst-chest::after {
    content: none;
}

/* Fallback-Dekor der Kiste */


/* Fortschrittsleiste unten im Spielfeld */

.kst-progress {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding-top: 4px;
    min-height: 36px;
    flex-wrap: nowrap;
}

.kst-progress-chest {
    width: 30px;
    height: 24px;
    border-radius: 4px;
    background: linear-gradient(#f4b24b, #b36a12);
    border: 1px solid #5c3b15;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Untere Einstellungen */

.kst-panel-bottom {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.kst-select-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kst-select-group select {
    border-radius: 999px;
    border: none;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* Popups */

.kst-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.kst-popup-chest {
    background: linear-gradient(#f4b24b, #b36a12);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.kst-popup-number {
    font-size: 2.2rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Frosch-Button / Bild */

.kst-frog-btn {
    width: 90px;
    height: 90px;
    font-size: 2.4rem;
    background: #2a9d8f;
    color: #fff;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.kst-frog-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

/* Gewinner-Popup */

.kst-winner-box {
    background: #1d3557;
    border-radius: 18px;
    padding: 20px 24px 24px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.kst-winner-text {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.kst-btn-close-winner {
    margin-top: 8px;
    background: #2a9d8f;
}

/* Konfetti */

.kst-confetti {
    pointer-events: none;
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.kst-confetti-piece {
    position: absolute;
    width: 6px;
    height: 12px;
    border-radius: 2px;
    animation-name: kst-confetti-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes kst-confetti-fall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(120%) rotate(360deg);
        opacity: 0;
    }
}

/* Responsiv etwas kleiner auf schmalen Screens */

@media (max-width: 480px) {
    .kst-container {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    .kst-timer {
        font-size: 2rem;
    }
    .kst-chest {
        width: 50px;
        height: 40px;
    }
}


.kst-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
