/* ========== Imports & Base ========== */
@import url('https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&family=Poppins:wght@600&display=swap');

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    height: 100vh;
}

body {
    background: linear-gradient(135deg, #2c2c2c, #1f1f1f);
    color: #fff;
    font-family: 'Arial', sans-serif;
    overflow-y: auto;
    /* Ermöglicht Scrollen nur wenn nötig */
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* === Page Wrapper === */
#page {
    width: 100%;
}

/* === Header === */
#header {
    text-align: center;
    padding: 20px 0;
    background-color: transparent;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

}

#game-container,
#auth-container,
#level-selection {
    margin-top: 20px;
    /* Abstand zum Header */
}



.stone-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

#header h1 {
    font-size: 72px;
    margin: 0;
    color: #e0e0e0;
    text-shadow: 0 0 10px #aaa, 0 0 20px #888;
}

.stone-icons img {
    height: 50px;
    margin: 0 10px;
    filter: drop-shadow(0 0 6px #ffffffaa);
    animation: pulseStone 2s infinite alternate;
}

@keyframes pulseStone {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 6px #ffffffaa);
    }

    100% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 12px #fff);
    }
}

/* === Auth Container === */
#auth-container {
    display: flex;
    flex-direction: row;
    gap: 50px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /** ❗ zentriert die Box in der Mitte **/
    max-width: 960px;
    margin: 40px auto;
}

.auth-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 250px;
}

.auth-box input,
.auth-box select,
.auth-box input[type="date"],
.auth-box input[type="email"],
.auth-box input[type="number"],
.auth-box input[type="text"],
.auth-box input[type="password"] {
    height: 50px;
    width: 100%;
    padding: 0 12px;
    font-size: 16px;
    border-radius: 10px;
    box-sizing: border-box;
    max-width: 100%;
    margin-bottom: 10px;
}

.auth-box label,
.auth-box .section-label {
    align-self: flex-start;
    width: 100%;
    margin-bottom: 4px;
}


.auth-box button {
    margin-top: 10px;

}

.auth-box button:hover {
    transform: scale(1.05);
    background: linear-gradient(45deg, #777, #aaa);
}

#patient-register-box-wrapper {
    display: flex;
    flex-direction: row;
    gap: 50px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 960px;
    margin: 40px auto;
}


.switch-text a {
    color: #aaa;
    text-decoration: underline;
}

.switch-text a:hover {
    color: #fff;
}

.info-panel {
    max-width: 300px;
    max-height: 220px;
    margin-top: 13%;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid #888;
    border-radius: 10px;
    padding: 20px;
    font-size: 16px;
    color: #ddd;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}


.standard-button.info-btn {
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
    min-width: 0;
}

.refcode-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.refcode-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.refcode-row label {
    font-size: 16px;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

#ref-code {
    width: 60%;
    max-width: 100%;
    height: 50px;
    padding: 0 12px;
    font-size: 16px;
    border-radius: 10px;
    box-sizing: border-box;
}

#ref-info {
    margin-top: 4px;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 20px;
    text-align: center;
    max-width: 100%;
}

/* === Game Container === */
#game-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
}


#game-interface {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: space-between;
}

#level-text {
    font-size: 32px;
    font-weight: bold;
    margin: 16px 0;
}

#grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: min(60vmin, 90vw);
    height: min(60vmin, 90vh);
    max-height: 70vh;
    margin: 20px auto;
    padding: 10px;
    background-color: #333;
    gap: 2px;
}


.tile {
    width: 100%;
    height: 100%;
    background-size: cover;
    cursor: pointer;
    transition: all 0.2s ease;
}

.highlight {
    border: 3px solid white;
    background-color: rgba(255, 255, 255, 0.2);
    box-sizing: border-box; /* Ensures the border doesn't expand tile size */
}

#game-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    min-height: 70vh;
}

.menu-buttons {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.standard-button {
    background: #444;
    color: #fff;
    border: 1px solid #888;
    border-radius: 10px;
    padding: 16px 28px;
    /* ↑ mehr Innenabstand (größerer Button) */
    font-size: 18px;
    /* ↑ größere Schrift */
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    width: 220px;
    /* ↑ breiterer Button */
    max-width: 100%;
    transition: background 0.2s ease, transform 0.2s ease;
}

.standard-button:hover {
    transform: scale(1.07);
    /* leichtes Vergrößern beim Hover */
    background: linear-gradient(45deg, #555, #aaa);
}

#level-text {
    text-align: center;
    margin: 16px auto;
    display: block;
}

.button-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.button-row .standard-button {
    margin: 0;
    /* vorheriges auto entfernen */
}


#tutorial-text {
    margin-top: 20px;
    padding: 16px 20px;
    font-size: 18px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid #ccc;
    border-radius: 8px;
    max-width: 1000px;
    width: 100%;
    color: #fff;
    text-align: center;       /* ⬅ Textinhalt zentriert */
    margin-left: auto;        /* ⬅ Block horizontal zentriert */
    margin-right: auto;
}

#level-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: 80vh;
    gap: 20px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
}

.level-grid .level-preview {
    display: grid;
    grid-template-columns: repeat(10, 20px); /* Increase tile width */
    grid-template-rows: repeat(10, 20px);   /* Increase tile height */
    gap: 2px;                               /* Slightly bigger gap between tiles */
    margin: 0 auto;
    background-color: #222;
    padding: 6px;
}


.level-button {
    background: none;
    border: none;
    padding: 8px; /* adds padding around your button for larger click area */
    cursor: pointer;
    width: auto;
    height: auto;
    transition: transform 0.2s ease-in-out;
}

.level-button:hover {
    transform: scale(1.05); /* slight hover effect */
}

.level-button.solved {
    border: 3px solid limegreen;
    border-radius: 12px;
    box-shadow: 0 0 10px limegreen;
}

#level-selection button {
    max-width: none;
}

#congrats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#congrats-message {
    font-size: 48px;
    color: white;
    text-align: center;
    animation: popFade 2s ease forwards;
    font-family: 'Poppins', sans-serif;
    white-space: pre-line;
}

@keyframes popFade {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Hide hidden containers */
#level-selection[style*="display: none"],
#game-menu[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    overflow: hidden;
}

/* Tile types */
.wall {
    background-image: url('images/wall.png');
}

.stone1 {
    background-image: url('images/stone1.png');
}

.stone2 {
    background-image: url('images/stone2.png');
}

.stone3 {
    background-image: url('images/stone3.png');
}

.stone4 {
    background-image: url('images/stone4.png');
}

.empty {
    background-color: #333; /* dunkles Grau als Platzhalter */
}

.selected {
    filter: brightness(50%);
}