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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

main {
    padding: 40px;
}

.game-container {
    text-align: center;
}

.game-header h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 10px;
}

.game-description {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #555;
}

#grid-size {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

#grid-size:hover {
    border-color: #667eea;
}

#grid-size:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

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

.game-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
}

#timer, #next-number, #best-time {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
}

.schulte-grid {
    display: grid;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto 30px;
    aspect-ratio: 1;
}

.grid-cell {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.grid-cell:hover {
    background: #f8f8f8;
    transform: scale(1.05);
    border-color: #667eea;
}

.grid-cell.correct {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
    border-color: #84fab0;
    animation: correctPulse 0.5s ease;
}

.grid-cell.wrong {
    background: #ff6b6b;
    color: white;
    border-color: #ff5252;
    animation: shake 0.5s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.message {
    min-height: 30px;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .game-header h2 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 20px;
    }
    
    .schulte-grid {
        max-width: 350px;
    }
    
    .grid-cell {
        font-size: 1.4rem;
    }
    
    .game-stats {
        gap: 20px;
    }
}