/* --- 基礎變數與設定 (保持不變) --- */
:root {
    --purple: #8e44ad;
    --bg-color: #f4f7f9;
    --gray-bulb: #dcdde1;
    --disabled-gray: #bdc3c7;
    --text-dark: #2c3e50;
    --accent-yellow: #f1c40f;
    --accent-blue: #3498db;
    --accent-green: #2ecc71;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: "Microsoft JhengHei", "PingFang TC", sans-serif; 
    background: var(--bg-color); 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
}
.hide { display: none !important; }

/* --- 這裡開始是原有佈局樣式 (省略重複部分，實際應用請保留) --- */
.app-wrapper { display: flex; flex-direction: column; height: 100vh; width: 100vw; }
.top-nav { background: #2f3640; color: white; padding: 10px 30px; display: flex; justify-content: space-between; align-items: center; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.2);}
.top-nav h1 { font-size: 1.4rem; }
.reset-button { background: #e74c3c; color: white; border: none; padding: 8px 20px; border-radius: 8px; cursor: pointer; font-weight: bold; transition: background 0.3s;}
.reset-button:hover { background: #c0392b; }
.lab-main { display: flex; flex: 1; padding: 20px; gap: 30px; overflow: hidden; }
.side-panel { flex: 0.8; display: flex; flex-direction: column; gap: 15px; }
.info-area { flex: 1; overflow-y: auto; padding-right: 10px; }
.info-area::-webkit-scrollbar { width: 6px; }
.info-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.button-grid { 
    display: grid;
    /* 預設寬版面：兩個一行 */
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    width: 100%; 
}
.liquid-btn { 
    width: 100%; 
    padding: 12px 5px; 
    font-size: 1rem; 
    border: 2px solid #ddd; 
    border-radius: 10px; 
    background: white; 
    cursor: pointer; 
    text-align: center; 
    transition: all 0.3s;
    /* 避免文字換行 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.liquid-btn.active { border-color: #2f3640; background: #f1f2f6; font-weight: bold; transform: translateX(5px);}
.action-btn { width: 100%; padding: 15px; font-size: 1.1rem; border: none; border-radius: 10px; background: var(--purple); color: white; cursor: pointer; font-weight: bold; box-shadow: 0 4px 0 #732d91; transition: all 0.2s;}
.action-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #732d91; }
.action-btn.used, .action-btn.disabled { background: var(--disabled-gray); cursor: not-allowed; box-shadow: none; transform: none;}
.intro-item ul { list-style-type: none; padding-left: 5px; margin-top: 10px;}
.intro-item li { font-size: 0.95rem; line-height: 1.8; color: #444; margin-bottom: 8px; position: relative; padding-left: 20px; text-align: justify;}
.intro-item li::before { content: "•"; color: var(--accent-blue); font-weight: bold; position: absolute; left: 0;}
.intro-item li b { color: #2c3e50; margin-right: 4px;}

/* --- 實驗舞台與滴管 (保持不變) --- */
.experiment-stage { flex: 1.2; background: white; border-radius: 20px; display: flex; justify-content: center; align-items: flex-start; position: relative; box-shadow: inset 0 0 15px rgba(0,0,0,0.05); }
.glassware-container { position: relative; width: 360px; height: 550px; display: flex; flex-direction: column; align-items: center; }
.dropper { position: absolute; top: -80px; transform: rotate(60deg); transform-origin: bottom center; width: 65px; z-index: 60; }
.dropper.active-mode { cursor: pointer; animation: nudge 2s infinite ease-in-out; }
@keyframes nudge { 0%, 100% { transform: rotate(60deg); } 50% { transform: rotate(57deg); } }
.dropper-bulb { width: 70px; height: 90px; background: var(--gray-bulb); border-radius: 50% 50% 15% 15%; border: 3px solid #bdc3c7; }
.dropper-tube { width: 25px; height: 160px; border: 2px solid #7f8c8d; border-top: none; margin: -2px auto 0; background: rgba(255,255,255,0.4); position: relative; overflow: hidden; }
.juice-fill { position: absolute; top: 0; width: 100%; height: 0%; background: var(--purple); transition: height 0.8s ease-in-out; }
.water-drop { position: absolute; top: 170px; left: 50%; transform: translateX(-50%); width: 14px; height: 18px; background: var(--purple); border-radius: 50%; opacity: 0; z-index: 50; }
.drop-fall { animation: fall 0.6s linear forwards; }
@keyframes fall { 0% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, 250px); opacity: 0; } }

/* --- 燒杯樣式與新增的 Emoji 動畫 --- */
.beaker { 
    width: 320px; height: 220px; border: 6px solid #95a5a6; border-top: none; border-radius: 0 0 45px 45px; 
    background: white; position: absolute; bottom: 80px; overflow: hidden; z-index: 10;
}

/* 新增：Emoji 基礎樣式與隨機滑動動畫 */
.beaker-emoji {
    position: absolute;
    bottom: 0%;      /* 初始位置 */
    left: 50%;      /* 初始置中 */
    transform: translateX(-50%); /* 修正置中偏移 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 40;
    transition: bottom 0.8s ease-in-out, left 1s ease-in-out; 
    pointer-events: none;
}
.emoji-inner {
    font-size: 2.2rem;
    display: inline-block;
}


/* 大彈跳：向上衝得更高 */
.bounce-big {
    animation: bigJump 0.5s ease-out;
}

@keyframes bigJump {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-35px) scale(1.2) } 
}

/* 小彈跳：輕微晃動 */
.bounce-small {
    animation: smallJump 0.5s ease-out;
}

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


.stop-animation {
    transition: none !important;
}




.liquid-fill { position: absolute; bottom: 0; width: 100%; height: 0%; transition: height 0.8s ease-in-out, background-color 0.5s; }
.surface-line { position: absolute; top: 0; width: 100%; border-top: 5px dashed rgba(230,230,230,0.8); z-index: 25; }
.overlay { opacity: 0; transition: opacity 0.8s; }
.beaker-name-display { position: absolute; width: 100%; top: 50%; text-align: center; color: white; font-size: 2.2rem; font-weight: bold; text-shadow: 0 2px 8px rgba(0,0,0,0.5); opacity: 0; transition: 0.8s; z-index: 30; }

/* --- 剩餘樣式保持不變 --- */
.info-card { padding: 18px; border-radius: 12px; background: white; border: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.02); margin-bottom: 10px;}
.info-card h3 { margin-bottom: 10px; font-size: 1.15rem; color: var(--text-dark); }
.report { border-left: 6px solid var(--accent-yellow); }
.science { border-left: 6px solid var(--accent-green); }
.solution-intro { border-left: 6px solid var(--accent-blue); }
.intro-item { margin-top: 15px; padding-bottom: 12px; border-bottom: 1px dashed #eee; }
.intro-item:last-child { border-bottom: none; }
.intro-item h4 { color: #2980b9; margin-bottom: 6px; font-size: 1.05rem; display: flex; align-items: center;}
.intro-item p { font-size: 0.92rem; line-height: 1.6; color: #555; text-align: justify;}
#drop-counter { margin-top: 10px; font-weight: bold; color: var(--purple); }

@media (max-width: 900px) {
    .lab-main { flex-direction: column; overflow-y: auto; padding: 15px; gap: 20px; }
    .side-panel { flex: none; width: 100%; }
	.button-grid {
        /* 手機端：三個一行 */
        grid-template-columns: repeat(3, 1fr); 
        gap: 6px; 
    }

    .liquid-btn {
        padding: 8px 2px; 
        font-size: 0.85rem; /* 縮小字體以適應三欄佈局 */
    }

.experiment-stage {
        min-height: 450px; /* 稍微縮減舞台高度 */
    }

    .glassware-container { transform: scale(0.85); height: 500px; }
    .beaker { bottom: 20px; }
    .info-area { max-height: none; overflow: visible; }
}

/* --- 導覽列左側群組 --- */
.nav-left {
    display: flex;
    align-items: center;
    gap: 15px; /* 首頁按鈕與標題的間距 */
}

/* --- 返回首頁按鈕樣式 --- */
.home-button {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15); /* 半透明背景 */
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* 針對行動裝置微調 */
@media (max-width: 600px) {
    .top-nav {
        padding: 10px 15px;
    }
    .top-nav h1 {
        font-size: 1.1rem; /* 手機端標題縮小一點 */
    }
    .home-button {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
}