:root {
    --paper: #f5ede0;
    --paper-soft: rgba(255, 249, 240, 0.78);
    --paper-strong: rgba(255, 252, 246, 0.92);
    --ink: #241915;
    --muted: #72645c;
    --line: rgba(49, 34, 24, 0.12);
    --line-strong: rgba(49, 34, 24, 0.22);
    --accent: #b54134;
    --accent-soft: rgba(181, 65, 52, 0.11);
    --shadow: 0 28px 72px rgba(85, 56, 31, 0.14);
    --radius-lg: 30px;
    --radius-md: 22px;
    --radius-sm: 16px;
    --max-width: 1240px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 12%, rgba(181, 65, 52, 0.12), transparent 24%),
        radial-gradient(circle at 84% 18%, rgba(31, 102, 94, 0.12), transparent 20%),
        linear-gradient(180deg, #eee3d4 0%, #f7efe5 42%, #ebe0d1 100%);
    color: var(--ink);
    font-family: "Noto Serif SC", "Songti SC", serif;
}

body {
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 24%, transparent 76%, rgba(255, 255, 255, 0.16)),
        repeating-linear-gradient(0deg, rgba(73, 52, 39, 0.025) 0, rgba(73, 52, 39, 0.025) 1px, transparent 1px, transparent 5px);
    opacity: 0.74;
}

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

input,
button {
    font: inherit;
}

code {
    padding: 0.12em 0.42em;
    border-radius: 8px;
    background: rgba(36, 25, 21, 0.08);
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 0.92em;
}

.notes-page {
    position: relative;
    z-index: 1;
    width: min(calc(100% - 44px), var(--max-width));
    margin: 0 auto;
    padding: 28px 0 42px;
}

.notes-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}

.notes-brand,
.eyebrow,
.notes-nav a,
.note-link,
.related-link,
.toc-item,
.category-chip,
.note-meta span,
.search-box span {
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.notes-brand {
    font-family: "Cormorant Garamond", "Noto Serif SC", serif;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 0.92;
}

.notes-nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.notes-nav a {
    color: var(--muted);
    font-size: 0.84rem;
    transition: color 180ms ease, transform 180ms ease;
}

.notes-nav a:hover,
.note-link:hover,
.related-link:hover,
.toc-item:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

.notes-hero,
.notes-controls,
.notes-list-section,
.note-article-shell,
.sidebar-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--paper-soft);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.notes-hero::before,
.note-article-shell::before,
.sidebar-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 40%),
        radial-gradient(circle at 88% 16%, rgba(181, 65, 52, 0.12), transparent 22%);
    pointer-events: none;
}

.notes-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.64fr) minmax(280px, 0.36fr);
    gap: 18px;
    padding: 28px;
}

.eyebrow {
    color: var(--accent);
    letter-spacing: 0.18em;
    font-size: 0.76rem;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.notes-hero h1,
.note-meta-band h1 {
    margin-top: 12px;
    font-family: "Cormorant Garamond", "Noto Serif SC", serif;
    line-height: 0.98;
    overflow-wrap: anywhere;
}

.notes-hero h1 {
    font-size: clamp(2.2rem, 3.8vw, 3.4rem);
    max-width: none;
}

.note-meta-band h1 {
    font-size: clamp(1.9rem, 3vw, 2.9rem);
    max-width: none;
}

.notes-hero p,
.notes-list-head p,
.note-meta-band p,
.note-card p,
.notes-stat p,
.markdown-body p,
.markdown-body li,
.toc-list p,
.related-link span {
    color: var(--muted);
    line-height: 1.92;
    overflow-wrap: anywhere;
}

.notes-hero-copy p:last-child {
    margin-top: 16px;
    max-width: 56ch;
}

.notes-hero-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.notes-stat,
.note-card,
.sidebar-card,
.notes-controls,
.notes-list-section,
.note-meta-band {
    background: var(--paper-strong);
}

.notes-stat {
    position: relative;
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.notes-stat::before,
.note-card::before,
.sidebar-card::after {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 62px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), rgba(181, 65, 52, 0));
}

.notes-stat strong {
    display: block;
    margin: 10px 0 10px;
    font-family: "Cormorant Garamond", "Noto Serif SC", serif;
    font-size: clamp(1.2rem, 1.8vw, 1.65rem);
    line-height: 1.14;
    overflow-wrap: anywhere;
}

.notes-controls,
.notes-list-section,
.note-article-shell,
.sidebar-card {
    margin-top: 18px;
}

.notes-controls,
.notes-list-section,
.note-meta-band,
.sidebar-card,
.note-card {
    padding: 24px;
}

.search-box {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.search-box span {
    color: var(--muted);
}

.search-box input {
    width: 100%;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.44);
    color: var(--ink);
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.search-box input:focus {
    border-color: rgba(181, 65, 52, 0.35);
    box-shadow: 0 0 0 4px rgba(181, 65, 52, 0.08);
    transform: translateY(-1px);
}

.category-bar,
.note-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.category-chip,
.note-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.44);
    color: #4a3b34;
}

.category-chip {
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.category-chip:hover {
    transform: translateY(-1px);
}

.category-chip.is-active {
    background: rgba(181, 65, 52, 0.12);
    border-color: rgba(181, 65, 52, 0.34);
    color: var(--ink);
}

.notes-list-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.notes-list-head h2,
.sidebar-card h2 {
    margin-top: 10px;
    font-size: 1.5rem;
    overflow-wrap: anywhere;
}

.notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.note-card {
    position: relative;
    display: grid;
    gap: 14px;
    min-height: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
}

.note-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.note-card h3,
.related-link strong {
    overflow-wrap: anywhere;
}

.note-card-empty {
    grid-column: 1 / -1;
}

.note-link {
    width: fit-content;
    margin-top: auto;
    color: var(--accent);
    font-weight: 600;
    transition: color 180ms ease, transform 180ms ease;
}

.note-link::after {
    content: " ↗";
}

.note-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(250px, 0.22fr);
    gap: 18px;
}

.note-article-shell {
    background: rgba(255, 249, 240, 0.84);
}

.note-meta-band {
    position: relative;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(181, 65, 52, 0.08), transparent 52%),
        rgba(255, 252, 246, 0.88);
}

.note-meta-band #note-summary {
    margin: 16px 0 18px;
}

.note-sidebar {
    display: grid;
    gap: 18px;
    align-self: start;
    position: sticky;
    top: 18px;
}

.toc-list,
.related-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.toc-item,
.related-link {
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.44);
    transition: color 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.toc-item {
    padding: 10px 12px;
    overflow-wrap: anywhere;
}

.toc-item.depth-h3 {
    margin-left: 12px;
}

.toc-item.depth-h4 {
    margin-left: 24px;
}

.related-link {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
}

.related-link strong {
    color: var(--ink);
    font-size: 1rem;
}

.markdown-body {
    padding: 34px 30px 40px;
}

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 1.4em 0 0.55em;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.markdown-body h1 {
    font-size: 2rem;
}

.markdown-body h2 {
    font-size: 1.58rem;
}

.markdown-body h3 {
    font-size: 1.24rem;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body table {
    margin: 0 0 1.2em;
}

.markdown-body p,
.markdown-body li {
    font-size: 1.02rem;
}

.markdown-body a {
    color: var(--accent);
    overflow-wrap: anywhere;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.45em;
}

.markdown-body blockquote {
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    background: rgba(181, 65, 52, 0.07);
    border-radius: 0 14px 14px 0;
}

.markdown-body pre {
    overflow: auto;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #2c221d;
    color: #f8eee7;
}

.markdown-body code {
    padding: 0.14em 0.42em;
    border-radius: 8px;
    background: rgba(36, 25, 21, 0.08);
}

.markdown-body pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
}

.markdown-body th,
.markdown-body td {
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 16px;
}

@media (max-width: 1080px) {
    .notes-hero,
    .note-layout,
    .notes-hero-panel {
        grid-template-columns: 1fr;
    }

    .note-sidebar {
        position: static;
    }
}

@media (max-width: 720px) {
    .notes-page {
        width: min(calc(100% - 24px), var(--max-width));
    }

    .notes-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .notes-hero,
    .notes-controls,
    .notes-list-section,
    .note-meta-band,
    .sidebar-card,
    .note-card,
    .markdown-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .notes-hero h1,
    .note-meta-band h1 {
        font-size: 2rem;
    }

    .notes-list-head,
    .note-card header {
        display: grid;
        justify-content: stretch;
    }
}
