/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    color: #4a90e2;
    font-size: 2.5rem;
    font-weight: bold;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    font-weight: normal;
}

.user-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.coins, .level {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.time {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: bold;
    transition: all 0.5s ease;
}

/* 宠物容器 */
.pet-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 30px;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* 宠物状态栏 */
.pet-status {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-label {
    min-width: 50px;
    font-weight: bold;
    color: #555;
}

.progress-container {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar.health {
    background: linear-gradient(90deg, #ff6b6b, #ee5a52);
}

.progress-bar.hunger {
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
}

.progress-bar.mood {
    background: linear-gradient(90deg, #feca57, #ff9ff3);
}

.progress-bar.clean {
    background: linear-gradient(90deg, #74b9ff, #0984e3);
}

.status-value {
    min-width: 50px;
    text-align: right;
    font-weight: bold;
    color: #666;
}

/* 宠物显示区域 */
.pet-display {
    text-align: center;
    position: relative;
}

#pet-animation-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

#pet-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    animation: petIdle 3s ease-in-out infinite;
    cursor: pointer;
}

#pet-image:hover {
    transform: scale(1.05);
}

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

/* 宠物进化阶段样式 */
.pet-juvenile #pet-image {
    animation: juvenileIdle 3s ease-in-out infinite;
    filter: hue-rotate(0deg);
}

.pet-growth #pet-image {
    animation: growthIdle 3s ease-in-out infinite;
    filter: hue-rotate(30deg);
}

.pet-mature #pet-image {
    animation: matureIdle 4s ease-in-out infinite;
    filter: hue-rotate(60deg);
}

.pet-legendary #pet-image {
    animation: legendaryIdle 5s ease-in-out infinite;
    filter: hue-rotate(90deg) drop-shadow(0 0 10px gold);
}

/* 宠物情绪样式 */
.emotion-indicator {
    position: absolute;
    top: -20px;
    right: -10px;
    font-size: 24px;
    z-index: 10;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.7));
}

.bounce {
    animation: bounce 2s ease-in-out infinite;
}

.shake {
    animation: shake 0.5s ease-in-out infinite;
}

.breathe {
    animation: breathe 3s ease-in-out infinite;
}

.drowsy {
    animation: drowsy 4s ease-in-out infinite;
}

.sad {
    animation: sad 3s ease-in-out infinite;
}

.weak {
    animation: weak 2s ease-in-out infinite;
}

/* 情绪动画 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes drowsy {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes sad {
    0%, 100% { transform: translateY(0) scale(0.95); }
    50% { transform: translateY(5px) scale(0.9); }
}

@keyframes weak {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 1; }
    50% { transform: translateY(3px) rotate(2deg); opacity: 0.8; }
}

/* 宠物进化阶段动画 */
@keyframes juvenileIdle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes growthIdle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-1deg); }
    75% { transform: translateY(-3px) rotate(1deg); }
}

@keyframes matureIdle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

@keyframes legendaryIdle {
    0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); }
    25% { transform: translateY(-5px) scale(1.03); filter: brightness(1.1); }
    50% { transform: translateY(-10px) scale(1.05); filter: brightness(1.2); }
    75% { transform: translateY(-5px) scale(1.03); filter: brightness(1.1); }
}

#pet-emotion {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.pet-name-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#pet-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a90e2;
}

.small-btn {
    background: #74b9ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.small-btn:hover {
    background: #0984e3;
    transform: scale(1.1);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: bold;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn i {
    font-size: 1.2rem;
}

/* 游戏区域 */
.game-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    color: #4a90e2;
    font-size: 2rem;
    margin-bottom: 10px;
}

.section-header p {
    color: #666;
    font-size: 1.1rem;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.tab-btn {
    background: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.tab-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #d0d0d0;
}

.tab-content {
    display: none;
    margin-top: 20px;
}

.tab-content.active {
    display: block;
}

/* 商店物品 */
.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.shop-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.shop-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.item-image {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 5px;
}

.item-effect {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.item-price {
    color: #ffd700;
    font-weight: bold;
}

.buy-btn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    background: linear-gradient(45deg, #00a085, #008f7a);
    transform: scale(1.05);
}

.buy-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 小游戏 */
.minigames {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.minigame-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.minigame-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.minigame-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.minigame-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.minigame-info p {
    opacity: 0.9;
    margin-bottom: 20px;
}

.play-game-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    border-radius: 25px;
    padding: 12px 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.play-game-btn:hover {
    background: white;
    color: #667eea;
}

/* 成就系统 */
.achievement-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.achievement[data-achieved="true"] {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
}

.achievement[data-achieved="false"] {
    opacity: 0.6;
}

.achievement-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: #ddd;
    color: #999;
}

.achievement-icon.achieved {
    background: #fff;
    color: #ffd700;
}

.achievement-info h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.achievement-info p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.game-modal-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    background: transparent;
    border: none;
    padding: 0;
    line-height: 1;
    font-weight: bold;
}

.close-modal:hover {
    color: #333;
}

#modal-title, #game-modal-title {
    color: #4a90e2;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* 游戏容器 */
#game-container {
    min-height: 300px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .pet-container {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .shop-items {
        grid-template-columns: 1fr;
    }
    
    .minigames {
        grid-template-columns: 1fr;
    }
    
    .achievement-list {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .user-info {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    #pet-image {
        width: 150px;
        height: 150px;
    }
    
    .action-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .shop-item {
        flex-direction: column;
        text-align: center;
    }
    
    .item-image {
        margin-bottom: 10px;
    }
}