/* ===================================
   GAME SCENE
   Стили игровой области (питомец, фон, земля, статистика)
   =================================== */

/* ===================================
   GAME AREA & SCENE
   =================================== */

.game-area {
    flex: 1;
    position: relative;
    margin: 0;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
}

.game-scene {
    position: relative;
    flex: 1;
    overflow: hidden;
}

/* ===================================
   STARRY SKY BACKGROUND
   =================================== */

.starry-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===================================
   PET BACKGROUND LAYER
   =================================== */

.pet-background {
    position: absolute;
    /* РАСШИРЕНО: Фон теперь выходит за границы game-scene сверху (было top: 0) */
    top: -30px;
    left: 0;
    width: 100%;
    /* РАСШИРЕНО: Компенсируем увеличение вверх (было height: 100%) */
    height: calc(100% + 30px);
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    border-radius: 20px;
    z-index: 1;
    opacity: 0.8;
}

/* ===================================
   GROUND LAYER
   =================================== */

.ground {
    position: absolute;
    /* РАСШИРЕНО: Земля теперь выходит за границы game-scene снизу (было bottom: 0) */
    bottom: -30px;
    left: 0;
    width: 100%;
    /* РАСШИРЕНО: Увеличена высота + компенсация расширения вниз (было 40%) */
    height: calc(40% + 30px);
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.8) 0%, rgba(46, 125, 50, 0.9) 100%);
    border-radius: 20px 20px 0 0;
    z-index: 2;
}

/* ===================================
   PET CHARACTER
   =================================== */

.pet-character {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 80px;
    z-index: 3;
    cursor: pointer;
    transition: transform 0.3s ease;
    user-select: none;
    animation: float 3s ease-in-out infinite;
}

.pet-character:hover {
    transform: translateX(-50%) scale(1.1);
}

.pet-character:active {
    transform: translateX(-50%) scale(0.95);
}

@keyframes float {
    0%, 100% {
        transform: translateX(-50%) translateY(0px);
    }
    50% {
        transform: translateX(-50%) translateY(-10px);
    }
}

/* ===================================
   PET STATS - COMPACT DISPLAY
   =================================== */

.pet-stats {
    margin: 12px 12px 4px;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100003;
    position: relative;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 18px;
    margin-bottom: 4px;
}

.stat-numbers {
    font-size: 12px;
    font-weight: bold;
    color: white;
    line-height: 1.2;
}

.stat-current {
    font-size: 14px;
    color: #4a9eff;
}

.stat-max {
    color: #b0b0b0;
}

.stat-mini-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.stat-mini-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.stat-mini-fill.mood {
    background: linear-gradient(90deg, #ff6b9d, #c44569);
}

.stat-mini-fill.food {
    background: linear-gradient(90deg, #4caf50, #388e3c);
}

.stat-mini-fill.sleep {
    background: linear-gradient(90deg, #2196f3, #1976d2);
}

/* ===================================
   PET INFO PANEL
   =================================== */

.pet-info-panel {
    margin: 10px 12px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 100002;
}

.pet-info-panel:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.pet-info-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Верхняя строка: уровень слева, имя по центру, следующий уровень справа */
.pet-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.level-current {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.15);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.level-next {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

#petName {
    flex: 1;
    text-align: center;
    color: white;
    font-size: 15px;
}

/* Полоска опыта */
.pet-exp-container {
    width: 100%;
}

.pet-exp-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #81C784);
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* Нижняя строка: Порода слева, Опыт по центру, Тип справа */
.pet-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

#petBreed, #petType {
    font-size: 10px;
}

#expText {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
}

/* ===================================
   PET ACTION BUTTONS
   =================================== */

.pet-action-buttons {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 4;
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
    transform: scale(0.95);
}

.sleep-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.play-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.feed-btn {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

/* ===================================
   FOOD SELECTOR
   =================================== */

.food-selector {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 5;
    min-width: 280px;
    max-width: 90%;
}

.food-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: #333;
    font-weight: 600;
}

.close-food-selector {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-food-selector:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.food-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.food-option-btn {
    padding: 12px;
    background: rgba(76, 175, 255, 0.1);
    border: 1px solid rgba(76, 175, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
    font-weight: 500;
}

.food-option-btn:hover {
    background: rgba(76, 175, 255, 0.2);
    border-color: rgba(76, 175, 255, 0.5);
    transform: translateX(4px);
}

.food-option-btn:active {
    transform: scale(0.98);
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 480px) {
    .pet-character {
        font-size: 60px;
        bottom: 22%;
    }

    .pet-stats {
        gap: 6px;
        margin: 10px 8px 4px;
        padding: 6px;
    }

    .stat-item {
        padding: 6px;
    }

    .stat-icon {
        font-size: 16px;
    }

    .stat-numbers {
        font-size: 11px;
    }

    .stat-current {
        font-size: 12px;
    }

    .action-btn {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .pet-action-buttons {
        gap: 12px;
    }
}

@media (max-width: 400px) {
    .pet-character {
        font-size: 50px;
    }

    .pet-info-panel {
        margin: 8px 10px 0;
        padding: 8px;
    }

    .pet-top-row {
        font-size: 13px;
    }

    #petName {
        font-size: 14px;
    }

    .action-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}
