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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28102, 126, 234, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.logo-maze {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: pulse 2s infinite;
}

.logo-maze::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 2px;
}

.logo-maze::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 2px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-brand.logo {
    margin-right: 0;
}

.nav-link {
    color: #333 !important;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem !important;
    border-radius: 20px;
    margin: 0 0.25rem;
}

.nav-link:hover {
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    color: white !important;
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

/* Game Section */
.game-section {
    margin-bottom: 3rem;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.game-header h1 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-description {
    color: #666;
}

.game-controls {
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 2px solid #e9ecef !important;
}

.btn-secondary:hover {
    background: #e9ecef !important;
    transform: translateY(-2px);
    color: #333 !important;
}

.level-display,
.score-display,
.lives-display {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

/* Game Status */
.game-status {
    margin-bottom: 2rem;
}

.game-message {
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 1rem;
    min-height: 30px;
}

.progress-container {
    max-width: 400px;
    margin: 0 auto;
}

.progress {
    height: 10px;
    border-radius: 5px;
    background-color: rgba(102, 126, 234, 0.2);
}

.progress-bar {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* Game Grid */
.game-grid-container {
    margin: 2rem 0;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.grid-cell {
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    min-height: 80px;
}

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

.grid-cell.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.grid-cell.correct {
    background: linear-gradient(45deg, #51cf66, #40c057);
    color: white;
    border-color: #51cf66;
    animation: correctPulse 0.5s ease-out;
}

.grid-cell.incorrect {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border-color: #ff6b6b;
    animation: incorrectShake 0.5s ease-out;
}

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

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

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes incorrectShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.grid-cell.sequence-highlight {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    border-color: #ffd700;
    transform: scale(1.1);
    animation: sequenceGlow 0.8s ease-in-out;
}

@keyframes sequenceGlow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

/* Game Stats */
.game-stats {
    margin-top: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 1.5rem 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Info Sections */
.info-section,
.leaderboard-section {
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.info-container,
.leaderboard-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

.instruction-item {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.instruction-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.instruction-item h4 {
    color: #333;
    margin-bottom: 1rem;
    font-weight: 600;
}

.instruction-item p {
    color: #666;
    line-height: 1.6;
}

.game-tips {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    padding: 2rem;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 0.5rem 0;
    color: #555;
    position: relative;
    padding-left: 1.5rem;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: 0;
    top: 0.5rem;
}

/* Leaderboard */
.leaderboard-table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1fr 2fr;
    gap: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1fr 2fr;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.3s ease;
}

.leaderboard-entry:hover {
    background-color: #f8f9fa;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.rank-col {
    font-weight: 600;
    color: #667eea;
}

/* Modal Styles */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 20px 20px 0 0;
}

.modal-title {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.game-over-content {
    padding: 1rem;
}

.final-stats {
    margin-bottom: 2rem;
}

.final-stats h2 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.final-stats h3 {
    color: #333;
    font-size: 1.5rem;
}

.performance-breakdown {
    margin-bottom: 2rem;
}

.performance-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.performance-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.performance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.performance-rating h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.performance-rating p {
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-grid {
        max-width: 300px;
        gap: 8px;
    }

    .grid-cell {
        min-height: 60px;
        font-size: 1.2rem;
    }

    .game-controls {
        justify-content: center;
        text-align: center;
    }

    .game-controls>* {
        margin: 0.25rem;
    }

    .leaderboard-header,
    .leaderboard-entry {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
        font-size: 0.8rem;
    }

    .instruction-item {
        padding: 1rem;
    }

    .stat-card {
        margin-bottom: 1rem;
    }

    .game-tips {
        padding: 1rem;
    }
}