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

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 屏幕通用样式 */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: inherit;
}

.hidden {
    display: none !important;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 10px;
    min-width: 150px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #ff7043, #ff5722);
    border: none;
    color: white;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 112, 67, 0.3);
    transition: all 0.3s ease;
    margin: 10px;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 112, 67, 0.4);
}

/* 开始界面样式 */
.game-title {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.game-title h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    max-width: 500px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.instructions h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin: 10px 0;
    padding: 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    color: #333;
}

.good-bacteria {
    color: #4CAF50;
    font-weight: bold;
}

.bad-bacteria {
    color: #f44336;
    font-weight: bold;
}

/* 游戏界面样式 */
#game-screen {
    padding: 0;
}

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    font-size: 18px;
    font-weight: bold;
}

/* 状态条系统样式 */
.status-bars {
    position: fixed;
    top: 70px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    z-index: 99;
    backdrop-filter: blur(5px);
    min-width: 250px;
}

.status-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: white;
}

.status-bar:last-child {
    margin-bottom: 0;
}

.status-label {
    min-width: 70px;
    font-weight: bold;
    margin-right: 10px;
}

.status-progress {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-right: 10px;
    position: relative;
}

.status-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 6px;
    transition: width 0.8s ease, background-color 0.5s ease;
    position: relative;
    overflow: hidden;
}

.status-fill.red {
    background: linear-gradient(90deg, #f44336, #e57373);
}

.status-fill.green {
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.status-fill.orange {
    background: linear-gradient(90deg, #FF9800, #FFB74D);
}

.status-fill.yellow {
    background: linear-gradient(90deg, #FFC107, #FFEB3B);
}

.status-fill.purple {
    background: linear-gradient(90deg, #9C27B0, #BA68C8);
}

.status-fill.blue {
    background: linear-gradient(90deg, #2196F3, #64B5F6);
}

.status-fill.cyan {
    background: linear-gradient(90deg, #00BCD4, #4DD0E1);
}

.status-fill.pink {
    background: linear-gradient(90deg, #E91E63, #F06292);
}

.status-fill.teal {
    background: linear-gradient(90deg, #009688, #4DB6AC);
}

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

/* 状态条动画效果 */
.status-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, 
        rgba(135, 206, 250, 0.8) 0%, 
        rgba(255, 182, 193, 0.8) 100%);
    overflow: hidden;
    padding-top: 80px;
}

/* 新的微生物样式 - 使用图片 */
.microbe {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    border: 3px solid rgba(255,255,255,0.6);
    animation: float 4s ease-in-out infinite;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: visible;
    opacity: 0;
    transform: scale(0.3);
}

/* 微生物出现动画 */
.microbe.fade-in {
    animation: microbeAppear 0.6s ease-out forwards, float 4s ease-in-out infinite 0.6s;
}

/* 微生物消失动画 */
.microbe.fade-out {
    animation: microbeDisappear 0.8s ease-in forwards;
}

@keyframes microbeAppear {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2) rotate(-90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes microbeDisappear {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8) rotate(90deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(180deg);
    }
}

.microbe:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.microbe.good {
    border-color: #4CAF50;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.microbe.bad {
    border-color: #f44336;
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.microbe.neutral {
    border-color: #FF9800;
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

/* 微生物名称标签 */
.microbe-name-tag {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(2deg); }
    50% { transform: translateY(-5px) rotate(-1deg); }
    75% { transform: translateY(-12px) rotate(3deg); }
}

/* 点击效果 */
.click-effect {
    position: absolute;
    pointer-events: none;
    font-size: 28px;
    font-weight: bold;
    animation: scoreFloat 1.2s ease-out forwards;
    z-index: 1000;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.8);
    }
}

/* 爆炸式知识面板 */
.knowledge-explosion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: explosionFadeIn 0.3s ease-out;
    backdrop-filter: blur(3px);
    pointer-events: none; /* 不阻塞点击 */
}

.knowledge-explosion-overlay.auto-hide {
    animation: explosionFadeOut 0.5s ease-in forwards;
}

.knowledge-explosion-content {
    background: transparent;
    border-radius: 10px;
    padding: 12px;
    max-width: 320px;
    max-height: 250px;
    min-width: 280px;
    position: relative;
    text-align: center;
    color: white;
    box-shadow: none;
    animation: explosionSlideIn 0.4s ease-out;
    overflow-y: visible;
    pointer-events: none; /* 允许鼠标穿透，不阻挡点击 */
}

.knowledge-close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: none; /* 关闭按钮也不阻挡，弹窗会自动关闭 */
}

.knowledge-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.microbe-image-large {
    display: none; /* 隐藏图片，只显示文字 */
}

.microbe-name-large {
    font-size: 1.2em;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    color: #FFD700;
    font-weight: bold;
}

.microbe-knowledge-text {
    font-size: 0.95em;
    line-height: 1.6;
    text-align: left;
    background: transparent;
    padding: 8px;
    border-radius: 6px;
    border: none;
    max-height: 180px;
    overflow: visible;
    color: #FFFFFF;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-weight: 500;
}

@keyframes explosionFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes explosionFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

/* 粒子特效系统 */
.particle {
    position: absolute;
    pointer-events: none;
    z-index: 1500;
}

/* 撤花特效 */
.confetti {
    width: 8px;
    height: 8px;
    background: #FFD700;
    border-radius: 50%;
    animation: confettiFall 2s ease-out forwards;
}

.confetti.pink { background: #FF69B4; }
.confetti.blue { background: #00BFFF; }
.confetti.green { background: #32CD32; }
.confetti.red { background: #FF6347; }
.confetti.purple { background: #DA70D6; }

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(300px) rotate(720deg) scale(0.3);
    }
}

/* 溥血特效 */
.blood-splash {
    width: 12px;
    height: 12px;
    background: #8B0000;
    border-radius: 50%;
    animation: bloodSplash 1.5s ease-out forwards;
}

.blood-splash.large {
    width: 16px;
    height: 16px;
}

.blood-splash.small {
    width: 8px;
    height: 8px;
}

@keyframes bloodSplash {
    0% {
        opacity: 1;
        transform: scale(1) translateX(0) translateY(0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.5) translateX(var(--splash-x, 0)) translateY(var(--splash-y, 0));
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateX(calc(var(--splash-x, 0) * 2)) translateY(calc(var(--splash-y, 0) * 2));
    }
}

#pause-btn {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 101;
    padding: 10px 20px;
    font-size: 14px;
}

/* 结束界面样式 */
.game-over {
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.final-score {
    margin: 20px 0;
    font-size: 1.5em;
}

.final-status-report {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.final-status-report h3 {
    margin-bottom: 15px;
    color: #FFD700;
}

#status-report-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.status-report-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-report-label {
    font-weight: bold;
    color: #FFD700;
    min-width: 100px;
}

.status-report-bar {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 10px;
}

.status-report-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 10px;
    transition: width 0.8s ease;
}

.status-report-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: white;
    font-size: 1.1em;
}

.score-evaluation {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.buttons {
    margin-top: 30px;
}

/* 暂停界面样式 */
.pause-menu {
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* 响应式设计 - 平板优化 */
@media screen and (min-width: 768px) {
    .microbe {
        width: 120px;
        height: 120px;
    }
    
    .microbe-name-tag {
        font-size: 14px;
        padding: 6px 15px;
        top: -40px;
    }
    
    .game-title h1 {
        font-size: 3.5em;
    }
    
    .instructions {
        max-width: 600px;
        font-size: 18px;
    }
    
    .btn-primary {
        padding: 20px 40px;
        font-size: 20px;
    }
    
    .knowledge-explosion-content {
        padding: 50px;
        max-width: 70vw;
    }
    
    .microbe-image-large {
        width: 200px;
        height: 200px;
    }
    
    .microbe-name-large {
        font-size: 2.8em;
    }
    
    .microbe-knowledge-text {
        font-size: 1.4em;
    }
}

/* 防止选中文本 */
.game-container, .microbe {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
/* =============== V010新增样式 =============== */

/* 下一代益生菌样式 - 紫色渐变背景 + 星标 */
.microbe.nextgen {
    /* ❗ 修复：移除 background，让 JavaScript 的 backgroundImage 生效 */
    border: 4px solid #FFD700;
    box-shadow: 0 0 25px rgba(156, 39, 176, 0.8), 0 0 40px rgba(233, 30, 99, 0.6), 0 0 15px rgba(255, 215, 0, 0.8);
    animation: nextgenGlow 2s ease-in-out infinite, float 4s ease-in-out infinite;
    /* ❗ 修复：确保可见 */
    opacity: 1 !important;
    transform: scale(1) !important;
}

.microbe.nextgen:hover {
    transform: scale(1.2) !important;
    box-shadow: 0 0 35px rgba(156, 39, 176, 1), 0 0 50px rgba(233, 30, 99, 0.8), 0 0 20px rgba(255, 215, 0, 1);
}

/* 下一代益生菌发光动画 */
@keyframes nextgenGlow {
    0%, 100% {
        box-shadow: 0 0 25px rgba(156, 39, 176, 0.8), 0 0 40px rgba(233, 30, 99, 0.6);
    }
    50% {
        box-shadow: 0 0 35px rgba(156, 39, 176, 1), 0 0 55px rgba(233, 30, 99, 0.9);
    }
}

/* 下一代益生菌名称标签 - 紫色渐变 + 星标 */
.microbe-name-tag.nextgen-tag {
    background: linear-gradient(90deg, #9C27B0, #E91E63);
    color: #FFD700;
    font-weight: 900;
    font-size: 13px;
    padding: 6px 14px;
    border: 2px solid #FFD700;
    box-shadow: 0 3px 10px rgba(156, 39, 176, 0.7);
    animation: tagPulse 1.5s ease-in-out infinite;
}

@keyframes tagPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

/* 健康干预因素样式 */
.microbe.intervention {
    background-size: contain;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    animation: interventionGlow 2.5s ease-in-out infinite, float 4s ease-in-out infinite;
    /* ❗ 修复：确保可见 */
    opacity: 1 !important;
    transform: scale(1) !important;
}

.microbe.intervention:hover {
    transform: scale(1.2) !important;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.9);
}

/* 健康干预因素发光动画 */
@keyframes interventionGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px currentColor;
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.9), 0 0 45px currentColor;
    }
}

/* 健康干预因素的emoji显示 */
.intervention-emoji {
    font-size: 14px;
    line-height: 1;
    animation: emojiFloat 3s ease-in-out infinite;
}

@keyframes emojiFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.1);
    }
}

/* 健康干预因素名称标签 */
.microbe-name-tag.intervention-tag {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-weight: 800;
    font-size: 11px;
    padding: 5px 12px;
    border: 2px solid rgba(255, 255, 255, 1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

/* 响应式优化 - 平板 */
@media screen and (min-width: 768px) {
    .microbe.nextgen,
    .microbe.intervention {
        width: 120px;
        height: 120px;
    }
    
    .intervention-emoji {
        font-size: 28px;
    }
    
    .microbe-name-tag.nextgen-tag,
    .microbe-name-tag.intervention-tag {
        font-size: 14px;
        padding: 7px 16px;
        top: -45px;
    }
}

/* 微生物属性条区域 */
.attribute-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.85);
    padding: 15px;
    border-radius: 12px;
    z-index: 99;
    backdrop-filter: blur(8px);
    min-width: 280px;
    max-width: 350px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.attribute-panel-title {
    font-size: 16px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.attribute-content {
    font-size: 14px;
    color: white;
    line-height: 1.8;
}

.attribute-placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

.attribute-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.attribute-item:last-child {
    border-bottom: none;
}

.attribute-label {
    font-weight: 600;
    color: #FFF;
}

.attribute-value {
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 5px;
    min-width: 60px;
    text-align: center;
}

.attribute-value.positive {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.attribute-value.negative {
    color: #f44336;
    background: rgba(244, 67, 54, 0.2);
}

/* 响应式设计 - 屟屏优化 */
@media screen and (max-width: 480px) {
    .attribute-panel {
        min-width: 240px;
        max-width: 280px;
        bottom: 80px; /* 留出暂停按钮空间 */
    }
    
    .attribute-panel-title {
        font-size: 14px;
    }
    
    .attribute-content {
        font-size: 12px;
    }
}
