/* ============================================
   Personal Wiki - Public Stylesheet
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg: #ffffff;
    --color-surface: #f8f9fa;
    --color-border: #e2e8f0;
    --color-text: #1a202c;
    --color-text-secondary: #64748b;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-accent: #f59e0b;
    --color-glossary: #8b5cf6;
    --color-glossary-bg: #f5f3ff;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
    --max-width: 960px;
    --header-height: 56px;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* --- Header --- */
.site-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    height: 100%;
}
.site-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    color: var(--color-text);
}
.site-logo:hover { text-decoration: none; }
.site-brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.site-logo-image {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(360px, 43vw);
    object-fit: contain;
}
.site-brand-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}
.site-brand-subtitle {
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
}
.nav-list > li {
    position: relative;
}
.nav-list a {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-list a:hover, .nav-list a.active {
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
}
.nav-rss a {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.nav-more {
    display: none;
}
.nav-more-toggle {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border-radius: 6px;
    padding: 0.34rem 0.52rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.nav-more-toggle:hover,
.nav-more-toggle[aria-expanded="true"] {
    color: var(--color-text);
    border-color: var(--color-primary);
    background: #f8fafc;
}
.nav-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 170px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.14);
    padding: 0.35rem;
    z-index: 260;
}
.nav-more-menu a {
    display: block;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.82rem;
    font-weight: 600;
}
.nav-more-menu a:hover,
.nav-more-menu a.active {
    text-decoration: none;
    background: #f8fafc;
}

.search-form-inline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}
.search-form-inline input {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 180px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-form-inline input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.search-submit {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.38rem 0.55rem;
    cursor: pointer;
}
.search-submit:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.search-form,
.search-form-hero {
    position: relative;
}
.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: min(72vh, 460px);
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    z-index: 250;
}
.search-suggest-group {
    padding: 0.4rem 0;
}
.search-suggest-group + .search-suggest-group {
    border-top: 1px solid #eef2f7;
}
.search-suggest-title {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0 0.75rem 0.3rem;
}
.search-suggest-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    padding: 0.46rem 0.75rem;
    color: var(--color-text);
    text-decoration: none;
}
.search-suggest-item:hover,
.search-suggest-item.is-active {
    text-decoration: none;
    background: #f8fafc;
}
.search-suggest-thumb {
    width: 42px;
    height: 26px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}
.search-suggest-thumb-placeholder {
    display: grid;
    place-items: center;
    color: var(--color-text-secondary);
    font-size: 0.74rem;
    font-weight: 700;
}
.search-suggest-text {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}
.search-suggest-text strong {
    font-size: 0.86rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-suggest-meta {
    font-size: 0.76rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-suggest-more {
    display: block;
    padding: 0.58rem 0.75rem;
    border-top: 1px solid #eef2f7;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
}
.search-suggest-more:hover {
    text-decoration: none;
    background: #f8fafc;
}

/* --- Main --- */
.site-main { min-height: calc(100vh - var(--header-height) - 60px); padding: 2rem 0; }

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 3rem 0 2.5rem;
}
.hero h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.hero-desc { color: var(--color-text-secondary); margin: 0.5rem 0 1.5rem; }
.search-form-hero {
    display: flex;
    gap: 0.5rem;
    max-width: 480px;
    margin: 0 auto;
}
.search-form-hero input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}
.search-form-hero input:focus { outline: none; border-color: var(--color-primary); }
.search-form-hero button {
    padding: 0.6rem 1.2rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
}
.search-form-hero button:hover { background: var(--color-primary-hover); }

/* --- Home Grid --- */
.home-grid { display: grid; gap: 2.5rem; }
.home-section {}
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-header h2 { font-size: 1.25rem; font-weight: 700; }
.view-all {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-weight: 500;
}

/* --- Article Cards --- */
.article-list, .articles-grid {
    display: grid;
    gap: 0.75rem;
}
.articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.article-card { height: 100%; }

.article-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.article-card a:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
    text-decoration: none;
}
.article-cover-thumb-wrap {
    width: 100%;
    height: 170px;
    margin-bottom: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-surface);
}
.article-cover-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.article-cover-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}
.article-card h2, .article-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.45;
    min-height: calc(1.45em * 2);
}
.article-excerpt {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0.3rem 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    min-height: calc(1.6em * 3);
}
.article-card time {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: auto;
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--color-surface);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-right: 0.3rem;
}

/* --- Category Filter --- */
.category-filter { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-tag {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}
.filter-tag:hover, .filter-tag.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    text-decoration: none;
}
.popular-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1.35rem 0 0;
}
.popular-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    padding: 0.7rem 0.8rem;
}
.popular-title {
    font-size: 0.92rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
}
.popular-list {
    list-style: none;
    display: grid;
    gap: 0.28rem;
}
.popular-item {
    min-width: 0;
}
.popular-link {
    display: grid;
    grid-template-columns: 24px 58px minmax(0, 1fr);
    align-items: center;
    gap: 0.48rem;
    padding: 0.28rem 0.2rem;
    border-radius: 6px;
    color: var(--color-text);
}
.popular-link:hover {
    text-decoration: none;
    background: #f8fafc;
}
.popular-rank {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}
.popular-thumb-wrap {
    width: 58px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--color-surface);
    display: block;
}
.popular-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.popular-thumb-placeholder {
    display: grid;
    place-items: center;
    color: var(--color-text-secondary);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.popular-text {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}
.popular-item-title {
    font-size: 0.86rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.popular-item-meta {
    color: var(--color-text-secondary);
    font-size: 0.74rem;
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
    flex-wrap: wrap;
}
.list-pagination {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
}
.pagination-link {
    display: inline-block;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    padding: 0.35rem 0.65rem;
    font-size: 0.86rem;
    line-height: 1.35;
}
.pagination-link:hover {
    text-decoration: none;
    border-color: var(--color-primary);
}
.pagination-number {
    min-width: 2rem;
    text-align: center;
}
.pagination-number.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    pointer-events: none;
}
.pagination-ellipsis {
    color: var(--color-text-secondary);
    padding: 0.2rem 0.3rem;
    font-size: 0.9rem;
}

/* --- Article Detail --- */
.article-detail { max-width: 720px; margin: 0 auto; }
.article-header { margin-bottom: 2rem; }
.article-header h1 { font-size: 1.8rem; font-weight: 800; line-height: 1.3; margin-top: 0.5rem; }
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}
.article-share {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}
.article-share .btn {
    padding: 0.38rem 0.72rem;
    font-size: 0.82rem;
}
.btn-share-x {
    border-color: #0f172a;
    color: #0f172a;
}
.btn-share-x:hover {
    background: #0f172a;
    color: #fff;
}
.copy-status {
    min-height: 1.2em;
    font-size: 0.78rem;
    color: #166534;
    font-weight: 600;
}
.copy-status.is-error {
    color: #b91c1c;
}
.meta-chip {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.meta-chip-updated {
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}
.article-cover-main-wrap { margin-bottom: 1rem; }
.article-cover-main {
    display: block;
    width: min(100%, 620px);
    height: auto;
    max-height: 360px;
    margin: 0 auto;
    object-fit: contain;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.article-highlight-note {
    margin: 0 0 0.9rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.83rem;
    font-weight: 600;
}
.article-pager {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.pager-link {
    display: block;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.8rem 0.9rem;
    color: var(--color-text);
    background: var(--color-bg);
}
.pager-link:hover {
    text-decoration: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.pager-label {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}
.pager-title {
    display: block;
    line-height: 1.45;
    font-size: 0.93rem;
}
.pager-next { text-align: right; }
.pager-spacer { display: block; }
.topic-request-panel {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fcfdff;
}
.community-page .topic-request-panel {
    margin-top: 0;
}
.topic-request-title {
    font-size: 1.02rem;
    font-weight: 800;
    margin: 0;
}
.topic-request-desc {
    margin-top: 0.32rem;
    color: var(--color-text-secondary);
    font-size: 0.86rem;
}
.topic-request-flash {
    margin-top: 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.4rem 0.55rem;
    font-size: 0.84rem;
    font-weight: 600;
}
.topic-request-flash.is-success {
    color: #166534;
    border-color: #86efac;
    background: #f0fdf4;
}
.topic-request-flash.is-error {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}
.topic-request-form {
    margin-top: 0.65rem;
}
.topic-request-form .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.topic-request-form .form-group {
    margin-bottom: 0.55rem;
}
.topic-request-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.22rem;
}
.topic-request-form input,
.topic-request-form textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.48rem 0.62rem;
    font-size: 0.9rem;
    font-family: inherit;
}
.topic-request-form textarea {
    resize: vertical;
    min-height: 92px;
}
.topic-request-form input:focus,
.topic-request-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}
.topic-request-trap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* --- Detail TOC --- */
.toc-box {
    margin: 0 0 1.2rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fcfdff;
}
.toc-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.55rem;
}
.toc-list {
    list-style: none;
    display: grid;
    gap: 0.35rem;
}
.toc-item a {
    display: inline-block;
    color: var(--color-text-secondary);
    border-bottom: 1px dashed transparent;
    font-size: 0.9rem;
    line-height: 1.5;
}
.toc-item a:hover {
    color: var(--color-primary);
    text-decoration: none;
    border-color: var(--color-primary);
}
.toc-item a.active {
    color: var(--color-primary);
    font-weight: 600;
    border-color: var(--color-primary);
}
.toc-item.toc-h3 {
    padding-left: 0.9rem;
}
.article-body h2,
.article-body h3,
.term-body h2,
.term-body h3 {
    scroll-margin-top: calc(var(--header-height) + 16px);
}

/* --- Prose (article body) --- */
.prose { line-height: 1.8; }
.prose h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; padding-bottom: 0.3rem; border-bottom: 2px solid var(--color-surface); }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.prose p { margin: 0.8rem 0; }
.prose .embed-card { margin: 1rem 0; }
.prose .embed-youtube {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 1rem auto;
    padding-top: 56.25%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}
.prose .embed-youtube iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.prose .embed-x .twitter-tweet {
    margin: 0.6rem auto !important;
}
.prose ul, .prose ol { margin: 0.8rem 0; padding-left: 1.5rem; }
.prose li { margin: 0.3rem 0; }
.prose blockquote {
    border-left: 3px solid var(--color-primary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    background: var(--color-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.prose pre {
    background: #f6f8fa;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.88rem;
    margin: 1rem 0;
    border: 1px solid var(--color-border);
}
.prose code { font-family: var(--font-mono); font-size: 0.9em; }
.prose p code, .prose li code {
    background: #f0f0f0;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.prose th, .prose td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.prose th { background: var(--color-surface); font-weight: 600; }
.prose img {
    display: block;
    width: auto;
    max-width: min(100%, 480px);
    max-height: 320px;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    margin: 1rem auto;
}

/* --- Glossary Auto-Link Tooltip --- */
.glossary-link {
    color: var(--color-glossary);
    border-bottom: 1px dashed var(--color-glossary);
    text-decoration: none;
    position: relative;
    cursor: help;
}
.glossary-link:hover { text-decoration: none; }
.glossary-link-highlight {
    background: #fff3c4;
    border-bottom-color: #d97706;
    box-shadow: inset 0 -1px 0 #d97706;
    border-radius: 3px;
    padding: 0 0.08em;
}
.glossary-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: normal;
    width: max-content;
    max-width: 300px;
    z-index: 200;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.glossary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-text);
}

/* --- Glossary Index --- */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 800; }
.page-desc { color: var(--color-text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.community-page {
    max-width: 780px;
}
.community-header {
    margin-bottom: 1rem;
}
.community-card {
    margin-bottom: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
}
.community-card h2 {
    font-size: 1.04rem;
    font-weight: 800;
    margin: 0 0 0.45rem;
}
.community-prose {
    font-size: 0.92rem;
}
.community-prose > :first-child {
    margin-top: 0;
}
.community-prose > :last-child {
    margin-bottom: 0;
}
.article-confirm-box { margin-bottom: 1rem; }
.article-confirm-panel {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}
.article-confirm-panel h2 { font-size: 1.2rem; font-weight: 700; }
.article-confirm-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.glossary-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 2rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    position: sticky;
    top: calc(var(--header-height) + 8px);
    z-index: 70;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.glossary-nav a {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}
.glossary-nav a:hover,
.glossary-nav a.active {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}

.glossary-group {
    margin-bottom: 2rem;
    scroll-margin-top: calc(var(--header-height) + 84px);
}
.group-initial {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
}
.glossary-dl { }
.glossary-item {
    border-bottom: 1px solid #f1f5f9;
}
.glossary-item-link {
    display: block;
    padding: 0.5rem 0;
    color: inherit;
    border-radius: 6px;
    transition: background 0.15s;
}
.glossary-item-link:hover {
    text-decoration: none;
    background: #f8fafc;
}
.glossary-item-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.glossary-item-content {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}
.glossary-thumb-link {
    flex-shrink: 0;
    width: 120px;
    display: block;
}
.glossary-thumb-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
}
.glossary-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--color-surface);
    border-radius: 6px;
    border: 1px solid var(--color-border);
}
.glossary-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
}
.glossary-item-text { min-width: 0; flex: 1; }
.glossary-item dt { font-weight: 600; }
.glossary-item .term-link-text { color: var(--color-text); }
.glossary-item-link:hover .term-link-text { color: var(--color-primary); }
.glossary-item dt .reading { font-weight: 400; color: var(--color-text-secondary); font-size: 0.85rem; }
.glossary-item dd { color: var(--color-text-secondary); font-size: 0.9rem; margin-top: 0.15rem; }

/* --- Glossary Detail --- */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}
.term-detail h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.5rem; }
.term-reading, .term-aliases { font-size: 0.9rem; color: var(--color-text-secondary); }
.term-actions { margin: 0 0 1rem; }
.back-link { font-size: 0.82rem; }
.term-shortdef {
    background: var(--color-glossary-bg);
    border-left: 3px solid var(--color-glossary);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1.05rem;
}
.term-body { margin-top: 1.5rem; }
.term-cover-main-wrap { margin: 1rem 0 1.2rem; }
.term-cover-main {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 420px;
    margin: 0 auto;
    object-fit: contain;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

/* --- Term Home List --- */
.term-list-home { list-style: none; }
.term-list-home li { border-bottom: 1px solid #f1f5f9; }
.term-list-home li a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.6rem 0;
    color: var(--color-text);
    gap: 1rem;
}
.term-list-home li a:hover { text-decoration: none; color: var(--color-primary); }
.term-def { font-size: 0.85rem; color: var(--color-text-secondary); text-align: right; flex-shrink: 1; }

/* --- Reverse Index --- */
.reverse-index, .related-articles {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}
.related-articles-horizontal .related-horizontal-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
    grid-auto-rows: 124px;
}
.related-articles-horizontal .related-horizontal-item {
    padding: 0;
    border-bottom: none;
    display: block;
    justify-content: initial;
    align-items: initial;
    height: 100%;
}
.related-horizontal-link {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    height: 100%;
}
.related-horizontal-link:hover {
    text-decoration: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    background: #fbfdff;
}
.related-horizontal-thumb-wrap {
    flex-shrink: 0;
    width: 124px;
    display: flex;
    align-items: center;
}
.related-horizontal-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}
.related-horizontal-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}
.related-horizontal-text {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 0.2rem;
}
.related-horizontal-title {
    color: var(--color-text);
    line-height: 1.45;
    font-size: 0.96rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.related-horizontal-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.28rem;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
}
.related-horizontal-excerpt {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.related-articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.8rem;
}
.related-articles-cards .article-card a {
    padding: 0.75rem 0.85rem;
}
.related-articles-cards .article-cover-thumb-wrap {
    height: 124px;
}
.related-articles-cards .article-card h2,
.related-articles-cards .article-card h3 {
    font-size: 0.95rem;
    min-height: calc(1.4em * 2);
}
.related-articles-cards .article-excerpt {
    font-size: 0.8rem;
    min-height: calc(1.5em * 2);
    -webkit-line-clamp: 2;
}
.reverse-index h2, .related-articles h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.reverse-index ul, .related-articles ul { list-style: none; }
.reverse-index li, .related-articles li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.reverse-index li time { font-size: 0.8rem; color: var(--color-text-secondary); }

/* --- Search --- */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.search-form input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}
.search-form input:focus { outline: none; border-color: var(--color-primary); }
.search-form button {
    padding: 0.6rem 1.2rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
}
.search-summary { color: var(--color-text-secondary); margin-bottom: 1.5rem; }
.search-section { margin-bottom: 2rem; }
.search-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.search-results { list-style: none; }
.search-results li { border-bottom: 1px solid #f1f5f9; }
.search-results li a {
    display: block;
    padding: 0.75rem 0;
    color: var(--color-text);
}
.search-results li a:hover { text-decoration: none; color: var(--color-primary); }
.search-results li a strong { font-weight: 600; }
.search-results li a p { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 0.2rem; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
    text-decoration: none;
}
.btn-outline {
    border-color: var(--color-border);
    background: transparent;
    color: var(--color-text);
}
.btn-outline:hover { background: var(--color-surface); text-decoration: none; }

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}
.admin-link { margin-left: 1rem; }

/* --- Back To Top --- */
.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 150;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    border-radius: 999px;
    min-width: 52px;
    height: 38px;
    padding: 0 0.9rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s, border-color 0.2s, color 0.2s;
}
.back-to-top:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* --- Empty State --- */
.empty-msg { color: var(--color-text-secondary); padding: 2rem; text-align: center; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .site-brand-subtitle {
        display: none;
    }
    .header-inner {
        gap: 0.32rem;
    }
    .site-nav {
        min-width: 0;
    }
    .nav-list {
        display: flex;
        gap: 0.16rem;
        flex-wrap: nowrap;
    }
    .nav-list a {
        padding: 0.3rem 0.45rem;
        font-size: 0.82rem;
        white-space: nowrap;
    }
    .site-logo-image {
        height: 32px;
        max-width: min(158px, 34vw);
    }
    .nav-extra {
        display: none;
    }
    .nav-more {
        display: block;
    }
    .nav-more-menu {
        right: 0;
    }
    .nav-more-toggle {
        padding: 0.32rem 0.48rem;
    }
    .search-form-inline input {
        width: 90px;
        font-size: 0.8rem;
        padding: 0.3rem 0.48rem;
    }
    .search-form-inline input:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
    .search-submit {
        font-size: 0.74rem;
        padding: 0.34rem 0.42rem;
    }

    .hero h1 { font-size: 1.5rem; }
    .search-form-hero { flex-direction: column; }
    .article-header h1 { font-size: 1.4rem; }
    .article-share .btn {
        padding: 0.34rem 0.6rem;
        font-size: 0.78rem;
    }
    .copy-status {
        flex-basis: 100%;
    }
    .article-pager { grid-template-columns: 1fr; }
    .pager-next { text-align: left; }
    .pager-spacer { display: none; }
    .article-confirm-actions { flex-direction: column; align-items: stretch; }
    .articles-grid { grid-template-columns: 1fr; }
    .popular-panels { grid-template-columns: 1fr; }
    .popular-link {
        grid-template-columns: 24px 50px minmax(0, 1fr);
    }
    .popular-thumb-wrap {
        width: 50px;
        height: 32px;
    }
    .glossary-item-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .glossary-nav { top: calc(var(--header-height) + 6px); }
    .glossary-thumb-link { width: 92px; }
    .glossary-thumb-wrap { width: 100%; }
    .glossary-thumb { width: 100%; height: 100%; }
    .term-list-home li a { flex-direction: column; gap: 0.2rem; }
    .term-def { text-align: left; }
    .search-suggest {
        max-height: min(62vh, 360px);
    }
    .topic-request-form .form-row {
        grid-template-columns: 1fr;
    }
    .related-articles-grid {
        grid-template-columns: 1fr;
    }
    .related-horizontal-thumb-wrap {
        width: 96px;
    }
    .related-articles-horizontal .related-horizontal-list {
        grid-auto-rows: 106px;
    }
    .related-horizontal-link {
        gap: 0.6rem;
        padding: 0.5rem;
    }
    .related-horizontal-title {
        font-size: 0.9rem;
    }
    .related-horizontal-excerpt {
        font-size: 0.79rem;
    }
    .back-to-top {
        right: 10px;
        bottom: 10px;
    }
}
