body {
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    /* Запрещает выделение текста и элементов интерфейса при зажатии */
    user-select: none;
    -webkit-user-select: none;
}

.hidden {
    display: none !important;
}

/* Экран выбора уровней */
#levelSelectScreen {
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#levelSelectScreen h1 {
    margin: 0;
    color: #2ed573;
    font-size: 26px;
}

#levelsGrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

/* Мобильная адаптация для маленьких экранов */
@media (max-width: 480px) {
    #levelsGrid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.level-card {
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 10px;
    padding: 10px 2px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.level-card:hover {
    background: #3a3a3a;
    border-color: #2ed573;
}

.level-card .stars {
    font-size: 10px;
    color: #ffd32a;
    min-height: 12px;
}

#clearProgressBtn {
    background: #333;
    color: #ff4757;
    border: 1px solid #ff4757;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    align-self: center;
}

/* Игровая панель управления */
#ui {
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 10px;
    width: 90%;
    max-width: 960px;
    justify-content: space-between;
}

#resetBtn, #backToMenuBtn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

#backToMenuBtn { background: #1e3c72; }

canvas {
    background: linear-gradient(#1e3c72, #2a5298);
    border: 2px solid #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    /* Критично для мобильных: предотвращает скролл страницы при перетаскивании по canvas */
    touch-action: none;
    max-width: 95vw;
    max-height: 70vh;
    width: auto;
    height: auto;
}
