/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #4A90E2;
    --secondary-green: #7ED321;
    --accent-orange: #F5A623;
    --danger-red: #D0021B;
    --background-light: #F8F9FA;
    --text-dark: #2C3E50;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 10px;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    overflow: hidden; /* Requirement 1.10.2: Prevent browser scrolling */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    /* Prevent pull-to-refresh on mobile (Requirement 1.10.2) */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    /* Prevent zoom on double tap */
    touch-action: manipulation;
}

/* Allow scrolling in modal windows */
body.modal-open {
    overflow: hidden; /* Keep body locked */
}

.screen.active {
    overflow-y: auto; /* Allow scrolling in active screens */
}

/* Prevent context menu and text selection */
body, canvas, button, div {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Game container - Full screen approach */
.game-container {
    display: grid;
    grid-template-areas: 
        "header"
        "main"
        "controls";
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

/* Header */
.game-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
    gap: 10px;
}

.score-display {
    display: flex;
    gap: 20px;
    font-size: 22px;  /* Было 18px - увеличено на 22% */
    font-weight: bold;
    color: white;
}

/* Progress System */
.progress-system {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
    max-width: 400px;
}

.level-stars {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.star {
    font-size: 24px;  /* Было 20px - увеличено на 20% */
    transition: all 0.3s ease;
    filter: grayscale(100%);
    opacity: 0.3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;  /* Было 24px - увеличено пропорционально */
    height: 28px; /* Было 24px - увеличено пропорционально */
    box-sizing: border-box; /* Важно для правильного размера с border */
}

.star.earned {
    filter: grayscale(0%);
    opacity: 1;
    animation: starGlow 2s infinite alternate;
}

.star.current {
    filter: grayscale(100%); /* Остается серой */
    opacity: 0.6; /* Чуть ярче чем обычные серые */
    border: 2px solid #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    animation: currentStarPulse 1.5s infinite;
    /* Убираем отдельные width/height - используем наследованные от .star */
    /* box-sizing: border-box уже установлен в .star */
}

.star.active {
    /* Legacy support - same as earned */
    filter: grayscale(0%);
    opacity: 1;
    animation: starGlow 2s infinite alternate;
}

@keyframes starGlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); text-shadow: 0 0 10px #FFD700; }
}

@keyframes currentStarPulse {
    0% { 
        border-color: #FFD700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% { 
        border-color: #FFA500;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    100% { 
        border-color: #FFD700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.level-text {
    color: white;
    font-size: 16px;  /* Было 14px - увеличено на 14% */
    font-weight: bold;
    white-space: nowrap;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 45px;   /* Было 40px - увеличено на 12% */
    height: 45px;  /* Было 40px - увеличено на 12% */
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;  /* Было 18px - увеличено на 11% */
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Main game area */
.game-main {
    grid-area: main;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* Add subtle obby-style border effect */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Screen overlays */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.screen > div {
    background: white;
    padding: 60px;  /* Было 40px - увеличено на 50% */
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 800px; /* Было 600px - увеличено на 33% */
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: contain; /* Prevent parent scrolling */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    /* Android specific fixes */
    touch-action: pan-y; /* Allow vertical scrolling */
    scroll-behavior: smooth;
}

/* Game title with obby-style */
.game-title {
    font-size: 4em;  /* Было 3em - увеличено на 33% */
    color: var(--primary-blue);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    /* Add obby-style text effects */
    background: linear-gradient(45deg, #4A90E2, #7ED321, #F5A623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: obbyGlow 3s ease-in-out infinite alternate;
}

@keyframes obbyGlow {
    0% { 
        filter: drop-shadow(0 0 5px rgba(74, 144, 226, 0.5));
        transform: scale(1);
    }
    100% { 
        filter: drop-shadow(0 0 15px rgba(126, 211, 33, 0.8));
        transform: scale(1.02);
    }
}

.game-subtitle {
    font-size: 1.6em;  /* Было 1.2em - увеличено на 33% */
    color: var(--text-dark);
    margin-bottom: 30px;
}

.best-score-menu {
    margin-top: 20px;
    font-size: 1.1em;
    color: var(--accent-orange);
    font-weight: bold;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.pause-content h2 {
    margin-bottom: 30px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Tutorial screen */
.tutorial-steps {
    display: grid;
    gap: 20px;
    margin: 30px 0;
}

.tutorial-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--background-light);
    border-radius: var(--border-radius);
}

.tutorial-icon {
    font-size: 2em;
    min-width: 60px;
}

.tutorial-step p {
    font-size: 1.1em;
    text-align: left;
}

/* Game over screen */
.final-score {
    font-size: 2em;
    color: var(--primary-blue);
    margin: 20px 0;
    font-weight: bold;
}

.new-record {
    font-size: 1.5em;
    color: var(--secondary-green);
    margin: 10px 0;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Stars congratulation styles */
.stars-congratulation {
    text-align: center;
    margin: 15px 0;
}

.congrats-title {
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stars-count {
    color: #FF6B35;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.button-row .main-btn {
    flex: 1;
    min-width: 120px;
}

/* Shop screen */
.shop-content {
    max-width: 900px; /* Было 700px - увеличено на 29% */
    width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: contain; /* Prevent parent scrolling */
    touch-action: pan-y; /* Allow vertical scrolling on Android */
    scroll-behavior: smooth;
    padding: 25px; /* Было 15px - увеличено на 67% */
}

.currency-display {
    text-align: center;
    font-size: 1.6em; /* Было 1.3em - увеличено на 23% */
    font-weight: bold;
    color: var(--accent-orange);
    margin-bottom: 20px; /* Было 15px - увеличено */
    padding: 12px; /* Было 8px - увеличено на 50% */
    background: var(--background-light);
    border-radius: var(--border-radius);
}

.shop-tutorial {
    margin-bottom: 15px; /* Reduced from 20px */
}

.tutorial-tip {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced from 10px */
    padding: 10px; /* Reduced from 15px */
    background: linear-gradient(135deg, #E3F2FD, #F3E5F5);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-blue);
}

.tip-icon {
    font-size: 1.2em; /* Reduced from 1.5em */
    flex-shrink: 0;
}

.tip-text {
    font-size: 1.1em; /* Было 0.95em - увеличено на 16% */
    color: var(--text-dark);
    font-weight: 500;
}

.shop-categories {
    display: flex;
    flex-direction: column; /* Изменено с row на column - теперь в столбик */
    gap: 25px; /* Увеличено с 20px */
    margin-bottom: 15px;
}

.shop-category {
    flex: 1; /* Equal width for both categories */
}

.shop-category h3 {
    color: var(--primary-blue);
    margin-bottom: 10px; /* Было 8px */
    font-size: 1.6em;   /* Было 1.4em - увеличено еще на 14% */
    text-align: left;   /* Изменено с center на left для столбика */
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Было 150px - увеличено на 20% */
    gap: 20px; /* Было 15px - увеличено на 33% */
    justify-items: stretch;
}

.shop-item {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 20px; /* Было 15px - увеличено на 33% */
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 180px; /* Было 150px - увеличено на 20% */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 1.1em; /* Добавлен больший шрифт для текста в элементах */
}

.shop-item:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.shop-item.owned {
    border-color: var(--secondary-green);
    background: rgba(126, 211, 33, 0.1);
}

.shop-item.selected {
    border-color: var(--accent-orange);
    background: rgba(245, 166, 35, 0.1);
}

.shop-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shop-item.disabled:hover {
    transform: none;
    border-color: transparent;
}

.item-preview {
    width: 60px; /* Было 50px - увеличено на 20% */
    height: 60px; /* Было 50px - увеличено на 20% */
    margin: 0 auto 10px; /* Было 8px - увеличено */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em; /* Было 1.8em - увеличено на 22% */
    background: white;
    border: 2px solid #ddd;
}

.item-name {
    font-weight: bold;
    margin-bottom: 3px; /* Reduced from 4px */
    color: var(--text-dark);
    font-size: 0.85em; /* Further reduced for compactness */
}

.item-price {
    color: var(--accent-orange);
    font-weight: bold;
    font-size: 0.85em; /* Further reduced for compactness */
}

.item-status {
    margin-top: 3px; /* Reduced from 4px */
    font-size: 0.75em; /* Further reduced for compactness */
    font-weight: bold;
}

.item-status.owned {
    color: var(--secondary-green);
}

.item-status.selected {
    color: var(--accent-orange);
}

/* Buttons */
.main-btn {
    padding: 20px 40px;  /* Было 15px 30px - увеличено на 33% */
    font-size: 1.4em;    /* Было 1.2em - увеличено на 17% */
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-blue);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 250px;    /* Было 200px - увеличено на 25% */
}

.main-btn:hover {
    background: #357ABD;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.main-btn:active {
    transform: translateY(0);
}

.main-btn.secondary {
    background: #9B59B6; /* Фиолетовый цвет для магазина */
}

.main-btn.secondary:hover {
    background: #8E44AD;
}

.main-btn.menu {
    background: #E67E22; /* Оранжевый цвет для кнопки "В меню" */
}

.main-btn.menu:hover {
    background: #D35400;
}

.main-btn.ad-reward {
    background: var(--secondary-green);
}

.main-btn.ad-reward:hover {
    background: #6BB91A;
}

.main-btn.disabled {
    background: #95a5a6 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.main-btn.disabled:hover {
    background: #95a5a6 !important;
    transform: none !important;
    box-shadow: none !important;
}

.main-btn small {
    display: block;
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Mobile controls */
.mobile-controls {
    grid-area: controls;
    display: none;
    height: 100px;
}

/* Скрыть кнопки управления когда игра не идет */
.mobile-controls.hidden {
    display: none !important;
}

.touch-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 2em;
    cursor: pointer;
    transition: background 0.1s ease;
    user-select: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.touch-area:active,
.touch-area:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Visual feedback for mouse hold */
.touch-area:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.4);
}

.touch-hint {
    opacity: 0.7;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .game-container {
        grid-template-areas: 
            "header"
            "main"
            "controls";
    }
    
    .mobile-controls {
        display: flex;
    }
    
    #game-canvas {
        border-radius: 0;
        width: 100vw;
        height: calc(100vh - 160px);
    }
    
    .game-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 8px;
    }
    
    .score-display {
        font-size: 14px !important; /* Уменьшено с 16px для мобилки */
        gap: 15px;
        order: 1;
    }
    
    .progress-system {
        order: 2;
        max-width: 100%;
    }
    
    .level-stars {
        gap: 3px;
    }
    
    .star {
        font-size: 16px;
        width: 20px;
        height: 20px;
    }
    
    .level-text {
        font-size: 12px;
    }
    
    .game-controls {
        order: 3;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .screen > div {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .game-title {
        font-size: 2.5em !important; /* Принудительно мобильный размер */
    }
    
    .game-subtitle {
        font-size: 1.2em !important; /* Принудительно мобильный размер */
    }
    
    .tutorial-step {
        flex-direction: column;
        text-align: center;
    }
    
    .tutorial-step p {
        text-align: center;
    }
    
    .game-over-buttons {
        gap: 10px;
    }
    
    /* Адаптивные размеры для текста звезд на мобильных */
    .congrats-title {
        font-size: 16px !important;
    }
    
    .stars-count {
        font-size: 20px !important;
    }
    
    .button-row {
        gap: 10px;
    }
    
    .button-row .main-btn {
        min-width: 100px;
        font-size: 1em;
        padding: 10px 15px;
    }
    
    .main-btn {
        padding: 12px 25px;
        font-size: 1.1em;
        min-width: 180px;
    }
    
    /* Shop mobile styles */
    .shop-content {
        max-height: 75vh; /* Further reduced from 80vh */
        padding: 15px 10px; /* More compact padding */
    }
    
    .shop-categories {
        flex-direction: column; /* Revert to vertical on mobile */
        gap: 12px; /* Smaller gap for mobile */
    }
    
    .shop-category h3 {
        text-align: left; /* Left align on mobile */
    }
    
    .tutorial-tip {
        flex-direction: column;
        text-align: center;
        gap: 6px; /* Reduced from 8px */
        padding: 8px; /* Reduced from 12px */
    }
    
    .tip-text {
        font-size: 0.85em; /* Further reduced from 0.9em */
    }
    
    .shop-items {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); /* auto-fill для лучшего выравнивания */
        gap: 8px;
        justify-items: stretch; /* Растягиваем элементы */
    }
    
    .shop-item {
        padding: 8px;
        min-height: 100px;
        width: 100%; /* Занимаем всю ширину */
    }
    
    .item-preview {
        width: 35px; /* Reduced from 40px */
        height: 35px; /* Reduced from 40px */
        font-size: 1.2em; /* Reduced from 1.4em */
        margin-bottom: 4px; /* Reduced margin */
    }
}

/* Medium screens - transition point */
@media (max-width: 1024px) and (min-width: 769px) {
    .shop-categories {
        flex-direction: column; /* Use vertical layout on medium screens too */
        gap: 15px;
    }
    
    .shop-category h3 {
        text-align: left;
    }
}

/* Desktop specific styles - ensure nothing overrides */
@media (min-width: 1025px) {
    .shop-categories {
        flex-direction: column !important; /* Принудительно в столбик на ПК */
        gap: 25px !important;
    }
    
    .shop-category h3 {
        font-size: 2.2em !important; /* Увеличено с 1.6em - заголовок "Магазин" */
        text-align: left !important;
    }
    
    .currency-display {
        font-size: 1.8em !important; /* Увеличено с 1.6em */
    }
    
    .game-title {
        font-size: 4em !important; /* Принудительно большой заголовок на ПК */
    }
    
    .game-subtitle {
        font-size: 1.6em !important; /* Принудительно большой подзаголовок на ПК */
    }
    
    .score-display {
        font-size: 22px !important; /* Принудительно большой счет на ПК */
    }
    
    .main-btn {
        font-size: 1.4em !important; /* Принудительно большие кнопки на ПК */
        padding: 20px 40px !important;
        min-width: 250px !important;
    }
    
    /* Исправляем мелкие шрифты в магазине */
    .item-name {
        font-size: 1.2em !important; /* Было 0.85em - сильно увеличено */
    }
    
    .item-price {
        font-size: 1.1em !important; /* Было 0.85em - сильно увеличено */
    }
    
    .item-status {
        font-size: 1.0em !important; /* Было 0.75em - сильно увеличено */
    }
    
    /* Исправляем "Лучший результат" */
    .best-score-menu {
        font-size: 1.5em !important; /* Было 1.1em - увеличено */
    }
    
    /* Исправляем текст в туториале */
    .tip-text {
        font-size: 1.4em !important; /* Было 1.1em - увеличено */
    }
    
    .tutorial-step p {
        font-size: 1.4em !important; /* Было 1.1em - увеличено */
    }
    
    /* Исправляем настройки - заголовки и текст */
    .settings-content h2 {
        font-size: 2.5em !important; /* Заголовок "Настройки" */
    }
    
    .settings-section h3 {
        font-size: 1.8em !important; /* Было 1.4em - заголовки "Язык", "Звук" */
    }
    
    .volume-control label {
        font-size: 1.3em !important; /* Было 16px - "Громкость музыки", "Громкость звуков" */
    }
    
    .language-btn {
        font-size: 1.2em !important; /* Было 16px - кнопки языков */
    }
    
    #music-volume-value,
    #sound-volume-value {
        font-size: 1.2em !important; /* Было 16px - значения громкости */
    }
    
    /* Исправляем размеры всех модальных окон на ПК */
    .screen > div {
        max-width: 1000px !important; /* Было 800px - увеличено на 25% */
        padding: 80px !important; /* Было 60px - увеличено на 33% */
    }
    
    /* Специально для окна настроек */
    .settings-content {
        max-width: 850px !important; /* Было 650px - увеличено на 31% */
        padding: 60px !important; /* Было 40px - увеличено на 50% */
    }
    
    /* Заголовок "Магазин" в самом магазине */
    .shop-content h2 {
        font-size: 2.5em !important; /* Заголовок "Магазин" */
    }
    
    /* Заголовок "Как играть" */
    .tutorial-content h2 {
        font-size: 2.5em !important; /* Заголовок "Как играть" */
    }
    
    /* Заголовок "Игра окончена" */
    .game-over-content h2 {
        font-size: 2.5em !important; /* Заголовок "Игра окончена" */
    }
    
    /* Заголовок "Пауза" */
    .pause-content h2 {
        font-size: 2.5em !important; /* Заголовок "Пауза" */
    }
    
    /* Адаптивные размеры для текста звезд на ПК */
    .congrats-title {
        font-size: 24px !important;
    }
    
    .stars-count {
        font-size: 32px !important;
    }
    
    /* Центрирование текста туториала */
    .tutorial-tip {
        text-align: center !important;
        justify-content: center !important; /* Центрируем flex элементы */
    }
    
    .tip-text {
        text-align: center !important; /* Центрируем сам текст */
    }
    
    /* Увеличиваем изображения в магазине */
    .item-preview {
        width: 80px !important; /* Было 60px - увеличено на 33% */
        height: 80px !important; /* Было 60px - увеличено на 33% */
    }
    
    /* Прямоугольные превью для фонов */
    .item-preview.background-preview {
        border-radius: 10px !important; /* Прямоугольная рамка вместо круглой */
        width: 90px !important; /* Чуть шире для фонов */
        height: 60px !important; /* Прямоугольная форма */
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2em !important; /* Принудительно маленький размер для очень маленьких экранов */
    }
    
    .game-subtitle {
        font-size: 1em !important; /* Принудительно маленький размер для подзаголовка */
    }
    
    .score-display {
        font-size: 14px;
        gap: 10px;
    }
    
    .main-btn {
        padding: 10px 20px;
        font-size: 1em;
        min-width: 160px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .game-header {
        padding: 5px 15px;
    }
    
    .score-display {
        font-size: 14px;
    }
    
    .control-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .mobile-controls {
        height: 60px;
    }
    
    #game-canvas {
        height: calc(100vh - 100px);
    }
}

/* Prevent scrolling and zooming on game area only */
html {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Allow scrolling in modal content */
.screen > div {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Disable pull-to-refresh */
body {
    overscroll-behavior: none;
}

/* Hide scrollbars */
::-webkit-scrollbar {
    display: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* Settings Screen Styles */
.settings-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 40px; /* Было 30px - увеличено на 33% */
    max-width: 650px; /* Было 500px - увеличено на 30% */
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: contain; /* Prevent parent scrolling */
    touch-action: pan-y; /* Allow vertical scrolling on Android */
    scroll-behavior: smooth;
    box-shadow: 0 10px 30px var(--shadow);
}

.settings-sections {
    margin: 20px 0;
}

.settings-section {
    margin-bottom: 35px; /* Было 30px - увеличено */
    padding: 25px; /* Было 20px - увеличено на 25% */
    background: rgba(74, 144, 226, 0.1);
    border-radius: var(--border-radius);
    border: 2px solid rgba(74, 144, 226, 0.2);
}

.settings-section h3 {
    margin-bottom: 18px; /* Было 15px - увеличено */
    color: var(--primary-blue);
    font-size: 1.4em; /* Было 1.2em - увеличено на 17% */
    font-weight: bold;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.language-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-blue);
    background: white;
    color: var(--primary-blue);
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.language-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    transform: translateY(-2px);
}

.language-btn.active {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

/* Volume Controls */
.volume-control {
    margin-bottom: 20px;
}

.volume-control label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-dark);
    font-size: 16px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.volume-slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-blue);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #357ABD;
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-blue);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.volume-slider::-webkit-slider-track {
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--primary-blue) 0%, var(--primary-blue) var(--value, 70%), #ddd var(--value, 70%), #ddd 100%);
}

#music-volume-value,
#sound-volume-value {
    min-width: 45px;
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 16px;
}

/* Settings button style */
.main-btn.settings {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 2px solid #27ae60;
}

.main-btn.settings:hover {
    background: linear-gradient(135deg, #27ae60, #229954);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
}

/* Responsive adjustments for settings */
@media (max-width: 480px) {
    .settings-content {
        padding: 20px;
        width: 95%;
    }
    
    .language-selector {
        flex-direction: column;
    }
    
    .language-btn {
        width: 100%;
    }
    
    .slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #music-volume-value,
    #sound-volume-value {
        text-align: center;
    }
}