/* 引入一个适合小学生的可爱字体 (可选) */
@font-face {
    font-family: 'HappyFont';
    src: url('../fonts/your-cute-font.woff2') format('woff2');
}


body {
    /* 基础字体设置，使用圆体或者无衬线体 */
    font-family: 'Arial Rounded MT Bold', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    /* 柔和的背景色 */
    background-color: #f0f8ff; /* 爱丽丝蓝 */
    color: #333;
    line-height: 1.6;
}

/* 顶部导航条 */
.header {
    background: linear-gradient(135deg, #ff6b6b, #feca57); /* 温暖的渐变色 */
    padding: 20px 40px;
    text-align: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative; /* 为登录按钮提供定位上下文 */
}

.header .logo {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    text-decoration: none;
}

.header .logo a {
    color: inherit;
    text-decoration: none;
}

/* 主要内容区域 */
.main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* 欢迎标题 */
.welcome-text {
    text-align: center;
    font-size: 2.8rem;
    color: #ff6347; /* 番茄色 */
    margin-bottom: 40px;
    /* 简单的动画效果 */
    animation: bounceIn 1s ease;
}

/* 四大模块的网格布局 */
.module-grid {
    display: grid;
    /* 电脑上显示两列 */
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

/* 模块卡片 */
.module-card {
    background-color: #ffffff;
    border-radius: 25px; /* 更圆的角 */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    text-align: center;
    text-decoration: none;
    color: #333;
    /* 漂亮的过渡动画 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.module-card:hover {
    /* 鼠标悬停时 "浮起来" */
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

/* 卡片图标 */
.module-icon {
    font-size: 4.5rem; /* 大图标 */
    margin-bottom: 20px;
    /* 图标掉落动画 */
    animation: dropIn 0.5s ease-out;
}

/* 卡片标题 */
.module-card h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* 卡片描述 */
.module-card p {
    font-size: 1.1rem;
    color: #666;
}

/* 为四个模块设置不同的主题色 */
.card-1 h2 { color: #e74c3c; } /* 红色 - 家国 */
.card-2 h2 { color: #f39c12; } /* 橙色 - 文化 */
.card-3 h2 { color: #2ecc71; } /* 绿色 - 成长 */
.card-4 h2 { color: #3498db; } /* 蓝色 - 拓展 */

/* 底部 */
.footer {
    text-align: center;
    padding: 30px;
    margin-top: 40px;
    background-color: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    color: #aaa;
    font-size: 0.9rem;
}

/* ================================== */
/* ==== 新增的 CSS 样式 ==== */
/* ================================== */

/* --- 1. 顶部登录/注册按钮 --- */

/* 按钮的容器 */
.header-login {
    position: absolute; /* 绝对定位，浮动在右上角 */
    top: 50%;
    right: 40px;
    transform: translateY(-50%); /* 垂直居中 */
    display: flex; /* 使用 flex 布局让按钮并排 */
    gap: 15px; /* 按钮之间的间距 */
}

/* 统一的按钮基础样式 */
.button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px; /* 更圆润的胶囊形状 */
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
}

/* 悬停效果 (放大一点点) */
.button:hover {
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 注册按钮 (主按钮，更显眼) */
.button-register {
    background-color: #ff6347; /* 番茄红，醒目 */
    color: white;
}

/* 登录按钮 (次按钮，白色背景) */
.button-login {
    background-color: white;
    color: #ff6b6b; /* 呼应主题色 */
}

/* --- 2. 动画人物样式 --- */

.character-helper {
    position: fixed; 
    top: 80%; 
    right: 5%; 
    transform: translateY(-50%); 
    cursor: pointer;
    z-index: 1000;
    animation: bob 3s ease-in-out infinite; 
}

.character-body {
    padding: 0;
    line-height: normal;
    background: none; 
    box-shadow: none; 
}

/* 这是图片本身的样式 */
.character-image {
    max-width: 150px; 
    height: auto; 
    display: block; 
    /* 让所有变化都更平滑 */
    transition: transform 0.3s ease, filter 0.3s ease;
    /* 给图片一点默认的阴影，让它和背景分离 */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}


/* **** 这是新的悬停样式 **** */

/* 1. 悬停在整个区域时 (和以前一样) */
.character-helper:hover {
    animation-play-state: paused; /* 停止漂浮 */
    transform: translateY(-50%) scale(1.1); /* 放大 */
}

/* 2. (新!) 悬停时，修改图片本身 */
.character-helper:hover .character-image {
    /* 添加一个发光效果: 
      - drop-shadow 是一个带颜色的阴影 (我们用一点红色)
      - brightness(1.1) 让图片本身变亮 10%
    */
    filter: drop-shadow(0 6px 12px rgba(255, 107, 107, 0.6)) brightness(1.1);
    
    /* 让图片也稍微再放大一点点，更有层次感 */
    transform: scale(1.05); 
}
/* --- 3. 语音气泡样式 --- */

.speech-bubble {
    display: none; /* 默认隐藏 */
    opacity: 0; /* 默认透明，配合JS实现淡入 */
    position: absolute;
    bottom: 100px; /* 在人物上方，根据图片大小调整 */
    right: 150px; /* 位于人物左侧，根据图片大小调整 */
    width: 200px;
    background-color: #ffffff;
    color: #333;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    transition: opacity 0.5s ease; /* 淡入淡出动画 */
    
    /* 气泡的小尾巴 */
    --bubble-tail-size: 10px;
}

/* 使用 ::after 伪元素制作气泡的小尾巴 */
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: calc(var(--bubble-tail-size) * -1); /* 在气泡底部 */
    left: 80%; /* 相对气泡定位，指向人物 */
    transform: translateX(-50%); /* 居中尾巴 */
    width: 0;
    height: 0;
    /* 绘制一个向下的三角形 */
    border-left: var(--bubble-tail-size) solid transparent;
    border-right: var(--bubble-tail-size) solid transparent;
    border-top: var(--bubble-tail-size) solid #ffffff; /* 颜色和气泡背景一致 */
}
/* (新!) 管理员按钮 (灰色，用于区分) */
.button-admin {
    background-color: #f0f0f0; /* 浅灰色背景 */
    color: #555; /* 深灰色文字 */
}

.button-admin:hover {
    background-color: #e0e0e0;
}

/* ================================== */
/* ==== 动画效果定义 ==== */
/* ================================== */

/* 漂浮动画的定义 */
@keyframes bob {
    0% { transform: translateY(-50%); } /* 从垂直居中开始 */
    50% { transform: translateY(calc(-50% - 15px)); } /* 向上浮动15px */
    100% { transform: translateY(-50%); } /* 回到垂直居中 */
}

/* 欢迎文字动画 */
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* 卡片图标动画 */
@keyframes dropIn {
    0% { transform: translateY(-30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ================================== */
/* ==== 响应式调整 (手机) ==== */
/* ================================== */

@media (max-width: 768px) {
    /* 调整网格 */
    .module-grid {
        grid-template-columns: 1fr; /* 变为一列 */
        gap: 30px;
    }

    /* 调整头部 */
    .header {
        padding: 20px;
    }
    .header .logo {
        font-size: 2rem;
    }
    .welcome-text {
        font-size: 2.2rem;
    }
    .module-card h2 {
        font-size: 1.8rem;
    }

    /* 在手机上，让登录按钮回到Logo下方，而不是浮动 */
    .header-login {
        position: static;
        transform: none;
        margin-top: 15px;
        justify-content: center; /* 居中排列 */
        gap: 10px;
    }
    .button {
        padding: 8px 16px; /* 手机上按钮小一点 */
        font-size: 0.85rem;
    }

    /* 在手机上，人物小一点，位置也调整 */
    .character-helper {
        top: auto; /* 取消垂直居中 */
        bottom: 20px; /* 放在底部 */
        right: 10px; /* 靠右 */
        transform: translateY(0); /* 取消垂直居中修正 */
    }
    .character-image {
        max-width: 100px; /* 手机上图片更小 */
    }
    
    /* 手机上鼠标悬停放大动画的调整 */
    .character-helper:hover {
        transform: translateY(0) scale(1.1);
    }
    
    /* 手机上的漂浮动画 */
    @keyframes bob {
        0% { transform: translateY(0); }
        50% { transform: translateY(-10px); }
        100% { transform: translateY(0); }
    }

    /* 手机上气泡的位置和大小调整 */
    .speech-bubble {
        width: 150px;
        bottom: 80px; /* 在人物上方 */
        right: 110px; /* 相对人物左侧 */
        padding: 10px;
        font-size: 0.9rem;
    }
    .speech-bubble::after {
        left: 70%; /* 手机上尾巴对齐人物 */
    }
}