* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    /* GEÄNDERT: Neuer ansprechender Gradient-Hintergrund */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    position: relative;
}

/* NEU: Animierte Hintergrund-Partikel */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: backgroundFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* NEU: Animation für schwebende Partikel */
@keyframes backgroundFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem;
    /* GEÄNDERT: Glasmorphismus-Effekt für den Container */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 100vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    /* NEU: Sanfte Einblend-Animation */
    animation: containerFadeIn 1s ease-out;
}

/* NEU: Container-Einblend-Animation */
@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    padding: 0.5rem 0;
    margin-top: 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 2rem;
    /* NEU: Subtiler Schatten */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

h1 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
    /* NEU: Gradient-Text-Effekt */
    background: linear-gradient(45deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
}

nav a, nav span {
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    transition: all 0.3s ease;
    /* NEU: Subtiler Schatten */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav a {
    color: #3498db;
    /* GEÄNDERT: Glaseffekt für Navigation */
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

nav a:hover {
    /* GEÄNDERT: Verbesserte Hover-Effekte */
    background: rgba(233, 236, 239, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

nav a.active {
    /* GEÄNDERT: Gradient für aktive Navigation */
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

nav span.locked {
    color: #adb5bd;
    background: rgba(248, 249, 250, 0.6);
    cursor: not-allowed;
    border: 1px solid rgba(173, 181, 189, 0.3);
}

nav span.completed {
    padding: 0.5rem 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    color: #27ae60;
    /* GEÄNDERT: Glaseffekt für abgeschlossene Items */
    background: rgba(234, 250, 241, 0.8);
    backdrop-filter: blur(5px);
    cursor: default;
    border: 1px solid rgba(39, 174, 96, 0.3);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.1);
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    font-size: 1rem;
    /* NEU: Glaseffekt für Inputs */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

/* NEU: Focus-Effekte für Inputs */
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.btn-submit {
    /* GEÄNDERT: Gradient-Button */
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-submit:hover {
    background: linear-gradient(45deg, #27ae60, #229954);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 204, 113, 0.4);
}

.btn-next {
    display: inline-block;
    /* GEÄNDERT: Gradient für Next-Button */
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.login-container {
    max-width: 500px;
    margin: 3rem auto;
    padding: 2rem;
    /* GEÄNDERT: Glasmorphismus für Login-Container */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px; /* GEÄNDERT: Rundere Ecken */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    /* NEU: Slide-in Animation */
    animation: slideInFromBottom 0.8s ease-out;
}

/* NEU: Slide-in Animation */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    /* NEU: Gradient-Text */
    background: linear-gradient(45deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.puzzle-container {
    margin-bottom: 2rem;
    padding: 2rem;
    /* GEÄNDERT: Glasmorphismus für Puzzle-Container */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px; /* GEÄNDERT: Rundere Ecken */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    /* NEU: Slide-in Animation */
    animation: slideInFromBottom 0.8s ease-out;
}

.puzzle-container h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    /* NEU: Gradient-Text */
    background: linear-gradient(45deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.puzzle-content {
    margin-bottom: 2rem;
    padding: 1.5rem;
    /* GEÄNDERT: Glaseffekt für Puzzle-Content */
    background: rgba(248, 249, 250, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 12px; /* GEÄNDERT: Rundere Ecken */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    /* NEU: Slide-in Animation */
    animation: slideInFromTop 0.5s ease-out;
}

/* NEU: Slide-in von oben */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success {
    /* GEÄNDERT: Glaseffekt für Success-Message */
    background: rgba(212, 237, 218, 0.9);
    backdrop-filter: blur(5px);
    color: #155724;
    border: 1px solid rgba(195, 230, 203, 0.5);
    box-shadow: 0 4px 12px rgba(21, 87, 36, 0.1);
}

.error {
    /* GEÄNDERT: Glaseffekt für Error-Message */
    background: rgba(248, 215, 218, 0.9);
    backdrop-filter: blur(5px);
    color: #721c24;
    border: 1px solid rgba(245, 198, 203, 0.5);
    box-shadow: 0 4px 12px rgba(114, 28, 36, 0.1);
}

.error-message {
    color: #dc3545;
    margin-bottom: 1rem;
    /* NEU: Pulse-Animation für Fehler */
    animation: errorPulse 0.5s ease-out;
}

/* NEU: Error-Pulse Animation */
@keyframes errorPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.puzzle-pieces {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 700px; 
    margin-left: auto;
    margin-right: auto;
}

.puzzle-piece {
    width: 120px; 
    height: 120px; 
    cursor: pointer;
    border: 2px solid #ccc;
    transition: transform 0.2s; /* ZURÜCK ZU: Ursprüngliche einfache Transition */
    overflow: hidden; 
    /* ENTFERNT: border-radius und box-shadow für bessere Sichtbarkeit */
}

.puzzle-piece:hover {
    transform: scale(1.05); /* ZURÜCK ZU: Einfache Hover-Animation */
    border-color: #3498db;
    /* ENTFERNT: Glow-Effekt für weniger Ablenkung */
}

.puzzle-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1px; 
    width: 484px; 
    height: 242px; 
    margin: 0 auto;
    padding: 1px; 
    background-color: transparent !important; 
    border: 1px solid #ccc; 
    border-radius: 4px; /* ZURÜCK ZU: Weniger runde Ecken */
    /* ENTFERNT: box-shadow für weniger Ablenkung */
}

.board-cell {
    position: relative; 
    width: 120px; 
    height: 120px; 
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0; 
    background-color: rgba(240, 240, 240, 0.5); 
    border: none; 
    box-shadow: none !important;
    overflow: hidden; 
    /* ENTFERNT: transition für weniger Ablenkung */
}

/* ENTFERNT: Hover-Effekt für Board-Cells für weniger Ablenkung */

.board-cell img {
    position: relative; 
    z-index: 2; 
    max-width: 100%;
    max-height: 100%;
    width: 100%; 
    height: 100%;
    object-fit: cover; 
    opacity: 1 !important; 
    filter: none !important; 
    border: none !important;
    box-shadow: none !important;
    -webkit-filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background-color: transparent !important;
    margin: 0 !important; 
    padding: 0 !important; 
    transition: all 0.3s ease; /* NEU: Transition */
}

.board-cell:has(img) {
    background-color: transparent !important;
    background: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.board-cell > img {
    display: block;
    margin: 0 !important; 
    width: 100%;
    height: 100%;
}

.puzzle-board[data-layout="2x4"] {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 242px; 
    height: 484px; 
}

.puzzle-board[data-layout="3x3"] {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 363px; 
    height: 363px; 
}

.math-puzzle {
    font-size: 1.2rem;
    padding: 1rem;
    /* GEÄNDERT: Glaseffekt für Math-Puzzle */
    background: rgba(233, 236, 239, 0.8);
    backdrop-filter: blur(5px);
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.coordinates-container {
    margin: 2rem auto;
    max-width: 600px;
    padding: 2rem;
    /* GEÄNDERT: Glasmorphismus für Koordinaten-Container */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px; /* GEÄNDERT: Rundere Ecken */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
    /* NEU: Celebration Animation */
    animation: celebrationBounce 1s ease-out;
}

/* NEU: Celebration-Animation */
@keyframes celebrationBounce {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    50% {
        transform: scale(1.05) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.coordinates-box {
    margin: 1.5rem 0;
    padding: 1.5rem;
    /* GEÄNDERT: Glaseffekt für Koordinaten-Box */
    background: rgba(248, 249, 250, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 12px; /* GEÄNDERT: Rundere Ecken */
    border: 1px solid rgba(233, 236, 239, 0.5);
}

.coordinates-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 1rem 0;
    padding: 1rem;
    /* GEÄNDERT: Glaseffekt und Gradient für Koordinaten-Display */
    background: linear-gradient(45deg, rgba(233, 236, 239, 0.8), rgba(248, 249, 250, 0.9));
    backdrop-filter: blur(5px);
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* NEU: Glow-Effekt */
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.btn-logout {
    display: inline-block;
    /* GEÄNDERT: Gradient für Logout-Button */
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    cursor: pointer;
    text-decoration: none;
    margin-top: 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-logout:hover {
    background: linear-gradient(45deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.4);
}

.actions {
    margin-top: 2rem;
    text-align: center;
}

.custom-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    /* NEU: Backdrop-Blur für Popup */
    backdrop-filter: blur(5px);
}

.popup-content {
    /* GEÄNDERT: Glasmorphismus für Popup */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem;
    border-radius: 16px; /* GEÄNDERT: Rundere Ecken */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    /* NEU: Popup-Animation */
    animation: popupFadeIn 0.3s ease-out;
}

/* NEU: Popup-Animation */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-title {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    /* NEU: Gradient-Text */
    background: linear-gradient(45deg, #2c3e50, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.popup-message {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.popup-button {
    /* GEÄNDERT: Gradient für Popup-Button */
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px; /* GEÄNDERT: Rundere Ecken */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.popup-button:hover {
    background: linear-gradient(45deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.visitor-counter {
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.visitor-counter p {
    margin: 0;
    padding: 0.5rem;
    /* GEÄNDERT: Glaseffekt für Visitor-Counter */
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(5px);
    display: inline-block;
    border-radius: 6px; /* GEÄNDERT: Rundere Ecken */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

footer {
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    color: #6c757d;
    font-size: 0.9rem;
    /* NEU: Glaseffekt für Footer */
    background: rgba(248, 249, 250, 0.3);
    backdrop-filter: blur(5px);
}

/* NEU: Auto-Logout Message Styling */
.auto-logout-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #721c24;
    font-weight: 600;
}

.auto-logout-message #countdown {
    color: #dc3545;
    font-weight: bold;
    font-size: 1.1em;
    /* NEU: Pulsing Animation für Countdown */
    animation: countdownPulse 1s ease-in-out infinite;
}

/* NEU: Countdown-Pulse Animation */
@keyframes countdownPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #ff1744;
    }
}

@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
    }
    
    .puzzle-piece {
        width: 90px; 
        height: 90px; 
    }
    
    .puzzle-board {
        width: 362px; 
        height: 182px; 
    }
    
    .board-cell {
        width: 90px; 
        height: 90px; 
    }
    
    /* NEU: Mobile Optimierungen */
    .login-container,
    .puzzle-container,
    .coordinates-container {
        margin: 1rem auto;
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 0.25rem;
    }
}