:root {
    /* Brand Colors - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #2a2a3a;
    --bg-overlay: rgba(10, 10, 15, 0.95);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-tertiary: #6a6a7a;
    
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-hover: #7c3aed;
    
    --border-subtle: rgba(139, 92, 246, 0.1);
    --border-medium: rgba(139, 92, 246, 0.2);
    --border-strong: rgba(139, 92, 246, 0.4);
    
    --shadow-sm: rgba(0, 0, 0, 0.3);
    --shadow-md: rgba(0, 0, 0, 0.5);
    --shadow-lg: rgba(139, 92, 246, 0.2);
    
    --game-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f1624 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(167, 139, 250, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

#game-container {
    position: relative;
    width: 450px;
    height: 600px;
    max-width: 100vw;
    max-height: 100vh;
    background: var(--bg-secondary);
    box-shadow: 
        0 20px 60px var(--shadow-md),
        0 0 0 1px var(--border-subtle),
        0 0 40px var(--shadow-lg);
    border-radius: 24px;
    overflow: hidden;
    z-index: 1;
}

#gameCanvas {
    display: block;
    width: 450px;
    height: 600px;
    max-width: 100%;
    max-height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Top UI Bar - Minimal and Clean */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    /* На desktop - вверху с обычным padding */
    padding-top: 16px;
    padding-left: 16px;
    padding-right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 200;
}

/* На мобильных - опущен вниз для Telegram панели */
@media (max-width: 768px) {
    #ui-overlay {
        top: 10%;
        padding-top: 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

.left-ui {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

#score-display, #high-score-display {
    background: rgba(26, 26, 36, 0.8);
    backdrop-filter: blur(12px);
    padding: 6px 12px;
    border-radius: 20px;
    pointer-events: all;
    min-width: 60px;
    text-align: center;
    border: 1px solid var(--border-subtle);
}

/* Hide score displays when start screen is visible */
body:has(#start-screen:not(.hidden)) #score-display,
body:has(#start-screen:not(.hidden)) #high-score-display {
    display: none !important;
}

/* Also hide when game over screen is visible */
body:has(#game-over-screen:not(.hidden)) #score-display,
body:has(#game-over-screen:not(.hidden)) #high-score-display {
    display: none !important;
}

#current-score, #high-score {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 1px;
    font-variant-numeric: tabular-nums;
}

.score-label {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.6);
}

#controls {
    display: flex;
    gap: 8px;
    pointer-events: all;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    opacity: 0.8;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    opacity: 1;
}

.icon-btn:active {
    opacity: 0.7;
    background: var(--bg-tertiary);
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hide pause button in main menu */
body:has(#start-screen:not(.hidden)) #pause-btn {
    display: none !important;
}

/* Specific button styles - removed, using unified style */

/* Modal Screens */
#game-over-screen, #start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.3s ease-out;
    pointer-events: auto;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Ensure controls are visible above modal screens */
#ui-overlay {
    z-index: 201 !important;
}

#controls {
    z-index: 202 !important;
}

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

.modal-content {
    text-align: center;
    animation: slideUp 0.4s ease-out;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    padding: 0 20px;
    box-sizing: border-box;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Menu Header */
.menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
    flex-shrink: 0;
}

/* Game Logo */
.game-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    width: 100%;
}

.logo-icon {
    font-size: 56px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.game-logo h1 {
    font-size: 42px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.tagline {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 4px;
}

/* Stats Card */
.stats-card {
    width: 100%;
    max-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.stat-icon {
    font-size: 24px;
    opacity: 0.8;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

/* Game Over Header */
.game-over-header {
    margin-bottom: 32px;
}

.game-over-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.game-over-header h1 {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.instructions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
}

.instruction-item .icon {
    font-size: 24px;
}

.score-container {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

/* New Record Message */
.coins-earned-message {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    padding: 12px 18px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    animation: slideInCoins 0.3s ease;
}

.coins-earned-message.hidden {
    display: none;
}

@keyframes slideInCoins {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coins-earned-icon {
    font-size: 24px;
    opacity: 0.9;
}

.coins-earned-text {
    font-size: 15px;
    font-weight: 600;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 4px;
}

#coins-earned-value {
    font-weight: 700;
    font-size: 16px;
}

.new-record-message {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.new-record-message.hidden {
    display: none;
}

.new-record-icon {
    font-size: 24px;
    opacity: 0.9;
}

.new-record-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Share Record Button */
.share-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
    box-shadow: none;
}

.share-btn:hover {
    background: var(--accent-hover);
    opacity: 0.9;
}

.share-btn:active {
    opacity: 0.8;
}

.share-btn.hidden {
    display: none;
}

.score-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.score-divider {
    width: 1px;
    height: 50px;
    background: var(--border-subtle);
}

.score-item .score-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.score-item .score-value {
    font-size: 28px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
}

.score-item.highlight .score-value {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Buttons */
.primary-btn {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 500;
    color: white;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    box-shadow: none;
}

.primary-btn .btn-icon {
    font-size: 18px;
    font-weight: 500;
}

.primary-btn:hover {
    background: var(--accent-hover);
    opacity: 0.9;
}

.primary-btn:active {
    opacity: 0.8;
}

/* Control Selector */
.control-selector {
    margin-bottom: 24px;
    width: 100%;
    max-width: 400px;
    flex-shrink: 0;
}

.section-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.title-icon {
    font-size: 16px;
    opacity: 0.7;
}

.control-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.control-option {
    padding: 20px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.control-option .option-icon {
    font-size: 32px;
    margin-bottom: 2px;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.control-option:hover .option-icon {
    opacity: 1;
}

.control-option .option-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-option .option-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.control-option .option-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.control-option:hover {
    border-color: var(--border-medium);
    background: var(--bg-tertiary);
}

.control-option.active {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.control-option.active .option-label {
    color: var(--accent-primary);
    font-weight: 600;
}

.control-option.active .option-icon {
    opacity: 1;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
}

/* Theme Selector */
.theme-selector {
    margin-top: 32px;
}

.theme-options {
    display: inline-flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.theme-option {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-option .theme-icon {
    font-size: 16px;
}

.theme-option:hover {
    background: var(--border);
}

.theme-option.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Mobile Control Buttons */
#mobile-controls {
    position: absolute;
    bottom: 40px;
    bottom: max(40px, calc(env(safe-area-inset-bottom) + 20px));
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    padding-left: max(40px, calc(env(safe-area-inset-left) + 20px));
    padding-right: max(40px, calc(env(safe-area-inset-right) + 20px));
    pointer-events: none;
    z-index: 20;
}

.mobile-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: rgba(26, 26, 36, 0.8);
    backdrop-filter: blur(12px);
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-btn:active {
    background: var(--accent-primary);
    border-color: var(--accent-secondary);
    transform: scale(0.95);
}

.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    #game-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        background: var(--bg-secondary);
        overflow: hidden;
    }
    
    #gameCanvas {
        display: block;
    }
    
    #ui-overlay {
        padding: 16px 12px;
    }
    
    #score-display, #high-score-display {
        padding: 10px 16px;
        min-width: 85px;
    }
    
    #current-score, #high-score {
        font-size: 26px;
    }
    
    .score-label {
        font-size: 10px;
    }
    
    .game-logo h1 {
        font-size: 48px;
    }
    
    .modal-content h1 {
        font-size: 36px;
    }
    
    #game-over-screen, #start-screen {
        padding: 16px;
        align-items: flex-start;
        justify-content: flex-start;
        overflow-y: auto;
    }
    
    .modal-content {
        max-width: 100%;
        padding: 0 12px;
        max-height: none;
        margin: auto 0;
        justify-content: flex-start;
    }
    
    .menu-header {
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .game-logo {
        gap: 8px;
    }
    
    .game-logo h1 {
        font-size: 36px;
    }
    
    .logo-icon {
        font-size: 48px;
        margin-bottom: 4px;
    }
    
    .tagline {
        font-size: 12px;
    }
    
    .stats-card {
        max-width: 100%;
        padding: 14px;
        width: 100%;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .stat-icon {
        font-size: 28px;
    }
    
    .control-selector {
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 11px;
        margin-bottom: 16px;
    }
    
    .action-buttons {
        max-width: 100%;
        gap: 10px;
    }
    
    .btn-large {
        padding: 16px 24px;
        font-size: 16px;
        min-height: 56px;
        width: 100%;
    }
    
    .secondary-actions {
        gap: 10px;
    }
    
    .action-btn {
        min-height: 44px;
        padding: 12px 14px;
        gap: 8px;
    }
    
    .action-icon {
        font-size: 18px;
    }
    
    .action-text {
        font-size: 13px;
    }
    
    .hint-text {
        font-size: 11px;
        margin-top: 16px;
        padding: 0 8px;
    }
    
    .control-options {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .control-option {
        padding: 16px 12px;
    }
    
    .control-option .option-icon {
        font-size: 28px;
    }
    
    .control-option .option-label {
        font-size: 14px;
    }
    
    .control-option .option-hint {
        font-size: 10px;
    }
    
    /* Hide desktop-only controls on mobile */
    .control-option[data-control="keyboard"],
    .control-option[data-control="mouse"] {
        display: none;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    .primary-btn {
        padding: 18px 40px;
        font-size: 15px;
    }
    
    .score-container {
        padding: 24px 20px;
        gap: 20px;
    }
    
    .score-item .score-value {
        font-size: 40px;
    }
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Access Guard Screen */
#access-guard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

#access-guard .modal-content {
    text-align: center;
    max-width: 400px;
}

#access-guard .guard-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

#access-guard h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

#access-guard p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Leaderboard Button */
#leaderboard-btn {
    margin-right: 8px;
}

/* Leaderboard Modal */
#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 20px;
}

#leaderboard-modal .modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-medium);
    box-shadow: 0 20px 60px var(--shadow-md);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#leaderboard-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

#leaderboard-modal .modal-header h2 {
    font-size: 24px;
    margin: 0;
    color: var(--text-primary);
}

#leaderboard-modal .close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

#leaderboard-modal .close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

#leaderboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Leaderboard List */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--border-medium);
}

/* Top 3 special styling */
.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-color: rgba(255, 215, 0, 0.3);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(192, 192, 192, 0.05) 100%);
    border-color: rgba(192, 192, 192, 0.3);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15) 0%, rgba(205, 127, 50, 0.05) 100%);
    border-color: rgba(205, 127, 50, 0.3);
}

/* Current user highlight */
.leaderboard-item.current-user {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.rank-badge {
    font-size: 20px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    color: var(--text-primary);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item .score {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-secondary);
}

/* Loading and Error States */
.loading, .error, .empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error {
    color: #ef4444;
}

/* Mobile Responsive */
@media (max-width: 500px) {
    #leaderboard-modal {
        align-items: flex-end;
        padding: 0;
    }

    #leaderboard-modal .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        margin-top: auto;
    }

    #leaderboard-modal .modal-header {
        padding: 24px 20px;
    }
    
    .leaderboard-item {
        padding: 10px 12px;
    }
    
    .rank-badge {
        font-size: 18px;
        min-width: 35px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .leaderboard-item .score {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
#leaderboard-content::-webkit-scrollbar {
    width: 8px;
}

#leaderboard-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

#leaderboard-content::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

#leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Button Group */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    pointer-events: auto;
}

/* Action Buttons Section */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    flex-shrink: 0;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 500;
    min-height: 52px;
    width: 100%;
    box-sizing: border-box;
}

.btn-large:hover {
    opacity: 0.9;
}

.btn-large:active {
    opacity: 0.8;
}

.secondary-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 400;
    min-height: 44px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    min-width: 0;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

.action-btn:active {
    opacity: 0.7;
    background: var(--bg-tertiary);
}

.action-icon {
    font-size: 18px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.action-btn:hover .action-icon {
    opacity: 1;
}

.action-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 400;
    white-space: nowrap;
}

/* Secondary Button */
.secondary-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 12px var(--shadow-sm);
    width: 100%;
    pointer-events: auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.secondary-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-md);
}

.secondary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--shadow-sm);
    background: rgba(139, 92, 246, 0.15);
}

.secondary-btn .btn-icon {
    font-size: 20px;
}

/* Ensure primary button also has pointer events */
.primary-btn {
    pointer-events: auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Pause Menu */
#pause-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.3s ease-out;
    z-index: 100;
}

#pause-menu .modal-content {
    text-align: center;
    animation: slideUp 0.4s ease-out;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

#pause-menu h1 {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 32px;
}

#pause-menu .button-group {
    min-width: 280px;
    gap: 8px;
}

@media (max-width: 768px) {
    #pause-menu {
        padding: 20px;
    }
    
    #pause-menu h1 {
        font-size: 22px;
        margin-bottom: 24px;
    }
}

/* Refresh button animation */
#refresh-btn:active {
    animation: spin 0.5s ease-in-out;
}

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

#refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hint text */
.hint-text {
    margin-top: 24px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    line-height: 1.5;
    display: none; /* Hidden by default, shown via JS if DEBUG_MODE is enabled */
}

/* Debug Console */
.debug-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: none; /* Hidden by default, shown via JS if DEBUG_MODE is enabled */
}

.debug-float-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 0, 0, 1);
}

.debug-float-btn:active {
    transform: scale(0.95);
}

#debug-console {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-top: 2px solid var(--accent-primary);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: slideUpDebug 0.3s ease-out;
}

@keyframes slideUpDebug {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.2);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    font-weight: 600;
    color: white;
}

.debug-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
    color: #00ff00;
}

.debug-log {
    margin-bottom: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border-left: 3px solid #00ff00;
}

.debug-log.error {
    color: #ff4444;
    border-left-color: #ff4444;
}

.debug-log.warn {
    color: #ffaa00;
    border-left-color: #ffaa00;
}

.debug-log.info {
    color: #00aaff;
    border-left-color: #00aaff;
}

.debug-log-time {
    color: #888;
    font-size: 10px;
    margin-right: 8px;
}

.debug-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.debug-action-btn {
    flex: 1;
    padding: 10px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.debug-action-btn:hover {
    background: var(--accent-hover);
}

.debug-action-btn:active {
    transform: scale(0.95);
}

.debug-action-btn.success {
    background: #00aa00;
}

#debug-content::-webkit-scrollbar {
    width: 6px;
}

#debug-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

#debug-content::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

/* Shop Modal Styles - Premium Mobile Game Style */
#shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.25s ease;
}

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

.shop-modal-content {
    max-width: 95%;
    max-height: 90vh;
    width: 480px;
    background: linear-gradient(180deg, #1a1625 0%, #0f0a1a 100%);
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(139, 92, 246, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Shop Modal Header Styles */
#shop-modal .modal-header,
.shop-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(167, 139, 250, 0.1) 100%);
    border-bottom: 2px solid rgba(139, 92, 246, 0.2);
    position: relative;
}

#shop-modal .modal-header::before,
.shop-modal-content .modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
}

#shop-modal .modal-header h2,
.shop-modal-content .modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

#shop-modal .close-btn,
.shop-modal-content .close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

#shop-modal .close-btn:hover,
.shop-modal-content .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.shop-balance {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 28px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    position: relative;
}

.shop-balance::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.4), transparent);
}

.balance-label {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-value {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.3));
}

.balance-icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.4));
    animation: coinPulse 2s ease-in-out infinite;
}

@keyframes coinPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.shop-tabs {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.shop-tab {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    backdrop-filter: blur(10px);
}

.shop-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.shop-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4) 0%, rgba(167, 139, 250, 0.3) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 
        0 4px 16px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.shop-tab.active::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

.shop-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.shop-content::-webkit-scrollbar {
    width: 6px;
}

.shop-content::-webkit-scrollbar-track {
    background: transparent;
}

.shop-content::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.shop-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

.shop-tab-content {
    display: none;
}

.shop-tab-content.active {
    display: block;
}

.skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 8px 0;
}

.skin-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.skin-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skin-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(167, 139, 250, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skin-card:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.skin-card:hover::before {
    opacity: 1;
}

.skin-card:hover::after {
    opacity: 1;
}

.skin-card.selected {
    border-color: rgba(139, 92, 246, 0.8);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.25) 0%, rgba(139, 92, 246, 0.15) 100%);
    box-shadow: 
        0 0 0 3px rgba(139, 92, 246, 0.4),
        0 12px 32px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-4px) scale(1.03);
}

.skin-card.selected::before {
    opacity: 1;
}

.skin-card.selected::after {
    opacity: 1;
}

.skin-card.owned:not(.selected) {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.skin-image {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

.skin-card:hover .skin-image {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(139, 92, 246, 0.4);
}

.skin-card.selected .skin-image {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 
        inset 0 2px 8px rgba(139, 92, 246, 0.2),
        0 8px 24px rgba(139, 92, 246, 0.5);
}

.skin-name {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-top: 6px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
}

.skin-price {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.4));
}

.skin-price.free {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.4));
}

.skin-status {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.skin-status.owned {
    color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.2) 100%);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 
        0 4px 12px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.skin-status.selected {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.6) 0%, rgba(167, 139, 250, 0.4) 100%);
    border-color: rgba(139, 92, 246, 0.8);
    box-shadow: 
        0 4px 16px rgba(139, 92, 246, 0.5),
        0 0 12px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 
            0 4px 16px rgba(139, 92, 246, 0.5),
            0 0 12px rgba(139, 92, 246, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 4px 20px rgba(139, 92, 246, 0.7),
            0 0 16px rgba(139, 92, 246, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

.skin-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.skin-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.skin-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.skin-btn:active::before {
    width: 300px;
    height: 300px;
}

.skin-btn.select {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 
        0 4px 16px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.skin-btn.select:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 24px rgba(139, 92, 246, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.skin-btn.select:active {
    transform: translateY(-1px) scale(1.02);
}

.skin-btn.buy {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e1b4b;
    box-shadow: 
        0 4px 16px rgba(251, 191, 36, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.skin-btn.buy:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 24px rgba(251, 191, 36, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.skin-btn.buy:active {
    transform: translateY(-1px) scale(1.02);
}

.skin-btn.buy:disabled {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    opacity: 0.6;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.skin-btn.buy:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-shop {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.btn-shop:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

/* Responsive shop */
@media (max-width: 600px) {
    #shop-modal {
        align-items: flex-end;
        padding: 0;
    }

    .shop-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 24px 24px 0 0;
        margin-top: auto;
        border-left: none;
        border-right: none;
        border-bottom: none;
        animation: slideUpMobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%) scale(0.95);
            opacity: 0;
        }
        to {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }

    #shop-modal .modal-header,
    .shop-modal-content .modal-header {
        padding: 20px 24px;
        position: relative;
    }

    #shop-modal .modal-header h2,
    .shop-modal-content .modal-header h2 {
        font-size: 22px;
    }

    .shop-balance {
        padding: 18px 24px;
    }

    .balance-value {
        font-size: 24px;
    }

    .balance-icon {
        font-size: 24px;
    }

    .shop-content {
        padding: 20px;
        max-height: calc(95vh - 220px);
    }

    .skins-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }

    .skin-image {
        width: 120px;
        height: 120px;
    }

    .skin-card {
        padding: 18px;
    }

    .skin-name {
        font-size: 16px;
    }

    .skin-price {
        font-size: 17px;
    }

    .skin-btn {
        padding: 12px 18px;
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .skins-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .skin-image {
        width: 110px;
        height: 110px;
    }

    .skin-card {
        padding: 16px;
        gap: 12px;
    }

    .shop-content {
        padding: 16px;
    }

    #shop-modal .modal-header,
    .shop-modal-content .modal-header {
        padding: 18px 20px;
    }

    .shop-balance {
        padding: 16px 20px;
    }
}

@media (max-width: 320px) {
    .skins-grid {
        grid-template-columns: 1fr;
    }

    .skin-image {
        width: 130px;
        height: 130px;
    }
}


/* Coins Earned Display */
.coins-earned {
    margin: 20px 0;
    padding: 15px 30px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.1));
    border: 2px solid var(--accent-secondary);
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-secondary);
    text-align: center;
    animation: coinPulse 0.6s ease-in-out;
    box-shadow: 0 4px 12px var(--shadow-lg);
}

@keyframes coinPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}


/* Shop Info Message */
.shop-info {
    margin: 15px 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    font-size: 14px;
    color: var(--accent-secondary);
    text-align: center;
    line-height: 1.5;
}


/* Shop Modal Styles */
.shop-content {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.shop-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.1));
    border-radius: 12px;
    margin-bottom: 15px;
}

.balance-label {
    font-size: 16px;
    color: var(--text-secondary);
}

.balance-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.shop-item {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.shop-item:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
}

.shop-item.owned {
    border-color: var(--accent-primary);
}

.shop-item.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.1));
    border-color: var(--accent-secondary);
}

.shop-item-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.shop-item-icon {
    font-size: 60px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.shop-item-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.shop-item-button {
    width: 100%;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shop-item-button.buy {
    background: var(--accent-primary);
    color: white;
}

.shop-item-button.buy:hover:not(:disabled) {
    background: var(--accent-hover);
}

.shop-item-button.buy:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.shop-item-button.select {
    background: var(--bg-secondary);
    color: var(--accent-secondary);
    border: 2px solid var(--accent-secondary);
}

.shop-item-button.select:hover {
    background: var(--accent-secondary);
    color: white;
}


/* Start Screen High Score */
.start-high-score {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.1));
    border: 2px solid var(--accent-secondary);
    border-radius: 12px;
    text-align: center;
}

.start-score-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-score-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--accent-secondary);
    text-shadow: 0 2px 8px var(--shadow-lg);
}
