/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, 
        #85C1E9 0%,   /* Sky blue - fresh and inviting */
        #82E0AA 25%,  /* Cyan-green - vibrant transition */
        #85E88D 50%,  /* Bright green - energetic center */
        #D5F4A0 75%,  /* Lime-yellow - playful blend */
        #FFF176 100%  /* Soft yellow - cheerful accent */
    );
    overflow: hidden;
    height: 100vh;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}


.hidden {
    display: none !important;
}

/* Main Menu Styles */
        .menu-container {
            text-align: center;
            background: rgba(255, 255, 255, 0.9);
            padding: 40px 40px 30px 40px; /* Reduced bottom padding by 10px */
            border-radius: 20px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            border: 3px solid #333;
            min-height: 450px;
            position: relative;
            z-index: 10;
        }

.game-title {
    font-size: 4.5rem;
    color: #2c3e50;
    margin-bottom: 20px; /* Reduced from 30px to 20px */
    margin-top: 85px; /* Move title down by 15px (70px + 15px) */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}


.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.copyright-text {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    margin-top: 20px;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
}

.menu-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border: 3px solid #2e7d32;
    color: white;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.menu-btn:hover {
    background: linear-gradient(145deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.play-btn {
    background: linear-gradient(145deg, #FF6B6B, #e74c3c);
    border-color: #c0392b;
}

.play-btn:hover {
    background: linear-gradient(145deg, #e74c3c, #FF6B6B);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    border: 4px solid #333;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2rem;
}

.controls-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}

.control-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.2rem;
}

.key {
    background: #f0f0f0;
    border: 2px solid #333;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 1.5rem;
    min-width: 50px;
    text-align: center;
}

.game-rules {
    margin: 30px 0;
    text-align: left;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.game-rules p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: #495057;
}

.modal-content .menu-btn {
    margin-top: 10px;
}

/* Modal buttons stacked layout */
.modal-buttons-stacked {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.modal-buttons-stacked .menu-btn {
    width: 100%;
    max-width: 250px;
    margin: 0;
}

/* Control text visibility - default (desktop) */
.control-text-mobile {
    display: none;
}

.control-text-desktop {
    display: inline;
}

/* Game Over Bird Canvas */
.game-over-bird {
    margin: 0 auto 20px;
    display: block;
}

/* Completion Title - Show/Hide Text */
.completion-title-mobile {
    display: none; /* Hidden on desktop by default */
}

.completion-title-full {
    display: inline; /* Shown on desktop by default */
}

/* Game Screen Styles */
#gameScreen {
    flex-direction: column;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #F0E68C 100%);
    position: relative;
    overflow: hidden;
    z-index: 5;
}

.game-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100; /* Ensure HUD is above game canvas */
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #333;
    font-weight: bold;
    font-size: 1.1rem;
}

.hud-left {
    text-align: left;
}

.hud-right {
    text-align: right;
}

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

#gameCanvas {
    border: none;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* Mobile Game Controls - Standalone Buttons */
.mobile-game-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 100;
}

.mobile-control-btn {
    flex: 1;
    max-width: 200px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.menu-btn-mobile:hover,
.pause-btn-mobile:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Stage Popup Styles */
.stage-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 200px));
    z-index: 300;
    pointer-events: none;
}

.stage-popup-content {
    background: white;
    padding: 20px 40px;
    border-radius: 15px;
    border: 3px solid #333;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.stage-popup-content h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin: 0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Main Menu Confirmation Popup */
.main-menu-confirm-content {
    max-width: 320px !important;
    text-align: center;
    padding: 20px 15px !important;
}

.main-menu-confirm-title {
    font-size: 1.6rem !important;
    color: #2c3e50;
    margin-bottom: 1px;
    line-height: 1.1;
    font-family: 'Courier New', monospace;
}

.main-menu-confirm-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 15px;
    margin-top: 0;
    line-height: 1.2;
    font-style: italic;
}

.main-menu-confirm-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.main-menu-confirm-buttons .menu-btn {
    min-width: 120px !important;
    padding: 10px 18px !important;
    font-size: 0.95rem !important;
}

/* Leave button - Red */
.main-menu-confirm-buttons .submit-btn {
    background: linear-gradient(145deg, #FF6B6B, #e74c3c) !important;
    border: 3px solid #c0392b !important;
}

.main-menu-confirm-buttons .submit-btn:hover {
    background: linear-gradient(145deg, #e74c3c, #FF6B6B) !important;
}

/* Go Back button - Green (keep existing styling) */

/* Overlay Styles */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.pause-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    border: 4px solid #333;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.pause-content h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2rem;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

/* Game Over & Victory Screens */
.game-over-container,
.victory-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 4px solid #333;
    max-width: 500px;
}

/* Leaderboard Screen */
.leaderboard-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 4px solid #333;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 200;
}

.leaderboard-container h1 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: #f39c12;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.trophy-icon {
    display: inline-block;
    font-size: 3rem;
    margin-right: 10px;
}

.leaderboard-table-container {
    margin: 30px 0;
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-table th {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    padding: 15px 10px;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.leaderboard-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #ddd;
    font-size: 1rem;
}

.leaderboard-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.leaderboard-table tbody tr:hover {
    background-color: #e8f5e8;
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.leaderboard-table tbody tr:first-child {
    background: linear-gradient(145deg, #FFD700, #FFA500);
    font-weight: bold;
    color: #8B4513;
}

.leaderboard-table tbody tr:nth-child(2) {
    background: linear-gradient(145deg, #E8E8E8, #D3D3D3);
    font-weight: bold;
    color: #2C3E50;
}

.leaderboard-table tbody tr:nth-child(3) {
    background: #E6A85C;
    font-weight: bold;
    color: #2C3E50;
}

.leaderboard-buttons {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

/* Leaderboard Bird Animation */
.leaderboard-bird-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Landing Page Bird Animation */
.landing-bird-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 1.0;
}

.game-over-container h1,
.victory-container h1 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: #2c3e50;
}

.victory-container h1 {
    color: #f39c12;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.final-score {
    margin: 30px 0;
    font-size: 1.5rem;
    color: #495057;
}

.final-score p {
    margin: 10px 0;
}

/* Player Info Form Styles */
.player-info-form {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    margin: 25px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

.player-info-form h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #FF6B9D;
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

#submitScoreBtn,
#submitVictoryScoreBtn {
    width: 100%;
    margin-top: 10px;
    font-size: 1.1rem;
    padding: 15px;
}

.game-over-buttons,
.victory-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 30px;
}

/* Old responsive styles removed - replaced by comprehensive mobile portrait media query below */

/* Unused animation classes removed for cleaner code */

/* Leaderboard Bird Canvas */
.leaderboard-bird-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

/* Leaderboard Container */
.leaderboard-container {
    position: relative;
    z-index: 1;
}

/* Real-time Play Counter */
.play-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    width: auto; /* Auto width to match content */
    max-width: 500px; /* Constrain to reasonable size */
}

.counter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-align: center;
    margin-top: 12px;
    font-family: 'Courier New', monospace;
}

.counter-display {
    display: flex;
    gap: 3px;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
}

.counter-digit {
    display: inline-block;
    width: 32px;
    height: 36px;
    background: #f5f5f5;
    color: #333;
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-align: center;
    line-height: 36px;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.counter-digit.flip {
    animation: digitFlip 0.6s ease;
}

@keyframes digitFlip {
    0% {
        transform: rotateX(0deg);
        background: #f5f5f5;
    }
    50% {
        transform: rotateX(90deg);
        background: #e0e0e0;
    }
    100% {
        transform: rotateX(0deg);
        background: #f5f5f5;
    }
}

/* Mobile Portrait Mode Optimizations */
@media (max-width: 768px) and (orientation: portrait) {
    body {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        overflow: hidden;
    }
    
    /* Landing Page - Compact for portrait */
    .game-title {
        font-size: 2.5rem;
        margin-top: 60px;          /* Increased by 40px (from 20px to 60px) */
        margin-bottom: 15px;
    }
    
    .menu-container {
        padding: 20px 15px 15px 15px;
        min-height: auto;
        max-width: 85%;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .menu-buttons {
        gap: 10px;
    }
    
    .menu-btn {
        font-size: 0.9rem;
        padding: 10px 15px;
        min-width: 160px;
    }
    
    .copyright-text {
        font-size: 0.6rem;
        margin-top: 15px;
    }
    
    /* Landing bird animation - proportionately smaller for mobile */
    .landing-bird-canvas {
        opacity: 0.8;
        transform: scale(0.65); /* Scale down bird to 65% */
    }
    
    /* Game HUD - More compact */
    .game-hud {
        font-size: 0.75rem;
        padding: 6px 10px;
        top: 5px;
        left: 5px;
        right: 5px;
    }
    
    .hud-item {
        font-size: 0.75rem;
    }
    
    /* Modals - Fit on screen */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 90%;
        max-height: 85vh;
        padding: 20px 15px;
        overflow-y: auto;
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .controls-info {
        gap: 10px;
        margin: 15px 0;
    }
    
    .control-item {
        font-size: 1rem;
        gap: 10px;
    }
    
    .key {
        font-size: 1.2rem;
        padding: 6px 10px;
        min-width: 40px;
    }
    
    .game-rules {
        margin: 15px 0;
        padding: 15px;
    }
    
    .game-rules p {
        font-size: 0.95rem;
        margin: 8px 0;
    }
    
    /* Leaderboard - Scrollable */
    .leaderboard-container {
        max-width: 90%;
        max-height: 85vh;
        padding: 20px 15px;
        overflow-y: auto;
    }
    
    .leaderboard-container h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .trophy-icon {
        font-size: 2rem;
    }
    
    .leaderboard-table-container {
        margin: 15px 0;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 3px;
        font-size: 0.7rem;
    }
    
    .leaderboard-table th {
        font-size: 0.75rem;
    }
    
    /* Make table horizontally scrollable on mobile */
    .leaderboard-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Canvas - Full screen */
    #gameCanvas {
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        width: 100vw !important;
        height: 100vh !important;
    }
    
    /* Game HUD - Adjust for mobile browser UI */
    .game-hud {
        top: 20px !important; /* Moved much higher for better visibility */
        left: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 1.01rem; /* Decreased by 10% from 1.12rem (total ~25% smaller than original) */
    }
    
    .hud-left, .hud-center, .hud-right {
        font-size: 1.01rem !important; /* Decreased by 10% from 1.12rem */
    }
    
    #livesCount, #scoreCount, #currentRound {
        font-size: 1.01rem !important; /* Decreased by 10% from 1.12rem */
    }
    
    /* Stage Popup - Compact for mobile with increased font */
    .stage-popup {
        z-index: 1000 !important; /* Ensure it's above everything on mobile */
    }
    
    .stage-popup-content {
        padding: 20px 40px;
        max-width: 90vw;
    }
    
    .stage-popup-content h2,
    #stageText {
        font-size: 1.62rem !important; /* Increased by 35% from 1.2rem */
        white-space: nowrap; /* Keep text in one line */
    }
    
    /* Stage Complete Popup - Compact with increased font */
    #stageCompletePopup {
        z-index: 1000 !important;
    }
    
    #stageCompleteText {
        font-size: 1.62rem !important; /* Increased by 35% from 1.2rem */
        white-space: nowrap; /* Keep text in one line */
    }
    
    /* Pause Popup - Compact for mobile with increased font */
    .pause-popup {
        padding: 10px;
    }
    
    .pause-content {
        padding: 25px 20px;
        max-width: 90%;
    }
    
    .pause-content h2 {
        font-size: 2.03rem !important; /* Increased by 35% from 1.5rem */
        margin-bottom: 10px;
    }
    
    .pause-content p {
        font-size: 1.22rem !important; /* Increased by 35% from 0.9rem */
        line-height: 1.4;
    }
    
    /* Game Over/Victory Popups with increased fonts */
    .game-over-container,
    .victory-container {
        padding: 25px 15px;
        max-width: 85%;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .game-over-bird {
        width: 60px !important;
        height: 40px !important;
    }
    
    .completion-title,
    #completionTitle {
        font-size: 1.76rem !important; /* Increased by 35% from 1.3rem */
        margin: 15px 0 10px 0;
    }
    
    .score-display,
    .completion-details p {
        font-size: 1.35rem !important; /* Increased by 35% from 1rem */
        margin: 10px 0;
    }
    
    .player-info {
        margin: 15px 0;
    }
    
    .player-info input {
        padding: 10px;
        font-size: 1.22rem !important; /* Increased by 35% from 0.9rem */
        margin: 5px 0;
    }
    
    .completion-buttons {
        gap: 8px;
        margin-top: 15px;
    }
    
    .completion-buttons .menu-btn {
        font-size: 1.15rem !important; /* Increased by 35% from 0.85rem */
        padding: 12px 18px;
        min-width: 160px;
    }
    
    /* Game Over Modal - Mobile specific */
    .game-over-bird {
        width: 120px !important; /* Smaller bird on mobile (75% of 160px) */
        height: 81px !important; /* Proportional height (75% of 108px) */
    }
    
    /* Hide full title, show mobile title */
    .completion-title-full {
        display: none !important;
    }
    
    .completion-title-mobile {
        display: inline !important;
    }
    
    /* Play Counter - Mobile adjustments */
    .play-counter {
        bottom: 15px;
        padding: 10px 12px;
        width: auto;
        max-width: 85%; /* Match menu-container mobile width */
    }
    
    .counter-label {
        font-size: 0.65rem;
        margin-top: 10px;
        margin-bottom: 0;
    }
    
    .counter-display {
        gap: 2px;
    }
    
    .counter-digit {
        width: 26px;
        height: 28px;
        font-size: 1.1rem;
        line-height: 28px;
    }
    
    /* Hide Pause/Resume control on mobile */
    .control-item-desktop {
        display: none !important;
    }
    
    /* Show mobile control text, hide desktop text */
    .control-text-mobile {
        display: inline !important;
    }
    
    .control-text-desktop {
        display: none !important;
    }
    
    /* Ensure modal buttons are properly stacked on mobile */
    .modal-buttons-stacked .menu-btn {
        width: 100%;
        max-width: 85%;
        padding: 15px 30px; /* Match main menu button height */
        font-size: 1.2rem;
    }
    
    /* Ensure single-line layout on mobile */
    .mobile-game-controls {
        gap: 12px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .mobile-control-btn {
        flex: 1;
        max-width: 180px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* Extra Small Phones (iPhone SE, etc.) */
@media (max-width: 375px) and (orientation: portrait) {
    .game-title {
        font-size: 2rem;
        margin-top: 55px;          /* Increased by 40px (from 15px to 55px) */
        margin-bottom: 10px;
    }
    
    .menu-container {
        padding: 15px 10px;
        max-width: 90%;
    }
    
    .menu-btn {
        font-size: 0.85rem;
        padding: 8px 12px;
        min-width: 140px;
    }
    
    .copyright-text {
        font-size: 0.55rem;
        margin-top: 10px;
    }
    
    /* Landing bird - even smaller for tiny screens */
    .landing-bird-canvas {
        transform: scale(0.55);
    }
    
    .modal-content h2 {
        font-size: 1.1rem;
    }
    
    .game-rules p {
        font-size: 0.85rem;
    }
    
    .leaderboard-container h1 {
        font-size: 1.5rem;
    }
    
    .completion-title {
        font-size: 1.1rem;
    }
    
    /* Stage popups - even smaller for extra small phones */
    .stage-popup {
        z-index: 1000 !important;
    }
    
    .stage-popup-content {
        padding: 12px 25px;
        max-width: 85vw;
    }
    
    .stage-popup-content h2,
    #stageText,
    #stageCompleteText {
        font-size: 1rem !important;
        white-space: nowrap;
    }
    
    /* Pause popup - smaller */
    .pause-content {
        padding: 20px 18px;
        max-width: 90%;
    }
    
    .pause-content h2 {
        font-size: 1.3rem !important;
        margin-bottom: 8px;
    }
    
    .pause-content p {
        font-size: 0.85rem !important;
        line-height: 1.3;
    }
    
    /* Play Counter - Extra small adjustments */
    .play-counter {
        bottom: 10px;
        padding: 8px 10px;
        width: auto;
        max-width: 90%; /* Match menu-container small screen width */
    }
    
    .counter-label {
        font-size: 0.6rem;
        margin-top: 8px;
        margin-bottom: 0;
    }
    
    .counter-display {
        gap: 1px;
    }
    
    .counter-digit {
        width: 22px;
        height: 24px;
        font-size: 0.95rem;
        line-height: 24px;
    }
    
    /* Hide Pause/Resume control on tiny screens */
    .control-item-desktop {
        display: none !important;
    }
    
    /* Ensure single-line layout on tiny screens */
    .mobile-game-controls {
        gap: 10px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .mobile-control-btn {
        flex: 1;
        max-width: 150px;
        padding: 7px 12px;
        font-size: 0.8rem;
    }
}

/* Mobile Landscape Mode */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        overflow: hidden;
    }
    
    .game-title {
        font-size: 1.5rem;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .menu-container {
        padding: 15px;
        min-height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .menu-buttons {
        gap: 8px;
    }
    
    .menu-btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
    
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
}