body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f4f8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    padding: 20px;
}

/* 16:9宽高比容器 */
.aspect-ratio-container {
    width: 90%;
    max-width: 1280px;
    height: 0;
    padding-bottom: 50.25%; /* 从 56.25% 减小，例如改为 50.25% (更接近 2:1 而不是 16:9) */
    position: relative;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px auto;
}

.content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    color: #1a365d;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.8rem;
}

.description {
    text-align: center;
    max-width: 800px;
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 设置动画容器的宽高比为16:9 */
#animation-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 宽高比 (9/16 = 0.5625 或 56.25%) */
    margin: 20px auto;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

#animation-inner-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 锥形瓶效果 - 完全重新设计 */
.beaker {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%; 
    height: 65%; 
    background-color: rgba(229, 236, 242, 0.6); 
    /* 更新 clip-path 以减小瓶身倾斜度并使底部更圆滑 */
    clip-path: polygon(
        35% 0%,    /* 颈部左上角 */
        65% 0%,    /* 颈部右上角 */
        65% 25%,   /* 颈部右下角 (肩部) */
        90% 88%,   /* 右侧瓶身斜边结束点 - 瓶身更宽，倾斜度减小 */
        85% 93%,   /* 右侧瓶身底部曲线过渡点1 - 圆角处理 */
        75% 95%,   /* 右下角底部点 */
        25% 95%,   /* 左下角底部点 */
        15% 93%,   /* 左侧瓶身底部曲线过渡点1 - 圆角处理 */
        10% 88%,   /* 左侧瓶身斜边结束点 - 瓶身更宽，倾斜度减小 */
        35% 25%    /* 颈部左下角 (肩部) */
    );
    z-index: 1;
    /* 增强玻璃质感 */
    border: 1.5px solid rgba(173, 200, 221, 0.7); /* 更清晰的边缘 */
    box-shadow: 
        inset 0 0 15px rgba(255, 255, 255, 0.6), /* 内部高光 */
        inset 0 2px 4px rgba(173, 200, 221, 0.4), /* 内部阴影，增加深度 */
        2px 2px 8px rgba(0, 0, 0, 0.05); /* 轻微外部阴影 */
}

/* 锥形瓶颈部环/唇边 */
.beaker::before {
    content: '';
    position: absolute;
    top: -3px; /* 调整位置，使其看起来像瓶口唇边 */
    left: 50%;
    transform: translateX(-50%);
    width: 22%; /* 匹配新的更窄颈部开口 (60%-40% = 20%), 略宽一点形成唇边 */
    height: 10px; /* 调整唇边厚度 */
    background-color: rgba(200, 214, 229, 0.7);
    border: 1.5px solid rgba(173, 200, 221, 0.8);
    border-bottom-color: rgba(173, 200, 221, 0.5); /* 底部颜色略深 */
    border-radius: 4px 4px 2px 2px / 6px 6px 2px 2px; /* 圆滑的唇边 */
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 移除旧的锥形瓶底座 .beaker::after 样式，因为新clip-path已包含底部形状 */
/* 如果需要，可以将 .beaker::after 用于其他效果，如底部高光或阴影 */
/* 例如，可以移除或注释掉以下规则： */
/* .beaker::after { ... } */
/* 为了明确，这里我们确保它不存在或为空 */
.beaker::after {
    content: none; /* 明确移除旧底座 */
}


/* 添加锥形瓶内部薄液体层 */
.flask-liquid {
    position: absolute;
    bottom: 5%; 
    left: 0;    
    width: 100%; 
    height: 10%; 
    background: linear-gradient(to bottom, 
        rgba(200, 220, 255, 0.4) 0%, 
        rgba(180, 210, 250, 0.6) 100%);
    z-index: 0; 
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.05); 
    /* 更新液体 clip-path 以匹配新的烧杯形状 */
    /* Y坐标: 0% (液面), 30% (斜边末端 @烧杯88%Y), 80% (曲线中点 @烧杯93%Y), 100% (底部 @烧杯95%Y) */
    /* X坐标: 基于新的烧杯轮廓计算得出 */
    clip-path: polygon(
        88.81% 0%,  /* 液体表面右点 */
        90% 30%,    /* 对应烧杯 90% X, 88% Y */
        85% 80%,    /* 对应烧杯 85% X, 93% Y */
        75% 100%,   /* 对应烧杯 75% X, 95% Y */
        25% 100%,   /* 对应烧杯 25% X, 95% Y */
        15% 80%,    /* 对应烧杯 15% X, 93% Y */
        10% 30%,    /* 对应烧杯 10% X, 88% Y */
        11.19% 0%   /* 液体表面左点 */
    );
}

/* 添加滴定管 */
.burette {
    position: absolute;
    top: 3%; /* 从 -70px 改为 3% */
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 120px;
    background-color: rgba(240, 245, 250, 0.7);
    border: 1px solid rgba(200, 214, 229, 0.8);
    z-index: 6;
    border-radius: 2px;
}

/* 滴定管顶部 */
.burette::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 8px;
    background-color: rgba(220, 230, 240, 0.8);
    border: 1px solid rgba(200, 214, 229, 0.8);
    border-radius: 5px 5px 0 0;
}

/* 滴定管底部滴嘴 */
.burette::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 10px;
    background-color: rgba(220, 230, 240, 0.8);
    border: 1px solid rgba(200, 214, 229, 0.8);
    border-radius: 0 0 2px 2px;
}

.vc {
    width: 35px; 
    height: 35px; 
    background: radial-gradient(circle at 30% 30%, #c6f6d5, #48bb78);
    border: 1px solid #2f855a;
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold; 
    color: #22543d;
    z-index: 5;
    transition: 
        opacity 0.5s ease-out, 
        transform 0.5s ease-out;
    animation: float 3s infinite ease-in-out alternate;
    box-shadow: 
        0 2px 5px rgba(0,0,0,0.15),
        inset 0 0 3px rgba(255,255,255,0.5);
    text-shadow: 0px 1px 1px rgba(255,255,255,0.7);
}

.dha { /* 脱氢抗坏血酸 (DHA) 的样式 */
    width: 35px; 
    height: 35px; 
    background: radial-gradient(circle at 30% 30%, #e2e8f0, #a0aec0); /* 例如：灰色系 */
    border: 1px solid #718096;
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold; 
    color: #2d3748; /* 深灰色文字 */
    z-index: 5;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* 用于消失动画 */
    box-shadow: 
        0 2px 5px rgba(0,0,0,0.15),
        inset 0 0 3px rgba(255,255,255,0.3);
    text-shadow: 0px 1px 1px rgba(255,255,255,0.5);
}

/* 移除 .reaction-products 或注释掉，因为它不再使用 */
/*
.reaction-products { ... }
*/

.iodide-product { /* 2I⁻ 产物样式 */
    width: 40px; 
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #fbd38d, #ed8936); /* 橙色系 */
    border: 1px solid #dd6b20;
    border-radius: 6px;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold; 
    color: #fffaf0; 
    z-index: 5;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.proton-product { /* 2H⁺ 产物样式 */
    width: 40px; 
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #fbb6ce, #ed64a6); /* 粉色/红色系 */
    border: 1px solid #d53f8c;
    border-radius: 6px;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold; 
    color: #fff5f7; 
    z-index: 5;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dha-label { /* DHA 全名标签样式 */
    position: absolute;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px; /* 稍大一点的字体 */
    color: #4a5568;
    z-index: 5;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    white-space: nowrap; /* 防止文字换行 */
}


.iodine {
    width: 30px; 
    height: 30px; 
    background: radial-gradient(circle at 30% 30%, #e9d8fd, #805ad5);
    border: 1px solid #553c9a; 
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold; 
    color: #44337a;
    top: -35px;
    z-index: 5;
    transition: 
        top 1s ease-in, 
        left 1s ease-in, 
        opacity 0.5s ease-out, 
        transform 0.5s ease-out;
    box-shadow: 
        0 2px 5px rgba(0,0,0,0.15),
        inset 0 0 3px rgba(255,255,255,0.5);
    text-shadow: 0px 1px 1px rgba(255,255,255,0.7);
}

.iodine.falling {
    animation: droplet 0.5s ease-out;
}

.starch {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #edf2f7);
    border: 2px dashed #a0aec0;
    border-radius: 50%;
    color: #4a5568;
    font-size: 10px;
    font-weight: bold;
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%); /* Base horizontal centering */
    transition: background 0.8s ease-in, border-color 0.8s ease-in, color 0.8s ease-in; /* Transition only non-transform properties */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 5;
    /* Apply float animation by default */
    animation-name: float;
    animation-duration: 4s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-direction: alternate;
    text-shadow: 0px 1px 1px rgba(255,255,255,0.7);
}

.starch.blue {
    background: radial-gradient(circle at 30% 30%, #bee3f8, #3182ce);
    border-color: #2b6cb0;
    color: #2a4365;
    /* When blue, continue float and add opacityPulse */
    animation-name: float, opacityPulse;
    animation-duration: 4s, 1.5s; /* Duration for float, duration for opacityPulse */
    animation-iteration-count: infinite, infinite;
    animation-timing-function: ease-in-out, ease-in-out; /* Timing for float, timing for opacityPulse */
    animation-direction: alternate, normal; /* Direction for float, direction for opacityPulse */
}

.disappear {
    opacity: 0;
    transform: scale(0.1);
}

/* 控制面板 */
.controls {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

button {
    background: linear-gradient(to bottom, #4299e1, #3182ce);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

button:hover {
    background: linear-gradient(to bottom, #3182ce, #2b6cb0);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

button:disabled {
    background: linear-gradient(to bottom, #a0aec0, #718096);
    cursor: not-allowed;
    transform: none;
}

/* 动画效果 */
@keyframes float {
    0% {
        transform: translateX(-50%) translateY(0px);
    }
    100% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Remove or rename the old pulse keyframes if it affected transform */
/* @keyframes pulse { ... } */

/* New keyframes for opacity pulse, does not affect transform */
@keyframes opacityPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes droplet {
    0% { transform: translateY(0) scaleY(1); }
    20% { transform: translateY(3px) scaleY(1.1); }
    100% { transform: translateY(0) scaleY(1); }
}

/* 模态框样式增强 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 25px;
    border-radius: 10px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-content h2 {
    color: #1a365d;
    margin-bottom: 15px;
}

.modal-content p, .modal-content ol {
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-content ol {
    padding-left: 20px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #555;
}

/* 响应式设计优化 */
@media (max-width: 900px) {
    .aspect-ratio-container {
        width: 95%;
        padding-bottom: 60%; /* 从 70% 减小，例如改为 60% */
    }
    
    #animation-container {
        width: 95%; /* 在中等屏幕上使用更大的宽度百分比 */
        /* height 由 padding-bottom 控制，移除固定的 height */
    }
}

@media (max-width: 600px) {
    .aspect-ratio-container {
        padding-bottom: 120%; /* 从 150% 减小，例如改为 120% */
    }
    
    #animation-container {
        width: 100%; /* 在小屏幕上使用全部宽度 */
        /* height 由 padding-bottom 控制，移除固定的 height */
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 15px;
    }
}
