:root {
    --bg: #eef1eb;
    --panel: #fbfcf8;
    --panel-border: #cfd6ca;
    --ink: #213028;
    --muted: #5a6a61;
    --accent: #375f4b;
    --accent-soft: #e4ece6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #e8ede5 0%, #f4f6f1 100%);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.5;
}

a {
    color: var(--accent);
}

.shell {
    min-height: 100vh;
    width: min(100%, 1680px);
    max-width: none;
    margin: 0 auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
}

.hero,
.sidebar,
.article-list,
.article-page,
.not-found {
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(33, 48, 40, 0.06);
}

.site-header {
    margin-bottom: 14px;
    padding: 4px 0;
}

.header-inner {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.header-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.title-card {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(33, 48, 40, 0.06);
}

.article-page,
.not-found {
    padding: 20px;
}

.layout {
    display: grid;
    gap: 16px;
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: stretch;
    flex: 1;
    min-height: 0;
    margin-bottom: 14px;
}

.sidebar {
    padding: 14px;
    position: relative;
    align-self: stretch;
    height: 100%;
    min-height: 100%;
    font-size: 0.82rem;
    line-height: 1.35;
}

.side-block + .side-block {
    margin-top: 18px;
}

.side-block h2,
.article-list h2 {
    margin-top: 0;
}

.side-block h2 {
    font-size: 0.98rem;
    margin-bottom: 8px;
}

.side-block ul {
    margin: 0;
    padding-left: 18px;
}

.side-block ul:has(.pin-mark) {
    list-style: none;
    padding-left: 0;
}

.side-block li {
    margin-bottom: 8px;
}

.side-block a {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.pin-mark {
    margin-right: 6px;
}

.article-list {
    padding: 16px 18px;
    border: 1px solid var(--panel-border);
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.header-search {
    min-width: min(340px, 100%);
    max-width: 380px;
    width: 100%;
}

.stage-note {
    margin-top: -4px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.92rem;
}

.article-card + .article-card {
    border-top: 1px solid var(--panel-border);
    margin-top: 18px;
    padding-top: 18px;
}

.topic-directory {
    display: grid;
    gap: 18px;
}

.topic-group {
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--panel-border);
}

.topic-group:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.topic-group h3 {
    margin: 0 0 10px;
}

.subtopic-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 0;
    padding-left: 18px;
}

.subtopic-list .article-card h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.summary {
    font-size: 1.05rem;
}

.search label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    font: inherit;
    padding: 8px 10px;
    background: #fff;
}

.search button {
    border: 0;
    border-radius: 12px;
    font: inherit;
    padding: 8px 12px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.article-header {
    margin-bottom: 16px;
}

.article-body h2:first-child {
    margin-top: 0;
}

.back-link {
    text-decoration: none;
    font-weight: 700;
}

.site-footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 14px 0 0;
    padding: 8px 12px;
    color: var(--ink);
    font-size: 0.82rem;
    margin-top: auto;
}

.footer-block {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
}

.empty-state {
    margin-bottom: 0;
}

@media (max-width: 860px) {
    body {
        font-size: 16px;
    }

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

    .search-row,
    .site-footer,
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-search {
        max-width: none;
    }

    .sidebar {
        align-self: start;
    }

    .subtopic-links {
        grid-template-columns: 1fr;
    }
}
