:root {
    /* === 核心色板 (Duolingo Palette) === */
    --primary: #58cc02; 
    --primary-dark: #46a302;
    --primary-light: #d7ffb8; 
    --blue: #1cb0f6; 
    --blue-dark: #1899d6;
    --blue-light: #ddf4ff; 
    --orange: #ff9600; 
    --orange-dark: #cc7800;
    --yellow: #ffc800; 
    --yellow-dark: #e5b400;
    --red: #ff4b4b; 
    --red-dark: #d50000;
    --red-light: #ffdfe0; 
    --purple: #ce82ff; 
    --purple-dark: #a568cc;

    --gray: #e5e5e5; 
    --gray-dark: #cfcfcf; 
    --text: #4b4b4b; 
    --text-light: #afafaf;
    --bg: #fff;

    --sidebar-width: 250px;
    --right-sidebar-width: 420px; 
    
    --level-0: #ebedf0;
    --level-1: #9be9a8;
    --level-2: #40c463;
    --level-3: #30a14e;
    --level-4: #216e39;
}

body { margin: 0; background: #fff; font-family: "Segoe UI", system-ui, sans-serif; color: var(--text); overflow-x: hidden; }

/* === 布局框架 === */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

/* === 移动端顶部栏 === */
.mobile-top-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 50px;
    background: #fff; border-bottom: 2px solid var(--gray); z-index: 1000;
    display: flex; justify-content: space-around; align-items: center;
}
.top-item { font-weight: bold; color: var(--text-light); font-size: 14px; display: flex; align-items: center; gap: 5px; }

/* === 导航栏 === */
.main-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 70px;
    background: #fff; border-top: 2px solid var(--gray);
    display: flex; justify-content: space-around; align-items: center; z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-logo { display: none; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-light); cursor: pointer; }
.nav-item.active { color: var(--blue); }
.nav-icon { font-size: 24px; }
.nav-text { font-size: 10px; font-weight: bold; text-transform: uppercase; margin-top: 4px; }

/* === 内容区域 === */
.content-area {
    flex: 1; padding: 70px 20px 100px; 
    width: 100%; box-sizing: border-box; display: flex; justify-content: center;
}
.view-section { width: 100%; max-width: 600px; display: none; animation: fadeIn 0.3s; position: relative; }
.view-section.active { display: block; }

/* === 右侧侧边栏 === */
.right-sidebar { display: none; }

/* === 响应式：大屏布局 === */
@media (min-width: 1024px) {
    .mobile-top-bar { display: none; }
    .app-layout { flex-direction: row; align-items: flex-start; }
    
    .main-nav {
        width: var(--sidebar-width); height: 100vh; position: sticky; top: 0;
        border-top: none; border-right: 2px solid var(--gray);
        flex-direction: column; justify-content: flex-start; padding: 20px;
        z-index: 1000; 
        flex-shrink: 0; 
    }
    .nav-logo { display: block; font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 30px; width: 100%; padding-left: 10px; }
    .nav-item { flex-direction: row; width: 90%; height: 50px; flex: none; justify-content: flex-start; padding-left: 20px; border-radius: 12px; margin-bottom: 5px; }
    .nav-item:hover { background: #f7f7f7; }
    .nav-item.active { background: var(--blue-light); border: 2px solid var(--blue); color: var(--blue); }
    .nav-icon { margin-right: 20px; font-size: 28px; } .nav-text { font-size: 16px; letter-spacing: 1px; }

    .content-area {
        padding-top: 40px; 
        width: 640px;      
        flex: none;        
        margin-left: auto; 
    }

    .right-sidebar {
        display: block; width: var(--right-sidebar-width); 
        position: sticky; top: 20px; 
        padding: 20px 40px 20px 20px; box-sizing: border-box;
        height: auto;
        flex-shrink: 0; 
        margin-right: auto; 
    }
}

/* =========================================
   组件：顶部数据行 (Stats Row)
   ========================================= */
.stats-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px; padding: 0 10px;
}
.stat-pill { display: flex; align-items: center; font-weight: 800; color: var(--text-light); font-size: 15px; transition: color 0.3s; }
.stat-pill:hover { filter: brightness(0.9); cursor: pointer; }
.stat-pill img, .stat-pill span.icon { width: 28px; height: 28px; margin-right: 8px; font-size: 24px; }

.stat-pill.fire { color: var(--orange); }
.stat-pill.gem { color: var(--blue); }
.stat-pill.xp { color: var(--yellow); }
.stat-pill.power { color: var(--primary); } 
.stat-pill.pen { color: var(--blue); }      

@keyframes pop-scale {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
.stat-change-anim { animation: pop-scale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* =========================================
   组件：个人勤勉度 & 广告
   ========================================= */
.module-box { border: 2px solid var(--gray); border-radius: 16px; padding: 20px; margin-bottom: 20px; background: #fff; }
.module-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.module-link { font-size: 14px; color: var(--blue); cursor: pointer; text-transform: uppercase; font-weight: bold; }
.diligence-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.d-day { aspect-ratio: 1; border-radius: 4px; background: var(--level-0); position: relative; cursor: pointer; }
.d-day:hover { transform: scale(1.2); z-index: 2; border: 1px solid rgba(0,0,0,0.1); }
.d-day[data-level="1"] { background: var(--level-1); }
.d-day[data-level="2"] { background: var(--level-2); }
.d-day[data-level="3"] { background: var(--level-3); }
.d-day[data-level="4"] { background: var(--level-4); }

.super-card { border: 2px solid var(--gray); border-radius: 16px; overflow: hidden; background: #fff; text-align: center; padding-bottom: 20px; }
.super-header { background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%); padding: 15px; color: white; display: flex; align-items: center; justify-content: center; }
.super-content { padding: 20px; }
.super-title { font-size: 18px; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.super-text { font-size: 14px; color: #777; margin-bottom: 20px; line-height: 1.5; font-style: italic; }
.super-btn { background: var(--purple); color: white; border: none; padding: 12px 30px; border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer; width: 80%; box-shadow: 0 4px 0 var(--purple-dark); transition: 0.1s; }
.super-btn:active { transform: translateY(4px); box-shadow: none; }

.btn-main { width: 100%; padding: 15px; border-radius: 16px; border: none; background: var(--primary); color: white; font-size: 15px; font-weight: 800; box-shadow: 0 4px 0 var(--primary-dark); cursor: pointer; text-transform: uppercase; letter-spacing: 1px; transition: 0.1s; }
.btn-main:active { transform: translateY(4px); box-shadow: none; margin-top: 4px; }


/* =========================================
   组件：地图节点与全局吸顶标题 (Global Sticky Header)
   ========================================= */

/* 1. 全局唯一的吸顶标题容器 (改用Class选择器) */
.global-unit-header {
    position: sticky;
    top: 50px; /* 移动端：避开顶栏 */
    z-index: 100; /* 保证层级最高 */
    
    color: white; 
    padding: 18px 20px; 
    border-radius: 16px; 
    text-align: left; 
    box-shadow: 0 5px 0 rgba(0,0,0,0.15); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px;
    
    transition: background-color 0.2s ease-out;
}

@media (min-width: 1024px) {
    .global-unit-header { top: 20px; } /* PC端位置 */
}

/* 2. 关卡区块 */
.unit-block { 
    text-align: center; 
    margin-bottom: 0; 
    padding-bottom: 40px;
    position: relative; 
}

/* 3. 灰线分割区 */
.unit-divider {
    display: flex; align-items: center; text-align: center;
    color: var(--text-light); font-weight: 800; font-size: 18px;
    margin: 20px 0 40px 0; 
}
.unit-divider::before, .unit-divider::after {
    content: ''; flex: 1; border-bottom: 2px solid var(--gray);
}
.unit-divider span { padding: 0 20px; }

/* 标题内部元素 */
.uh-info { flex: 1; }
.uh-phase { font-size: 14px; font-weight: 800; opacity: 0.9; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.uh-title { font-size: 20px; font-weight: 800; margin: 0; }
.uh-guide-btn {
    background: rgba(0,0,0,0.15); color: white; border: none; padding: 10px 15px; border-radius: 12px;
    font-weight: 800; font-size: 14px; cursor: pointer; display: flex; align-items: center;
    transition: 0.1s; box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}
.uh-guide-btn:active { transform: translateY(4px); box-shadow: none; margin-top: 4px; }

/* 关卡节点容器 */
.nodes-wrapper {
    display: flex; flex-direction: column; align-items: center;
}

/* 关卡地图按钮 */
.node-container { height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.node { width: 70px; height: 70px; border-radius: 50%; border: none; font-size: 32px; cursor: pointer; position: relative; background: #fff; box-shadow: 0 6px 0 var(--gray); transition: 0.1s; z-index: 2; }
.node:active { transform: translateY(4px); box-shadow: none; }
.node.current { background: var(--primary); color: white; box-shadow: 0 6px 0 var(--primary-dark); }
.node.locked { background: var(--gray); color: #ccc; cursor: not-allowed; box-shadow: none; }
.node.completed { background: var(--yellow); color: white; box-shadow: 0 6px 0 var(--yellow-dark); }
.node-container:nth-child(even) .node { transform: translateX(50px); }
.node-container:nth-child(odd):not(:first-child) .node { transform: translateX(-50px); }

/* === 战力统计等保持不变 === */
.cute-card { background: #fff; border: 2px solid var(--gray); border-radius: 20px; padding: 20px; margin-bottom: 20px; box-shadow: 0 5px 0 #f0f0f0; }
.chart-wrapper { width: 100%; height: 300px; position: relative; margin: 0 auto; }
.stats-grid { display: flex; gap: 15px; }
.stat-box { flex: 1; border-radius: 16px; padding: 15px; color: white; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.stat-box.blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-dark); }
.stat-box.orange { background: var(--orange); box-shadow: 0 4px 0 var(--orange-dark); }
.stat-val { font-size: 28px; font-weight: 800; } .stat-label { font-size: 12px; opacity: 0.9; }

.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #fff; z-index: 2000; display: none; flex-direction: column; }
.overlay.active { display: flex; }
.quiz-header { padding: 15px 20px; display: flex; align-items: center; border-bottom: 2px solid var(--gray); flex-shrink: 0; }
.progress-track { flex: 1; height: 16px; background: var(--gray); border-radius: 8px; margin-left: 20px; overflow: hidden; }
#quiz-progress { height: 100%; background: var(--primary); width: 0%; transition: 0.3s; }
.quiz-content { flex: 1; padding: 20px; overflow-y: auto; max-width: 600px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.footer-check { flex-shrink: 0; padding: 20px; border-top: 2px solid var(--gray); background: #fff; max-width: 600px; margin: 0 auto; width: 100%; box-sizing: border-box; z-index: 10; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.feedback-sheet { position: fixed; bottom: -100%; left: 0; width: 100%; background: #fff; z-index: 5000; border-top: 2px solid var(--gray); padding: 20px; box-sizing: border-box; transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.feedback-sheet.visible { bottom: 0; }
.feedback-sheet.correct { background: var(--primary-light); border-color: transparent; }
.feedback-sheet.wrong { background: var(--red-light); border-color: transparent; }
.feedback-header { display: flex; align-items: center; margin-bottom: 20px; }
.feedback-icon { font-size: 40px; margin-right: 15px; }
.feedback-text h3 { margin: 0; font-size: 20px; }
.feedback-sheet.correct h3 { color: var(--primary-dark); } .feedback-sheet.wrong h3 { color: var(--red); }
.opt-btn { border: 2px solid var(--gray); border-radius: 12px; padding: 15px; margin-bottom: 10px; font-weight: bold; cursor: pointer; transition: 0.1s; box-shadow: 0 4px 0 var(--gray); color: var(--text); background: #fff; }
.opt-btn.selected { border-color: var(--blue); background: var(--blue-light); color: var(--blue); box-shadow: 0 4px 0 var(--blue); }

.modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.5); z-index: 5000; display: none; align-items: center; justify-content: center; }
.modal-overlay.visible { display: flex; }
.modal-box { background: white; width: 80%; max-width: 320px; padding: 30px; border-radius: 20px; text-align: center; }
.modal-icon { font-size: 50px; margin-bottom: 10px; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideIn { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

.profile-header-card { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid var(--gray); }
.profile-info h2 { font-size: 28px; margin: 0 0 5px 0; color: #333; }
.profile-meta { color: var(--text-light); font-size: 14px; margin-bottom: 10px; font-weight: bold; }
.profile-flag { font-size: 24px; }
.profile-avatar-large { width: 80px; height: 80px; background: var(--primary); color: white; border-radius: 50%; font-size: 30px; font-weight: 800; display: flex; justify-content: center; align-items: center; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--gray); position: relative; }
.edit-icon { position: absolute; right: 0; bottom: 0; background: var(--blue); width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }
/* === 新增：VIP专属节点样式 === */
.node.pro-locked {
    background: linear-gradient(135deg, #ffd900 0%, #ff9600 100%);
    color: white;
    box-shadow: 0 6px 0 #cc7800;
    cursor: pointer; /* 允许点击，点击后弹窗提示购买 */
}
/* Super 会员红心样式 */
.stat-pill.heart.super {
    color: var(--purple); /* 会员无限红心显示紫色 */
}

/* =========================================
   新增：气泡提示框 (Tooltip)
   ========================================= */
.tooltip-container {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.tooltip-box {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 12px;
    padding: 10px 15px;
    background: #4b4b4b;
    color: white;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
    z-index: 9999;
    line-height: 1.6;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
/* 气泡上方的小三角 */
.tooltip-box::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent transparent #4b4b4b transparent;
}
/* 鼠标悬停显示 */
.tooltip-container:hover .tooltip-box {
    opacity: 1;
    visibility: visible;
}
/* 移动端特殊处理，防止气泡超出屏幕右侧 */
.mobile-top-bar .tooltip-box {
    left: auto;
    right: -10px;
    transform: none;
}
.mobile-top-bar .tooltip-box::after {
    left: auto;
    right: 20px;
    transform: none;
}

/* =========================================
   新增/修复：答题界面题目样式
   ========================================= */
.q-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 25px;
    line-height: 1.6;
}
.opts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.super-badge {
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    vertical-align: bottom;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

/* =========================================
   修复：地图节点上的气泡 (向上弹出)
   ========================================= */
.node.tooltip-container .tooltip-box {
    bottom: 110%; /* 在节点正上方 */
    top: auto;
    margin-bottom: 10px;
    background: var(--purple-dark);
}
.node.tooltip-container .tooltip-box::after {
    top: 100%; /* 小三角指向下 */
    bottom: auto;
    border-color: var(--purple-dark) transparent transparent transparent;
}

/* =========================================
   修复：学习页面缺失的样式 (Study Content & Tips)
   ========================================= */
.study-content {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 20px;
}
/* 给文章里的重点加粗部分加上蓝色高光背景 */
.study-content b {
    color: var(--blue-dark);
    background: var(--blue-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 900;
}
.study-tips {
    background: #f0f8ff;
    border-left: 5px solid var(--blue);
    padding: 15px;
    border-radius: 8px;
    color: #555;
    font-style: italic;
    font-size: 14px;
    font-weight: bold;
}

/* =========================================
   新增：战力动态与曲线图样式
   ========================================= */
.stats-trend-row {
    display: flex; gap: 15px; margin-bottom: 25px;
}
.trend-box {
    flex: 1; background: #fff; border: 2px solid var(--gray); border-radius: 12px; 
    padding: 15px 5px; text-align: center; box-shadow: 0 4px 0 var(--gray);
}
.trend-label {
    font-size: 13px; color: var(--text-light); font-weight: 800; margin-bottom: 8px;
}
.trend-val { font-size: 22px; font-weight: 900; }
.trend-val.up { color: var(--primary); }
.trend-val.down { color: var(--red); }
.trend-val.flat { color: var(--text-light); }

.line-chart-wrapper {
    width: 100%; height: 250px; position: relative; margin: 0 auto;
}

/* =========================================
   新增：气泡向上弹出修饰类 (用于勤勉度网格)
   ========================================= */
.tooltip-top .tooltip-box {
    bottom: 140%; 
    top: auto; 
    margin-top: 0; 
    margin-bottom: 5px;
    background: #333;
}
.tooltip-top .tooltip-box::after {
    top: 100%; 
    bottom: auto;
    border-color: #333 transparent transparent transparent;
}

/* === 核心新增：完美还原的卡片 UI === */
.duo-card { border: 2px solid var(--gray); border-radius: 16px; padding: 20px; margin-bottom: 20px; background: #fff; text-align: left; }
.duo-super-badge { display: inline-block; background: linear-gradient(90deg, #1cb0f6, #ce82ff); color: white; font-weight: 900; font-style: italic; padding: 2px 10px; border-radius: 6px; font-size: 14px; margin-bottom: 15px; }
.duo-btn-blue { width: 100%; padding: 15px; border-radius: 12px; border: none; background: #3b3bff; color: white; font-size: 16px; font-weight: 800; box-shadow: 0 4px 0 #2a2aeb; cursor: pointer; transition: 0.1s; text-transform: uppercase;}
.duo-btn-blue:active { transform: translateY(4px); box-shadow: none; margin-top: 4px; }
.quest-row { display: flex; align-items: center; margin-top: 20px; }
.quest-icon { font-size: 40px; margin-right: 15px; }
.quest-bar-bg { background: var(--gray); height: 16px; border-radius: 8px; position: relative; width: 100%; display: flex; align-items: center; overflow: visible; }
.quest-bar-fill { background: var(--yellow); height: 100%; border-radius: 8px; }
.quest-bar-text { position: absolute; width: 100%; text-align: center; font-size: 12px; font-weight: 900; color: #777; }

/* 数据统计卡片 (圆角矩形风格) */
.data-cards-row { display: flex; gap: 15px; margin-bottom: 30px; }
.data-card {
    flex: 1; border: 2px solid var(--gray); border-radius: 16px;
    padding: 15px 20px; display: flex; align-items: center; gap: 10px;
}
.data-icon { font-size: 24px; }
.data-text h4 { margin: 0; font-size: 18px; color: #333; }
.data-text span { font-size: 12px; color: var(--text-light); font-weight: bold; }

.profile-header-card { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.profile-info h2 { font-size: 28px; margin: 0 0 5px 0; color: #333; }
.profile-meta { color: var(--text-light); font-size: 14px; margin-bottom: 10px; font-weight: bold; }
.profile-avatar-large { width: 80px; height: 80px; background: var(--primary); color: white; border-radius: 50%; font-size: 30px; font-weight: 800; display: flex; justify-content: center; align-items: center; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--gray); position: relative; }