/* Добавляем пользовательский шрифт */
@font-face {
    font-family: 'Rubik Bubbles';
    src: url('../../../../fonts/RubikBubbles-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Базовые стили */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh; /* ← ДОБАВЛЕНО */
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Контейнеры панелей */
.game-wrapper {
    display: flex;
    width: 100%;
    margin: 10px auto;
    box-sizing: border-box;
    border: 5px solid;
    border-image: linear-gradient(to top, 
        #d52b1e 0%, #d52b1e 33%, 
        #0055b8 33%, #0055b8 66%, 
        white 66%, white 100%);
    border-image-slice: 1;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    background-color: #f0f8ff;
    min-height: calc(100vh - 20px); /* ← ДОБАВЛЕНО */
}

.left-panel {
    flex: 0 0 30%;
    background-color: #2c5e1a;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.right-panel {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #e6f7ff, #ffffff);
}

.pine-container {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: hidden;
}

.pine-bg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 85%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 85%, rgba(0,0,0,0) 100%);
}

.bear {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: auto;
    z-index: 10;
    transition: bottom 0.5s ease-in-out;
    filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.3));
}

/* Карточки - базовая сетка */
.cards-container {
    display: grid;
    gap: 15px;
    padding: 10px;
    margin: 10px 0;
    overflow-y: auto;
    flex: 1;
}

.animal-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    aspect-ratio: 1 / 1;
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
}

.animal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    border-color: #0055b8;
}

.animal-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sound-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#music-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

#volume-slider {
    width: 80px;
    cursor: pointer;
}

.score-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 20px;
    flex-shrink: 0;
}

.progress-bar {
    flex-grow: 1;
    height: 15px;
    background-color: #e0e0e0;
    border-radius: 7px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.5s ease;
}

.start-button {
    background: #2c5e1a;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 30px;
    font-size: 18px;
    cursor: pointer;
    margin: 15px auto;
    display: block;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
}

.start-button:hover {
    background: #3a7a24;
    transform: translateY(-3px);
}

.start-button.hidden {
    display: none;
}

.game-title {
    font-size: 36px;
    margin: 10px 0;
    text-align: center;
    font-family: 'Rubik Bubbles', cursive, sans-serif;
    color: #8B0000;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.result-bubble {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    z-index: 1000;
    pointer-events: none;
    animation: bubble-animation 1.5s forwards;
}

.result-bubble.yes {
    background: radial-gradient(circle, #4CAF50, #2E7D32);
}

.result-bubble.no {
    background: radial-gradient(circle, #F44336, #c62828);
}

@keyframes bubble-animation {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* ========== ДЕСКТОП ========== */
@media (min-width: 1024px) {
    .cards-container {
        grid-template-columns: repeat(4, minmax(140px, 170px));
        justify-content: center;
    }
    .bear {
        width: 180px;
    }
}

/* ========== ПЛАНШЕТЫ ========== */
@media (min-width: 768px) and (max-width: 1023px) {
    .cards-container {
        grid-template-columns: repeat(3, minmax(130px, 160px));
        justify-content: center;
    }
    .bear {
        width: 140px;
    }
    .game-title {
        font-size: 30px;
    }
}

/* ========== ФИКС ДЛЯ IPAD ========== */
@media (min-width: 768px) and (max-width: 1024px) {
    .cards-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }
    .animal-card {
        max-width: 160px !important;
        margin: 0 auto !important;
    }
}

/* ========== ТЕЛЕФОНЫ ========== */
@media (max-width: 767px) {
    .game-wrapper {
        flex-direction: column;
        margin: 5px;
    }
    .left-panel {
        flex: 0 0 auto;
        height: 160px;
        min-height: auto;
        order: 2;
    }
    .right-panel {
        order: 1;
        padding: 10px;
    }
    .cards-container {
        grid-template-columns: repeat(2, minmax(110px, 140px));
        justify-content: center;
        gap: 10px;
    }
    .bear {
        width: 80px;
        bottom: 10px;
    }
    .game-title {
        font-size: 24px;
    }
    .start-button {
        padding: 8px 20px;
        font-size: 16px;
    }
}

/* ========== АЛЬБОМНАЯ ОРИЕНТАЦИЯ ========== */
@media (max-width: 767px) and (orientation: landscape) {
    .game-wrapper {
        flex-direction: row;
    }
    .left-panel {
        flex: 0 0 35%;
        height: auto;
        order: 1;
    }
    .right-panel {
        order: 2;
        height: 90vh;
    }
    .cards-container {
        grid-template-columns: repeat(3, minmax(90px, 110px));
    }
    .bear {
        width: 70px;
    }
}

/* ========== СПЕЦИАЛЬНЫЙ ФИКС ДЛЯ IPHONE (ТОЛЬКО CSS) ========== */
@supports (-webkit-touch-callout: none) {
    html, body {
        height: auto !important;
        min-height: -webkit-fill-available !important;
        overflow-y: auto !important;
    }
    
    .game-wrapper {
        display: block !important;
        height: auto !important;
        min-height: 100vh !important;
        margin: 5px !important;
    }
    
    .cards-container {
        display: grid !important;
        grid-template-columns: repeat(2, calc(50% - 10px)) !important;
        gap: 12px !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 80px !important;
    }
    
    .animal-card {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
    }
    
    .left-panel {
        height: 140px !important;
        min-height: auto !important;
    }
    
    .bear {
        width: 70px !important;
    }
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #fff9e6, #ffefd5);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    border: 5px solid #ffd700;
}

.modal-content h2 {
    font-family: 'Rubik Bubbles', cursive;
    color: #d52b1e;
    font-size: 2rem;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 1.2rem;
    color: #5a3921;
    margin-bottom: 20px;
}

.trophy {
    font-size: 4rem;
    color: #ffd700;
    margin: 15px 0;
}

.modal-button {
    background: #2c5e1a;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 10px 25px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
}