@font-face {
    font-family: "Bricolage";
    src: local("Bricolage Grotesque");
}

:root {
    --ink: #0f172a;
    --muted: #64748b;
    --paper: #f6f7fb;
    --panel: #ffffff;
    --line: #e2e8f0;
    --line-light: #f1f5f9;
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --cyan: #06b6d4;
    --cyan-light: #cffafe;
    --green: #10b981;
    --green-light: #d1fae5;
    --red: #ef4444;
    --red-light: #fee2e2;
    --orange: #f59e0b;
    --orange-light: #fef3c7;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Bricolage", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 0%, rgba(37, 99, 235, .11), transparent 34%),
        radial-gradient(circle at 92% 8%, rgba(6, 182, 212, .12), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, var(--paper) 360px);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main {
    animation: pageEnter .38s ease both;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 48px);
    height: 64px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--line);
}

.brand,
.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.3px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    border-radius: 9px;
    font-size: 15px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 8px 18px rgba(37, 99, 235, .22);
}

.brand-logo {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 9px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.site-nav > a {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.site-nav > a:hover {
    color: var(--ink);
    background: var(--line-light);
}

.site-nav form {
    margin: 0;
}

.site-nav button {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.site-nav button:hover {
    color: var(--red);
    background: var(--red-light);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 60;
}

.mobile-profile-link {
    display: none;
}

.mobile-profile-avatar {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid white;
    box-shadow: var(--shadow);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all 0.3s ease;
}

body.menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

body.menu-open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

body.menu-open {
    overflow: hidden;
}

.nav-strong,
.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.primary-button {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: var(--shadow);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.primary-button:active,
.secondary-button:active,
.nav-strong:active,
.create-post-button:active {
    transform: translateY(0) scale(.98);
}

.secondary-button,
.nav-strong {
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.secondary-button:hover,
.nav-strong:hover {
    border-color: var(--primary-light);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.flash {
    max-width: 960px;
    margin: 20px auto 0;
    padding: 14px 20px;
    border-radius: var(--radius);
    background: var(--orange-light);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 36px;
    padding: 56px clamp(16px, 4vw, 48px) 34px;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
}

.hero-copy h1 {
    max-width: 720px;
    margin: 12px 0 16px;
    font-size: clamp(38px, 6vw, 68px);
    line-height: 1.02;
    letter-spacing: 0;
    font-weight: 900;
}

.hero-copy p {
    max-width: 660px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.78;
}

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

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eyebrow::before {
    content: "";
    display: block;
    width: 20px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    border-radius: 2px;
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 28px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(219, 234, 254, .72));
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
}

.hero-panel::after {
    content: "";
    position: absolute;
    width: 160px;
    height: 160px;
    right: -54px;
    top: -54px;
    background:
        linear-gradient(90deg, rgba(37, 99, 235, .12) 1px, transparent 1px),
        linear-gradient(0deg, rgba(37, 99, 235, .12) 1px, transparent 1px);
    background-size: 18px 18px;
    transform: rotate(12deg);
}

.hero-kicker {
    display: block;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .8px;
}

.hero-panel strong {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 18px;
    line-height: 1.65;
    color: var(--ink);
}

.hero-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.hero-stats div {
    padding: 14px 12px;
    border: 1px solid rgba(37, 99, 235, .14);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .7);
}

.hero-stats b {
    display: block;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
}

.hero-stats span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.community-grid {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 280px;
    gap: 24px;
    padding: 32px clamp(16px, 4vw, 48px) 72px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.category-rail,
.popular-panel {
    position: sticky;
    top: 84px;
    padding: 18px;
    background: rgba(255, 255, 255, .9);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.category-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.category-toggle svg {
    transition: transform 0.2s ease;
    color: var(--muted);
}

.category-rail.open .category-toggle svg {
    transform: rotate(180deg);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-rail h2,
.popular-panel h2 {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.category-list a,
.popular-panel a {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.category-list a:hover {
    background: var(--line-light);
    color: var(--ink);
    transform: translateX(2px);
}

.category-list a.active {
    color: var(--primary-dark);
    background: var(--primary-light);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--primary);
}

.popular-panel a {
    padding: 14px;
    margin-top: 8px;
    background: linear-gradient(180deg, #ffffff, var(--line-light));
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.popular-panel a:hover {
    background: var(--primary-light);
    transform: translateX(2px);
    border-color: rgba(37, 99, 235, .16);
    box-shadow: var(--shadow-sm);
}

.popular-panel a span {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popular-panel a strong {
    display: block;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.thread-list {
    display: grid;
    gap: 14px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.section-head h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.section-head a {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.section-head a:hover {
    background: var(--primary-light);
}

.section-head .create-post-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 1px solid rgba(37, 99, 235, .2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    line-height: 1;
    white-space: nowrap;
}

.section-head .create-post-button:focus {
    color: white;
    outline: 0;
    box-shadow: 0 0 0 3px var(--primary-light), var(--shadow);
}

.section-head .create-post-button:hover {
    color: white;
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.thread-card {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 16px;
    padding: 22px;
    background: rgba(255, 255, 255, .94);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
    animation: cardEnter .42s ease both;
}

.thread-card:nth-of-type(2) {
    animation-delay: .04s;
}

.thread-card:nth-of-type(3) {
    animation-delay: .08s;
}

.thread-card:nth-of-type(4) {
    animation-delay: .12s;
}

.thread-card:nth-of-type(5) {
    animation-delay: .16s;
}

.thread-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-3px);
    background: #ffffff;
}

.thread-card:active {
    transform: translateY(-1px) scale(.995);
}

.clickable-card {
    cursor: pointer;
}

.clickable-card:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

.thread-card h3 {
    margin: 6px 0 8px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
}

.thread-card h3 a {
    color: var(--ink);
    transition: color 0.15s ease;
}

.thread-card h3 a:hover {
    color: var(--primary);
}

.thread-card p {
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
    margin: 0 0 10px;
}

.thread-meta,
.thread-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.thread-meta span:first-child {
    color: var(--primary);
    font-weight: 700;
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.thread-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32);
}

.avatar-link {
    display: inline-flex;
    flex-shrink: 0;
    border-radius: var(--radius);
}

.avatar-link:hover .avatar {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32), var(--shadow);
}

img.avatar {
    display: block;
    object-fit: cover;
    background: var(--line-light);
}

.avatar.small {
    width: 36px;
    height: 36px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.avatar.large {
    width: 88px;
    height: 88px;
    font-size: 32px;
    border-radius: var(--radius-lg);
}

.auth-screen,
.form-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 64px);
    padding: 40px 16px;
}

.auth-card,
.compose-card {
    width: min(100%, 440px);
    padding: 40px;
    background: rgba(255, 255, 255, .94);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
}

.auth-card h1,
.compose-card h1 {
    margin: 8px 0 28px;
    font-size: 24px;
    font-weight: 800;
}

.auth-card .primary-button {
    width: 100%;
}

.auth-switch {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 700;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 16px;
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    transition: all 0.2s ease;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 0;
    border-color: var(--primary);
    background: var(--panel);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 28px;
    padding: 32px clamp(16px, 4vw, 48px) 64px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.post-detail,
.comment-panel,
.profile-head {
    padding: 32px;
    background: rgba(255, 255, 255, .94);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.post-detail h1 {
    margin: 12px 0 20px;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.author-strip,
.comment-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.author-strip {
    padding: 18px;
    border-radius: var(--radius);
    background: var(--line-light);
    border: 1px solid var(--line);
}

.author-strip strong {
    font-size: 15px;
    font-weight: 700;
}

.author-strip p,
.comment-card p {
    margin: 4px 0 0;
    color: var(--muted);
    line-height: 1.55;
    font-size: 14px;
}

.post-body {
    margin-top: 28px;
    font-size: 16px;
    line-height: 1.85;
    color: #334155;
}

.post-body p {
    margin: 0 0 16px;
}

.comment-panel {
    display: grid;
    gap: 18px;
}

.comment-panel h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.comment-card {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.comment-card:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.comment-card strong {
    font-size: 14px;
    font-weight: 700;
}

.comment-card p {
    margin: 6px 0 4px;
    color: #475569;
    line-height: 1.6;
}

.comment-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.comment-form {
    display: grid;
    gap: 14px;
    padding-top: 8px;
}

.profile-head {
    display: flex;
    gap: 24px;
    margin: 32px auto 24px;
    max-width: 1280px;
    align-items: center;
}

.profile-main {
    min-width: 0;
}

.profile-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.profile-actions form {
    margin: 0;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    color: #991b1b;
    background: var(--red-light);
    border: 1px solid rgba(239, 68, 68, .22);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 14px;
    transition: all .18s ease;
}

.danger-button:hover {
    color: white;
    background: var(--red);
    box-shadow: var(--shadow);
}

.profile-stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-left: auto;
    min-width: 130px;
}

.profile-stats div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line-light);
}

.profile-stats b {
    display: block;
    color: var(--ink);
    font-size: 22px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.profile-stats span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.profile-head .avatar.large {
    border: 8px solid var(--line-light);
    box-shadow: 0 18px 38px rgba(15, 23, 42, .12);
}

.profile-list {
    padding: 0 clamp(16px, 4vw, 48px) 64px;
    max-width: 1280px;
    margin: 0 auto;
}

.profile-thread-card {
    grid-template-columns: 1fr;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 16px;
    min-height: 60vh;
    text-align: center;
}

.empty-card {
    padding: 24px;
    color: var(--muted);
    background: var(--line-light);
    border-radius: var(--radius);
    border: 1px dashed var(--line);
    text-align: center;
    font-size: 14px;
}

.profile-empty {
    display: grid;
    justify-items: start;
    gap: 8px;
    max-width: 520px;
    background: rgba(255, 255, 255, .88);
    border-style: solid;
    text-align: left;
}

.profile-empty strong {
    color: var(--ink);
    font-size: 18px;
}

.profile-empty p {
    margin: 0 0 8px;
}

.admin-body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
    background:
        radial-gradient(circle at 88% 0%, rgba(37, 99, 235, .1), transparent 34%),
        var(--paper);
}

.admin-sidebar {
    padding: 24px;
    color: white;
    background: linear-gradient(180deg, #0b1220 0%, #172033 100%);
    border-right: 1px solid var(--line);
}

.admin-sidebar nav {
    display: grid;
    gap: 4px;
    margin-top: 28px;
}

.admin-sidebar a {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.admin-sidebar a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-shell {
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.admin-topbar div {
    display: grid;
    gap: 2px;
}

.admin-topbar strong {
    font-size: 16px;
    font-weight: 700;
}

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

.admin-content {
    padding: 28px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    padding: 24px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.metric-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 32px;
    font-weight: 800;
    color: var(--ink);
}

.metric-card:nth-child(1) {
    border-top: 3px solid var(--primary);
}

.metric-card:nth-child(2) {
    border-top: 3px solid var(--cyan);
}

.metric-card:nth-child(3) {
    border-top: 3px solid var(--green);
}

.metric-card:nth-child(4) {
    border-top: 3px solid var(--orange);
}

.admin-panel {
    padding: 24px;
    background: rgba(255, 255, 255, .94);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

.admin-panel h2 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 700;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.quick-actions a {
    padding: 18px;
    border-radius: var(--radius);
    background: var(--line-light);
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    transition: all 0.15s ease;
    border: 1px solid var(--line);
}

.quick-actions a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-light);
}

.split-panel {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--line-light);
}

th:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

th:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

td {
    font-size: 14px;
}

td form {
    margin: 0;
}

td button {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    background: var(--panel);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

td button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.settings-form {
    max-width: 820px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-green {
    background: var(--green-light);
    color: #065f46;
}

.badge-red {
    background: var(--red-light);
    color: #991b1b;
}

.badge-orange {
    background: var(--orange-light);
    color: #92400e;
}

.badge-purple {
    background: var(--purple-light);
    color: #5b21b6;
}

@media (max-width: 1080px) {
    .hero,
    .community-grid,
    .post-layout {
        grid-template-columns: 1fr;
    }

    .category-rail,
    .popular-panel {
        position: static;
    }

    .category-rail {
        display: block;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .category-toggle {
        display: flex;
    }

    .category-list {
        display: none;
        grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
        gap: 8px;
        padding: 12px;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        margin-top: 8px;
        animation: cardEnter .22s ease both;
    }

    .category-rail.open .category-list {
        display: grid;
    }

    .category-list a {
        margin-top: 0;
        padding: 8px 14px;
        font-size: 13px;
        text-align: center;
    }

    .popular-panel {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
        padding: 14px;
    }

    .popular-panel h2 {
        grid-column: 1 / -1;
        margin-bottom: 4px;
    }

    .popular-panel a {
        margin-top: 0;
    }

    .hero-panel {
        order: -1;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 760px) {
    .site-header {
        position: sticky;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px;
        align-items: center;
        min-height: 56px;
        height: auto;
        padding: 10px 12px;
    }

    .menu-toggle {
        display: flex;
    }

    .mobile-profile-link {
        display: inline-flex;
        justify-self: end;
        align-items: center;
        justify-content: center;
    }

    .mobile-profile-link + .site-nav {
        display: none;
    }

    .site-nav {
        grid-column: 1 / -1;
        position: static;
        width: 100%;
        max-height: 0;
        margin-top: 0;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        padding: 0;
        border: 0;
        border-radius: var(--radius-md);
        transform: none;
        transition: max-height 0.25s ease, margin-top 0.25s ease, padding 0.25s ease, border-color 0.25s ease;
        z-index: 55;
        overflow: hidden;
    }

    body.menu-open .site-nav {
        max-height: calc(100vh - 86px);
        margin-top: 10px;
        padding: 10px;
        border: 1px solid var(--line);
        overflow-y: auto;
    }

    .site-nav > a,
    .site-nav button {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 12px 14px;
        font-size: 16px;
        border-radius: var(--radius-sm);
        text-align: left;
        width: 100%;
    }

    .site-nav > a:hover,
    .site-nav button:hover {
        background: var(--line-light);
    }

    .site-nav form {
        width: 100%;
    }

    .site-nav .nav-strong {
        margin-top: 0;
        text-align: center;
        justify-content: center;
    }

    .brand {
        font-size: 14px;
        gap: 8px;
    }

    .brand-mark {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
    }

    .nav-strong,
    .primary-button,
    .secondary-button {
        min-height: 36px;
        padding: 0 14px;
        font-size: 13px;
    }

    .hero {
        padding-top: 24px;
        padding-bottom: 24px;
        gap: 18px;
    }

    .hero-copy h1 {
        font-size: 34px;
        line-height: 1.08;
    }

    .hero-copy p {
        font-size: 15px;
    }

    .hero-panel {
        padding: 20px;
    }

    .hero-panel strong {
        font-size: 15px;
    }

    .hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-top: 16px;
    }

    .hero-stats div {
        padding: 10px 8px;
    }

    .hero-stats b {
        font-size: 20px;
    }

    .community-grid {
        padding: 16px;
        gap: 16px;
    }

    .thread-card {
        grid-template-columns: 42px 1fr;
        padding: 16px;
        gap: 12px;
    }

    .thread-card .avatar {
        display: grid;
        width: 42px;
        height: 42px;
        border-radius: var(--radius);
    }

    .thread-card img.avatar {
        display: block;
    }

    .profile-thread-card {
        grid-template-columns: 1fr;
    }

    .thread-card h3 {
        font-size: 15px;
    }

    .thread-card p {
        font-size: 13px;
    }

    .thread-meta,
    .thread-stats {
        gap: 8px;
        font-size: 12px;
    }

    .auth-screen {
        place-items: start center;
        min-height: calc(100vh - 56px);
        padding: 22px 16px 36px;
    }

    .auth-card,
    .compose-card {
        width: 100%;
        padding: 24px 18px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .auth-card h1,
    .compose-card h1 {
        margin-bottom: 22px;
        font-size: 26px;
        line-height: 1.18;
        letter-spacing: 0;
    }

    .auth-card label {
        gap: 7px;
        margin-bottom: 14px;
        font-size: 14px;
    }

    .auth-card input {
        min-height: 48px;
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 12px;
    }

    .auth-card .primary-button {
        min-height: 48px;
        margin-top: 2px;
        font-size: 15px;
    }

    .auth-switch {
        margin-top: 16px;
        line-height: 1.7;
    }

    .auth-card .eyebrow {
        font-size: 12px;
    }

    .post-layout {
        padding: 16px;
        gap: 16px;
    }

    .post-detail,
    .comment-panel,
    .profile-head {
        padding: 18px;
        border-radius: var(--radius);
    }

    .post-detail h1 {
        font-size: 22px;
    }

    .post-body {
        font-size: 15px;
    }

    .author-strip {
        padding: 14px;
    }

    .comment-card {
        padding-bottom: 14px;
    }

    .profile-head {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        text-align: left;
        padding: 18px;
        margin: 16px;
        gap: 14px;
        align-items: start;
    }

    .profile-head .avatar.large {
        width: 72px;
        height: 72px;
        font-size: 26px;
        border-width: 5px;
        grid-row: span 2;
    }

    .profile-main h1 {
        margin: 8px 0 8px;
        font-size: 28px;
        line-height: 1.16;
        overflow-wrap: anywhere;
    }

    .profile-main p {
        margin: 0;
        color: var(--muted);
        font-size: 14px;
    }

    .profile-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 4px;
    }

    .profile-actions form,
    .profile-actions .danger-button {
        width: 100%;
    }

    .profile-actions form {
        grid-column: 1 / -1;
    }

    .profile-stats {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
        margin-left: 0;
    }

    .profile-stats div {
        padding: 12px;
    }

    .profile-stats b {
        font-size: 18px;
    }

    .profile-empty {
        max-width: none;
        padding: 18px;
    }

    .profile-list {
        padding: 0 16px 40px;
    }

    .admin-body,
    .split-panel,
    .admin-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .admin-body {
        display: block;
    }

    .admin-sidebar {
        padding: 14px 16px;
        position: static;
    }

    .admin-sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin-top: 12px;
        padding-bottom: 4px;
    }

    .admin-sidebar nav a {
        padding: 9px 10px;
        text-align: center;
    }

    .admin-topbar {
        padding: 14px 16px;
    }

    .admin-content {
        padding: 16px;
    }

    .metric-card {
        padding: 18px;
    }

    .metric-card strong {
        font-size: 26px;
    }

    .admin-panel {
        padding: 16px;
    }

    table {
        min-width: 600px;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 13px;
    }
}
