html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#gameCanvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.ui-panel {

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}




.modal {
    background: rgba(0, 0, 0, 0.9);
}

.menu-content, .modal-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;  /* Change back from 0px to 30px */
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    color: #333;
}

.modal-content {
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.modal-content.wide {
    max-width: 800px;
}

/* Universal modal header style */
.modal-header-styled {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    margin: -30px -30px 20px -30px; /* Negative margins to extend beyond modal padding */
    position: sticky;
    top: -30px; /* Adjust sticky position to account for margin */
    z-index: 10;
}


.modal-header-styled h2 {
    margin: 0;
    font-size: 1.5em;
    color: white;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Fix modal content spacing for headers */
.modal-header-styled + * {
    margin-top: 20px;
}

#howToPlayUI .modal-content.wide {
    max-height: 70vh;
    position: relative;
}

#closeHowToPlayBtn {
    position: relative;
    margin-top: 20px;
    background: #ff9800 !important;
    min-width: 120px;
}

#howToPlayUI .how-to-play-sections {
    max-height: calc(70vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    margin-right: 5px;
    margin-bottom: 20px;
}

.game-title {
    font-size: 3em;
    color: #333;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

.auth-section {
    margin: 20px 0;
}

.menu-content {
    color: #333; /* Ensure all text is dark */
}

.auth-section input {
    display: block;
    width: 80%;
    margin: 10px auto;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    color: #333;
    background: white;
}

.btn {
    padding: 12px 24px;
    margin: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn.primary {
    background: #4CAF50;
    color: white;
}

.btn.secondary {
    background: #2196F3;
    color: white;
}

.btn.tertiary {
    background: #ff9800;
    color: white;
}

.btn.special {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    animation: pulse 2s infinite;
}

.btn.large {
    font-size: 1.3em;
    padding: 15px 30px;
}

.btn.small {
    font-size: 0.9em;
    padding: 8px 16px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Full screen game canvas fixes */
/* ADDED: Full screen game canvas fixes */
/* Mobile game scaling fixes */


#globalAudioToggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    background: rgba(0, 0, 0, 0.8);
}

#globalAudioToggle:active {
    transform: scale(0.95);
}



/* New unified menu styles */
.menu-content.unified {
    width: min(480px, 92vw); /* Slightly smaller */
    height: auto;
    max-height: 85vh; /* Key fix - limits height */
    overflow-y: auto; /* Key fix - makes it scrollable */
    overflow-x: hidden;
    padding: 15px; /* Slightly less padding */
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
}


.game-logo {
    max-width: 255px;  
    height: auto;
    margin-bottom: 0px;  /* Change this from 5px to 0px */
}

.auth-header {
    font-size: 0.9em;
    color: #666;
    margin: 15px 0;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 12px;  /* Reduce from 20px */
}

.btn.auth-btn {
    background: #3498db;
    color: white;
    padding: 10px 20px;
    font-size: 0.9em;
}

.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;  /* Reduced from 12px */
    margin: 10px 0;  /* Reduced from 20px 0 */
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;  /* Reduced from 20px */
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}


.player-info {
    width: 100%;
    text-align: center;
}

.player-name-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;  /* Reduced from 8px */
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;  /* Reduced from 15px 20px */
    border-radius: 25px;
    border: none;
    box-shadow: none;
    min-width: 200px;
}

.player-name-display {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding: 5px 10px;
    background: transparent;
    border: none;
    min-height: 24px;
}


.edit-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}


.name-prompt {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
    text-align: center;
    font-style: italic;
}

.name-prompt.hidden {
    display: none;
}

.player-input {
    padding: 10px 15px;
    border: 2px solid #4CAF50;
    border-radius: 25px;
    font-size: 1.2em;
    width: 180px;
    text-align: center;
    background: white;
    color: #333;
    font-weight: bold;
    outline: none;
}

.player-input:focus {
    border-color: #45a049;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.edit-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.player-input.editing {
    display: block !important;
}

.player-name-display.hidden {
    display: none;
}


.player-info {
    width: 100%;
    text-align: center;
}

.player-label {
    display: none;
}


.player-avatar {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.avatar-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #FFD700;
    background: #fff;
}

.gem-counter {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #FFFFFF;  /* White text */
    margin: 10px 0;
    background: #1a1a2e;  /* Very dark blue */
    padding: 5px 15px;
    border-radius: 20px;
    border: 2px solid #16213e;  /* Even darker border */
    display: inline-block;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;  /* Changed from 8px to 10px */
    margin: 10px 20px;  /* Changed from margin-top: 10px to have side margins */
    max-width: 400px;  /* Added to limit button width */
    margin-left: auto;  /* Added to center */
    margin-right: auto;  /* Added to center */
}

.menu-btn {
    position: relative; /* required for ::before shine to position correctly */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}


.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.menu-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-weight: bold;
}

.modal-content.small {
    max-width: 400px;
}

.modal-content.small input {
    display: block;
    width: 90%;
    margin: 10px auto;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}


.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.gem-display {
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.store-gem-balance {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    margin: 10px 0 15px 0;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Changed to purple gradient */
    border-radius: 10px;
    border: 2px solid #764ba2; /* Changed to purple border */
    color: #FFFFFF;
}

.store-gem-balance .gem-amount {
    color: #FFD700;
    font-size: 1.2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-weight: bold;
    font-size: 1.1em;
    z-index: 100;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-center {
    text-align: center;
}

.hud-right {
    text-align: right;
}

.powerups {
    display: flex;
    gap: 10px;
}

.pause-btn-inline {
    background: rgba(0, 0, 0, 0.35);  /* Reduced opacity */
    color: white;
    border: 2px solid #FFD700;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pause-btn-inline:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.5);  /* Slightly darker on hover */
}

.pause-buttons, .gameover-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.stats {
    margin: 20px 0;
    text-align: left;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    color: #4CAF50;
    font-weight: bold;
}

.shop-tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    background: #4CAF50;
    color: white;
    border-bottom-color: #45a049;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.shop-item {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.shop-item:hover {
    border-color: #4CAF50;
    transform: translateY(-2px);
}

.shop-item.unlocked {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
}

.item-info h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.item-info p {
    margin: 10px 0;
    color: #666;
}

.price {
    font-weight: bold;
    color: #FFD700;
}

.owned {
    color: #4CAF50;
    font-weight: bold;
}

.buy-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.buy-btn:hover {
    background: #45a049;
}

.select-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.select-btn:hover {
    background: #1976D2;
}

.select-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.skin-preview, .env-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 10px;
    border: 2px solid #ddd;
}

.skin-preview.default { background: #FF6B6B; }
.skin-preview.ninja { background: #333; }
.env-preview.desert { background: linear-gradient(45deg, #F4A460, #DEB887); }
.env-preview.jungle { background: linear-gradient(45deg, #228B22, #8FBC8F); }

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
}

.leaderboard-entry.top-3 {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: white;
    font-weight: bold;
}

.entry-rank {
    font-size: 1.5em;
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
}

.entry-info {
    flex: 1;
}

.entry-username {
    font-weight: bold;
    font-size: 1.1em;
}

.entry-details {
    font-size: 0.9em;
    opacity: 0.8;
}

.entry-score {
    font-size: 1.2em;
    font-weight: bold;
    color: #4CAF50;
}

.settings-list {
    text-align: left;
    margin: 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.setting-item label {
    font-weight: bold;
}

.setting-item select, .setting-item input {
    min-width: 120px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Enhanced Settings Modal Styles */


.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn-corner {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn-corner:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.settings-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 15px 15px; /* Round bottom corners */
}

.settings-section {
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 15px;
}

.section-header {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.label-text {
    font-weight: 600;
    color: #333;
    font-size: 1em;
}

.label-hint {
    font-size: 0.85em;
    color: #666;
}

.label-hint.warning {
    color: #ff9800;
}

.setting-control {
    flex: 0 0 auto;
    min-width: 150px;
}

/* Styled Select */
.styled-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.styled-select:hover {
    border-color: #667eea;
}

.styled-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Volume Slider Container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.volume-slider:hover::-moz-range-thumb {
    transform: scale(1.2);
}

.volume-value {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

/* Audio Toggle Button */
.audio-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.audio-toggle-btn.muted {
    background: #f44336;
}

/* Music Station Grid */
.music-station-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.station-btn {
    padding: 10px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.station-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.station-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4CAF50;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .settings-modal {
        max-height: 90vh;
        width: 100%;
        border-radius: 0;
    }
    
    .settings-header {
        border-radius: 0;
        padding: 15px;
    }
    
    .settings-container {
        padding: 15px;
    }
    
    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px 0;
    }
    
    .setting-control {
        width: 100%;
        min-width: unset;
    }
    
    .music-station-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-height: 600px) {
    .settings-header {
        padding: 10px 15px;
    }
    
    .settings-header h2 {
        font-size: 1.2em;
    }
    
    .settings-section {
        margin-bottom: 20px;
        padding: 10px;
    }
}

.loading {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666;
}

/* Responsive menu styles */
.menu-content.unified {
    width: min(520px, 92vw);
    /* Make the menu a single, non-scroll card that scales */
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 20px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
}


/* Scrollbar styling */
.menu-content.unified::-webkit-scrollbar {
    width: 8px;
}

.menu-content.unified::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.menu-content.unified::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.menu-content.unified::-webkit-scrollbar-thumb:hover {
    background: #555;
}




@media (max-height: 700px) {
    .menu-content.unified {
        max-height: 95vh;
        padding: 10px 20px;
    }
    
    .game-logo {
        max-width: 200px;
        margin-bottom: 0px;
    }
    
    .game-subtitle {
        font-size: 0.95em;
        margin: 5px 0 10px 0;
    }
    
    .auth-header {
        font-size: 0.85em;
        margin: 8px 0;
    }
    
    .player-section { margin: 10px 0; }
    .player-info { text-align: center; }
    .player-avatar { margin: 10px 0; }
    .gem-counter { margin: 10px 0; }
    .menu-grid {
        margin: 10px auto;
        max-width: 400px;
    }
}





@media (max-height: 600px) {
    .menu-content.unified {
        max-height: 100vh;
        padding: 10px;
    }
    
    .game-logo {
        max-width: 150px;
        margin-bottom: 5px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    
    .menu-btn {
        padding: 8px;
        font-size: 0.8em;
    }
}






/* Animated gradient background */
body {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}






/* Spaceship menu animation */
.menu-spaceship {
    position: absolute;
    width: 60px;
    height: 40px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    animation: spaceshipFlight 15s linear infinite;
}

.menu-spaceship:hover {
    transform: scale(1.2);
    filter: brightness(1.3);
}

.menu-spaceship img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

@keyframes spaceshipFlight {
    0% {
        left: -80px;
        top: 30%;
    }
    25% {
        top: 25%;
    }
    50% {
        top: 35%;
    }
    75% {
        top: 20%;
    }
    100% {
        left: 100%;
        top: 30%;
    }
}

/* Spaceship mode indicator */
.spaceship-mode-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4B0082, #8A2BE2);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 100;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

/* Enhanced settings for spaceship mode */
#spaceshipModeContainer {
    background: rgba(138, 43, 226, 0.1);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #8A2BE2;
}

#spaceshipModeToggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
}


/* Glassmorphism effects */
.modal-content, .menu-content {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}




@keyframes shimmer {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}


.mini-leaderboard {
    max-height: 200px;
    overflow-y: auto;
    margin: 10px 0 20px 0;
    border: 2px solid #FFD700;
    border-radius: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.1);
}

.mini-leaderboard .leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    margin: 3px 0;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9em;
}

.mini-leaderboard .leaderboard-entry.current-game {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.mini-leaderboard .leaderboard-entry.top-3 {
    background: rgba(255, 215, 0, 0.2);
}

.mini-leaderboard .entry-rank {
    font-weight: bold;
    min-width: 25px;
}

.mini-leaderboard .entry-username {
    flex: 1;
    text-align: left;
    margin: 0 10px;
}

.mini-leaderboard .entry-score {
    font-weight: bold;
}




/* 3D button depth */
.btn {
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn:hover {
    box-shadow: 0 7px 14px rgba(0,0,0,0.4), 0 3px 6px rgba(0,0,0,0.3);
}

.btn:active {
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
}

/* Neon glow for powerup slots */
.powerup-slot {
    box-shadow: 0 0 10px rgba(255,215,0,0.5), inset 0 0 10px rgba(0,0,0,0.3);
}

.powerup-slot:hover {
    box-shadow: 0 0 20px rgba(255,215,0,0.8), inset 0 0 10px rgba(0,0,0,0.3);
}


@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}






.how-to-play-sections {
    text-align: left;
}


.music-station-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.station-btn {
    padding: 8px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    min-width: 70px;
}

.station-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.station-btn.active {
    background: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}


.how-to-section {
    background: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.how-to-section h3 {
    color: #4CAF50;
    margin: 0 0 15px 0;
    font-size: 1.3em;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.control-key {
    background: #2196F3;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.control-action {
    color: #333;
    font-size: 0.9em;
}

.gem-click-area {
    text-align: center;
    margin: 15px 0;
}

.clickable-gem {
    font-size: 3em;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-block;
    user-select: none;
}

.clickable-gem:hover {
    transform: scale(1.2);
}

.clickable-gem:active {
    transform: scale(0.9);
}

.gem-click-hint {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.powerups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.powerup-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.powerup-icon {
    font-size: 2em;
    min-width: 40px;
}

.powerup-info strong {
    color: #4CAF50;
    display: block;
    margin-bottom: 5px;
}

.powerup-info p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.how-to-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.how-to-section li {
    margin: 5px 0;
    color: #333;
}

@media (max-width: 768px) {
    
        .player-section {
        margin: 10px 0;
        padding: 12px 15px;
    }
    
    .player-name-container {
        padding: 6px 12px;
    }
    
    .player-input {
        width: 150px;
        font-size: 1em;
    }
    
    .edit-btn {
        width: 28px;
        height: 28px;
        font-size: 1em;
    }
    
    
    
    
    
    .how-to-play-sections {
        max-height: 60vh;
    }
    
    .controls-grid, .powerups-grid {
        grid-template-columns: 1fr;
    }
    
    .clickable-gem {
        font-size: 4em;
    }
}



@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* New overlay HUD styles */
/* Remove old HUD styles */
.hud {
    display: none !important;
}

#pauseBtn.pause-btn {
    display: none !important;
}






.characters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);  /* Desktop: 5 columns */
    gap: 10px;
    margin: 10px 0;
    max-height: 400px;  /* Add max height */
    overflow-y: auto;   /* Enable scroll */
    padding: 5px;
    -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
}

/* Mobile responsive - add this right after */
@media (max-width: 768px) {
    .characters-grid {
        grid-template-columns: repeat(2, 1fr);  /* Tablet: 2 columns */
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .characters-grid {
        grid-template-columns: 1fr;  /* Phone: 1 column */
        max-height: 60vh;
    }
}

.store-grid, .inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.character-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    color: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.character-card h3 {
    font-size: 0.85em;
    margin: 5px 0;
}

.character-stats {
    font-size: 0.65em;
    line-height: 1.1;
    margin: 4px 0;
}

.character-card-bottom {
    margin-top: auto;
    padding-top: 8px;
}

.store-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.character-card:hover, .store-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.character-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 3px solid #FFD700;
    position: relative;
    overflow: visible;  /* Changed from hidden to visible for overlap effect */
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-head-image {
    width: 120%;     /* Increased from 80% to 120% */
    height: 120%;    /* Increased from 80% to 120% */
    object-fit: cover;   /* Changed from contain to cover */
    border-radius: 50%;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;      /* Ensure image is above background */
}

.character-card:hover .character-head-image {
    transform: scale(1.1);
}

.character-card:not(.unlocked) .character-head-image {
    filter: brightness(0.3) contrast(0.5);
}

.character-card.unlocked .character-head-image {
    filter: none;
}

.character-card.selected .character-head-image {
    filter: brightness(1.2) drop-shadow(0 0 10px #FFD700);
}

/* Fallback styles */
.character-head-image:not([src]),
.character-head-image[src=""] {
    display: none;
}

.character-head-image[src=""],
.character-head-image:not([src]) {
    display: none;
}

.character-card.unlocked {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.character-card.selected {
    border: 3px solid #FFD700;
}

.character-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 8px 0;
    font-size: 0.9em;
}

.character-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.character-checkbox input[type="checkbox"]:disabled {
    cursor: default;
}

.character-checkbox span {
    color: #FFD700;
    font-weight: bold;
}

.character-card .select-btn,
.character-card .buy-btn {
    display: block;
    margin: 10px auto 0 auto;
    min-width: 100px;
}

.inventory-slot {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #FFD700;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.inventory-slot.filled {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.item-icon {
    font-size: 2em;
}

.item-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #FFD700;
    color: #333;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
}

/* Gem Store Enhancements */
.modal-content.extra-wide {
    max-width: 900px;
}

.daily-bonus-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    border: 2px solid #FFD700;
}

.daily-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    
    /* ADD THESE LINES TO MAKE THEM EQUAL WIDTH */
    flex: 1;
    min-width: 150px;
    max-width: 180px;
}
.daily-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.daily-btn:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
}

.daily-icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.character-card[data-skin="blackwhite"] .character-preview {
    background: radial-gradient(circle, #FFFFFF 60%, #DDDDDD 100%) !important;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1); /* Subtle inner shadow for depth */
}

.daily-text {
    text-align: center;
}

.daily-timer {
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
}

.store-tabs {
    display: flex;
    gap: 5px;
    margin: 20px 0;
    border-bottom: 2px solid #ddd;
}

.store-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
}

.store-tab.active {
    color: #333;
    border-bottom-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
}

.store-tab:hover {
    background: rgba(255, 215, 0, 0.05);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.store-item {
    position: relative;
    background: linear-gradient(135deg, #fff, #f5f5f5);
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.store-item:hover {
    transform: translateY(-5px);
    border-color: #FFD700;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.store-item.bundle {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-color: #FF8C00;
}

.bundle-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #FF0000;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.item-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.store-item h3 {
    color: #333;
    margin: 10px 0;
}

.store-item p {
    color: #666;
    font-size: 0.9em;
    margin: 10px 0;
}

.price {
    font-size: 1.2em;
    font-weight: bold;
    color: #FFD700;
    margin: 10px 0;
}

.price.original {
    text-decoration: line-through;
    color: #999;
    font-size: 1em;
}

.level-bar {
    width: 100%;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

/* Lucky Wheel Styles */
.wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}



.spin-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.spin-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.spin-btn:disabled {
    background: #999;
    transform: none;
    cursor: not-allowed;
}

.wheel-result {
    font-size: 1.2em;
    font-weight: bold;
    color: #FFD700;
    text-align: center;
    margin: 10px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Enhanced HUD */
.hud {
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255,215,0,0.5);
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hud-label {
    font-size: 0.7em;
    color: #FFD700;
    letter-spacing: 2px;
}

.hud-value {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.combo-meter {
    text-align: center;
}

.combo-bar {
    width: 150px;
    height: 8px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #FFD700;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px auto;
}

.combo-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    transition: width 0.3s ease;
}




/* Mobile-optimized touch targets */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .menu-btn {
        min-height: 50px;
    }
    
    .powerup-slot {
        width: 50px;
        height: 50px;
    }
    
    #pauseBtn {
        width: 60px;
        height: 60px;
        font-size: 2em;
    }
}

.menu-btn span {
    pointer-events: none;
}


/* Add only these NEW styles at the end of your style section */

/* New wrapper class */
.game-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Replace the existing #gameUI .game-container rule with this: */
#gameUI .game-container {
    position: relative;
    width: 1200px;
    height: 600px;
    max-width: none; /* Make sure this says "none" not "95vw" */
    max-height: none; /* Make sure this says "none" not "85vh" */
    background: #87CEEB;
    border: 2px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

/* Override canvas positioning when inside game container */
.game-container #gameCanvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    z-index: 1;
    display: block !important;
    border: none !important;
}

/* Override HUD overlays to position within container */
.game-container .game-stats-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.35);
    padding: 10px 15px;
    border-radius: 10px;
    color: white;
}



.game-container .game-controls-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Update stat items layout */
.game-container .stat-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.game-container .stat-item:last-child {
    margin-bottom: 0;
}

.game-container .stat-value {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.game-container .stat-label {
    font-size: 0.7em;
    color: #FFD700;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* New responsive scaling for game container */
@media (max-width: 1250px) {
    #gameUI .game-container {
        transform: scale(0.9);
    }
}

@media (max-width: 1000px) {
    #gameUI .game-container {
        transform: scale(0.75);
    }
}



@media (max-width: 600px) {
    #gameUI .game-container {
        transform: scale(0.75) !important;
    }
    
    .game-container .game-stats-overlay,
    .game-container .combo-overlay,
    .game-container .game-controls-overlay {
        transform: scale(1.0);
    }
}


#unlimitedJumpsContainer {
    background: rgba(255, 215, 0, 0.1);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #FFD700;
}

#unlimitedJumpsToggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.cheat-activated {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    z-index: 10000;
    animation: cheatPulse 1s ease-in-out;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
}

/* Compact Store Styles */
.compact-store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.compact-store-item {
    background: linear-gradient(135deg, #fff, #f8f8f8);
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.compact-store-item:hover {
    transform: translateY(-2px);
    border-color: #FFD700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.compact-store-item .item-icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.compact-store-item h4 {
    color: #333;
    margin: 5px 0;
    font-size: 0.9em;
}

.compact-store-item p {
    color: #666;
    font-size: 0.75em;
    margin: 5px 0;
    line-height: 1.2;
}

.compact-store-item .price {
    font-size: 0.9em;
    font-weight: bold;
    color: #FFD700;
    margin: 5px 0;
}

.compact-store-item .buy-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 5px;
    margin-top: 5px;
}

.level-indicator {
    margin: 5px 0;
}

.level-text {
    font-size: 0.7em;
    color: #666;
}

.current-level {
    font-weight: bold;
    color: #4CAF50;
}

/* Pre-game modal styles */
.pregame-powerups {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.pregame-powerup {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    position: relative;
}

.pregame-powerup:hover {
    background: rgba(255, 215, 0, 0.1);
    transform: scale(1.02);
    border-color: #FFD700;
}

.pregame-powerup.selected {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    border-width: 3px;
}

.pregame-powerup .checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.pregame-powerup.selected .checkbox {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.pregame-powerup .icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.pregame-powerup .name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.pregame-powerup .count {
    color: #666;
    font-size: 0.9em;
}

.pregame-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Achievements UI */
.achievements-summary {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    font-weight: bold;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    margin: 20px 0;
    padding: 10px;
    /* REMOVED: max-height and overflow-y */
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.achievement-coin {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #B8860B;
    background: radial-gradient(circle at 30% 30%, #FFD700, #DAA520, #B8860B);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.2);
    margin-bottom: 8px;
}

.achievement-coin.locked {
    background: radial-gradient(circle at 30% 30%, #666, #444, #222);
    border-color: #333;
    color: #777;
    cursor: default;
}

.achievement-coin:not(.locked):hover {
    transform: scale(1.1) rotateY(10deg);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        0 0 15px rgba(255,215,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.2);
}

.achievement-desc {
    font-size: 10px;
    color: #333;
    text-align: center;
    line-height: 1.2;
    max-width: 70px;
    word-wrap: break-word;
    margin-top: 4px;
}

.achievement-desc.locked {
    color: #999;
}

.achievement-desc.unlocked {
    color: #4CAF50;
    font-weight: bold;
}

.achievement-tooltip {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-coin:hover .achievement-tooltip {
    opacity: 1;
}

/* Compact Inventory Styles */
.inventory-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.inventory-stats {
    display: flex;
    justify-content: center;
    align-items: center;  /* Add this for vertical alignment */
    gap: 20px;
    font-weight: bold;
    font-size: 14px;
}

.inventory-stats > span {
    display: flex;
    align-items: center;  /* Align content within each span */
    gap: 5px;  /* Space between label and value */
}

.inventory-main-content {
    display: flex;
    gap: 15px;
    max-height: 420px;
}

.item-details-panel {
    flex: 0 0 220px;
    background: linear-gradient(135deg, #f9f9f9, #f0f0f0);
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    height: fit-content;
    max-height: 400px;
    overflow-y: auto;
}

.item-detail-placeholder {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 10px;
    font-size: 13px;
}

.inventory-sections {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 400px;
    padding-right: 5px;
}

.inventory-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.section-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    padding-bottom: 6px;
    border-bottom: 2px solid #4CAF50;
}

.inventory-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Fixed 4 columns */
    gap: 12px; /* Bigger gap */
}

.inventory-slot {
    width: 100px; /* Increased from 60px */
    height: 100px; /* Increased from 60px */
    background: linear-gradient(135deg, #fff, #f8f8f8);
    border: 2px solid #ddd;
    border-radius: 10px; /* Slightly larger radius */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-slot:hover {
    transform: translateY(-2px);
    border-color: #4CAF50;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.inventory-slot.selected {
    border-color: #FFD700;
    background: linear-gradient(135deg, #fffef5, #fff8e1);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.inventory-slot.empty {
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed #ccc;
    cursor: default;
}

.inventory-slot.empty:hover {
    transform: none;
    border-color: #ccc;
    box-shadow: none;
}

.inventory-slot .item-icon {
    font-size: 36px; /* Increased from 24px */
    margin-bottom: 4px;
}


.inventory-slot .item-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: #4CAF50;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px; /* Slightly larger */
    font-weight: bold;
}

.inventory-slot .item-name {
    font-size: 10px; /* Slightly larger */
    text-align: center;
    color: #666;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
    line-height: 1.2;
}

.item-rarity {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.rarity-common { background: #95a5a6; }
.rarity-rare { background: #3498db; }
.rarity-epic { background: #9b59b6; }
.rarity-legendary { background: #f39c12; }

/* Detail Panel Styles */
.item-detail-content {
    animation: fadeIn 0.3s ease;
}

.item-detail-header {
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
}

.item-detail-icon {
    font-size: 36px;
    margin-bottom: 6px;
}

.item-detail-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

.item-detail-category {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-detail-description {
    color: #555;
    line-height: 1.3;
    margin-bottom: 10px;
    font-size: 12px;
}

.item-detail-stats {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.item-detail-stat {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    font-size: 11px;
}

.stat-label {
    color: #666;
}

.stat-value {
    color: #4CAF50;
    font-weight: bold;
}

.item-owned-count {
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.item-owned-count .owned-label {
    font-size: 12px;
    color: #666;
}

.item-owned-count .owned-value {
    font-size: 20px;
    font-weight: bold;
    color: #4CAF50;
}


/* Improved mobile modal handling */
.inventory-modal {
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
}

.close-x {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
}

.close-x:hover {
    color: #333;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .close-x {
        display: block;
    }
}

.inventory-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Make sections collapsible on very small screens */
@media (max-height: 600px) {
    .inventory-section {
        margin-bottom: 8px;
        padding: 8px;
    }
    
    .section-title {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .inventory-slot {
        width: 45px;
        height: 45px;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .inventory-main-content {
        flex-direction: row;
    }
    
    .item-details-panel {
        flex: 0 0 180px;
        max-height: none;
        margin-bottom: 0;
        margin-right: 10px;
    }
    
    .inventory-sections {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        max-height: 250px;
        overflow-y: auto;
    }
}

/* Ensure proper scrolling on iOS */
@supports (-webkit-touch-callout: none) {
    .inventory-scroll-container,
    .inventory-sections,
    .item-details-panel {
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }
}

/* Prevent pull-to-refresh on mobile while scrolling inventory */
.inventory-modal {
    overscroll-behavior-y: contain;
}


/* Mobile Responsive Inventory */
@media (max-width: 768px) {
    .inventory-main-content {
        flex-direction: column;
        max-height: none;
    }
    
    .item-details-panel {
        flex: none;
        width: 100%;
        max-height: 200px;
        margin-bottom: 15px;
        order: -1; /* Show details at top on mobile */
    }
    
    .inventory-sections {
        max-height: none;
        padding-right: 0;
    }
    
    .inventory-section {
        margin-bottom: 10px;
    }
    
    .inventory-mini-grid {
        grid-template-columns: repeat(4, 1fr); /* Keep 4 columns on mobile too */
        gap: 8px;
    }
    
    .inventory-slot {
        width: 75px; /* Smaller on mobile but still bigger than before */
        height: 75px;
    }
    
    .inventory-slot .item-icon {
        font-size: 28px;
    }
    
    .inventory-slot .item-name {
        font-size: 7px;
    }
    
    #inventoryUI .modal-content.wide {
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
    }
}

@media (max-width: 480px) {
    .inventory-mini-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .inventory-slot {
        width: 50px;
        height: 50px;
    }
    
    .item-detail-icon {
        font-size: 28px;
    }
    
    .item-detail-name {
        font-size: 14px;
    }
    
    .section-title {
        font-size: 12px;
    }
}

/* Fix scrolling for all modal content on mobile */
@media (max-width: 768px) {
    .modal-content {
        max-height: 80vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 20px 15px !important;
    }
    
    .modal-content.wide {
        width: 95% !important;
        max-width: none !important;
    }
}

/* Ensure touch scrolling works properly */
.inventory-sections {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.item-details-panel {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Prevent horizontal scroll on mobile */
.inventory-main-content {
    overflow-x: hidden;
}

/* Better touch targets on mobile */
@media (pointer: coarse) {
    .inventory-slot {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .achievement-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
        padding: 5px;
    }
    
    .achievement-coin {
        width: 40px;
        height: 40px;
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .achievement-desc {
        font-size: 8px;
        max-width: 60px;
    }
    
    .achievement-tooltip {
        font-size: 10px;
        bottom: 50px;
        max-width: 150px;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .achievement-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .achievement-coin {
        width: 35px;
        height: 35px;
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .achievement-desc {
        font-size: 7px;
        max-width: 50px;
    }
}

@keyframes cheatPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}


/* Fix landscape mode viewport */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #gameUI .game-container {
        transform: scale(0.6) !important;
        transform-origin: center center;
    }
    
    .game-wrapper {
        height: 100vh !important;
        overflow: auto !important;
        align-items: flex-start !important;
        padding-top: 10px !important;
    }
}

/* Specific fix for iPhone landscape */
@media screen and (orientation: landscape) and (max-height: 430px) {
    #gameUI .game-container {
        transform: scale(0.45) !important;
    }
}


