/* Universelles Box-Sizing für alle Elemente */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Grundlegende Stile */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;

    /* NEU: Body ist jetzt der primäre Scroller */
    overflow-y: auto; /* Erlaubt vertikales Scrollen des gesamten Bodys */
    overflow-x: hidden; /* Verhindert horizontalen Bildlauf */
    min-height: 100vh; /* Stellt sicher, dass der Body immer mindestens die Viewport-Höhe einnimmt */
    width: 100vw;
    position: relative;

    /* Padding an den Seiten des Bodys, um den App-Container zu begrenzen */
    padding-inline: 5px;
}

#app-container {
    background-color: #fff;
    border-radius: 8px;
    /*box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);*/
    width: 90%;
    max-width: 800px;

    /* NEU: App-Container ist kein Flex-Container mehr für die vertikale Verteilung */
    display: block; /* Standard-Blockverhalten */
    height: auto; /* Höhe passt sich dem Inhalt an */
    min-height: unset; /* Entfernt vorherige Mindesthöhenbeschränkung */

    /* Zentrierung des App-Containers mit Auto-Margins */
    margin: 20px auto; /* 20px oben/unten, auto für horizontale Zentrierung */
    box-sizing: border-box;
}

/* App Header (Titel) */
#app-header {
    background-color: #ffffff; /* Changed to white */
    color: #000000; /* Changed text color for contrast */
    padding: 15px;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex; /* Added flexbox for alignment */
    justify-content: space-between; /* Space out items */
    align-items: center; /* Vertically center items */
    
    /* Sticky Header */
    position: sticky; /* Make the header sticky */
    top: 0; /* Stick to the top of the viewport */
    z-index: 999; /* Ensure it stays above other content when scrolling */
    border-bottom: 1px solid #eee; /* Optional: Add a subtle border for separation */
}

#app-header h1 {
    margin: 0;
    font-size: 1.8em;
    flex-grow: 1; /* Allows h1 to take available space */
}

/* Header Logo */
#header-logo {
    width: 40px; /* Square logo */
    height: 40px;
    margin-right: 15px; /* Space between logo and title */
    object-fit: contain; /* Ensures the image fits without cropping */
    cursor: pointer; /* NEU: Macht das Logo anklickbar */
}

/* Header Restart Button */
#header-restart-button {
    position: absolute;
    right: 15px; /* Abstand vom rechten Rand */
    top: 50%; /* Vertikal zentrieren */
    transform: translateY(-50%); /* Exakte vertikale Zentrierung */
    cursor: pointer;
    z-index: 100; /* Sicherstellen, dass er über anderen Elementen liegt */
    padding: 5px; /* Erhöht den klickbaren Bereich */
    border-radius: 50%; /* Macht den Bereich rund */
    transition: background-color 0.3s ease; /* Sanfter Übergang für Hover-Effekt */
}

#header-restart-button:hover {
    background-color: rgba(255, 255, 255, 0.2); /* Leichter Hintergrund beim Hover */
}

#header-restart-button img {
    width: 24px; /* Größe des Icons */
    height: 24px;
    display: block; /* Entfernt zusätzlichen Platz unter dem Bild */
}

/* Bereich für die Karte oben */
#map-display {
    width: 100%;
    height: 300px; /* Feste Höhe für Desktop-Ansicht */
    border-bottom: 1px solid #ddd;
    box-sizing: border-box;
    overflow: hidden; /* Verhindert Überlauf von iframe-Inhalt */
}

#map-display iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    min-width: 0;
}

/* Bereich für den Inhalt (Start, OL, Finish Screens) */
#content-area {
    height: auto; /* Höhe passt sich dem Inhalt an */
    min-height: unset; /* Entfernt vorherige Mindesthöhenbeschränkung */
    padding: 20px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.screen {
    display: none;
    text-align: center;
}

.screen.active {
    display: block;
}

/* Start- und Abschlussbildschirm */
#start-screen h1, #finish-screen h1 {
    color: #96b522;
    margin-bottom: 20px;
}

#start-button, .answer-button {
    background-color: #96b522;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin: 10px;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
}

#start-button:hover, .answer-button:hover {
    background-color: #628d0e;
}

/* Navigationsbuttons (Zurück/Weiter/Abschliessen)*/
.nav-button {
    background-color: #aa8e7f; /* Standardfarbe */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin: 10px;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
}

.nav-button:hover {
    background-color: #916b57; /* Hover-Farbe */
}

/* --- Aktualisierte Regel für das Zurücksetzen der Button-Farbe nach dem Klick --- */
/* Stellt sicher, dass die Hintergrundfarbe auf die Standardfarbe zurückgesetzt wird */
.nav-button:focus,
.nav-button:active {
    outline: none; /* Entfernt den Standard-Outline */
    background-color: #aa8e7f; /* Setzt die Farbe auf die Standardfarbe zurück */
    box-shadow: none; /* Entfernt Schatteneffekte bei Fokus/Aktiv */
}

.nav-button:focus:not(:hover) {
    background-color: #aa8e7f;
}

/* Navigationsbuttons im deaktivierten Zustand */
.nav-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#timer {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    color: #916b57;
}

#posten-title {
    color: #96b522;
    margin-bottom: 20px;
}

.posten-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box; /* Wichtig für Flex-Items */
}

.foto-container img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    display: block;
}

.foto-container {
    position: relative;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box; /* Wichtig für Flex-Items */
}

.question-section {
    width: 100%;
    margin-top: 15px;
    min-width: 0;
    box-sizing: border-box; /* Wichtig für Flex-Items */
}

#question-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #444;
}

.answer-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box; /* Wichtig für Flex-Items */
}

.answer-button {
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 200px;
    box-sizing: border-box;
}

/* Selektierter Antwort-Button */
.answer-button.selected {
    background-color: #628d0e;
    color: white;
    border-color: #628d0e;
}

.answer-button.selected:hover {
    background-color: #628d0e;
}

/* Navigation Buttons */
.navigation-buttons {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.navigation-buttons .nav-button {
    flex: 1;
    margin: 0 5px;
    box-sizing: border-box;
}

/* Overlay für Bildvergrößerung */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
}

#overlay-img {
    max-width: 90%;
    max-height: 90%;
    display: block;
    box-sizing: border-box;
}

.close-overlay {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* Stil für die Zusammenfassung der Antworten */
.summary-item-correct {
    color: green;
}

.summary-item-incorrect {
    color: red;
}

.summary-item-unanswered {
    color: #888;
}

.correct-answer-display {
    color: black;
    font-weight: normal;
}

/* --- Zurücksetzen von Button-Active/Focus-States --- */
/* Dies verhindert, dass Navigationsbuttons nach dem Klick "kleben bleiben" */
.nav-button:focus,
.nav-button:active {
    outline: none; /* Entfernt den Standard-Outline */
    background-color: #916b57;
    border-color: #916b57;
    box-shadow: none; /* Entfernt Schatteneffekte bei Fokus/Aktiv */
}

/* Optional: Behält den Hover-Effekt bei, wenn Button aktiv und gehovert wird */
.nav-button:active:hover {
    background-color: #5a6268;
}

/* NEU: Container für Nutzungsbedingungen */
.terms-container {
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    color: #444;
}

.terms-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #96b522; /* Farbe für den Haken */
}

.terms-container label {
    cursor: pointer;
}

.terms-container a {
    color: #96b522;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

.terms-container a:hover {
    color: #628d0e;
}

/* NEU: Deaktivierter Zustand für Start-Button */
#start-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#start-button:disabled:hover {
    background-color: #cccccc;
}

/* NEU: Overlay für Nutzungsbedingungen */
#terms-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Höherer z-index als Bild-Overlay */
    padding: 20px;
    box-sizing: border-box;
}

/* NEU: Inhaltsbox für das Overlay der Nutzungsbedingungen */
.overlay-content {
    background-color: #ffffff;
    padding: 25px 30px;
    border-radius: 8px;
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    box-sizing: border-box; /* */
}

.overlay-content h2 {
    color: #96b522;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8em;
}

.overlay-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #333;
}

/* NEU: Schliessen-Button im Overlay der Nutzungsbedingungen */
.overlay-content .close-overlay {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #555;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.overlay-content .close-overlay:hover {
    color: #000;
}


/* Responsivität für Mobilgeräte (max-width: 600px) */
@media (max-width: 600px) {
    body {
        padding: 0; /* Entfernt seitliches Padding für volle Breite auf Mobilgeräten */
		padding-bottom: env(safe-area-inset-bottom); /* Globale Berücksichtigung */
    }

    #app-container {
        width: 100vw;
        border-radius: 0; /* Keine abgerundeten Ecken auf Mobilgeräten */
        height: auto; /* NEU: Höhe passt sich dem Inhalt an, keine 100vh */
        min-height: unset; /* NEU */
        padding: 0; /* Kein Padding am Hauptcontainer */
        /* Removed overflow: hidden; here too for consistency and to allow sticky */
        margin: 0; /* Keine Ränder am Hauptcontainer auf Mobilgeräten */
    }

    #app-header {
        padding: 15px 10px;
        width: 100%;
        /* Keep flex properties for mobile as well */
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* Sticky Header for mobile */
        position: sticky; /* Make the header sticky */
        top: 0; /* Stick to the top of the viewport */
        z-index: 999; /* Ensure it stays above other content when scrolling */
    }

    #app-header h1 {
        font-size: 1.5em;
        margin: 0; /* Ensure no extra margin on mobile */
    }

    #header-logo {
        width: 30px; /* Smaller logo on mobile */
        height: 30px;
        margin-right: 10px;
    }

    #header-restart-button {
        width: 30px; /* Smaller button on mobile */
        height: 30px;
        margin-left: 10px;
    }

    #map-display {
        height: 200px; /* Reduzierte feste Höhe für die Karte auf Mobilgeräten */
        overflow: hidden; /* Sicherstellen, dass nichts aus dem iframe-Container überläuft */
    }

    #map-display iframe {
        min-width: 0;
        width: 100%;
    }

    #content-area {
        padding: 15px;
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: unset;
    }

    .answer-buttons {
        flex-direction: column; /* Antwort-Buttons untereinander */
        gap: 5px;
        width: 100%;
        min-width: 0;
    }

    .answer-button {
        width: 100%;
        max-width: unset;
        margin: 0;
        padding: 12px;
    }

    .navigation-buttons {
        flex-direction: column; /* Navigationsbuttons untereinander */
        gap: 5px;
        width: 100%;
        min-width: 0;
        padding-bottom: 0;
        margin-bottom: 0;
		padding-bottom: env(safe-area-inset-bottom); /* Sicherer Abstand für iOS */
    }

    .navigation-buttons .nav-button {
        width: 100%;
        max-width: unset;
        margin: 0; /* Setzt alle Margins auf 0 */
        padding: 12px;
    }

    /* NEU: Wendet den unteren Rand nur auf den letzten Button an */
    .navigation-buttons .nav-button:last-child {
        margin-bottom: 15px; /* Gewünschter Rand unter dem letzten Button */
    }

    .posten-content, .question-section, .foto-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    #terms-overlay { 
        padding: 0; 
    }

    .overlay-content { 
        width: calc(100% - 40px);
        padding: 20px;
        margin: 20px;
        max-width: unset;
    }

    .overlay-content h2 {
        font-size: 1.5em;
    }
}

#app-footer {
    text-align: center;
    padding: 20px;
    background-color: #f0f0f0;
    color: #555;
    font-size: 0.9em;
    margin-top: 20px;
    border-top: 1px solid #ddd;
}

#app-footer a {
    color: #96b522;
    text-decoration: underline;
}

#app-footer a:hover {
    color: #628d0e;
	text-decoration: underline;
	
}

#app-footer .fa-heart {
    color: #555;
    margin: 0 2px; /* Space around the heart */
}