* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --brand: #2f6fed;
    --brand-2: #2bb3a6;
}


html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: #f6f8fb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-page-content {
    flex: 1;
}



.site-footer {
    margin-top: auto;
}


.navbar-clean {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.brand-title {
    color: #0f172a;
    letter-spacing: .5px;
}

.brand-sub {
    color: #64748b;
}

.navbar-main {
    width: 100%;
    padding: 12px 0;
}

.nav-brand-box {
    min-width: 0;
}

.nav-brand-box .navbar-brand {
    margin: 0;
    text-decoration: none;
}

.top-nav-wrap {
    min-width: 0;
    position: relative;
    overflow: visible;
}

.top-nav-menu {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: visible;
}

.top-nav-menu .nav-link {
    display: block;
    color: #475569;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
}

.top-nav-menu .nav-link:hover,
.top-nav-menu .nav-link.active {
    background: rgba(47, 111, 237, 0.08);
    color: #2f6fed;
}

.top-nav-menu .nav-item-has-sub {
    position: relative;
}

.top-nav-menu .nav-item-has-sub {
    position: relative;
}

.top-nav-menu .nav-item-has-sub>.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.top-nav-menu .nav-sub-caret {
    font-size: 12px;
    transition: transform .2s ease;
}

/* 鼠标移上去箭头旋转 */
.top-nav-menu .nav-item-has-sub:hover .nav-sub-caret,
.top-nav-menu .nav-item-has-sub:focus-within .nav-sub-caret {
    transform: rotate(180deg);
}

/* 关键：用 top:100% + padding-top 做缓冲，不用 margin-top 产生断层 */
.top-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    padding: 14px 8px 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .12);
    z-index: 5000;
}

/* 再加一个“悬停桥”，避免鼠标下移时 hover 断掉 */
.top-submenu::before {
    content: "";
    position: absolute;
    left: 0;
    top: -12px;
    width: 100%;
    height: 12px;
    background: transparent;
}

/* 鼠标悬停自动弹出 */
.top-nav-menu .nav-item-has-sub:hover .top-submenu,
.top-nav-menu .nav-item-has-sub:focus-within .top-submenu {
    display: block;
}

.top-submenu-link {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
}

.top-submenu-link:hover,
.top-submenu-link.active {
    color: #2f6fed;
    background: rgba(47, 111, 237, 0.08);
}

.right-actions,
.mobile-actions {
    flex-shrink: 0;
}

.navbar .user-dd {
    position: relative;
}

.navbar .user-dd .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    margin-top: 8px;
    padding: 8px 0;
    border-radius: 12px;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    z-index: 2000;
}

.navbar .user-dd .dropdown-item {
    padding: 12px 16px;
    white-space: nowrap;
}

.navbar {
    position: relative;
    z-index: 2001;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

@media (min-width: 992px) {
    .navbar-main {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        column-gap: 28px;
        padding: 14px 0;
    }

    .nav-brand-box .navbar-brand {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .nav-menu-row {
        min-width: 0;
        overflow: visible;
    }

    .desktop-nav-wrap {
        overflow: visible;
    }

    .top-nav-wrap {
        width: 100%;
        overflow: visible;
    }

    .top-nav-menu {
        justify-content: flex-start;
    }

    .desktop-only.right-actions {
        justify-self: end;
    }

    .mobile-only {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    .navbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 0;
    }

    .nav-brand-box {
        min-width: 0;
        flex: 1;
    }

    .mobile-actions {
        justify-self: end;
    }

    .nav-menu-row {
        min-width: 0;
    }

    .nav-brand-box .navbar-brand {
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
    }

    .brand-title {
        font-size: 1.5rem !important;
    }

    .brand-sub {
        font-size: 12px !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-actions .btn {
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    .brand-title {
        font-size: 1.7rem !important;
    }

    .brand-sub {
        font-size: 12px !important;
    }
}

#loginModal {
    z-index: 1060;
}

#pointPreviewModal {
    z-index: 3000;
}

.modal-backdrop {
    z-index: 1050;
}

.navbar {
    z-index: 1000 !important;
}

.chapter-nav {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.chapter-nav-item {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-radius: 999px;
    background: #f3f6fb;
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.chapter-nav-item.active,
.chapter-nav-item:hover {
    background: #e8f0ff;
    color: #2563eb;
}

.chapter-block {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
}

.chapter-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f7;
}

.chapter-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.chapter-meta {
    margin-top: 6px;
    color: #6b7280;
    font-size: 14px;
}

.section-block+.section-block {
    margin-top: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.section-count {
    font-size: 14px;
    color: #6b7280;
}

.point-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    transition: .2s ease;
    height: 100%;
}

.point-card:hover {
    transform: translateY(-4px);
}

.point-cover img {
    width: 100%;
    display: block;
}

.knowledge-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.point-body {
    padding: 14px 16px 18px;
}

.point-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #eaf2ff;
    color: #3b82f6;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.point-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    line-height: 1.5;
}

#pointPreviewModal .modal-dialog {
    max-width: 1388px;
}

#pointPreviewModal .modal-content {
    border: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

#pointPreviewModal .modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

#pointPreviewModal .modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
}

#pointPreviewModal .modal-body {
    padding: 16px;
    background: #f8fafc;
    max-height: 78vh;
    overflow-y: auto;
}

.desktop-nav-wrap {
    min-width: 0;
}

.mobile-top-actions {
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.mobile-drawer {
    display: none;
}

.mobile-drawer-divider {
    height: 1px;
    background: rgba(15, 23, 42, 0.08);
    margin: 4px 0 6px;
}

.mobile-drawer-btn {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #334155;
    font-size: 15px;
    line-height: 1.4;
    text-align: left;
}

.mobile-drawer-btn:hover {
    background: rgba(47, 111, 237, 0.08);
    border-color: rgba(47, 111, 237, 0.14);
    color: #2f6fed;
}

.mobile-sub-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #334155;
    font-size: 15px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.mobile-sub-toggle:hover,
.mobile-sub-toggle.active {
    color: #2f6fed;
    background: rgba(47, 111, 237, 0.08);
    border-color: rgba(47, 111, 237, 0.14);
}

.mobile-sub-toggle .mobile-sub-caret {
    font-size: 12px;
    transition: transform .2s ease;
}

.mobile-sub-links {
    max-height: 0;
    overflow: hidden;
    transition: max-height .22s ease;
    margin-left: 10px;
    border-left: 2px solid rgba(47, 111, 237, 0.18);
    padding-left: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-sub-group.open .mobile-sub-links {
    max-height: 320px;
}

.mobile-sub-group.open .mobile-sub-caret {
    transform: rotate(180deg);
}

.mobile-sub-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #475569;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 14px;
    line-height: 1.4;
}

.mobile-sub-link.active,
.mobile-sub-link:hover {
    color: #2f6fed;
    background: rgba(47, 111, 237, 0.08);
    border-color: rgba(47, 111, 237, 0.14);
}

@media (max-width: 991.98px) {
    .desktop-nav-wrap {
        display: none !important;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .navbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 0;
    }

    .nav-brand-box {
        min-width: 0;
        flex: 1;
    }

    .nav-brand-box .navbar-brand {
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
    }

    .brand-title {
        font-size: 1.5rem !important;
    }

    .brand-sub {
        font-size: 12px !important;
    }

    .mobile-drawer {
        display: block;
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s ease;
    }

    .mobile-drawer.open {
        max-height: 520px;
    }

    .mobile-drawer-inner {
        padding: 0 0 14px 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mobile-drawer-link {
        display: block;
        padding: 12px 14px;
        border-radius: 12px;
        text-decoration: none;
        color: #334155;
        background: #ffffff;
        border: 1px solid rgba(15, 23, 42, 0.08);
        font-size: 15px;
        line-height: 1.4;
    }

    .mobile-drawer-link.active,
    .mobile-drawer-link:hover {
        color: #2f6fed;
        background: rgba(47, 111, 237, 0.08);
        border-color: rgba(47, 111, 237, 0.14);
    }
}

.site-footer {
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    padding: 28px 0;
    margin-top: 40px;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.footer-title {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 4px;
}

.footer-desc {
    font-size: 14px;
    color: #6c757d;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links a {
    color: #495057;
    font-size: 14px;
    text-decoration: none;
}

.footer-links a:hover {
    color: #0d6efd;
}

.footer-meta {
    font-size: 1rem;
    color: #868e96;
    line-height: 1.8;
}

@media (max-width: 768px) {
    .site-footer {
        padding: 22px 0;
    }

    .footer-title {
        font-size: 16px;
    }

    .footer-desc,
    .footer-links a,
    .footer-meta {
         font-size: 1rem;
    }

    .footer-links {
        gap: 12px;
    }
}

/* PC端：鼠标悬停“我的”时自动显示下拉菜单 */
@media (min-width: 992px) {
    .user-dd:hover .dropdown-menu {
        display: block;
        margin-top: 0;
    }

    .user-dd:hover .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}