:root {
    --bg: #f3f5f8;
    --paper: #ffffff;
    --paper-soft: #f8fafc;
    --ink: #111827;
    --muted: #5f6b7a;
    --line: #d6dee8;
    --line-dark: #aeb9c8;
    --brand: #145da0;
    --brand-deep: #073763;
    --brand-soft: #e7f0fb;
    --accent: #0f4c81;
    --shadow-soft: 0 8px 22px rgba(15, 35, 55, 0.06);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
    line-height: 1.65;
    background: var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0));
    height: 220px;
    z-index: -1;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-deep);
    text-decoration: underline;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-top: 6px solid var(--brand-deep);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.header-inner {
    width: 100%;
    margin: 0;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    padding: 0;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 24px;
    background: var(--brand-deep);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 20px;
    letter-spacing: 0.04em;
}

.brand small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--line);
    background: #fff;
}

.top-nav button {
    border: 0;
    border-left: 1px solid var(--line);
    padding: 8px 16px;
    color: var(--brand-deep);
    background: #fff;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

.top-nav button:first-child {
    border-left: 0;
}

.top-nav button:hover {
    color: #fff;
    background: var(--brand);
}

.page-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 86px;
    display: grid;
    gap: 14px;
    max-height: calc(100vh - 102px);
    overflow: auto;
    padding-right: 2px;
}

.sidebar::-webkit-scrollbar,
.category-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.side-card,
.content-panel,
.source-group,
.home-section,
.file-card,
.hero-card,
.guide-card {
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}

.side-card {
    border-radius: var(--radius-md);
    padding: 16px;
}

.side-label,
.section-kicker,
.eyebrow,
.breadcrumb,
.home-kicker {
    margin: 0;
    color: var(--brand);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-card h2 {
    margin: 4px 0 12px;
    font-size: 18px;
    line-height: 1.25;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.summary-grid div,
.result-summary article {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--paper-soft);
}

.summary-grid strong,
.result-summary strong {
    display: block;
    color: var(--brand-deep);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 22px;
    line-height: 1.1;
}

.summary-grid span,
.result-summary span {
    color: var(--muted);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 12px;
}

.quick-entry {
    display: grid;
    gap: 8px;
}

.side-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.side-section-head h2 {
    margin: 0;
}

.side-section-head button,
.copy-btn {
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    padding: 5px 9px;
    color: var(--brand-deep);
    background: #fff;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 13px;
}

.side-section-head button:hover,
.copy-btn:hover {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.category-tree {
    display: grid;
    gap: 10px;
}

.category-tree.is-collapsed .category-group:not(:first-child) {
    display: none;
}

.category-group {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    overflow: hidden;
}

.category-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    background: #f6f8fb;
}

.category-group summary::-webkit-details-marker {
    display: none;
}

.category-group summary em {
    min-width: 34px;
    padding: 1px 8px;
    color: var(--brand-deep);
    font-size: 12px;
    font-style: normal;
    text-align: center;
    background: var(--brand-soft);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.group-description {
    margin: 8px 12px 6px;
    color: var(--muted);
    font-size: 12px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.category-buttons {
    display: grid;
    gap: 6px;
    padding: 0 8px 10px;
}

.category-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    text-align: left;
    color: var(--ink);
    background: #fff;
}

.category-button:hover {
    border-color: var(--line-dark);
    background: #f7fafd;
}

.category-button.active {
    color: #fff;
    border-color: var(--brand-deep);
    background: var(--brand-deep);
}

.category-button.active .button-meta {
    color: rgba(255, 255, 255, 0.78);
}

.button-title {
    font-weight: 700;
}

.button-meta {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.stats-panel {
    margin-bottom: 4px;
}

.hot-files {
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    font-size: 13px;
}

.hot-files li {
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.hot-files li:last-child {
    border-bottom: 0;
}

.hot-files a {
    display: block;
    color: var(--ink);
    font-weight: 700;
    word-break: break-word;
}

.hot-files em {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.content-panel {
    min-width: 0;
    border-radius: var(--radius-lg);
    padding: 22px;
    background: #fff;
}

.content-panel.is-home {
    border-color: transparent;
    box-shadow: none;
    padding-top: 0;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 18px;
    align-items: start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.content-panel.is-home .toolbar {
    display: block;
    border-bottom: 0;
    margin-bottom: 14px;
    padding-bottom: 0;
}

.content-panel.is-home .view-heading {
    display: none;
}

.view-heading h1 {
    margin: 4px 0 5px;
    font-size: clamp(26px, 3.4vw, 40px);
    line-height: 1.15;
    letter-spacing: 0.02em;
}

.view-heading p:last-child {
    margin: 0;
    color: var(--muted);
}

.search-box {
    display: grid;
    gap: 6px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.search-box span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.search-box input,
.sort-select {
    width: 100%;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    outline: none;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
}

.search-box input:focus,
.sort-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(20, 93, 160, 0.14);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.filter-chip {
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    padding: 7px 12px;
    color: var(--brand-deep);
    background: #fff;
}

.filter-chip:hover,
.filter-chip.active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.sort-select {
    width: auto;
    margin-left: auto;
    color: var(--ink);
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.file-grid {
    display: grid;
    gap: 16px;
}

.source-group {
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: none;
}

.source-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.source-title h2 {
    margin: 0;
    font-size: 20px;
}

.source-title p {
    margin: 0;
    max-width: 520px;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.file-card {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: none;
}

.file-card:hover {
    border-color: var(--brand);
    background: #f9fbfe;
}

.file-badge {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    background: var(--brand);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.file-badge.handout {
    background: #303946;
}

.file-info {
    min-width: 0;
}

.file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 7px;
}

.chip {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--muted);
    font-size: 11px;
    background: #f8fafc;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.file-title {
    margin: 0 0 7px;
    font-size: 16px;
    line-height: 1.45;
    word-break: break-word;
}

.file-path {
    margin: 0 0 10px;
    color: var(--muted);
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-all;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 7px 13px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    background: var(--brand-deep);
}

.download-btn:hover {
    color: #fff;
    text-decoration: none;
    background: var(--brand);
}

.empty-state,
.loading-card {
    border: 1px dashed var(--line-dark);
    border-radius: var(--radius-md);
    padding: 28px;
    color: var(--muted);
    background: #fff;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 8px;
    color: var(--ink);
}

.home-grid {
    display: block;
}

.home-title-band {
    width: calc(100% + 44px);
    margin: 0 -22px 18px;
    border: 0;
    border-radius: 0;
    padding: clamp(28px, 5vw, 48px) 22px;
    color: #fff;
    background: var(--brand-deep);
}

.home-title-band h1 {
    margin: 6px 0 8px;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: 0.04em;
}

.home-subtitle {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 22px;
}

.home-lead {
    max-width: 880px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
}

.home-kicker {
    color: rgba(255, 255, 255, 0.68);
}

.home-actions,
.compact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.primary-action,
.secondary-action {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 9px 15px;
    font-weight: 700;
}

.primary-action {
    color: var(--brand-deep);
    background: #fff;
}

.secondary-action {
    color: #fff;
    background: transparent;
}

.primary-action:hover {
    background: var(--brand-soft);
}

.secondary-action:hover {
    background: rgba(255, 255, 255, 0.14);
}

.home-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 18px;
    padding-top: 16px;
    color: rgba(255, 255, 255, 0.76);
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.home-stat-row b {
    color: #fff;
    font-size: 20px;
}

.home-section {
    border-radius: var(--radius-md);
    padding: clamp(18px, 3vw, 26px);
    margin-bottom: 14px;
    box-shadow: none;
}

.compact-section h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    color: var(--brand-deep);
    font-size: 24px;
    line-height: 1.25;
}

.home-section p,
.home-section li {
    color: #263241;
}

.home-section p {
    margin: 0 0 11px;
}

.home-section p:last-child {
    margin-bottom: 0;
}

.home-section ol,
.home-section ul {
    margin: 0;
    padding-left: 24px;
}

.home-section li + li {
    margin-top: 6px;
}

.thanks-list {
    columns: 2;
    column-gap: 34px;
}

.contact-info {
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.site-footer {
    margin-top: 24px;
    padding: 30px 28px 22px;
    color: rgba(255, 255, 255, 0.78);
    background: #111827;
}

.footer-grid {
    width: min(1440px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1.2fr;
    gap: 24px;
}

.site-footer h3 {
    margin: 0 0 10px;
    color: #fff;
}

.site-footer a {
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.82);
}

.site-footer p {
    margin: 0;
}

.friendly-links {
    display: block;
}

.friendly-links a {
    display: block;
    width: fit-content;
    margin: 6px 0;
    text-decoration: none;
}

.footer-bottom {
    width: min(1440px, 100%);
    margin: 22px auto 0;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.56);
    font-size: 13px;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

.footer-contact-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.footer-contact-links.icon-only a {
    width: 24px;
    height: 24px;
    justify-content: center;
}

.footer-contact-links.icon-only i {
    width: auto;
    font-size: 17px;
}

.ai-logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ai-logo {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: none !important;
    background: transparent !important;
    text-decoration: none;
    opacity: 0.82;
}

.ai-logo img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.ai-logo:hover {
    opacity: 1;
}

@media (max-width: 1120px) {
    .page-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-panel,
    .sidebar .side-card:nth-child(3) {
        grid-column: 1 / -1;
    }

    .category-tree {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .result-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .header-inner,
    .page-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-nav {
        width: 100%;
        overflow-x: auto;
    }

    .top-nav button {
        flex: 1;
        white-space: nowrap;
    }

    .page-shell {
        padding-top: 16px;
        gap: 16px;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }

    .category-tree {
        grid-template-columns: 1fr;
    }

    .content-panel {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .home-title-band {
        width: calc(100% + 32px);
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .filter-row {
        align-items: stretch;
    }

    .sort-select {
        width: 100%;
        margin-left: 0;
    }

    .result-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .source-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .source-title p {
        text-align: left;
    }

    .group-content {
        grid-template-columns: 1fr;
    }

    .thanks-list {
        columns: 1;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .result-summary {
        grid-template-columns: 1fr;
    }

    .file-card {
        grid-template-columns: 1fr;
    }

    .file-badge {
        width: 38px;
        height: 38px;
    }
}
