/* ==================== GLOBALE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: url('bg.png');
    background-size: cover, cover;
    background-position: center, center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', 'Poppins', Roboto, 'Helvetica Neue', sans-serif;
    padding: 20px;
    position: relative;
}

/* Hintergrund-Overlay für bessere Lesbarkeit der Inhalte */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 0;
}

/* ==================== LOGIN OVERLAY ==================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.login-box {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 45px 40px;
    border-radius: 64px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 420px;
    width: 90%;
    border: 1px solid rgba(255, 215, 150, 0.3);
    animation: slideUp 0.5s ease;
    position: relative;
    z-index: 1;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3));
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-box h2 {
    background: linear-gradient(135deg, #f9e7c2, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.login-box p {
    color: #cbae86;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    color: #f5e7c8;
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 60px;
    background: rgba(249, 231, 194, 0.95);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.input-group input:focus {
    box-shadow: 0 0 0 3px #e67e22, inset 0 2px 5px rgba(0,0,0,0.1);
    transform: scale(1.02);
    background: #fff5e6;
}

.login-btn {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border: none;
    padding: 14px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 60px;
    cursor: pointer;
    width: 100%;	
    border:2px solid #e67e22;
    transform: translateY(-2px);
    transition: 0.05s linear;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-btn:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 #b45f1b;
}

.error-msg {
    color: #e67e22;
    margin-top: 18px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 40px;
}

.image-info {
    margin-top: 20px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 40px;
    color: #f9e7c2;
    font-size: 0.9rem;
    border: 2px solid #e67e22;
}

.image-info.warning {
    background: rgba(230, 126, 34, 0.2);
    color: #f39c12;
    border-color: #e67e22;
}

/* ==================== MODUS-UMSCHALTER ==================== */
.mode-switcher {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.mode-btn {
    background: linear-gradient(135deg, rgba(44, 62, 47, 0.9), rgba(30, 47, 26, 0.9));
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 215, 150, 0.3);
    padding: 12px 30px;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #cbae86;
    font-family: inherit;
}

.mode-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: #e67e22;
    box-shadow: 0 5px 20px rgba(230, 126, 34, 0.3);
}

.mode-btn.mode-active {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    border-color: #f9e7c2;
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.4);
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== VORSCHAU-BEREICH ==================== */
.preview-container {
    background: linear-gradient(135deg, rgba(30, 47, 42, 0.95), rgba(15, 30, 26, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 32px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e67e22;
    animation: previewPulse 1.5s ease-in-out infinite;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes previewPulse {
    0%, 100% { 
        border-color: #e67e22; 
        box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.4); 
    }
    50% { 
        border-color: #f39c12; 
        box-shadow: 0 0 0 8px rgba(243, 156, 18, 0.2); 
    }
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.preview-icon {
    font-size: 1.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.preview-title {
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #f9e7c2, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
}

.preview-timer {
    font-size: 2rem;
    font-weight: bold;
    color: #e67e22;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 15px;
    border-radius: 40px;
    min-width: 70px;
    text-align: center;
    text-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
}

.preview-seconds {
    color: #cbae86;
    font-size: 0.9rem;
}

.preview-image-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border: 3px solid #e67e22;
    animation: imageZoom 0.5s ease;
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.05);
}

@keyframes imageZoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.preview-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.preview-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e67e22, #f39c12);
    width: 100%;
    border-radius: 10px;
    transition: width 1s linear;
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
}

.preview-skip-btn {
    background: linear-gradient(135deg, #7f8c8d, #5d6e6e);
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
    transition: all 0.2s ease;
}

.preview-skip-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.4);
}

/* ==================== HAUPTSPIEL ==================== */
.game-wrapper {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.game-header {
    text-align: center;
    margin-bottom: 25px;
}

.game-header h1 {
    background: linear-gradient(135deg, #f9e7c2, #e67e22, #f39c12);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titleGlow 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(230, 126, 34, 0.3)); }
    50% { filter: drop-shadow(0 0 15px rgba(230, 126, 34, 0.6)); }
}

.subtitle {
    color: #cbae86;
    font-size: 0.85rem;
    margin-top: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Stats Panel */
.stats-panel {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, rgba(30, 47, 42, 0.9), rgba(15, 30, 26, 0.9));
    backdrop-filter: blur(5px);
    padding: 12px 20px;
    border-radius: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 110px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 150, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(230, 126, 34, 0.5);
}

.stat-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

.stat-info {
    text-align: left;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #cbae86;
    letter-spacing: 1px;
    display: block;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #f9e7c2, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

/* Puzzle Container */
.puzzle-container {
    background: linear-gradient(145deg, rgba(42, 62, 42, 0.9), rgba(30, 47, 26, 0.9));
    backdrop-filter: blur(5px);
    border-radius: 48px;
    padding: 20px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 15px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 150, 0.2);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    background-color: rgba(62, 90, 62, 0.5);
    padding: 20px;
    border-radius: 32px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.tile {
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #f9e7c2, #ecd9b4);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 800;
    color: #3d2a1a;
    cursor: pointer;
    box-shadow: 0 10px 0 #a27b4a;
    transform: translateY(-3px);
    transition: all 0.08s linear;
    text-shadow: 2px 2px 0 rgba(255, 215, 150, 0.8);
    position: relative;
    background-size: cover;
    background-position: center;
}

/* Bild-Puzzle Kacheln */
.tile.image-tile {
    background-size: 400% 400%;
    color: transparent;
    text-shadow: none;
    box-shadow: 0 8px 0 #7a5a36;
}

.tile:active {
    transform: translateY(5px);
    box-shadow: 0 4px 0 #7a5a36;
}

.empty {
    background: linear-gradient(145deg, #6f8f6a, #5a7855);
    box-shadow: inset 0 0 0 3px #8fae8a, 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: none;
}

.empty:active {
    transform: none;
    box-shadow: inset 0 0 0 3px #8fae8a;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.user-badge {
    background: linear-gradient(135deg, rgba(30, 47, 42, 0.9), rgba(15, 30, 26, 0.9));
    backdrop-filter: blur(5px);
    padding: 8px 20px;
    border-radius: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 150, 0.2);
}

.username {
    background: linear-gradient(135deg, #f9e7c2, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: bold;
    font-size: 1rem;
}

.logout-btn {
    background: #7f8c8d;
    border: none;
    padding: 6px 16px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.1s ease;
    box-shadow: 0 3px 0 #5d6e6e;
    transform: translateY(-1px);
}

.logout-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #5d6e6e;
}

.game-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    border: none;
    padding: 10px 24px;
    border-radius: 60px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translateY(-2px);
    font-family: inherit;
    backdrop-filter: blur(5px);
}

.btn:active {
    transform: translateY(3px);
}

.btn-primary {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    box-shadow: 0 5px 0 #b45f1b;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #b45f1b;
}

.btn-random {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 5px 0 #1f618d;
}

.btn-random:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #1f618d;
}

.btn-highscore {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 5px 0 #c47d0a;
}

.btn-highscore:hover {
    background: linear-gradient(135deg, #f5b041, #f39c12);
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #c47d0a;
}

/* Win Banner */
.win-banner {
    margin-top: 20px;
    min-height: 100px;
}

.win-message {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.95), rgba(230, 126, 34, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    animation: winPulse 0.6s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes winPulse {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.win-icon {
    font-size: 3rem;
    animation: winSpin 0.5s ease;
}

@keyframes winSpin {
    from { transform: rotate(0deg) scale(0); }
    to { transform: rotate(360deg) scale(1); }
}

.win-text h3 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.win-text p {
    font-size: 0.9rem;
    color: #fff5e6;
}

/* Game Footer */
.game-footer {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 40px;
    border: 1px solid rgba(255, 215, 150, 0.2);
}

.game-footer p {
    color: #7e9a8e;
    font-size: 0.7rem;
    margin: 5px 0;
}

.mode-numbers {
    background: linear-gradient(135deg, #f9e7c2, #ecd9b4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mode-images {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Timer Warnung */
@keyframes timerWarning {
    0%, 100% { 
        background: linear-gradient(135deg, #f9e7c2, #ecd9b4);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    50% { 
        background: linear-gradient(135deg, #e67e22, #f39c12);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        text-shadow: 0 0 8px #e67e22;
    }
}

.timer-warning {
    animation: timerWarning 0.5s ease-in-out infinite;
}

/* Copyright Footer */
.copyright {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 215, 150, 0.2);
    font-size: 0.7rem;
    color: #7e9a8e;
    text-align: center;
    letter-spacing: 0.5px;
}

.copyright:hover {
    color: #cbae86;
    transition: color 0.3s ease;
}

/* Login Footer */
.login-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 215, 150, 0.2);
    font-size: 0.7rem;
    color: #7e9a8e;
    text-align: center;
    letter-spacing: 0.5px;
}

.login-footer:hover {
    color: #cbae86;
    transition: color 0.3s ease;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 550px) {
    body {
        padding: 15px;
    }
    
    .grid {
        gap: 10px;
        padding: 15px;
    }
    
    .tile {
        font-size: 1.6rem;
        border-radius: 18px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .stat-card {
        padding: 8px 12px;
        min-width: 85px;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .game-header h1 {
        font-size: 1.6rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .mode-btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    .win-message {
        padding: 15px;
    }
    
    .win-icon {
        font-size: 2rem;
    }
    
    .win-text h3 {
        font-size: 1.1rem;
    }
    
    .preview-image {
        max-width: 150px;
        max-height: 150px;
    }
    
    .preview-timer {
        font-size: 1.5rem;
        padding: 3px 12px;
        min-width: 55px;
    }
    
    .preview-title {
        font-size: 1rem;
    }
}

@media (max-width: 450px) {
    .stats-panel {
        gap: 8px;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .user-badge {
        width: 100%;
        justify-content: center;
    }
    
    .game-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .mode-switcher {
        flex-direction: column;
    }
}