/* 电子鸡游戏样式 */
.tamagotchi-container {
    background-color: #2a2a2a;
    padding: 20px;
    width: 500px;
    margin: -30px auto; /* 从-10px改为-30px，向上移动20px */
    display: flex;
    flex-direction: column;
    gap: 15px; /* 减小间距 */
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 4px #8a2be2, 0 0 10px rgba(138, 43, 226, 0.5), 0 0 20px rgba(138, 43, 226, 0.3);
    position: relative; /* 添加相对定位 */
    left: 50%; /* 水平居中 */
    transform: translateX(-50%); /* 水平居中偏移修正 */
}

.pet-status {
    display: flex;
    flex-direction: column;
    gap: 6px; /* 减小状态栏之间的间距 */
    padding: 10px; /* 减小内边距 */
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px; /* 减小间距 */
}

.status-bar span {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px; /* 减小字体大小 */
    color: #fff;
    width: 70px; /* 减小宽度 */
}

.progress-bar {
    flex: 1;
    height: 12px; /* 减小高度 */
    background-color: #222;
    border: 2px solid #444;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 50%,
        transparent 100%
    );
    background-size: 10px 100%;
    pointer-events: none;
}

.progress-fill {
    height: 100%;
    width: 80%;
    transition: width 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #55ff55;
    box-shadow: 0 0 8px rgba(85, 255, 85, 0.7);
}

.coin-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px; /* 减小上边距 */
    padding: 4px 8px; /* 减小内边距 */
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #ffd700;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

.coin-display {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px; /* 减小字体大小 */
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

.level-separator {
    margin: 0 8px;
    color: #ffffff;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px; /* 减小字体大小 */
}

.level-display {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px; /* 减小字体大小 */
    color: #55ffff;
    text-shadow: 0 0 5px rgba(85, 255, 255, 0.7);
}

.pet-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px; /* 减小间距 */
    padding: 15px; /* 修复内边距中的空格错误 */
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    position: relative;
}

.pet-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(138, 43, 226, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(138, 43, 226, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.pet-animation {
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 10px; /* 减小底部间距 */
}

.pet-animation img {
    max-width: none; /* 移除最大宽度限制 */
    max-height: none; /* 移除最大高度限制 */
    filter: drop-shadow(0 0 5px rgba(138, 43, 226, 0.5));
    transition: all 0.3s ease;
    width: 540px; /* 将宽度从160px增加到200px */
    height: auto; /* 保持宽高比 */
    image-rendering: pixelated; /* 保持像素风格清晰 */
    image-rendering: crisp-edges;
    z-index: 1;
    position: relative;
    top: 20px; /* 向上移动宠物图片 */
}

.pet-message {
    padding: 4px;
    background-color: #222;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    width: 100%;
    text-align: center;
    min-height: 2%;
    font-size: 10px; /* 减小字体大小 */
    line-height: 1.4;
    z-index: 2;
}

.pet-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 改为3列布局 */
    gap: 10px; /* 减小间距 */
}

.action-btn {
    min-width: 70px; /* 减小最小宽度 */
    height: 32px; /* 减小高度 */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 6px 12px; /* 减小内边距 */
    background: #8a2be2;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 9px; /* 减小字体大小 */
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
}

.action-btn:hover {
    background-color: #9a3bf2;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.7);
    transform: translateY(-2px);
}

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

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.reset-btn {
    position: relative;
    width: 80px;
    text-align: center;
    min-width: 80px;
    height: 28px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 8px 10px;
    background: #ff5555;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #ff5555;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 10px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
}

.reset-btn:hover {
    background-color: #ff7777;
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.7);
    transform: translateY(-2px);
}

.reset-btn:active {
    transform: translateY(1px);
}

/* 修改back-btn的样式，使其不再是absolute定位 */
.back-btn {
    position: relative;
    width: 80px;
    text-align: center;
    min-width: 80px;
    height: 28px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 8px 10px;
    background: #8a2be2;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 10px;
    font-family: 'Press Start 2P', cursive;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .button-container {
        flex-direction: row;
        justify-content: center;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .tamagotchi-container {
        width: 90%;
        max-width: 500px;
        padding: 15px;
    }
    
    .pet-animation {
        width: 200px;
        height: 200px;
    }
    
    .pet-actions {
        grid-template-columns: repeat(2, 1fr); /* 移动端改为2列 */
    }
    
    .back-btn {
        position: static;
        margin: 20px auto;
        width: 150px;
    }
}

/* 状态指示器 */
.status-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(138, 43, 226, 0.7);
}

.status-indicator.healthy {
    background-color: #55ff55;
}

.status-indicator.warning {
    background-color: #ffff55;
}

.status-indicator.danger {
    background-color: #ff5555;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* 游戏说明面板 */
.game-instructions {
    position: absolute;
    right: -220px;
    top: 20px;
    text-align: left;
    padding: 10px;
    background-color: #2a2a2a;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    width: 180px;
    max-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    overflow: hidden;
}

.game-instructions h3 {
    color: #8a2be2;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: center;
}

.instructions-content {
    max-height: 0;
    opacity: 0;
    padding: 0 5px;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.3s ease;
    overflow: hidden;
}

.game-instructions:hover {
    box-shadow: 0 0 0 2px #8a2be2, 0 0 15px rgba(138, 43, 226, 0.7);
}

.game-instructions:hover .instructions-content {
    max-height: 400px;
    opacity: 1;
    padding: 5px;
}

.game-instructions p {
    font-size: 10px;
    margin-bottom: 8px;
    color: #cccccc;
    transform: translateY(5px);
    transition: transform 0.3s ease;
}

.game-instructions:hover p {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .game-instructions {
        position: static;
        margin-top: 20px;
        max-width: 100%;
        width: 100%;
    }
    
    .instructions-content {
        max-height: none;
        opacity: 1;
        padding: 5px;
    }
    
    .game-instructions p {
        transform: translateY(0);
    }
}

.pet-animation img.needs-clean {
    filter: sepia(0.3);
}
/* 关心度指数样式 */
.care-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #ff69b4; /* 粉色边框 */
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(255, 105, 180, 0.7);
}

/* 关心度显示样式 */
.care-display {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #ff69b4; /* 粉色文字 */
    text-shadow: 0 0 5px rgba(255, 105, 180, 0.7);
}

/* 特殊动画GIF的样式 */
.pet-animation {
    position: relative;
    width: 100%;
    height: 200px; /* 调整高度以适应GIF */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 防止GIF溢出容器 */
}

#pet-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 保持比例适应容器 */
    transition: opacity 0.3s ease; /* 只添加透明度过渡效果 */
    height: auto; /* 保持宽高比 */
}

#pet-image[src*="inject.gif"] {
    width: 340px; 
    height: auto; /* 自动高度保持比例 */
    object-position: center; /* 确保居中 */
    transform: none; /* 移除任何变换 */
}
.travel-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    display: none;
    image-rendering: pixelated;
}   

.forest-bg {
    background-image: url('../images/scenes/forest.png');
}

.beach-bg {
    background-image: url('../images/scenes/beach.png');
}

.mountain-bg {
    background-image: url('../images/scenes/mountain.png');
}

.traveling .grid-overlay,
.traveling #particles-js,
.traveling .retro-title,
.traveling .retro-footer {
    opacity: 0;
    transition: opacity 0.5s;
}

.traveling .container {
    z-index: 10;
}

.traveling .tamagotchi-container {
    background-color: rgba(0, 0, 0, 0.7);
    border-color: #55ff55;
}

.adventure-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB, #E0F7FA);
    z-index: 5;
    overflow: hidden;
    border-radius: 5px;
}

.adventure-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom, #8B4513, #A0522D);
    z-index: 6;
}

.adventure-item {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    z-index: 7;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

@media (max-width: 768px) {
    .adventure-scene {
        border-radius: 3px;
    }
    
    .adventure-item {
        width: 15px;
        height: 15px;
    }
}

.fixed-buttons {
    position: fixed;
    bottom: 6%;
    right: 1%;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.fixed-buttons .pixel-btn {
    margin: 0;
}
