@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&family=Noto+Serif+SC:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400&display=swap');

:root {
    --bg: #0a0908;
    --bg-surface: #131110;
    --bg-elevated: #1c1916;
    --accent: #c9a84c;
    --accent-dim: #a08530;
    --accent-glow: rgba(201,168,76,0.08);
    --text-primary: #e8dfd0;
    --text-body: #c8bfb0;
    --text-muted: #7a7060;
    --text-faint: #4a4438;
    --border: #2a2520;
    --border-light: #3a3428;
    --serif: 'Noto Serif SC', 'Cormorant Garamond', Georgia, serif;
    --display: 'Cormorant Garamond', 'Noto Serif SC', Georgia, serif;
    --mono: 'JetBrains Mono', 'Courier New', monospace;
    --page-width: 21cm;
    --margin-left: 2.54cm;
    --margin-right: 2.54cm;
    --margin-top: 3.17cm;
    --margin-bottom: 3.17cm;
    --print-bg: #ffffff;
    --print-text: #1a1a1a;
    --print-text-muted: #333333;
    --print-border: #dddddd;
    --print-border-light: #eeeeee;
    --print-highlight: #f9f9f9;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--serif);
    font-size: 12pt;
    line-height: 1.85;
    color: var(--text-body);
    background-color: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    opacity: 0.025;
    pointer-events: none;
    z-index: 9999;
}

::selection {
    background: rgba(201,168,76,0.25);
    color: var(--text-primary);
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(201,168,76,0.3);
    transition: color 0.3s, border-color 0.3s;
}

a:hover {
    color: var(--accent-dim);
    border-bottom-color: var(--accent);
}

.main-content {
    max-width: var(--page-width);
    margin: 0 auto;
    background-color: transparent;
    min-height: 100vh;
    padding-left: var(--margin-left);
    padding-right: var(--margin-right);
    padding-top: var(--margin-top);
    padding-bottom: var(--margin-bottom);
    position: relative;
    transition: margin-left 0.4s cubic-bezier(0.16,1,0.3,1), padding-left 0.4s cubic-bezier(0.16,1,0.3,1), padding-right 0.4s cubic-bezier(0.16,1,0.3,1);
}

@media screen and (max-width: 1200px) {
    .main-content {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 60px;
        margin-left: 0;
    }
}

@media screen and (max-width: 768px) {
    .main-content {
        padding-left: 15px;
        padding-right: 15px;
        padding-top: 50px;
    }
}

.sidebar-toggle {
    position: fixed;
    bottom: 80px;
    left: 20px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
    transform: translateX(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    background-color: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
    transform: translateY(-2px);
}

.sidebar-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle.shifted {
    left: 300px;
}

.sidebar-toggle.hidden {
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
    z-index: 999;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) var(--bg);
}

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

@media screen and (max-width: 1200px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.visible {
        transform: translateX(0);
    }
}

.sidebar-header {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-header h3 {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-faint);
    text-align: center;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin-bottom: 0.15rem;
}

.toc-list a {
    display: block;
    padding: 0.3rem 0.6rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    border-left: 2px solid transparent;
    border-radius: 0 3px 3px 0;
    transition: all 0.25s;
    font-family: var(--serif);
    line-height: 1.5;
}

.toc-list a:hover {
    color: var(--text-body);
    background: var(--accent-glow);
    border-left-color: var(--accent-dim);
}

.toc-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-glow);
    font-weight: 500;
}

.sidebar-actions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
}

.sidebar-action-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.08em;
}

.sidebar-action-btn:hover {
    background-color: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.paper-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.header-meta {
    margin-bottom: 1.5rem;
}

.header-tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.paper-header h1 {
    font-family: var(--display);
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.25;
    letter-spacing: 0.02em;
}

.paper-header .subtitle {
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.header-en {
    font-family: var(--display);
    font-size: 0.9rem;
    font-weight: 300;
    font-style: italic;
    color: var(--text-faint);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.header-divider {
    width: 60px;
    height: 1px;
    background: var(--accent);
    margin: 0 auto 1.5rem;
    opacity: 0.5;
}

.author-info {
    margin-bottom: 1.8rem;
}

.author-info .author {
    font-size: 0.92rem;
    font-weight: 400;
    color: var(--text-body);
    margin-bottom: 0.3rem;
}

.author-info .author-name {
    font-weight: 500;
    color: var(--text-primary);
}

.author-info .affiliation {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.abstract {
    text-align: left;
    background-color: var(--accent-glow);
    padding: 1.5rem;
    border-left: 3px solid var(--accent);
    margin-bottom: 1.5rem;
    border-radius: 0 4px 4px 0;
}

.abstract h3 {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.abstract p {
    font-size: 0.95rem;
    line-height: 1.75;
    text-indent: 0;
    margin-bottom: 0;
    color: var(--text-primary);
}

.keywords {
    text-align: left;
}

.keywords h3 {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.keyword {
    display: inline-block;
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.25rem 0.8rem;
    border-radius: 3px;
    font-size: 0.82rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
    font-family: var(--serif);
}

.keyword:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.paper-body {
    margin-top: 30px;
}

.chapter {
    margin-bottom: 40px;
}

.chapter h2 {
    font-family: var(--display);
    font-size: 18pt;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    page-break-after: avoid;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.section {
    margin-bottom: 30px;
}

.section h3 {
    font-family: var(--display);
    font-size: 14pt;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    page-break-after: avoid;
    line-height: 1.35;
}

.section h4 {
    font-family: var(--serif);
    font-size: 12pt;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 20px;
}

.paper-body p {
    text-indent: 2em;
    margin-bottom: 15px;
    line-height: 1.85;
    text-align: justify;
    hyphens: auto;
}

.paper-body strong {
    font-weight: 600;
    color: var(--text-primary);
}

.paper-body em {
    font-style: italic;
    color: var(--text-body);
}

.paper-body ul,
.paper-body ol {
    margin-left: 2em;
    margin-bottom: 15px;
    line-height: 1.85;
}

.paper-body li {
    margin-bottom: 8px;
    padding-left: 0.3rem;
}

.paper-body li::marker {
    color: var(--accent-dim);
}

.paper-body li strong {
    font-weight: 600;
}

blockquote {
    margin: 1.8rem 0;
    padding: 1.2rem 1.5rem;
    background-color: var(--accent-glow);
    border-left: 3px solid var(--accent);
    font-style: italic;
    font-size: 1.02rem;
    line-height: 1.85;
    quotes: "\201C""\201D""\2018""\2019";
    border-radius: 0 4px 4px 0;
}

blockquote p {
    text-indent: 0;
    margin-bottom: 0;
    color: var(--text-primary);
}

.antinomy-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0 2rem;
    font-size: 0.92rem;
}

.antinomy-table th,
.antinomy-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    text-align: left;
    vertical-align: top;
}

.antinomy-table th {
    background-color: transparent;
    color: var(--accent);
    font-weight: 400;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-light);
}

.antinomy-table tr:nth-child(even) {
    background-color: transparent;
}

.antinomy-table tr:hover {
    background-color: var(--accent-glow);
}

.relation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0 2rem;
    font-size: 0.92rem;
}

.relation-table th,
.relation-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    text-align: left;
    vertical-align: top;
}

.relation-table th {
    background-color: transparent;
    color: var(--accent);
    font-weight: 400;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-light);
}

.relation-table tr:nth-child(even) {
    background-color: transparent;
}

.relation-table tr:hover {
    background-color: var(--accent-glow);
}

.concept-network {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.concept-network h2 {
    font-family: var(--display);
    font-size: 18pt;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: 0.02em;
}

.network-layer {
    margin-bottom: 35px;
    padding: 20px;
    background-color: var(--accent-glow);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.network-layer h3 {
    font-family: var(--display);
    font-size: 13pt;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.network-layer p {
    text-indent: 0;
    margin-bottom: 10px;
}

.network-layer ul {
    margin-left: 1.5em;
}

.network-layer li {
    margin-bottom: 6px;
}

.network-diagram {
    font-family: var(--mono);
    font-size: 9pt;
    line-height: 1.5;
    white-space: pre-wrap;
    background-color: var(--bg-elevated);
    color: var(--text-body);
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--border);
}

.network-diagram .highlight {
    color: var(--accent);
}

.network-diagram .accent {
    color: var(--accent-dim);
}

footer {
    margin-top: 6rem;
    border-top: 1px solid var(--border);
    padding: 4rem var(--margin-left) 4rem var(--margin-right);
    background: var(--bg-surface);
}

.footer-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 2rem;
}

footer .footer-brand {
    font-family: var(--display);
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

footer p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 0.8rem;
    text-indent: 0;
}

.footer-links {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: none;
    padding: 0.3rem 0;
    transition: color 0.3s;
    text-transform: uppercase;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    margin-top: 2rem;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-faint);
    letter-spacing: 0.05em;
}

.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, opacity 0.3s;
    z-index: 99;
}

.back-to-top:hover {
    background-color: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.back-to-top.visible {
    display: flex;
}

@media screen and (max-width: 768px) {
    .back-to-top {
        bottom: 70px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    .sidebar-toggle {
        bottom: 70px;
        left: 15px;
        width: 40px;
        height: 40px;
    }
    
    footer {
        padding: 2.5rem 0;
        margin-top: 3rem;
    }
    
    .footer-inner {
        padding: 0 1.2rem;
        max-width: 100%;
    }
    
    footer .footer-brand {
        font-size: 1.1rem;
    }
    
    footer p {
        font-size: 0.82rem;
    }
    
    .footer-links {
        gap: 1rem;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .footer-links a {
        font-size: 0.65rem;
    }
    
    .footer-copy {
        margin-top: 1.5rem;
        font-size: 0.6rem;
    }
}

@media screen and (min-width: 769px) and (max-width: 1200px) {
    footer {
        padding: 3rem 0;
        margin-top: 4rem;
    }
    
    .footer-inner {
        padding: 0 1.5rem;
        max-width: 90%;
    }
    
    footer .footer-brand {
        font-size: 1.25rem;
    }
}

@media screen and (min-width: 1201px) {
    body {
        padding-left: 280px;
        transition: padding-left 0.4s cubic-bezier(0.16,1,0.3,1);
    }
    
    body.no-sidebar {
        padding-left: 0;
    }
    
    .main-content {
        max-width: var(--page-width);
        margin: 0 auto;
    }
    
    footer {
        max-width: var(--page-width);
        margin: 0 auto;
    }
}

@media screen and (max-width: 767px) {
    :root {
        --margin-left: 15px;
        --margin-right: 15px;
        --margin-top: 50px;
    }
    
    .paper-header h1 {
        font-size: 1.5rem;
    }
    
    .paper-header .subtitle {
        font-size: 1rem;
    }
    
    .header-en {
        font-size: 0.8rem;
    }
    
    .chapter h2 {
        font-size: 1.25rem;
    }
    
    .section h3 {
        font-size: 1.05rem;
    }
    
    .keyword {
        font-size: 10pt;
        padding: 3px 10px;
    }
    
    .antinomy-table,
    .relation-table {
        font-size: 9pt;
    }
    
    .antinomy-table th,
    .antinomy-table td,
    .relation-table th,
    .relation-table td {
        padding: 8px 10px;
    }
    
    .network-diagram {
        font-size: 7pt;
    }
}

@media print {
    body {
        background-color: var(--print-bg);
        color: var(--print-text);
    }
    
    .sidebar,
    .sidebar-toggle,
    .back-to-top,
    footer {
        display: none !important;
    }
    
    .main-content {
        max-width: 100%;
        margin: 0;
        padding: var(--margin-top) var(--margin-left) var(--margin-bottom) var(--margin-right);
        box-shadow: none;
    }
    
    .paper-header {
        border-bottom-color: var(--print-border);
    }
    
    .paper-header h1,
    .paper-header h2,
    .chapter h2,
    .section h3,
    .section h4 {
        color: var(--print-text);
    }
    
    .paper-body p,
    .paper-body li {
        color: var(--print-text-muted);
    }
    
    .abstract {
        background-color: var(--print-highlight);
        border-left-color: var(--print-text);
    }
    
    .abstract p {
        color: var(--print-text-muted);
    }
    
    blockquote {
        background-color: var(--print-highlight);
        border-left-color: var(--print-text);
        page-break-inside: avoid;
    }
    
    blockquote p {
        color: var(--print-text-muted);
    }
    
    .chapter h2,
    .section h3 {
        page-break-after: avoid;
    }
    
    .section {
        page-break-inside: avoid;
    }
    
    .antinomy-table th,
    .relation-table th {
        color: var(--print-text);
        border-bottom-color: var(--print-border);
    }
    
    .antinomy-table td,
    .relation-table td {
        border-bottom-color: var(--print-border-light);
        color: var(--print-text-muted);
    }
    
    .keyword {
        background-color: var(--print-highlight);
        color: var(--print-text-muted);
        border-color: var(--print-border);
    }
}