/* ==========================================================================
   应创校园生活 - 全局样式
   依据 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;
    --notice-h: 32px;
    --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: var(--notice-h);
    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(--notice-h) + var(--header-height) + var(--space-md)) var(--space-md) var(--space-md);
}

.post-list {
    padding: var(--space-md);
}

/* 进入动效（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%;
    height: auto;
    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 / 10;
}

.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-tag.md-img-count {
    background: #1b1b1f;
    color: #ffffff;
}

:root[data-theme="dark"] .post-tag.md-img-count {
    background: #fbfbfd;
    color: #000000;
}

.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: calc(var(--notice-h) + var(--header-height));
    padding: 12px var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior: contain;
    /* 毛玻璃（与 header 同材质），首行做不支持 backdrop-filter 时的回退 */
    background: var(--bg-page);
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-separator);
    position: sticky;
    top: calc(var(--notice-h) + 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;
    /* 不能 hidden：会裁掉评论区“更多”操作下拉面板；圆角由 border-radius 负责 */
    overflow: visible;
    transition: background-color var(--duration-normal) var(--ease);
}

.detail-header {
    position: relative;
    padding: var(--space-md);
}
.detail-head-actions {
    position: absolute;
    top: var(--space-md);
    right: 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%;
    height: auto;
    border-radius: var(--radius-sm);
    background: var(--color-fill);
    cursor: zoom-in;
    min-height: 120px;
}

.detail-images.single .detail-image {
    min-height: 160px;
}

.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 {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px var(--space-md);
    margin-bottom: 12px;
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: background-color var(--duration-normal) var(--ease);
}

.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-input);
    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-input);
    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);
}

/* ---------- 协议同意弹窗（用户协议 / 隐私政策） ---------- */
.modal-agree .modal-content {
    max-width: 440px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    transform: none;
}

.modal-agree .modal-body {
    text-align: left;
    color: var(--color-label);
    overflow-y: auto;
    padding-bottom: var(--space-sm);
}

.agree-note {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.agree-item {
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
    background: var(--color-background);
}

.agree-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: var(--fs-subhead);
    font-weight: 600;
    color: var(--color-label);
    cursor: pointer;
}

.agree-item-head .agree-toggle {
    flex-shrink: 0;
    font-size: var(--fs-footnote);
    font-weight: 400;
    color: var(--color-primary);
}

.agree-item-frame {
    display: none;
    width: 100%;
    height: 52vh;
    border: 0;
    border-top: 1px solid var(--color-separator);
    background: var(--color-background);
}

.agree-item.open .agree-item-frame {
    display: block;
}

.agree-actions {
    padding: var(--space-sm) 20px 20px;
}

/* 注册页协议勾选（卡片式同意块） */
.agree-check {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-fill);
    min-height: 44px;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease);
}

.agree-check:hover {
    background: var(--color-fill-strong);
}

.agree-check:focus-within {
    border-color: var(--color-primary);
}

.agree-check:has(input:checked) {
    background: var(--primary-tint);
    border-color: var(--color-primary);
}

.agree-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.agree-check-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.agree-check-title {
    font-size: var(--fs-subhead);
    font-weight: 500;
    color: var(--color-label);
    line-height: 1.6;
}

.agree-check-sub {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    line-height: 1.6;
}

.agree-check .field-error {
    flex: 1 0 100%;
    margin-top: 2px;
}

.agree-check a {
    color: var(--color-primary);
    word-break: break-all;
}

.agree-check + .agree-check {
    margin-top: 8px;
}

/* 同意弹窗：真实姓名确认勾选 */
.agree-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-fill);
    font-size: var(--fs-subhead);
    color: var(--color-label);
    line-height: 1.6;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease);
}

.agree-confirm:hover {
    background: var(--color-fill-strong);
}

.agree-confirm:focus-within {
    border-color: var(--color-primary);
}

.agree-confirm:has(input:checked) {
    background: var(--primary-tint);
    border-color: var(--color-primary);
}

.agree-confirm input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

/* ---------- 图片预览 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);
}

.lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-out;
    animation: anim-scale-in var(--duration-normal) var(--ease) both;
}

.lightbox-img {
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* 电脑端查看器控件：缩放条 + 鸟瞰图（移动端隐藏） */
.lightbox-controls {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.lightbox-zoombar {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    background: rgba(28, 28, 30, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.lightbox-zoom-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: #FFFFFF;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease);
}

.lightbox-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.lightbox-zoom-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-zoom-value {
    width: 48px;
    padding: 8px 0;
    text-align: center;
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-variant-numeric: tabular-nums;
    color: #FFFFFF;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.lightbox-minimap {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    touch-action: none;
}

.lightbox-minimap img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: fill;
    border-radius: 0;
    animation: none;
    pointer-events: none;
}

.lightbox-minimap-rect {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #0A84FF;
    background: rgba(10, 132, 255, 0.18);
    border-radius: 3px;
    cursor: grab;
    touch-action: none;
}

.lightbox-minimap-rect:active {
    cursor: grabbing;
}

@media (max-width: 1023px) {
    .lightbox-controls {
        display: none;
    }
}

/* ---------- 用户卡片 / 徽章 ---------- */
.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-input);
    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);
}

/* ---------- 已认证蓝V标识 ---------- */
.verified-badge {
    display: inline-block;
    vertical-align: -2px;
    margin-left: 4px;
    flex-shrink: 0;
}

.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));
    }

    /* FAB 相对底栏定位：与 tab-bar 增高量保持一致，避免底栏遮挡 */
    .fab {
        bottom: calc(var(--tab-bar-height) + 16px + 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);
    }

    .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(--notice-h) + 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 内容面
       注意：此处不能加 backdrop-filter —— 它会让 .container 成为
       position:fixed 子元素（标题栏/侧栏/FAB）的包含块，导致它们
       不再相对视口固定，而是随页面滚动、按页面底部定位 */
    .container {
        background: var(--material-acrylic);
        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(--notice-h) + 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));
        grid-auto-rows: 4px;
        grid-auto-flow: row dense;
        column-gap: 16px;
        row-gap: 0;
        align-items: start;
    }

    /* 纵向间距以单列卡片为参考（.card 12px），行跨度由 JS 按卡片实际高度换算 */
    .post-list .card {
        margin-bottom: 12px;
    }

    .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;
    }
}

/* ==========================================================================
   编辑资料表单 / 用户管理（个人中心 + 管理后台）
   ========================================================================== */
.profile-edit-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.profile-edit-card .btn {
    width: 100%;
    margin-top: 4px;
}

.form-hint {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-warning);
    margin-top: 6px;
}

.form-input:disabled {
    opacity: 0.55;
    background: var(--color-fill);
}

.profile-badge.banned {
    background: var(--error-tint);
    color: var(--color-error);
}

.user-ban-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: var(--radius-pill);
    background: var(--error-tint);
    color: var(--color-error);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: 500;
    vertical-align: middle;
}

.user-action-btn.neutral {
    background: var(--color-fill);
    color: var(--color-label);
}

/* 编辑用户弹窗：字段较多时内部滚动 */
.modal-body-scroll {
    max-height: min(60vh, 440px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ---------- 登录/注册页返回按钮（点击回首页） ---------- */
.login-back {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 10;
    background: var(--color-fill);
}

/* ---------- 下拉刷新指示器（移动端/平板端，电脑端不启用） ---------- */
.pull-refresh-indicator {
    position: fixed;
    top: calc(var(--notice-h) + var(--header-height) + 8px);
    left: 50%;
    transform: translate(-50%, -80px);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 16px;
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    opacity: 0;
    pointer-events: none;
    z-index: 300;
    transition: opacity var(--duration-fast) var(--ease);
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.pull-refresh-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-separator);
    border-top-color: var(--color-primary);
    border-radius: 50%;
}

.pull-refresh-indicator.loading .pull-refresh-spinner {
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   评论子楼 / 点赞 / 置顶 / 引导气泡（新需求）
   ========================================================================== */
.comment-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: 2px;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.comment-action {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--duration-fast) var(--ease);
}

.comment-action:hover {
    background: var(--color-fill);
}

.comment-action:active {
    opacity: 0.6;
}

.comment-action.danger {
    color: var(--color-error);
}

/* 点赞按钮 */
.comment-like {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-label-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: transform var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.comment-like:active {
    transform: scale(1.15);
}

.comment-like.liked {
    color: var(--color-error);
}

.comment-like-count {
    font-weight: 600;
}

/* 评论置顶徽章 */
.comment-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: 600;
    background: var(--warning-tint);
    color: var(--color-warning);
    vertical-align: middle;
}

/* 子楼（回复）层级 */
.comment-children {
    margin-left: 0;
    padding-left: 0;
}

.comment-item.comment-sub {
    margin-top: var(--space-sm);
    padding-left: 12px;
    border-left: 2px solid var(--color-separator);
}

/* 点赞引导气泡 */
.like-guide-bubble {
    position: fixed;
    z-index: 400;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 14px;
    background: var(--color-label);
    color: var(--color-background);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    animation: anim-scale-in var(--duration-normal) var(--ease) both;
}

:root[data-theme="dark"] .like-guide-bubble {
    background: var(--color-card);
    color: var(--color-label);
    border: 1px solid var(--color-separator);
}

.like-guide-arrow {
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    background: inherit;
    transform: translateX(-50%) rotate(45deg);
}

.like-guide-close {
    background: none;
    border: none;
    color: inherit;
    font-size: var(--fs-subhead);
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.7;
}

.like-guide-close:hover {
    opacity: 1;
}

/* 帖子：置顶 / 可见性 标识 */
.post-tag.pinned-tag {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.post-tag.visibility-tag {
    background: var(--primary-tint);
    color: var(--color-primary);
}

/* 个人中心：档案标签 */
.profile-badge.tag {
    background: var(--warning-tint);
    color: var(--color-warning);
}

/* ==========================================================================
   管理后台：级部/班级树、学生批量调整、浏览统计
   ========================================================================== */
.org-grade {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.org-grade-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.org-grade-name {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
}

.org-count {
    font-size: var(--fs-caption);
    color: var(--color-label-secondary);
    font-weight: 400;
    margin-left: 4px;
}

.org-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.org-classes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

.org-class-chip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    background: var(--color-fill);
    border-radius: var(--radius-md);
    padding: 6px 10px;
}

.org-class-name {
    font-size: var(--fs-footnote);
    font-weight: 600;
}

/* 学生选择行 */
.student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 10px 0;
    border-bottom: 1px solid var(--color-separator);
    font-size: var(--fs-subhead);
}

.student-row:last-child {
    border-bottom: none;
}

.student-check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

/* 批量调整工具条 */
.org-batch {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-separator);
}

.org-batch .search-input {
    flex: 0 1 160px;
    min-height: 36px;
    padding: 6px 12px;
    width: auto;
}

/* 帖子可见性下拉 */
.vis-select {
    width: auto;
    min-height: 36px;
    padding: 4px 10px;
    font-size: var(--fs-caption);
}

/* 后台徽章变体 */
.user-ban-badge.fake {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.user-ban-badge.top {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.user-ban-badge.ad {
    background: var(--warning-tint);
    color: var(--color-warning);
}

.user-ban-badge.vis {
    background: var(--primary-tint);
    color: var(--color-primary);
}

.user-ban-badge.terms-ok {
    background: var(--success-tint);
    color: var(--color-success);
}

.user-ban-badge.terms-no {
    background: var(--warning-tint);
    color: var(--color-warning);
}

/* 浏览统计 */
.views-summary {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.views-summary-item {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    padding: 6px 12px;
    background: var(--color-fill);
    border-radius: var(--radius-md);
}

.views-summary-item b {
    color: var(--color-label);
}

.view-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-separator);
    font-size: var(--fs-footnote);
}

.view-row:last-child {
    border-bottom: none;
}

.view-row .ua {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 宽模态框（后台） */
.modal-content-wide {
    width: min(720px, calc(100vw - 40px));
}

@media (min-width: 1024px) {
    .modal-content-wide {
        width: min(860px, 90vw);
    }
}

/* ==========================================================================
   消息中心 / 通知（新需求）
   ========================================================================== */
.messages-tabs {
    margin-bottom: 12px;
}

.notify-badge {
    display: none;
    width: 7px;
    height: 7px;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--color-error);
    vertical-align: middle;
    flex: none;
}
.notify-badge.on {
    display: inline-block;
}

.msg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}

.msg-item.unread {
    border-color: var(--color-primary);
    background: var(--primary-tint);
}

.msg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-fill);
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.msg-type {
    font-size: var(--fs-subhead);
    line-height: var(--lh-subhead);
    font-weight: 600;
}

.msg-time {
    font-size: var(--fs-caption);
    color: var(--color-label-secondary);
}

.msg-by {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    margin-top: 2px;
}

.msg-content {
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label);
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-reason {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--error-tint);
    color: var(--color-error);
    font-size: var(--fs-footnote);
}

.msg-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.msg-link {
    font-size: var(--fs-footnote);
    color: var(--color-primary);
    text-decoration: none;
}

.msg-link:hover {
    text-decoration: underline;
}

.msg-reply {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-top: 6px;
}

.msg-reply .comment-input {
    flex: 1;
}

/* ==========================================================================
   评论：折叠主楼 / 个人隐藏 / 回复给谁 / 投票 vs 比例（新需求）
   ========================================================================== */
.comment-folded {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--color-fill);
    border: 1px dashed var(--color-separator);
    margin-bottom: var(--space-sm);
}

.comment-folded-label {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    flex: 1;
}

.comment-hidden {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.comment-hidden-text {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
}

.reply-to {
    display: inline-block;
    font-size: var(--fs-footnote);
    line-height: var(--lh-footnote);
    color: var(--color-label-secondary);
    margin: 2px 0;
    cursor: pointer;
}

.reply-to-name {
    color: var(--color-primary);
}

/* 社区投票提示 */
.flag-prompt {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--color-fill);
    border: 1px solid var(--color-separator);
}

.flag-prompt-text {
    display: block;
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    margin-bottom: 6px;
}

.flag-prompt-btns {
    display: flex;
    gap: 8px;
}

.flag-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-separator);
    background: var(--color-card);
    font-size: var(--fs-footnote);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.flag-btn.unsuitable:hover {
    background: var(--error-tint);
    color: var(--color-error);
}

.flag-btn.suitable:hover {
    background: var(--success-tint);
    color: var(--color-success);
}

/* vs 比例条 */
.flag-vs {
    margin-top: 8px;
}

.vs-bar {
    display: flex;
    height: 8px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--color-separator);
}

.vs-unsuitable {
    background: var(--color-error);
}

.vs-suitable {
    background: var(--color-success);
}

.vs-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-caption);
    color: var(--color-label-secondary);
    margin-top: 4px;
}

.vs-l-unsuitable {
    color: var(--color-error);
}

.vs-l-suitable {
    color: var(--color-success);
}

.comment-action.flagged {
    color: var(--color-error);
}

/* 底部导航未读角标 */
.tab-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.tab-icon {
    position: relative;
}

/* ==========================================================================
   消息中心：分区改为分段控制（明确可见的两栏），页面与底部导航对齐
   ========================================================================== */
.messages-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: var(--color-fill);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.messages-tabs .admin-tab {
    flex: 1;
    justify-content: center;
    min-height: 40px;
    padding: 0;
    background: transparent;
    color: var(--color-label-secondary);
    border-radius: var(--radius-md);
}

.messages-tabs .admin-tab:hover {
    background: var(--color-fill-strong);
}

.messages-tabs .admin-tab.active {
    background: var(--color-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* 空态/加载态占位，避免列表为空时显得过空 */
#msgList {
    min-height: 200px;
}

/* 消息中心：顶部让出固定 header 高度，避免 header 遮挡分区 tab */
.messages-page {
    padding: calc(var(--notice-h) + var(--header-height) + var(--space-md)) var(--space-md) var(--space-md);
}

/* 表单只读字段：置灰、不可编辑 */
.form-input[readonly] {
    color: var(--color-label-tertiary);
    background: var(--color-fill);
    cursor: not-allowed;
}

/* ---------- 顶部公告条幅（固定全宽 100vw，单份文本，不滚动） ---------- */
.notice-ticker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--notice-h);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: #FFF6D6;
    border-bottom: 1px solid #E7D27E;
    color: #5A4500;
    font-size: var(--fs-footnote);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notice-ticker a {
    color: #0A56C2;
    font-weight: 600;
    text-decoration: underline;
    margin-left: 4px;
}

/* ---------- Markdown 富文本渲染 ---------- */
.md-img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 6px 0;
    display: block;
}
.post-content pre,
.detail-text pre {
    background: var(--color-fill);
    border: 1px solid var(--color-separator);
    border-radius: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    font-size: 12px;
}
.post-content code,
.detail-text code {
    background: var(--color-fill);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
}
.post-content pre code,
.detail-text pre code {
    background: transparent;
    padding: 0;
}
.post-content blockquote,
.detail-text blockquote {
    border-left: 3px solid var(--color-separator);
    margin: 6px 0;
    padding: 2px 12px;
    color: var(--color-label-secondary);
}
.post-content h1, .post-content h2, .post-content h3,
.detail-text h1, .detail-text h2, .detail-text h3 {
    margin: 10px 0 4px;
    line-height: 1.3;
}
.post-content h1, .detail-text h1 { font-size: 20px; }
.post-content h2, .detail-text h2 { font-size: 18px; }
.post-content h3, .detail-text h3 { font-size: 16px; }

/* 后台列表总数提示 */
.list-meta{font-size:13px;color:var(--color-text-secondary,#86868b);margin:4px 0 10px;min-height:18px;}


/* 深色主题：主按钮/FAB hover 增强反馈（primary-strong 与 primary 同色时无明暗变化） */
[data-theme="dark"] .btn-primary:hover:not(:disabled),
[data-theme="dark"] .fab:hover { filter: brightness(1.12); }

/* 触控设备触摸目标 >= 44px 扩充（评论操作/点赞/投票/话题/标签/搜索等） */
@media (pointer: coarse) {
    .comment-action, .comment-like, .flag-btn, .user-action-btn,
    .topic-chip, .detail-action-btn, .search-btn, .notice-close,
    .vis-select, .image-remove { min-height: 44px; }
}

/* 子楼缩进上限：第 3 层及更深与第 2 层平齐，避免无限缩进 */
.comment-item[data-depth="3"],
.comment-item[data-depth="3"] .comment-sub { padding-left: 0; border-left: none; }

/* 评论"更多"菜单（收拢置顶/折叠/隐藏/删除） */
.comment-actions { position: relative; }
.comment-more { position: relative; display: inline-block; }
.comment-more-menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
    display: none; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--color-card); border: 1px solid var(--color-separator);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    min-width: 132px;
}
.comment-more-menu.open { display: flex; }
.comment-more-menu .comment-action { justify-content: flex-start; width: 100%; white-space: nowrap; }

/* 公告条幅：可关闭按钮 + 深色适配 */
.notice-ticker { position: relative; padding-right: 40px; }
.notice-text { overflow: hidden; text-overflow: ellipsis; }
.notice-close {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; line-height: 1; font-size: 18px;
    border: none; background: transparent; color: inherit; opacity: .7;
    cursor: pointer; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.notice-close:hover { opacity: 1; }
[data-theme="dark"] .notice-ticker {
    background: #3A2F05; border-bottom-color: #57430A; color: #FFE9A8;
}
[data-theme="dark"] .notice-ticker a { color: #7DB7FF; }


/* 表单内联错误提示（P1-7） */
.field-error {
    margin: 6px 0 0;
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--color-error);
}
.form-input[aria-invalid="true"] { border-color: var(--color-error); }
.form-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--error-tint); }


/* 后台宽屏：≥1280 加宽容器、统计卡满 5 列（P2-9） */
@media (min-width: 1280px) {
    .admin-page { max-width: 1120px; }
    .stats-grid { grid-template-columns: repeat(5, 1fr); }
}


/* 注册页级部/班级联级检索下拉 */
.combo-wrap { position: relative; }
.combo-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
    margin: 0; padding: 6px; list-style: none;
    background: var(--color-card); border: 1px solid var(--color-separator);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    max-height: 240px; overflow-y: auto;
}
.combo-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-body); }
.combo-item:hover { background: var(--color-fill); }
.combo-create { color: var(--color-primary); font-weight: 600; }
.combo-empty { padding: 10px 12px; color: var(--color-label-tertiary); font-size: var(--fs-footnote); }
.combo-input[disabled] { opacity: .5; }

/* 公告条幅已下线：占位高度归零，页面顶部 padding 不残留留白 */
:root { --notice-h: 0px; }


/* ================= 广告子系统 ================= */
.ad-badge {
    display: inline-block;
    padding: 2px 9px;
    margin: 0 6px 4px 0;
    background: #FFE9A8;
    color: #5B4A00;
    font-size: var(--fs-footnote);
    font-weight: 700;
    border-radius: 6px;
    vertical-align: middle;
    letter-spacing: .5px;
}
[data-theme="dark"] .ad-badge {
    background: #57430A;
    color: #FFE9A8;
}
.ad-meta {
    display: inline-block;
    margin: 0 6px 4px 0;
    vertical-align: middle;
}
.ad-contact {
    margin: 12px 0;
    padding: 10px 14px;
    border: 1px dashed var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-fill);
    display: flex;
    gap: 10px;
    align-items: baseline;
}
.ad-contact-label {
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    font-weight: 600;
    flex-shrink: 0;
}
.ad-contact-value {
    font-weight: 600;
    color: var(--color-primary);
    word-break: break-all;
}
.ad-nointeract {
    margin: 12px 0 0;
    padding: 12px;
    text-align: center;
    color: var(--color-label-secondary);
    font-size: var(--fs-footnote);
    border: 1px dashed var(--color-separator);
    border-radius: var(--radius-md);
}
.ad-status {
    display: inline-block;
    margin: 8px 4px 0 0;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--fs-footnote);
    font-weight: 600;
}
.ad-status-pending, .ad-status-badge.ad-status-pending { background: var(--primary-tint); color: var(--color-primary); }
.ad-status-approved, .ad-status-badge.ad-status-approved { background: var(--success-tint); color: var(--color-success); }
.ad-status-rejected, .ad-status-badge.ad-status-rejected { background: var(--danger-tint, #FDEBEA); color: var(--color-danger, #C0392B); }
.ad-status-expired, .ad-status-badge.ad-status-expired { background: var(--color-fill); color: var(--color-label-secondary); }
.ad-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: var(--fs-footnote);
    font-weight: 600;
    vertical-align: middle;
}
.ad-relaunch {
    margin: 14px 0 0;
    padding: 14px;
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-fill);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ad-relaunch-hint {
    margin: 0;
    font-size: var(--fs-footnote);
    color: var(--color-label-secondary);
    line-height: 1.6;
}
.ad-relaunch .btn-primary { align-self: flex-start; }
.gen-code {
    display: inline-block;
    margin: 2px;
    padding: 4px 8px;
    background: var(--color-fill);
    border: 1px solid var(--color-separator);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: .5px;
}

/* ---------- 广告主中心 ---------- */
.empty-sub {
    margin-top: 8px;
    color: var(--color-label-secondary);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    text-align: center;
}
.ad-gate-note {
    margin: 10px 0 18px;
    color: var(--color-warning);
    font-size: var(--fs-caption);
    text-align: center;
}
.ad-toolbar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    padding: 12px 0;
}

/* ========== 标准后台侧边栏 Layout ========== */
.admin-page {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}
.admin-sidebar {
    flex: 0 0 196px;
    position: sticky;
    top: calc(var(--header-height) + var(--space-md));
    max-height: calc(100vh - var(--header-height) - var(--space-lg));
    overflow-y: auto;
    padding: var(--space-sm) 0;
}
.sidebar-group-title {
    font-size: var(--fs-caption);
    color: var(--color-label-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--space-md) var(--space-sm) var(--space-xs);
}
.admin-sidebar-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    margin: 2px 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-label);
    border-radius: var(--radius-sm);
    font-size: var(--fs-body);
    cursor: pointer;
    text-align: left;
}
.admin-sidebar-item:hover { background: var(--color-fill); }
.admin-sidebar-item.active {
    background: var(--primary-tint);
    color: var(--color-primary-strong);
    font-weight: 600;
}
.admin-content { flex: 1; min-width: 0; }
.admin-panel {
    background: var(--color-card);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}
.admin-panel-title {
    font-size: var(--fs-subhead);
    font-weight: 600;
    margin-bottom: var(--space-md);
}
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.perm-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-caption);
    color: var(--color-label);
}
.form-select { background-color: var(--color-card); color: var(--color-label); }

@media (min-width: 1024px) {
    .admin-page { max-width: 1000px; }
}

@media (max-width: 767px) {
    .admin-page { display: block; }
    .admin-sidebar {
        display: flex;
        position: sticky;
        top: var(--header-height);
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
        scrollbar-width: none;
    }
    .admin-sidebar::-webkit-scrollbar { display: none; }
    .sidebar-group-title { display: none; }
    .admin-sidebar-item { flex: 0 0 auto; width: auto; white-space: nowrap; }
}

/* ---------- 首页话题下拉面板（工具条"话题"按钮展开） ---------- */
.topic-panel {
    position: fixed;
    z-index: 90;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: 12px var(--space-md);
    max-height: 46vh;
    overflow-y: auto;
    background: var(--material-bar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-separator);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
.topic-panel[hidden] { display: none; }
.topic-caret {
    display: inline-block;
    margin-left: 3px;
    font-size: 10px;
    transition: transform var(--duration-fast) var(--ease);
}
.filter-chip[aria-expanded="true"] .topic-caret { transform: rotate(180deg); }

/* ================= 闲置市集 ================= */
.market-banner {
    margin: 12px 16px;
    padding: 10px 12px;
    background: var(--warning-tint);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    font-size: var(--fs-caption);
    line-height: 1.7;
    color: var(--color-label);
}
.market-banner strong { display: block; margin-bottom: 2px; }
.market-banner.warn { margin: 0 16px 12px; }

.market-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 16px 16px;
}
@media (min-width: 768px) {
    .market-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.market-card {
    display: flex;
    flex-direction: column;
    background: var(--color-card);
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: var(--color-label);
    text-decoration: none;
    transition: opacity var(--duration-fast) var(--ease);
}
.market-card:active { opacity: 0.85; }
.market-card-img { position: relative; aspect-ratio: 1 / 1; background: var(--color-fill); }
.market-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.market-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.72);
    color: #FFFFFF;
    font-size: var(--fs-caption);
    font-weight: 600;
}
.market-status-badge.flagged { background: var(--color-warning); }
.market-status-badge.removed { background: rgba(60, 60, 67, 0.85); }
.market-status-badge.ok { background: var(--color-success); }
.market-status-badge.lg {
    top: 12px;
    left: 12px;
    right: auto;
    padding: 4px 12px;
    font-size: var(--fs-subhead);
}
.market-card-body { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; }
.market-card-title {
    font-size: var(--fs-subhead);
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.market-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.market-card-time, .market-card-owner { font-size: var(--fs-caption); color: var(--color-label-secondary); }
.post-tag.market-mode-private { background: var(--primary-tint); color: var(--color-primary); }
.post-tag.market-mode-barter { background: var(--success-tint); color: var(--color-success); }

/* 发布页 */
.market-gate { margin: 12px 16px; }
.market-gate-title { font-weight: 600; font-size: var(--fs-subhead); margin-bottom: 6px; }
.market-gate-text { font-size: var(--fs-subhead); line-height: 1.7; color: var(--color-label-secondary); margin-bottom: 10px; }
.market-gate-btns { display: flex; gap: 8px; }
.field-hint { margin-top: 6px; font-size: var(--fs-caption); line-height: 1.6; color: var(--color-label-secondary); }
.img-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.img-slot {
    position: relative;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--color-separator);
    border-radius: 12px;
    background: var(--color-fill);
    cursor: pointer;
    overflow: hidden;
}
.img-slot.main { width: 144px; height: 144px; }
.img-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-slot-add { font-size: var(--fs-caption); color: var(--color-label-secondary); }
.img-slot-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    font-size: 12px;
}
.img-slot-del {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #FFFFFF;
    font-size: 14px;
    line-height: 22px;
    cursor: pointer;
}
.market-form-note { margin: 8px 0 4px; font-size: var(--fs-caption); line-height: 1.7; color: var(--color-label-secondary); }

/* 详情页 */
.market-detail-page { padding-bottom: 92px; }
.market-gallery { position: relative; background: var(--color-fill); }
.market-main-img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; cursor: zoom-in; }
.market-thumbs { display: flex; gap: 8px; padding: 10px 16px; }
.market-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--color-separator);
    object-fit: cover;
    cursor: pointer;
}
.market-info { margin: 12px 16px 16px; }
.market-info-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.market-info-time { font-size: var(--fs-caption); color: var(--color-label-secondary); }
.market-info-title { font-size: var(--fs-headline); font-weight: 700; line-height: 1.4; margin-bottom: 10px; word-break: break-word; }
.market-seller { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.market-seller-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.market-seller-name { font-size: var(--fs-subhead); font-weight: 600; }
.market-seller-me { font-size: var(--fs-caption); color: var(--color-label-secondary); }
.market-desc { font-size: var(--fs-subhead); line-height: 1.8; white-space: pre-wrap; word-break: break-word; margin-bottom: 12px; }
.market-disclaimer {
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--color-fill);
    font-size: var(--fs-caption);
    line-height: 1.7;
    color: var(--color-label-secondary);
}
.market-owner-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

/* 底部操作栏 */
.market-action-bar {
    position: fixed;
    left: var(--nav-width);
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--color-card);
    border-top: 1px solid var(--color-separator);
}
.market-action-dead { padding: 6px 0; text-align: center; font-size: var(--fs-subhead); color: var(--color-label-secondary); }
.fab.fab-drill { bottom: calc(env(safe-area-inset-bottom) + 20px); }

/* 交换申请 */
.market-ex-title { font-size: var(--fs-subhead); font-weight: 600; margin-bottom: 10px; }
.market-ex-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-fill);
}
.market-ex-img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; cursor: pointer; flex-shrink: 0; }
.market-ex-body { flex: 1; min-width: 140px; }
.market-ex-name { font-size: var(--fs-subhead); font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.market-ex-user { font-size: var(--fs-caption); color: var(--color-label-secondary); margin-bottom: 4px; }
.market-ex-status { font-size: var(--fs-caption); color: var(--color-label-secondary); }
.market-ex-status.pending { color: var(--color-warning); }
.market-ex-status.accepted { color: var(--color-success); font-weight: 600; }
.market-ex-status.rejected { color: var(--color-red, #FF3B30); }
.market-ex-btns { display: flex; gap: 8px; flex-shrink: 0; }
.market-ex-tip { margin-top: 6px; font-size: var(--fs-caption); color: var(--color-label-secondary); line-height: 1.6; }

/* 合规弹窗与联系方式 */
.market-modal-p { margin-bottom: 8px; font-size: var(--fs-subhead); line-height: 1.7; }
.market-contact-value {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: var(--color-fill);
    font-size: var(--fs-title3);
    font-weight: 700;
    text-align: center;
    word-break: break-all;
}
.market-warn-text { color: var(--color-warning); font-size: var(--fs-caption); }

/* ================= 手机号短信验证 / 账号注销 ================= */
.sms-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.sms-row .form-input {
    flex: 1;
    min-width: 0;
}
.sms-send-btn {
    flex: 0 0 auto;
    min-width: 108px;
    text-align: center;
}
.agree-sms {
    margin-top: var(--space-sm);
    padding: 12px;
    border: 1px solid var(--color-separator);
    border-radius: var(--radius-md);
    background: var(--color-background);
}
.agree-sms-note { margin-bottom: 8px; }
.agree-sms-phone {
    flex: 0 0 auto;
    align-self: center;
    font-size: var(--fs-subhead);
    font-weight: 600;
    color: var(--color-label-secondary);
}
.deleted-name { color: var(--color-label-secondary); }
.section-divider {
    border: none;
    border-top: 1px solid var(--color-separator);
    margin: 20px 0;
}
.danger-text { color: var(--color-error); }
.user-ban-badge.deleted {
    background: var(--color-fill);
    color: var(--color-label-secondary);
}

/* ================= 闲置市集 · 桌面端适配 ================= */
.page-content > .market-banner,
.create-page > .market-banner { margin: 0 0 12px; }
.market-detail-page .market-banner.warn { margin: 0 0 12px; }

.market-card {
    transition: transform var(--duration-fast) var(--ease),
        box-shadow var(--duration-fast) var(--ease);
}
@media (hover: hover) {
    .market-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
}

@media (min-width: 1024px) {
    .market-list-page { max-width: 1100px; }
    .market-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .market-detail-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
        gap: 16px;
        align-items: start;
    }
    .market-detail-grid .market-info { margin: 0; }
    .market-detail-grid .market-thumbs { padding: 10px 0 0; }

    .market-action-bar {
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    .market-action-bar .btn-block { max-width: 420px; }
    .market-action-dead { flex: 1; }
}

/* ---------- 王者荣耀战绩卡片（[kog:...] 快照渲染） ---------- */
.kog-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-separator);
    border-left-width: 4px;
    border-radius: 12px;
    background: var(--color-fill);
}
.kog-card.kog-win { border-left-color: var(--color-success); }
.kog-card.kog-lose { border-left-color: var(--color-error); }
.kog-hero {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--color-fill-strong);
    flex: none;
}
.kog-hero-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--color-label);
}
.kog-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.kog-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}
.kog-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-label);
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kog-rank {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--color-fill-strong);
    color: var(--color-label-secondary);
    white-space: nowrap;
}
.kog-result {
    font-size: 12px;
    font-weight: 800;
    margin-left: auto;
}
.kog-win .kog-result { color: var(--color-success); }
.kog-lose .kog-result { color: var(--color-error); }
.kog-kda {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-label);
}
.kog-score {
    font-size: 12px;
    color: var(--color-label-secondary);
}
.kog-mvp {
    font-size: 11px;
    font-weight: 800;
    color: var(--color-warning);
    padding: 1px 6px;
    border: 1px solid var(--color-warning);
    border-radius: 6px;
}
.kog-sub {
    font-size: 11px;
    color: var(--color-label-secondary);
    gap: 6px;
}
.kog-sub span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


