/* style.css */
/* !!! ИЗМЕНЕНИЕ: Подключаем новый мультяшный шрифт с Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');

:root {
    --primary-bg: #87CEEB;
    --secondary-bg: #f0f8ff; /* Алисово-синий */
    --button-bg: #FFD700; /* Золотой */
    --button-hover-bg: #FFA500; /* Оранжевый */
    --text-color: #333;
    --card-bg: #4682B4; /* Стальной синий */
    --card-front-bg: #FFFACD; /* Лимонный шифон */
    --hint-bg: #FF69B4; /* Розовый для подсказки */

    /* !!! ИЗМЕНЕНИЕ: Новые цвета для дизайна */
    --gradient-top: #2E8B57; /* Морской зеленый */
    --gradient-bottom: #006400; /* Темно-зеленый */
    --top-bar-bg: #191970; /* Полуночный синий */
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000; /* Фоновый цвет на случай, если картинка не загрузится */
    /* !!! ИЗМЕНЕНИЕ: Применяем новый шрифт ко всей игре */
    font-family: 'Fredoka One', cursive;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    /* !!! ИЗМЕНЕНИЕ: Устанавливаем фоновое изображение для всей страницы */
    background-image: url('bg.png');
    background-size: cover; /* Масштабирует изображение, чтобы оно полностью покрывало фон */
    background-position: center; /* Центрирует изображение */
    background-repeat: no-repeat; /* Запрещает повторение изображения */

    /* !!! ИЗМЕНЕНИЕ: Запрещаем выделение, лупу и меню при удержании */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE10+/Edge */
    user-select: none;         /* Standard */
    -webkit-touch-callout: none; /* iOS Safari */
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px; /* Максимальная ширина для десктопа */
    max-height: 900px; /* Максимальная высота */
    /* !!! ИЗМЕНЕНИЕ: Устанавливаем фоновое изображение для контейнера */
    background-image: url('bg_container.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.screen.active {
    display: flex;
}

#start-screen {
    text-align: center;
}

#game-title {
    /* !!! ИЗМЕНЕНИЕ: Уменьшили шрифт, так как название теперь длинное */
    font-size: 2.5rem;
    line-height: 1.2;
    padding: 0 10px;
    color: white;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

.button {
    /* !!! ИЗМЕНЕНИЕ: Увеличиваем шрифт и немного меняем стиль */
    padding: 1.2rem 2.5rem;
    font-size: 1.8rem;
    border: 3px solid #333;
    border-radius: 15px;
    background-color: var(--button-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0.5rem;
    box-shadow: 0 6px 0 #9c8400; /* Создаем эффект 3D-кнопки */
    text-transform: uppercase; /* Все буквы заглавные */
}

.button:hover {
    background-color: var(--button-hover-bg);
    transform: translateY(2px);
    box-shadow: 0 4px 0 #9c8400;
}

.button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #9c8400;
}

#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center; /* Центрируем контент по вертикали */
    /* !!! ИЗМЕНЕНИЕ: Увеличиваем высоту панели */
    padding: 1.5rem 1rem;
    /* !!! ИЗМЕНЕНИЕ: Заменяем цвет на градиент */
    background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
    /* !!! ИЗМЕНЕНИЕ: Увеличиваем шрифт и добавляем тень */
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: white;
    box-sizing: border-box;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); /* Тень для глубины */
}

/* Стили для кнопки подсказки */
#hint-container {
    position: absolute;
    top: 5rem; /* Сразу под top-bar */
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 4;
}

#hint-button {
    background-color: var(--hint-bg);
    box-shadow: 0 6px 0 #c71585; /* Темно-розовый */
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    font-size: 1.5rem;
}

#hint-button:hover {
    background-color: #FF1493;
    box-shadow: 0 4px 0 #c71585;
}

#hint-counter-box {
    background: white;
    color: #333;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    font-weight: bold;
    border: 2px solid #333;
}


#game-board {
    display: grid;
    gap: 1.2vmin; /* Немного увеличим зазор */
    /* !!! ИЗМЕНЕНИЕ: Увеличиваем отступ сверху, чтобы поле не залезало под панель */
    margin-top: 10rem; /* Увеличили, чтобы влезла кнопка подсказки */
    width: 95%;
    max-width: 450px;
}

.card {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    visibility: hidden;
    transition: visibility 0s 0.5s, transform 0.5s;
    transform: scale(0);
}


.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card-back {
    background-color: var(--card-bg);
    background-image: url('card-back.png');
    background-size: cover;
    background-position: center;
    border: 3px solid #f0f8ff; /* Добавим рамку рубашке */
}

.card-front {
    background-color: var(--card-front-bg);
    transform: rotateY(180deg);
    background-size: 100% 1000%;
    border: 3px solid #4682B4; /* И рамку для лицевой стороны */
}

.popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.popup.active {
    display: flex;
}

.popup-content {
    background: var(--secondary-bg);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    color: var(--text-color);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: popup-appear 0.3s ease-out;
    border: 5px solid var(--button-bg); /* Рамка в стиле кнопок */
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

/* !!! ИЗМЕНЕНИЕ: Увеличим шрифт в окнах победы/проигрыша */
.popup-content h2 {
    font-size: 2.5rem;
    margin-top: 0;
}

.popup-content p {
    font-size: 1.5rem;
}


#add-moves-button, #buy-hint-button {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* !!! ИЗМЕНЕНИЕ: Сильно увеличиваем иконку видео, чтобы было понятно, что это реклама */
.video-icon {
    width: 4rem; 
    height: 4rem;
    margin-left: 0.8rem;
    background-color: #008000; /* Green */
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg>') no-repeat center;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg>') no-repeat center;
}

/* Стили для лидерборда */
#leaderboard-container {
    margin: 1rem 0;
    width: 100%;
    min-height: 100px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 0.5rem;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.2rem;
}

#leaderboard-table th, #leaderboard-table td {
    padding: 5px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

#leaderboard-table td:last-child {
    text-align: right;
    font-weight: bold;
}

.leaderboard-current-player {
    background-color: rgba(255, 215, 0, 0.4); /* Подсветка игрока */
    font-weight: bold;
}
