/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Prevent zoom on mobile */
    touch-action: manipulation;
    /* Better mobile font rendering */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Full height on mobile */
    height: 100%;
}

:root {
    --primary-color: #00d4ff;
    --secondary-color: #ff6b6b;
    --accent-color: #4ecdc4;
    --warning-color: #ffd93d;
    --success-color: #6bcf7f;
    --dark-bg: #1a1a2e;
    --darker-bg: #16213e;
    --light-text: #ffffff;
    --shadow-light: rgba(255, 255, 255, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-game: linear-gradient(180deg, #87ceeb 0%, #98fb98 50%, #f0e68c 100%);
    --gradient-pillar: linear-gradient(180deg, #8B4513 0%, #654321 100%);
    --game-width: 450px;
    --game-height: 600px;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: 
        /* Animated overlay gradients */
        linear-gradient(45deg, rgba(46, 204, 113, 0.1) 0%, transparent 25%),
        linear-gradient(-45deg, rgba(52, 152, 219, 0.1) 0%, transparent 25%),
        linear-gradient(135deg, rgba(155, 89, 182, 0.1) 0%, transparent 25%),
        linear-gradient(-135deg, rgba(241, 196, 15, 0.1) 0%, transparent 25%),
        /* Atmospheric depth layers */
        radial-gradient(circle at 30% 70%, rgba(52, 152, 219, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(46, 204, 113, 0.1) 0%, transparent 50%),
        /* Dark overlay for better contrast */
        linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)),
        /* Your background image */
        url('IMG/background.jpg');
    background-size: 
        400% 400%, 400% 400%, 400% 400%, 400% 400%,
        300% 300%, 300% 300%,
        cover,
        cover;
    background-position: 
        0% 0%, 100% 100%, 100% 0%, 0% 100%,
        30% 70%, 70% 30%,
        center,
        center;
    background-attachment: fixed;
    animation: backgroundShift 20s ease-in-out infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Particle Background */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(120, 200, 255, 0.3) 0%, transparent 50%);
}

.particle {
    position: absolute;
    background: var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    animation: float 4s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0) rotate(0deg);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-20px) rotate(180deg);
        opacity: 1;
    }
}

@keyframes backgroundShift {
    0%, 100% { 
        background-position: 
            0% 0%, 100% 100%, 100% 0%, 0% 100%,
            30% 70%, 70% 30%,
            center,
            center;
    }
    25% { 
        background-position: 
            25% 25%, 75% 75%, 75% 25%, 25% 75%,
            40% 60%, 60% 40%,
            center,
            center;
    }
    50% { 
        background-position: 
            50% 50%, 50% 50%, 50% 50%, 50% 50%,
            50% 50%, 50% 50%,
            center,
            center;
    }
    75% { 
        background-position: 
            75% 25%, 25% 75%, 25% 75%, 75% 25%,
            60% 40%, 40% 60%,
            center,
            center;
    }
}

/* Main Game Container */
.game_container {
    width: var(--game-width);
    height: var(--game-height);
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: 
        /* Subtle overlay to enhance contrast */
        linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.1)),
        /* Secondary gradient for depth */
        var(--gradient-game);
    transition: transform 0.3s ease;
}

.game_container:hover {
    transform: scale(1.02);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 50px rgba(46, 204, 113, 0.2);
}

/* Game Canvas */
.game-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: 
        url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M20 20c0-11.046-8.954-20-20-20s-20 8.954-20 20 8.954 20 20 20 20-8.954 20-20zm-30 0c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10-10-4.477-10-10z'/%3E%3C/g%3E%3C/svg%3E") repeat;
}

/* Enhanced Bird Design */
.bird {
    position: absolute;
    width: 50px;
    height: 50px;
    z-index: 100;
    transform-origin: center;
    transition: transform 0.15s ease-out;
}

.bird.flapping {
    animation: birdFlap 0.2s ease-out;
}

@keyframes birdFlap {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

/* Enhanced Pillars */
.pillar {
    position: absolute;
    width: 90px;
    background: var(--gradient-pillar);
    border: 3px solid #27ae60;
    border-radius: 8px;
    box-shadow: 
        inset 0 0 10px rgba(255, 255, 255, 0.2),
        4px 0 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.pillar::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    height: 20px;
    background: linear-gradient(180deg, #2ecc71, #27ae60);
    border-radius: 12px;
    border: 3px solid #27ae60;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pillar.bottom::before {
    top: auto;
    bottom: -8px;
}

.pillar-decoration {
    position: absolute;
    width: 100%;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        #2ecc71,
        #2ecc71 5px,
        #27ae60 5px,
        #27ae60 10px
    );
    top: 50%;
    transform: translateY(-50%);
}

/* Power-ups */
.powerup {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    z-index: 50;
    animation: powerupFloat 2s ease-in-out infinite alternate, powerupRotate 3s linear infinite;
    box-shadow: 0 0 15px currentColor;
}

.powerup.shield {
    background: radial-gradient(circle, #4ecdc4, #2ecc71);
    color: #4ecdc4;
}

.powerup.slowtime {
    background: radial-gradient(circle, #9b59b6, #8e44ad);
    color: #9b59b6;
}

.powerup.extralife {
    background: radial-gradient(circle, #e74c3c, #c0392b);
    color: #e74c3c;
}

.powerup.score {
    background: radial-gradient(circle, #f39c12, #e67e22);
    color: #f39c12;
}

@keyframes powerupFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

@keyframes powerupRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Particle Effects */
.particle-effect {
    position: absolute;
    pointer-events: none;
    z-index: 150;
}

.explosion-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: explode 0.8s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--dx), var(--dy));
        opacity: 0;
    }
}

.score-popup {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: var(--warning-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: scorePopup 1s ease-out forwards;
    z-index: 200;
    pointer-events: none;
}

@keyframes scorePopup {
    0% {
        transform: scale(0.5) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) translateY(-10px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-30px);
        opacity: 0;
    }
}

/* Game UI */
.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    padding: 20px;
    pointer-events: none;
}

.score-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.current-score, .high-score {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 20px;
    color: var(--light-text);
    font-size: 14px;
    font-weight: bold;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.current-score {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.high-score {
    background: linear-gradient(135deg, var(--warning-color), var(--secondary-color));
}

.score-label {
    display: block;
    font-size: 10px;
    opacity: 0.8;
}

.lives-display {
    position: absolute;
    top: 80px;
    left: 20px;
    display: flex;
    gap: 5px;
}

.lives-display .heart {
    color: var(--secondary-color);
    font-size: 20px;
    text-shadow: 0 0 10px currentColor;
    animation: heartbeat 2s ease-in-out infinite;
}

.lives-display .heart.lost {
    color: #666;
    animation: none;
    opacity: 0.3;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.time-display {
    position: absolute;
    top: 120px;
    left: 20px;
    color: var(--accent-color);
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 15px;
    border: 2px solid var(--accent-color);
}

.time-display .timer-label {
    color: var(--secondary-color);
}

.powerup-status {
    position: absolute;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 15px;
    color: var(--light-text);
    font-size: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.powerup-item.active {
    transform: translateX(0);
    opacity: 1;
}

.powerup-item .icon {
    font-size: 16px;
}

.game-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: var(--light-text);
    font-size: 16px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        /* Layered overlay for depth */
        radial-gradient(circle at 30% 30%, rgba(46, 204, 113, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 70% 70%, rgba(52, 152, 219, 0.1) 0%, transparent 40%),
        /* Dark overlay with transparency */
        linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px) saturate(1.2);
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.screen-content {
    text-align: center;
    color: var(--light-text);
    max-width: 500px;
    padding: 40px;
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Start Screen */
/* Simple Professional Start Screen */
.game-header {
    text-align: center;
    margin-bottom: 50px;
}

.game-title {
    font-size: 3.5em;
    font-weight: 800;
    color: #FFD700;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.game-subtitle {
    font-size: 1.2em;
    color: #B8860B;
    margin: 0;
    font-weight: 300;
    opacity: 0.9;
}

/* Clean Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #FFD700;
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-color: #FFD700;
    color: #333;
    font-weight: 700;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #FFA500, #FF8C00);
    transform: translateY(-3px);
}

.menu-btn .icon {
    font-size: 18px;
}

/* Simple Stats */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #B8860B;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.4em;
    font-weight: bold;
    color: #FFD700;
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-color: var(--primary-color);
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    box-shadow: 0 15px 30px rgba(0, 212, 255, 0.4);
    transform: translateY(-3px);
}

.menu-btn .icon {
    font-size: 20px;
}

/* Game Stats */
.game-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.stat-item i {
    color: var(--warning-color);
}

/* Game Over Screen */
.gameover-title {
    font-size: 2.5em;
    margin-bottom: 30px;
    background: linear-gradient(45deg, var(--secondary-color), var(--warning-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-score {
    margin-bottom: 30px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-item.best {
    color: var(--warning-color);
    font-size: 16px;
    animation: celebration 0.6s ease-in-out infinite alternate;
}

@keyframes celebration {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}



/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--darker-bg);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h3 {
    color: var(--light-text);
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Settings */
.modal-body {
    color: var(--light-text);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--accent-color);
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--light-text);
    font-family: inherit;
}

.setting-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* Mode Selection */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.mode-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.mode-card.active {
    border-color: var(--accent-color);
    background: rgba(78, 205, 196, 0.2);
}

.mode-card i {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.mode-card h4 {
    margin-bottom: 8px;
    color: var(--light-text);
    font-size: 1.1em;
}

.mode-card p {
    font-size: 0.9em;
    opacity: 0.8;
    color: var(--light-text);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: var(--light-text);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--light-text);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2em;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Screen Shake Effect */
.screen-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Responsive Design */
/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 5px;
        font-size: 14px;
    }
    
    .game_container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    
    /* Mobile Start Screen */
    .game-header {
        margin-bottom: 30px;
    }
    
    .game-title {
        font-size: 2.5em;
        margin-bottom: 5px;
    }
    
    .game-subtitle {
        font-size: 1em;
    }
    
    .menu-buttons {
        gap: 12px;
        margin-bottom: 30px;
        max-width: 280px;
    }
    
    .menu-btn {
        padding: 16px 20px;
        font-size: 14px;
        gap: 10px;
    }
    
    .menu-btn.primary {
        font-size: 16px;
        padding: 18px 24px;
    }
    
    .menu-btn .icon {
        font-size: 16px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 15px;
    }
    
    /* Mobile UI Elements */
    .lives-display {
        top: 60px;
        left: 15px;
    }
    
    .lives-display .heart {
        font-size: 18px;
    }
    
    .time-display {
        top: 100px;
        left: 15px;
        font-size: 16px;
        padding: 6px 10px;
    }
    
    .powerup-status {
        top: 60px;
        right: 15px;
        gap: 8px;
    }
    
    .powerup-item {
        padding: 8px;
        font-size: 14px;
    }
    
    .score-display {
        font-size: 2em;
    }
    
    /* Mobile Modals */
    .modal-content {
        width: 95vw;
        max-width: 350px;
        padding: 20px;
        margin: 10px;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .mode-card {
        padding: 15px;
    }
    
    .mode-card h4 {
        font-size: 1.1em;
    }
    
    .mode-card p {
        font-size: 0.9em;
    }
}
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .game-stats {
        padding: 20px;
    }
    }
    
    .game-ui {
        padding: 10px;
    }
    
    .score-display {
        font-size: 12px;
        gap: 10px;
    }
    
    .current-score, .high-score {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .menu-btn {
        font-size: 14px;
        padding: 12px 20px;
        gap: 10px;
    }
    
    .title-flappy,
    .title-bird {
        font-size: 2.5em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .game-stats {
        padding: 20px;
    }
    
    .title-ultimate {
        font-size: 1.2em;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mode-card {
        padding: 15px;
    }
    
    .screen-content {
        padding: 20px;
        max-width: 90vw;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding: 0;
        overflow: hidden;
    }
    
    .game_container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    
    /* Extra Small Mobile UI */
    .game-title {
        font-size: 2em;
    }
    
    .game-subtitle {
        font-size: 0.9em;
    }
    
    .menu-buttons {
        gap: 10px;
        max-width: 260px;
    }
    
    .menu-btn {
        padding: 14px 18px;
        font-size: 13px;
    }
    
    .menu-btn.primary {
        font-size: 15px;
        padding: 16px 20px;
    }
    
    .game-stats {
        padding: 12px;
        gap: 10px;
    }
    
    /* Touch-friendly UI elements */
    .lives-display {
        top: 40px;
        left: 10px;
    }
    
    .lives-display .heart {
        font-size: 16px;
    }
    
    .time-display {
        top: 75px;
        left: 10px;
        font-size: 14px;
        padding: 5px 8px;
    }
    
    .powerup-status {
        top: 40px;
        right: 10px;
        gap: 6px;
    }
    
    .powerup-item {
        padding: 6px;
        font-size: 12px;
    }
    
    .score-display {
        font-size: 1.8em;
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .current-score, .high-score {
        padding: 5px 10px;
        font-size: 11px;
        min-width: 80px;
        text-align: center;
    }
    
    .modal-content {
        width: 95vw;
        max-width: 300px;
        padding: 15px;
        margin: 5px;
    }
    
    .mode-card {
        padding: 12px;
    }
    
    .mode-card h4 {
        font-size: 1em;
    }
    
    .mode-card p {
        font-size: 0.85em;
    }
}
    
    .powerup-item {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .game-controls {
        bottom: 8px;
        right: 8px;
        gap: 5px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .menu-btn {
        font-size: 12px;
        padding: 10px 15px;
        gap: 8px;
    }
    
    .menu-btn .icon {
        font-size: 16px;
    }
    
    .title-flappy,
    .title-bird {
        font-size: 2em;
    }
    
    .title-ultimate {
        font-size: 1em;
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    .screen-content {
        padding: 15px;
    }
    
    .modal-content {
        padding: 15px;
        border-radius: 15px;
    }
    
    .bird {
        width: 45px;
        height: 45px;
    }
    
    .pillar {
        width: 80px;
    }
}

/* Touch-friendly Design for Mobile */
@media (hover: none) and (pointer: coarse) {
    /* Mobile touch devices */
    .menu-btn {
        min-height: 44px; /* Apple's recommended touch target size */
        touch-action: manipulation;
    }
    
    .mode-card {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .control-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Remove hover effects on touch devices */
    .menu-btn:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .menu-btn.primary:hover {
        background: linear-gradient(135deg, #FFD700, #FFA500);
        transform: none;
    }
    
    /* Better touch feedback */
    .menu-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .mode-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Time Attack Display */
.time-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--warning-color);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid var(--warning-color);
    box-shadow: 0 0 20px rgba(255, 217, 61, 0.5);
}

/* Enhanced Bird States */
.bird.invulnerable {
    animation: invulnerabilityFlash 0.2s infinite;
}

@keyframes invulnerabilityFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Power-up Collection Effect */
.powerup.collected {
    animation: powerupCollect 0.5s ease-out forwards;
}

@keyframes powerupCollect {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Enhanced Pillar Effects */
.pillar.passed {
    filter: brightness(1.2) saturate(1.5);
    animation: pillarPass 0.3s ease-out;
}

@keyframes pillarPass {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Game Mode Indicators */
.mode-indicator {
    position: absolute;
    top: 120px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

/* Enhanced Button Hover Effects */
.menu-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Difficulty Indicators */
.difficulty-indicator {
    position: absolute;
    bottom: 80px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12px;
    backdrop-filter: blur(5px);
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.difficulty-dot.active {
    background: var(--secondary-color);
    box-shadow: 0 0 10px currentColor;
}

/* Level Progress Bar */
.level-progress {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px currentColor;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 480px) {
    .time-display {
        top: 10px;
        font-size: 16px;
        padding: 8px 15px;
    }
    
    .mode-indicator {
        top: 100px;
        left: 10px;
        font-size: 10px;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    :root {
        --shadow-light: rgba(255, 255, 255, 0.15);
        --shadow-dark: rgba(0, 0, 0, 0.6);
    }
}

/* Performance Optimizations */
.game-canvas,
.bird,
.pillar,
.powerup,
.particle {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Print Styles */
@media print {
    .game_container,
    .screen,
    .modal {
        display: none !important;
    }
    
    body::after {
        content: "Flappy Bird Ultimate - Visit the website to play!";
        display: block;
        text-align: center;
        font-size: 24px;
        margin-top: 100px;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .particle,
    .explosion-particle,
    .score-popup {
        animation: none !important;
    }
    
    .bird-wing {
        animation: none !important;
    }
    
    .loading-spinner {
        animation: none !important;
        border: 4px solid var(--primary-color);
    }
}

/* Focus styles for keyboard navigation */
.menu-btn:focus,
.control-btn:focus,
.close-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bird-body {
        border-width: 3px;
    }
    
    .pillar {
        border-width: 4px;
    }
    
    .menu-btn,
    .control-btn {
        border-width: 3px;
    }
}

/* Custom scrollbar for modal content */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --shadow-light: rgba(255, 255, 255, 0.8);
        --shadow-dark: rgba(0, 0, 0, 0.8);
    }
    
    .menu-btn,
    .control-btn {
        border: 2px solid var(--light-text);
    }
}