/* Новые стили для игры с свайпом уровней */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Экраны */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.screen.active {
    display: flex;
    opacity: 1;
    flex-direction: column;
}

.screen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 140px; /* Увеличен нижний отступ для GUI */
    overflow-y: auto;
}

.screen-title {
    font-size: 32px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 30px;
    text-align: center;
}

/* HUD - остаётся как есть */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    z-index: 1000;
}

#coins-display, #hints-display {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 25px;
    padding: 5px 15px;
    gap: 8px;
}

#coins-display.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

#coins-display.clickable:hover {
    transform: scale(1.05);
}

.coin-icon, .hint-icon {
    width: 30px;
    height: 30px;
}

#coins-amount, #hints-amount {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.plus-btn {
    width: 25px;
    height: 25px;
    cursor: pointer;
}

#settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

#settings-btn:hover {
    transform: rotate(45deg);
}

#settings-btn img {
    width: 40px;
    height: 40px;
}

/* Экраны */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 120px;
    overflow: hidden;
}

.screen-title {
    color: white;
    font-size: 32px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    margin-bottom: 30px;
}

/* ============= НОВЫЙ ДИЗАЙН ГЛАВНОГО ЭКРАНА ============= */

/* Контейнер для свайпа */
.levels-swiper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 400px;
    margin-bottom: 20px;
}

/* Карусель уровней */
.levels-carousel {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
    position: relative;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Карточка уровня */
.level-card {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.level-card-inner {
    width: 100%;
    max-width: 450px;
    height: 350px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    position: relative;
    transition: transform 0.3s;
}

.level-card-inner:hover {
    transform: scale(1.02);
}

.level-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Оверлей с информацией */
.level-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.level-card-title {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.level-card-progress {
    color: #fbbf24;
    font-size: 16px;
    font-weight: 600;
}

/* Кнопки свайпа */
.swipe-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.swipe-btn img {
    width: 24px;
    height: 24px;
}

.swipe-left {
    left: 10px;
}

.swipe-left img {
    transform: rotate(180deg);
}

.swipe-right {
    right: 10px;
}

.swipe-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Индикаторы уровней (точки) */
.level-indicators {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.level-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
    cursor: pointer;
}

.level-indicator.active {
    background: white;
    width: 30px;
    border-radius: 6px;
}

/* Информация о текущем уровне */
.level-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    margin-bottom: 20px;
}

.level-name {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.level-stats {
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* Кнопка Играть */
.btn-play {
    position: relative;
    display: block;
    margin: 20px auto 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s;
}

.btn-play:hover {
    transform: scale(1.05);
}

.btn-play img {
    width: 250px;
    height: auto;
}

.btn-play span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
}

/* ============= НОВЫЙ ИГРОВОЙ ЭКРАН ============= */

#game-canvas-wrapper {
    width: 100%;
    height: calc(100% - 120px);
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Новая панель предметов */
#items-panel-new {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 10px;
    z-index: 100;
}

.items-scroll {
    width: 100%;
    height: 100%;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px;
    -webkit-overflow-scrolling: touch;
}

.items-scroll::-webkit-scrollbar {
    height: 6px;
}

.items-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.items-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Тип предмета */
.item-type {
    flex: 0 0 90px;
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.item-type:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.6);
}

.item-type img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Счётчик предметов */
.item-counter {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

/* Галочка на найденном типе */
.item-checkmark {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #10b981;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
}

.item-type.completed .item-checkmark {
    display: flex;
}

.item-type.completed {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
}

/* Кнопка подсказки в игре */
.game-hint-btn {
    position: absolute;
    bottom: 140px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101;
    transition: transform 0.2s;
}

.game-hint-btn:hover {
    transform: scale(1.1);
}

.game-hint-btn .btn-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.game-hint-btn .btn-icon {
    width: 35px;
    height: 35px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
}

.game-hint-btn span {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Кнопка выхода */
.game-exit-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 101;
    transition: all 0.2s;
}

.game-exit-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.game-exit-btn img {
    width: 30px;
    height: 30px;
}

/* GUI Navigation - остаётся без изменений */
.gui-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px;
}

.gui-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: transform 0.2s;
}

.gui-btn:hover {
    transform: scale(1.05);
}

.gui-btn .btn-bg {
    width: 70px;
    height: 70px;
}

.gui-btn .btn-icon {
    position: absolute;
    top: 15px;
    width: 40px;
    height: 40px;
}

.gui-btn .btn-label {
    color: white;
    font-size: 14px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.gui-btn .badge {
    position: absolute;
    top: 5px;
    right: 10px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Попапы */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup.hidden {
    display: none;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.popup-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    z-index: 1;
}

.popup-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.popup-close:hover {
    transform: rotate(90deg);
}

.popup-close img {
    width: 100%;
    height: 100%;
}

/* Экран загрузки */
#loading-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    color: white;
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    color: white;
    font-size: 18px;
}
