/* Grundlegendes Styling */
body {
    text-align: center; /* This helps with inline and inline-block elements */
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items horizontally */
    justify-content: center; /* Center items vertically */
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrollbar */
    margin: 0;
    box-sizing: border-box;
    /* Removed padding-top from here */
}

/* Styling für die Würfelauswahl */
.wuerfel-auswahl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive Grid */
    gap: 20px;
    padding: 20px;
    max-width: 800px;
    width: 90%; /* Breite an den verfügbaren Platz anpassen */
    margin: 0 auto; /* Center the grid */
    justify-items: center;
    box-sizing: border-box; /* Box-Sizing für konsistentes Verhalten */
}

.wuerfel-auswahl a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box; /* Box-Sizing für konsistentes Verhalten */
}

.wuerfel-auswahl img {
    max-width: 100%; /* Bildgröße an den Container anpassen */
    height: auto;
    margin-bottom: 10px;
}

/* ---  Button Styling (Flexbox Centering) --- */
#button-container {
    display: flex;
    justify-content: center; /* Horizontal centering */
    align-items: center;     /* Vertical centering */
    width: 100%; /* Ensure the container takes the full width */
    padding: 20px 0; /* Add some padding around the button */
    min-height: 60px; /* Reserviert Platz für den Button, auch wenn er nicht sichtbar ist */
}

.overlay-open-button {
    background: linear-gradient(135deg, #0066CC, #004C99); /* Project Primary Colors */
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: 30px; /* Stark abgerundete Ecken für magisches Aussehen */
    cursor: pointer;
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    width: auto;
    max-width: 90%;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3); /* Blue shadow */
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    box-sizing: border-box;
    z-index: 10;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Abstand zwischen Icon und Text */
}

/* Magisches Symbol vor dem Text */
.overlay-open-button:before {
    content: '✨'; /* Funkelnde Sterne für magischen Effekt */
    font-size: 18px;
    margin-right: 4px;
}

.overlay-open-button:active {
    transform: translateY(1px); /* Leicht nach unten beim Klicken für Feedback */
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.4);
    background: linear-gradient(135deg, #0055b3, #003d7a); /* Darker on click */
}

/* Magischer Glüh-Effekt */
@keyframes magic-glow {
    0% {
        box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 102, 204, 0.6), 0 0 15px rgba(51, 153, 255, 0.4);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    }
}

/* Funkelnder Hintergrund-Effekt */
@keyframes sparkle {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}



.result-display {
    margin-top: 20px;
    font-size: 16px;
    color: #333;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-family: "Cabin Sketch", cursive;
    text-align: center;
    max-width: 80%;
    margin: 20px auto;
    box-sizing: border-box; /* Box-Sizing für konsistentes Verhalten */
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.overlay #resultDisplay {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    backdrop-filter: blur(5px);
    border: 1px solid #ccc;
    box-sizing: border-box; /* Box-Sizing für konsistentes Verhalten */
}

.overlay #resultDisplay p {
    margin: 0;
    padding: 5px 0;
    line-height: 1.5;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    background-color: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.overlay.active {
    display: flex;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wuerfel-auswahl {
        grid-template-columns: 1fr !important; /* Einspaltige Anordnung auf kleineren Bildschirmen */
        gap: 30px !important; /* Größerer Abstand zwischen den Würfeln */
        padding: 30px 20px !important;
    }
    
    .wuerfel-auswahl img {
        width: 120px !important; /* Etwas größere Würfel auf mobilen Geräten */
    }
    
    .overlay-open-button {
        font-size: 16px;
        padding: 8px 16px;
    }
    .result-display {
        font-size: 14px;
        padding: 10px;
    }
    /* Removed fixed height from #dice-container-wrapper */
    #dice-container-wrapper {
        padding: 20px 0; /* Use padding for spacing */
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px; /* Kleinere Schriftgröße für sehr kleine Bildschirme */
    }
    .wuerfel-auswahl img {
        width: 80px; /* Kleinere Bilder */
    }
    .overlay-open-button {
        font-size: 14px;
        padding: 6px 12px;
    }
    /* Removed fixed height from #dice-container-wrapper */
    #dice-container-wrapper {
        padding: 15px 0; /* Use padding for spacing, adjust as needed */
    }
}

/* Cabin Sketch mit font-display */
.overlay-open-button, .result-display {
  font-family: "Cabin Sketch", cursive;
  font-display: swap; /* Sorgt für sofortige Anzeige einer Fallback-Schrift */
}

/* Container für Würfel */
#dice-container-wrapper {
    display: flex;
    justify-content: center; /* Zentriert den Würfel horizontal */
    align-items: center;     /* Zentriert den Würfel vertikal */
    width: 100%; /* Volle Breite */
    padding: 30px 0; /* Use padding to control vertical space around the dice */
    min-height: 160px; /* Feste Mindesthöhe für den Würfelbereich */
    position: relative; /* Für stabilere Positionierung */
}
