/* ========================================
   可视化教学平台 - 样式文件
   白色为主，蓝色点缀，简洁现代风格
   ======================================== */

/* CSS 变量 */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --primary-bg: #eff6ff;

    /* 默认学科颜色（莫兰迪蓝） */
    --subject-color: #6b8cae;
    --subject-dark: #4a6d8c;
    --subject-light: #8fadc8;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;

    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;

    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: all 0.3s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    /* scroll-behavior 在老浏览器中由 polyfill 处理 */
    scroll-behavior: smooth;
}

/* IE11 及老浏览器 CSS 变量回退 - 在compat.css中有更完整的处理 */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
        Helvetica, Arial, sans-serif;
    background: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========================================
   导航栏
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    min-height: 60px;
    background: rgba(255, 255, 255, 0.95);
    /* backdrop-filter 需要前缀 */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.navbar.scrolled {
    border-bottom-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* Logo在左边 */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
}

.nav-logo i {
    font-size: 1.5rem;
}

/* 导航菜单在中间 - 居中 */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.15rem;
    flex-wrap: nowrap;
    overflow: hidden;
    justify-content: center;
    flex: 1;
}

/* 用户菜单在右边 */
#user-menu-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 80px;
}

.nav-link {
    padding: 0.5rem 0.4rem;
    border-radius: var(--radius-md);
    color: #1f2937;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-link:hover {
    color: var(--subject-color, var(--primary-color));
    background: rgba(107, 140, 174, 0.1);
}

.nav-link.active {
    color: var(--subject-color, var(--primary-color));
    background: rgba(107, 140, 174, 0.15);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* 用户名按钮 - 直接跳转个人中心 */
.user-profile-btn {
    height: 36px;
    padding: 0 1rem;
    border-radius: var(--radius-md);
    background: #dbeafe;
    color: var(--primary-color);
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-sizing: border-box;
}

.user-profile-btn:hover {
    background: var(--primary-color);
    color: white;
}

.user-profile-btn i {
    font-size: 1.1rem;
}

/* 用户名文字长度限制 - 防止过长用户名撑开布局 */
.user-profile-btn span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 用户菜单容器 - min-width 已合并到上方 #user-menu-container */

/* 用户菜单 */
.user-menu {
    position: relative;
}

.user-btn {
    height: 36px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background: var(--primary-bg);
    border: none;
    border-radius: var(--radius-md);
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-sizing: border-box;
}

.user-btn:hover {
    background: var(--primary-color);
    color: white;
}

.user-btn i {
    font-size: 1rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1002;
}

.user-menu:hover .user-dropdown,
.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-header .username {
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-header .expire-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.user-dropdown-header .expire-info.warning {
    color: #f59e0b;
}

.user-dropdown-header .expire-info.expired {
    color: #ef4444;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.user-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 38px;
    min-width: 80px;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.login-btn:hover {
    background: var(--primary-dark);
}

/* ========================================
   主横幅区域
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 2rem 60px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--primary-bg) 100%);
    overflow: hidden;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero-title .highlight {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-graphic {
    position: relative;
    width: 400px;
    height: 400px;
}

.circle {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--primary-light);
    animation: float 6s ease-in-out infinite;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: 50px;
    left: 50px;
    opacity: 0.3;
}

.circle-2 {
    width: 200px;
    height: 200px;
    top: 100px;
    left: 100px;
    border-color: var(--primary-color);
    opacity: 0.5;
    animation-delay: -2s;
}

.circle-3 {
    width: 100px;
    height: 100px;
    top: 150px;
    left: 150px;
    background: var(--primary-bg);
    border-color: var(--primary-color);
    animation-delay: -4s;
}

.math-symbol {
    position: absolute;
    font-size: 4rem;
    font-weight: 300;
    color: var(--primary-color);
    opacity: 0.6;
    animation: float 4s ease-in-out infinite;
    top: 20px;
    right: 50px;
}

.symbol-2 {
    top: 200px;
    right: 20px;
    animation-delay: -1s;
    font-size: 3rem;
}

.symbol-3 {
    bottom: 50px;
    left: 80px;
    animation-delay: -2s;
    font-size: 2.5rem;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-white {
    background: white;
    color: var(--primary-color);
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   区块标题
   ======================================== */
.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.section-title.text-left {
    text-align: left;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
}

/* ========================================
   学科卡片区域
   ======================================== */
.subjects {
    padding: 6rem 0;
    background: var(--bg-white);
}

.subject-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: white;
    font-size: 1.5rem;
}

.subject-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subject-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.subject-card:hover .card-arrow {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

/* ========================================
   关于GeoGebra
   ======================================== */
.about {
    padding: 6rem 0;
    background: var(--bg-light);
}

.about-content {
    display: flex;
    gap: 4rem;
    align-items: center;
}

.about-text {
    flex: 1;
}

.about-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.feature-list {
    list-style: none;
    margin-bottom: 2rem;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-list i {
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.about-image {
    flex: 1;
    max-width: 100%;
}

.browser-mockup {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-width: 100%;
}

.browser-header {
    background: var(--bg-gray);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.browser-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
}

.browser-dot:nth-child(1) {
    background: #ef4444;
}

.browser-dot:nth-child(2) {
    background: #f59e0b;
}

.browser-dot:nth-child(3) {
    background: #22c55e;
}

.browser-content {
    padding: 1.5rem;
}

.ggb-preview {
    position: relative;
    height: 200px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.axis {
    position: absolute;
    background: var(--text-light);
}

.axis-x {
    width: 100%;
    height: 2px;
    top: 50%;
}

.axis-y {
    width: 2px;
    height: 100%;
    left: 50%;
}

.function-curve {
    position: absolute;
    width: 100%;
    height: 100%;
}

.point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

.point-1 {
    top: 30%;
    left: 30%;
}

.point-2 {
    top: 60%;
    left: 70%;
}

/* ========================================
   特性介绍
   ======================================== */
.features {
    padding: 6rem 0;
    background: var(--bg-white);
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-card .feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ========================================
   使用统计
   ======================================== */
.stats {
    padding: 4rem 0;
    background: var(--primary-bg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.stat-item {
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ========================================
   CTA区域
   ======================================== */
.cta {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    text-align: center;
    color: white;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.cta p {
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* ========================================
   页脚
   ======================================== */
.footer {
    background: var(--text-primary);
    color: var(--text-light);
    padding: 4rem 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-light);
}

.footer-links h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.9rem;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 120px;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-graphic {
        width: 300px;
        height: 300px;
        margin-top: 2rem;
    }

    .about-content {
        flex-direction: column;
        gap: 2rem;
    }

    .about-image {
        width: 100%;
        max-width: 450px;
        margin: 0 auto;
    }

    .browser-content {
        padding: 1rem;
    }

    .ggb-preview {
        height: 180px;
    }

    .feature-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .section-title.text-left {
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* 平板屏幕：隐藏用户名文字 */
@media (max-width: 850px) {
    .user-profile-btn span {
        display: none;
    }

    .user-profile-btn {
        padding: 0.5rem;
    }
}

/* 平板及手机：显示汉堡菜单 */
@media (max-width: 1000px) {
    .nav-container {
        position: relative;
    }

    /* 隐藏原导航菜单 */
    .nav-menu {
        display: none !important;
    }

    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        padding: 0 0.875rem;
        height: 38px;
        min-width: 80px;
        border-radius: var(--radius-md);
        background: var(--primary-color);
        border: 1px solid var(--primary-color);
        z-index: 1101;
        order: 0;
        font-size: 0.9rem;
        font-weight: 500;
        color: white;
        white-space: nowrap;
        flex-shrink: 0;
        margin-left: 12px;
        margin-right: auto;
    }

    .nav-toggle i {
        font-size: 1rem;
    }

    .nav-toggle:hover {
        background: var(--primary-dark, #2563eb);
        border-color: var(--primary-dark, #2563eb);
        color: white;
    }

    /* 用户菜单在最右边 */
    #user-menu-container {
        order: 2;
    }

    /* 登录按钮与菜单按钮样式统一 */
    .login-btn {
        height: 38px;
        min-width: 80px;
        padding: 0 0.875rem;
        font-size: 0.9rem;
    }

    .login-btn i {
        font-size: 1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 关于区域优化 */
    .about {
        padding: 4rem 0;
    }

    .about-description {
        font-size: 1rem;
    }

    .feature-list li {
        font-size: 0.95rem;
    }

    /* 页脚手机优化 */
    .footer-content {
        gap: 2rem;
    }

    .footer-links ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        justify-content: center;
    }

    .footer-bottom {
        font-size: 0.8rem;
    }
}

/* ========================================
   移动端下拉导航菜单
   ======================================== */
.mobile-dropdown-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1099;
    padding: 0.5rem 1rem 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-dropdown-menu.show {
    display: block;
}

.mobile-menu-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-row:last-child {
    border-bottom: none;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--bg-light);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 150px;
    text-align: center;
}

.mobile-menu-item:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.mobile-menu-item.active {
    background: var(--primary-color);
    color: white;
}

.mobile-menu-item i {
    font-size: 0.85rem;
}

/* 遮罩层 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1099;
}

.mobile-menu-overlay.show {
    display: block;
}

@media (max-width: 1000px) {
    .mobile-dropdown-menu {
        padding: 0.75rem;
    }

    .mobile-menu-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-width: 70px;
    }

    /* 关于区域 - 窄屏优化 */
    .about {
        padding: 3rem 0;
    }

    .about-content {
        gap: 1.5rem;
    }

    .about-image {
        max-width: 100%;
    }

    .browser-mockup {
        border-radius: var(--radius-md);
    }

    .browser-header {
        padding: 0.5rem 0.75rem;
    }

    .browser-dot {
        width: 10px;
        height: 10px;
    }

    .browser-content {
        padding: 0.75rem;
    }

    .ggb-preview {
        height: 150px;
    }

    .section-title {
        font-size: 1.75rem;
    }

    /* 特性卡片 - 2列布局 */
    .feature-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .feature-card {
        padding: 1rem 0.75rem;
    }

    .feature-card .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .feature-card h3 {
        font-size: 0.95rem;
    }

    .feature-card p {
        font-size: 0.8rem;
    }

    /* 统计区域优化 */
    .stats {
        padding: 2.5rem 0;
    }

    .stats-grid {
        gap: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .mobile-menu-item {
        flex: 1 1 calc(33% - 0.5rem);
        min-width: 60px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .mobile-menu-item i {
        display: inline-block;
        font-size: 0.75rem;
    }

    /* 关于区域 - 超窄屏优化 */
    .about {
        padding: 2rem 0;
    }

    .container {
        padding: 0 1rem;
    }

    .about-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .feature-list li {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .browser-content {
        padding: 0.5rem;
    }

    .ggb-preview {
        height: 120px;
    }

    /* 特性卡片 - 超窄屏优化 */
    .features {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 2rem;
    }

    .feature-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .feature-card {
        padding: 0.75rem 0.5rem;
    }

    .feature-card .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .feature-card h3 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .feature-card p {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* 统计区域 */
    .stats {
        padding: 2rem 0;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* CTA区域 */
    .cta {
        padding: 3rem 0;
    }

    .cta h2 {
        font-size: 1.5rem;
    }
}

/* 【已清理】原重复的 @media (max-width: 1000px) 已合并到 L992 和 L2988 */

/* ========================================
   课件页面样式
   ======================================== */
/* 横幅已移除，学科信息迁移到缩略图面板内 */
.page-header {
    display: none;
}

.course-layout {
    display: flex;
    /* 导航栏是 fixed 定位，需要 margin-top 把内容推到导航栏下方 */
    margin-top: 61px;
    /* 去掉横幅后，只需减去导航栏高度（含border） */
    height: calc(100vh - 61px);
    height: calc(100dvh - 61px);
    max-height: calc(100vh - 61px);
    max-height: calc(100dvh - 61px);
    overflow: hidden;
}

/* 合并后的标题栏中间区域：学科信息 + 剩余次数 */
.subject-info-center {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    opacity: 0.9;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.subject-info-center .subject-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.subject-info-center .subject-desc {
    opacity: 0.85;
    font-size: 0.82rem;
}

.subject-info-center .subject-separator {
    opacity: 0.5;
    font-size: 0.65rem;
}

/* 窄屏：隐藏学科描述，只保留学科名 */
@media (max-width: 768px) {
    .subject-info-center .subject-desc,
    .subject-info-center .subject-separator {
        display: none;
    }
}

/* 极窄屏：隐藏整个学科信息，只留文件夹名和课件数 */
@media (max-width: 480px) {
    .subject-info-center {
        display: none;
    }
}

/* 课程页面禁止body滚动 */
body.course-page {
    overflow: hidden;
    height: 100vh;
}

body.course-page .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

/* 左侧边栏 */
.sidebar {
    width: 300px;
    min-width: 300px;
    background: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

/* 收藏按钮（在标题栏右侧） */
.favorites-header-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    background: #fff8e1;
    border: 1px solid #f59e0b;
    color: #b45309;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

.sidebar-header h2 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 搜索框 */
.search-box {
    padding: 0.5rem 0.75rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-light);
}

.search-input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-input::placeholder {
    color: var(--text-light);
}

/* 收藏功能样式 */

/* 收藏按钮（在浏览模式切换区域） */
.favorites-mode-btn {
    position: relative;
}

.favorites-mode-btn i {
    color: #f59e0b;
}

.favorites-mode-btn.active {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.favorites-mode-btn.active i {
    color: white;
}

.fav-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fav-count-badge:empty,
.fav-count-badge[data-count="0"] {
    display: none;
}

/* 收藏面板（与目录区域平级） */
.favorites-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    min-height: 0;
    /* 允许flex子元素收缩 */
    max-height: calc(100vh - 280px);
    /* 限制最大高度，确保能滚动 */
}

.favorites-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    flex-shrink: 0;
}

.favorites-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.favorites-panel-title i {
    color: white;
}

.favorites-panel-header .favorites-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

.favorites-panel .favorites-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    min-height: 0;
    /* 允许flex子元素收缩，启用滚动 */
    -webkit-overflow-scrolling: touch;
    /* iOS滚动优化 */
}

/* 旧版收藏区域样式（保留兼容） */
.favorites-section {
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.favorites-header:hover {
    background: var(--bg-light);
}

.favorites-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.favorites-title i {
    color: #f59e0b;
}

.favorites-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-gray);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.favorites-toggle {
    color: var(--text-light);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.favorites-toggle.expanded {
    transform: rotate(180deg);
}

.favorites-list {
    max-height: none;
    overflow-y: auto;
}

.favorites-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-light);
}

.favorites-empty i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.favorites-empty p {
    font-size: 0.85rem;
    margin: 0;
}

.favorites-login-tip {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.favorites-login-tip i {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: block;
}

.favorites-login-tip p {
    font-size: 0.8rem;
    margin: 0 0 0.75rem;
}

.favorites-login-btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.favorites-login-btn:hover {
    background: var(--primary-dark);
}

.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-gray);
    transition: background 0.2s;
}

.favorite-item:hover {
    background: var(--primary-bg);
}

.favorite-item:last-child {
    border-bottom: none;
}

.favorite-item-info {
    flex: 1;
    min-width: 0;
}

.favorite-item-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-item-path {
    display: block;
    font-size: 0.7rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

.favorite-item-remove {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.favorite-item:hover .favorite-item-remove {
    opacity: 1;
}

.favorite-item-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* 收藏按钮样式 */
.favorite-btn {
    transition: all 0.2s;
}

.favorite-btn.favorited {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: white !important;
}

.favorite-btn.favorited:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

/* 收藏卡片样式（基于缩略图卡片） */
.thumbnail-card.favorites-card {
    position: relative;
}

.favorites-card-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    color: #f59e0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.thumbnail-card.favorites-card:hover .favorites-card-remove {
    opacity: 1;
}

.favorites-card-remove:hover {
    background: #fef3c7;
    color: #dc2626;
    transform: scale(1.1);
}

.favorites-card-remove i {
    font-size: 0.9rem;
}

/* 收藏为空时的样式 */
.favorites-thumbnail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8fafc;
}

/* 当thumbnail-grid只包含空状态时，设置相对定位 */
.thumbnail-grid:has(.favorites-thumbnail-empty) {
    position: relative;
    min-height: 400px;
}

/* 兼容不支持:has的浏览器 */
.thumbnail-grid--favorites-empty {
    position: relative;
    min-height: 400px;
}

.favorites-thumbnail-empty i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.favorites-thumbnail-empty h3 {
    font-size: 1.25rem;
    color: #475569;
    margin: 0 0 8px;
    font-weight: 600;
}

.favorites-thumbnail-empty p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
}

.favorites-login-btn-large {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.favorites-login-btn-large:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .favorites-thumbnail-empty {
        padding: 40px 20px;
        min-height: 200px;
    }

    .favorites-thumbnail-empty i {
        font-size: 3rem;
    }
}

.catalog-nav {
    padding: 0.75rem;
    padding-bottom: 120px;
    /* 底部留出空间给浮动的"关闭目录"按钮（40px按钮高+20px底部定位+充足余量） */
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-gutter: auto;
}

/* 年级分组 */
.grade-group {
    margin-bottom: 2px;
}

/* 年级标题 - 独立方块 + 左侧色块 */
.grade-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 0.5px solid #333;
    border-left: 6px solid var(--primary-color, #4a6fa5);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
    /* 展开后固定在侧边栏顶部 */
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 主目录循环配色 */
.grade-group:nth-child(6n+1)>.grade-header {
    border-left-color: #4a6fa5;
}

.grade-group:nth-child(6n+2)>.grade-header {
    border-left-color: #0d9488;
}

.grade-group:nth-child(6n+3)>.grade-header {
    border-left-color: #d97706;
}

.grade-group:nth-child(6n+4)>.grade-header {
    border-left-color: #7c3aed;
}

.grade-group:nth-child(6n+5)>.grade-header {
    border-left-color: #16a34a;
}

.grade-group:nth-child(6n+6)>.grade-header {
    border-left-color: #e11d48;
}

.grade-header:hover {
    background: #f0f7ff;
}

/* 激活时：蓝色背景 + 白色文字 */
.grade-header.expanded {
    background: #6b8db5;
    color: white;
    border-left-width: 6px;
}

.grade-header.expanded .grade-name,
.grade-header.expanded .grade-toggle {
    color: white;
}

.grade-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
}

/* 年级名称 */
.grade-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grade-toggle {
    color: var(--text-light);
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.grade-header.expanded .grade-toggle {
    transform: rotate(90deg);
}

/* 章节列表 */
.chapter-list {
    display: none;
    padding-left: 10px;
    margin-top: 0;
    margin-left: 4px;
}

.chapter-list.show {
    display: block;
    border-left: 1px dashed #333;
}

.chapter-item {
    margin-bottom: 0;
}

/* 深层嵌套目录样式优化 */
.ggb-list .chapter-item {
    margin-left: 0 !important;
}

.ggb-list .ggb-list {
    padding-left: 8px;
    margin-left: 4px;
}

.ggb-list .ggb-list.show {
    border-left: 1px dashed #333;
}

.ggb-list .ggb-list .ggb-list {
    padding-left: 6px;
}

.ggb-list .ggb-list .ggb-list .ggb-list {
    padding-left: 4px;
}

.ggb-list .ggb-list .ggb-list .ggb-list .ggb-list {
    padding-left: 4px;
}

/* 章节标题 - 独立方块 */
.chapter-header {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    background: white;
    border: 0.5px solid #333;
    border-radius: 4px;
    margin-top: 2px;
    transition: all 0.15s ease;
    font-size: 0.88rem;
    min-height: 26px;
    overflow: hidden;
    gap: 0.25rem;
    /* 子文件夹标题 sticky */
    position: sticky;
    top: 2.4rem;
    z-index: 5;
}

.chapter-header span:not(.chapter-toggle):not(.chapter-icon) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chapter-icon {
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-right: 0.3rem;
}

.chapter-header:hover {
    background: #f0f7ff;
    color: var(--text-primary);
}

/* 激活时：蓝色背景 + 白色文字 */
.chapter-header.expanded {
    background: #6b8db5;
    color: white;
    font-weight: 500;
}

.chapter-header.expanded span,
.chapter-header.expanded .chapter-icon,
.chapter-header.expanded .chapter-toggle {
    color: white;
}

.chapter-toggle {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.chapter-header.expanded .chapter-toggle {
    transform: rotate(90deg);
}

/* 课件列表 */
.ggb-list {
    display: none;
    padding-left: 8px;
    margin-top: 0;
    margin-left: 4px;
}

.ggb-list.show {
    display: block;
    border-left: 1px dashed #333;
}

/* 课件项 - 独立方块 */
.ggb-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    background: white;
    border: 0.5px solid #333;
    border-radius: 4px;
    margin-top: 2px;
    transition: all 0.15s ease;
    font-size: 0.88rem;
}

.ggb-item:hover {
    background: #f0f7ff;
    color: var(--text-primary);
}

/* 选中的课件：蓝色背景 */
.ggb-item.active {
    background: #6b8db5;
    color: white;
}

.ggb-item-icon {
    margin-right: 0.4rem;
}

/* 右侧内容区 - 必须限制高度，让子元素能正确布局 */
.content-area {
    flex: 1;
    padding: 0;
    background: var(--bg-white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    position: relative;
    /* 限制最大高度 */
}

/* 欢迎面板 */
.welcome-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 3rem;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.welcome-panel h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-panel>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.welcome-features {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.welcome-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

/* GGB 展示面板 */
.ggb-panel {
    background: var(--bg-white);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* 关键：允许flex子元素收缩 */
    max-height: 100%;
}

.ggb-header {
    padding: 0 16px;
    min-height: 60px;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ggb-header-left h3 {
    font-size: 1rem;
    margin: 0;
}

.ggb-path {
    display: none;
}

.ggb-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ggb-header-right button:not(.rotate-fullscreen-btn) {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

/* 缩放控制 */
.ggb-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-scale {
    min-width: 50px;
    text-align: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0 0.5rem;
}

/* 全屏按钮和下载按钮 */
.fullscreen-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* GGB 显示控制按钮组 */
.ggb-display-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 2px;
}

.display-ctrl-group {
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.display-ctrl-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0.5rem 0.6rem;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.8rem;
    line-height: 1;
    white-space: nowrap;
}

.display-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.display-ctrl-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

/* 两个按钮之间的分隔线 */
.display-ctrl-group .display-ctrl-btn+.display-ctrl-btn {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* A 图标（标签大小） */
.ctrl-icon {
    font-weight: 700;
    font-size: 0.8rem;
    font-family: serif;
}

.ctrl-icon-lg {
    font-size: 1.05rem;
}

/* 线条图标 */
.ctrl-line {
    display: inline-block;
    width: 14px;
    border-radius: 1px;
    background: white;
}

.ctrl-line-thin {
    height: 1px;
}

.ctrl-line-thick {
    height: 3px;
}

/* +/- 图标缩小 */
.display-ctrl-btn i.fas {
    font-size: 0.6rem;
    opacity: 0.85;
}

/* 手机端显示控制按钮的响应式 */
@media (max-width: 768px) {

    /* 手机端默认隐藏，只有进入全屏后才显示（由 .fullscreen / .rotate-fullscreen 覆盖） */
    .ggb-display-controls {
        display: none;
    }

    .display-ctrl-btn {
        padding: 4px 6px;
        font-size: 0.65rem;
    }

    .ctrl-icon {
        font-size: 0.65rem;
    }

    .ctrl-icon-lg {
        font-size: 0.8rem;
    }

    .ctrl-line {
        width: 10px;
    }
}


/* 全屏模式下显示控制按钮保持可见 */
.ggb-panel.fullscreen .ggb-display-controls,
.ggb-panel.rotate-fullscreen .ggb-display-controls {
    display: flex;
}

#download-btn {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}

#download-btn:hover {
    background: rgba(34, 197, 94, 0.5);
}

/* 蓝色框：独立的展示区 */
.ggb-display-area {
    flex: 1;
    position: relative;
    background: var(--bg-light);
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    /* 尺寸由JS动态计算 */
}

/* 红色框：独立的GGB展示窗口 */
.ggb-display-window {
    position: absolute;
    top: 0;
    left: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    /* 位置和尺寸完全由JS控制 */
}

/* GGB容器 */
.ggb-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    /* 尺寸完全由JS控制 */
}

/* 隐藏GeoGebra自带的加载进度条 */
#ggb-container article>div:first-child,
.ggb-container article>div:first-child {
    display: none !important;
}

.ggb-tips {
    padding: 0.5rem 1.5rem;
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* 全屏模式 - GGB展示窗口全屏 */
.ggb-panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    background: #1a1a2e;
}

.ggb-panel.fullscreen .ggb-header {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    opacity: 0.95;
}

.ggb-panel.fullscreen .ggb-display-area {
    background: #1a1a2e;
}

.ggb-panel.fullscreen .ggb-display-window {
    border-radius: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.ggb-panel.fullscreen .ggb-tips {
    display: none;
}

/* ========== 旋转全屏模式 - 手机横屏浏览 ========== */
.ggb-panel.rotate-fullscreen {
    position: fixed;
    /* 旋转后：屏幕高度做宽，屏幕宽度做高 */
    width: 100vh;
    width: 100dvh;
    height: 100vw;
    height: 100dvw;
    transform: rotate(90deg);
    transform-origin: top left;
    top: 0;
    left: 100vw;
    left: 100dvw;
    z-index: 10000;
    border-radius: 0;
    margin: 0;
    background: #1a1a2e;
}

.ggb-panel.rotate-fullscreen .ggb-header {
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    opacity: 0.95;
    flex-wrap: nowrap;
}

/* 横屏模式下重置手机端按钮行样式，防止按钮竖排错位 */
.ggb-panel.rotate-fullscreen .ggb-header-right {
    width: auto;
    flex-wrap: nowrap;
    gap: 0.3rem;
    justify-content: flex-end;
}

.ggb-panel.rotate-fullscreen .ggb-header-right button {
    height: 28px;
    padding: 0 0.5rem;
    font-size: 0.75rem;
}

.ggb-panel.rotate-fullscreen .ggb-header-left h3 {
    font-size: 0.9rem;
}

.ggb-panel.rotate-fullscreen .ggb-path {
    display: none;
}

.ggb-panel.rotate-fullscreen .ggb-display-area {
    background: #1a1a2e;
}

.ggb-panel.rotate-fullscreen .ggb-display-window {
    border-radius: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.ggb-panel.rotate-fullscreen .ggb-tips {
    display: none;
}

/* 旋转全屏时隐藏原有的全屏按钮和购买按钮（但保留刷新按钮） */
.ggb-panel.rotate-fullscreen .fullscreen-btn,
.ggb-panel.rotate-fullscreen .buy-member-btn {
    display: none;
}

.ggb-panel.rotate-fullscreen #refresh-ggb-btn,
.ggb-panel.fullscreen #refresh-ggb-btn {
    display: flex !important;
}

/* 旋转全屏退出按钮 */
.rotate-exit-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.rotate-exit-btn:hover,
.rotate-exit-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

/* 旋转全屏按钮 - 仅手机端显示，样式与 .fullscreen-btn 统一 */
.rotate-fullscreen-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.rotate-fullscreen-btn:hover,
.rotate-fullscreen-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

/* 手机端才显示旋转全屏按钮，文字隐藏（与 .fullscreen-btn 断点一致） */
@media (max-width: 768px) {
    .rotate-fullscreen-btn {
        display: flex;
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .rotate-fullscreen-btn span {
        display: none;
    }
}

/* 加载状态 */
.loading {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* 错误消息 */
.error-message {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

/* 空状态 */
.empty-state {
    color: var(--text-light);
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    font-style: italic;
}

/* 深层级目录样式 */
.chapter-item[data-level="0"]>.chapter-header {
    font-weight: 500;
    color: var(--text-primary);
}

.chapter-item[data-level="1"]>.chapter-header {
    font-size: 0.82rem;
}

.chapter-item[data-level="2"]>.chapter-header {
    font-size: 0.8rem;
    padding: 0.35rem 0.4rem;
    min-height: 26px;
}

.chapter-item[data-level="3"]>.chapter-header,
.chapter-item[data-level="4"]>.chapter-header,
.chapter-item[data-level="5"]>.chapter-header {
    font-size: 0.78rem;
    padding: 0.3rem 0.35rem;
    min-height: 24px;
}

/* 确保所有章节头都可点击 */
.chapter-header {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* 点击区域扩展 */
.chapter-header::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -4px;
    right: -4px;
    bottom: -2px;
    z-index: -1;
}

/* 空目录样式 - 仍可点击展开 */
.chapter-header.empty {
    color: var(--text-light);
    cursor: pointer;
}

.chapter-header.empty:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* 章节图标缩小深层级 */
.chapter-item[data-level="3"] .chapter-icon,
.chapter-item[data-level="4"] .chapter-icon,
.chapter-item[data-level="5"] .chapter-icon {
    font-size: 0.7rem;
}

/* 响应式课件页面 */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }

    /* 在较窄的sidebar中隐藏按钮文字，只显示图标 */
    .view-mode-section {
        gap: 6px;
        padding: 8px 10px;
    }

    .view-mode-section .mode-label {
        font-size: 0.75rem;
    }

    .mode-btn {
        padding: 6px 8px;
    }

    .mode-btn span {
        display: none;
    }
}

/* ========================================
   目录切换按钮
   ======================================== */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 950;
    padding: 0 20px;
    height: 40px;
    border-radius: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    outline: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.sidebar-toggle:focus:not(:focus-visible) {
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle:focus-visible {
    outline: none;
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(59, 130, 246, 0.4);
}

/* 目录内的切换按钮（显示在目录头部） */
.sidebar-header-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-bg);
    color: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-header-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.sidebar-header-toggle i {
    font-size: 0.9rem;
}

/* 隐藏Logo文字，给导航栏和按钮留出空间 */
@media (max-width: 1250px) {
    .nav-logo span {
        display: none;
    }

    .nav-logo {
        min-width: auto;
    }
}

/* 平板端优化 - 目录从左侧滑出 */
@media (max-width: 1200px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        left: 20px;
        right: auto;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-header-toggle {
        display: flex;
    }

    .course-layout {
        position: relative;
        margin-top: 60px;
        /* 去掉横幅后，只需减去导航栏高度 */
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }

    /* 目录从左侧滑出 */
    .sidebar {
        position: fixed;
        left: 0;
        right: auto;
        top: 60px;
        bottom: 0;
        /* 重要：覆盖基础样式的 height:100%，否则 bottom 属性会被忽略 */
        height: auto;
        width: 300px;
        min-width: 300px;
        z-index: 900;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }

    .sidebar.visible {
        transform: translateX(0);
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .sidebar-overlay {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 899;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .content-area {
        padding: 0;
        margin-left: 0;
        width: 100%;
    }

    /* 用户菜单响应式 */
    #user-menu-container {
        margin-left: auto;
        margin-right: 0.5rem;
    }

    .user-profile-btn span {
        display: none;
    }

    .user-profile-btn {
        padding: 0.5rem;
    }

    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 220px;
    }
}

@media (max-width: 1000px) {
    .nav-container {
        height: 60px;
        padding: 0 1rem;
    }

    .nav-menu {
        top: 60px;
    }
}

@media (max-width: 768px) {
    .course-layout {
        margin-top: 60px;
        /* 去掉横幅后，只需减去导航栏高度 */
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }

    .sidebar {
        width: 85%;
        max-width: 300px;
        /* JS 会动态设置 top 和 height */
        top: 60px;
    }

    .sidebar-overlay {
        top: 60px;
    }

    .content-area {
        padding: 0;
        flex: 1;
        height: 100%;
    }

    .search-box {
        padding: 0.75rem;
    }

    /* 收藏区域手机优化 */
    .favorites-header {
        padding: 0.6rem 0.75rem;
    }

    .favorites-title {
        font-size: 0.85rem;
    }

    .favorites-list {
        max-height: 150px;
    }

    .favorite-item {
        padding: 0.5rem 0.75rem;
    }

    .favorite-item-title {
        font-size: 0.8rem;
    }

    .sidebar-toggle {
        bottom: 65px;
        left: 15px;
    }

    /* GGB面板手机优化 */
    .ggb-panel {
        border-radius: 0;
    }

    .ggb-header {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .ggb-header-left h3 {
        font-size: 0.95rem;
    }

    .ggb-path {
        font-size: 0.7rem;
    }

    /* 手机端按钮行：允许换行、缩小间距 */
    .ggb-header-right {
        flex-wrap: wrap;
        gap: 0.3rem;
        width: 100%;
        justify-content: flex-start;
    }

    .ggb-header-right button:not(.rotate-fullscreen-btn) {
        height: 28px;
        padding: 0 0.5rem;
        font-size: 0.75rem;
    }

    .fullscreen-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .fullscreen-btn span {
        display: none;
    }

    .ggb-tips {
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }

    .ggb-wrapper {
        padding: 0.25rem;
    }

    /* 欢迎面板手机优化 */
    .welcome-panel {
        padding: 1.5rem;
    }

    .welcome-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }

    .welcome-panel h2 {
        font-size: 1.2rem;
    }

    .welcome-features {
        flex-direction: column;
        gap: 0.75rem;
    }

    .welcome-feature {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.75rem;
        height: 60px;
    }

    .nav-logo span {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .course-layout {
        margin-top: 60px;
        /* 去掉横幅后，只需减去导航栏高度 */
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }

    .sidebar {
        /* JS 会动态设置 top 和 height */
        top: 60px;
    }

    .sidebar-overlay {
        top: 60px;
    }

    .content-area {
        padding: 0;
    }
}

/* ========================================
   登录/用户认证相关样式
   ======================================== */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

.btn-login {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white !important;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-logout {
    padding: 6px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.user-greeting {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 用户信息在导航栏中的样式 */
#nav-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

/* 平板及移动端隐藏登录按钮区域 */
@media (max-width: 1000px) {
    .nav-auth {
        position: absolute;
        top: 60px;
        right: 0;
        background: white;
        padding: 12px 20px;
        border-radius: 0 0 0 var(--radius-md);
        box-shadow: var(--shadow-md);
        display: none;
    }

    .nav-menu.active+.nav-auth,
    .nav-auth.show {
        display: flex;
    }
}

/* ========================================
   浏览模式切换区域
   ======================================== */
.view-mode-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow: hidden;
}

.view-mode-section .mode-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    height: 30px;
    border: 1px solid var(--subject-color, var(--primary-color));
    background: white;
    color: var(--subject-color, var(--primary-color));
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-md);
}

.mode-btn i {
    font-size: 0.9rem;
}

.mode-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.mode-btn.active {
    background: var(--subject-color, var(--primary-color));
    color: white;
}

/* ========================================
   缩略图浏览模式 - 响应式列数：大屏5列、平板4列、小平板3列、手机2列
   ======================================== */
/* 缩略图网格容器 */
.thumbnail-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    /* 回退：使用flexbox布局 */
    gap: 12px;
    padding: 12px;
    overflow-y: auto;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    -ms-flex-line-pack: start;
    align-content: flex-start;
}

/* 现代浏览器使用grid */
@supports (display: grid) {
    .thumbnail-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        /* 行高由JS动态计算，默认auto */
        grid-auto-rows: auto;
        gap: 8px;
        padding: 8px;
        overflow-y: auto;
        flex: 1;
        align-content: start;
    }
}

/* 单个缩略图卡片 - 4:3 横向比例 */
.thumbnail-card {
    position: relative;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    /* flexbox回退：固定宽度和高度 */
    width: calc(20% - 8px);
    height: 180px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    /* 现代浏览器：4:3 横向比例，适合展示数学图形 */
    aspect-ratio: 4 / 3;
    /* 防止内容撑开导致重叠 */
    min-height: 0;
}

/* Grid 布局下的卡片 */
@supports (display: grid) {
    .thumbnail-card {
        width: auto;
        height: auto;
    }
}

/* 不支持 aspect-ratio 的浏览器降级 */
@supports not (aspect-ratio: 4 / 3) {
    .thumbnail-card {
        height: 150px;
        /* 4:3 比例降级高度 */
    }
}

.thumbnail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* 缩略图预览区域 - 填充剩余空间，防止溢出 */
.thumbnail-preview {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    background: white;
    overflow: hidden;
}

/* 缩略图图片样式（从GGB文件提取的静态图片） */
.thumbnail-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 宽度铺满，超出部分裁剪 */
    object-position: center top;
    /* 水平居中，顶部对齐 */
    opacity: 0;
    transition: opacity 0.3s ease;
    background: white;
}

/* 静态占位符样式（备用，图片加载失败时显示） */
.thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: white;
    color: var(--text-light);
}

.thumbnail-placeholder i {
    font-size: 2.5rem;
    color: var(--primary-light);
}

.thumbnail-placeholder .file-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    opacity: 0.6;
}

.thumbnail-preview .loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.thumbnail-preview .loading-placeholder i {
    font-size: 2rem;
    color: var(--primary-light);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

/* 缩略图信息区域 - 始终显示在底部 */
.thumbnail-info {
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-white);
    flex-shrink: 0;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.thumbnail-info h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    /* 允许两行显示 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    line-height: 1.3;
}

/* 隐藏路径信息，让标题有更多空间 */
.thumbnail-info p {
    display: none;
}

/* 点击查看遮罩 */
.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
}

.thumbnail-card:hover .thumbnail-overlay {
    background: rgba(59, 130, 246, 0.15);
    opacity: 1;
}

.thumbnail-overlay span {
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transform: translateY(10px);
    transition: var(--transition);
}

.thumbnail-card:hover .thumbnail-overlay span {
    transform: translateY(0);
}

/* ========== 定制GGB卡片样式 ========== */
.thumbnail-card-custom {
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    /* 与普通卡片一致的实线边框 */
}

.thumbnail-card-custom:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.thumbnail-custom-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent !important;
    padding: 8px;
    overflow: hidden;
}

.thumbnail-custom-preview .custom-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.thumbnail-card-custom:hover .custom-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.thumbnail-custom-preview .custom-icon i {
    font-size: 1.25rem;
    color: white;
}

.thumbnail-custom-preview .custom-text {
    text-align: center;
    line-height: 1.35;
}

.thumbnail-custom-preview .custom-line1 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 0;
}

.thumbnail-custom-preview .custom-line2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 1px;
}

.thumbnail-custom-preview .custom-line3 {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.thumbnail-custom-overlay {
    background: rgba(59, 130, 246, 0.08) !important;
}

.thumbnail-card-custom:hover .thumbnail-custom-overlay {
    background: rgba(59, 130, 246, 0.15) !important;
}

.thumbnail-card-custom .thumbnail-info h4 {
    color: #3b82f6;
    font-size: clamp(0.9rem, 1.1vw, 1.1rem);
}

.thumbnail-card-custom .thumbnail-info p {
    color: #94a3b8;
}

/* 缩略图分页控制 - 固定在面板底部，不遮挡缩略图 */
.thumbnail-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--border-color);
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 10;
}

/* 页码容器 */
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 页码按钮 */
.page-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.page-num:hover:not(:disabled) {
    border-color: var(--subject-color, var(--primary-color));
    color: var(--subject-color, var(--primary-color));
    background: var(--primary-bg);
}

.page-num.active {
    background: var(--subject-color, var(--primary-color));
    border-color: var(--subject-color, var(--primary-color));
    color: white;
    cursor: default;
}

/* 省略号 */
.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    color: var(--text-light);
    font-size: 0.9rem;
    user-select: none;
}

/* 页码跳转框 */
.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-jump input {
    width: 50px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
}

.page-jump input:focus {
    outline: none;
    border-color: var(--subject-color, var(--primary-color));
    box-shadow: 0 0 0 2px rgba(var(--subject-color-rgb, 59, 130, 246), 0.1);
}

.page-jump input::-webkit-outer-spin-button,
.page-jump input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.page-jump input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.page-jump-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    background: var(--subject-color, var(--primary-color));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.page-jump-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 【已清理】.folder-item 旧样式已被下方 L3842 的新版覆盖，删除此处重复定义 */

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--subject-color, var(--primary-color));
    background: white;
    color: var(--subject-color, var(--primary-color));
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: bold;
    flex-shrink: 0;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--subject-color, var(--primary-color));
    color: white;
    transform: scale(1.05);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0 8px;
    font-weight: 500;
    white-space: nowrap;
}

.pagination-info strong {
    color: var(--subject-color, var(--primary-color));
    font-weight: 700;
}

/* 缩略图模式下的目录样式 */
.catalog-nav.thumbnail-mode .ggb-item {
    display: none !important;
}

.catalog-nav.thumbnail-mode .ggb-list {
    padding-left: 0.25rem;
}

/* 文件夹点击样式 */
.folder-item {
    cursor: pointer;
}

.folder-item .chapter-header.folder-clickable {
    background: white;
    border: 0.5px solid #333;
    border-radius: 4px;
    margin: 2px 0 0 0;
    padding: 0.45rem 0.75rem;
}

.folder-item .chapter-header.folder-clickable:hover {
    background: #eef2f7;
    color: var(--primary-color);
}

.folder-item .chapter-header.folder-clickable:hover .chapter-icon {
    color: var(--primary-color);
}

.folder-item.active .chapter-header.folder-clickable {
    background: var(--primary-color);
    color: white;
    border-left-color: var(--primary-color);
}

/* 缩略图面板（显示在content-area中）- 必须撑满可用空间，不溢出 */
.thumbnail-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    /* 限制最大高度，防止溢出 */
    height: 100%;
    /* 撑满父容器 */
    background: var(--bg-light);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.thumbnail-panel.active {
    display: flex;
}

/* 缩略图网格 - 响应式列数，固定行高 */
.thumbnail-panel .thumbnail-grid {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: #f8fafc;
    /* flexbox回退 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    -ms-flex-line-pack: start;
    align-content: flex-start;
}

/* 现代浏览器使用grid */
@supports (display: grid) {
    .thumbnail-panel .thumbnail-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        /* 行高由JS动态计算，默认auto */
        grid-auto-rows: auto;
        gap: 8px;
        padding: 8px;
        align-content: start;
    }
}

/* 当只有欢迎面板时，居中显示 - 使用兼容老浏览器的类名方案 */
.thumbnail-panel .thumbnail-grid.thumbnail-grid--welcome {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;  /* 欢迎面板不需要滚动条 */
}

/* 分页区域 - 固定在面板底部，确保不遮挡内容 */
.thumbnail-panel .thumbnail-pagination {
    flex-shrink: 0;
    z-index: 100;
    border-top: 1px solid var(--border-color);
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    /* 桌面端：在面板内部显示，不使用fixed定位 */
    position: relative;
}

/* 移动端分页：fixed定位，底部显示 */
@media (max-width: 768px) {
    .thumbnail-panel .thumbnail-pagination {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }
}

/* 缩略图头部 - 使用学科主题色 */
.thumbnail-header {
    position: relative;
    padding: 0 16px;
    height: 60px;
    background: linear-gradient(135deg, var(--subject-color, var(--primary-color)) 0%, var(--subject-dark, var(--primary-dark)) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.thumbnail-header h3 {
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thumbnail-header h3 i {
    opacity: 0.8;
}

.thumbnail-count {
    background: rgba(255, 255, 255, 0.95);
    color: var(--subject-color, var(--primary-color, #3b82f6));
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 空状态提示 - 居中显示 */
.thumbnail-empty {
    grid-column: 1 / -1;
    /* 占据所有列 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    height: 100%;
    color: var(--text-secondary);
    padding: 40px;
    text-align: center;
    background: var(--bg-light);
}

.thumbnail-empty i {
    font-size: 5rem;
    color: var(--primary-light);
    margin-bottom: 24px;
    opacity: 0.6;
}

.thumbnail-empty p {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 300px;
}

/* 缩略图欢迎面板 - 带学科图标，完全居中 */
.thumbnail-welcome {
    grid-column: 1 / -1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: 40px;
    text-align: center;
    background: var(--bg-light);
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* 当只显示欢迎面板时，grid容器变成flex居中 */
.thumbnail-grid.thumbnail-grid--welcome-only {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    height: 100%;
}

.thumbnail-welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.thumbnail-welcome h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.thumbnail-welcome>p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.thumbnail-welcome-features {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail-welcome-features span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.thumbnail-welcome-features span i {
    color: var(--subject-color, var(--primary-color));
}

.thumbnail-invite,
.welcome-invite {
    margin-top: 1.5rem;
    text-align: center;
}

@media (max-width: 768px) {
    .thumbnail-welcome {
        padding: 20px;
        min-height: 300px;
    }

    .thumbnail-welcome h2 {
        font-size: 1.2rem;
    }

    .thumbnail-welcome-features {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* 返回缩略图按钮（继承 .fullscreen-btn 样式，只控制显示/隐藏） */
.back-to-thumbnail-btn {
    display: none;
}

.back-to-thumbnail-btn.show {
    display: inline-flex;
}

/* 响应式缩略图 - 桌面端 */
@media (min-width: 769px) {

    /* 桌面端分页始终在面板内，不使用fixed定位 */
    .thumbnail-pagination {
        position: relative;
        padding: 10px 16px;
    }

    .thumbnail-panel .thumbnail-grid {
        padding-bottom: 12px;
        /* 不需要额外底部间距 */
    }
}

/* 响应式缩略图 - 小平板/手机端 */
@media (max-width: 768px) {
    .thumbnail-grid {
        /* 小平板：3列 */
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: auto;
        gap: 6px;
        padding: 6px;
    }

    .thumbnail-panel .thumbnail-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: auto;
        gap: 6px;
        padding: 6px;
        /* 给底部分页栏留出足够空间，避免被裁切 */
        padding-bottom: 80px;
        overflow-y: auto;
    }

    .thumbnail-info {
        height: 44px;
        min-height: 44px;
        max-height: 44px;
        padding: 5px 6px;
    }

    .thumbnail-info h4 {
        font-size: 0.88rem;
    }

    .mode-btn {
        padding: 5px 10px;
        height: 28px;
        font-size: 0.75rem;
    }

    .mode-btn i {
        font-size: 0.85rem;
    }

    .mode-btn span {
        display: none;
    }

    .thumbnail-pagination {
        padding: 8px 12px 8px 70px;
        /* 左侧留出空间避开目录按钮 */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        z-index: 1050;
        height: 56px;
        min-height: 56px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }

    .pagination-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .page-num {
        min-width: 28px;
        height: 30px;
        font-size: 0.85rem;
    }

    /* 平板端跳转框样式 */
    .page-jump {
        margin-left: 8px;
        padding-left: 8px;
        font-size: 0.8rem;
    }

    .page-jump input {
        width: 45px;
        height: 30px;
    }

    .page-jump-btn {
        height: 30px;
        padding: 0 10px;
        font-size: 0.75rem;
    }
}

/* 响应式缩略图 - 手机端 */
@media (max-width: 480px) {
    .thumbnail-grid {
        /* 手机：2列 */
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: auto;
        gap: 5px;
        padding: 5px;
    }

    .thumbnail-panel .thumbnail-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: auto;
        gap: 5px;
        padding: 5px;
        /* 给底部分页栏和浏览器底部工具栏留出足够空间 */
        padding-bottom: 100px;
        overflow-y: auto;
    }

    .thumbnail-info {
        height: 40px;
        min-height: 40px;
        max-height: 40px;
        padding: 4px 5px;
    }

    .thumbnail-info h4 {
        font-size: 0.82rem;
    }



    .thumbnail-pagination {
        padding: 8px 10px 8px 60px;
        /* 左侧留出空间避开目录按钮 */
        height: 52px;
        min-height: 52px;
        gap: 4px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        z-index: 1050;
        /* 高于目录按钮 */
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        /* 考虑手机浏览器底部工具栏的安全区域 */
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }

    .pagination-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .page-num {
        min-width: 26px;
        height: 28px;
        padding: 0 4px;
        font-size: 0.8rem;
    }

    .page-ellipsis {
        width: 18px;
        font-size: 0.85rem;
    }

    .pagination-pages {
        gap: 3px;
    }

    /* 手机端跳转框样式 - 简化显示 */
    .page-jump {
        margin-left: 6px;
        padding-left: 6px;
        gap: 4px;
    }

    .page-jump span {
        display: none;
        /* 隐藏文字 */
    }

    .page-jump input {
        width: 40px;
        height: 28px;
        font-size: 0.8rem;
    }

    .page-jump-btn {
        height: 28px;
        padding: 0 8px;
        font-size: 0.7rem;
    }
}

/* ========================================
   学科主题颜色
   ======================================== */
/* ========================================
   莫兰迪色系 - 各学科主题色
   ======================================== */

/* 小学数学 - 莫兰迪绿 */
.subject-primary-math {
    --subject-color: #7fa87f;
    --subject-dark: #5c8a5c;
    --subject-light: #a3c4a3;
}

/* 初中数学 - 莫兰迪蓝 */
.subject-junior-math {
    --subject-color: #6b8cae;
    --subject-dark: #4a6d8c;
    --subject-light: #8fadc8;
}

/* 高中数学 - 莫兰迪紫 */
.subject-senior-math {
    --subject-color: #9585a8;
    --subject-dark: #7a6b8f;
    --subject-light: #b5a8c4;
}

/* 初中物理 - 莫兰迪橙 */
.subject-junior-physics {
    --subject-color: #c9a86c;
    --subject-dark: #a68a4f;
    --subject-light: #dfc99a;
}

/* 高中物理 - 莫兰迪红/砖红 */
.subject-senior-physics {
    --subject-color: #b87b7b;
    --subject-dark: #996060;
    --subject-light: #d4a3a3;
}

/* 其他学科 - 莫兰迪青 */
.subject-other {
    --subject-color: #6a9fa8;
    --subject-dark: #4d838c;
    --subject-light: #8fc1c9;
}

/* AI生成GGB - 莫兰迪紫 */
.subject-ai-ggb {
    --subject-color: #9a7fb8;
    --subject-dark: #7d5fa0;
    --subject-light: #bfb0a0;
}

/* ========================================
   全屏书写功能样式
   ======================================== */

/* 书写画布层 - 覆盖在GGB上方 */
.drawing-canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    pointer-events: none;
}

.drawing-canvas-layer.active {
    pointer-events: auto;
    cursor: crosshair;
}

.drawing-canvas-layer.active.eraser-mode {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="rgba(255,255,255,0.3)" stroke="white" stroke-width="2"/></svg>') 12 12, auto;
}

.drawing-canvas-layer canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* 书写工具切换按钮 */
.drawing-toggle-btn {
    position: fixed;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(147, 51, 234, 0.9));
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    z-index: 10001;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    transition: all 0.3s ease;
    animation: toggle-btn-appear 0.4s ease-out;
}

.drawing-toggle-btn.position-right {
    right: 20px;
    left: auto;
}

.drawing-toggle-btn.position-left {
    left: 20px;
    right: auto;
}

.drawing-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.5);
}

.drawing-toggle-btn:active {
    transform: scale(0.95);
}

.drawing-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

@keyframes toggle-btn-appear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 书写工具栏 */
.drawing-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 8px 6px;
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    user-select: none;
    opacity: 0;
}

.drawing-toolbar.visible {
    display: flex;
    animation: toolbar-slide-in 0.35s ease-out forwards;
}

@keyframes toolbar-slide-in {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.drawing-toolbar.dragging {
    transition: none;
    cursor: grabbing;
}

/* 拖动手柄 */
.drawing-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 42px;
    cursor: grab;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin-right: 2px;
}

.drawing-drag-handle:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.drawing-drag-handle:active {
    cursor: grabbing;
}

/* 工具栏按钮 */
.drawing-toolbar-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drawing-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.drawing-toolbar-btn.active {
    background: var(--subject-color, #3b82f6);
    box-shadow: 0 0 12px var(--subject-color, #3b82f6);
}

/* 激光笔按钮特殊样式 */
.drawing-toolbar-btn.laser-btn.active {
    background: #ef4444;
    box-shadow: 0 0 15px #ef4444;
}

/* 颜色按钮 - 色相环 */
.drawing-color-trigger {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: conic-gradient(hsl(0, 100%, 50%),
            hsl(30, 100%, 50%),
            hsl(60, 100%, 50%),
            hsl(90, 100%, 50%),
            hsl(120, 100%, 50%),
            hsl(150, 100%, 50%),
            hsl(180, 100%, 50%),
            hsl(210, 100%, 50%),
            hsl(240, 100%, 50%),
            hsl(270, 100%, 50%),
            hsl(300, 100%, 50%),
            hsl(330, 100%, 50%),
            hsl(360, 100%, 50%));
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.drawing-color-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, #fff 50%, transparent 51%);
}

.drawing-color-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.drawing-color-trigger .current-color {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 笔触大小按钮 */
.drawing-size-trigger {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawing-size-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.drawing-size-trigger .size-preview {
    border-radius: 50%;
    background: #fff;
    transition: all 0.2s ease;
}

/* 弹出选择器 - 通用样式 */
.drawing-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(30, 30, 46, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10002;
}

.drawing-popup.show {
    opacity: 1;
    visibility: visible;
}

.drawing-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(30, 30, 46, 0.98);
}

/* 颜色弹出选择器 */
.color-popup {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    min-width: 160px;
}

.color-popup-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.color-popup-btn:hover {
    transform: scale(1.15);
}

.color-popup-btn.active {
    border-color: #fff;
    box-shadow: 0 0 10px currentColor;
}

/* 笔触大小弹出选择器 */
.size-popup {
    display: flex;
    gap: 10px;
    padding: 8px;
}

.size-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-popup-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.size-popup-btn.active {
    border-color: var(--subject-color, #3b82f6);
    background: rgba(59, 130, 246, 0.2);
}

.size-popup-btn .dot {
    border-radius: 50%;
    background: #fff;
}

/* 橡皮擦弹出选择器 */
.eraser-popup {
    display: flex;
    gap: 10px;
    padding: 8px;
}

.eraser-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.eraser-popup-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.eraser-popup-btn.active {
    border-color: var(--subject-color, #3b82f6);
    background: rgba(59, 130, 246, 0.2);
}

.eraser-popup-btn .eraser-dot {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #fff;
}

/* 橡皮擦按钮激活状态 */
.drawing-toolbar-btn.eraser-btn.active {
    background: #6b7280;
    box-shadow: 0 0 12px rgba(107, 114, 128, 0.6);
}

/* 分隔线 */
.drawing-toolbar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 2px;
}

/* 响应式 */
@media (max-width: 768px) {
    .drawing-toggle-btn {
        bottom: 12px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .drawing-toggle-btn.position-right {
        right: 12px;
    }

    .drawing-toggle-btn.position-left {
        left: 12px;
    }

    .drawing-toolbar {
        bottom: 12px;
        padding: 6px 8px 6px 4px;
        gap: 4px;
    }

    .drawing-drag-handle {
        width: 24px;
        height: 36px;
        font-size: 12px;
    }

    .drawing-toolbar-btn,
    .drawing-color-trigger,
    .drawing-size-trigger {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .drawing-color-trigger .current-color {
        width: 14px;
        height: 14px;
    }

    .drawing-color-trigger::before {
        width: 16px;
        height: 16px;
    }

    .drawing-popup {
        padding: 10px;
    }

    .color-popup-btn {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .drawing-toggle-btn {
        bottom: 10px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .drawing-toggle-btn.position-right {
        right: 10px;
    }

    .drawing-toggle-btn.position-left {
        left: 10px;
    }

    .drawing-toolbar {
        padding: 5px 6px 5px 3px;
        gap: 3px;
        border-radius: 30px;
    }

    .drawing-drag-handle {
        width: 20px;
        height: 32px;
        font-size: 10px;
    }

    .drawing-toolbar-btn,
    .drawing-color-trigger,
    .drawing-size-trigger {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .drawing-color-trigger .current-color {
        width: 12px;
        height: 12px;
    }

    .drawing-color-trigger::before {
        width: 14px;
        height: 14px;
    }
}

/* ========================================
   缩略图网格响应式样式（兼容老浏览器）
   响应式列数（与左侧菜单1200px断点同步）
   >1500px: 5列, 1200-1500px: 4列, 993-1200px: 5列, 769-992px: 4列, ≤768px: 3列, ≤480px: 2列
   卡片比例 4:3（横向）
   ======================================== */
/* 超大屏幕 >1500px：5列（菜单显示） */
@media (min-width: 1501px) {
    .thumbnail-card {
        width: calc(20% - 8px);
        /* flexbox回退：5列 */
    }
}

@supports (display: grid) {
    @media (min-width: 1501px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(5, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* 大屏幕 1200-1500px：4列（菜单显示） */
@media (min-width: 1201px) and (max-width: 1500px) {
    .thumbnail-card {
        width: calc(25% - 8px);
        /* flexbox回退：4列 */
    }
}

@supports (display: grid) {
    @media (min-width: 1201px) and (max-width: 1500px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(4, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* 中等屏幕 993-1200px：5列（菜单隐藏，空间大） */
@media (min-width: 993px) and (max-width: 1200px) {
    .thumbnail-card {
        width: calc(20% - 8px);
        /* flexbox回退：5列 */
    }
}

@supports (display: grid) {
    @media (min-width: 993px) and (max-width: 1200px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(5, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* 平板设备 769-992px：4列 */
@media (min-width: 769px) and (max-width: 992px) {
    .thumbnail-card {
        width: calc(25% - 8px);
        /* flexbox回退：4列 */
    }
}

@supports (display: grid) {
    @media (min-width: 769px) and (max-width: 992px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(4, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* 小平板/大手机：3列 */
@media (max-width: 768px) {

    .thumbnail-grid,
    .thumbnail-panel .thumbnail-grid {
        gap: 6px;
        padding: 6px;
    }

    .thumbnail-card {
        width: calc(33.333% - 6px);
        /* flexbox回退：3列 */
    }
}

@supports (display: grid) {
    @media (max-width: 768px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(3, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* 手机设备：2列更紧凑 */
@media (max-width: 480px) {

    .thumbnail-grid,
    .thumbnail-panel .thumbnail-grid {
        gap: 5px;
        padding: 5px;
    }

    .thumbnail-card {
        width: calc(50% - 5px);
        /* flexbox回退：2列 */
    }
}

@supports (display: grid) {
    @media (max-width: 480px) {

        .thumbnail-grid,
        .thumbnail-panel .thumbnail-grid {
            grid-template-columns: repeat(2, 1fr);
            grid-auto-rows: auto;
        }

        .thumbnail-card {
            width: auto;
            height: auto;
        }
    }
}

/* ========================================
   骨架屏加载效果
   ======================================== */

/* 骨架屏动画 */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* 骨架基础样式 */
.skeleton {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* 深色主题骨架屏 */
.skeleton-dark {
    background: linear-gradient(90deg,
            #2a2a2a 25%,
            #3a3a3a 50%,
            #2a2a2a 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* 骨架屏容器 */
.skeleton-container {
    padding: 16px;
}

/* 侧边栏骨架屏 */
.skeleton-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.skeleton-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8f8f8;
}

.skeleton-sidebar-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.skeleton-sidebar-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-sidebar-title {
    height: 14px;
    width: 70%;
}

.skeleton-sidebar-meta {
    height: 10px;
    width: 50%;
}

/* 缩略图网格骨架屏 */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
}

.skeleton-card {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    border: 1px solid #e5e7eb;
}

.skeleton-card-image {
    height: 140px;
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-card-title {
    height: 16px;
    width: 80%;
}

.skeleton-card-meta {
    height: 12px;
    width: 60%;
}

/* GGB面板骨架屏 */
.skeleton-ggb {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8fafc;
}

.skeleton-ggb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.skeleton-ggb-title {
    height: 20px;
    width: 200px;
}

.skeleton-ggb-btn {
    height: 36px;
    width: 80px;
    border-radius: 8px;
}

.skeleton-ggb-canvas {
    flex: 1;
    margin: 16px;
    border-radius: 12px;
    background: linear-gradient(90deg,
            #e8e8e8 25%,
            #d8d8d8 50%,
            #e8e8e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* 列表项骨架屏 */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 8px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-text-line {
    height: 12px;
    border-radius: 4px;
}

.skeleton-text-line.short {
    width: 40%;
}

.skeleton-text-line.medium {
    width: 60%;
}

.skeleton-text-line.long {
    width: 80%;
}

/* 响应式骨架屏 */
@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .skeleton-card-image {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .skeleton-grid {
        gap: 8px;
        padding: 8px;
    }

    .skeleton-card-image {
        height: 80px;
    }

    .skeleton-card-content {
        padding: 8px;
    }
}

/* ========== 微信二维码弹窗 ========== */
.wechat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.wechat-modal.show {
    display: flex;
}

.wechat-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 16px;
}

.wechat-modal-content img {
    display: block;
    max-width: 390px;
    max-height: 85vh;
    border-radius: 8px;
}

.wechat-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.wechat-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 600px) {
    .wechat-modal-content img {
        max-width: 320px;
    }
}