* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #202122;
    background: #fff;
}

.sidebar {
    position: fixed;
    top: 50px;
    left: -15vw;
    width: 15vw;
    height: calc(100vh - 50px);
    background: #f8f9fa;
    border-right: 1px solid #a2a9b1;
    padding: 20px;
    transition: left 0.6s ease;
    overflow-y: auto;
    z-index: 99;
}

.sidebar-trigger {
    position: fixed;
    top: 50px;
    left: 0;
    width: 30px;
    height: calc(100vh - 50px);
    z-index: 98;
}

.sidebar-trigger:hover + .sidebar,
.sidebar:hover,
.sidebar.active,
.sidebar.locked {
    left: 0;
}

.sidebar.locked ~ .container {
    margin-left: 15vw;
}

.nav-section {
    margin: 8px 0;
}

.nav-section-title {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #202122;
    padding: 6px 0;
    font-weight: 500;
}

.nav-toggle {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    position: relative;
}

.nav-toggle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 2px solid #72777d;
    border-bottom: 2px solid #72777d;
    transform: translate(-75%, -50%) rotate(45deg);
    transition: transform 0.2s;
}

.nav-section.collapsed .nav-toggle::before {
    transform: translate(-75%, -75%) rotate(-45deg);
}

.nav-section.collapsed .nav-items {
    display: none;
}

.nav-items {
    margin-left: 24px;
}

.nav-link {
    color: #3366cc;
    text-decoration: none;
    display: block;
    padding: 4px 0;
    font-size: 14px;
}

.nav-link:hover {
    text-decoration: underline;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #fff;
    border-bottom: 1px solid #a2a9b1;
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 100;
    justify-content: space-between;
}

.header-title {
    font-size: 1.5em;
    font-weight: 500;
    margin-left: 20px;
}

.header-links {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-right: 20px;
}

.header-link {
    color: #3366cc;
    text-decoration: none;
    font-size: 14px;
}

.header-link:hover {
    text-decoration: underline;
}

.timeline-toggle {
    margin: 8px 0 16px;
    padding: 6px 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f7f7f7;
    color: #202122;
    font: inherit;
    cursor: pointer;
}

.timeline-toggle:hover,
.timeline-toggle:focus-visible {
    background: #eef2f5;
}

[hidden] {
    display: none !important;
}

#markdown-page-viewer.timeline-details-collapsed > ul > li > ul {
    display: none;
}

.container {
    width: 100%;
    flex: 1 0 auto;
    max-width: 70%;
    margin: 0 auto;
    padding: 10px 20px 40px;
    transition: margin-left 0.6s ease;
}

.title {
    text-align: center;
    font-size: 2em;
    margin-bottom: 20px;
    color: #000;
    white-space: nowrap;
}

.translation-line {
    display: inline;
    margin: 0;
    padding: 0;
}

.authors {
    text-align: center;
    margin: 20px 0 10px;
    line-height: 1.8;
}

.author-link {
    color: #3366cc;
    text-decoration: none;
}

.author-link:hover {
    text-decoration: underline;
}

.affiliations {
    text-align: center;
    margin: 10px 0;
    color: #666;
}

.links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 5px 0;
    padding: 0;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-radius: 4px;
    color: #202122;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.button:hover {
    background: #f0f0f0;
}

.button i {
    margin-right: 8px;
}

.video-container {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    /* 移除了固定的 padding-bottom 和 height: 0 */
}

.video-container video {
    width: 100%;
    height: auto; /* 高度会根据视频比例自动调整 */
    display: block; /* 防止底部可能出现的小空隙 */
}

/* Markdown and HTML section styles */
.markdown-section, .html-section {
    margin: 40px 0;
    scroll-margin-top: 70px;
}

.markdown-section h1, .html-section h1 {
    font-size: 1.8em;
    margin-bottom: 0.8em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #a2a9b1;
    color: #000;
    font-family: 'Linux Libertine','Georgia','Times',serif;
    position: relative;
}

.project-section h2,
.markdown-section h2, .html-section h2 {
    font-size: 1.5em;
    margin: 1em 0;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #c8ccd1;
    color: #162441;
    position: relative;
}

.markdown-section h3, .html-section h3 {
    font-size: 1.2em;
    margin: 0.8em 0;
    color: #162441;
    position: relative;
}

/* 标题锚点链接样式 */
.markdown-section .header-link,
.html-section .header-link {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    text-decoration: none;
    color: #666;
    font-weight: normal;
}

.markdown-section h1:hover .header-link,
.markdown-section h2:hover .header-link,
.markdown-section h3:hover .header-link,
.markdown-section h4:hover .header-link,
.markdown-section h5:hover .header-link,
.markdown-section h6:hover .header-link,
.html-section h1:hover .header-link,
.html-section h2:hover .header-link,
.html-section h3:hover .header-link,
.html-section h4:hover .header-link,
.html-section h5:hover .header-link,
.html-section h6:hover .header-link {
    opacity: 1;
}

.markdown-section .header-link:hover,
.html-section .header-link:hover {
    color: #3366cc;
    text-decoration: none;
}

/* Cite 按钮样式适配 */
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section h5,
.markdown-section h6,
.html-section h1,
.html-section h2,
.html-section h3,
.html-section h4,
.html-section h5,
.html-section h6 {
    position: relative;
    scroll-margin-top: 70px;
}

.markdown-section .cite-button,
.html-section .cite-button {
    position: absolute;
    right: -55px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    text-decoration: none;
    color: #666;
    font-weight: normal;
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.markdown-section h1:hover .cite-button,
.markdown-section h2:hover .cite-button,
.markdown-section h3:hover .cite-button,
.markdown-section h4:hover .cite-button,
.markdown-section h5:hover .cite-button,
.markdown-section h6:hover .cite-button,
.html-section h1:hover .cite-button,
.html-section h2:hover .cite-button,
.html-section h3:hover .cite-button,
.html-section h4:hover .cite-button,
.html-section h5:hover .cite-button,
.html-section h6:hover .cite-button {
    opacity: 1;
}

.markdown-section .cite-button:hover,
.html-section .cite-button:hover {
    color: #3366cc;
    border-color: #3366cc;
    text-decoration: none;
}

.markdown-section p, .html-section p {
    margin: 1em 0;
    line-height: 1.6;
}

.markdown-section pre, .html-section pre {
    margin: 1em 0;
    padding: 16px;
    background: #f6f8fa;
    border-radius: 4px;
    overflow-x: auto;
    font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
}

.markdown-section code, .html-section code {
    font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: #f6f8fa;
    border-radius: 3px;
}

.markdown-section img, .html-section img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
}

/* Demo section specific styles */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0px;
    margin: 0px 0;
}

.demo-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.demo-item:hover {
    transform: translateY(-5px);
}

.demo-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.demo-content {
    padding: 15px;
}

.demo-title {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #162441;
}

.demo-description {
    font-size: 0.9em;
    color: #666;
}

.lock-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    padding: 5px;
    z-index: 100;
}

footer {
    flex-shrink: 0;
    text-align: center;
    padding: 0px;
    margin-top: 0px;
    border-top: 1px solid #a2a9b1;
    font-size: 14px;
    color: #666;
}

footer a {
    color: #3366cc;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Unordered lists style */
.markdown-section ul, .html-section ul {
    padding-left: 40px; /* Consistent with main content padding */
    margin: 1em 0;      /* Same margin as paragraphs */
}

/* Ordered lists style */
.markdown-section ol, .html-section ol {
    padding-left: 40px; /* Consistent with main content padding */
    margin: 1em 0;      /* Same margin as paragraphs */
}

.footnote {
    color: #3366cc;
    position: relative;
    cursor: help;
}
.footnote:hover::after {
    content: attr(data-note);
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #333;
    color: white;
    padding: 8px 10px;
    border-radius: 4px;
    white-space: normal;
    max-width: 300px;
    min-width: 200px;
    font-size: 0.9em;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 1000;
    word-wrap: break-word;
}

/* 当脚注靠近右边缘时，让提示框向左显示 */
.footnote:hover::after {
    left: 50%;
    transform: translateX(-50%);
}

/* 添加小三角形指向脚注 */
.footnote:hover::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333;
    z-index: 1001;
}

/* 标题区域背景横幅 —— 全宽，紧贴导航栏 */
.hero-banner {
    position: relative;
    width: 100%;
    margin-top: 50px;
    padding: 0;
    overflow: hidden;
    background: #f7f9fb;
}

.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Legacy static gallery background:
    background-image: url('./images/background_gallery_big.gif');
    */
    background: linear-gradient(90deg, rgba(255,255,255,0.90), rgba(255,255,255,0.58), rgba(255,255,255,0.90));
    z-index: 1;
    pointer-events: none;
}

.qualitative-ribbon {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    opacity: 0.90;
    filter: saturate(0.92) contrast(0.96);
    pointer-events: none;
}

.qualitative-ribbon-track {
    display: flex;
    width: max-content;
    height: 100%;
    animation: qualitative-ribbon-scroll 72s linear infinite;
}

.qualitative-ribbon-group {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding-right: 12px;
}

.qualitative-ribbon img {
    display: block;
    width: auto;
    height: 100%;
    min-height: 210px;
    object-fit: cover;
}

@keyframes qualitative-ribbon-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.hero-inner {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    margin: 0 auto;
    padding: 42px 20px 20px;
}

.hero-inner .title,
.hero-inner .authors,
.hero-inner .affiliations,
.hero-inner .highlight-notice {
    text-shadow: 0 1px 10px rgba(255,255,255,0.98);
}

.project-section {
    margin: 42px 0;
}

.paper-cover-grid,
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 22px 0;
}

/* The four laws form one wide cover strip; the rest of the page stays readable. */
#teaser > details {
    width: 85vw;
    margin-left: calc(50% - 42.5vw);
    margin-right: calc(50% - 42.5vw);
    box-sizing: border-box;
}

.tldr-more {
    margin-top: 10px;
}

.tldr-more button {
    appearance: none;
    padding: 0;
    border: 0;
    color: #3366cc;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.tldr-more button:hover,
.tldr-more button:focus-visible {
    text-decoration: underline;
}

.tldr-list {
    margin: 14px 0 0 24px;
    padding-left: 18px;
}

.tldr-list li {
    margin: 8px 0;
    padding-left: 4px;
}

.paper-cover-grid {
    width: 85vw;
    margin-left: calc(50% - 42.5vw);
    margin-right: calc(50% - 42.5vw);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.paper-cover-panel,
.showcase-card {
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(31, 35, 40, 0.08);
}

.paper-cover-panel img,
.showcase-card img {
    display: block;
    width: 100%;
    height: auto;
}

.results-stage {
    display: grid;
    background: #0b0d10;
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    grid-template-areas:
        "previous image next"
        "caption caption caption";
    align-items: center;
}

.results-stage-link {
    grid-area: image;
    display: block;
    min-width: 0;
    padding: 12px 0;
    background: #0b0d10;
}

.results-stage figcaption {
    grid-area: caption;
    background: #fff;
    border-top: 1px solid #d8dee4;
}

.results-wall {
    display: grid;
    grid-template-columns: repeat(var(--wall-columns), minmax(0, 1fr));
    align-items: start;
    gap: 8px;
    width: min(96vw, 1800px);
    margin: 22px 0 0 50%;
    transform: translateX(-50%);
}

.results-wall-item {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(31, 35, 40, 0.08);
}

.results-wall-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #f6f8fa;
}

.results-wall-item figcaption {
    display: -webkit-box;
    min-height: 3.1em;
    padding: 6px 8px;
    overflow: hidden;
    border-top: 1px solid #d8dee4;
    color: #4f5964;
    font-size: clamp(10px, 0.75vw, 13px);
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.results-wall[data-results-wall="matrices"] .results-wall-item:first-child {
    grid-column: 1 / -1;
}

.results-wall[data-results-wall="matrices"] .results-wall-item img {
    aspect-ratio: auto;
}

.results-arrow {
    position: static;
    z-index: 3;
    width: 38px;
    height: 54px;
    padding: 0;
    justify-self: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.results-arrow:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.75);
}

.results-arrow-prev {
    grid-area: previous;
}

.results-arrow-next {
    grid-area: next;
}

.paper-cover-panel figcaption,
.showcase-card figcaption {
    padding: 10px 13px 12px;
    color: #4f5964;
    font-size: 0.92em;
    line-height: 1.45;
}

.paper-cover-caption {
    width: min(85vw, 1200px);
    max-width: none;
    margin: 14px 0 0 50%;
    transform: translateX(-50%);
    color: #3f4852;
    text-align: center;
}

.task-graph-figure {
    margin: 22px 0;
    text-align: center;
}

.task-graph-figure img {
    display: block;
    width: 100%;
    height: auto;
}

.task-graph-figure figcaption {
    margin-top: 12px;
    color: #4f5964;
    line-height: 1.5;
}

.image-viewer-host {
    position: relative;
}

.image-viewer-host img[data-image-viewer-ready] {
    cursor: crosshair;
}

.image-viewer-open,
.image-lightbox-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 5px;
    color: #fff;
    background: rgba(20, 24, 28, 0.82);
    font-size: 16px;
    cursor: pointer;
}

.image-viewer-open {
    position: absolute;
    z-index: 6;
    opacity: 0;
    transform: translateX(-100%);
    transition: opacity 0.16s ease, background-color 0.16s ease;
}

.image-viewer-host:hover > .image-viewer-open,
.image-viewer-host:focus-within > .image-viewer-open {
    opacity: 1;
}

.image-viewer-open:hover,
.image-viewer-open:focus-visible,
.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
    background: rgba(20, 24, 28, 0.96);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.image-magnifier-lens {
    position: fixed;
    z-index: 9998;
    width: 180px;
    height: 180px;
    border: 2px solid rgba(255, 255, 255, 0.96);
    border-radius: 50%;
    background-color: #fff;
    background-repeat: no-repeat;
    box-shadow: 0 5px 24px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.image-magnifier-lens[hidden],
.image-lightbox[hidden] {
    display: none;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(8, 10, 12, 0.78);
}

.image-lightbox-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80vw;
    height: 80vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    background: #0b0d10;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.image-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

html.image-lightbox-open,
html.image-lightbox-open body {
    overflow: hidden;
}

@media (max-width: 1100px) {
    .results-wall {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .results-wall[data-results-wall="analysis"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-wall[data-results-wall="matrices"] {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .results-wall,
    .results-wall[data-results-wall="analysis"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-wall[data-results-wall="matrices"] {
        grid-template-columns: 1fr;
    }

    .image-lightbox-panel {
        width: 92vw;
        height: 82vh;
    }
}

@media (max-width: 460px) {
    .results-wall,
    .results-wall[data-results-wall="matrices"],
    .results-wall[data-results-wall="analysis"] {
        grid-template-columns: 1fr;
    }
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0;
}

.metric-card {
    padding: 18px 12px;
    background: #f7f9fb;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    text-align: center;
}

.metric-value {
    display: block;
    color: #172b4d;
    font-size: 1.65em;
    font-weight: 700;
}

.metric-label {
    display: block;
    margin-top: 4px;
    color: #586069;
    font-size: 0.88em;
}

.experiment-summary strong {
    color: #c62828;
}

.experiment-example {
    margin-top: 1.15em;
}

@media (max-width: 760px) {
    .title {
        white-space: normal;
    }

    .showcase-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }

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

    .qualitative-ribbon-track {
        animation-duration: 48s;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .qualitative-ribbon-track {
        animation: none;
    }
}

/* 醒目说明样式 */
.highlight-notice {
    color: blue;
    font-family: 'Times New Roman', Times, serif;
    font-weight: bold;
    display: block;
    text-align: center;
}
