@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka', 'Arial', sans-serif;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 9/16;
    background: url('assets/фон.png') center/cover no-repeat;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* Название */
.game-title {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 65%;
    z-index: 5;
    animation: bounce 2s ease-in-out infinite;
}

.game-title img {
    width: 100%;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

/* Панель счёта и таймера */
.game-header {
    position: absolute;
    top: 32%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 8%;
    z-index: 5;
}

.score-panel, .timer-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.score-panel {
    color: #FF6B6B;
}

.timer-panel {
    color: #4A90E2;
}

.panel-label {
    font-size: 16px;
    font-weight: 700;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-value {
    font-size: 26px;
    font-weight: 700;
}

/* Кнопки управления СЛЕВА (пауза и перезапуск) */
.game-controls-left {
    position: absolute;
    top: 5%;
    left: 5%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.game-controls-left.hidden {
    display: none;
}

/* Кнопки управления СПРАВА (звуки) */
.game-controls-right {
    position: absolute;
    top: 5%;
    right: 5%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.control-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #4A90E2;
    border: none;
    width: 45px;
    height: 45px;
    font-size: 22px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5px;
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.muted {
    background: rgba(255, 107, 107, 0.95);
    color: white;
}

/* Игровое поле */
.holes-grid {
    position: absolute;
    top: 43%;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3%;
    aspect-ratio: 1;
}

.hole {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: transform 0.1s;
}

.hole:active {
    transform: scale(0.95);
}

.hole-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.hole.active .hole-img {
    animation: pop-up 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-up {
    0% {
        transform: scale(0.5) translateY(30px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Оверлеи */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(12px);
}

.overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.screen-content {
    text-align: center;
    color: white;
    padding: 50px 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 30px;
    max-width: 85%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    position: relative;
    backdrop-filter: blur(8px);
}

.screen-content h1 {
    font-size: 52px;
    margin-bottom: 15px;
    text-shadow: 4px 4px 12px rgba(0,0,0,0.9);
    font-weight: 700;
    color: #FFD700;
    line-height: 1.1;
}

.screen-content p {
    font-size: 20px;
    margin-bottom: 35px;
    opacity: 0.95;
    font-weight: 600;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

.btn-play {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 26px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    transition: all 0.2s;
    margin: 15px 0;
    font-family: 'Fredoka', sans-serif;
    text-transform: none;
}

.btn-play:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.7);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #4A90E2, #5AB9EA);
    color: white;
    border: none;
    padding: 16px 50px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5);
    transition: all 0.2s;
    margin: 10px 0;
    font-family: 'Fredoka', sans-serif;
}

.btn-secondary:hover {
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.best-score {
    margin-top: 30px;
    font-size: 22px;
    opacity: 0.95;
    font-weight: 700;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

#best-score {
    font-weight: 700;
    color: #FFD700;
    font-size: 32px;
}

/* Экран результатов */
.final-score {
    margin: 40px 0;
}

.score-big {
    font-size: 90px;
    font-weight: 700;
    color: #FF6B6B;
    text-shadow: 5px 5px 15px rgba(0,0,0,0.9);
    line-height: 1;
}

.score-label {
    font-size: 24px;
    margin-top: 12px;
    opacity: 0.95;
    font-weight: 600;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

.stats {
    margin: 35px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 25px;
    font-size: 19px;
    font-weight: 700;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.1);
}

.stat-item span:first-child {
    opacity: 0.95;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.stat-item span:last-child {
    font-weight: 700;
    color: #FFD700;
    font-size: 26px;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

/* Адаптация */
@media (max-width: 400px) {
    .game-title {
        width: 75%;
    }
    
    .score-panel, .timer-panel {
        font-size: 14px;
        padding: 10px 18px;
    }
    
    .panel-label {
        font-size: 13px;
    }
    
    .panel-value {
        font-size: 22px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .control-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .screen-content h1 {
        font-size: 42px;
    }
    
    .score-big {
        font-size: 70px;
    }
    
    .btn-play {
        font-size: 22px;
        padding: 16px 50px;
    }
}