/*
 * 首页样式。
 *
 * 来源：从旧站 index.php 的 <style> 块整段抽出（旧文件第 171~826 行，
 * 658 行内联 CSS）。刻意在视觉上做零改动 —— 阶段 ③ 的目标是把样子搬过来，
 * 不是顺手重做设计。所有选择器、数值、动画时长都保持原样。
 *
 * 做过的四处改动：
 *   1. 图片路径 ./img/ 与 ../img/ 统一改成 /assets/img/。
 *      旧站中文版与英文版是两份文件、两套相对路径，新站只有一份。
 *   2. 语言相关的背景图改成用 body 上的语言类切换（见文件末尾），
 *      不再靠两份文件各写一份。
 *   3. 缩进统一去掉一层（原先嵌在 HTML 里多缩进了一级）。
 *   4. 补 .toggle-option { text-decoration: none }（见文件末尾）：
 *      语言切换的两个选项新站改成了 <a>，旧站是 <div>，不改这条会多两条下划线。
 *
 * 已知问题，不在本阶段改：
 *   - 语言切换按钮（.toggle-*）的规则被重复写了两遍，是旧站留下的冗余。
 *     因为两条规则完全相同，重复不影响结果，所以先原样保留。
 *   - 底部导航图标依赖 Font Awesome 的外部 CDN，见 home.php 里的说明。
 *   - 仍有若干 !important，是旧站为覆盖内联样式留下的，暂不动。
 */
/* 添加星星连线消失动画 */
@keyframes line-disappear {
    0% { width: var(--line-width); }
    100% { width: 0; }
}

.line-disappear {
    animation: line-disappear 0.1s ease-out forwards !important;
}

/* AI聊天悬浮图标样式 - 修改为使用图片并添加文字 */
.ai-chat-float {
    position: fixed;
    bottom: 80px; /* 在底部菜单上方 */
    right: 20px;
    width: 60px;
    height: 80px; /* 增加高度以容纳文字 */
    background: url('/assets/img/aiicon.png') no-repeat center top;
    background-size: 60px 60px; /* 保持图片大小不变 */
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    text-decoration: none;
    padding-top: 60px; /* 为图片预留空间 */
}

.ai-chat-float:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

/* 添加文字样式 */
.ai-chat-float-text {
    font-size: 12px;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
    margin-top: 2px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}

/* 隐藏原来的图标 */
.ai-chat-float i {
    display: none;
}

/* 小红点样式 */
.red-dot {
    position: absolute;
    top: 8px; /* 调整到图片区域的右上角 */
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.red-dot.show {
    opacity: 1;
    transform: scale(1);
}

/* 抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.ai-chat-float.shake {
    animation: shake 0.8s ease-in-out;
}

/* SEO优化：隐藏的H1标题 */
.seo-heading {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* 其他样式保持不变 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #111827;
    color: #e5e7eb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 50px; /* 为底部菜单留出空间 */
}

.zhuye {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #1f2e55;
    padding-top: 0;
    margin: 0 auto;
    background-image: url('/assets/img/bg.svg');
    background-size: 100%;
    background-position-y: 40px;
    background-repeat: no-repeat;
    background-color: #1b1a10;
    padding-bottom: 20px; /* 新增：为底部菜单留出空间 */
}

/* 重构顶部固定栏 */
.top-fixed {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(40, 40, 60, 0.95);
    color: #c8cbd6;
    height: 40px;
    overflow: hidden;
    padding: 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 跑马灯容器 - 左浮动80% */
.marquee-wrapper {
    float: left;
    width: 72%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

.marquee-container {
    display: inline-block;
    animation: marquee linear infinite;
    padding-left: 100%;
    will-change: transform;
    white-space: nowrap;
}

.marquee-text {
    display: inline-block;
    line-height: 40px;
    font-size: 18px;
    color: #e0e0ff;
    padding-right: 50px;
}

/* 语言切换按钮容器 - 右浮动20%（里面的 .lang-switch 由 lang-switch.css 统一定义） */
.language-toggle {
    float: right;
    width: 28%;
    height: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-left: 10px;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* 清除浮动 */
.top-fixed:after {
    content: "";
    display: table;
    clear: both;
}

/* 响应式调整 */
@media (max-width: 420px) {
    .marquee-text {
        font-size: 16px;
    }
    
    /* 移动端调整悬浮图标大小 */
    .ai-chat-float {
        width: 60px; /* 保持60px */
        height: 75px; /* 调整高度 */
        bottom: 75px;
        right: 15px;
        font-size: 22px;
        background-size: 55px 55px; /* 稍微调整图片大小 */
        padding-top: 55px; /* 相应调整padding */
    }
    
    .ai-chat-float-text {
        font-size: 11px; /* 移动端文字稍小 */
    }
}

@media (max-width: 380px) {
    .marquee-text {
        font-size: 11px;
        line-height: 38px;
    }
    
    .top-fixed {
        height: 38px;
    }
    
    .marquee-wrapper {
        width: 70%;
    }
    
    .language-toggle {
        width: 30%;
    }
}

@media (max-width: 350px) {
    .marquee-text {
        font-size: 10px;
    }
    
    .ai-chat-float {
        width: 55px; /* 稍微调整宽度 */
        height: 70px; /* 调整高度 */
        bottom: 70px;
        right: 10px;
        font-size: 20px;
        background-size: 50px 50px; /* 调整图片大小 */
        padding-top: 50px; /* 相应调整padding */
    }
    
    .ai-chat-float-text {
        font-size: 10px; /* 更小屏幕文字更小 */
    }
}

/* 修改.elementBackground的高度为动态计算 */
.elementBackground {
    position: relative;
    width: 100%;
    /* 先用背景图的宽高比（935.91 × 1623.68，见 assets/img/bg.svg）把高度占住。
       不给这个占位的话，window.load 之前容器高度是 0 —— 两个子元素
       （.EightDiagrams / .starsContainer / .infoBtn）都是 position:absolute，
       撑不起高度 —— 图片一到位整页往下猛跳一次，用户看到的就是「卡一下」。
       JS 之后按实际宽度覆写 height，两者只差 25px，肉眼无感。 */
    aspect-ratio: 935.91 / 1623.68;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 2px; /* 为底部元素留出空间 */
}

.EightDiagrams {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    inset: 0px;
    max-width: 240px;
    max-height: 240px;
    margin: 0 auto;
    margin-top: 10rem;
}

.rotate-layer {
    position: absolute;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
}

.rotate-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer-1 { width: 30%; height: 30%; }
.layer-2 { width: 50%; height: 50%; }
.layer-3 { width: 70%; height: 70%; }
.layer-4 { width: 84%; height: 84%; }
.layer-5 { width: 100%; height: 100%; }

.rotate-continuously { animation: rotate linear infinite; }
.rotate-reverse { animation: rotate linear infinite reverse; }

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.starsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* 添加隔离层防止影响其他元素 */
    contain: strict;
    isolation: isolate;
}

.star-text, .animated-star {
    position: absolute;
    opacity: 0;
    z-index: 10;
    /* 确保星星不会影响布局 */
    transform: translateZ(0);
    will-change: transform, opacity;
}

.star-text {
    width: 42px;
    z-index: 199;
}

.animated-star {
    width: 38px;
    z-index: 99;
}

@keyframes star-fly-in {
    0% { opacity: 0; transform: translateX(10px) scale(5.5); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes star-flash {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.star-text.pojun { left: 1.9rem; top: 23.3rem; }
.animated-star.animated-star1 { left: 2rem; top: 23.9rem; }
.star-text.wuqu { left: 6.3rem; top: 23.3rem; }
.animated-star.animated-star2 { left: 6.3rem; top: 24rem; }
.star-text.lianzhen { left: 9.5rem; top: 25.6rem; }
.animated-star.animated-star3 { left: 9.5rem; top: 26.3rem; }
.star-text.wenqu { right: 10.1rem; top: 27.6rem; }
.animated-star.animated-star4 { right: 10.4rem; top: 28.3rem; }
.star-text.lucun { right: 10.4rem; top: 33.7rem; }
.animated-star.animated-star5 { right: 10.4rem; top: 32.2rem; }
.star-text.jumen { right: 4.1rem; top: 34.9rem; }
.animated-star.animated-star6 { right: 4.1rem; top: 33.4rem; }
.star-text.tanlang { right: 1.8rem; top: 29.5rem; }
.animated-star.animated-star7 { right: 2rem; top: 30rem; }

.animated-star.animated-star01 { left: 3.4rem; top: 21.8rem; }
.animated-star.animated-star02 { left: 4.1rem; top: 25.6rem; }

.animated-star.animated-star01,
.animated-star.animated-star02 {
    opacity: 1 !important;
    animation: star-flash 2s ease-in-out infinite;
    transform: scale(0.8);
}

.infoBtn {
    position: absolute;
    top:35rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 260px;
    text-align: center;
    z-index: 100;
}

/* 当屏幕高度不足时调整infoBtn位置 */
@media (max-height: 700px) {
    .infoBtn {
        top: 34rem; /* 在矮屏幕上上移按钮 */
    }
}

@media (max-height: 600px) {
    .infoBtn {
        top: 24rem; /* 在更矮屏幕上进一步上移 */
    }
}

.btn-pulse { animation: pulse 2s infinite; }
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.scale-animation { animation: scalePulse 2s ease-in-out infinite; }
@keyframes scalePulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

.anan {
    width: 78%;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.registerurl {
    background: #1f2e55;
    height: 30px;
    margin: 0 auto;
    font-size: 15px;
    color: #fff;
    text-align: center;
    padding: 2rem 0;
}

.content-area { padding: 1.5rem; }
.content-images { display: flex; flex-direction: column; gap: 20px; }
.content-images img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.footer {
    background: #1b1a10;
    width: 100%;
    padding: 1px 0 20px 0; /* 增加上边距 */
    text-align: center;
    position: relative;
    z-index: 10; /* 确保在底部菜单上方 */
}

.facai { font-size: 13px; }

/* 底部导航栏样式已抽到 assets/css/bottom-nav.css（首页与报告/用户页单独引入） */



/* 星星连线样式 */
.star-line {
    position: absolute;
    height: 3px;
    background-color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
    transform-origin: 0 50%;
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.line-appear {
    opacity: 1;
    animation: line-pulse 0.8s ease-in-out infinite;
}

@keyframes line-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 页面过渡效果 */
.page-transition {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0.7; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- 语言相关 ----
 * 旧站的做法是：中文版 index.php 写 bg.svg、英文版 En/index.php 写 bg_en.svg，
 * 两份文件各 1200 行，除了路径几乎一模一样 —— 改一个样式要改两处，
 * 漏改一处就中英不一致。新站只有一份样式表，用 body 上的语言类来区分。
 * 这条规则放在文件末尾，靠「后写」覆盖上面的默认值，不改原有选择器的特异性。 */
body.lang-en .zhuye {
    background-image: url('/assets/img/bg_en.svg');
}

/* 语言切换的两个选项在新站是 <a>（旧站是 <div>，靠 JS 改 location）。
 * 下划线已由 lang-switch.css 的 .lang-switch__opt { text-decoration: none } 统一处理，
 * 这里不再单独写。组件样式集中在一处，便于两页复用。 */
