/* Enhanced game area with gradient background */
.game-area {
    border: 3px solid #0d6efd;
    border-radius: 15px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(13, 110, 253, 0.3);
    position: relative;
    overflow: hidden;
}

.game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(13, 110, 253, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

#gameCanvas {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 2px solid rgba(13, 110, 253, 0.5);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced game stats with better visual hierarchy */
.game-stats {
    font-size: 1.3em;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.game-stats .badge {
    padding: 10px 15px;
    font-size: 0.9em;
    border-radius: 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, var(--bs-primary) 0%, #0056b3 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced input styling */
#wordInput {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: var(--bs-light);
    border: 2px solid #0d6efd;
    border-radius: 10px;
    padding: 15px;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
    transition: all 0.3s ease;
}

#wordInput:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25), 0 4px 16px rgba(13, 110, 253, 0.3);
    transform: translateY(-2px);
}

/* Enhanced instructions styling */
#instructions {
    text-align: left;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(13, 110, 253, 0.3);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Enhanced section styling */
.daily-challenge-section, .practice-mode-section {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
    border-radius: 15px;
    padding: 25px;
    border: 2px solid rgba(13, 110, 253, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.daily-challenge-section:hover, .practice-mode-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: rgba(13, 110, 253, 0.4);
}

/* Enhanced navigation */
.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 3px solid #0d6efd;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5em;
    color: #0d6efd !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Improved form controls */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Pulse animation for important elements */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Animation for correct answers */
.animate-score {
    animation: scoreBoost 0.6s ease-out;
}

@keyframes scoreBoost {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #28a745; }
    100% { transform: scale(1); }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Success celebration animation */
.success-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(40, 167, 69, 0.3) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1000;
    animation: successFlash 0.8s ease-out;
}

@keyframes successFlash {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1.2); }
}

/* Level up animation */
.level-up-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #000;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 2em;
    font-weight: bold;
    z-index: 1001;
    animation: levelUpBounce 1.5s ease-out;
    box-shadow: 0 10px 30px rgba(255, 193, 7, 0.5);
}

@keyframes levelUpBounce {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); 
    }
    50% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.1) rotate(5deg); 
    }
    70% { 
        transform: translate(-50%, -50%) scale(0.9) rotate(-2deg); 
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1) rotate(0deg); 
    }
}

/* Enhanced word animation on canvas */
.word-trail {
    position: absolute;
    pointer-events: none;
    color: rgba(13, 110, 253, 0.6);
    font-size: 0.8em;
    animation: fadeTrail 1s ease-out forwards;
}

@keyframes fadeTrail {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.2); }
}

/* Modal overlay for game over */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    animation: fadeIn 0.3s ease-out;
}

.game-over-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #0d6efd;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.5s ease-out;
}

.game-over-modal h2 {
    color: #ffc107;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.game-over-modal p {
    font-size: 1.2em;
    margin-bottom: 15px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(-50px) scale(0.8); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Attempts notification */
.attempts-notification {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    z-index: 100;
    animation: notificationSlide 0.5s ease-out;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

@keyframes notificationSlide {
    from { 
        opacity: 0; 
        transform: translateX(-50%) translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-50%) translateY(0); 
    }
}

/* Mode selection layout improvements */
.mode-selection-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-selection-container .btn-group {
    display: flex;
    justify-content: center;
}

.mode-selection-container .btn {
    flex: 1;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .shape-container {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
    
    .level-up-animation {
        font-size: 1.5em;
        padding: 15px 30px;
    }
    
    .game-over-modal {
        margin: 20px;
        padding: 30px;
    }
    
    .game-over-modal h2 {
        font-size: 2em;
    }
    
    /* Smaller buttons on mobile for better fit */
    .mode-selection-container .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }
    
    /* Ensure button groups wrap properly on very small screens */
    .btn-group {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .mode-selection-container .btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.25rem;
    }
    
    /* Stack all mode buttons vertically on very small screens */
    .mode-selection-container {
        gap: 4px;
    }
    
    .mode-selection-container .btn-group {
        flex-direction: column;
    }
    
    .mode-selection-container .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 2px;
    }
}

/* Logo styles */
.logo-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Bus title animation */
.title-container {
    height: 120px;
    position: relative;
    overflow: hidden;
}

.bus-title {
    position: absolute;
    left: -300px;
    animation: driveAcross 6s forwards;
}

.bus-body {
    background-color: var(--bs-primary);
    padding: 10px 30px;
    border-radius: 10px;
    position: relative;
}

.bus-body h1 {
    color: var(--bs-light);
    margin: 0;
    font-size: 2.5em;
}

.wheels {
    display: flex;
    justify-content: space-between;
    width: 80%;
    margin: -5px auto 0;
}

.wheel {
    width: 20px;
    height: 20px;
    background-color: var(--bs-dark);
    border: 3px solid var(--bs-light);
    border-radius: 50%;
    animation: rotate 2s linear infinite;
}

@keyframes driveAcross {
    0% { 
        left: -300px;
    }
    45% { 
        left: calc(100% - 300px);
    }
    50% {
        left: calc(100% - 300px);
    }
    95% {
        left: calc(50% - 150px);
    }
    100% {
        left: calc(50% - 150px);
    }
}

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

/* Difficulty selection */
#difficultySelect .btn-group {
    gap: 10px;
}

#difficultySelect .btn {
    min-width: 100px;
}

/* Enhanced buttons with hover effects */
.btn {
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    border-color: #0d6efd;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    border-color: #0056b3;
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}

.btn-success:hover {
    background: linear-gradient(135deg, #146c43 0%, #0f5132 100%);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #000;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #cc9a00 100%);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

#beginButton {
    display: none;
    margin: 20px auto;
    font-size: 1.2em;
    padding: 12px 30px;
}

/* Enhanced shape container styles */
.shape-container {
    width: 70px;
    height: 70px;
    border: 2px solid #444;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    cursor: pointer;
    margin: 8px auto;
    background: linear-gradient(135deg, #2b2b2b 0%, #1a1a1a 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.shape-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.shape-container:hover {
    background: linear-gradient(135deg, #3c3c3c 0%, #2a2a2a 100%);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.2);
    border-color: #0d6efd;
}

.shape-container:hover::before {
    left: 100%;
}

.shape-container.selected {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.4);
    border-color: #80bdff;
}

/* Enhanced category styling */
.shape-container.shaded {
    background: linear-gradient(135deg, #2b2b2b 0%, #1a1a1a 100%);
    border-color: #555;
}

.shape-container.unshaded {
    background: linear-gradient(135deg, #212121 0%, #0f0f0f 100%);
    border-color: #333;
}

.shape-container.bordered {
    background: linear-gradient(135deg, #2b2b2b 0%, #1a1a1a 100%);
    border: 3px solid #666;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

#selectedShapesDisplay {
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 10px;
    border: 2px solid rgba(13, 110, 253, 0.3);
}

.selected-shape {
    margin: 5px;
    font-size: 36px;
    padding: 8px;
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: bounceIn 0.3s ease-out;
}

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