:root {
    --bg: #f3ecdf;
    --surface: rgba(255, 250, 244, 0.94);
    --surface-strong: #fffdf9;
    --panel: #fff6ea;
    --line: rgba(56, 39, 16, 0.11);
    --text: #2f2212;
    --muted: #75614d;
    --accent: #0f766e;
    --accent-2: #c76818;
    --accent-3: #164e63;
    --shadow: 0 24px 64px rgba(54, 36, 13, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html,
body { overflow-x: hidden; }
body {
    margin: 0;
    padding-top: var(--site-header-offset, 72px);
    font-family: "PingFang SC", "Noto Sans SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(199, 104, 24, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 34%),
        linear-gradient(180deg, #f8f2e8, #f2eadf);
}

body.admin {
    padding-top: 0;
}

body.nav-drawer-open {
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
.wrap { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }

.site-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 50;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
    background: rgba(248, 242, 232, 0.82);
}

.header-inner,
.top-nav,
.hero-stats,
.section-nav,
.footer-grid,
.actions-row,
.card-top,
.section-head.compact,
.admin-head,
.admin-topbar {
    display: flex;
    align-items: center;
}

.header-inner { justify-content: space-between; min-height: 72px; }
.header-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #115e59);
    color: #fff;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.menu-toggle,
.nav-drawer-backdrop {
    display: none;
}

.menu-toggle {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.82);
    color: var(--text);
    border: 1px solid var(--line);
    flex-shrink: 0;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.top-nav { gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.top-nav a { position: relative; padding-bottom: 4px; white-space: nowrap; }
.top-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .2s ease;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.top-nav a:hover::after { transform: scaleX(1); }

.hero { padding: 56px 0 20px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 0.82fr; gap: 24px; align-items: start; }
.hero-grid.hero-grid-single { grid-template-columns: 1fr; }
.hero h1 { font-size: clamp(34px, 5vw, 62px); line-height: 1.05; margin: 0 0 16px; max-width: 100%; width: auto; text-wrap: balance; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; color: var(--accent); margin-bottom: 10px; }
.hero-text,
.section-head p,
.card p,
.site-footer p,
.admin-section-hint { color: var(--muted); line-height: 1.7; }

.hero-panel,
.card,
.admin-block,
.auth-card,
.admin-main.narrow,
.article-card,
.friend-card,
.post-shell,
.submit-shell,
.ad-card,
.ad-banner,
.metric-card,
.quick-action-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-panel { padding: 24px; }
.hero-stats { gap: 18px; margin: 24px 0; flex-wrap: wrap; }
.hero-stats div,
.badge {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 16px;
}
.hero-stats div { padding: 12px 16px; min-width: 90px; }
.hero-stats strong { display: block; font-size: 24px; }
.hero-stats span { color: var(--muted); font-size: 13px; }

.search-form,
.admin-searchbar {
    display: flex;
    gap: 12px;
}

.search-form { margin-top: 12px; }
.ad-strip,
.ad-grid,
.article-grid,
.friend-grid,
.admin-metrics,
.quick-action-grid {
    display: grid;
    gap: 16px;
}

.ad-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.ad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.article-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.friend-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.category-ad-grid {
    margin-bottom: 24px;
    margin-top: 8px;
}

.search-form input,
.stack-form input,
.stack-form textarea,
.stack-form select,
.auth-card input,
textarea,
.admin-searchbar input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: #fffdf9;
    font: inherit;
}

button,
.button {
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-2), #ea580c);
    color: #fff;
    padding: 14px 18px;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: transform .18s ease, box-shadow .18s ease;
}

button:hover,
.button:hover { transform: translateY(-1px); }
.button.secondary { background: #efe5d7; color: var(--text); }

.section-nav {
    position: sticky;
    top: var(--site-header-offset, 72px);
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: auto;
    padding: 18px 16px;
    margin-bottom: 10px;
    background: rgba(248, 242, 232, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    border-radius: 12px;
    transition: background .2s ease, backdrop-filter .2s ease;
}

.section-nav-placeholder {
    display: none;
}

.category-section {
    scroll-margin-top: calc(var(--site-header-offset, 72px) + 64px);
}

.section-head-with-media {
    align-items: center;
    gap: 24px;
}

.section-head-main {
    flex: 1 1 0;
}

.section-head-main p:last-child {
    margin-bottom: 0;
}

.category-hero-media {
    flex: 0 0 180px;
    max-width: 180px;
}

.category-hero-media img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 22px;
    box-shadow: 0 14px 32px rgba(20, 28, 45, 0.12);
}

.section-nav a,
.badge {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.section-nav a {
    background: rgba(255,255,255,.76);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.section-nav a.active,
.section-nav a:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}

.category-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.58);
}

.category-section-home,
.category-section-detail {
    position: relative;
}

.category-section-home .section-head,
.category-section-detail .section-head {
    position: relative;
    margin-bottom: 22px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
}

.category-section-home .section-head::after,
.category-section-detail .section-head::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 88px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), rgba(15, 118, 110, 0));
}

.category-toolbar-meta,
.category-toolbar-actions,
.section-filter-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge.soft {
    background: rgba(255,255,255,.45);
}

.section-search-input {
    min-width: 240px;
}

.section-filter-tabs {
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.7);
}

.section-tab {
    padding: 10px 14px;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
}

.section-tab.active {
    background: linear-gradient(135deg, var(--accent), #115e59);
    color: #fff;
}

.section { padding: 28px 0; }
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    align-items: end;
}

.section-head h1,
.section-head h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
    position: relative;
    padding: 22px;
    transition: transform .18s ease, box-shadow .18s ease, opacity .25s ease;
}
.card:hover { transform: translateY(-4px); }
.card > * {
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.card-cover-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: 24px;
    pointer-events: auto;
}
.section-card.is-collapsed {
    display: none;
}

.section-card.is-hidden-by-filter {
    display: none;
}
.card-heading {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.card-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fffdf9, #f7efe4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.card-logo img,
.plain-link-with-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fallback-icon {
    display: inline-flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--accent-3);
    background: linear-gradient(135deg, rgba(22, 78, 99, .12), rgba(15, 118, 110, .14));
}

.fallback-icon.small {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 12px;
}

.card-domain {
    display: inline-block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.article-card,
.friend-card,
.submit-shell,
.post-shell,
.ad-card,
.ad-banner,
.metric-card,
.quick-action-card { padding: 22px; }

.article-card {
    position: relative;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.article-card:hover {
    transform: translateY(-4px);
}

.article-card > * {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.card-top { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-link,
.article-card a,
.card a {
    pointer-events: auto;
}

.card-link { color: var(--accent); font-weight: 700; position: relative; z-index: 4; }
.ad-card,
.ad-banner,
.friend-card,
.quick-action-card { display: grid; gap: 8px; }

.ad-card {
    position: relative;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(54, 36, 13, 0.12);
    background: rgba(255, 255, 255, 0.82);
}

.ad-banner {
    position: relative;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ad-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(54, 36, 13, 0.12);
    background: rgba(255, 255, 255, 0.82);
}

.friend-card {
    position: relative;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.friend-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(54, 36, 13, 0.12);
    background: rgba(255, 255, 255, 0.82);
}

a.friend-card {
    color: inherit;
    text-decoration: none;
}

.ad-card strong,
.ad-banner strong,
.friend-card strong { font-size: 18px; }
.article-card h3,
.article-card h2,
.post-shell h1 { margin: 0 0 10px; }
.post-meta { color: var(--muted); margin-bottom: 18px; }
.post-body { line-height: 1.9; color: var(--text); font-size: 17px; }

.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plain-list li {
    position: relative;
    color: var(--muted);
    border-radius: 16px;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.plain-list li:hover {
    transform: translateX(6px);
    background: rgba(255,255,255,.68);
    box-shadow: 0 12px 28px rgba(54, 36, 13, 0.08);
}
.plain-list span { font-size: 13px; }
.plain-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 16px;
}

.plain-link-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.plain-link-meta {
    flex-shrink: 0;
}

.plain-link-with-icon img {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 2px;
}

.plain-link-with-icon,
.plain-link-meta {
    transition: transform .18s ease, color .18s ease, opacity .18s ease;
}

.plain-list li:hover .plain-link-with-icon {
    transform: translateX(2px);
}

.plain-list li:hover .plain-link-meta {
    color: var(--accent);
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(22px);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .55s ease, transform .55s ease;
}

.site-footer { margin-top: 48px; padding: 32px 0 56px; border-top: 1px solid var(--line); }
.footer-grid { gap: 18px; align-items: start; flex-wrap: wrap; }
.footer-grid > div { flex: 1; min-width: 220px; }
.footer-copyright {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}
.breadcrumb { display: flex; gap: 8px; color: var(--muted); margin-bottom: 20px; }

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.admin-shell-pro {
    background: linear-gradient(180deg, #f5efe6, #f0e7da);
}

.admin-sidebar {
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(24, 18, 12, .96), rgba(35, 24, 14, .98)),
        radial-gradient(circle at top, rgba(15, 118, 110, 0.25), transparent 35%);
    color: #f8f1e6;
    display: grid;
    gap: 20px;
    align-content: start;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-sidebar-brand strong { display: block; }
.admin-sidebar-brand p { margin: 4px 0 0; color: rgba(255,255,255,.66); font-size: 13px; }

.admin-menu,
.admin-sidebar-actions { display: grid; gap: 8px; }

.admin-menu a,
.admin-sidebar-actions a {
    border-radius: 16px;
    padding: 12px 14px;
    color: rgba(255,255,255,.82);
    transition: background .18s ease, transform .18s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.admin-menu a.active,
.admin-menu a:hover,
.admin-sidebar-actions a:hover {
    background: rgba(255,255,255,.1);
    transform: translateX(2px);
}

.admin-main { padding: 28px; }
.admin-topbar { justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-head { justify-content: space-between; }
.admin-head h1 { margin: 0; }
.admin-head p { margin: 6px 0 0; color: var(--muted); }

.admin-searchbar {
    min-width: min(420px, 100%);
    background: rgba(255,255,255,.7);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 10px;
    box-shadow: var(--shadow);
}

.admin-searchbar input { background: transparent; border: 0; padding: 12px 14px; }
.admin-search-feedback {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.62);
    color: var(--muted);
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.admin-search-feedback a {
    color: var(--accent);
    font-weight: 700;
}

.admin-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 24px;
}

.metric-card strong {
    display: block;
    font-size: 30px;
    margin-bottom: 10px;
}

.metric-card span { color: var(--muted); }

.admin-grid-overview {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
}

.overview-list {
    display: grid;
    gap: 12px;
}

.cms-overview-list .overview-item {
    min-height: 96px;
    align-content: start;
}

.overview-item {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.6);
}

.overview-item span {
    color: var(--muted);
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.admin-inline-settings {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.admin-block-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.admin-block-config-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.58);
}

.quick-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quick-action-card {
    min-height: 88px;
    align-items: center;
    font-weight: 700;
    transition: transform .18s ease, background .18s ease;
}
.quick-action-card:hover {
    transform: translateY(-3px);
    background: var(--surface-strong);
}

.admin-list-toolbar {
    margin-bottom: 14px;
}

.admin-block { padding: 22px; margin-bottom: 24px; }
.table-shell {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.6);
}

.admin-main table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 900px; }
.admin-main th,
.admin-main td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.empty-row {
    text-align: center !important;
    color: var(--muted);
    padding: 28px 12px !important;
}

.row-selected {
    background: rgba(15, 118, 110, .08);
}

.detail-row[hidden] {
    display: none;
}

.detail-row td {
    padding: 0;
    background: rgba(255,255,255,.45);
}

.detail-panel {
    padding: 18px 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    margin-bottom: 14px;
}

.detail-grid strong,
.detail-message strong {
    display: block;
    margin-bottom: 6px;
}

.detail-grid p,
.detail-message p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    word-break: break-word;
}

.detail-message {
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.admin-main th {
    background: rgba(255,255,255,.74);
    position: sticky;
    top: 0;
    z-index: 1;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions a,
.actions button {
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
}

.status-pill.published,
.status-pill.approved { background: rgba(34, 197, 94, .12); color: #166534; }
.status-pill.draft { background: rgba(107, 114, 128, .12); color: #374151; }
.status-pill.pending { background: rgba(234, 179, 8, .16); color: #92400e; }
.status-pill.rejected { background: rgba(239, 68, 68, .12); color: #991b1b; }
.bulk-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.7);
}

.bulk-toolbar select {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fffdf9;
}

.row-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.section-more-row {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.auth-shell,
.form-shell { display: flex; align-items: center; justify-content: center; }
.auth-card,
.admin-main.narrow { width: min(760px, calc(100% - 24px)); padding: 28px; }
.stack-form,
.auth-card { display: grid; gap: 14px; }
.stack-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.actions-row {
    justify-content: flex-start;
    gap: 12px;
    margin-top: 8px;
}

.actions-row .button,
.actions-row button {
    min-width: 140px;
}

.checkbox {
    display: inline-flex !important;
    gap: 10px !important;
    align-items: center !important;
    font-weight: 500 !important;
}

.checkbox input,
.row-check input {
    width: 18px;
    height: 18px;
    margin: 0;
}
.empty-state,
.flash { color: var(--muted); }
.flash { color: #b91c1c; }
.flash.success { color: #166534; }

.admin-flash {
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(190, 38, 38, 0.08);
    color: #7a1f1f;
}

.admin-flash.success {
    background: rgba(23, 133, 78, 0.1);
    color: #145c39;
}

.admin-attachments-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.media-upload-form {
    padding: 18px;
    border: 1px solid rgba(20, 28, 45, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
}

.admin-media-preview {
    margin: 4px 0 12px;
}

.admin-media-preview img,
.table-thumb {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(20, 28, 45, 0.08);
    background: #fff;
}

.table-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 64px;
    padding: 0 10px;
    border-radius: 12px;
    background: rgba(20, 28, 45, 0.06);
    color: var(--muted);
    font-size: 12px;
}

.scroll-top-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 25;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
}

.scroll-top-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.admin-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.admin-pagination a {
    display: inline-flex;
    min-width: 40px;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.7);
}

.admin-pagination .page-step {
    min-width: auto;
    padding-inline: 14px;
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    padding: 10px 2px;
}

.admin-pagination a.active {
    background: var(--accent);
    color: #fff;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .24s ease, visibility .24s ease;
}

.search-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.search-overlay[hidden] {
    display: none;
}

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(47, 34, 18, 0.56);
    border: 0;
    padding: 0;
    cursor: pointer;
}

.search-dialog {
    position: relative;
    z-index: 101;
    width: min(640px, calc(100% - 32px));
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.search-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.search-dialog-head h2 {
    margin: 0;
    font-size: 18px;
}

.search-dialog-head .eyebrow {
    margin-bottom: 6px;
}

.search-dialog-close {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.search-dialog-close:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-1px);
}

.search-dialog-form {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
}

.search-dialog-form input {
    flex: 1;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 15px;
}

.search-dialog-form button {
    padding: 12px 18px;
    font-size: 14px;
}

.search-results-shell {
    display: flex;
    flex-direction: column;
    padding: 16px 22px 22px;
    overflow: auto;
    max-height: calc(60vh - 120px);
}

.search-dialog-hint {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.search-result-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.search-result-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.search-result-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 8px 24px rgba(54, 36, 13, 0.08);
}

.search-result-link {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 14px 16px;
    align-items: center;
}

.search-result-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.search-result-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(22, 78, 99, 0.12), rgba(15, 118, 110, 0.14));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.search-result-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-result-title-group {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.search-result-title-group strong {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-domain {
    font-size: 12px;
    color: var(--muted);
}

.search-result-description {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--accent);
    padding: 6px 10px;
    background: rgba(15, 118, 110, 0.1);
    border-radius: 999px;
    align-self: start;
}

.search-results-more {
    margin-top: 14px;
    justify-self: center;
}

.search-empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

body.search-overlay-open {
    overflow: hidden;
}

.header-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.header-search-trigger:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(54, 36, 13, 0.08);
}

.search-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.search-text {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header-search-trigger {
        padding: 10px;
    }
    .search-text {
        display: none;
    }
}

@media (max-width: 1100px) {
    .admin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .card-grid,
    .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .friend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-grid-overview { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .admin-block-config-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
    .hero-grid,
    .card-grid,
    .footer-grid,
    .admin-shell,
    .article-grid,
    .friend-grid,
    .ad-grid,
    .ad-strip,
    .admin-metrics,
    .quick-action-grid { grid-template-columns: 1fr; }

    .section-head,
    .header-inner,
    .admin-topbar { align-items: flex-start; flex-direction: column; }

    .header-inner {
        align-items: center;
        gap: 12px;
        padding: 12px 0;
    }
    .header-brand-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        flex: 1;
    }
    .header-controls {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .top-nav {
        position: fixed;
        top: var(--mobile-header-offset, 72px);
        right: 0;
        bottom: auto;
        width: min(320px, 82vw);
        height: calc(100dvh - var(--mobile-header-offset, 72px));
        max-height: calc(100dvh - var(--mobile-header-offset, 72px));
        padding: 20px 20px 24px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        flex-wrap: nowrap;
        overflow-y: auto;
        background: rgba(255, 250, 244, 0.98);
        box-shadow: -18px 0 40px rgba(47, 34, 18, 0.12);
        transform: translateX(calc(100% + 24px));
        visibility: hidden;
        pointer-events: none;
        transition: transform .24s ease, visibility .24s ease;
        z-index: 60;
    }
    .top-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }
    .top-nav a {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        border-radius: 14px;
        font-size: 17px;
        font-weight: 600;
        padding-bottom: 10px;
        background: rgba(255,255,255,.58);
    }
    .top-nav a:hover,
    .top-nav a:active {
        background: rgba(15, 118, 110, 0.12);
    }
    .nav-drawer-backdrop {
        position: fixed;
        inset: 0;
        border: 0;
        padding: 0;
        background: rgba(47, 34, 18, 0.28);
        opacity: 0;
        pointer-events: none;
        transition: opacity .24s ease;
        z-index: 40;
    }
    .nav-drawer-backdrop.is-visible {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    .admin-sidebar { display: flex; flex-wrap: wrap; }
    .search-form,
    .admin-searchbar { flex-direction: column; width: 100%; }

    .section-head-with-media {
        align-items: flex-start;
        flex-direction: column;
    }

    .category-hero-media {
        max-width: 120px;
    }
}

/* Compact redesign */
:root {
    --bg: #efe7da;
    --surface: rgba(255, 251, 246, 0.88);
    --surface-strong: #fffdf9;
    --panel: #f6ede1;
    --line: rgba(68, 49, 26, 0.1);
    --text: #24180d;
    --muted: #6f5c49;
    --accent: #0f766e;
    --accent-2: #ba5a1d;
    --accent-3: #163d53;
    --shadow: 0 18px 44px rgba(45, 30, 10, 0.08);
}

body {
    font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(186, 90, 29, 0.16), transparent 26%),
        radial-gradient(circle at 100% 0%, rgba(15, 118, 110, 0.14), transparent 28%),
        linear-gradient(180deg, #f7f2eb 0%, #efe7da 100%);
}

.wrap,
.section-nav.is-stuck {
    width: min(1180px, calc(100% - 28px));
}

.site-header {
    border-bottom: 1px solid rgba(68, 49, 26, 0.08);
    background: rgba(247, 242, 235, 0.76);
    box-shadow: 0 10px 30px rgba(45, 30, 10, 0.04);
}

.header-inner {
    min-height: 64px;
    gap: 20px;
}

.brand {
    gap: 12px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.brand-text-group {
    display: grid;
    gap: 2px;
}

.brand-text {
    min-height: auto;
    font-size: 15px;
    font-weight: 800;
}

.brand-subtext {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.top-nav {
    gap: 10px;
    font-size: 13px;
}

.top-nav a {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
}

.top-nav a::after {
    display: none;
}

.top-nav a:hover {
    color: var(--accent);
    background: rgba(15, 118, 110, 0.08);
}

.header-search-trigger {
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.58);
}

.hero {
    padding: 34px 0 10px;
}

.hero-shell {
    display: grid;
    gap: 18px;
}

.home-page #category-stream {
    margin-top: -12px;
}

.hero-grid {
    gap: 18px;
}

.hero-main,
.hero-panel,
.summary-card,
.site-footer .footer-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(247, 238, 227, 0.92));
    box-shadow: var(--shadow);
}

.hero-main {
    padding: 28px;
}

.hero-main::before,
.hero-panel::before,
.summary-card::before,
.site-footer .footer-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 32%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 26%);
}

.hero-copy,
.hero-actions,
.hero-stats,
.hero-quick-nav,
.hero-panel > *,
.summary-card > *,
.footer-shell > * {
    position: relative;
    z-index: 1;
}

.hero h1 {
    margin-bottom: 12px;
    font-size: clamp(32px, 4.6vw, 56px);
    line-height: 1;
    max-width: 12ch;
}

.hero-text {
    max-width: 58ch;
    margin: 0;
    font-size: 15px;
    line-height: 1.72;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.hero-stats-compact {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 0;
}

.hero-stats-compact div,
.summary-card,
.section-nav a,
.badge,
.section-head-meta .section-inline-link {
    backdrop-filter: blur(8px);
}

.hero-stats-compact div {
    min-width: 0;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
}

.hero-stats strong {
    font-size: 22px;
}

.hero-quick-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.hero-quick-nav-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-quick-nav a {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid var(--line);
    font-size: 13px;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

.hero-quick-nav a:hover {
    transform: translateY(-1px);
    color: var(--accent);
    background: rgba(255, 255, 255, 0.9);
}

.hero-panel-compact {
    padding: 22px;
}

.hero-panel-head,
.section-head-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-panel-head h2 {
    margin: 0;
    font-size: 22px;
}

.section {
    padding: 22px 0;
}

.section-head {
    margin-bottom: 14px;
}

.section-head h1,
.section-head h2 {
    font-size: clamp(24px, 3vw, 34px);
}

.section-head p {
    margin: 6px 0 0;
    max-width: 58ch;
}

.section-head-meta {
    margin-top: 14px;
}

.section-inline-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.category-layout {
    position: relative;
    display: flex;
    gap: 22px;
    align-items: flex-start;
}

.category-sidebar {
    flex: 0 0 220px;
    align-self: flex-start;
    width: 220px;
}

.category-sidebar.is-stuck {
    position: fixed;
    top: calc(var(--site-header-offset, 72px) + 12px);
    z-index: 20;
}

.category-sidebar.is-bottomed {
    position: absolute;
    top: auto;
    bottom: 0;
}

.category-content {
    flex: 1;
    min-width: 0;
}

.section-nav {
    position: sticky;
    top: calc(var(--site-header-offset, 72px) + 12px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
    margin: 0;
    width: 100%;
    max-height: calc(100vh - var(--site-header-offset, 72px) - 24px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(247, 242, 235, 0.76);
    box-shadow: 0 8px 18px rgba(45, 30, 10, 0.05);
    overflow-y: auto;
    scrollbar-width: none;
}

@media (min-width: 961px) {
    .section-nav.is-stuck {
        position: static;
        top: auto;
        left: auto;
        width: 100%;
        transform: none;
        z-index: auto;
    }
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.66);
    font-size: 12px;
    line-height: 1;
}

.section-nav a small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav.is-stuck {
    margin-top: 0;
}

.category-section {
    scroll-margin-top: calc(var(--site-header-offset, 72px) + 46px);
}

.section-nav a.active small,
.section-nav a:hover small {
    background: rgba(255, 255, 255, 0.16);
    color: currentColor;
}

.category-section-home .section-head,
.category-section-detail .section-head {
    margin-bottom: 16px;
    padding-bottom: 14px;
}

.category-content .category-section:first-child {
    padding-top: 0;
}

.card-grid {
    gap: 14px;
}

.card,
.article-card,
.friend-card,
.ad-card,
.ad-banner {
    border-radius: 20px;
}

.card {
    padding: 18px;
}

.card-top {
    margin-bottom: 10px;
}

.card-heading {
    grid-template-columns: 48px 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.card-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.card h3,
.article-card h3,
.friend-card strong {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
}

.card-domain {
    margin-top: 2px;
    font-size: 11px;
}

.card-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
}

.article-grid,
.friend-grid,
.ad-grid,
.ad-strip {
    gap: 14px;
}

.article-card,
.friend-card,
.ad-card,
.ad-banner {
    padding: 18px;
}

.friend-card span,
.ad-card span,
.ad-banner span,
.article-card p {
    color: var(--muted);
    line-height: 1.6;
}

.plain-list {
    gap: 6px;
}

.plain-link-row {
    min-height: 52px;
    padding: 10px 12px;
}

.plain-list li:hover {
    transform: translateX(4px);
}

.search-dialog {
    width: min(700px, calc(100% - 28px));
    border-radius: 22px;
}

.search-result-link {
    padding: 12px 14px;
}

.site-footer {
    margin-top: 36px;
    padding: 18px 0 44px;
    border-top: 0;
}

.footer-shell {
    padding: 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.footer-grid h2 {
    margin: 0 0 8px;
    font-size: 15px;
}

.footer-grid p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.footer-copyright {
    margin-top: 18px;
    padding-top: 18px;
}

@media (max-width: 1100px) {
    .hero-stats-compact,
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .category-layout {
        flex-direction: column;
        gap: 0;
    }

    .category-sidebar {
        position: static;
        flex: none;
        width: 100%;
        margin-top: 0;
        max-height: none;
        overflow: visible;
    }

    .section-nav {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
    }

    .section-nav.is-stuck {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        width: min(1200px, calc(100% - 32px));
        padding-top: 14px;
        top: var(--site-header-offset, 72px);
        z-index: 40;
    }

    .section-nav-placeholder {
        display: block;
    }

    .header-inner {
        gap: 12px;
    }

    .brand-subtext {
        display: none;
    }

    .hero-main,
    .hero-panel-compact,
    .summary-card,
    .footer-shell {
        padding: 20px;
    }

    .hero h1 {
        max-width: none;
        font-size: clamp(28px, 9vw, 42px);
    }

    .hero-stats-compact,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .section-nav {
        flex-direction: row;
        align-items: center;
        margin-top: 10px;
        padding: 5px;
        border-radius: 14px;
        overflow: auto;
    }

    .section-nav a {
        display: inline-flex;
        width: auto;
        justify-content: flex-start;
        padding: 7px 9px;
    }

    .top-nav {
        background: rgba(255, 251, 246, 0.98);
    }
}

@media (max-width: 640px) {
    .wrap,
    .section-nav.is-stuck {
        width: min(100%, calc(100% - 20px));
    }

    .hero {
        padding-top: 24px;
    }

    .hero-actions,
    .hero-panel-head,
    .section-head-meta {
        align-items: stretch;
    }

    .hero-actions .button,
    .section-inline-link {
        width: 100%;
    }

    .hero-quick-nav {
        gap: 8px;
    }

    .hero-quick-nav-label {
        width: 100%;
    }

    .section-nav {
        gap: 5px;
        margin-top: 8px;
        padding: 4px;
    }

    .section-nav a {
        padding: 7px 8px;
    }

    .section-nav a small {
        display: none;
    }

    .scroll-top-button {
        right: 14px;
        bottom: 14px;
    }
}
