/* ===== 自托管字体（Orbitron，静态字重）===== */
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/orbitron-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/orbitron-800.woff2') format('woff2');
}
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('../fonts/orbitron-900.woff2') format('woff2');
}

/* ===== 变量 ===== */
:root {
    --paper: #FDFBF7;
    --paper2: #F5F0E8;
    --paper3: #EDE8DE;
    --ink: #1A1A1A;
    --ink2: #333333;
    --ink3: #555555;
    --gold: #C8A86B;
    --gold2: #B8924A;
    --gold-bg: rgba(200, 168, 107, 0.10);
    --gold-bd: rgba(200, 168, 107, 0.30);
    --rule: rgba(0, 0, 0, 0.08);
    --card-bg: #FFFFFF;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow2: 0 8px 28px rgba(0, 0, 0, 0.12);
    --radius: 20px;
    --radius-sm: 14px;
    --max-w: 480px;
    --font-serif: 'Noto Serif SC', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft YaHei", Tahoma, Arial, sans-serif;
    --font-el: 'Cormorant Garamond', serif;
    /* 儿童友好色板 */
    --kid-blue: #5B9BD5;
    --kid-green: #6BCB77;
    --kid-coral: #FF6B6B;
    --kid-yellow: #FFD93D;
    --kid-purple: #9B59B6;
    --kid-orange: #FF9F43;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    background: var(--paper2);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    padding: 20px 16px 60px;
    min-height: 100vh;
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--paper2);
}
::-webkit-scrollbar-thumb {
    background: var(--gold-bd);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== 头部 ===== */
.header {
    background: var(--paper);
    border-radius: 24px 24px 16px 16px;
    padding: 28px 32px 20px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--rule);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.header-left .logo {
    font-size: 38px;
    line-height: 1;
}

.header-left h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -.01em;
}
.header-left h1 em {
    font-style: normal;
    color: var(--gold2);
    position: relative;
}
/* ===== 品牌标题（Logo 徽章版） ===== */
.brand-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    line-height: 1.2;
    text-shadow: none;
}
.brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: chip-float 3s ease-in-out infinite;
}
.brand-chip-text {
    font-family: 'Orbitron', 'Arial Black', sans-serif;
    font-weight: 800;
    font-size: 34px;
    letter-spacing: 0.08em;
    line-height: 1;
    background: linear-gradient(180deg, #FFFFFF 15%, #3B82F6 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9)) drop-shadow(0 0 12px rgba(59, 130, 246, 0.55));
    animation: ai-color-cycle 21s steps(1, end) infinite, ai-flicker 3s ease-in-out infinite;
}
@keyframes ai-color-cycle {
    0%     { background-image: linear-gradient(180deg, #FFFFFF 15%, #3B82F6 90%); filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9)) drop-shadow(0 0 12px rgba(59, 130, 246, 0.55)); }
    14.28% { background-image: linear-gradient(180deg, #FFFFFF 15%, #06B6D4 90%); filter: drop-shadow(0 0 6px rgba(103, 232, 249, 0.9)) drop-shadow(0 0 12px rgba(6, 182, 212, 0.55)); }
    28.57% { background-image: linear-gradient(180deg, #FFFFFF 15%, #8B5CF6 90%); filter: drop-shadow(0 0 6px rgba(196, 181, 253, 0.9)) drop-shadow(0 0 12px rgba(139, 92, 246, 0.55)); }
    42.85% { background-image: linear-gradient(180deg, #FFFFFF 15%, #EC4899 90%); filter: drop-shadow(0 0 6px rgba(249, 168, 212, 0.9)) drop-shadow(0 0 12px rgba(236, 72, 153, 0.55)); }
    57.14% { background-image: linear-gradient(180deg, #FFFFFF 15%, #F59E0B 90%); filter: drop-shadow(0 0 6px rgba(252, 211, 77, 0.9)) drop-shadow(0 0 12px rgba(245, 158, 11, 0.55)); }
    71.42% { background-image: linear-gradient(180deg, #FFFFFF 15%, #10B981 90%); filter: drop-shadow(0 0 6px rgba(110, 231, 183, 0.9)) drop-shadow(0 0 12px rgba(16, 185, 129, 0.55)); }
    85.71% { background-image: linear-gradient(180deg, #FFFFFF 15%, #EF4444 90%); filter: drop-shadow(0 0 6px rgba(252, 165, 165, 0.9)) drop-shadow(0 0 12px rgba(239, 68, 68, 0.55)); }
    100%   { background-image: linear-gradient(180deg, #FFFFFF 15%, #3B82F6 90%); filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9)) drop-shadow(0 0 12px rgba(59, 130, 246, 0.55)); }
}
@keyframes ai-flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.6; }
    94% { opacity: 1; }
    96% { opacity: 0.75; }
    97% { opacity: 1; }
}
@keyframes chip-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
.brand-cn {
    font-family: var(--font-serif);
    font-weight: 900;
    font-size: 0.8em;
    background: linear-gradient(115deg, #1A1A1A 25%, #B8924A 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.brand-title em {
    color: var(--gold2);
    font-style: normal;
    font-weight: 700;
    font-size: 0.8em;
}
.brand-spark {
    color: #E9CB85;
    font-size: 13px;
    line-height: 1;
    animation: spark-twinkle 1.8s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(233, 203, 133, 0.85);
    align-self: flex-start;
    margin-top: 5px;
}
@keyframes spark-twinkle {
    0%, 100% { opacity: 0.25; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.15); }
}

.header-left .sub {
    font-size: 13px;
    color: var(--ink3);
    background: var(--paper2);
    padding: 4px 16px;
    border-radius: 30px;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink2);
    text-decoration: none;
    background: var(--paper2);
    border: 1px solid var(--rule);
    transition: all 0.2s;
}
.header-nav-link:hover {
    background: var(--paper3);
    color: var(--ink);
    border-color: var(--gold-bd);
}

.nav-badge {
    display: none;
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}
.nav-badge.show { display: inline-block; }
.header-nav-link { position: relative; }

.stats-badge {
    background: var(--paper2);
    padding: 6px 18px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink2);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== 头部下拉菜单 ===== */
.header-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gold);
    color: #fff;
    border: 1px solid var(--rule);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.dropdown-toggle:hover {
    background: var(--paper3);
    color: var(--ink);
    border-color: var(--gold-bd);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.header-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow2);
    min-width: 160px;
    overflow: hidden;
    z-index: 100;
}
.header-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink2);
    text-decoration: none;
    transition: background 0.15s;
    border-top: 1px solid var(--rule);
}
.dropdown-menu a:first-child {
    border-top: none;
}
.dropdown-menu a:hover {
    background: var(--paper2);
    color: var(--gold2);
}

/* ===== Footer 导航链接 ===== */
.footer-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-bottom: 10px;
}
.footer-link {
    color: var(--ink3);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: color 0.15s;
    white-space: nowrap;
}
.footer-link:hover {
    color: var(--gold2);
    text-decoration: underline;
}

/* ===== 分类标签栏 ===== */
.category-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    flex-wrap: nowrap;
}

.category-tab {
    min-width: 76px;
    padding: 10px 10px 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink3);
    cursor: pointer;
    transition: color 0.25s ease;
    font-family: var(--font-sans);
    white-space: nowrap;
    letter-spacing: 0.5px;
    position: relative;
    flex-shrink: 1;
}
.category-tab::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, #C8A86B, #D4B87A);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}
.category-tab:hover {
    color: var(--ink);
}
.category-tab:hover::after {
    transform: scaleX(0.4);
}
.category-tab.active {
    color: #B8924A;
    font-weight: 800;
}
.category-tab.active::after {
    transform: scaleX(1);
}
.category-tab.active:hover {
    color: #B8924A;
}

/* 分类下拉 */
.category-dropdown {
    position: relative;
}
.category-tab-hasdrop {
    padding-right: 16px;
}
.cat-drop-arrow {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.category-dropdown.open .cat-drop-arrow {
    transform: rotate(180deg);
}
.category-drop-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(253, 251, 247, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(200, 168, 107, 0.25);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-6px);
    transition: all 0.2s ease;
    z-index: 100;
}
.category-dropdown.open .category-drop-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.category-drop-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--ink2);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.category-drop-item:hover {
    background: rgba(200, 168, 107, 0.12);
    color: #B8924A;
}

/* ===== 工具栏 ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-left .count {
    font-size: 14px;
    color: var(--ink3);
    font-weight: 500;
}
.toolbar-left .count strong {
    color: var(--ink);
    font-size: 17px;
    font-weight: 700;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toolbar-right .count {
    font-size: 14px;
    color: var(--ink3);
    font-weight: 500;
}
.toolbar-right .count strong {
    color: var(--ink);
    font-size: 17px;
    font-weight: 700;
}
/* ===== 工具栏单行紧凑（仅首页 index.html：课程包/模块 tab 与模式切换放在同一行） ===== */
.toolbar-compact {
    flex-wrap: nowrap;
}
.toolbar-compact .toolbar-left {
    flex: 1 1 auto;
    min-width: 0;
}
.toolbar-compact .toolbar-left .category-tabs,
.toolbar-compact .toolbar-left .package-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.toolbar-compact .toolbar-left .category-tabs::-webkit-scrollbar,
.toolbar-compact .toolbar-left .package-tabs::-webkit-scrollbar {
    display: none;
}
.toolbar-compact .category-tab,
.toolbar-compact .package-tab {
    min-width: 0;
    flex-shrink: 0;
    font-size: 13px;
    letter-spacing: 0;
    padding: 9px 8px 11px;
}
.toolbar-compact .category-tab::after,
.toolbar-compact .package-tab::after {
    left: 8px;
    right: 8px;
}
.toolbar-compact .mode-switch-btn {
    font-size: 13px;
    padding: 5px 13px;
}
/* ===== 课程包 tab（「我的课程」+ 每个课程包一个 tab，样式与上方分类 tab 统一） ===== */
.package-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
    padding-bottom: 0;
}
.package-tab {
    min-width: 110px;
    padding: 10px 14px 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink3);
    cursor: pointer;
    transition: color 0.25s ease;
    font-family: var(--font-sans);
    white-space: nowrap;
    letter-spacing: 0.5px;
    position: relative;
}
.package-tab::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, #C8A86B, #D4B87A);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}
.package-tab:hover {
    color: var(--ink);
}
.package-tab:hover::after {
    transform: scaleX(0.4);
}
.package-tab.active {
    color: #B8924A;
    font-weight: 800;
}
.package-tab.active::after {
    transform: scaleX(1);
}

/* ===== 模式切换（课程包 / 模块） ===== */
.mode-switch {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border: 1px solid var(--gold-bd);
    border-radius: 22px;
    background: var(--paper2);
    gap: 2px;
}
.mode-switch-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 18px;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--ink3);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.mode-switch-btn:hover {
    color: var(--ink);
}
.mode-switch-btn.active {
    background: linear-gradient(135deg, #C8A86B, #D4B87A);
    color: #fff;
    box-shadow: 0 3px 8px rgba(200, 168, 107, 0.35);
}

/* ===== 课程网格 ===== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    transition: all 0.3s;
}

/* ===== 课程包区块（素养课） ===== */
.course-package-block {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #FFF9F0, #FFF2E2);
    border: 2px solid var(--gold-bd);
    border-radius: 18px;
    padding: 18px 18px 22px;
    margin-bottom: 4px;
}
.course-package-block .package-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.course-package-block .package-icon {
    font-size: 34px;
    flex-shrink: 0;
}
.course-package-block .package-info {
    flex: 1;
    min-width: 200px;
}
.course-package-block .package-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 900;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}
.course-package-block .package-title::before {
    content: '';
    width: 6px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--gold), var(--gold2));
    display: inline-block;
}
.course-package-block .package-desc {
    font-size: 13px;
    color: var(--ink2);
    margin-top: 4px;
    line-height: 1.6;
}
.course-package-block .package-badge {
    background: var(--gold);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}
.course-package-block .package-course-grid {
    grid-template-columns: repeat(3, 1fr);
}
/* ===== 课程卡片 ===== */
.course-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px 22px 18px;
    border: 1px solid var(--rule);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: 265px; /* 统一卡片高度，保证所有卡片同尺寸 */
}
.course-card:hover {
    border-color: var(--gold-bd);
    box-shadow: var(--shadow2);
    transform: translateY(-2px);
}

.course-card .top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.course-card .top-row .left-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.course-card .course-id {
    font-family: var(--font-el);
    font-size: 14px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 30px;
    background: var(--paper2);
    color: var(--ink3);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.course-card .age-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 30px;
    background: var(--gold-bg);
    color: var(--gold2);
    white-space: nowrap;
}

.course-card .profession-tag {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 30px;
    white-space: nowrap;
}
.profession-tag.profession-R {
    background: #fadbd8;
    color: #922b21;
}
.profession-tag.profession-I {
    background: #d4e6f1;
    color: #1a5276;
}
.profession-tag.profession-A {
    background: #ebdef0;
    color: #6c3483;
}
.profession-tag.profession-S {
    background: #d5f5e3;
    color: #1a6e3a;
}
.profession-tag.profession-E {
    background: #fdebd0;
    color: #a04000;
}
.profession-tag.profession-C {
    background: #e8e8e8;
    color: #5d6d7e;
}

.course-card .course-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.course-card .course-title {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    margin: 4px 0 4px;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.course-card .course-title:hover {
    color: var(--gold2);
    border-bottom-color: var(--gold-bd);
}

.course-card .course-desc {
    font-size: 14px;
    color: var(--ink2);
    line-height: 1.65;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
}

.course-card .card-meta {
    margin-top: auto; /* 底部信息条贴卡底，保证所有卡片对齐 */
    padding-top: 4px;
}

.course-card .knowledge-wrap {
    display: none; /* 隐藏能力标签，仅详情页展示 */
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 4px;
}
.course-card .knowledge-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 12px;
    border-radius: 20px;
}
.course-card .k-ai {
    background: #EDE7F6;
    color: #6C5CE7;
}
.course-card .k-talent {
    background: #FFF0EB;
    color: #E17055;
}
.course-card .k-profession {
    background: #E3F0FD;
    color: #0984E3;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--paper);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--rule);
}
.empty-state .emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}
.empty-state h3 {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--ink);
    margin-bottom: 6px;
}
.empty-state p {
    color: var(--ink3);
    font-size: 14px;
}

/* ===== 弹窗 ===== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-card {
    background: var(--paper);
    border-radius: 24px;
    max-width: 640px;
    width: 94%;
    padding: 28px 32px 24px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.25);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--rule);
}
.popup-overlay.active .popup-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.popup-card .popup-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--paper);
    border: none;
    font-size: 28px;
    color: var(--ink3);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0 4px;
    z-index: 2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -8px;
    margin-right: -8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.popup-card .popup-close:hover {
    color: var(--ink);
    background: var(--paper2);
}

.popup-card .popup-icon {
    font-size: 40px;
    margin-bottom: 4px;
}
.popup-card .popup-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 2px;
}
.popup-card .popup-sub {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink3);
}
.popup-card .popup-sub span {
    background: var(--paper2);
    padding: 2px 14px;
    border-radius: 30px;
}

/* 关联说明 */
.popup-card .popup-relation {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink2);
    background: var(--paper2);
    padding: 14px 18px;
    border-radius: 14px;
    border-left: 4px solid var(--gold);
    margin-bottom: 18px;
}
.popup-card .popup-relation strong {
    color: var(--ink);
}

/* 小课列表 */
.popup-card .popup-lessons-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.popup-card .popup-lessons-title .badge {
    font-size: 12px;
    font-weight: 600;
    background: var(--gold-bg);
    color: var(--gold2);
    padding: 0 14px;
    border-radius: 30px;
    border: 1px solid var(--gold-bd);
}

.popup-card .lesson-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--rule);
    transition: all 0.2s;
}
.popup-card .lesson-item:hover {
    border-color: var(--gold-bd);
    box-shadow: var(--shadow);
}
.popup-card .lesson-item .lesson-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.popup-card .lesson-item .lesson-num {
    font-family: var(--font-el);
    font-size: 16px;
    font-weight: 700;
    color: var(--gold2);
    background: var(--gold-bg);
    padding: 0 12px;
    border-radius: 30px;
    min-width: 48px;
    text-align: center;
    line-height: 28px;
}
.popup-card .lesson-item .lesson-topic {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}
.popup-card .lesson-item .lesson-detail {
    font-size: 14px;
    color: var(--ink2);
    line-height: 1.6;
    padding-left: 4px;
}
.popup-card .lesson-item .lesson-detail .label {
    font-weight: 600;
    color: var(--ink);
    display: inline-block;
    min-width: 52px;
}
.popup-card .lesson-item .lesson-detail .label-outcome {
    font-weight: 600;
    color: var(--gold2);
    display: inline-block;
    min-width: 52px;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .course-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 820px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .course-package-block .package-course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px 10px 40px;
    }
    .header {
        padding: 16px 16px 14px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    .header-left h1,
    .header-left .brand-title {
        font-size: 18px;
    }
    .brand-chip-text {
        font-size: 25px;
    }
    .brand-spark {
        font-size: 10px;
        margin-top: 3px;
    }
    .header-left h1 em::after {
        height: 4px;
        bottom: 1px;
    }
    .header-left .sub {
        font-size: 11px;
        padding: 3px 12px;
    }
    .header-right {
        justify-content: flex-end;
        flex-shrink: 0;
    }
    .category-tabs {
        gap: 6px;
        justify-content: center;
    }
    .category-tab {
        min-width: 100px;
        padding: 8px 8px 10px;
        font-size: 13px;
    }
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .course-package-block .package-course-grid {
        grid-template-columns: 1fr;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .toolbar-left {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .course-card .top-row {
        flex-wrap: wrap;
    }
    .popup-card {
        padding: 20px 18px 18px;
        max-width: 98%;
        max-height: 92vh;
    }
    .popup-card .popup-title {
        font-size: 20px;
    }
    .popup-card .lesson-item {
        padding: 10px 12px;
    }
    .popup-card .lesson-item .lesson-topic {
        font-size: 14px;
    }
    .popup-card .lesson-item .lesson-detail {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .course-grid {
        grid-template-columns: 1fr;
    }
    .header {
        padding: 12px 14px 10px;
    }
    .header-left .logo {
        font-size: 26px;
    }
    .header-left h1 {
        font-size: 16px;
    }
    .dropdown-toggle {
        padding: 5px 12px;
        font-size: 12px;
        gap: 4px;
    }
    .dropdown-arrow {
        font-size: 8px;
    }
    .course-card {
        padding: 14px 16px 14px;
    }
    .course-card .course-title {
        font-size: 17px;
    }
    .course-card .course-id {
        font-size: 12px;
        padding: 2px 10px;
    }
    .popup-card .popup-lessons-title {
        font-size: 16px;
    }
    .popup-card .lesson-item .lesson-num {
        font-size: 14px;
        min-width: 40px;
        line-height: 24px;
    }
}

/* ===== 动画 ===== */
@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
.course-card {
    animation: floatUp 0.4s ease forwards;
}
.course-card:nth-child(2) {
    animation-delay: 0.04s;
}
.course-card:nth-child(3) {
    animation-delay: 0.08s;
}
.course-card:nth-child(4) {
    animation-delay: 0.12s;
}
.course-card:nth-child(5) {
    animation-delay: 0.16s;
}
.course-card:nth-child(6) {
    animation-delay: 0.20s;
}
.course-card:nth-child(7) {
    animation-delay: 0.24s;
}
.course-card:nth-child(8) {
    animation-delay: 0.28s;
}
.course-card:nth-child(9) {
    animation-delay: 0.32s;
}
.course-card:nth-child(10) {
    animation-delay: 0.36s;
}
.course-card:nth-child(11) {
    animation-delay: 0.40s;
}
.course-card:nth-child(12) {
    animation-delay: 0.44s;
}
.course-card:nth-child(13) {
    animation-delay: 0.48s;
}
