/* ========================================
   ChemLab Hero v2.0 - CSS Stylesheet
   真实化学模拟引擎样式表

   包含:
   - 真实pH刻度样式
   - 金属反应气泡效果
   - 沉淀反应动画
   - 教育面板样式
   ======================================== */

/* ========================================
   CSS Variables - 颜色和主题
   ======================================== */
:root {
    /* 主色调 */
    --primary-blue: #4FC3F7;
    --primary-green: #81C784;
    --primary-orange: #FFB74D;
    --primary-pink: #F06292;
    --primary-purple: #BA68C8;
    --primary-yellow: #FFD54F;

    /* 背景色 */
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-mid: #16213e;
    --bg-gradient-end: #0f3460;

    /* UI 颜色 */
    --ui-white: #ffffff;
    --ui-light: #f5f5f5;
    --ui-shadow: rgba(0, 0, 0, 0.2);
    --ui-glow: rgba(79, 195, 247, 0.5);

    /* pH 指示剂颜色 */
    --ph-1: #c62828;   /* 强酸红 */
    --ph-3: #ef6c00;   /* 橙色 */
    --ph-5: #fbc02d;   /* 黄色 */
    --ph-7: #43a047;   /* 中性绿 */
    --ph-9: #00897b;   /* 青色 */
    --ph-11: #1e88e5;  /* 蓝色 */
    --ph-14: #ad1457;  /* 强碱紫红 */

    /* 动画时长 */
    --transition-fast: 0.2s;
    --transition-normal: 0.4s;
    --transition-slow: 0.8s;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: auto;
}

body {
    font-family: 'Nunito', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    color: var(--ui-white);
    min-height: 100vh;
    display: block;
    padding-top: 60px;
}

/* ========================================
   游戏顶部导航
   ======================================== */
.game-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(5, 5, 16, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.back-home-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #a0aec0;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.back-home-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
}

.game-nav-title {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #00d4ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#game-container {
    min-height: calc(100vh - 60px);
}

/* ========================================
   主容器
   ======================================== */
#game-container {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ========================================
   Screen 通用样式
   ======================================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ========================================
   Start Screen
   ======================================== */
#start-screen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg,
        rgba(26, 26, 46, 0.95) 0%,
        rgba(22, 33, 62, 0.95) 50%,
        rgba(15, 52, 96, 0.95) 100%);
    overflow: hidden;
}

.floating-molecules {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.molecule {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    padding: 12px 20px;
    border-radius: 20px;
    animation: floatMolecule 8s ease-in-out infinite;
    text-shadow: 0 0 10px currentColor;
}

.m1 { top: 10%; left: 10%; color: #4FC3F7; animation-delay: 0s; }
.m2 { top: 20%; right: 15%; color: #81C784; animation-delay: 1s; }
.m3 { top: 50%; left: 5%; color: #FFD54F; animation-delay: 2s; }
.m4 { top: 70%; right: 10%; color: #BA68C8; animation-delay: 3s; }
.m5 { top: 35%; left: 80%; color: #F06292; animation-delay: 4s; }
.m6 { top: 80%; left: 30%; color: #FFB74D; animation-delay: 5s; }

@keyframes floatMolecule {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(10deg); }
    50% { transform: translateY(-10px) rotate(-5deg); }
    75% { transform: translateY(-25px) rotate(5deg); }
}

.lab-background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: none;
}

.bubble {
    position: absolute;
    bottom: -50px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(79, 195, 247, 0.4),
        rgba(79, 195, 247, 0.1));
    animation: bubbleRise 6s ease-in-out infinite;
}

.b1 { width: 80px; height: 80px; left: 10%; animation-delay: 0s; }
.b2 { width: 50px; height: 50px; left: 25%; animation-delay: 1s; }
.b3 { width: 100px; height: 100px; left: 50%; animation-delay: 2s; }
.b4 { width: 60px; height: 60px; left: 70%; animation-delay: 3s; }
.b5 { width: 70px; height: 70px; left: 85%; animation-delay: 4s; }

@keyframes bubbleRise {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-200px) scale(1.2); opacity: 0.4; }
    100% { transform: translateY(-400px) scale(0.8); opacity: 0; }
}

.logo-container {
    text-align: center;
    z-index: 10;
    margin-bottom: 40px;
}

.lab-coat-icon {
    position: relative;
    width: 100px;
    height: 80px;
    margin: 0 auto 20px;
}

.coat-body {
    width: 70px;
    height: 60px;
    background: linear-gradient(180deg, #ffffff, #e0e0e0);
    border-radius: 8px 8px 15px 15px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
}

.coat-collar {
    width: 50px;
    height: 15px;
    background: linear-gradient(180deg, #f5f5f5, #ffffff);
    border-radius: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 5px;
}

.goggle-strap {
    width: 90px;
    height: 25px;
    border: 3px solid #FFD54F;
    border-radius: 50%;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.goggle-strap::before {
    content: '👓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
}

.game-title {
    font-size: 52px;
    font-weight: 900;
    margin-bottom: 8px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 40px rgba(79, 195, 247, 0.5);
    animation: titlePulse 2s ease-in-out infinite;
}

.title-chem { color: var(--primary-blue); }
.title-lab { color: var(--primary-green); }
.title-hero { color: var(--primary-yellow); }

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

.subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
    letter-spacing: 4px;
}

.version-tag {
    font-size: 14px;
    color: var(--primary-green);
    margin-top: 8px;
    padding: 4px 12px;
    background: rgba(129, 199, 132, 0.2);
    border-radius: 20px;
    display: inline-block;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 45px;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 183, 77, 0.4), 0 0 0 4px rgba(255, 183, 77, 0.2);
    transition: all var(--transition-normal);
    z-index: 10;
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 183, 77, 0.5), 0 0 0 8px rgba(255, 183, 77, 0.3);
}

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

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 8px 20px rgba(255, 183, 77, 0.4), 0 0 0 4px rgba(255, 183, 77, 0.2); }
    50% { box-shadow: 0 8px 30px rgba(255, 183, 77, 0.6), 0 0 0 12px rgba(255, 183, 77, 0.15); }
}

.btn-icon { font-size: 28px; }
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ui-white);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.music-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 24px;
    transition: all var(--transition-normal);
    z-index: 100;
}

.music-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.music-btn.playing {
    animation: musicPulse 1s ease-in-out infinite;
    background: rgba(79, 195, 247, 0.3);
}

@keyframes musicPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0.5); }
    50% { box-shadow: 0 0 0 15px rgba(79, 195, 247, 0); }
}

.version-info {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

/* ========================================
   Level Select Screen
   ======================================== */
#level-select {
    flex-direction: column;
    padding: 40px;
    background: linear-gradient(180deg,
        rgba(26, 26, 46, 0.98) 0%,
        rgba(22, 33, 62, 0.98) 100%);
}

.level-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 16px;
    color: var(--ui-white);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-4px);
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--ui-white);
}

.level-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    flex: 1;
    align-content: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.level-card {
    position: relative;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.level-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(79, 195, 247, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.level-card:hover::before { opacity: 1; }

.level-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ui-white);
    background: var(--primary-purple);
    border-radius: 20px;
}

.level-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 80px;
    margin: 15px 0;
    font-size: 24px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
}

.acid-base-icon {
    background: linear-gradient(135deg, rgba(229, 57, 53, 0.2), rgba(30, 136, 229, 0.2));
}

.metal-icon {
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.2), rgba(129, 199, 132, 0.2));
}

.metal-bar {
    display: flex;
    gap: 15px;
}

.metal-mg { color: #9E9E9E; font-weight: bold; }
.metal-zn { color: #78909C; font-weight: bold; }
.metal-cu { color: #FFA726; font-weight: bold; }

.ion-icon {
    background: linear-gradient(135deg, rgba(186, 104, 200, 0.2), rgba(245, 124, 146, 0.2));
}

.test-tube {
    position: relative;
    width: 25px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.tube-liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(180deg, var(--primary-purple), var(--primary-pink));
}

.precipitate {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 20%;
    background: white;
    animation: precipitatePulse 2s ease-in-out infinite;
}

@keyframes precipitatePulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.6; }
}

.level-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--ui-white);
    margin-bottom: 8px;
}

.level-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.level-status {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.status-complete { color: var(--primary-green); font-weight: 600; }
.status-incomplete { color: rgba(255, 255, 255, 0.4); font-weight: 600; }

.assistant-bubble {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 15px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    animation: bubbleBounce 2s ease-in-out infinite;
}

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

.assistant-emoji { font-size: 36px; }
.bubble-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}

/* ========================================
   Game Screen
   ======================================== */
#game-screen {
    flex-direction: column;
    background: linear-gradient(180deg,
        rgba(26, 26, 46, 0.98) 0%,
        rgba(22, 33, 62, 0.98) 100%);
    padding: 15px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
}

.level-indicator {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-yellow);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-yellow));
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(255, 183, 77, 0.3);
}

.score-label { font-size: 13px; color: rgba(0, 0, 0, 0.6); }
.score-value { font-size: 22px; font-weight: 900; color: #1a1a2e; }

/* 游戏区域 */
.game-area {
    display: grid;
    grid-template-columns: 180px 1fr 260px;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* 化学试剂架 */
.chemical-shelf {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.chemical-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-normal);
    user-select: none;
}

.chemical-item:hover {
    border-color: var(--primary-blue);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(79, 195, 247, 0.3);
}

.chemical-item.dragging {
    opacity: 0.8;
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.chemical-item.added {
    opacity: 0.4;
    pointer-events: none;
    border-color: var(--primary-green);
}

.chemical-bottle {
    width: 45px;
    height: 55px;
    position: relative;
    margin-bottom: 8px;
}

.bottle-neck {
    width: 18px;
    height: 12px;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border-radius: 3px 3px 0 0;
}

.bottle-body {
    width: 100%;
    height: 75%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-radius: 4px 4px 12px 12px;
    position: relative;
    overflow: hidden;
}

.bottle-liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80%;
    border-radius: 0 0 10px 10px;
}

.chemical-info {
    text-align: center;
}

.chemical-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--ui-white);
}

.chemical-formula {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-yellow);
    margin: 2px 0;
}

.chemical-desc {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* 实验台 */
.experiment-station {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.beaker-container {
    position: relative;
    width: 180px;
    height: 260px;
}

.beaker {
    width: 100%;
    height: 220px;
    position: relative;
    background: linear-gradient(180deg,
        rgba(200, 230, 255, 0.15),
        rgba(200, 230, 255, 0.25));
    border: 4px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px 8px 35px 35px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.beaker.drag-over {
    border-color: var(--primary-green);
    box-shadow: 0 0 30px rgba(129, 199, 132, 0.5);
    transform: scale(1.03);
}

.beaker-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.4), rgba(56, 142, 60, 0.4));
    border-radius: 0 0 30px 30px;
    transition: all 0.8s ease;
    overflow: hidden;
}

.beaker-liquid.neutral-glow {
    box-shadow: 0 0 30px rgba(129, 199, 132, 0.8);
}

.beaker-liquid.heating {
    box-shadow: 0 0 30px rgba(255, 152, 0, 0.6);
}

.beaker-liquid.pouring {
    animation: liquidWave 0.5s ease-in-out;
}

@keyframes liquidWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.05); }
}

.liquid-surface {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 50%;
}

.bubble-animation, #bubble-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.precipitate-layer, #precipitate-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.8));
    border-radius: 0 0 30px 30px;
    opacity: 0;
    transition: opacity 1s ease;
}

.precipitate-layer.active {
    opacity: 1;
}

.beaker-glass-effect {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 15px;
    height: 60%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 50%;
}

.beaker-shadow {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 15px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3), transparent);
    border-radius: 50%;
}

/* pH 刻度尺 */
.ph-scale {
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ph-scale-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 150px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

.ph-scale-bar {
    width: 20px;
    height: 150px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.ph-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        var(--ph-14), /* 紫色顶部 */
        var(--ph-11), /* 蓝色 */
        var(--ph-9),  /* 青色 */
        var(--ph-7),  /* 绿色中间 */
        var(--ph-5),  /* 黄色 */
        var(--ph-3),  /* 橙色 */
        var(--ph-1)   /* 红色底部 */
    );
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.ph-marker-line {
    position: absolute;
    left: -8px;
    width: 36px;
    height: 6px;
    background: var(--ui-white);
    border-radius: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    bottom: 50%;
    transition: bottom 0.5s ease;
}

.ph-current-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
}

.ph-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-yellow);
}

.ph-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--ui-white);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.ph-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* 通用指示剂按钮 */
.indicator-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-white);
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-pink));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.indicator-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(186, 104, 200, 0.4);
}

.indicator-btn.used {
    opacity: 0.5;
    pointer-events: none;
}

/* 反应方程式显示 */
.reaction-display {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 20px;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.equation-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--ui-white);
    font-family: 'Courier New', monospace;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.equation-text.show {
    opacity: 1;
}

/* 沉淀反应结果 */
.reaction-result {
    position: absolute;
    bottom: -90px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.reaction-result.show {
    display: block;
}

.reaction-result .precipitation-detected,
.reaction-result .no-reaction {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

.reaction-result .precipitation-detected {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.reaction-result .no-reaction {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.reaction-result .icon {
    font-size: 24px;
}

/* 信息面板 */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.instruction-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg,
        rgba(255, 213, 79, 0.1),
        rgba(255, 183, 77, 0.05));
    border: 1px solid rgba(255, 213, 79, 0.3);
    border-radius: var(--radius-md);
}

.instruction-icon { font-size: 24px; }
.instruction-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ui-white);
}

/* 教育面板 */
.education-panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 15px;
    max-height: 150px;
    overflow-y: auto;
}

.education-title {
    font-size: 14px;
    color: var(--primary-green);
    margin-bottom: 10px;
}

.education-content {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.education-content h4 {
    color: var(--primary-yellow);
    margin-bottom: 8px;
}

.education-content .highlight {
    color: var(--primary-green);
    font-weight: bold;
}

.education-content .equation-highlight {
    color: var(--primary-blue);
    font-family: 'Courier New', monospace;
    background: rgba(79, 195, 247, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin: 4px 0;
}

.education-content .note {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin-top: 8px;
}

.education-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.education-content li {
    margin: 4px 0;
}

/* 实验室助手 */
.lab-assistant {
    display: flex;
    justify-content: center;
}

.assistant-avatar {
    position: relative;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: assistantBounce 2s ease-in-out infinite;
}

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

.face {
    position: relative;
    width: 52px;
    height: 52px;
    background: #FFE0B2;
    border-radius: 50%;
}

.face.happy .mouth { border-radius: 0 0 20px 20px; border-top: none; }
.face.thinking .mouth { border-radius: 50%; height: 8px; width: 8px; border: 2px solid #333; }
.face.surprised .mouth { border-radius: 50%; width: 14px; height: 14px; }
.face.neutral .mouth { width: 16px; height: 3px; background: #333; border-radius: 2px; border: none; }

.eyes {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 12px;
}

.eye {
    width: 10px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    position: relative;
}

.pupil {
    position: absolute;
    top: 2px;
    left: 3px;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
}

.mouth {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 18px 18px;
}

.goggles {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 18px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--primary-yellow) 15%,
        var(--primary-yellow) 40%,
        #333 50%,
        var(--primary-yellow) 60%,
        var(--primary-yellow) 85%,
        transparent 100%);
    border-radius: 10px;
    border: 2px solid #333;
}

.dialogue-bubble {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.dialogue-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 25px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid rgba(255, 255, 255, 0.95);
}

#dialogue-text {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}

/* 实验室笔记本 */
.lab-notebook {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.notebook-header {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.notebook-content {
    padding: 10px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 11px;
}

.notebook-entry {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.entry-time {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    margin-right: 8px;
}

.equation {
    color: var(--primary-yellow);
    font-family: 'Courier New', monospace;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 12px;
    margin-top: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-white);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.hint-btn:hover {
    border-color: var(--primary-yellow);
    background: rgba(255, 213, 79, 0.2);
}

.reset-btn:hover {
    border-color: var(--primary-blue);
    background: rgba(79, 195, 247, 0.2);
}

.check-btn {
    background: linear-gradient(135deg, var(--primary-green), #66BB6A);
    border-color: transparent;
}

.check-btn:hover {
    background: linear-gradient(135deg, #66BB6A, var(--primary-green));
    box-shadow: 0 8px 25px rgba(129, 199, 132, 0.4);
}

/* 进度条 */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    max-width: 280px;
    margin: 0 auto;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-green));
    border-radius: 5px;
    transition: width var(--transition-slow);
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.progress-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-yellow);
}

/* ========================================
   Result Screen
   ======================================== */
#result-screen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg,
        rgba(26, 26, 46, 0.98) 0%,
        rgba(22, 33, 62, 0.98) 100%);
}

.result-container {
    text-align: center;
    padding: 40px;
    max-width: 450px;
}

.result-icon {
    font-size: 90px;
    margin-bottom: 20px;
    animation: resultBounce 0.5s ease-out;
}

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

.result-title {
    font-size: 42px;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--primary-yellow);
}

.result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
}

.result-score .score-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.score-number {
    font-size: 64px;
    font-weight: 900;
    color: var(--primary-orange);
    text-shadow: 0 0 30px rgba(255, 183, 77, 0.5);
}

.result-message {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
}

.knowledge-card {
    background: linear-gradient(135deg,
        rgba(129, 199, 132, 0.1),
        rgba(79, 195, 247, 0.1));
    border: 1px solid rgba(129, 199, 132, 0.3);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 25px;
    text-align: left;
}

.knowledge-card h4 {
    font-size: 16px;
    color: var(--primary-green);
    margin-bottom: 10px;
}

.knowledge-card p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ui-white);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ========================================
   Overlays
   ======================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.overlay.active { display: flex; }

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.star-burst {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary-yellow);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: starExplode 1s ease-out forwards;
}

@keyframes starExplode {
    0% { transform: translate(0, 0) scale(0); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(1); opacity: 0; }
}

.hint-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    padding: 25px;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: hintPop 0.3s ease-out;
}

@keyframes hintPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.hint-icon { font-size: 45px; margin-bottom: 12px; }

#hint-text {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 18px;
}

.btn-small {
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ui-white);
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-small:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(79, 195, 247, 0.4);
}

/* ========================================
   气泡和沉淀粒子动画
   ======================================== */
@keyframes bubbleRise {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-40px) scale(1.3); opacity: 0.5; }
    100% { transform: translateY(-80px) scale(0.5); opacity: 0; }
}

@keyframes precipitateFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.9; }
    70% { opacity: 0.8; }
    100% { transform: translateY(200px) rotate(180deg); opacity: 0; }
}

/* ========================================
   Animations
   ======================================== */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

@keyframes scaleIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.success-pulse {
    animation: successPulse 0.5s ease-in-out;
}

@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(129, 199, 132, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(129, 199, 132, 0); }
    100% { box-shadow: 0 0 0 0 rgba(129, 199, 132, 0); }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 150px 1fr 220px;
    }

    .ph-scale {
        right: -60px;
    }
}

@media (max-width: 768px) {
    .game-title { font-size: 36px; }
    .subtitle { font-size: 16px; }

    .game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .chemical-shelf {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
    }

    .chemical-item {
        min-width: 75px;
    }

    .ph-scale {
        position: static;
        flex-direction: row;
        height: auto;
        margin-top: 20px;
    }

    .ph-scale-labels {
        flex-direction: row;
        height: auto;
        gap: 8px;
    }

    .ph-scale-bar {
        width: 150px;
        height: 20px;
    }

    .ph-marker-line {
        width: 6px;
        height: 28px;
        left: 0;
        bottom: auto;
        top: 0;
    }

    .level-cards {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}