:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --accent: #f59e0b;
    --bg: #f5f7fa;
    --bg-white: #fff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f1f5f9;
    --danger: #ef4444;
    --success: #10b981;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* === Top bar === */
.topbar {
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
}
.topbar .inner {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar a { color: var(--text-muted); }
.topbar a:hover { color: var(--primary); }

/* === Header === */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.site-header .row {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
}
.brand .icon {
    width: 42px;
    height: 42px;
    background: url(/favicon.ico?v=20260606) center/contain no-repeat;
    color: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    filter: drop-shadow(0 0 8px rgba(251,191,36,.85)) drop-shadow(0 0 18px rgba(245,158,11,.45));
    overflow: hidden;
    text-indent: -9999px;
}
.brand small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.main-nav a {
    padding: 8px 16px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    border-radius: 6px;
    transition: all .2s;
    position: relative;
}
.main-nav a:hover { background: var(--bg); color: var(--primary); }
.main-nav a.active {
    color: var(--primary);
    font-weight: 600;
}
.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}
.main-nav a small {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.search-box {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    overflow: hidden;
    height: 36px;
}
.search-box input {
    width: 200px;
    border: none;
    background: transparent;
    padding: 0 14px;
    outline: none;
    font-size: 13px;
}
.search-box button {
    background: transparent;
    border: none;
    padding: 0 14px;
    color: var(--text-secondary);
    font-size: 14px;
}
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(37,99,235,.35); transform: translateY(-1px); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost {
    background: var(--bg);
    color: var(--text);
}
.btn-ghost:hover { background: #e5e7eb; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.user-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 18px;
    background: var(--bg);
    color: var(--text);
}
.user-mini:hover { background: var(--primary-light); color: var(--primary); }
.user-mini .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
}
.user-mini .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-mini .nickname { font-size: 13px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 汉堡 */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    padding: 6px;
}

/* === Layout === */
.main-wrap { padding: 20px 0 60px; }
.layout-3col {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    gap: 20px;
    align-items: start;
}
.layout-2col {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

.side-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.side-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.side-card h3 .more { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.side-card h3 .more:hover { color: var(--primary); }

.category-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    margin-bottom: 4px;
    transition: all .2s;
    font-size: 14px;
}
.category-list a:hover, .category-list a.active {
    background: var(--primary-light);
    color: var(--primary);
}
.category-list a .ico {
    width: 22px; text-align: center;
}
.category-list a .cnt {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.hot-list { margin: 0; padding: 0; list-style: none; }
.hot-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-light);
}
.hot-list li:last-child { border: 0; }
.hot-list li a {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.hot-list li .rank {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-top: 2px;
}
.hot-list li:nth-child(1) .rank { background: #ef4444; color: #fff; }
.hot-list li:nth-child(2) .rank { background: #f97316; color: #fff; }
.hot-list li:nth-child(3) .rank { background: #f59e0b; color: #fff; }
.hot-list li .title {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex: 1;
}
.hot-list li:hover .title { color: var(--primary); }
.hot-list li .meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }


/* === Top tabs (推荐/最新/精华) === */
.tabs-bar {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.tabs-bar .tab {
    padding: 10px 18px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-right: 4px;
    transition: all .2s;
    white-space: nowrap;
}
.tabs-bar .tab:hover { color: var(--primary); }
.tabs-bar .tab.active {
    color: var(--primary);
    font-weight: 700;
    border-bottom-color: var(--primary);
}
.tabs-bar .tab .badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}
.tabs-bar .write-btn {
    margin-left: auto;
}

/* === Post card === */
.post-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s;
}
.post-card:hover { box-shadow: var(--shadow-md); }

.post-card .head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.post-card .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #93c5fd, var(--primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}
.post-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-card .author { font-weight: 500; font-size: 14px; color: var(--text); }
.post-card .time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.post-card .body { padding-left: 52px; }
.post-card .title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    transition: color .2s;
}
.post-card .title:hover { color: var(--primary); }
.post-card .title .tag-top {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    margin-right: 6px;
    vertical-align: middle;
}
.post-card .title .tag-essence {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    margin-right: 6px;
    vertical-align: middle;
}
.post-card .excerpt {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card .images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    max-width: 480px;
}
.post-card .images img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity .2s;
}
.post-card .images img:hover { opacity: .85; }

.post-card .foot {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--text-muted);
    font-size: 13px;
}
.post-card .foot .cat-tag {
    background: var(--bg);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: auto;
}
.post-card .foot .cat-tag:hover { background: var(--primary-light); color: var(--primary); }
.post-card .foot .act {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color .2s;
}
.post-card .foot .act:hover { color: var(--primary); }
.post-card .foot .act.liked { color: var(--danger); }
.post-card .foot .act.collected { color: var(--accent); }

/* Empty / Loading */
.empty, .loading {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}
.empty .emoji { font-size: 40px; margin-bottom: 12px; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 20px 0;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border-light);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .cur {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.pagination .disabled { opacity: .4; cursor: not-allowed; }

/* === Post detail === */
.post-detail {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    box-shadow: var(--shadow-sm);
}
.post-detail .crumb {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}
.post-detail .crumb a:hover { color: var(--primary); }
.post-detail h1 {
    font-size: 26px;
    color: var(--text);
    margin-bottom: 18px;
    line-height: 1.4;
}
.post-detail .author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
}
.post-detail .author-info .avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #93c5fd, var(--primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.post-detail .author-info .avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-detail .author-info .nick { font-size: 15px; font-weight: 500; }
.post-detail .author-info .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.post-detail .author-info .stats {
    margin-left: auto;
    display: flex;
    gap: 24px;
    color: var(--text-muted);
    font-size: 13px;
}
.post-detail .content {
    font-size: 16px;
    line-height: 1.9;
    color: var(--text);
    margin-bottom: 28px;
}
.post-detail .content img { max-width: 100%; border-radius: var(--radius-md); margin: 16px 0; }
.post-detail .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 18px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}
.post-detail .actions .act-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-secondary);
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}
.post-detail .actions .act-btn:hover { background: var(--primary-light); color: var(--primary); }
.post-detail .actions .act-btn.liked { background: #fee2e2; color: var(--danger); }
.post-detail .actions .act-btn.collected { background: #fef3c7; color: var(--accent); }

/* === Comments === */
.comments-section { margin-top: 28px; }
.comments-section h3 { font-size: 17px; color: var(--text); margin-bottom: 16px; }
.comment-form {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.comment-form textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.comment-form textarea:focus { border-color: var(--primary); }
.comment-form .actions {
    margin-top: 10px;
    text-align: right;
}
.comment-item {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 12px;
}
.comment-item .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #93c5fd, var(--primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.comment-item .avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-item .body { flex: 1; min-width: 0; }
.comment-item .nick { font-size: 13px; font-weight: 500; color: var(--text); }
.comment-item .time { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.comment-item .text { font-size: 14px; color: var(--text); margin-top: 6px; }

/* === Forms === */
.form-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
    max-width: 720px;
    margin: 0 auto;
}
.form-card h2 { font-size: 20px; margin-bottom: 22px; color: var(--text); }
.form-row { margin-bottom: 16px; }
.form-row label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
    background: var(--bg-white);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { resize: vertical; min-height: 200px; line-height: 1.7; }

/* === Footer === */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 28px 0 20px;
    margin-top: 40px;
    text-align: center;
    font-size: 13px;
}
.site-footer a { color: #94a3b8; }
.site-footer a:hover { color: #fff; }
.site-footer .links { margin-bottom: 14px; }
.site-footer .links a { margin: 0 12px; }
.site-footer .copy { color: #64748b; font-size: 12px; }

/* === Toast === */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: rgba(0,0,0,.85);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === Modal === */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.modal-mask.show { display: flex; }
.modal-box {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    padding: 24px 28px;
}

/* === Responsive === */
@media (max-width: 980px) {
    .layout-3col { grid-template-columns: 1fr 260px; }
    .layout-3col .left-side { display: none; }
}
@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .topbar { font-size: 11px; }
    .topbar .inner > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .site-header .row { height: 56px; gap: 10px; }
    .brand { font-size: 18px; gap: 8px; }
    .brand .icon { width: 36px; height: 36px; font-size: 0; }
    .brand small { display: none; }

    .nav-toggle { display: block; }
    .main-nav {
        position: absolute;
        top: 56px; left: 0; right: 0;
        flex-direction: column;
        background: #fff;
        gap: 2px;
        padding: 0 12px;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 4px 12px rgba(0,0,0,.05);
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s, padding .3s;
    }
    .main-nav.open { max-height: 400px; padding: 10px 12px 14px; }
    .main-nav a { padding: 12px; font-size: 15px; border-radius: 8px; }
    .main-nav a.active::after { display: none; }
    .main-nav a.active { background: var(--primary-light); }
    .main-nav a small { display: none; }

    .header-actions { gap: 8px; margin-left: auto; }
    .search-box { display: none; }
    .header-actions .btn { padding: 6px 12px; font-size: 13px; }

    .main-wrap { padding: 12px 0 40px; }
    .layout-3col, .layout-2col { grid-template-columns: 1fr; }
    .layout-3col .left-side, .layout-3col .right-side,
    .layout-2col .right-side { display: none; }

    .tabs-bar { padding: 4px 8px; border-radius: 10px; }
    .tabs-bar .tab { padding: 8px 14px; font-size: 14px; }

    .post-card { padding: 14px 16px; margin-bottom: 10px; border-radius: 10px; }
    .post-card .body { padding-left: 0; margin-top: 4px; }
    .post-card .title { font-size: 16px; }
    .post-card .excerpt { font-size: 13px; }
    .post-card .images { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .post-card .images img { height: 90px; }
    .post-card .foot { font-size: 12px; gap: 12px; flex-wrap: wrap; }

    .post-detail { padding: 20px 16px; border-radius: 10px; }
    .post-detail h1 { font-size: 20px; }
    .post-detail .content { font-size: 15px; }
    .post-detail .author-info .stats { display: none; }

    .form-card { padding: 20px 16px; border-radius: 10px; }
}
@media (max-width: 420px) {
    .post-card .images { grid-template-columns: repeat(2, 1fr); }
    .post-card .images img { height: 110px; }
}
