/* =================================================================
   1. 全局重置与基础布局 (Base & Layout)
   ================================================================= */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box; /* 核心：统一盒模型 */
    outline: none;
}

body {
    position: relative;
    margin: 0 auto;
    max-width: 640px; /* 移动端最大宽度限制 */
    background-color: #F0F9FF; /* 现代化浅灰背景#F5F7FA */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: #1D1D1F; /* 苹果深灰字色 */
    padding-bottom: 80px; /* 防止底部内容被悬浮按钮遮挡 */
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 隐藏滚动条但允许滚动 (可选，提升美观度) */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* =================================================================
   2. 顶部导航栏 (Sticky Navigation) - 渐变边框尊享版
   ================================================================= */
.course-nav {
    position: sticky;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    z-index: 100;
    /*background: rgba(245, 247, 250, 0.95);取消和背景暂时同一颜色*/
    backdrop-filter: blur(12px);
    /*border-bottom: 1px solid rgba(0,0,0,0.05);*/
}

.course-nav a {
    flex: 1;
    background: transparent;
    padding: 8px 0; /* 稍微减小一点内补，因为边框占了2px */
    border-radius: 16px;
    
    /* 【关键1】预先设置2px透明边框，防止选中时抖动 */
    border: 2px solid transparent; 
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 文字与图标容器 */
.nav-title {
    display: flex !important;
    align-items: center !important;
    justify-content: center;
    
    font-size: 16px;
    font-weight: 600;
    color: #98989E;
    line-height: 1;
    transition: transform 0.2s ease;
}

/* 图片素材样式 */
.nav-img {
    width: 28px;
    height: 28px;
    margin-right: 8px;
    display: block;
    object-fit: contain;
}

/* ============ 选中状态 (Active State) - 渐变边框核心 ============ */
.course-nav a.nav-active {
    /* 【关键2】双层背景实现圆角渐变边框
       第一层：linear-gradient(#fff, #fff) -> 纯白背景 (padding-box)
       第二层：linear-gradient(...) -> 蓝紫渐变 (border-box) 
    */
    background-image: linear-gradient(#fff, #fff), linear-gradient(135deg, #007AFF, #5856D6);
    background-origin: padding-box, border-box;
    background-clip: padding-box, border-box;
    
    /* 让边框显现 */
    border: 2px solid transparent;
    
    /* 蓝色系的弥散光晕，呼应边框 */
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.15); 
}

.course-nav a.nav-active .nav-title {
    color: #007AFF; /* 文字变蓝 */
    transform: scale(1.02);
}

.course-nav a:active .nav-title {
    transform: scale(0.95);
    opacity: 0.7;
}

/* =================================================================
   3. 头部视频与 Banner (Header Area)
   ================================================================= */
.fd-video {
    /*padding: 16px 16px 0 16px;*/
}

.fd-video-inner {
    position: relative;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.fd-video-img {
    width: 100%;
    display: block;
}

/* 播放按钮 */
.fd-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    pointer-events: none;
}

/* =================================================================
   4. 搜索框区域 (Search Bar) - 已修复清除按钮错位
   ================================================================= */
#search-container, #search-container-2 {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

#search-container > div, #search-container-2 > div {
    position: relative;
    width: 100%;
    max-width: 92%; /* 控制搜索框整体宽度 */
}

/* 搜索输入框 */
input[type="text"] {
    width: 100%;
    padding: 12px 40px 12px 40px !important; /* 左右留出空间给图标 */
    border: 1px solid #eee; /* 淡边框 */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    font-size: 14px;
    color: #333;
    -webkit-appearance: none; 
    outline: none;
    transition: border-color 0.2s;
}

/* 输入框聚焦时的效果 */
input[type="text"]:focus {
    border-color: #007AFF;
}

input::placeholder {
    color: #ccc;
}

/* 左侧搜索图标 */
.search-icon {
    position: absolute;
    top: 50%;
    left: 14px !important;
    transform: translateY(-50%); /* 垂直居中核心代码 */
    color: #aaa;
    pointer-events: none;
    font-size: 14px;
    z-index: 5;
}

/* 右侧清除按钮 (核心修复) */
#clear-button, #clear-button-2 {
    position: absolute; /* 关键：必须是绝对定位 */
    top: 50%;
    right: 12px !important;
    transform: translateY(-50%); /* 垂直居中核心代码 */
    
    background: transparent;
    border: none;
    color: #999;
    padding: 4px; /* 增加一点点击范围 */
    cursor: pointer;
    z-index: 10;  /* 保证在输入框上面 */
    
    /* 确保图标居中 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 清除按钮点击时的微反馈 */
#clear-button:active, #clear-button-2:active {
    opacity: 0.6;
    transform: translateY(-50%) scale(0.9);
}

/* =================================================================
   5. 游戏列表卡片 (Game Cards) - 核心展示区
   ================================================================= */
.fd-tutorial, .fd-problem, .fd-code {
    padding: 0 16px 16px 16px;
}

/* 核心修复：默认隐藏“更新日记”和“系列代码” */
.fd-problem, .fd-code {
    display: none;
}

/* 确保“精品代码”默认是显示的 */
.fd-tutorial {
    display: block;
}

/* ================= 列表分组标题 (居中时间轴风格) ================= */
h3 {
    position: relative;
    /* padding-left: 14px;  <-- 删除：居中不需要左边距留位了 */
    margin: 32px 0 16px 0;  /* 调整间距，让上下呼吸感更强 */
    
    font-size: 16px;        /* 字号微调大一点，撑起标题气场 */
    font-weight: 600;
    color: #666;         /* 稍微深一点的黑色，比纯蓝更耐看，配合蓝色装饰 */
    line-height: 1;
    
    display: flex;
    align-items: center;
    justify-content: center; /* 【关键】：内容水平居中 */
}

/* 左侧蓝色竖条装饰 - 改为跟随文字 */


/* 右侧 UPDATE 标识 */
h3::after {
    content: "更新";
    margin-left: 10px;       /* 增加间距 */
    font-size: 10px;
    font-weight: 800;        /* 更粗一点，像印章 */
    color: #007AFF;
    background: rgba(0, 122, 255, 0.12);
    padding: 3px 6px;        /* 稍微大一点 */
    border-radius: 6px;
    letter-spacing: 0.5px;   /* 字母间距，更精致 */
}

/* ================= 列表卡片 (回归紧凑版) ================= */
.app {
    display: flex;
    align-items: flex-start; /* 改为顶部对齐，防止高度不一致 */
    background-color: #fff;  /* 改为白色背景，更干净 */
    margin: 10px 10px;       /* 卡片间距 */
    padding: 10px;           /* 增加内部呼吸感 */
    border-radius: 12px;     /* 圆角稍微调大一点点 */
    /*box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);阴影*/
    box-shadow: 0 2px 6px #d0d0d0;
    position: relative;      /* 为角标定位 */
}

.app:active {
    background-color: #f9f9f9; /* 点击反馈 */
}

/* 左侧图标 */
.app img {
    width: 55px;  /* 稍微缩小一点图标，更精致 */
    height: 55px;
    margin-right: 12px; /* 调整间距 */
    border-radius: 12px;
    flex-shrink: 0; /* 防止被挤压 */
    background-color: #f0f0f0;
}

/* 右侧内容区域 */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 55px; /* 保证和图标等高 */
}

/* 标题区域 */
.app h2 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* 重点：红色链接恢复显示 */
.app h2 span {
    color: #FF0000;      /* 保持原来的红色 */
    font-size: 14px;     /* 稍微小一号 */
    font-weight: 400;    /* 稍微细一点，区分标题 */
    margin-left: 5px;
}

/* 描述行 (类型、人气、描述) */
.app p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

/* 小标签优化 (去除黑框，改为淡灰底色) */
.app p span {
    display: inline-block;
    color: #666;
    /*background-color: #F2F2F7;*/
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-right: 4px;
    /*border: none; */
    border: 1px solid #646566;
}

/* 描述文字 */
.app p c {
    display: block; /* 换行显示描述 */
    color: #999;
    font-size: 12px;
    margin-top: 4px;
    white-space: nowrap;      /* 单行显示 */
    overflow: hidden;         /* 超出隐藏 */
    text-overflow: ellipsis;  /* 省略号 */
    max-width: 240px;         /* 限制宽度防止撑开 */
}

/* ================= 搜索框微调 ================= */
#search-container input {
    border: 1px solid #eee; /* 加个淡边框 */
    padding: 10px 10px 10px 35px;
    border-radius: 8px;
}

/* =================================================================
   6. 排名角标与颜色 (Badges & Rankings)
   ================================================================= */
.rank-number, .new-tag {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    border-top-left-radius: 12px;
    border-bottom-right-radius: 10px;
    min-width: 20px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

/* ================= 🏆 前三名：荣耀渐变 ================= */

/* 🥇 冠军：红橙烈焰 */
.top-1 .rank-number { 
    background: linear-gradient(135deg, #FF3B30, #FF9500); 
    z-index: 12; 
    font-size: 11px; /* 冠军稍微大一点 */
}

/* 🥈 亚军：橙黄辉煌 */
.top-2 .rank-number { 
    background: linear-gradient(135deg, #FF9500, #FFCC00); 
    z-index: 11;
}

/* 🥉 季军：金黄璀璨 */
.top-3 .rank-number { 
    background: linear-gradient(135deg, #FFCC00, #FFDB4D); 
    color: #947600; /* 字色加深，保证在黄色背景下的清晰度 */
    z-index: 11;
}

/* ================= 🎖️ 4-10名：多彩精英 (iOS 配色) ================= */

/* 第4名：科技蓝 (Blue) */
.top-4 .rank-number { background: #1989fa; }

/* 第5名：深邃紫 (Indigo) */
.top-5 .rank-number { background: #e40fe7; }

/* 第6名：霓虹粉 (Pink) */
.top-6 .rank-number { background: #999; }

/* 第7名：清新青 (Teal) */
.top-7 .rank-number { background: #999; }

/* 第8名：健康绿 (Green) */
.top-8 .rank-number { background: #999; }

/* 第9名：活力橙 (Orange) */
.top-9 .rank-number { background: #999; }

/* 第10名：守门红 (Red) - 压轴 */
.top-10 .rank-number { 
    background: #999; 
    min-width: 24px; /* 两位数稍微宽一点 */
}

/* ================= 📄 11名以后：普通灰 ================= */
.default-rank .rank-number { 
    background: #999; /* 浅灰 */
    color: #fff; 
}

/* ✨ 新游标签 */
.new-tag {
    background: #34C759; /* 苹果绿 */
    border-radius: 10px 0 12px 0;
}

/* =================================================================
   7. 悬浮按钮 (Floating Actions) - 侧边吸附标签风格
   ================================================================= */
.fq-custommm, .fq-customm {
    position: fixed !important;
    right: 0 !important; /* 核心：彻底贴死右边 */
    z-index: 90;
    
    background: #FFFFFF !important; 
    color: #1D1D1F !important;
    
    /* 核心：左圆右方，形成“抽屉标签”的效果 */
    border-radius: 24px 0 0 24px !important;
    
    /* 内边距调整：左边大一点(圆角侧)，右边小一点(贴边侧) */
    padding: 8px 10px 8px 14px !important;
    
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none;
    
    /* 阴影改为主要向左下方投射，增加立体感 */
    box-shadow: -2px 2px 12px rgba(0,0,0,0.08) !important;
    
    /* 边框微调：去掉右边的边框 */
    border: 1px solid rgba(0,0,0,0.05) !important;
    border-right: none !important;
    
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease;
}

/* 点击时的反馈：向右缩进一点点 */
.fq-custommm:active, .fq-customm:active {
    transform: translateX(4px); /* 点击时“缩”进屏幕边缘 */
    background: #F2F2F7 !important;
}

/* 位置设定 */
.fq-customm {
    bottom: 140px !important; 
}

.fq-custommm {
    bottom: 190px !important; 
}

/* 图标大小微调 */
.fq-custommm img, .fq-customm img {
    width: 18px !important; /* 稍微改小一点，更精致 */
    height: 18px !important;
    filter: none !important;
    margin: 0 !important;
}

/* 返回顶部按钮 - 保持圆形，稍微靠边一点 */
#back-to-top {
    position: fixed !important;
    z-index: 90;
    right: 16px !important; /* 稍微靠边 */
    bottom: 100px !important;
    
    width: 40px; /* 稍微做小一点，减少干扰 */
    height: 40px;
    border-radius: 50% !important;
    
    background: #FFFFFF !important;
    color: #333 !important;
    
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}
/* =================================================================
   8. 弹窗与动画 (Modals & Animations) - Layer.js 适配
   ================================================================= */
/* 修复 Layer 弹窗在移动端的宽度 */
.layui-m-layer0 .layui-m-layerchild {
    width: 85% !important;
    max-width: 640px !important;
    border-radius: 16px !important;
    background-color: #fff !important;
}

.layui-layer-msg {
    border: none !important;
    background: rgba(0,0,0,0.8) !important;
    color: #fff !important;
    border-radius: 8px !important;
}

/* 复制成功的 SVG 动画 (原 HTML JS 中的样式提纯) */
.circle-copy, .circle-load, .circle-done { stroke-dasharray: 63; stroke-dashoffset: 63; }
.tick-copy, .tick-load, .tick-done { stroke-dasharray: 20; stroke-dashoffset: 20; }

@keyframes circle { from { stroke-dashoffset: 63; } to { stroke-dashoffset: 0; } }
@keyframes tick { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }

/* 视频模态框 */
.video-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    z-index: 1999;
}
/* =================================================================
   9. 导航栏引导气泡 (Navigation Tips)
   ================================================================= */
.course-nav a {
    position: relative; /* 确保气泡能相对于按钮定位 */
}

.nav-tip {
    position: absolute;
    top: -30px; /* 悬浮在按钮上方 */
    left: 50%;
    transform: translateX(-50%);
    
    /*background: rgba(0, 0, 0, 0.85); */
    background: #007aff;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 101;
    pointer-events: none; /* 关键：让点击穿透气泡，防止遮挡按钮点击 */
    
    /* 上下浮动动画 */
    animation: tip-bounce 1.5s infinite ease-in-out;
}

/* 小三角箭头 */
.nav-tip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: #007aff transparent transparent transparent;
}

/* 隐藏状态 class */
.nav-tip.tip-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px); /* 下沉消失 */
}

/* 浮动动画关键帧 */
@keyframes tip-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}
/* =================================================================
   10. 右侧悬浮工具栏 (Floating Toolbar - 彩蛋菜单 & 返回顶部)
   ================================================================= */
.floating-toolbar {
    position: fixed;
    right: 16px;
    bottom: 100px; /* 距离底部的位置，留出导航栏空间 */
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 12px; /* 两个按钮之间的间距 */
    align-items: flex-end; /* 靠右对齐 */
}

/* --- 通用圆形悬浮按钮 --- */
.floating-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性过渡 */
    -webkit-tap-highlight-color: transparent;
    padding: 0; /* 清除默认内边距 */
}

.floating-btn:active {
    transform: scale(0.9); /* 点击缩小反馈 */
}

/* 彩蛋按钮 - 暖色渐变 */
.gradient-btn {
    background: linear-gradient(135deg, #FF9500, #FF3B30);
    /* 简单的呼吸动画，吸引注意 */
    animation: pulse-orange 2s infinite;
}

/* 返回顶部按钮 - 深色半透明 */
.dark-btn {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* --- 彩蛋菜单容器 (用于定位弹出层) --- */
.side-menu-container {
    position: relative;
}

/* --- 弹出的菜单气泡面板 --- */
.menu-popover {
    position: absolute;
    bottom: 60px; /* 在触发按钮上方 */
    right: 0;
    width: 180px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 16px;
    
    /* 默认隐藏状态 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9); /* 下沉且缩小 */
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right; /* 从右下角弹出 */
    z-index: 901;
}

/* 激活状态 - 显示菜单 */
.menu-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 气泡标题 */
.popover-title {
    font-size: 13px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 12px;
    text-align: center;
}

/* 菜单项列表 */
.popover-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 单个菜单项按钮 */
.popover-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #F5F7FA;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.popover-item:active {
    background: #ECEEF2;
}

.popover-item img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}
/* 图片图标样式 */
.float-icon {
    width: 32px;  /* 根据你的素材实际大小调整 */
    height: 32px;
    display: block;
    object-fit: contain;
    pointer-events: none; /* 防止点击图片时不触发按钮事件 */
}
/* 呼吸动画定义 */
@keyframes pulse-orange {
    0% { box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3); }
    50% { box-shadow: 0 4px 18px rgba(255, 59, 48, 0.5); }
    100% { box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3); }
}
/* =================================================================
   12. 顶部滚动公告栏 (Notice Bar)
   ================================================================= */
.notice-bar {
    background: #FFFBE6; /* 柔和的奶黄色背景 */
    color: #FF9500;      /* 活力橙文字 */
    height: 36px;
    display: flex;
    align-items: center;
    font-size: 13px;
    padding: 0 12px;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid rgba(255, 149, 0, 0.1); /* 淡淡的底边框 */
}

/* 左侧固定标题 (带喇叭) */
.notice-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    white-space: nowrap;
    z-index: 2;
    background: #FFFBE6; /* 遮住后面滚动的字 */
    padding-right: 8px;
    box-shadow: 10px 0 15px #FFFBE6; /* 边缘羽化，让文字消失得自然 */
}

/* 滚动区域容器 */
.notice-scroller {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* 滚动的文字本体 */
.notice-text {
    white-space: nowrap;
    display: inline-block;
    /* 核心动画：从右向左匀速滚动 */
    animation: marquee-scroll 15s linear infinite;
    padding-left: 100%; /* 初始位置在最右边外面 */
}

/* 动画关键帧 */
@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%) translateX(-200px); } /* 多移一点确保完全滚出去 */
}