* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* Prevent text selection on double taps */
    -webkit-user-select: none;
}

/* Prevent touch actions only on game canvas and during gameplay */
canvas, #game-container {
    touch-action: none;
}

body {
    width: 100vw;
    height: 100vh;
    background-color: #222;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: fixed;
    -webkit-tap-highlight-color: transparent;
}

/* Allow scrolling on body when menu is active */
body.menu-active {
    touch-action: pan-y;
    overflow-y: auto;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #333; /* Dark ground */
    touch-action: none; /* Prevent scrolling on canvas during game */
    -webkit-touch-callout: none;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas when UI is just HUD */
    z-index: 10; /* Assure que l'UI est au-dessus du canvas */
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    pointer-events: auto; /* Re-enable clicks for buttons */
    transition: opacity 0.3s;
    padding: 20px;
    text-align: center;
    touch-action: pan-y; /* Allow vertical scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 20; /* Assure que les écrans sont au-dessus de tout */
}

.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden; /* Ensure it's completely hidden */
}

.active {
    opacity: 1;
    pointer-events: auto;
}

#hud {
    height: auto;
    flex-direction: row;
    z-index: 15; /* Assure que le HUD est au-dessus du canvas mais sous les écrans */
    justify-content: space-between;
    padding: 20px;
    background: none;
    pointer-events: none;
    align-items: flex-start; /* Align items to top */
    flex-wrap: wrap;
}

.stat-box {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px black;
    display: flex;
    align-items: center;
    gap: 10px;
}

#streak-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#streak-bars {
    display: flex;
    gap: 4px;
}

.streak-bar {
    width: 12px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    transition: background-color 0.2s, transform 0.2s;
}

/* Streak Colors */
.streak-bar.active-1 { background-color: #f1c40f; box-shadow: 0 0 5px #f1c40f; } /* Yellow */
.streak-bar.active-2 { background-color: #f39c12; box-shadow: 0 0 5px #f39c12; } /* Orange-Yellow */
.streak-bar.active-3 { background-color: #e67e22; box-shadow: 0 0 8px #e67e22; } /* Orange */
.streak-bar.active-4 { background-color: #d35400; box-shadow: 0 0 8px #d35400; } /* Dark Orange */
.streak-bar.active-5 { background-color: #c0392b; box-shadow: 0 0 10px #c0392b; } /* Red */

#streak-fire {
    font-size: 28px;
    animation: pulse 1s infinite;
}

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

button {
    padding: 15px 40px;
    font-size: 24px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    font-weight: bold;
    touch-action: manipulation; /* Améliore la réactivité sur mobile */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

button:hover {
    background-color: #c0392b;
}

button:active {
    transform: scale(0.95); /* Feedback visuel sur mobile */
}

/* Assurer que tous les boutons sont cliquables sur mobile */
button, .tab-btn, .upgrade-btn, .free-gold-btn, .leaderboard-tab-btn, .lang-btn {
    pointer-events: auto !important;
    -webkit-touch-callout: none;
}

button:active {
    transform: translateY(2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Smaller login button on Play tab */
#login-btn {
    padding: 8px 22px;
    font-size: 16px;
    margin-top: 8px;
}

#high-scores {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
}

#high-score-list {
    list-style: none;
    margin-top: 10px;
    max-height: 100px;
    overflow-y: auto;
}

#high-score-list li {
    padding: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

/* Game Summary Styles */
#game-summary {
    width: 100%;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 18px;
}

.plus {
    color: #2ecc71;
    font-weight: bold;
}

.minus {
    color: #e74c3c;
    font-weight: bold;
}

h1 { font-size: 42px; margin-bottom: 20px; color: #e74c3c; text-shadow: 2px 2px 0 #fff; }
h2 { font-size: 36px; margin-bottom: 10px; }
h3 { font-size: 20px; margin-bottom: 5px; color: #f1c40f; }
p { font-size: 18px; margin-bottom: 10px; line-height: 1.4; }

/* Tabs Styles */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 30px;
    font-size: 18px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
    touch-action: manipulation; /* Améliore la réactivité sur mobile */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.tab-btn.icon-btn {
    padding: 12px 20px;
    font-size: 24px;
    min-width: 50px;
}

.tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

.tab-btn.active {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 450px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
}

/* Fixed tabs at top */
#start-screen {
    justify-content: flex-start;
    padding-top: 10vh;
}

#start-screen h1 {
    margin-bottom: 15px;
}

#start-screen .tabs {
    margin-bottom: 30px;
}

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

/* Rules Styles */
.rules-container {
    max-height: 55vh;
    height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color: #e74c3c #333;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    position: relative;
}

.rules-container::-webkit-scrollbar {
    width: 8px;
}

.rules-container::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.rules-container::-webkit-scrollbar-thumb {
    background: #e74c3c;
    border-radius: 4px;
}

/* Enhanced scrollbars for mobile */
@media screen and (max-width: 768px) {
    .rules-container::-webkit-scrollbar,
    .shop-container::-webkit-scrollbar,
    .leaderboard-list::-webkit-scrollbar {
        width: 12px;
    }
    
    .rules-container::-webkit-scrollbar-thumb,
    .shop-container::-webkit-scrollbar-thumb,
    .leaderboard-list::-webkit-scrollbar-thumb {
        background: #e74c3c;
        border-radius: 6px;
        border: 2px solid rgba(0, 0, 0, 0.2);
    }
    
    .rules-container::-webkit-scrollbar-thumb:active,
    .shop-container::-webkit-scrollbar-thumb:active,
    .leaderboard-list::-webkit-scrollbar-thumb:active {
        background: #c0392b;
    }
}

.rule-section {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #e74c3c;
    padding: 12px 15px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
}

.rule-section h3 {
    margin-bottom: 8px;
    font-size: 18px;
}

.rule-section p {
    font-size: 15px;
    margin-bottom: 5px;
    color: #ddd;
}

.rule-section .emoji {
    font-size: 20px;
    margin-right: 5px;
}

.rule-section .warning {
    color: #f39c12;
    font-style: italic;
    font-size: 14px;
    margin-top: 8px;
}

/* Final Stats on Game Over */
.final-stats {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 10px;
}

.final-stats p {
    font-size: 22px;
    font-weight: bold;
}

.final-stats span {
    color: #3498db;
}

/* Pause Button */
#pause-btn {
    padding: 8px 12px;
    font-size: 24px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    margin-top: 0;
    margin-left: 15px;
    pointer-events: auto;
    transition: all 0.2s ease;
}

#pause-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Pause Screen */
#pause-screen {
    background-color: rgba(0, 0, 0, 0.9);
}

#pause-screen h2 {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 20px;
}

/* Pause buttons container: always stack vertically (Resume above Quit) */
.pause-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#resume-btn {
    background-color: #27ae60;
    font-size: 28px;
    padding: 18px 50px;
}

#resume-btn:hover {
    background-color: #219a52;
}

/* Countdown */
#countdown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
}

#countdown-number {
    font-size: 150px;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 0 0 30px rgba(241, 196, 15, 0.8);
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(1.5); opacity: 0; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.8; }
}

/* Game Over Buttons */
.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#menu-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    font-size: 18px;
    padding: 12px 30px;
}

#menu-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f6dad);
}

#revive-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    font-size: 20px;
    padding: 15px 35px;
    animation: revivePulse 2s ease-in-out infinite;
    border: 2px solid #f1c40f;
}

#revive-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

#revive-btn:disabled {
    background: #555;
    border-color: #444;
    color: #888;
    animation: none;
    cursor: not-allowed;
}

@keyframes revivePulse {
    0%, 100% { box-shadow: 0 0 10px rgba(241, 196, 15, 0.5); }
    50% { box-shadow: 0 0 25px rgba(241, 196, 15, 0.8); }
}

/* Ad Screen */
#ad-screen {
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100;
}

#ad-container {
    width: 90%;
    max-width: 500px;
    text-align: center;
}

#ad-skip-text {
    color: #aaa;
    font-size: 16px;
    margin-bottom: 20px;
}

#ad-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 15px;
    padding: 40px 30px;
    border: 3px solid #3498db;
}

#ad-content h2 {
    color: #3498db;
    margin-bottom: 30px;
}

#ad-fake {
    color: #ecf0f1;
}

#ad-fake p {
    margin-bottom: 15px;
}

#ad-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #1a252f;
    border-radius: 4px;
    margin-top: 30px;
    overflow: hidden;
}

#ad-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Gold Display */
.gold-display {
    position: relative; /* For absolute positioning of floating text */
    display: flex;
    align-items: center;
    justify-content: center; /* Center content */
    gap: 8px;
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    padding: 10px 25px;
    border-radius: 25px;
    border: 2px solid #f1c40f;
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
    transition: transform 0.1s;
}

.gold-display.shop-gold {
    width: 90%;
    max-width: 300px;
    margin: 0 auto 15px auto;
}

.gold-display.pulse {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.6);
}

.gold-floating-text {
    position: absolute;
    top: -30px;
    right: 0;
    font-size: 20px;
    color: #2ecc71;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-40px); opacity: 0; }
}

.gold-icon {
    font-size: 28px;
}

.gold-earned-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #27ae60, #1e8449);
    padding: 12px 25px;
    border-radius: 10px;
    border: 2px solid #f1c40f;
    margin: 15px 0;
    font-size: 22px;
    font-weight: bold;
    color: #f1c40f;
    animation: goldPulse 1.5s ease-in-out infinite;
}

.gold-earned-box .gold-total {
    font-size: 16px;
    color: #ecf0f1;
    opacity: 0.8;
}

@keyframes goldPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(241, 196, 15, 0.5); }
    50% { box-shadow: 0 0 25px rgba(241, 196, 15, 0.8); }
}

/* Shop Styles */
.shop-container {
    width: 100%;
    max-height: 55vh;
    height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 10px;
    scrollbar-width: thin;
    scrollbar-color: #e74c3c #333;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    position: relative;
}

.shop-container::-webkit-scrollbar {
    width: 8px;
}

.shop-container::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.shop-container::-webkit-scrollbar-thumb {
    background: #e74c3c;
    border-radius: 4px;
}

.shop-header-actions {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.free-gold-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: 2px solid #f1c40f;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(155, 89, 182, 0.4);
    animation: pulse 2s infinite;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.free-gold-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(155, 89, 182, 0.6);
    background: linear-gradient(135deg, #a569bd, #9b59b6);
}

.upgrade-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.upgrade-icon {
    font-size: 32px;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}

.upgrade-info {
    flex-grow: 1;
    text-align: left;
}

.upgrade-info h3 {
    font-size: 18px;
    color: #3498db;
    margin-bottom: 4px;
}

.upgrade-info p {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 8px;
}

.upgrade-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    color: #ecf0f1;
}

.stat-current {
    color: #3498db;
    font-weight: bold;
}

.stat-next {
    color: #2ecc71;
    font-weight: bold;
}

.upgrade-level {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.level-dots {
    display: flex;
    gap: 3px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
}

.dot.filled {
    background-color: #2ecc71;
    box-shadow: 0 0 5px #2ecc71;
}

.upgrade-buttons {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.upgrade-btn {
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 8px;
    margin-top: 0;
    min-width: 90px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    touch-action: manipulation; /* Améliore la réactivité sur mobile */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.upgrade-btn.gold-btn {
    background: #27ae60;
    color: white;
}

.upgrade-btn.gold-btn:hover {
    background: #219a52;
}

.upgrade-btn.gold-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

.upgrade-btn.time-btn {
    background: #3498db;
    color: white;
    font-size: 14px;
}

.upgrade-btn.time-btn:hover {
    background: #2980b9;
}

.upgrade-btn.time-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

.upgrade-btn.time-btn.active {
    background: #e67e22;
    position: relative;
    overflow: hidden;
}

.time-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: loaderSlide 1s linear infinite;
    pointer-events: none;
    display: none; /* Hidden by default */
}

@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.time-text {
    position: relative;
    z-index: 1;
}

.upgrade-btn.maxed {
    background: #f39c12;
    color: white;
    cursor: default;
}

/* Settings Styles */
.settings-container {
    padding: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

/* About Styles */
.about-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.about-section {
    margin-bottom: 25px;
}

.about-section h3 {
    color: #f1c40f;
    margin-bottom: 15px;
    font-size: 20px;
    text-align: center;
}

.credits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credit-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid #3498db;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.credit-item strong {
    color: #3498db;
    font-size: 14px;
}

.credit-item span {
    color: #ecf0f1;
    font-size: 14px;
}

.credit-item a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s;
}

.credit-item a:hover {
    color: #5dade2;
    text-decoration: underline;
}

/* About Corner Button */
.about-corner-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.8);
    border: 2px solid #3498db;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Cacher le bouton About pendant le jeu */
#hud.active ~ .about-corner-btn,
#game-over-screen.active ~ .about-corner-btn {
    display: none;
}

.about-corner-btn:hover {
    background: rgba(52, 152, 219, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.5);
}

.about-corner-btn:active {
    transform: scale(0.95);
}

/* About Overlay */
.about-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.about-overlay.hidden {
    display: none;
}

.about-modal {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 3px solid #3498db;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.login-overlay.hidden {
    display: none;
}

.login-modal {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 3px solid #e67e22;
    border-radius: 15px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
    padding-bottom: 10px;
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 10px 20px;
    border-bottom: 2px solid #e67e22;
}

.login-modal-header h2 {
    color: #f1c40f;
    margin: 0;
    font-size: 22px;
}

.login-close-btn {
    background: transparent;
    border: none;
    color: #ecf0f1;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.login-close-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    transform: rotate(90deg);
}

.login-container {
    padding: 16px 20px 20px 20px;
}

.login-container .player-name-input,
.login-container .player-pin-input {
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    max-width: 260px;
}

.login-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.login-modal-actions button {
    padding: 10px 18px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: #ecf0f1;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.login-modal-actions #login-confirm-btn {
    background: linear-gradient(135deg, #e67e22, #e74c3c);
    border-color: #e67e22;
    font-weight: bold;
}

.login-modal-actions #login-cancel-btn {
    background: rgba(0, 0, 0, 0.7);
}

.login-modal-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

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

.about-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #3498db;
}

.about-modal-header h2 {
    color: #f1c40f;
    margin: 0;
    font-size: 24px;
}

.about-close-btn {
    background: transparent;
    border: none;
    color: #ecf0f1;
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.about-close-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    transform: rotate(90deg);
}

.about-container {
    padding: 20px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.setting-label {
    display: block;
    color: #3498db;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.setting-select {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
}

.setting-select:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.setting-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.setting-select option {
    background: #222;
    color: white;
    padding: 10px;
}

.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.audio-control-row {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    background: rgba(52, 152, 219, 0.08);
    border-radius: 6px;
    transition: background 0.2s;
}

.audio-control-row:hover {
    background: rgba(52, 152, 219, 0.12);
}

.audio-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
    color: #fff;
    font-size: 15px;
}

.audio-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3498db;
}

.audio-slider-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    color: #fff;
}

.audio-label-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.audio-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    cursor: pointer;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.audio-slider-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.audio-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
}

.audio-slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.audio-slider-container input[type="range"]::-moz-range-thumb:hover {
    background: #2980b9;
}

.audio-volume-value {
    min-width: 45px;
    text-align: right;
    color: #3498db;
    font-weight: 600;
    font-size: 14px;
}

/* Player Name Input */
.player-name-input {
    margin-bottom: 20px;
    width: 100%;
    max-width: 300px;
}

.player-name-input label {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    color: #ecf0f1;
}

.player-name-input input {
    width: 100%;
    padding: 12px 15px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    text-align: center;
    transition: all 0.2s;
}

.player-name-input input:focus {
    outline: none;
    border-color: #e74c3c;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

/* Player PIN Input */
.player-pin-input {
    margin-bottom: 8px;
    width: 100%;
    max-width: 300px;
}

.player-pin-input label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #ecf0f1;
}

.player-pin-input input {
    width: 100%;
    padding: 10px 14px;
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ecf0f1;
    transition: all 0.2s;
}

.player-pin-input input:focus {
    outline: none;
    border-color: #e67e22;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.4);
}

.play-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.play-mode-toggle .mode-btn {
    flex: 1;
    max-width: 150px;
    padding: 8px 10px;
    font-size: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: #ecf0f1;
    cursor: pointer;
    transition: all 0.2s;
}

.play-mode-toggle .mode-btn.active {
    background: linear-gradient(135deg, #e67e22, #e74c3c);
    border-color: #e67e22;
    color: #fff;
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
}

.play-mode-status {
    margin-top: 4px;
    margin-bottom: 4px;
    font-size: 14px;
    color: #bdc3c7;
}

.player-name-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.player-name-input input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Leaderboard Styles */
.leaderboard-container {
    width: 100%;
    max-width: 600px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.leaderboard-tab-btn {
    padding: 10px 25px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
}

.leaderboard-tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.leaderboard-tab-btn.active {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

.leaderboard-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
    align-items: center;
}

.leaderboard-search input {
    flex: 1;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    transition: all 0.2s;
}

.leaderboard-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.leaderboard-search input:focus {
    outline: none;
    border-color: #e74c3c;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.leaderboard-search button {
    padding: 10px 20px;
    font-size: 16px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0;
}

.leaderboard-search button:hover {
    background: linear-gradient(135deg, #2980b9, #1f6dad);
    transform: scale(1.05);
}

.leaderboard-search-result {
    margin-bottom: 20px;
    min-height: 50px;
    width: 100%;
    clear: both;
}

.leaderboard-search-result .leaderboard-header,
.leaderboard-search-result .leaderboard-body {
    width: 100%;
}

.leaderboard-controls {
    margin-bottom: 15px;
    margin-top: 15px;
    display: flex;
    justify-content: center;
    clear: both;
    width: 100%;
}

.refresh-btn {
    padding: 10px 20px;
    font-size: 16px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f6dad);
    transform: scale(1.05);
}

.leaderboard-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #e74c3c #333;
    max-height: 55vh;
    height: 55vh;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    position: relative;
}

.leaderboard-personal {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}

.leaderboard-personal .personal-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.leaderboard-personal .personal-body .leaderboard-row {
    font-size: 14px;
}

.login-error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 4px;
}

.player-pin-help {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}

.leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: #e74c3c;
    border-radius: 4px;
}

.leaderboard-header {
    margin-bottom: 10px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px 80px;
    gap: 10px;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    align-items: center;
    transition: all 0.2s;
}

.leaderboard-row.header-row {
    background: rgba(231, 76, 60, 0.2);
    font-weight: bold;
    color: #f1c40f;
    border-bottom: 2px solid #e74c3c;
    margin-bottom: 10px;
    padding: 12px 10px;
}

.leaderboard-row:not(.header-row) {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-row:not(.header-row):hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.leaderboard-row.current-player {
    background: rgba(46, 204, 113, 0.2);
    border: 2px solid #2ecc71;
    font-weight: bold;
}

.leaderboard-row.player-rank-separator {
    margin-top: 15px;
    border-top: 2px dashed rgba(46, 204, 113, 0.5);
    padding-top: 15px;
}

.rank-col {
    text-align: center;
    font-weight: bold;
}

.name-col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-col {
    text-align: center;
    color: #f1c40f;
    font-weight: bold;
}

.time-col {
    text-align: center;
    color: #3498db;
    font-size: 14px;
}

.loading-text, .no-scores, .error-text {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-size: 16px;
}

.error-text {
    color: #e74c3c;
}

/* Online Score Status */
.online-score-status {
    margin-top: 15px;
    text-align: center;
    min-height: 25px;
}

#score-submit-status {
    font-size: 14px;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ============================================ */

/* Tablets and small screens */
@media screen and (max-width: 768px) {
    h1 { 
        font-size: 22px; 
        margin-bottom: 8px; 
    }
    
    h2 { 
        font-size: 20px; 
        margin-bottom: 6px; 
    }
    
    h3 { 
        font-size: 14px; 
    }
    
    p { 
        font-size: 12px; 
    }
    
    .screen {
        padding: 8px;
    }
    
    #start-screen {
        padding-top: 2vh;
    }
    
    #start-screen h1 {
        margin-bottom: 6px;
    }
    
    .tabs {
        gap: 3px;
        margin-bottom: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tab-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .tab-btn.icon-btn {
        padding: 6px 10px;
        font-size: 16px;
        min-width: 35px;
    }
    
    .tab-content {
        max-width: 100%;
        width: 100%;
        max-height: 85vh;
    }
    
    .tab-content.active {
        max-height: 85vh;
    }
    
    button {
        padding: 8px 20px;
        font-size: 16px;
        margin-top: 8px;
    }
    
    .play-mode-toggle {
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .play-mode-toggle .mode-btn {
        padding: 4px 6px;
        font-size: 11px;
        max-width: 100px;
    }
    
    .play-mode-status {
        font-size: 11px;
        margin-top: 1px;
        margin-bottom: 1px;
    }
    
    .gold-display {
        padding: 6px 15px;
        font-size: 16px;
    }
    
    .gold-display.shop-gold {
        max-width: 260px;
    }
    
    .gold-icon {
        font-size: 20px;
    }
    
    .stat-box {
        font-size: 18px;
        gap: 5px;
    }
    
    #hud {
        padding: 10px;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .rules-container {
        max-height: 60vh;
        height: 60vh;
        padding: 8px;
        min-height: 200px;
    }
    
    .shop-container {
        max-height: 60vh;
        height: 60vh;
        padding: 0 5px;
        min-height: 200px;
    }
    
    .upgrade-item {
        padding: 12px;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }
    
    .upgrade-icon {
        font-size: 28px;
        margin-right: 10px;
    }
    
    .upgrade-info h3 {
        font-size: 16px;
    }
    
    .upgrade-info p {
        font-size: 13px;
    }
    
    .leaderboard-container {
        max-height: 60vh;
        min-height: 200px;
    }
    
    .leaderboard-list {
        max-height: 50vh;
        height: 50vh;
        min-height: 150px;
    }
    
    .leaderboard-row {
        font-size: 14px;
        padding: 8px 5px;
        gap: 5px;
    }
    
    .leaderboard-row.header-row {
        font-size: 12px;
        padding: 10px 5px;
    }
    
    .rank-col, .name-col, .score-col, .time-col {
        font-size: 12px;
    }
    
    .final-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .final-stats p {
        font-size: 18px;
    }
    
    .game-over-buttons {
        width: 100%;
    }
    
    .game-over-buttons button {
        width: 100%;
        max-width: 300px;
    }
}

/* Mobile phones */
@media screen and (max-width: 480px) {
    h1 { 
        font-size: 18px; 
        margin-bottom: 6px; 
    }
    
    h2 { 
        font-size: 16px; 
        margin-bottom: 4px; 
    }
    
    h3 { 
        font-size: 12px; 
    }
    
    p { 
        font-size: 11px; 
        margin-bottom: 4px;
    }
    
    .screen {
        padding: 6px;
    }
    
    #start-screen {
        padding-top: 1vh;
    }
    
    #start-screen h1 {
        margin-bottom: 5px;
    }
    
    .tabs {
        gap: 2px;
        margin-bottom: 6px;
    }
    
    .tab-btn {
        padding: 4px 6px;
        font-size: 10px;
    }
    
    .tab-btn.icon-btn {
        padding: 5px 8px;
        font-size: 14px;
        min-width: 30px;
    }
    
    button {
        padding: 6px 16px;
        font-size: 14px;
        margin-top: 6px;
    }
    
    .play-mode-toggle {
        gap: 3px;
        margin-bottom: 6px;
    }
    
    .play-mode-toggle .mode-btn {
        padding: 4px 5px;
        font-size: 10px;
        max-width: 85px;
    }
    
    .play-mode-status {
        font-size: 10px;
        margin-top: 1px;
        margin-bottom: 1px;
    }
    
    .gold-display {
        padding: 5px 12px;
        font-size: 14px;
    }
    
    .gold-display.shop-gold {
        max-width: 100%;
    }
    
    .gold-icon {
        font-size: 18px;
    }
    
    .stat-box {
        font-size: 14px;
        gap: 3px;
        flex-wrap: wrap;
    }
    
    #hud {
        padding: 8px 5px;
        flex-direction: row;
        align-items: flex-start;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    #hud .stat-box {
        font-size: 12px;
        flex: 0 0 auto;
    }
    
    #hud #streak-container {
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }
    
    #streak-container {
        flex-wrap: wrap;
    }
    
    #streak-bars {
        gap: 2px;
    }
    
    .streak-bar {
        width: 8px;
        height: 16px;
    }
    
    #pause-btn {
        padding: 6px 10px;
        font-size: 18px;
        margin-left: 0;
        margin-top: 5px;
    }
    
    .rules-container {
        max-height: 70vh;
        height: 70vh;
        padding: 5px;
        min-height: 200px;
    }
    
    .rule-section {
        padding: 8px 10px;
        margin-bottom: 8px;
    }
    
    .rule-section h3 {
        font-size: 12px;
    }
    
    .rule-section p {
        font-size: 11px;
    }
    
    .shop-container {
        max-height: 70vh;
        height: 70vh;
        min-height: 200px;
    }
    
    .upgrade-item {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .upgrade-icon {
        font-size: 20px;
        margin-right: 6px;
        width: 26px;
    }
    
    .upgrade-info {
        flex: 1;
        min-width: 0;
    }
    
    .upgrade-info h3 {
        font-size: 12px;
    }
    
    .upgrade-info p {
        font-size: 10px;
    }
    
    .upgrade-stats {
        font-size: 10px;
    }
    
    .upgrade-level {
        font-size: 12px;
    }
    
    .upgrade-buttons {
        width: 100%;
        flex-direction: row;
        margin-top: 8px;
    }
    
    .upgrade-btn {
        flex: 1;
        min-width: 0;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .upgrade-btn.time-btn {
        font-size: 10px;
    }
    
    .leaderboard-tab-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .leaderboard-search input {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .leaderboard-search button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .setting-label {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .setting-select {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .player-name-input {
        max-width: 100%;
        margin-bottom: 12px;
    }
    
    .player-name-input input {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .leaderboard-container {
        max-height: 70vh;
        min-height: 200px;
    }
    
    .leaderboard-list {
        max-height: 60vh;
        height: 60vh;
        min-height: 150px;
    }
    
    .leaderboard-row {
        grid-template-columns: 45px 1fr 60px 50px;
        font-size: 10px;
        padding: 5px 2px;
        gap: 2px;
    }
    
    .leaderboard-row.header-row {
        font-size: 10px;
        padding: 6px 2px;
    }
    
    .rank-col, .score-col, .time-col {
        font-size: 10px;
    }
    
    .name-col {
        font-size: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .final-stats {
        gap: 8px;
    }
    
    .final-stats p {
        font-size: 16px;
    }
    
    #game-summary {
        padding: 12px;
        margin: 10px 0;
    }
    
    .summary-row {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .gold-display {
        padding: 8px 20px;
        font-size: 20px;
    }
    
    .gold-display.shop-gold {
        max-width: 100%;
    }
    
    .gold-icon {
        font-size: 24px;
    }
    
    .gold-earned-box {
        padding: 10px 20px;
        font-size: 18px;
    }
    
    .free-gold-btn {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .lang-btn {
        padding: 12px 15px;
        font-size: 18px;
        gap: 15px;
    }
    
    .lang-flag {
        font-size: 28px;
    }
    
    #high-scores {
        margin-top: 15px;
        padding: 12px;
    }
    
    #high-score-list {
        font-size: 12px;
    }
    
    #high-score-list li {
        padding: 4px;
        font-size: 12px;
    }
    
    #pause-screen h2 {
        font-size: 36px;
    }
    
    #resume-btn {
        font-size: 24px;
        padding: 15px 40px;
    }
    
    #countdown-number {
        font-size: 100px;
    }
    
    #ad-content {
        padding: 30px 20px;
    }
    
    #ad-content h2 {
        font-size: 24px;
    }
    
    .loading-text, .no-scores, .error-text {
        padding: 15px;
        font-size: 14px;
    }
    
    #score-submit-status {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Very small phones (landscape) */
@media screen and (max-width: 360px) {
    h1 { 
        font-size: 16px; 
        margin-bottom: 4px;
    }
    
    #start-screen h1 {
        margin-bottom: 4px;
    }
    
    .tabs {
        gap: 1px;
        margin-bottom: 4px;
    }
    
    .tab-btn {
        padding: 3px 5px;
        font-size: 9px;
    }
    
    .tab-btn.icon-btn {
        padding: 4px 6px;
        font-size: 12px;
        min-width: 28px;
    }
    
    button {
        padding: 5px 12px;
        font-size: 12px;
        margin-top: 4px;
    }
    
    .play-mode-toggle {
        gap: 2px;
        margin-bottom: 4px;
    }
    
    .play-mode-toggle .mode-btn {
        padding: 3px 4px;
        font-size: 9px;
        max-width: 75px;
    }
    
    .play-mode-status {
        font-size: 9px;
    }
    
    .gold-display {
        padding: 4px 10px;
        font-size: 12px;
    }
    
    .gold-icon {
        font-size: 16px;
    }
    
    .stat-box {
        font-size: 11px;
    }
    
    #hud .stat-box {
        font-size: 10px;
    }
}

/* Overlay d'orientation pour bloquer le mode portrait sur mobile */
#orientation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 20px;
    z-index: 3000;
}

#orientation-overlay .orientation-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

#orientation-overlay .orientation-text {
    font-size: 18px;
    line-height: 1.4;
}

#orientation-overlay.visible {
    display: flex;
}

/* Ne jamais afficher l'overlay sur desktop */
@media screen and (min-width: 769px) {
    #orientation-overlay {
        display: none !important;
    }
}

/* Prevent text selection and context menu on mobile */
@media screen and (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    button, .tab-btn, .upgrade-btn {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
    
    input, textarea {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    #start-screen {
        padding-top: 0.5vh;
    }
    
    #start-screen h1 {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .tabs {
        margin-bottom: 4px;
        gap: 2px;
    }
    
    .tab-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .tab-btn.icon-btn {
        padding: 5px 8px;
        font-size: 14px;
        min-width: 30px;
    }
    
    button {
        padding: 6px 16px;
        font-size: 14px;
        margin-top: 6px;
    }
    
    .play-mode-toggle {
        gap: 3px;
        margin-bottom: 4px;
    }
    
    .play-mode-toggle .mode-btn {
        padding: 4px 5px;
        font-size: 10px;
        max-width: 85px;
    }
    
    .gold-display {
        padding: 5px 12px;
        font-size: 14px;
    }
    
    .rules-container,
    .shop-container {
        max-height: 50vh;
        min-height: 150px;
    }
    
    .leaderboard-container {
        max-height: 50vh;
        min-height: 150px;
    }
    
    .leaderboard-list {
        max-height: 40vh;
        min-height: 120px;
    }
    
    #hud {
        padding: 5px;
    }
    
    .stat-box {
        font-size: 14px;
    }
}

/* Paysage avec faible hauteur (tablettes / mobiles en paysage) : rapprocher l'UX du desktop */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #hud {
        padding: 6px;
        gap: 6px;
    }

    .stat-box {
        font-size: 16px;
        gap: 6px;
    }

    #pause-btn {
        padding: 6px 10px;
        font-size: 20px;
        margin-left: 8px;
    }

    #streak-fire {
        font-size: 22px;
    }

    .streak-bar {
        width: 10px;
        height: 18px;
    }
}