:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --card-soft: #f8fbff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #d9e2ec;
    --brand: #1678d3;
    --brand-dark: #0f5ea8;
    --brand-soft: #e7f1fb;
    --danger: #d83b01;
    --shadow: 0 8px 24px rgba(15, 23, 42, .08);
    --radius: 4px;
    --maxw: 780px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    padding: 68px 0 calc(92px + env(safe-area-inset-bottom));
}

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

button {
    font: inherit;
}

.hidden {
    display: none !important;
}

.site-app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    width: 100%;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid rgba(229, 231, 235, .88);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-app-header-inner {
    max-width: var(--maxw);
    min-height: 62px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.site-app-logo {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-app-logo-box {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--brand);
    border-radius: var(--radius);
}

.site-app-logo-box img {
    width: 100%;
    height: 100%;
    display: block;
}

.site-app-logo-text {
    min-width: 0;
    display: block;
}

.site-app-logo-text strong,
.site-app-logo-text small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.site-app-logo-text strong {
    font-size: 16px;
    line-height: 1.1;
    font-weight: 900;
}

.site-app-logo-text small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.site-app-header-actions {
    flex: 0 0 auto;
}

.site-app-menu {
    position: relative;
    z-index: 20;
}

.site-app-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #cde1f7;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    border-radius: var(--radius);
}

.site-app-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 50;
    width: 154px;
    padding: 6px;
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(217, 226, 236, .95);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
    border-radius: var(--radius);
}

.site-app-menu-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 10px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius);
}

.site-app-menu-item:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.app {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
}

.topic-hero,
.section-title,
.loading,
.empty,
.error {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.topic-hero {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px;
}

.topic-cover {
    min-width: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e9eef5;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.topic-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.topic-cover-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #6b7b8d;
    font-size: 14px;
    font-weight: 900;
    background:
        linear-gradient(135deg, rgba(22, 120, 211, .14), rgba(0, 168, 143, .12)),
        #edf3f9;
}

.topic-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.back-link {
    align-self: flex-start;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    background: var(--brand-soft);
    border: 1px solid #cde1f7;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 900;
    border-radius: var(--radius);
}

.topic-info h1 {
    margin: 10px 0 0;
    color: var(--text);
    font-size: 24px;
    line-height: 1.25;
    font-weight: 900;
}

.topic-info p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.topic-meta {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-meta span {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    background: var(--card-soft);
    border: 1px solid var(--line);
    color: #526172;
    font-size: 12px;
    font-weight: 800;
    border-radius: var(--radius);
}

.section {
    padding-bottom: 12px;
}

.section-title {
    padding: 12px 14px;
    margin-bottom: 10px;
}

.section-title h2 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    line-height: 1.3;
    font-weight: 900;
}

.section-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.article-list {
    display: block;
    padding: 2px 16px 4px;
    background: var(--card);
    border-radius: var(--radius);
}

.article-card {
    min-width: 0;
    display: block;
    padding: 18px 0 22px;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    transition: none;
}

.article-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.article-title {
    margin: 0;
    color: #111827;
    font-size: 21px;
    line-height: 1.35;
    font-weight: 900;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.article-index {
    flex: 0 0 auto;
    color: #111827;
    font-size: 22px;
    line-height: 1;
    font-weight: 400;
}

.article-title-text {
    min-width: 0;
    color: #111827;
}

.article-card:hover .article-title-text {
    color: #175199;
}

.article-summary-box {
    margin-top: 12px;
    padding: 16px 18px;
    background: #f6f6f8;
    border-radius: 12px;
}

.article-summary {
    margin: 0;
    color: #374151;
    font-size: 16px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading,
.empty,
.error {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
    line-height: 1.7;
}

.error {
    color: var(--danger);
}

.footer-space {
    height: 12px;
}

.app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    width: 100%;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid rgba(229, 231, 235, .95);
    box-shadow: 0 -12px 30px rgba(15, 23, 42, .10);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-tabbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
}

.app-tab {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    border-radius: var(--radius);
}

.app-tab svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-tab.active {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

@media (max-width: 680px) {
    body {
        padding-top: 64px;
    }

    .site-app-header-inner {
        min-height: 56px;
        padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px 8px;
        gap: 8px;
    }

    .site-app-logo-box {
        width: 34px;
        height: 34px;
    }

    .site-app-logo-text small {
        max-width: 180px;
    }

    .site-app-menu-panel {
        width: 146px;
    }

    .topic-hero {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 8px;
        padding: 10px;
    }

    .topic-cover {
        aspect-ratio: 16 / 9;
    }

    .topic-info h1 {
        font-size: 21px;
    }

    .section {
        padding-bottom: 8px;
    }

    .section-title {
        padding: 10px;
        margin-bottom: 8px;
    }

    .article-card {
        padding: 15px 0 19px;
    }

    .article-list {
        padding: 0 10px 2px;
    }

    .article-title {
        font-size: 18px;
        gap: 8px;
    }

    .article-index {
        font-size: 19px;
    }

    .article-summary-box {
        margin-top: 10px;
        padding: 14px 16px;
        border-radius: 11px;
    }

    .article-summary {
        font-size: 15px;
    }

    .app-tabbar-inner {
        padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
        gap: 2px;
    }

    .app-tab {
        min-height: 50px;
    }
}
