* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.game-container {
    position: absolute;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

.header {
    flex-shrink: 0;
    width: fit-content;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(224, 234, 252, 0.9);  /* Светлый полупрозрачный фон */
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);  /* Эффект матового стекла */
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px; /* Добавляем отступ снизу */
}

#gameCanvas {
    flex-grow: 1;
    max-height: calc(100vh - 150px);
    margin: auto;
    width: fit-content;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.score-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 1.2em;
    padding: 10px 0;
    margin-bottom: 5px;
    gap: 10px;
}

.score, .best-score {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-weight: 600;
    color: #2c3e50;
    min-width: 140px;
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.score:hover, .best-score:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.score span, .best-score span {
    color: #e74c3c;
    margin-left: 5px;
    font-weight: 700;
}


.controls-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.controls-row button {
    flex: 1;
    padding: 10px;
    font-size: 1.2em;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.controls-row button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.controls-row button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#gameCanvas {
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.bomb-control {
    position: static;
    transform: none;
    display: flex;
    gap: 15px;
}

#bombButton {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px;
    font-size: 2em;
    background: transparent;
    border: none;
    cursor: grab;
    transition: transform 0.2s ease;
    user-select: none;
}

/* Отключаем стандартное поведение перетаскивания для всех элементов внутри кнопки */
#bombButton * {
    pointer-events: none;
}

#bombButton:hover {
    transform: scale(1.1);
}

#bombButton span {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#bombCount {
    font-size: 0.8em;
    color: #666;
}

#themeToggle::after {
    display: none;
}

/* Стиль для невидимого перетаскивания */
[draggable="true"] {
    cursor: grab;
}

#jokerButton {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px;
    font-size: 2em;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

#jokerButton:focus {
    outline: none;
}

#jokerButton:active {
    background: transparent;
}

#jokerButton:hover {
    transform: scale(1.1);
}

#jokerCount {
    font-size: 0.8em;
    color: #666;
}

.joker-bounce {
    animation: bounce 0.5s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #e0eafc, #cfdef3);
    color: #2c3e50;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 80%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.modal h2 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 24px;
}

.modal p {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 18px;
}

.modal button {
    margin-top: 15px;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    background-color: #4a90e2;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
}

.modal button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background-color: #357abd;
}

#finalScore {
    color: #e74c3c;
    font-weight: bold;
    font-size: 24px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#cancelRestartButton {
    background-color: #e74c3c;
}

#cancelRestartButton:hover {
    background-color: #c0392b;
}

.modal-buttons button {
    flex: 1;
    max-width: 200px;
}

.rules-content {
    text-align: left;
    margin: 20px 0;
    line-height: 1.5;
    overflow-y: auto;
    max-height: 60vh;
    padding-right: 10px;
}

/* Стилизация полосы прокрутки */
.rules-content::-webkit-scrollbar {
    width: 8px;
}

.rules-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.rules-content::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.5);
    border-radius: 4px;
}

.rules-content::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.7);
}

.rules-content p {
    margin: 15px 0;
    padding-left: 20px;
    position: relative;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
}

.rules-content p:before {
    content: '•';
    position: absolute;
    left: 0;
}

/* Добавляем медиа-запрос для мобильных устройств */
@media (max-width: 600px) {
    .game-container {
        padding: 20px;
    }

    .header {
        width: 100%;
        border-radius: 0;
        padding: 10px;
        margin: 0;
        margin-bottom: 10px;
        box-sizing: border-box;     
    }

    .modal-content {
        margin: 10px;
        padding: 20px;
        max-width: 95%;
    }

    .modal button {
        margin-top: 20px;
        position: sticky;
        bottom: 0;
        width: 100%;
        background-color: #4a90e2;
    }
}

/* Добавляем дополнительные стили для очень маленьких экранов */
@media (max-width: 400px) {
    .score, .best-score {
        padding: 6px 10px;
        min-width: 80px;
        font-size: 0.8em;
    }

    .controls-row {
        flex-wrap: wrap;
        gap: 5px;
    }

    .controls-row button {
        flex: 0 1 calc(33.33% - 5px);
        padding: 8px;
        font-size: 1em;
    }

    /* Добавляем стили для бомбы и джокера */
    #bombButton, #jokerButton {
        font-size: 1.5em;
        padding: 5px;
    }

    #bombCount, #jokerCount {
        font-size: 0.7em;
    }
}

@media (max-width: 310px) {
    .score, .best-score {
        padding: 6px 10px;
        min-width: 80px;
        font-size: 0.5em;
    }

       
    .score-row {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
       
    }
}
/* Обновляем стили для мобильных устройств */
@media (max-width: 600px) {
    
}