/* ============================================
   儿童趣味化学实验站 - 专业儿童教育风格
   ============================================ */

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

:root {
    /* 主色调 */
    --primary: #4FC3F7;
    --primary-light: #B3E5FC;
    --primary-dark: #29B6F6;

    /* 辅助色 */
    --accent-yellow: #FFC107;
    --accent-green: #81C784;
    --accent-pink: #F8BBD0;
    --accent-purple: #BA68C8;
    --accent-orange: #FFB74D;

    /* 背景色 */
    --bg-white: #FFFFFF;
    --bg-soft: #FAFCFE;
    --bg-light: #F0F8FF;

    /* 文字色 */
    --text-primary: #2C3E50;
    --text-secondary: #5A6C7D;
    --text-muted: #95A5A6;

    /* 圆角 */
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(79, 195, 247, 0.1);
    --shadow: 0 4px 20px rgba(79, 195, 247, 0.15);
    --shadow-lg: 0 12px 40px rgba(79, 195, 247, 0.2);

    /* 字体 */
    --font-cute: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

html, body {
    background: var(--bg-soft);
    color: var(--text-primary);
    font-family: var(--font-cute);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============ 顶部导航 ============ */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-white);
    padding: 16px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-light);
    border-radius: var(--radius);
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
}

.back-home:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-3px);
}

.back-icon {
    font-size: 18px;
    font-weight: 700;
}

.site-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-emoji {
    font-size: 36px;
}

.title-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 1px;
}

.header-spacer {
    width: 120px;
}

/* ============ 分类标签 ============ */
.category-tabs {
    background: var(--bg-white);
    padding: 24px 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 76px;
    z-index: 90;
}

.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-soft);
    border: 3px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
}

.tab-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(79, 195, 247, 0.4);
}

.tab-icon {
    font-size: 24px;
}

.tab-name {
    font-size: 15px;
}

.tab-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

.tab-btn:not(.active) .tab-count {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ============ 主内容区 ============ */
.experiment-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px;
}

.section-title-area {
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.section-desc {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ============ 实验卡片网格 ============ */
.experiment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.exp-card {
    background: var(--bg-white);
    border: 3px solid var(--bg-light);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.exp-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(79, 195, 247, 0.05) 100%);
    pointer-events: none;
}

.exp-card.theme-blue { border-color: var(--primary-light); }
.exp-card.theme-blue:hover { border-color: var(--primary); }

.exp-card.theme-yellow { border-color: #FFE082; }
.exp-card.theme-yellow:hover { border-color: var(--accent-yellow); }

.exp-card.theme-green { border-color: #C5E1A5; }
.exp-card.theme-green:hover { border-color: var(--accent-green); }

.exp-card.theme-pink { border-color: #F8BBD0; }
.exp-card.theme-pink:hover { border-color: #EC407A; }

.exp-card.theme-purple { border-color: #D1C4E9; }
.exp-card.theme-purple:hover { border-color: var(--accent-purple); }

.exp-card.theme-orange { border-color: #FFCC80; }
.exp-card.theme-orange:hover { border-color: var(--accent-orange); }

.exp-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.exp-card-icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
    line-height: 1;
    position: relative;
    z-index: 1;
    transition: transform 0.3s;
}

.exp-card:hover .exp-card-icon {
    transform: scale(1.1) rotate(-5deg);
}

.exp-card-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.exp-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    min-height: 44px;
    position: relative;
    z-index: 1;
}

.exp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 16px;
    border-top: 2px dashed var(--bg-light);
    position: relative;
    z-index: 1;
}

.exp-card-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.exp-card-diff {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
}

.exp-card-diff.easy { background: #E8F5E9; color: var(--accent-green); }
.exp-card-diff.medium { background: #FFF8E1; color: #F57C00; }
.exp-card-diff.hard { background: #FFEBEE; color: #E53935; }

.exp-card-start {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.exp-card:hover .exp-card-start i {
    transform: translateX(4px);
}

.exp-card-start i {
    transition: transform 0.3s;
}

/* ============ 实验弹窗 ============ */
.experiment-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.experiment-modal.active {
    display: flex;
}

.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-soft);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--accent-pink);
    color: white;
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 80px 20px 28px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #E1F5FE 100%);
}

.modal-icon {
    font-size: 64px;
    line-height: 1;
    flex-shrink: 0;
}

.modal-title-area {
    flex: 1;
}

.modal-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    background: var(--bg-soft);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

/* ============ 步骤面板 ============ */
.steps-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    align-self: start;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-soft);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.step-item.active {
    background: #E1F5FE;
    border-color: var(--primary);
    transform: scale(1.02);
}

.step-item.completed {
    opacity: 0.6;
}

.step-item.completed .step-text {
    text-decoration: line-through;
}

.step-num {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-item.completed .step-num {
    background: var(--accent-green);
}

.step-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 4px;
}

/* ============ 实验工作台 ============ */
.lab-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.lab-bench {
    min-height: 400px;
    background: linear-gradient(180deg, #FAFCFE 0%, #F0F8FF 100%);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

/* ============ 弹窗底部 ============ */
.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-white);
    border-top: 1px solid var(--bg-light);
}

.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px solid;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.btn-reset {
    border-color: #FFAB91;
    color: #E64A19;
}

.btn-reset:hover {
    background: #FFAB91;
    color: white;
    transform: translateY(-2px);
}

.btn-exit {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-exit:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ============ 结果弹窗 ============ */
.result-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
    animation: fadeIn 0.3s;
}

.result-popup.active {
    display: flex;
}

.result-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    border: 4px solid var(--accent-yellow);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-icon {
    font-size: 80px;
    margin-bottom: 16px;
    line-height: 1;
}

.result-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.result-content {
    text-align: left;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
}

.result-content::-webkit-scrollbar {
    width: 6px;
}

.result-content::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

.result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.result-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-soft);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ============ 实验台内通用元素 ============ */
.beaker {
    position: absolute;
    width: 120px;
    height: 140px;
    cursor: pointer;
    transition: all 0.2s;
}

.beaker:hover {
    transform: scale(1.05);
}

.beaker .beaker-label {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid #8B8B8B;
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.beaker .beaker-glass {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 120px;
    background: rgba(255, 255, 255, 0.7);
    border: 4px solid #8B8B8B;
    border-top: none;
    border-radius: 0 0 12px 12px;
}

.beaker .beaker-liquid {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    height: 0;
    background: transparent;
    border-radius: 0 0 8px 8px;
    transition: all 1s ease-in-out;
}

.interactive-item {
    position: absolute;
    cursor: pointer;
    user-select: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
    text-align: center;
}

.interactive-item:hover {
    transform: scale(1.1);
}

.interactive-item:active {
    transform: scale(0.95);
}

.interactive-item .item-emoji {
    font-size: 56px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    line-height: 1;
}

.interactive-item .item-label {
    display: inline-block;
    margin-top: 4px;
    background: white;
    border: 1.5px solid var(--primary);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--primary-dark);
    font-weight: 600;
    white-space: nowrap;
}

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .top-header { padding: 14px 24px; }
    .title-text { font-size: 20px; }
    .category-tabs { padding: 16px 24px; grid-template-columns: repeat(2, 1fr); top: 70px; }
    .experiment-main { padding: 24px; }
    .modal-body { grid-template-columns: 1fr; }
    .steps-panel { order: 2; }
    .lab-panel { order: 1; }
}

@media (max-width: 640px) {
    .top-header {
        flex-direction: row;
        padding: 12px 16px;
    }
    .back-home span:not(.back-icon) { display: none; }
    .title-text { font-size: 16px; }
    .title-emoji { font-size: 28px; }
    .header-spacer { width: 0; }
    .category-tabs { padding: 12px 16px; gap: 8px; }
    .tab-btn { padding: 10px 12px; font-size: 13px; }
    .tab-name { font-size: 13px; }
    .experiment-main { padding: 16px; }
    .experiment-grid { grid-template-columns: 1fr; gap: 16px; }
    .section-title { font-size: 24px; }
    .modal-content { max-height: 95vh; }
    .modal-header { padding: 20px 50px 16px 20px; }
    .modal-icon { font-size: 48px; }
    .modal-title { font-size: 22px; }
    .modal-body { padding: 16px; }
}

/* ============ 动画 ============ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes bubbleUp {
    0% { transform: translateY(0); opacity: 0.3; }
    50% { opacity: 1; }
    100% { transform: translateY(-20px); opacity: 0; }
}