.hidden {
    display: none;
}

.weihnachtsspiel-add p {
    color: white;
    margin-top: 1.5rem;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
    text-align: center;
    display: block;
}

.weihnachtsspiel-add p a {
    color: red;
    text-decoration: none;

}

/*
------------------------------------------- highscore ----------------------------------------------------------
 */

/* Highscore Modal Styling */
.highscore-modal-content {
    margin: 1rem 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.highscore-modal-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #f3f4f6;
    border-radius: 0.5rem;
    border-left: 4px solid #3b82f6;
}

.highscore-modal-mode {
    font-weight: bold;
    color: #1f2937;
}

.highscore-modal-score {
    font-weight: bold;
    color: #3b82f6;
    font-size: 1.2rem;
}

/*
---------------------------------------------------- ladescreen -----------------------------------------
 */

/* Ladebildschirm */
.weihnachtsspiel-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease-out;
}

.weihnachtsspiel-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.loading-text {
    font-size: clamp(1.2rem, 4vw, 2rem);
    color: white;
    font-weight: bold;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
    margin: 0;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}
/*
---------------------------------------------------- ladescreen -----------------------------------------
 */

/* Sound Toggle Button */
.weihnachtsspiel-sound-toggle {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem; /* rechts vom Credits-Link */
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s ease, background 0.2s ease;
    padding: 0;
}

/* WICHTIG: Hidden state muss explizit sein */
.weihnachtsspiel-sound-toggle.hidden {
    display: none !important;
}

.weihnachtsspiel-sound-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.weihnachtsspiel-sound-toggle:active {
    transform: scale(0.95);
}

.weihnachtsspiel-sound-toggle .sound-icon {
    width: 24px;
    height: 24px;
    filter: invert(1); /* macht das Icon weiß */
    pointer-events: none;
}


.points-label {
    font-size: 3rem;
}

.highscore-label {
    font-size: 2rem;
    color: black;
}

.highscore-item {
    font-weight: normal; /* nicht fett */
    line-height: 1.2;
}

.weihnachtsspiel-credits {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    font-size: 0.8rem;
    color: black;
    cursor: pointer;
    z-index: 20;
    text-decoration: none;
}

.weihnachtsspiel-credits-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.weihnachtsspiel-credits-content {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.weihnachtsspiel-credits-content h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    border-left: 6px solid #dc2626;
}

.weihnachtsspiel-credits-modal.hidden {
    display: none;
}


.weihnachtsspiel-wrapper {
    position: relative;
    width: 100%;
    height: 80vh;
    overflow: hidden;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    touch-action: none;
}

.weihnachtsspiel-wrapper * {
    box-sizing: border-box;
}

.weihnachtsspiel-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.weihnachtsspiel-screen-content {
    padding-top: 35vh;
}

#weihnachtsspiel-instructions-modal .weihnachtsspiel-credits-content {
    max-width: 90%;
    text-align: center;
    padding: 1rem;
}

/* Screen overlay (Start / GameOver) */
.weihnachtsspiel-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    background-color: rgb(240, 240, 240);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 2rem 1rem;
    gap: 0.5rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;



    background-image: url('/fileadmin/user_upload/spiel/xmas25/game_background_1.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;

}

.weihnachtsspiel-screen.hidden {
    display: none !important;
}

/* Responsive Titel */
.weihnachtsspiel-title {
    font-size: clamp(1.5rem, 6vw, 3.75rem);
    font-weight: bold;
    margin: 0 0 1rem 0;
    color: black;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
    text-align: center;
    line-height: 1.05;
    max-width: 95%;
    word-break: break-word;
    hyphens: auto;
}

.weihnachtsspiel-text {
    font-size: clamp(0.9rem, 3.6vw, 1.5rem);
    color: black;
    margin: 0 0 1rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-align: center;
    padding: 0 1rem;
    max-width: 92%;
    word-break: break-word;
    white-space: normal;
}

/* Responsive Button */
.weihnachtsspiel-button {
    display: inline-block;
    font-size: clamp(0.9rem, 3.5vw, 1.5rem);
    padding: clamp(0.5rem, 1.8vw, 1.2rem) clamp(0.9rem, 3vw, 2rem);
    font-weight: bold;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    background-color: #22c55e;
    color: white;
    box-shadow: 0 10px 15px rgba(0,0,0,0.3);
    transition: transform 0.12s ease;
    touch-action: manipulation;
    max-width: 100%;
    width: auto;
    white-space: normal;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.button-group .weihnachtsspiel-button {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}




.weihnachtsspiel-button:hover,
.weihnachtsspiel-button:active {
    transform: scale(1.03);
}

/* Finalscore */
#weihnachtsspiel-finalscore {
    font-size: clamp(1.5rem, 8vw, 3rem);
    margin: 0.5rem 0 1rem 0;
    max-width: 95%;
    word-break: break-word;
    text-align: center;
    border-left: none;
}

/* HUD */
.weihnachtsspiel-hud {
    position: absolute;
    top: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 10;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.weihnachtsspiel-hud.left { left: 0.5rem; }
.weihnachtsspiel-hud.right { right: 0.5rem; }

.weihnachtsspiel-logo {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px rgba(0,0,0,0.3);
    z-index: 10;
}

.weihnachtsspiel-logo-text {
    font-size: 2rem;
    font-weight: bold;
    color: #dc2626;
    letter-spacing: -2px;
}

.weihnachtsspiel-logo img {
    width: 40%;
    height: 40%;
    object-fit: contain;
    display: block;
    border-radius: 50%;
    pointer-events: none;
}

.key-icon {
    height: 4em;
    vertical-align: middle;
    /*margin: 0 0.1em;*/
    display: inline-block;
}

/* Difficulty select inline */
.weihnachtsspiel-difficulty {
    display: flex;
    align-items: center; /* vertikal zentriert */
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap; /* verhindert Überlauf bei langen Texten */
}

.difficulty-label {
    font-size: clamp(0.9rem, 3.5vw, 1.5rem);
    color: #111827;
    white-space: nowrap; /* verhindert Umbruch im Label */
}

/* Select Box */
.weihnachtsspiel-select {
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.15);
    background: white;
    color: #111827;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);

    min-width: 120px;
    max-width: 250px; /* erhöht für lange Optionen */
    text-align: center;
}

/* IE/Edge Pfeil entfernen */
.weihnachtsspiel-select::-ms-expand {
    display: none;
}

#weihnachtsspiel-gameover {
    background-image: url('/fileadmin/user_upload/spiel/xmas25/game_background_endscreen.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;

    justify-content: flex-start;
    padding-top: 30vh;

}

.weihnachtsspiel-button.anleitung {
    background-color: darkorange;
    margin-left: 1vh;
}

.weihnachtsspiel-hud.legend-timer {
    left: 50%;
    transform: translateX(-50%);
    font-size: 3.5rem;
    padding: 1rem 2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-decrement {
    font-size: 0.5em;
    margin-left: 0.5rem;
    opacity: 0.8;
    color: red;
}




/* Gameover: Textfarben weiß */
#weihnachtsspiel-gameover .weihnachtsspiel-text,
#weihnachtsspiel-gameover .weihnachtsspiel-title,
#weihnachtsspiel-gameover .points-label,
#weihnachtsspiel-gameover .difficulty-label {
    color: white;
    text-shadow: 0 3px 6px rgba(0,0,0,0.7);
}









/* Tablet */
@media (min-width: 481px) and (max-width: 1024px) {
    .weihnachtsspiel-wrapper { height: 70vh; }
    .weihnachtsspiel-hud { font-size: 1.75rem; }
}

/* Smartphone */
@media (max-width: 480px) {

    .weihnachtsspiel-add {
        width: 100%;             /* Container nimmt die volle Breite ein */
        display: flex;           /* Flexbox verwenden */
        justify-content: center; /* horizontal zentrieren */
        align-items: center;     /* vertikal zentrieren (falls nötig) */
        text-align: center;      /* Text innerhalb des Containers zentrieren */
        margin-top: 0.3rem;
    }

    .weihnachtsspiel-add p {
        margin: 0;               /* optional: Abstand kontrollieren */
        font-size: 0.4rem;       /* an Mobile anpassen */
    }


    .highscore-modal-content {
        max-width: 100%;
    }

    .highscore-modal-item {
        padding: 0.5rem;
        font-size: 0.4rem;
    }

    .highscore-modal-score {
        font-size: 0.5rem;
    }


    .button-group {
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0.3rem;
        padding-left: 0.1rem;
        flex-direction: column;
    }

    .button-group .weihnachtsspiel-button {
        min-width: 200px;
        max-width: 250px;
        flex: 0; /* WICHTIG: entfernt flex: 1 */
        align-self: flex-start; /* WICHTIG: buttons selbst links ausrichten */
    }

    .timer-decrement {
        font-size: 0.3em;
        margin-left: 0.1rem;
        opacity: 0.8;
        color: red;
    }

    .weihnachtsspiel-sound-toggle {
        width: 28px;
        height: 28px;
        bottom: 0.25rem;
        left: 0.1rem;
    }

    .weihnachtsspiel-sound-toggle .sound-icon {
        width: 16px;
        height: 16px;
    }

    .points-label {
        font-size: 1rem;
    }

    .highscore-label {
        font-size: 0.5rem;
    }

    .key-icon {
        height: 2em;
        vertical-align: middle;
        /*margin: 0 0.1em;*/
        display: inline-block;
    }

    .weihnachtsspiel-credits {
        font-size: 0.4rem;
        bottom: 0.15rem;
        left: 0.15rem;
    }

    .weihnachtsspiel-difficulty {
        flex-direction: column; /* Label über Dropdown */
        align-items: center;
        justify-content: center;
        gap: 0.15rem; /* noch kompakter */
        width: 100%; /* volle Breite nutzen */
    }

    .difficulty-label {
        font-size: 0.6rem; /* größer: von 0.7rem auf 0.9rem */
        white-space: normal;
        text-align: center;
        width: 100%;
    }

    .weihnachtsspiel-select {
        font-size: clamp(0.5rem, 1.5vw, 0.5rem);
        padding: 0.4rem 0.6rem; /* größer: von 0.2rem 0.4rem */
        min-width: 200px;
        max-width: 200px;
        width: auto;
        text-align: center;
        background-size: 0.6rem auto; /* größer: von 0.5rem auf 0.6rem */
        margin-left: 0.1vh;
    }

    .weihnachtsspiel-wrapper {
        height: 90vh;
        min-height: 500px;
        max-height: 800px;
    }

    .weihnachtsspiel-screen {
        padding: 1rem 0.1rem;
        gap: 0.4rem;
        justify-content: center;
        align-items: flex-start;
    }

    .weihnachtsspiel-title { font-size: clamp(1.25rem, 8vw, 2rem); margin-bottom: 0.5rem; }
    .weihnachtsspiel-text { font-size: clamp(0.8rem, 3.6vw, 1rem); margin-bottom: 0.5rem; }

    .weihnachtsspiel-button {
        font-size: clamp(0.5rem, 1.5vw, 0.5rem);
        padding: 0.4rem 1rem;
        margin-top: 0.5rem;
        box-sizing: border-box;
    }

    .weihnachtsspiel-hud { font-size: 0.8rem; padding: 0.1rem 0.75rem; margin-top: 0rem; }
    .weihnachtsspiel-hud.legend-timer {
        font-size: 2rem;
        padding: 0.5rem 1rem;
        top: 3rem;
        min-width: 250px;
    }
    .weihnachtsspiel-logo { width: 38px; height: 38px; bottom: 0.5rem; right: 0.5rem; }
    .weihnachtsspiel-logo-text { font-size: 1rem; }
    .weihnachtsspiel-title { font-size: 0.8rem;}
    .weihnachtsspiel-text { font-size: 0.5rem; }
    #weihnachtsspiel-finalscore { font-size: 0.2rem; }


    /*
    Verschiebung der Sachen im endscreen
     */

    /* "Du hast erreicht:" */
    #weihnachtsspiel-gameover .weihnachtsspiel-text {
        margin-bottom: 0.2rem;
    }

    /* Punkteanzeige */
    #weihnachtsspiel-finalscore {
        margin: 0 0 0.4rem 0;
        line-height: 1;
    }

    /* Buttons enger */
    #weihnachtsspiel-gameover .weihnachtsspiel-button {
        margin-top: 0.25rem;
    }

    /* Abstand zwischen Highscore & Restart Button */
    #weihnachtsspiel-highscore-btn {
        margin-bottom: 0.1rem;
    }

    /* Modus-Auswahl näher an Buttons */
    #weihnachtsspiel-gameover .weihnachtsspiel-difficulty {
        margin-top: 0.4rem;
        gap: 0.1rem;
    }

    #weihnachtsspiel-gameover .weihnachtsspiel-score {
        width: auto;
        justify-content: center;
        text-align: center;
    }

    .weihnachtsspiel-gameover {
        justify-content: center;
        align-items: center;
        padding-top: 35svh;
    }

    /* Score + Buttons wirklich zentrieren */
    #weihnachtsspiel-gameover .weihnachtsspiel-score,
    #weihnachtsspiel-gameover .weihnachtsspiel-button,
    #weihnachtsspiel-gameover .weihnachtsspiel-difficulty {
        align-self: center;
    }

    #weihnachtsspiel-finalscore {
        margin-top: 0.5rem;
    }
}

/* Landscape Smartphone */
@media (max-width: 896px) and (orientation: landscape) {
    .weihnachtsspiel-wrapper { height: 70vh; }
    .weihnachtsspiel-screen { padding: 0.5rem; gap: 0.25rem; }
    .weihnachtsspiel-title { font-size: clamp(1rem, 6vw, 1.5rem); margin-bottom: 0.5rem; }
    .weihnachtsspiel-text { font-size: clamp(0.7rem, 3.2vw, 0.9rem); margin-bottom: 0.4rem; }
    .weihnachtsspiel-button { font-size: 1rem; padding: 0.6rem 1rem; }
    .weihnachtsspiel-hud { font-size: 1rem; top: 0.5rem; padding: 0.25rem 0.5rem; }
}

@media (max-width: 400px) {
    .weihnachtsspiel-wrapper {
        height: 80vh;
    }
}