/* ==========================================================================
   应创校园生活 - 全局样式
   依据 Design_Specification.json v1.0.0
   - 设计（排版/颜色/动效/组件）：Apple HIG
   - 系统适配（深色模式/响应式/无障碍/DPI）：Windows 规范
   断点: mobile 0-767 | tablet 768-1023 | desktop 1024+
   ========================================================================== */

/* ---------- 重置 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    color-scheme: light;
    scrollbar-width: thin;
    scrollbar-color: var(--color-separator) transparent;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

/* ---------- 设计令牌 Design Tokens（浅色） ---------- */
:root {
    /* 颜色 - Apple 语义色 */
    --color-primary: #007AFF;
    --color-primary-strong: #0051D5;
    --color-success: #34C759;
    --color-warning: #FF9500;
    --color-error: #FF3B30;
    --color-label: #000000;
    --color-label-secondary: rgba(60, 60, 67, 0.6);
    --color-label-secondary-solid: #3C3C43;
    --color-label-tertiary: rgba(60, 60, 67, 0.3);
    --color-background: #FFFFFF;
    --color-surface: #F2F2F7;
    --color-card: #FFFFFF;
    --color-separator: #E5E5EA;

    /* 派生色（语义色的强调/淡染，供标签与徽章使用） */
    --color-fill: rgba(120, 120, 128, 0.12);
    --color-fill-strong: rgba(120, 120, 128, 0.2);
    --primary-tint: rgba(0, 122, 255, 0.12);
    --success-tint: rgba(52, 199, 89, 0.15);
    --warning-tint: rgba(255, 149, 0, 0.15);
    --error-tint: rgba(255, 59, 48, 0.12);
    --focus-ring: rgba(0, 122, 255, 0.25);

    /* 页面与材料（Mica / Acrylic 近似） */
    --bg-page: var(--color-surface);
    --material-bar: rgba(255, 255, 255, 0.85);
    --material-acrylic: rgba(255, 255, 255, 0.72);
    --material-backdrop: rgba(0, 0, 0, 0.4);
    --toast-bg: rgba(0, 0, 0, 0.8);
    --toast-fg: #FFFFFF;
    --shadow-tint: 0, 0, 0;

    /* 排版 - Apple 字体层级（Segoe UI Variable 优先，DPI 友好 rem） */
    --font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --fs-large-title: 2.125rem;   /* 34 */
    --lh-large-title: 2.5625rem;  /* 41 */
    --fs-title1: 1.75rem;         /* 28 */
    --lh-title1: 2.125rem;        /* 34 */
    --fs-title2: 1.375rem;        /* 22 */
    --lh-title2: 1.75rem;         /* 28 */
    --fs-title3: 1.25rem;         /* 20 */
    --lh-title3: 1.5625rem;       /* 25 */
    --fs-headline: 1.0625rem;     /* 17 */
    --lh-headline: 1.375rem;      /* 22 */
    --fs-body: 1.0625rem;         /* 17 */
    --lh-body: 1.375rem;          /* 22 */
    --fs-callout: 1rem;           /* 16 */
    --lh-callout: 1.3125rem;      /* 21 */
    --fs-subhead: 0.9375rem;      /* 15 */
    --lh-subhead: 1.25rem;        /* 20 */
    --fs-footnote: 0.8125rem;     /* 13 */
    --lh-footnote: 1.125rem;      /* 18 */
    --fs-caption: 0.75rem;        /* 12 */
    --lh-caption: 1rem;           /* 16 */

    /* 间距 Apple 4/8/16/24/32/48 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-input: 10px;
    --radius-pill: 999px;

    /* 阴影（Depth 原则：层次感） */
    --shadow-sm: 0 1px 3px rgba(var(--shadow-tint), 0.08);
    --shadow-md: 0 4px 12px rgba(var(--shadow-tint), 0.1);
    --shadow-lg: 0 8px 24px rgba(var(--shadow-tint), 0.14);

    /* 动效 */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 350ms;
    --ease: cubic-bezier(0.42, 0, 0.58, 1);

    /* 控件尺寸（componentStyles） */
    --control-height: 50px;
    --control-height-sm: 36px;
    --header-height: 56px;
    --tab-bar-height: 64px;
    --list-row-height: 44px;
    --nav-width: 0px;

    /* 品牌装饰（匿名标识） */
    --anon-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --anon-color: #667eea;
}

/* ---------- 深色模式（Windows ThemeResource 语义） ---------- */
:root[data-theme="dark"] {
    --color-primary: #0A84FF;
    --color-primary-strong: #0A84FF;
    --color-success: #30D158;
    --color-warning: #FF9F0A;
    --color-error: #FF453A;
    --color-label: #FFFFFF;
    --color-label-secondary: rgba(235, 235, 245, 0.6);
    --color-label-secondary-solid: #EBEBF5;
    --color-label-tertiary: rgba(235, 235, 245, 0.3);
    --color-background: #000000;
    --color-surface: #1C1C1E;
    --color-card: #1C1C1E;
    --color-separator: #38383A;

    --color-fill: rgba(120, 120, 128, 0.24);
    --color-fill-strong: rgba(120, 120, 128, 0.36);
    --primary-tint: rgba(10, 132, 255, 0.2);
    --success-tint: rgba(48, 209, 88, 0.18);
    --warning-tint: rgba(255, 159, 10, 0.18);
    --error-tint: rgba(255, 69, 58, 0.16);
    --focus-ring: rgba(10, 132, 255, 0.4);

    --bg-page: var(--color-background);
    --material-bar: rgba(28, 28, 30, 0.82);
    --material-acrylic: rgba(44, 44, 46, 0.72);
    --material-backdrop: rgba(0, 0, 0, 0.55);
    --toast-bg: rgba(58, 58, 60, 0.95);
    --toast-fg: #FFFFFF;
    --shadow-tint: 0, 0, 0;

    --anon-color: #8b9cf7;
}

/* ---------- 基础 ---------- */
body {
    font-family: var(--font-family);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    background-color: var(--bg-page);
    color: var(--color-label);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overscroll-behavior: none;
    transition: background-color var(--duration-normal) var(--ease),
        color var(--duration-normal) var(--ease);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: opacity var(--duration-fast) var(--ease);
}

a:active {
    opacity: 0.6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: var(--primary-tint);
    color: var(--color-label);
}

/* 无障碍：键盘导航焦点（AutomationProperties / 键盘导航清单项） */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- 应用容器 ---------- */
.container {
    display: flow-root; /* 防止子元素 margin 穿透，避免空页面出现幽灵滚动区 */
    min-height: 100vh;
    padding-bottom: calc(var(--tab-bar-height) + 16px);
    padding-left: var(--nav-width);
}

/* ---------- 头部导航（frosted bar / Acrylic） ---------- */
.header {
    position: fixed;
    top: 0;
    left: var(--nav-width);
    right: 0;
    height: var(--header-height);
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-separator);
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 var(--space-md);
    z-index: 100;
    transition: background-color var(--duration-normal) var(--ease);
}

.header-title {
    font-size: var(--fs-headline);
    line-height: var(--lh-headline);
    font-weight: 600;
    color: var(--color-label);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        transform var(--duration-fast) var(--ease);
}

.header-btn:hover {
    background: var(--color-fill);
}

.header-btn:active {
    background: var(--color-fill-strong);
    transform: scale(0.94);
}

/* ---------- 底部导航 / 侧边导航栏（NavigationView） ---------- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: var(--nav-width);
    right: 0;
    height: var(--tab-bar-height);
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--color-separator);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-sm);
    z-index: 100;
    transition: background-color var(--duration-normal) var(--ease);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) 0;
    min-height: 48px;
    color: var(--color-label-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: color var(--duration-fast) var(--ease),
        background var(--duration-fast) var(--ease);
}

.tab-item.active {
    color: var(--color-primary);
}

.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-label {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: 500;
}

/* ---------- 页面内容区 ---------- */
.page-content,
.post-list,
.create-page,
.profile-page,
.topics-page,
.admin-page,
.post-detail,
.load-more {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.page-content,
.create-page,
.profile-page,
.topics-page,
.admin-page,
.post-detail {
    padding: calc(var(--header-height) + var(--space-md)) var(--space-md) var(--space-md);
}

.post-list {
    padding: var(--space-md);
}

.container.has-comment-bar {
    padding-bottom: calc(var(--tab-bar-height) + 88px);
}

/* 进入动效（fade / drill，Apple 动效曲线） */
@keyframes anim-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes anim-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes anim-slide-up-in {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes anim-scale-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes anim-drill-in {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-fade {
    animation: anim-fade-in var(--duration-normal) var(--ease) both;
}

.page-drill {
    animation: anim-drill-in var(--duration-slow) var(--ease) both;
}

/* ---------- 卡片（Apple Card：radius 16 / padding 16 / Surface） ---------- */
.card {
    background: var(--color-card);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: transform var(--duration-normal) var(--ease),
        box-shadow var(--duration-normal) var(--ease),
        background-color var(--duration-normal) var(--ease);
}

.card:active {
    transform: scale(0.98);
}

/* ---------- 帖子卡片 ---------- */
.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--color-fill);
    flex-shrink: 0;
}

.post-user-info {
    flex: 1;
    min-width: 0;
}

.post-username {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
    color: var(--color-label);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-meta {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
}

.post-title {
    font-size: var(--fs-headline);
    line-height: var(--lh-headline);
    font-weight: 600;
    color: var(--color-label);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content {
    font-size: var(--fs-callout);
    line-height: 1.6;
    color: var(--color-label);
    margin-bottom: 12px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: 12px;
}

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

.post-images.double {
    grid-template-columns: repeat(2, 1fr);
}

.post-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--color-fill);
    cursor: zoom-in;
}

.post-images.single .post-image {
    aspect-ratio: 16 / 9;
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding-top: 12px;
    border-top: 1px solid var(--color-separator);
}

.post-tag {
    display: inline-block;
    padding: var(--space-xs) 10px;
    background: var(--color-fill);
    border-radius: var(--radius-pill);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
    margin-right: var(--space-sm);
    white-space: nowrap;
}

.post-tag.type-dynamic {
    background: var(--primary-tint);
    color: var(--color-primary);
}

.post-tag.type-help {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.post-tag.type-ad {
    background: var(--success-tint);
    color: var(--color-success);
}

.post-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.post-action {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--color-label-secondary);
    font-size: var(--fs-footnote);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    transition: color var(--duration-fast) var(--ease);
}

.post-action:active {
    opacity: 0.6;
}

/* ---------- 筛选栏与胶囊按钮 ---------- */
.filter-bar {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--header-height);
    padding: 12px var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior: contain;
    background: var(--bg-page);
    position: sticky;
    top: var(--header-height);
    z-index: 50;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip,
.admin-tab {
    padding: var(--space-sm) 14px;
    min-height: 36px;
    background: var(--color-fill);
    border-radius: var(--radius-pill);
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    white-space: nowrap;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: background var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease),
        transform var(--duration-fast) var(--ease);
}

.filter-chip:hover,
.admin-tab:hover {
    background: var(--color-fill-strong);
}

.filter-chip:active,
.admin-tab:active {
    transform: scale(0.95);
}

.filter-chip.active,
.admin-tab.active {
    background: var(--color-primary);
    color: #FFFFFF;
}

.filter-chip .chip-close {
    display: inline-flex;
    align-items: center;
    opacity: 0.8;
}

.filter-chip.topic-context {
    background: var(--primary-tint);
    color: var(--color-primary);
}

.filter-chip.topic-context:hover {
    background: var(--color-fill-strong);
}

/* ---------- 悬浮发布按钮 ---------- */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(var(--tab-bar-height) + 16px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 50;
    transition: transform var(--duration-fast) var(--ease),
        background var(--duration-fast) var(--ease);
}

.fab:hover {
    background: var(--color-primary-strong);
}

.fab:active {
    transform: scale(0.9);
}

/* ---------- 加载更多 ---------- */
.load-more {
    text-align: center;
    padding: var(--space-md);
    color: var(--color-label-secondary);
    font-size: var(--fs-footnote);
    display: none;
}

.load-more.visible {
    display: block;
}

/* 桌面端：显式"加载更多"按钮（不使用滚动加载） */
.load-more.as-button.visible {
    width: fit-content;
    min-height: 44px;
    margin-left: auto;
    margin-right: auto;
    padding: 12px var(--space-xl);
    background: var(--color-fill);
    border: none;
    border-radius: var(--radius-pill);
    color: var(--color-primary);
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        transform var(--duration-fast) var(--ease);
}

.load-more.as-button.visible:hover {
    background: var(--color-fill-strong);
}

.load-more.as-button.visible:active {
    transform: scale(0.97);
}

/* ---------- 详情页 ---------- */
.detail-card,
.comments-card {
    background: var(--color-card);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: background-color var(--duration-normal) var(--ease);
}

.detail-header {
    padding: var(--space-md);
}

.detail-author {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-md);
}

.detail-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--color-fill);
    flex-shrink: 0;
}

.detail-user-info {
    flex: 1;
    min-width: 0;
}

.detail-username {
    font-size: var(--fs-callout);
    line-height: var(--lh-callout);
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-meta {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
}

.detail-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.detail-action-btn {
    padding: var(--space-sm) 14px;
    min-height: 36px;
    font-size: var(--fs-footnote);
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease),
        opacity var(--duration-fast) var(--ease);
}

.detail-action-btn.delete {
    background: var(--color-error);
    color: #FFFFFF;
}

.detail-action-btn:active {
    transform: scale(0.95);
}

.detail-content {
    padding: 0 var(--space-md) var(--space-md);
}

.detail-title {
    font-size: var(--fs-title3);
    line-height: var(--lh-title3);
    font-weight: 600;
    margin-bottom: 12px;
}

.detail-text {
    font-size: var(--fs-callout);
    line-height: 1.7;
    color: var(--color-label);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.detail-images.single {
    grid-template-columns: 1fr;
}

.detail-images.double {
    grid-template-columns: repeat(2, 1fr);
}

.detail-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--color-fill);
    cursor: zoom-in;
}

.detail-images.single .detail-image {
    aspect-ratio: 16 / 9;
}

.detail-footer {
    padding: 12px var(--space-md);
    border-top: 1px solid var(--color-separator);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ---------- 评论 ---------- */
.comments-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-separator);
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.comments-list {
    padding: var(--space-md);
    background: var(--color-fill);
}

.comment-item {
    display: flex;
    margin-bottom: var(--space-md);
}

.comment-item:last-child {
    margin-bottom: 0;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--color-card);
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.comment-username {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    font-weight: 600;
    color: var(--color-label);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-delete {
    font-size: var(--fs-caption);
    color: var(--color-error);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    flex-shrink: 0;
}

.comment-delete:active {
    opacity: 0.6;
}

.comment-text {
    font-size: var(--fs-subhead);
    line-height: 1.5;
    color: var(--color-label);
    margin-bottom: var(--space-xs);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.comment-time {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-tertiary);
}

/* 评论输入条 */
.comment-input-area {
    position: fixed;
    bottom: 0;
    left: var(--nav-width);
    right: 0;
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--color-separator);
    padding: 12px var(--space-md);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.comment-input {
    flex: 1 1 auto;
    max-width: 640px;
    min-height: 44px;
    padding: 10px var(--space-md);
    font-size: var(--fs-subhead);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-pill);
    background: var(--color-card);
    outline: none;
    transition: border-color var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease);
}

.comment-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.comment-submit {
    min-height: 44px;
    padding: 10px 20px;
    font-size: var(--fs-subhead);
    font-weight: 600;
    background: var(--color-primary);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease),
        opacity var(--duration-fast) var(--ease);
}

.comment-submit:active {
    transform: scale(0.95);
}

.comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- 表单（Apple Input：radius 10 / height 50 / 17px） ---------- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    font-weight: 600;
    color: var(--color-label-secondary-solid);
    margin-bottom: var(--space-sm);
}

.form-input {
    width: 100%;
    min-height: var(--control-height);
    padding: 12px var(--space-md);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-input);
    background: var(--color-card);
    color: var(--color-label);
    transition: border-color var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease),
        background-color var(--duration-normal) var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-input::placeholder {
    color: var(--color-label-tertiary);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E8E93' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: 40px;
    cursor: pointer;
}

.form-tip {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-tertiary);
    margin-top: var(--space-sm);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.optional {
    font-size: var(--fs-caption);
    color: var(--color-label-tertiary);
    font-weight: 400;
}

.char-count {
    text-align: right;
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-tertiary);
    margin-top: var(--space-xs);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--fs-subhead);
    min-height: 44px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: var(--space-sm);
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

/* ---------- 按钮（Apple Filled：radius 12 / height 50 / 17 Semibold） ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    height: var(--control-height);
    padding: 0 var(--space-lg);
    font-size: var(--fs-body);
    line-height: 1;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease),
        background var(--duration-fast) var(--ease),
        opacity var(--duration-fast) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-strong);
}

.btn-secondary {
    background: var(--color-fill-strong);
    color: var(--color-label);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-fill);
}

/* Apple Bordered 按钮 */
.btn-bordered {
    background: transparent;
    border-color: var(--color-separator);
    color: var(--color-primary);
}

.btn-bordered:hover:not(:disabled) {
    background: var(--color-fill);
}

.btn-danger {
    background: var(--color-error);
    color: #FFFFFF;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: var(--control-height-sm);
    padding: 0 var(--space-md);
    font-size: var(--fs-subhead);
}

/* 触控设备保证触摸目标 ≥ 44px（tablet 清单项） */
@media (pointer: coarse) {
    .btn-sm {
        min-height: 44px;
    }
}

/* ---------- 头像 / 图片上传 ---------- */
.avatar-upload,
.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.avatar-upload img,
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-icon,
.avatar-preview-icon {
    font-size: 32px;
    color: var(--color-label-tertiary);
}

.avatar-upload input,
.avatar-preview input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* 发帖图片九宫格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-top: 12px;
}

.image-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: var(--color-fill);
    position: relative;
    overflow: hidden;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-remove {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    border: none;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-add {
    border: 2px dashed var(--color-separator);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease);
}

.image-add:active,
.image-add:hover {
    border-color: var(--color-primary);
}

.image-add-icon {
    font-size: 32px;
    color: var(--color-label-tertiary);
}

.image-add input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------- 分段控件（tabs） ---------- */
.tabs,
.login-tabs {
    display: flex;
    background: var(--color-fill);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    margin-bottom: var(--space-md);
}

.tab,
.login-tab {
    flex: 1;
    min-height: 44px;
    padding: 10px var(--space-md);
    text-align: center;
    font-size: var(--fs-subhead);
    font-weight: 500;
    color: var(--color-label-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease);
}

.tab.active,
.login-tab.active {
    background: var(--color-card);
    color: var(--color-label);
    box-shadow: var(--shadow-sm);
}

/* ---------- 发帖类型选择 ---------- */
.type-selector {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    min-height: 48px;
    padding: 12px;
    text-align: center;
    font-size: var(--fs-subhead);
    font-weight: 500;
    background: var(--color-fill);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease),
        transform var(--duration-fast) var(--ease);
}

.type-btn.active {
    background: var(--color-card);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.type-btn:active {
    transform: scale(0.98);
}

.submit-area {
    margin-top: var(--space-lg);
}

/* ---------- 空状态 / 加载 ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-xxl) var(--space-md);
    grid-column: 1 / -1;
}

.empty-state.compact {
    padding: var(--space-xl) 0;
}

.empty-icon {
    display: block;
    margin: 0 auto var(--space-md);
    color: var(--color-label-tertiary);
}

.empty-text {
    font-size: var(--fs-subhead);
    color: var(--color-label-secondary);
}

.loading {
    display: flex;
    justify-content: center;
    padding: var(--space-md);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-fill-strong);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--material-backdrop);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: anim-fade-in var(--duration-fast) var(--ease) both;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--toast-bg);
    color: var(--toast-fg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal) var(--ease),
        visibility var(--duration-normal) var(--ease);
    pointer-events: none;
    max-width: 80vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* ---------- 模态框（Depth：浮层 + 缩放进入） ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: var(--material-backdrop);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal) var(--ease),
        visibility var(--duration-normal) var(--ease);
    padding: var(--space-md);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform var(--duration-normal) var(--ease);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 20px 12px;
    text-align: center;
}

.modal-title {
    font-size: var(--fs-headline);
    line-height: var(--lh-headline);
    font-weight: 600;
}

.modal-body {
    padding: 0 20px 20px;
    text-align: center;
    font-size: var(--fs-subhead);
    color: var(--color-label-secondary);
}

.modal-body .form-group {
    text-align: left;
}

.modal-body .form-label {
    text-align: left;
}

.modal-footer {
    display: flex;
    border-top: 1px solid var(--color-separator);
}

.modal-btn {
    flex: 1;
    min-height: 48px;
    padding: 14px;
    font-size: var(--fs-body);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-primary);
    transition: background var(--duration-fast) var(--ease);
}

.modal-btn:first-child {
    border-right: 1px solid var(--color-separator);
    color: var(--color-label-secondary);
}

.modal-btn:hover {
    background: var(--color-fill);
}

.modal-btn:active {
    background: var(--color-fill-strong);
}

/* ---------- 图片预览 Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    cursor: zoom-out;
    animation: anim-fade-in var(--duration-normal) var(--ease) both;
    padding: var(--space-md);
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    animation: anim-scale-in var(--duration-normal) var(--ease) both;
}

/* ---------- 用户卡片 / 徽章 ---------- */
.user-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    background: var(--color-fill);
}

.user-name {
    font-size: var(--fs-title3);
    line-height: var(--lh-title3);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.user-info {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    margin-bottom: var(--space-xs);
}

.user-badge {
    display: inline-block;
    padding: var(--space-xs) 12px;
    background: var(--color-primary);
    color: #FFFFFF;
    border-radius: var(--radius-pill);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: 500;
    margin-top: var(--space-sm);
}

.user-badge.authenticated {
    background: var(--success-tint);
    color: var(--color-success);
}

.user-badge.admin {
    background: var(--warning-tint);
    color: var(--color-warning);
}

/* ---------- 列表项（list row ≥ 44 / separatorInset 16） ---------- */
.list-item {
    display: flex;
    align-items: center;
    min-height: var(--list-row-height);
    padding: 12px var(--space-md);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-separator);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease);
}

.list-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.list-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.list-item:only-child {
    border-radius: var(--radius-md);
}

.list-item:hover {
    background: var(--color-fill);
}

.list-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--color-primary);
}

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

.list-title {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 500;
    color: var(--color-label);
}

.list-subtitle {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    margin-top: 2px;
}

.list-arrow {
    color: var(--color-label-tertiary);
    font-size: 18px;
    flex-shrink: 0;
}

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 60px var(--space-lg) var(--space-lg);
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.login-page.centered {
    justify-content: center;
    max-width: 440px;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xxl);
}

.login-logo h1 {
    font-size: var(--fs-large-title);
    line-height: var(--lh-large-title);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.login-logo.compact h1 {
    font-size: var(--fs-title1);
    line-height: var(--lh-title1);
}

.login-logo p {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    color: var(--color-label-secondary);
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
    animation: anim-fade-in var(--duration-normal) var(--ease) both;
}

.login-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
}

.login-title {
    font-size: var(--fs-title3);
    line-height: var(--lh-title3);
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-lg);
}

.back-link {
    text-align: center;
    margin-top: var(--space-lg);
}

.back-link a {
    font-size: var(--fs-subhead);
    color: var(--color-label-secondary);
}

/* ---------- 个人中心 ---------- */
.profile-header {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: background-color var(--duration-normal) var(--ease);
}

.profile-avatar-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    position: relative;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-fill);
}

.profile-avatar-edit {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #FFFFFF;
    border: 2px solid var(--color-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease);
}

.profile-avatar-edit:hover {
    transform: scale(1.08);
}

.profile-avatar-edit input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.profile-name {
    font-size: var(--fs-title3);
    line-height: var(--lh-title3);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.profile-info {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    color: var(--color-label-secondary);
    margin-bottom: var(--space-xs);
}

.profile-badges {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: 12px;
    flex-wrap: wrap;
}

.profile-badge {
    padding: var(--space-xs) 12px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: 500;
}

.profile-badge.authenticated {
    background: var(--success-tint);
    color: var(--color-success);
}

.profile-badge.admin {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.menu-section {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 12px var(--space-md);
    border: none;
    border-bottom: 1px solid var(--color-separator);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item[hidden] {
    display: none;
}

.menu-item:hover {
    background: var(--color-fill);
}

.menu-item:active {
    background: var(--color-fill-strong);
}

.menu-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.menu-icon.warning {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.menu-icon.accent {
    background: var(--success-tint);
    color: var(--color-success);
}

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

.menu-title {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 500;
}

.menu-subtitle {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
    margin-top: 2px;
}

.menu-arrow {
    color: var(--color-label-tertiary);
    font-size: 18px;
    flex-shrink: 0;
}

.my-posts-section {
    margin-top: var(--space-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    gap: var(--space-sm);
}

.section-title {
    font-size: var(--fs-callout);
    line-height: var(--lh-callout);
    font-weight: 600;
}

.section-more {
    font-size: var(--fs-footnote);
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
}

/* ---------- 话题页 ---------- */
.topic-card {
    display: block;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--duration-normal) var(--ease),
        box-shadow var(--duration-normal) var(--ease);
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.topic-card:active {
    transform: scale(0.98);
}

.topic-name {
    font-size: var(--fs-callout);
    line-height: var(--lh-callout);
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-label);
}

.topic-desc {
    font-size: var(--fs-footnote);
    line-height: 1.5;
    color: var(--color-label-secondary);
    margin-bottom: var(--space-sm);
}

.topic-meta {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-tertiary);
}

/* ---------- 管理后台 ---------- */
.admin-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.admin-tabs::-webkit-scrollbar {
    display: none;
}

.admin-content {
    display: none;
}

.admin-content.active {
    display: block;
    animation: anim-fade-in var(--duration-normal) var(--ease) both;
}

.search-bar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.search-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 10px var(--space-md);
    font-size: var(--fs-subhead);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-pill);
    background: var(--color-card);
    outline: none;
    transition: border-color var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.search-btn {
    min-height: 44px;
    padding: 10px 20px;
    font-size: var(--fs-subhead);
    font-weight: 600;
    background: var(--color-primary);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease);
}

.search-btn:active {
    transform: scale(0.96);
}

.user-item,
.manage-item,
.topic-item {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--duration-normal) var(--ease);
}

.user-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background: var(--color-fill);
    flex-shrink: 0;
}

.user-item .user-info {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.user-item .user-name {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--color-label);
}

.user-meta {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
    margin-top: 2px;
    word-break: break-all;
}

.user-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.user-action-btn {
    padding: var(--space-sm) 14px;
    min-height: 36px;
    font-size: var(--fs-caption);
    font-weight: 500;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease),
        background var(--duration-fast) var(--ease);
}

.user-action-btn:hover {
    filter: brightness(0.97);
}

.user-action-btn:active {
    transform: scale(0.95);
}

.user-action-btn.success {
    background: var(--success-tint);
    color: var(--color-success);
}

.user-action-btn.warning {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.user-action-btn.danger {
    background: var(--error-tint);
    color: var(--color-error);
}

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.manage-main {
    flex: 1;
    min-width: 0;
}

.manage-title {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--color-label);
}

.manage-content {
    font-size: var(--fs-subhead);
    color: var(--color-label-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-sm);
    word-break: break-word;
}

.manage-meta {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-tertiary);
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-info h3 {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.topic-info p {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
}

.add-topic-btn {
    margin-bottom: var(--space-md);
}

/* ---------- 统计卡片 ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: var(--space-md);
}

.stat-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--duration-normal) var(--ease);
}

.stat-value {
    font-size: var(--fs-title1);
    line-height: var(--lh-title1);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
}

/* ---------- 匿名样式 ---------- */
.anonymous-name {
    color: var(--anon-color);
}

.post-avatar[src*="noname"],
.comment-avatar[src*="noname"],
.detail-avatar[src*="noname"] {
    background: var(--anon-gradient);
}

/* ---------- 头像圆形裁切加固 ----------
   部分移动内核在 loading="lazy" 图片解码完成后偶发丢失 border-radius，
   用 clip-path 二次裁切兜底 */
.post-avatar,
.comment-avatar,
.detail-avatar,
.user-avatar,
.user-avatar-large,
.profile-avatar {
    border-radius: 50%;
    clip-path: circle(50%);
}

.avatar-upload,
.avatar-preview {
    clip-path: circle(50%);
}

.avatar-upload img,
.avatar-preview img {
    clip-path: circle(50%);
}

/* ==========================================================================
   安全区域（iOS / 移动端，须在侧栏断点之前）
   ========================================================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tab-bar {
        height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
    }

    .container {
        padding-bottom: calc(var(--tab-bar-height) + 16px + env(safe-area-inset-bottom));
    }

    .container.has-comment-bar {
        padding-bottom: calc(var(--tab-bar-height) + 88px + env(safe-area-inset-bottom));
    }

    .comment-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ==========================================================================
   平板 768-1023：单列 + 左侧紧凑导航（NavigationView Left Compact）
   ========================================================================== */
@media (min-width: 768px) {
    :root {
        --nav-width: 64px;
    }

    body {
        background:
            radial-gradient(1200px 600px at 100% 0%, var(--primary-tint), transparent 60%),
            var(--bg-page);
    }

    .container {
        padding-bottom: var(--space-lg);
    }

    .container.has-comment-bar {
        padding-bottom: 96px;
    }

    .tab-bar {
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: 64px;
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: var(--space-xs);
        padding: calc(var(--header-height) + var(--space-md)) var(--space-sm) var(--space-md);
        border-top: none;
        border-right: 1px solid var(--color-separator);
    }

    .tab-item {
        flex: 0 0 auto;
        flex-direction: column;
        gap: 2px;
        padding: 10px 0;
        min-height: 52px;
    }

    .tab-item:hover {
        background: var(--color-fill);
        color: var(--color-primary);
    }

    .fab {
        bottom: var(--space-lg);
        right: var(--space-lg);
    }

    .header {
        grid-template-columns: 40px 1fr 40px;
    }

    /* 桌面交互：hover 反馈（鼠标输入完整支持） */
    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .btn:hover:not(:disabled) {
        filter: brightness(0.97);
    }

    .post-action:hover {
        color: var(--color-primary);
    }

    .modal-content {
        max-width: 400px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .page-content,
    .create-page,
    .profile-page,
    .topics-page,
    .admin-page,
    .post-detail {
        padding-bottom: var(--space-lg);
    }
}

/* ==========================================================================
   桌面 ≥1024：多列 + 左侧导航（NavigationView Left）
   ========================================================================== */
@media (min-width: 1024px) {
    :root {
        --nav-width: 220px;
    }

    body {
        background:
            radial-gradient(1400px 700px at 90% -10%, var(--primary-tint), transparent 55%),
            radial-gradient(1000px 500px at 0% 100%, var(--warning-tint), transparent 50%),
            var(--bg-page);
    }

    /* Mica 窗口 + Acrylic 内容面 */
    .container {
        background: var(--material-acrylic);
        backdrop-filter: blur(40px) saturate(150%);
        -webkit-backdrop-filter: blur(40px) saturate(150%);
        border-right: 1px solid var(--color-separator);
        min-height: 100vh;
        box-shadow: 0 0 40px rgba(var(--shadow-tint), 0.06);
    }

    .tab-bar {
        width: 220px;
        padding: calc(var(--header-height) + var(--space-md)) var(--space-md) var(--space-md);
    }

    .tab-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px var(--space-md);
        min-height: 48px;
        font-size: var(--fs-subhead);
    }

    .tab-label {
        font-size: var(--fs-subhead);
        line-height: var(--lh-subhead);
    }

    .card,
    .detail-card,
    .comments-card,
    .profile-header,
    .menu-section,
    .topic-card,
    .user-item,
    .manage-item,
    .topic-item,
    .stat-card,
    .login-card {
        border-color: var(--color-separator);
    }

    /* 多列帖子流（加载条与内容列同宽） */
    .post-list,
    .load-more {
        max-width: 960px;
    }

    .post-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-md);
        align-items: start;
    }

    .post-list .card {
        margin-bottom: 0;
    }

    .comment-input-area {
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
    }
}

/* 移动端不显示多列与侧栏特例恢复 */
@media (max-width: 767px) {
    .post-list {
        display: block;
    }
}

/* ==========================================================================
   动效降级（无障碍：prefers-reduced-motion）
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   打印
   ========================================================================== */
@media print {

    .header,
    .tab-bar,
    .fab,
    .comment-input-area,
    .toast {
        display: none !important;
    }

    .container {
        padding: 0;
    }
}
