/**
 * style.css — 杯友社设计系统（Design System）
 * ----------------------------------------------------------------------------
 * 级联层顺序（优先级 低 → 高）：reset < tokens < themes < base < components < utilities
 *   - tokens 定义设计变量；themes 在不同时机覆写变量（明暗主题），二者都在组件之前，
 *     组件只消费 var()，从而做到"换主题=换变量，不改任何选择器"。
 *   - 自定义属性的胜负由层优先级决定：themes 层高于 tokens 层，所以深色变量稳定生效。
 *
 * 设计约束：
 *  - 移动优先（参考原型 390×844），同时适配桌面端（max-width 容器 + 双栏 sidebar）。
 *  - 主色明亮玫红 --c-primary，中性灰背景，文本对比度 ≥ 4.5:1（无障碍）。
 *  - 所有尺寸基于 8px 基线网格（--sp-*）。
 *  - 保留 :focus-visible 焦点样式（键盘导航可见）。
 * ----------------------------------------------------------------------------
 */

@layer reset, tokens, themes, base, components, utilities;

/* ============================ TOKENS ============================ */
@layer tokens {
  :root {
    /* —— 品牌色 —— */
    --c-primary: #ff4d6d;          /* 主行动色（明亮玫红，去橘调） */
    --c-primary-dark: #e63a59;     /* 主色按下/悬停 */
    --c-primary-soft: #ffe9ee;     /* 主色淡底（标签/引用/代码底） */
    --c-on-primary: #ffffff;       /* 主色/彩色面上的文字与图标色 */
    --c-on-overlay: #ffffff;       /* 深色遮罩上的文字色 */
    --c-star: #ffc62e;             /* 评分星金（提亮、更明确的亮黄） */

    /* —— 中性色（浅色默认，整体提亮） —— */
    --c-bg: #f7f9fc;
    --c-surface: #ffffff;
    --c-surface-2: #f1f4f9;
    --c-text: #20242e;
    --c-text-soft: #5b6472;
    --c-border: #e8ebf0;
    --c-tag: #ffe9ee;

    /* —— 语义色（提亮） —— */
    --c-success: #16a34a;
    --c-warning: #b26a00;
    --c-warning-bg: #fff7e6;
    --c-danger: #e5484d;

    /* —— 遮罩（图片删除按钮等） —— */
    --c-overlay: rgba(20, 24, 40, 0.55);
    --c-overlay-strong: rgba(20, 24, 40, 0.8);

    /* —— 间距（8px 基线网格）—— */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

    /* —— 圆角（半径刻度）—— */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* —— 字号阶梯 —— */
    --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px;
    --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 20px; --fs-3xl: 24px;

    /* —— 阴影层级（elevation）—— */
    --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.06);
    --shadow-card: 0 1px 3px rgba(20, 24, 40, 0.06), 0 4px 16px rgba(20, 24, 40, 0.04); /* 卡片静止态 */
    --shadow-md: 0 6px 20px rgba(20, 24, 40, 0.10);
    --shadow-lg: 0 12px 32px rgba(20, 24, 40, 0.14);

    /* —— 动效 —— */
    --motion-fast: 120ms;
    --motion: 200ms;
    --motion-slow: 320ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* —— 布局 —— */
    --header-h: 56px;
    --maxw: 1080px;
  }
}

/* ============================ THEMES ============================ */
/* 深色主题：覆写 tokens 中的颜色与阴影，组件无需任何改动即可换肤。 */
@layer themes {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --c-primary: #ff5d7c;
    --c-primary-dark: #ff476b;
    --c-primary-soft: #311c24;
    --c-bg: #1a1e27;
    --c-surface: #232834;
    --c-surface-2: #2b313d;
    --c-text: #eef0f3;
    --c-text-soft: #a7afbb;
    --c-border: #343b48;
    --c-tag: #311c24;
    --c-warning: #e0a23c;
    --c-warning-bg: #2e2410;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }

  /* 系统偏好跟随：用户未手动选择主题时，跟随操作系统 */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
      color-scheme: dark;
      --c-primary: #ff5d7c;
      --c-primary-dark: #ff476b;
      --c-primary-soft: #311c24;
      --c-bg: #1a1e27;
      --c-surface: #232834;
      --c-surface-2: #2b313d;
      --c-text: #eef0f3;
      --c-text-soft: #a7afbb;
      --c-border: #343b48;
      --c-tag: #311c24;
      --c-warning: #e0a23c;
      --c-warning-bg: #2e2410;
      --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
      --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
      --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
      --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    }
  }
}

/* ============================ RESET ============================ */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
}

/* ============================ BASE ============================ */
@layer base {
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease);
  }

  a { color: inherit; text-decoration: none; }
  a:hover { color: var(--c-primary); }

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

  /* 焦点可见（无障碍） */
  :focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* 视觉隐藏但屏幕阅读器可读（补充语义化标题/说明，不破坏观感） */
  .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* ============================ COMPONENTS ============================ */
@layer components {

  /* ---------- 顶部导航 ---------- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
  }
  .site-header .brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--c-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }
  /* 品牌字标（透明 PNG，亮/暗主题通用）：以高度控制尺寸，宽度自适应 */
  .site-header .brand .brand-logo {
    display: block;
    height: 34px;
    width: auto;
  }
  @media (max-width: 400px) {
    .site-header .brand .brand-logo { height: 30px; }
  }
  .site-header nav {
    display: none;
    gap: 18px;
    margin-left: 8px;
  }
  .site-header nav a {
    color: var(--c-text-soft);
    font-size: 14px;
    font-weight: 600;
  }
  .site-header nav a.active { color: var(--c-primary); }
  .site-header .spacer { flex: 1; }
  .site-header .btn-publish {
    background: var(--c-primary);
    color: var(--c-on-primary);
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
  }
  .site-header .btn-publish:hover { background: var(--c-primary-dark); color: var(--c-on-primary); }

  /* 顶部真实搜索框（替代 emoji 图标） */
  .site-header .header-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    padding: 7px 14px;
    transition: border-color .18s ease, box-shadow .18s ease;
  }
  .site-header .header-search:focus-within {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 18%, transparent);
  }
  .site-header .header-search .hs-icon {
    width: 17px; height: 17px;
    flex: 0 0 auto;
    stroke: var(--c-text-soft);
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
  }
  .site-header .header-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.4;
  }
  .site-header .header-search input::placeholder { color: var(--c-text-soft); }

  /* 右侧发帖浮标（FAB）：避开底部 Tab 栏 */
  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(70px + env(safe-area-inset-bottom) + 16px);
    z-index: 60;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--c-primary);
    color: var(--c-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--c-primary) 40%, transparent);
    text-decoration: none;
    transition: transform .12s ease, box-shadow .18s ease;
  }
  .fab svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; fill: none; }
  .fab:active { transform: scale(.92); }
  .fab:focus-visible { outline: 3px solid var(--c-primary-dark); outline-offset: 3px; }

  /* ---------- 布局容器 ---------- */
  .container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* 关键：网格子项默认 min-width:auto 会被内容（如可横向滚动的板块标签条）顶宽，
     导致整页横向溢出、右侧内容被裁。这里统一压成可收缩，滚动留在标签条内部。 */
  .container > * { min-width: 0; }
  @media (min-width: 860px) {
    .site-header nav { display: flex; }
    /* 仅带侧栏的页面（首页/排行榜）走双栏；其余页保持单栏，避免右侧空出 300px */
    .container.has-sidebar { grid-template-columns: 1fr 300px; align-items: start; }
    /* 首页：DOM 中榜单块前置（移动端置顶），桌面端用 grid-area 放回右栏顶部 */
    .container.has-sidebar.home-layout {
      grid-template-areas:
        "main rank"
        "main more";
      grid-template-rows: auto 1fr;
    }
    .container.has-sidebar.home-layout > section { grid-area: main; }
    .container.has-sidebar.home-layout > .sidebar-rank { grid-area: rank; }
    .container.has-sidebar.home-layout > .sidebar-more { grid-area: more; }
  }

  /* ---------- 板块标签（activePlate） ---------- */
  .plate-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scrollbar-width: thin;
  }
  .plate-tabs a {
    flex: 0 0 auto;
    padding: 8px 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-soft);
    white-space: nowrap;
  }
  .plate-tabs a.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: var(--c-on-primary);
  }
  .plate-tabs a:hover { color: var(--c-primary); }
  .plate-tabs a.active:hover { color: var(--c-on-primary); }

  /* ---------- 排序标签（sort） ---------- */
  .sort-tabs {
    display: flex;
    gap: 4px;
    margin: 8px 0 12px;
    border-bottom: 1px solid var(--c-border);
  }
  .sort-tabs a {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-soft);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
  }
  .sort-tabs a.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
  }

  /* ---------- 卡片 ---------- */
  .card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform var(--motion) var(--ease), box-shadow var(--motion) var(--ease), border-color var(--motion) var(--ease);
  }
  .post-list { display: flex; flex-direction: column; gap: 12px; }

  .post-item {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .post-item .title {
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    margin: 0;
  }
  .post-item .title:hover { color: var(--c-primary); }
  .post-item .excerpt {
    color: var(--c-text-soft);
    font-size: 14px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* 带图帖：配图网格 */
  .post-item .post-thumbs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .post-item .pt {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--c-surface-2);
    flex: 0 0 auto;
  }
  .post-item .pt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .post-item .pt-more {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-surface-2);
    color: var(--c-text-soft);
    font-weight: 700;
    font-size: 14px;
    border: 1px dashed var(--c-border);
  }
  /* 列表卡片封面：生成式渐变（含真实图回退），全出血到卡片左右内边距、顶边贴齐 */
  .post-item.has-cover { padding-top: 0; overflow: hidden; }
  .pi-cover {
    display: block;
    position: relative;
    margin: 0 -16px 6px;
    aspect-ratio: 16 / 7;
    background: var(--c-surface-2);
    overflow: hidden;
  }
  .pi-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pi-cover-gen {
    background:
      radial-gradient(130% 130% at 16% 10%, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 52%),
      linear-gradient(135deg, var(--cv1, #d36bb4), var(--cv2, #7c4dff));
  }
  .pi-cover .cv-motif {
    position: absolute;
    right: 10px;
    bottom: 6px;
    width: 54px;
    height: 54px;
    color: rgba(255, 255, 255, .9);
  }
  .pi-cover .cv-motif .icon { width: 100%; height: 100%; }
  .pi-cover .cv-tag {
    position: absolute;
    left: 12px;
    top: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .22);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  }
  /* 帖子单图：社媒式单图铺满（不经封面横幅） */
  .post-media-single {
    display: block;
    margin: 2px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--c-surface-2);
  }
  .post-media-single img { width: 100%; height: 100%; object-fit: cover; display: block; }
  /* 板块页「全部 / 精华」筛选 chips */
  .forum-filters { display: flex; gap: 8px; margin: 10px 0 2px; flex-wrap: wrap; }
  .ff-chip {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text-soft);
    cursor: pointer;
    transition: background var(--motion) var(--ease), color var(--motion) var(--ease), border-color var(--motion) var(--ease);
  }
  .ff-chip:hover { border-color: var(--c-primary); color: var(--c-text); }
  .ff-chip.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
  .ff-chip.active:hover { color: #fff; }
  .post-meta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    font-size: 13px;
    color: var(--c-text-soft);
  }
  .post-meta .pm-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .post-meta .pm-stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
  .post-meta .pm-follow {
    flex: 0 0 auto; font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1;
    padding: 7px 14px; border-radius: var(--radius-pill);
    border: 1px solid var(--c-primary); color: var(--c-primary); background: transparent;
    cursor: pointer; appearance: none; -webkit-appearance: none;
    transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
  }
  .post-meta .pm-follow:hover { background: var(--c-primary-soft); }
  .post-meta .pm-follow.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .post-meta .stat { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text-soft); }
  .post-meta .stat svg { width: 14px; height: 14px; }
  .post-meta .stat b { font-weight: 700; color: var(--c-text); }
  .post-meta .stat i { font-style: normal; font-size: 11.5px; }
  .post-meta .stat-time { margin-left: auto; }
  .post-meta .author { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--c-text); }
  .avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-on-primary);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
    overflow: hidden;
  }
  /* 真实头像图：铺满圆形，图片加载失败时由 onerror 隐藏，露出容器底色 */
  .avatar.avatar-img { background: var(--c-surface-2); }
  .avatar.avatar-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .tag-essence {
    background: var(--c-tag);
    color: var(--c-primary-dark);
    font-size: 12px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 6px;
  }
  /* ---------- 侧栏 ---------- */
  .sidebar { display: flex; flex-direction: column; gap: 16px; }
  .sidebar .card { padding: 14px 16px; }
  .sidebar h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--c-text-soft);
    letter-spacing: 0.04em;
  }
  .rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .rank-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
  .rank-list .idx {
    width: 20px; height: 20px;
    border-radius: 6px;
    background: var(--c-bg);
    color: var(--c-text-soft);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }
  .rank-list .idx.top { background: var(--c-primary); color: var(--c-on-primary); }
  .rank-list a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rank-list a:hover { color: var(--c-primary); }
  .plate-nav {
    list-style: none; margin: 0; padding: 0;
    /* 2 列网格：移动端满宽下不再"一行一个、右侧大段留白" */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
  }
  .plate-nav a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 600;
    color: var(--c-text);
  }
  .plate-nav a:hover { background: var(--c-bg); }
  .plate-nav a.active { background: var(--c-tag); color: var(--c-primary-dark); }

  /* ---------- 帖子详情 ---------- */
  /* 用纵向 flex + gap 统一卡片间距，避免每块各写 margin 导致节奏忽大忽小 */
  #post-detail { display: flex; flex-direction: column; gap: 16px; }
  #post-detail .back-link { margin-bottom: 0; align-self: flex-start; }
  /* 桌面端收窄成"阅读栏"并居中：16px 正文铺满 1000px 时每行过长，阅读体验差 */
  @media (min-width: 860px) {
    #post-detail { width: 100%; max-width: 800px; margin: 0 auto; }
  }

  .post-detail { padding: 22px 20px 18px; }
  .post-detail h1 {
    font-size: 21px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
  }
  .post-detail .post-meta {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-border);
  }
  .post-detail .body {
    color: var(--c-text);
    font-size: 16px;
    line-height: 1.85;
    margin: 16px 0;
    /* 注意：renderMarkdown 输出的已是块级结构，这里若保留 pre-wrap，
       源码换行会被再渲染一遍 → 段落之间出现成片空白（此前的排版问题）。 */
    white-space: normal;
  }
  .post-detail .body > :first-child { margin-top: 0; }
  .post-detail .body > :last-child { margin-bottom: 0; }
  /* 正文小标题 / 强调：给 Markdown 的 ## 与 ** 明确层级，避免「像小标题却没样式」 */
  .post-detail .body h2 { font-size: 18px; font-weight: 800; line-height: 1.5; margin: 22px 0 10px; color: var(--c-text); }
  .post-detail .body h3 { font-size: 16px; font-weight: 800; margin: 18px 0 8px; color: var(--c-text); }
  .post-detail .body strong { font-weight: 800; color: var(--c-text); }
  .post-detail .body em { font-style: italic; }
  .post-detail .body ul, .post-detail .body ol { margin: 12px 0; padding-left: 22px; }
  .post-detail .body li { margin: 6px 0; }

  /* 点赞 / 评论 / 分享：一组等高、同圆角、同字号的操作胶囊。
     历史问题：点赞走 .btn-primary（实心 pill 39px）、评论与分享走 .action-count（纯文字 22px，
     且 <button> 未重置 UA 外观，漏出灰底方角 26px），三者高度 39/22/26、圆角 999/0/0，完全不成组。 */
  .post-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
  }
  .pa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 36px;
    padding: 0 15px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    color: var(--c-text-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
  }
  .pa-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .pa-btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  /* 主操作：实心主色；已赞退为淡底，避免长期亮着喧宾夺主 */
  .pa-btn.pa-like {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: var(--c-on-primary);
  }
  .pa-btn.pa-like:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: var(--c-on-primary); }
  .pa-btn.pa-like.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .pa-btn.pa-like.on:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  /* 分享固定靠右，与左侧「互动」在语义上分开 */
  .pa-btn.pa-share { margin-left: auto; }
  /* 收藏：默认描边，已收藏填充主色（bookmark 图标 fill 跟随） */
  .pa-btn.pa-save.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .pa-btn.pa-save.on:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .pa-btn.pa-save.on svg { fill: currentColor; }

  /* ---------- 帖子详情增强：作者卡 / 同板块推荐 / 灯箱 ---------- */
  .author-card { padding: 16px 18px; }
  .author-card .ac-head { display: flex; align-items: center; gap: 12px; }
  .author-card .ac-avatar { flex: 0 0 auto; display: block; }
  .author-card .ac-info { flex: 1 1 auto; min-width: 0; }
  .author-card .ac-name { font-size: 16px; font-weight: 800; color: var(--c-text); display: flex; align-items: center; gap: 8px; }
  .ac-level { font-size: 12px; font-weight: 700; color: var(--c-primary-dark); background: var(--c-primary-soft); border-radius: var(--radius-pill); padding: 1px 8px; white-space: nowrap; }
  .author-card .ac-meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--c-text-soft); }
  .author-card .ac-meta span { display: inline-flex; align-items: center; gap: 4px; }
  .author-card .ac-meta .icon { width: 14px; height: 14px; }
  .author-card .ac-btn { flex: 0 0 auto; align-self: center; font-size: 13px; font-weight: 700; color: var(--c-primary); text-decoration: none; padding: 7px 12px; border: 1px solid var(--c-border); border-radius: var(--radius-pill); transition: border-color .18s var(--ease), color .18s var(--ease); }
  .author-card .ac-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .author-card .ac-bio { margin: 12px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--c-text-soft); }

  .related { padding: 16px 18px 18px; }
  .related-title { font-size: 15px; font-weight: 800; margin: 0 0 10px; }
  .related-list { display: flex; flex-direction: column; gap: 10px; }
  .rel-card { display: block; text-decoration: none; padding: 11px 13px; border: 1px solid var(--c-border); border-radius: var(--radius-md); background: var(--c-surface); transition: border-color .18s var(--ease), transform .18s var(--ease); }
  .rel-card:hover { border-color: var(--c-primary); transform: translateY(-1px); }
  .rel-card .rel-title { display: block; font-size: 14.5px; font-weight: 700; color: var(--c-text); line-height: 1.45; }
  .rel-card .rel-meta { margin-top: 5px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-soft); }
  .rel-card .rel-meta .icon { width: 13px; height: 13px; }

  /* 灯箱：点图放大全屏（仅帖子详情内，避开头像） */
  .lightbox {
    position: fixed; inset: 0; z-index: 1500;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 17, 22, .92); padding: 24px;
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .lightbox.open { opacity: 1; visibility: visible; }
  .lightbox-img { max-width: 92vw; max-height: 92vh; width: auto; height: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); background: var(--c-surface); }
  .lightbox-close { position: absolute; top: 16px; right: 18px; width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
  .lightbox-close:hover { background: rgba(255, 255, 255, .28); }

  /* ---------- 评论区 ---------- */
  .comment-block { padding: 18px 16px 20px; }
  .comment-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .comment-title .count {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-radius: var(--radius-pill);
    padding: 1px 8px;
  }
  .comment {
    display: flex; gap: 10px; padding: 12px 0;
    border-bottom: 1px solid var(--c-border);
  }
  .comment:last-of-type { border-bottom: none; }
  .comment .content { flex: 1; min-width: 0; }
  .comment .c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .comment .c-head .name { font-weight: 700; font-size: 14px; }
  .comment .c-head .time { font-size: 12px; color: var(--c-text-soft); }
  #comments { scroll-margin-top: calc(var(--header-h) + 12px); }
  /* 评论输入框不必像发帖正文那么高，收紧留白 */
  #comment-input { min-height: 96px; }

  /* ---------- 表单 ---------- */
  .form-group { margin-bottom: 16px; }
  .form-group label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
  }
  .form-group input,
  .form-group textarea,
  .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--c-surface);
  }
  .form-group textarea { min-height: 160px; resize: vertical; }
  .btn-primary {
    background: var(--c-primary);
    color: var(--c-on-primary);
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 22px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
  }
  .btn-primary:hover { background: var(--c-primary-dark); }

  /* 发帖表单增强 */
  .form-group label .form-counter { float: right; font-weight: 400; font-size: 12px; color: var(--c-text-soft); }
  .form-error { margin: 6px 0 0; font-size: 12px; color: var(--c-danger, #e5484d); }
  .publish-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
  .publish-actions .btn-primary { margin-left: auto; }
  .autosave-hint { font-size: 12px; color: var(--c-text-soft); }
  .btn-text { background: none; border: none; color: var(--c-text-soft); font-size: 13px; cursor: pointer; padding: 4px 6px; }
  .btn-text:hover { color: var(--c-danger, #e5484d); }
  .btn-sm { padding: 7px 12px; font-size: 13px; }
  .draft-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: color-mix(in srgb, var(--c-primary) 10%, var(--c-surface));
    border: 1px solid color-mix(in srgb, var(--c-primary) 32%, transparent);
    border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 16px; flex-wrap: wrap;
  }
  .draft-banner__text { font-size: 13px; }
  .draft-banner__text strong { color: var(--c-primary); }
  .draft-banner__actions { display: flex; gap: 8px; align-items: center; }
  .dropzone {
    margin-top: 8px; border: 1.5px dashed var(--c-border); border-radius: var(--radius-md);
    background: var(--c-surface-2, var(--c-surface)); padding: 18px; text-align: center;
    cursor: pointer; transition: border-color .15s, background .15s;
  }
  .dropzone:hover, .dropzone:focus-visible { border-color: var(--c-primary); outline: none; }
  .dropzone.is-dragover { border-color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 12%, var(--c-surface)); }
  .dropzone__inner { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
  .dropzone__icon { font-size: 24px; line-height: 1; color: var(--c-primary); }
  .dropzone__text { font-size: 13px; color: var(--c-text-soft); }

  /* ---------- 用户主页 ---------- */
  .profile-head {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .profile-head .avatar { width: 64px; height: 64px; font-size: 26px; }
  .profile-head .name { font-size: 18px; font-weight: 800; margin: 0; }
  .profile-head .bio { color: var(--c-text-soft); font-size: 14px; margin: 4px 0 0; }
  .stat-row { display: flex; gap: 24px; padding: 0 16px 16px; }
  .stat-row .stat-item .n { font-size: 18px; font-weight: 800; }
  .stat-row .stat-item .l { font-size: 12px; color: var(--c-text-soft); }

  /* ---------- 页脚 ---------- */
  .site-footer {
    text-align: center;
    color: var(--c-text-soft);
    font-size: 12px;
    padding: 20px 16px 28px;
    border-top: 1px solid var(--c-border);
    margin-top: 8px;
  }
  .footer-note { margin: 0; line-height: 1.7; }
  .footer-note + .footer-note { margin-top: 2px; opacity: 0.82; }

  /* 移动端：榜单块在单栏下置顶，压缩一点高度避免抢占首屏 */
  @media (max-width: 859px) {
    .container.home-layout { padding-top: 12px; }
    .sidebar-rank .card { padding: 12px 14px; }
    .sidebar-rank .rank-list { gap: 8px; }
  }

  /* ---------- 空状态（增强） ---------- */
  .empty {
    padding: var(--sp-7) var(--sp-4);
    text-align: center;
    color: var(--c-text-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
  }
  .empty-icon { font-size: 40px; line-height: 1; opacity: 0.85; }
  .empty-title { font-weight: 800; font-size: var(--fs-lg); color: var(--c-text); margin: 0; }
  .empty-desc { font-size: var(--fs-base); margin: 0; max-width: 280px; }

  /* ---------- 排行榜页 ---------- */
  .rank-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
  .rank-tab {
    padding: 10px 16px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 14px;
    color: var(--c-text-soft);
    cursor: pointer;
  }
  .rank-tab.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
  .rank-sub-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
  .rank-sub {
    padding: 6px 14px;
    border: none;
    background: var(--c-bg);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-soft);
    cursor: pointer;
  }
  .rank-sub.active { background: var(--c-tag); color: var(--c-primary-dark); }
  .rank-table { list-style: none; margin: 0; padding: 0; }
  .rank-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--c-border); }
  .rank-row:last-child { border-bottom: none; }
  .rank-row .idx {
    width: 24px; height: 24px;
    border-radius: 6px;
    background: var(--c-bg);
    color: var(--c-text-soft);
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }
  .rank-row .idx.top { background: var(--c-primary); color: var(--c-on-primary); }
  .rank-main { flex: 1; min-width: 0; }
  .rank-title { font-weight: 700; font-size: 15px; color: var(--c-text); display: inline-flex; align-items: center; gap: 6px; }
  .rank-title:hover { color: var(--c-primary); }
  .rank-submeta { font-size: 13px; color: var(--c-text-soft); margin-top: 2px; }
  .rank-submeta .sep { opacity: 0.45; }

  /* 移动端：榜单大标签改为横向滚动单行，避免 4 个标签换行后落单 */
  @media (max-width: 560px) {
    .rank-tabs {
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 4px;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }
    .rank-tabs::-webkit-scrollbar { display: none; }
    .rank-tab { flex: 0 0 auto; padding: 9px 14px; }
  }
  .plate-bar-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
  .plate-bar-name { flex: 0 0 120px; font-weight: 700; font-size: 14px; color: var(--c-text); }
  .plate-bar-track { flex: 1; height: 10px; background: var(--c-bg); border-radius: var(--radius-pill); overflow: hidden; }
  .plate-bar-fill { height: 100%; background: var(--c-primary); border-radius: var(--radius-pill); }
  .plate-bar-num { flex: 0 0 auto; font-weight: 800; font-size: 14px; color: var(--c-primary); }

  /* ---------- 审核相关 ---------- */
  .form-hint { margin: 6px 0 0; font-size: 12px; color: var(--c-text-soft); }
  .tag-review {
    background: var(--c-warning-bg);
    color: var(--c-warning);
    font-size: 12px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 6px;
    margin-left: 4px;
  }

  /* ---------- 搜索页 ---------- */
  .search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
  .search-bar input {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--c-surface);
    color: var(--c-text);
  }
  .search-bar input:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
  .search-summary { font-size: 14px; color: var(--c-text-soft); margin: 4px 4px 8px; }
  .tag-group { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    display: inline-block;
    padding: 6px 14px;
    background: var(--c-tag);
    color: var(--c-primary-dark);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
  }
  .chip:hover { background: var(--c-primary); color: var(--c-on-primary); }
  .user-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
  .user-row .name { font-weight: 800; font-size: 15px; }
  .user-row .bio { font-size: 13px; color: var(--c-text-soft); margin: 2px 0 0; }

  /* ---------- 个人中心 ---------- */
  .me-tabs { display: flex; gap: 8px; margin: 14px 0 12px; flex-wrap: wrap; }
  .me-tab {
    padding: 9px 16px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 14px;
    color: var(--c-text-soft);
    cursor: pointer;
  }
  .me-tab.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
  .comment-row .name { font-weight: 800; font-size: 15px; margin: 0 0 2px; }
  .comment-row .excerpt { margin: 0 0 4px; }
  .comment-row .stat { font-size: 12px; }

  /* ---------- 单品页 ---------- */
  .product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card { padding: 14px 16px; display: block; }
  .product-card:hover { border-color: var(--c-primary); }
  .pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .pc-head .pc-title { flex: 1; min-width: 0; }
  .product-card .pc-title { font-weight: 800; font-size: 15px; color: var(--c-text); }
  .product-card .pc-desc { font-size: 13px; color: var(--c-text-soft); margin: 6px 0 8px; line-height: 1.5; }
  .product-card .pc-meta { font-size: 12px; color: var(--c-primary-dark); font-weight: 700; }

  /* ---------- 单品图片位（缩略图 / 占位） ---------- */
  /* 有 product.image 时显示真实图片；否则用品牌首字占位块，尺寸固定以便接入真实图后不跳版 */
  .thumb {
    flex: 0 0 auto;
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(120% 120% at 18% 12%, var(--c-primary-soft) 0%, transparent 62%),
      var(--c-surface-2);
    border: 1px solid var(--c-border);
    color: var(--c-primary-dark);
    font-weight: 800;
    font-size: 20px;
    line-height: 1;
    user-select: none;
  }
  .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .thumb .thumb-mono { display: block; }
  .thumb-sm { width: 48px; height: 48px; font-size: 17px; border-radius: 10px; }
  .thumb-lg { width: 72px; height: 72px; font-size: 26px; }

  .product-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  }
  .product-link:hover { border-color: var(--c-primary); }
  .product-link .pl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .product-link .pl-label { font-size: 12px; color: var(--c-text-soft); }
  .product-link .pl-name { font-size: 15px; color: var(--c-text); }
  .product-link .pl-meta { font-size: 13px; color: var(--c-primary-dark); font-weight: 700; white-space: nowrap; }
  .card-title { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--c-text); }
  .section-h { margin: 18px 4px 8px; font-size: 15px; font-weight: 800; color: var(--c-text-soft); }
  .rating-dist { display: flex; flex-direction: column; gap: 8px; }
  .rd-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  .rd-star { flex: 0 0 34px; color: var(--c-text-soft); font-weight: 700; }
  .rd-track { flex: 1; height: 10px; background: var(--c-primary-soft); border-radius: 6px; overflow: hidden; }
  .rd-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-primary-dark)); border-radius: 6px; }
  .rd-num { flex: 0 0 40px; text-align: right; color: var(--c-text-soft); }
  .sort-bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
  .sort-bar select { padding: 8px 10px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); font-size: 14px; color: var(--c-text); }

  @media (max-width: 560px) {
    .product-grid { grid-template-columns: 1fr; }
  }

  /* ---------- 移动端汉堡菜单（<860px 显示） ---------- */
  .menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  @media (max-width: 859px) {
    .menu-toggle { display: inline-flex; }
    .site-header nav.open {
      display: flex;
      flex-direction: column;
      position: absolute;
      top: var(--header-h);
      left: 0; right: 0;
      background: var(--c-surface);
      border-bottom: 1px solid var(--c-border);
      box-shadow: var(--shadow-card);
      padding: 4px 0;
      gap: 0;
      margin-left: 0;
    }
    .site-header nav.open a {
      padding: 13px 16px;
      border-bottom: 1px solid var(--c-border);
      color: var(--c-text);
      font-size: 15px;
    }
    .site-header nav.open a:last-child { border-bottom: none; }
  }

  /* ---------- 发帖图片预览 ---------- */
  .img-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
  }
  .img-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
  }
  .img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .img-remove {
    position: absolute;
    top: 3px; right: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--c-overlay);
    color: var(--c-on-overlay);
    border: none;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .img-remove:hover { background: var(--c-overlay-strong); }
  .img-remove:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }

  /* 评论加图 */
  .comment-img-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
  .comment-add-img {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-text-soft);
    font-size: 13px; font-weight: 700; cursor: pointer;
  }
  .comment-add-img:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .comment-add-img:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .comment-img-preview { display: flex; gap: 8px; flex-wrap: wrap; }
  .comment-img-preview .img-thumb { width: 64px; height: 64px; }
  .comment-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 8px; }
  .comment-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-border); }

  /* 评论楼中楼 / 引用 / @提及 */
  .c-actions { margin-top: 6px; display: flex; align-items: center; gap: 12px; }
  .c-reply {
    background: none; border: none; color: var(--c-text-soft); font-size: 13px;
    font-weight: 700; cursor: pointer; padding: 2px 4px; border-radius: 6px;
  }
  .c-reply:hover { color: var(--c-primary); background: color-mix(in srgb, var(--c-primary) 10%, transparent); }
  .c-del {
    background: none; border: none; color: var(--c-text-soft); font-size: 13px;
    font-weight: 700; cursor: pointer; padding: 2px 4px; border-radius: 6px; font-family: inherit;
  }
  .c-del:hover { color: #e5484d; background: color-mix(in srgb, #e5484d 10%, transparent); }
  .comment-replies {
    margin: 10px 0 0 18px; padding-left: 12px;
    border-left: 2px solid var(--c-border);
    display: flex; flex-direction: column; gap: 12px;
  }
  .comment.is-reply { padding: 10px 0 0; border-bottom: none; }
  .comment.is-reply .c-head .name { font-size: 13px; }
  .c-quote {
    display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap;
    margin: 6px 0; padding: 6px 10px; border-radius: 8px;
    background: var(--c-surface-2, var(--c-surface)); border: 1px solid var(--c-border);
    font-size: 13px; color: var(--c-text-soft);
  }
  .c-quote__author { color: var(--c-primary); font-weight: 700; text-decoration: none; }
  .c-quote__author:hover { text-decoration: underline; }
  .c-quote__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mention { color: var(--c-primary); font-weight: 700; text-decoration: none; }
  .mention:hover { text-decoration: underline; }
  .reply-target {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 10px; padding: 6px 10px; border-radius: 8px;
    background: color-mix(in srgb, var(--c-primary) 10%, var(--c-surface));
    border: 1px solid color-mix(in srgb, var(--c-primary) 30%, transparent);
    font-size: 13px; color: var(--c-text-soft);
  }
  .reply-target a { color: var(--c-primary); font-weight: 700; text-decoration: none; }
  .reply-target a:hover { text-decoration: underline; }
  .reply-cancel {
    margin-left: auto; background: none; border: none; cursor: pointer;
    color: var(--c-text-soft); font-size: 16px; line-height: 1; padding: 0 4px;
  }
  .reply-cancel:hover { color: var(--c-danger, #e5484d); }

  /* ---------- 帖子详情图片 ---------- */
  .post-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
  }
  .post-images img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
  }
  @media (max-width: 480px) {
    .post-images { grid-template-columns: 1fr; }
  }

  /* ---------- 微交互与动效 ---------- */
  @keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* 卡片入场 + 悬停抬升 */
  @media (hover: hover) {
    .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
    .product-card:hover { transform: translateY(-2px); border-color: var(--c-primary); }
    .plate-nav a:hover { background: var(--c-surface-2); }
  }

  /* 按钮 / 可点元素统一过渡与按下反馈 */
  .btn-primary, .btn-publish, .rank-tab, .me-tab, .plate-tabs a, .chip,
  .sort-bar select, .search-bar input, .menu-toggle, .theme-toggle {
    transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease),
                border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease),
                transform var(--motion-fast) var(--ease);
  }
  .btn-primary:active, .btn-publish:active, .rank-tab:active, .me-tab:active,
  .plate-tabs a:active, .chip:active, .menu-toggle:active, .theme-toggle:active {
    transform: scale(0.96);
  }

  /* 列表项轻量入场 */
  .post-item, .product-card, .rank-row, .user-row, .comment {
    animation: fade-up var(--motion-slow) var(--ease) both;
  }

  /* ---------- 主题切换按钮 ---------- */
  .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .theme-toggle:hover { border-color: var(--c-primary); }
  .theme-toggle:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

  /* ---------- Markdown 渲染（正文 / 评论 / 预览） ---------- */
  .md { line-height: 1.75; word-break: break-word; }
  .md > :first-child { margin-top: 0; }
  .md > :last-child { margin-bottom: 0; }
  .md h1, .md h2, .md h3, .md h4 { line-height: 1.35; margin: 1em 0 .5em; font-weight: 700; }
  .md h1 { font-size: 1.4em; }
  .md h2 { font-size: 1.25em; }
  .md h3 { font-size: 1.1em; }
  .md p { margin: .7em 0; }
  .md ul, .md ol { margin: .7em 0; padding-left: 1.4em; }
  .md li { margin: .3em 0; }
  .md li::marker { color: var(--c-primary); }
  .md strong { color: var(--c-text); }
  .md blockquote {
    margin: .8em 0; padding: .4em .9em;
    border-left: 3px solid var(--c-primary);
    background: var(--c-primary-soft);
    border-radius: 0 8px 8px 0; color: var(--c-text-soft);
  }
  .md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em; background: var(--c-primary-soft);
    padding: .12em .4em; border-radius: 6px;
  }
  .md pre { background: var(--c-primary-soft); padding: 12px 14px; border-radius: 10px; overflow: auto; }
  .md pre code { background: none; padding: 0; }
  .md a { color: var(--c-primary); text-decoration: underline; }
  .md hr { border: none; border-top: 1px solid var(--c-border); margin: 1em 0; }
  .md del { opacity: .6; }

  /* 表格（GFM 管道表）：窄屏横向滚动，避免挤压列宽导致文字折行错乱 */
  .md-table-wrap { overflow-x: auto; margin: 1em 0; -webkit-overflow-scrolling: touch; }
  .md-table { width: 100%; border-collapse: collapse; font-size: .92em; min-width: 320px; }
  .md-table th, .md-table td {
    border: 1px solid var(--c-border);
    padding: 8px 10px;
    vertical-align: top;
  }
  .md-table th { background: var(--c-bg); font-weight: 700; color: var(--c-text); white-space: nowrap; }
  .md-table td { color: var(--c-text-soft); }
  .md-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--c-bg) 40%, transparent); }

  /* ---------- 发帖页 Markdown 工具栏 + 预览 ---------- */
  .md-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .md-toolbar button {
    min-width: 34px; height: 32px; padding: 0 8px;
    border: 1px solid var(--c-border); border-radius: 8px;
    background: var(--c-surface); color: var(--c-text);
    font-size: 13px; cursor: pointer; line-height: 1;
  }
  .md-toolbar button:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .md-toolbar button:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .md-preview {
    margin-top: 10px; padding: 14px 16px;
    border: 1px dashed var(--c-border); border-radius: 12px;
    background: var(--c-surface-2); min-height: 80px;
  }
  .md-empty { color: var(--c-text-soft); font-size: 13px; margin: 0; }
  .comment .md { margin-top: 6px; font-size: 14px; line-height: 1.7; }

  /* ============================================================
     排行榜：标签置顶 + 单品榜横向滑动
     顶部标签（帖子/用户/板块/单品）→ 单品榜为横向 scroll-snap 滑动，
     不再双列平铺占用页面；社区榜单列表渲染在 #rank-content 内
     ============================================================ */
  .board-hero {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background:
      radial-gradient(120% 160% at 0% 0%, var(--c-primary-soft) 0%, transparent 58%),
      var(--c-surface);
  }
  .bh-kicker {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    color: var(--c-primary-dark);
    text-transform: uppercase;
  }
  .bh-title { margin: 0 0 8px; font-size: 19px; font-weight: 800; line-height: 1.35; }
  .bh-desc { margin: 0; font-size: 13px; line-height: 1.7; color: var(--c-text-soft); }
  .bh-stats { display: flex; gap: 22px; }
  .bh-stat { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
  .bh-stat b { font-size: 22px; font-weight: 800; color: var(--c-primary); }
  .bh-stat span { font-size: 12px; color: var(--c-text-soft); }
  @media (min-width: 720px) {
    .board-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; }
  }

  /* ============================================================
     排行榜：一整条完整榜单（1..N 连续名次）
     顶部榜单头 → 名次列表 → 口径脚注；前三名用金银铜徽标强化
     ============================================================ */
  .rb-board { padding: 0; overflow: hidden; }
  /* 排行榜的类型筛选：5 个标签尽量一屏全显，放不下时换行兜底（不藏在横滑里） */
  #prod-type-cats { flex-wrap: wrap; overflow: visible; row-gap: 8px; }
  #prod-type-cats .rev-cat { padding: 9px 12px; }
  @media (max-width: 374px) {
    #prod-type-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #prod-type-cats .rev-cat { text-align: center; }
    /* 360 窄屏先把年份让出来，保证品名完整不截断 */
    .rb-year { display: none; }
  }


  .rb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 15px 12px;
    border-bottom: 1px solid var(--c-border);
    background: linear-gradient(180deg, var(--c-primary-soft), transparent 92%);
  }
  .rb-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .01em;
  }
  .rb-title .icon { width: 18px; height: 18px; color: var(--c-primary); }
  .rb-sub {
    font-size: 12px;
    font-weight: 800;
    color: var(--c-primary);
    vertical-align: 1px;
  }
  .rb-note { font-size: 12px; color: var(--c-text-soft); white-space: nowrap; }

  .rb-list { list-style: none; margin: 0; padding: 0; }

  .rb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--c-border);
    /* 逐行入场，营造榜单「排出来」的节奏感 */
    animation: rankRowIn .34s cubic-bezier(.22,.61,.36,1) both;
    animation-delay: calc(var(--i, 0) * 32ms);
  }
  .rb-row:last-child { border-bottom: none; }
  .rb-row.is-top {
    background: linear-gradient(90deg, color-mix(in srgb, var(--c-primary) 6%, transparent), transparent 62%);
  }

  .rb-no {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--c-surface-2);
    color: var(--c-text-soft);
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  .rb-no.n1 {
    background: linear-gradient(145deg, #ffbd3d, #ff7a00);
    color: #fff;
    box-shadow: 0 4px 10px rgba(255, 138, 0, .34);
  }
  .rb-no.n2 {
    background: linear-gradient(145deg, #cdd6e6, #919fb8);
    color: #fff;
    box-shadow: 0 4px 10px rgba(120, 135, 160, .26);
  }
  .rb-no.n3 {
    background: linear-gradient(145deg, #e6ab7f, #bd7444);
    color: #fff;
    box-shadow: 0 4px 10px rgba(170, 105, 60, .26);
  }

  .rb-thumb { flex: 0 0 auto; display: inline-flex; }
  .rb-thumb .thumb { width: 52px; height: 52px; font-size: 18px; }
  .rb-row.is-top .rb-thumb .thumb { width: 56px; height: 56px; font-size: 20px; }

  .rb-main { flex: 1; min-width: 0; }
  .rb-name {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.34;
    color: var(--c-text);
    /* 品名 + 年份固定一行：超长才截断，避免年份单独掉到第二行 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rb-name:hover { color: var(--c-primary); }
  .rb-year { margin-left: 5px; font-size: 12px; font-weight: 500; color: var(--c-text-soft); }
  .rb-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--c-primary);
    color: var(--c-on-primary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: .3px;
  }
  .rb-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
  }
  .rb-stars { font-size: 11px; letter-spacing: .5px; }
  .rb-score { font-size: 13px; font-weight: 800; color: var(--c-text); }
  .rb-count { font-size: 12px; color: var(--c-text-soft); }

  .rb-heat {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px 3px 5px;
    border-radius: var(--radius-pill);
    background: var(--c-primary-soft);
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
  }
  .rb-heat .icon { width: 12px; height: 12px; }
  .rb-heat b { font-size: 12px; font-weight: 800; }

  .rb-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 15px;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface-2);
    color: var(--c-text-soft);
    font-size: 12px;
    line-height: 1.5;
  }
  .rb-foot .icon { width: 13px; height: 13px; flex: 0 0 auto; }

  /* 排行榜页：运营后台入口 */
  .admin-access {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 14px 16px;
  }
  .admin-access .aa-text { font-size: 13px; color: var(--c-text-soft); line-height: 1.5; }
  .admin-access .aa-em { color: var(--c-primary); font-weight: 800; }
  .admin-access .btn-primary { flex: 0 0 auto; }
  @media (max-width: 560px) {
    .admin-access { flex-direction: column; align-items: flex-start; }
  }

  @keyframes rankRowIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .rb-row { animation: none; }
  }

  /* 排行榜页底部板块导航：整页宽度下按可用宽度自动铺列 */
  .rank-aside .plate-nav { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }

  /* 排行榜页：社区热帖 Top5（renderSidebar 渲染，按引擎综合热度） */
  .side-hot { margin-top: 14px; padding: 14px 16px; }
  .side-hot .side-hot-title { display: flex; align-items: center; gap: 7px; font-size: 15px; margin: 0 0 10px; }
  .hot-ranking { list-style: none; margin: 0; padding: 0; }
  .hot-ranking li { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--c-border); }
  .hot-ranking li:last-child { border-bottom: 0; }
  .hot-ranking .idx {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; background: var(--c-surface-2); color: var(--c-text-soft);
    font-variant-numeric: tabular-nums;
  }
  .hot-ranking .idx.top { background: var(--c-primary); color: var(--c-on-primary); }
  .hot-ranking a { flex: 1; font-size: 13.5px; color: var(--c-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hot-ranking a:hover { color: var(--c-primary); }


  /* ============================================================
     单品内页（结构参考香水时代单品页）
     图位 + 规格表 + 评分分布 + 操作行 / 体感标签 / 简介 / 测评 / 右栏
     ============================================================ */
  .prod-layout { display: grid; gap: 14px; }
  .prod-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  @media (min-width: 980px) {
    .prod-layout { grid-template-columns: minmax(0, 1fr) 282px; align-items: start; }
  }

  .prod-hero { display: grid; gap: 16px; padding: 18px 16px; }
  @media (min-width: 720px) {
    .prod-hero { grid-template-columns: 200px minmax(0, 1fr); gap: 22px; align-items: start; }
  }
  /* 移动端：图位转为通栏横幅（扁平比例），避免小图旁边留大片空白，又不把首屏推太深 */
  .ph-media { position: relative; width: 100%; max-width: 100%; aspect-ratio: 5 / 2; }
  .ph-media .thumb-block { font-size: 44px; }
  @media (min-width: 720px) {
    .ph-media { max-width: 100%; aspect-ratio: 1; }
    .ph-media .thumb-block { font-size: 48px; }
  }
  .thumb-block { width: 100%; height: 100%; border-radius: var(--radius-lg); font-size: 48px; }
  .ph-media-hint {
    position: absolute; right: 8px; bottom: 8px;
    padding: 2px 6px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text-soft);
    font-size: 11px;
    line-height: 1.4;
  }
  .ph-crumb { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
  .chip-xs { padding: 3px 10px; font-size: 12px; }
  .chip-plain { background: var(--c-surface-2); color: var(--c-text-soft); }
  .chip-plain:hover { background: var(--c-surface-2); color: var(--c-text-soft); }
  .ph-title { margin: 0 0 6px; font-size: 20px; font-weight: 800; line-height: 1.35; }
  .ph-year { font-size: 13px; font-weight: 600; color: var(--c-text-soft); }
  .ph-desc { margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: var(--c-text-soft); }

  .spec-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--c-surface-2);
  }
  @media (max-width: 560px) {
    .spec-list { grid-template-columns: 1fr; }
  }
  .spec-row { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; min-width: 0; }
  .spec-row dt { flex: 0 0 66px; color: var(--c-text-soft); }
  .spec-row dd { margin: 0; font-weight: 600; color: var(--c-text); min-width: 0; overflow-wrap: anywhere; }

  .score-row {
    display: grid;
    gap: 12px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
  }
  @media (min-width: 600px) {
    .score-row { grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 18px; }
  }
  .score-label { font-size: 12px; color: var(--c-text-soft); }
  .score-num { font-size: 34px; font-weight: 800; line-height: 1.05; color: var(--c-primary); }
  .score-stars { color: var(--c-star); font-size: 14px; letter-spacing: 1px; }
  .score-count { margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--c-text-soft); }
  .score-row .rd-row { font-size: 12px; gap: 8px; }
  .score-row .rd-star { flex: 0 0 32px; font-weight: 600; }
  .score-row .rd-track { height: 8px; }
  .score-row .rd-num { flex: 0 0 34px; }

  .ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .act {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
  }
  .act:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .act:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .act.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .act-sm { padding: 6px 12px; font-size: 12px; }

  .my-rate {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    font-size: 12px;
    color: var(--c-text-soft);
  }
  .mr-label { margin-right: 4px; }
  .mr-star {
    padding: 0 1px;
    border: none;
    background: none;
    color: var(--c-text-soft);
    opacity: .5;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: color var(--motion-fast) var(--ease), opacity var(--motion-fast) var(--ease);
  }
  .mr-star:hover { color: var(--c-star); opacity: 1; }
  .mr-star.on { color: var(--c-star); opacity: 1; }
  .mr-val { margin-left: 6px; font-weight: 700; color: var(--c-primary-dark); }

  .prod-sec { padding: 16px; }
  .sec-note { margin: -6px 0 12px; font-size: 12px; color: var(--c-text-soft); line-height: 1.6; }
  .feel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }
  .feel-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface-2);
    text-align: center;
  }
  .feel-icon { font-size: 22px; line-height: 1; }
  .feel-k { font-size: 12px; font-weight: 700; color: var(--c-text); line-height: 1.3; }
  .feel-pct { font-size: 12px; font-weight: 800; color: var(--c-primary); }

  .intro-block { display: grid; gap: 14px; }
  @media (min-width: 600px) {
    .intro-block { grid-template-columns: 148px minmax(0, 1fr); gap: 18px; align-items: start; }
  }
  .intro-fig { margin: 0; max-width: 150px; }
  .intro-mono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    background:
      radial-gradient(120% 120% at 20% 10%, var(--c-primary-soft) 0%, transparent 62%),
      var(--c-surface-2);
    border: 1px solid var(--c-border);
    color: var(--c-primary-dark);
    font-size: 34px;
    font-weight: 800;
  }
  .intro-fig figcaption { margin-top: 6px; font-size: 11px; color: var(--c-text-soft); text-align: center; }
  .intro-text p { margin: 0 0 10px; font-size: 14px; line-height: 1.85; color: var(--c-text); }
  .intro-text .intro-src { margin: 0; font-size: 12px; color: var(--c-text-soft); }

  .rev-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
  .rev-head .card-title { margin: 0; }
  .rev-count {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    font-size: 12px;
    vertical-align: 1px;
  }
  .rev-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rev-tabs { display: flex; gap: 4px; }
  .rev-tab {
    padding: 5px 12px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--c-surface-2);
    color: var(--c-text-soft);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .rev-tab.active { background: var(--c-tag); color: var(--c-primary-dark); }

  .review { padding: 14px 0; border-bottom: 1px solid var(--c-border); }
  .review:last-child { border-bottom: none; padding-bottom: 2px; }
  .rv-head { display: flex; gap: 10px; align-items: flex-start; }
  .rv-who { flex: 1; min-width: 0; }
  .rv-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rv-name { font-size: 14px; font-weight: 800; color: var(--c-text); }
  .rv-name:hover { color: var(--c-primary); }
  .rv-stars { color: var(--c-star); font-size: 11px; letter-spacing: .5px; }
  .rv-tag {
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--c-surface-2);
    color: var(--c-text-soft);
    font-size: 11px;
    font-weight: 700;
  }
  .rv-meta { margin-top: 2px; font-size: 12px; color: var(--c-text-soft); }
  .rv-body { margin-top: 8px; font-size: 14px; line-height: 1.8; }
  .rv-foot { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
  .rv-act {
    padding: 4px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    color: var(--c-text-soft);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .rv-act:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .rv-act.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-dark); }
  .rv-plain { font-size: 12px; color: var(--c-text-soft); }
  .rv-more { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--c-primary); text-decoration: none; }
  .rv-more:hover { text-decoration: underline; }

  /* 单篇测评详情页 */
  .review-detail { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
  .rd-back { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--c-text-soft); text-decoration: none; }
  .rd-back:hover { color: var(--c-primary); }
  .rd-head { display: flex; gap: 12px; align-items: center; }
  .rd-who { min-width: 0; }
  .rd-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rd-name { font-size: 15px; font-weight: 800; color: var(--c-text); }
  .rd-name:hover { color: var(--c-primary); }
  .rd-meta { font-size: 12px; color: var(--c-text-soft); margin-top: 3px; }
  .rd-product {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border: 1px solid var(--c-border); border-radius: var(--radius-md);
    background: var(--c-surface-2); text-decoration: none; color: inherit;
  }
  .rd-product:hover { border-color: var(--c-primary); }
  .rd-product-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .rd-product-info b { font-size: 14px; color: var(--c-text); }
  .rd-product-info span { font-size: 12px; color: var(--c-text-soft); }
  .rd-product-go { font-size: 18px; color: var(--c-primary); flex: 0 0 auto; }
  .rd-body { font-size: 15px; line-height: 1.9; }
  .rd-foot { display: flex; align-items: center; gap: 14px; }
  .rd-others { padding: 16px; }
  .rd-others-title { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: var(--c-text); }

  .prod-discuss { padding-top: 4px; }
  .side-block { padding: 14px 14px 6px; }
  .side-title { margin: 0 0 10px; font-size: 14px; font-weight: 800; }
  .side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
  .side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--c-border);
  }
  .side-list li:last-child .side-item { border-bottom: none; }
  .si-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .si-name { font-size: 13px; font-weight: 700; color: var(--c-text); overflow-wrap: anywhere; }
  .side-item:hover .si-name { color: var(--c-primary); }
  .si-meta { font-size: 12px; color: var(--c-primary-dark); font-weight: 700; }
  .side-list-plain { gap: 0; }
  .side-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
    font-size: 13px;
    line-height: 1.5;
  }
  .side-list-plain li:last-child .side-row { border-bottom: none; }
  a.side-row:hover .sr-name { color: var(--c-primary); }
  .sr-name { font-weight: 600; overflow-wrap: anywhere; }
  .sr-count { flex: 0 0 auto; font-size: 12px; color: var(--c-text-soft); }
  .side-empty { margin: 0 0 10px; font-size: 12px; color: var(--c-text-soft); }

  /* ============================================================
     底部全局 Tab 栏（L0 主导航）
     固定置底 + 安全区适配；首页/测评/排行榜/交流/我的 五键
     详情页按父级高亮（单品→排行榜 · 帖子→交流 · 用户→我的）
     ============================================================ */
  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -2px 12px rgba(20, 24, 40, 0.06);
  }
  .bn-inner {
    display: flex;
    max-width: var(--maxw);
    margin: 0 auto;
  }
  .bn-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 2px calc(6px + env(safe-area-inset-bottom));
    color: var(--c-text-soft);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .bn-icon { font-size: 21px; line-height: 1; }
  .bn-item.active { color: var(--c-primary); }
  .bn-item:hover { color: var(--c-primary); }
  .bn-item:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -2px; }
  /* 五键正中的「排行榜」做成抬起中键：更大、带描边环、常驻浮动 + 呼吸光晕 */
  .bn-item.is-feature { position: relative; }
  .bn-item.is-feature .bn-icon {
    width: 46px;
    height: 46px;
    margin-top: -20px;
    border-radius: 50%;
    border: 3px solid var(--c-surface);
    box-sizing: border-box;
    background: linear-gradient(145deg, #ff7d95, var(--c-primary) 62%, var(--c-primary-dark));
    color: var(--c-on-primary);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--c-primary) 40%, transparent);
    animation: bnFloat 3.4s ease-in-out infinite;
  }
  .bn-item.is-feature .bn-icon .icon { width: 24px; height: 24px; }
  .bn-item.is-feature .bn-label { font-size: 12px; font-weight: 800; }
  .bn-item.is-feature.active .bn-icon {
    animation: bnFloat 3.4s ease-in-out infinite, bnGlow 2.2s ease-in-out infinite;
  }
  .bn-item.is-feature.active { color: var(--c-primary); }
  .bn-item.is-feature:active .bn-icon { transform: scale(.92); }

  @keyframes bnFloat {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -3px; }
  }
  @keyframes bnGlow {
    0%, 100% { box-shadow: 0 6px 16px color-mix(in srgb, var(--c-primary) 38%, transparent); }
    50% { box-shadow: 0 9px 26px color-mix(in srgb, var(--c-primary) 62%, transparent); }
  }
  @media (prefers-reduced-motion: reduce) {
    .bn-item.is-feature .bn-icon,
    .bn-item.is-feature.active .bn-icon { animation: none; }
  }
  @media (min-width: 860px) {
    .bn-item { font-size: 12px; }
    .bn-icon { font-size: 23px; }
  }
  /* 内容避让固定底栏：所有页面统一留出底栏高度（含安全区） */
  .container { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

  /* ============================================================
     首页门户（聚合入口）
     搜索条 + 双十一 banner + 分类总览 + 榜单精选 + 今日热帖
     ============================================================ */
  .portal-hero { display: flex; flex-direction: column; gap: 12px; }
  .portal-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    color: var(--c-text-soft);
    box-shadow: var(--shadow-card);
  }
  .portal-search .ps-icon { font-size: 18px; }
  .portal-search .ps-text { font-size: 14px; }
  .portal-search:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .portal-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background:
      radial-gradient(120% 160% at 0% 0%, var(--c-primary-soft) 0%, transparent 60%),
      var(--c-surface);
    border: 1px solid var(--c-primary-soft);
    color: var(--c-text);
    box-shadow: var(--shadow-card);
  }
  .portal-banner .pb-tag {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--c-primary);
    color: var(--c-on-primary);
    font-size: 12px;
    font-weight: 800;
  }
  .portal-banner .pb-text { font-size: 14px; font-weight: 700; color: var(--c-primary-dark); }
  .portal-banner:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

  .home-sec { margin-top: 20px; }
  .home-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }
  .home-sec-title { margin: 0; font-size: 17px; font-weight: 800; }
  .more-link { color: var(--c-text-soft); font-size: 13px; font-weight: 700; }
  .more-link:hover { color: var(--c-primary); }

  .cat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .cat-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    color: var(--c-text);
    text-decoration: none;
  }
  .cat-tile .cat-icon { font-size: 24px; line-height: 1; }
  .cat-tile .cat-name { font-size: 15px; font-weight: 800; margin-top: 4px; }
  .cat-tile .cat-desc { font-size: 12px; color: var(--c-text-soft); }
  .cat-tile:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  /* 三大核心板块：跨整行、视觉更重，作为门户主入口 */
  .cat-tile.cat-major {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    background:
      radial-gradient(120% 160% at 0% 0%, var(--c-primary-soft) 0%, transparent 62%),
      var(--c-surface);
    border-color: var(--c-primary-soft);
  }
  .cat-tile.cat-major .cat-name { margin-top: 0; font-size: 17px; }
  .cat-tile.cat-major .cat-icon { font-size: 30px; }
  .cat-tile.cat-major .cat-desc { margin-left: auto; }
  @media (hover: hover) {
    .cat-tile:hover { border-color: var(--c-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
  }
  @media (min-width: 560px) {
    .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cat-tile.cat-major { grid-column: span 2; }
  }

  .hot-list {
    list-style: none; margin: 0; padding: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
  }
  .hot-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--c-border);
    font-size: 14px;
  }
  .hot-list li:last-child { border-bottom: none; }
  .hot-list .idx {
    flex: 0 0 22px; height: 22px; border-radius: 6px;
    background: var(--c-bg); color: var(--c-text-soft);
    font-size: 12px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .hot-list .idx.top { background: var(--c-primary); color: var(--c-on-primary); }
  .hot-list a {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--c-text); font-weight: 600;
  }
  .hot-list a:hover { color: var(--c-primary); }

  .seg-tabs {
    display: inline-flex; gap: 4px;
    background: var(--c-surface-2);
    padding: 3px;
    border-radius: var(--radius-pill);
  }
  .seg {
    border: none; background: none; cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px; font-weight: 700; color: var(--c-text-soft);
  }
  .seg.active { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-sm); }
  .seg:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

  /* 排行榜精选：单品横向小卡（文字版，非板块导航） */
  .prod-grid { display: flex; flex-direction: column; gap: 12px; }
  .prod-mini {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    text-decoration: none; color: var(--c-text);
  }
  .prod-mini:hover { border-color: var(--c-primary); }
  .prod-mini:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .prod-mini .pm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .prod-mini .pm-name { font-size: 15px; font-weight: 800; }
  .prod-mini .pm-sub { font-size: 12px; color: var(--c-text-soft); }
  .prod-mini .pm-rate { font-size: 13px; display: flex; align-items: center; gap: 6px; }
  .prod-mini .pm-stars { color: var(--c-star); letter-spacing: 1px; }
  .prod-mini .pm-num { color: var(--c-primary); font-weight: 800; }

  /* 测评精选：紧凑预告卡 */
  .teaser-list { display: flex; flex-direction: column; gap: 12px; }
  .rev-teaser {
    display: block;
    padding: 13px 15px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    text-decoration: none; color: var(--c-text);
  }
  .rev-teaser:hover { border-color: var(--c-primary); }
  .rev-teaser:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .rt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rt-name { font-size: 14px; font-weight: 800; }
  .rt-stars { font-size: 13px; color: var(--c-star); letter-spacing: 1px; }
  .rt-tag {
    padding: 1px 8px; border-radius: var(--radius-pill);
    background: var(--c-primary-soft); color: var(--c-primary-dark);
    font-size: 11px; font-weight: 700;
  }
  .rt-excerpt {
    margin: 8px 0 0; font-size: 13px; color: var(--c-text-soft); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .rt-foot { margin-top: 8px; display: flex; gap: 14px; font-size: 12px; color: var(--c-text-soft); }

  /* 内页统一标题区（单品库 / 排行榜共用，字号与留白一致） */
  .page-head { margin: 2px 0 14px; }
  .page-head .ph-h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: .5px;
  }
  .page-head .ph-note {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--c-text-soft);
  }
  .rank-cycle {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--c-primary);
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .rank-cycle .icon { width: 13px; height: 13px; flex: 0 0 auto; }

  /* ============================================================
     排行榜页：标题置顶 + 单行口径说明
     ============================================================ */
  .rank-head { margin: 2px 0 14px; }
  .rank-head .rh-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: .5px;
  }
  .rank-head .rh-note {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--c-text-soft);
  }

  /* ============================================================
     测评页：分类标签 + 测评卡片 + 横评文章卡
     ============================================================ */
  .rev-cats {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 2px 0 10px;
    scrollbar-width: none;
  }
  .rev-cats::-webkit-scrollbar { display: none; }
  .rev-cat {
    flex: 0 0 auto;
    padding: 9px 16px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius-pill);
    font-size: 14px; font-weight: 700; color: var(--c-text-soft);
    cursor: pointer;
    white-space: nowrap;
  }
  .rev-cat.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
  .rev-cat:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  /* 测评卡片：脱离单品页语境后，套一层卡片底，避免裸分隔线浮在页面底上 */
  .review-list { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
  .review-list > .review {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 14px 16px;
  }
  .review-list > .review:last-child { padding-bottom: 14px; }
  .article-card {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: var(--c-text);
  }
  .article-card:hover { border-color: var(--c-primary); }
  .ac-title { font-size: 15px; font-weight: 800; }
  .ac-meta { margin-top: 6px; font-size: 13px; color: var(--c-text-soft); }

  /* ============================================================
     个人中心（升级版）
     头像信息区 + 数据条（获赞/关注/粉丝/帖子）+ 等级进度 + 内容 Tab
     ============================================================ */
  .profile-head { flex-wrap: wrap; }
  .ph-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .ph-name { font-size: 19px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .ph-lv { color: var(--c-primary); font-size: 13px; font-weight: 800; }
  .btn-edit {
    align-self: flex-start;
    padding: 5px 14px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius-pill);
    font-size: 13px; font-weight: 700; color: var(--c-text);
    cursor: pointer;
  }
  .btn-edit:hover { border-color: var(--c-primary); color: var(--c-primary); }
  .btn-edit:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
  .ph-sub { font-size: 13px; color: var(--c-text-soft); margin: 0; }
  .ph-bio { font-size: 14px; color: var(--c-text-soft); margin: 0; line-height: 1.6; }

  /* 编辑资料弹窗 */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: color-mix(in srgb, #000 45%, transparent);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
  }
  .modal-card {
    width: 100%; max-width: 460px;
    background: var(--c-surface);
    border-radius: 18px 18px 0 0;
    display: flex; flex-direction: column;
    max-height: 90dvh; overflow: hidden;
    animation: sheet-up .22s ease;
  }
  @keyframes sheet-up { from { transform: translateY(20px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
  @media (min-width: 560px) {
    .modal-overlay { align-items: center; padding: 16px; }
    .modal-card { border-radius: 18px; }
  }
  .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--c-border); }
  .modal-title { margin: 0; font-size: 17px; font-weight: 800; }
  .modal-close { border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--c-text-soft); cursor: pointer; padding: 0 4px; }
  .modal-close:hover { color: var(--c-text); }
  .modal-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field-label { font-size: 13px; font-weight: 700; color: var(--c-text-soft); }
  .field input, .field textarea {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--c-border); border-radius: var(--radius-md);
    background: var(--c-surface-2); color: var(--c-text);
    padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical;
  }
  .field input:focus, .field textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 18%, transparent); }
  .pe-colors { display: flex; gap: 10px; flex-wrap: wrap; }
  .pe-color { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--c-border); }
  .pe-color.selected { border-color: var(--c-text); box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-primary); }
  .pe-avatar { display: flex; align-items: center; gap: 14px; }
  .pe-avatar-preview .avatar { border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 18%, transparent); }
  .pe-avatar-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
  .modal-foot { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--c-border); }
  .modal-foot .btn-primary, .modal-foot .btn-ghost { flex: 1; }
  .btn-ghost { padding: 11px 16px; border: 1px solid var(--c-border); background: var(--c-surface); border-radius: var(--radius-md); font-size: 15px; font-weight: 700; color: var(--c-text); cursor: pointer; }
  .btn-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); }

  .stat-row2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 14px 8px;
    text-align: center;
  }
  .stat-row2 .st { display: flex; flex-direction: column; gap: 2px; }
  .stat-row2 .st-n { font-size: 18px; font-weight: 800; color: var(--c-text); }
  .stat-row2 .st-l { font-size: 12px; color: var(--c-text-soft); }

  .lv-box { padding: 14px 16px; }
  .lv-top {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; font-weight: 700; color: var(--c-text-soft);
    margin-bottom: 8px;
  }
  .lv-top span:last-child { color: var(--c-primary); }
  .lv-track { height: 10px; background: var(--c-surface-2); border-radius: var(--radius-pill); overflow: hidden; }
  .lv-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-primary-dark)); border-radius: var(--radius-pill); }
}

/* ============================ 18+ 门 / 加载中 / 登录 ============================ */
.age-gate {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--c-overlay-strong) 92%, transparent);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.age-card {
  width: 100%; max-width: 380px;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.age-emoji { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.age-title { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.age-desc { margin: 0 0 18px; font-size: 14px; line-height: 1.7; color: var(--c-text-soft); }
.age-actions { display: flex; flex-direction: column; gap: 10px; }
.age-tip { margin: 16px 0 0; font-size: 12px; color: var(--c-text-soft); line-height: 1.6; }
.age-leave {
  position: fixed; inset: 0; z-index: 101;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
  background: var(--c-surface); color: var(--c-text-soft); font-size: 16px; line-height: 1.8;
}
.age-leave-emoji { font-size: 48px; }

/* 全局加载遮罩（方案A：挥手转圈） */
.global-loading {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-surface);
  transition: opacity .45s ease;
}
.global-loading.is-hiding { opacity: 0; }
.loading-stage { position: relative; width: 240px; height: 240px; display: flex; align-items: center; justify-content: center; }
.loading-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.loading-track { stroke: var(--c-surface-2, #F8D7EA); }
.loading-bar { stroke: url(#loadingCandy); stroke-linecap: round; transition: stroke-dashoffset .15s linear; }
.loading-doll { position: relative; width: 140px; max-width: 56%; height: auto; transform-origin: 50% 90%; animation: loadingSway 1.6s ease-in-out infinite; }
.loading-doll.celebrate { animation: loadingJump .55s ease; }
.loading-star { position: absolute; font-size: 22px; color: #8FD8E8; opacity: 0; transform: scale(0); pointer-events: none; }
.loading-star.pop { animation: loadingPop .7s ease forwards; }
.loading-pct { margin-top: 4px; font-size: 40px; font-weight: 800; color: #D36BB4; letter-spacing: 2px; line-height: 1; }
.loading-text { font-size: 14px; color: var(--c-text-soft); font-weight: 600; letter-spacing: 2px; }
@keyframes loadingSway {
  0%, 100% { transform: rotate(-2.5deg) translateY(0); }
  50%      { transform: rotate(2.5deg) translateY(-7px); }
}
@keyframes loadingJump {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-26px) scale(1.04); }
  60%  { transform: translateY(0) scale(.98); }
  80%  { transform: translateY(-8px); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes loadingPop {
  0%   { opacity: 0; transform: scale(0) rotate(0deg); }
  45%  { opacity: 1; transform: scale(1.25) rotate(20deg); }
  100% { opacity: 0; transform: scale(.6) rotate(40deg) translateY(-14px); }
}
@media (max-width: 400px) { .loading-stage { width: 196px; height: 196px; } .loading-doll { width: 116px; } }
@media (prefers-reduced-motion: reduce) {
  .loading-doll { animation: none; }
  .loading-bar { transition: none; }
  .loading-star.pop { animation: none; opacity: 0; }
}

.header-login {
  flex: 0 0 auto;
  font-size: 13px; font-weight: 700; color: var(--c-primary);
  text-decoration: none; padding: 6px 4px;
  white-space: nowrap;
}
.header-login:hover { text-decoration: underline; }
.header-user { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 2px; }
.header-user .avatar { border-radius: 50%; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-primary) 35%, transparent); }
.header-user:hover { opacity: .85; }

.login-card { padding: 28px 22px; max-width: 420px; margin: 8px auto 0; }
.login-title { margin: 0 0 6px; font-size: 21px; font-weight: 800; text-align: center; }
.login-sub { margin: 0 0 18px; font-size: 13px; color: var(--c-text-soft); text-align: center; line-height: 1.6; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.login-tab {
  flex: 1; padding: 10px; border: 1px solid var(--c-border); background: var(--c-surface);
  border-radius: var(--radius-md); font-size: 15px; font-weight: 700; color: var(--c-text-soft); cursor: pointer;
}
.login-tab.active { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }
.login-card .form-group label { font-size: 13px; font-weight: 700; color: var(--c-text-soft); margin-top: 12px; }
.login-card .form-group input {
  width: 100%; box-sizing: border-box; margin-top: 6px;
  border: 1px solid var(--c-border); border-radius: var(--radius-md);
  background: var(--c-surface-2); color: var(--c-text);
  padding: 11px 12px; font-size: 14px; font-family: inherit;
}
.login-card .form-group input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 18%, transparent); }
.login-error { color: var(--c-danger, #e5484d); font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 10px; }
.login-note { margin: 16px 0 0; font-size: 12px; color: var(--c-text-soft); line-height: 1.6; text-align: center; }
.btn-block { width: 100%; margin-top: 16px; padding: 12px 16px; border: none; border-radius: var(--radius-md); background: var(--c-primary); color: var(--c-on-primary); font-size: 15px; font-weight: 800; cursor: pointer; }
.btn-block:hover { background: var(--c-primary-dark); }

/* ==================== 线性矢量图标系统（替代 emoji） ==================== */
@layer components {
  .icon {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -0.18em;
  }
  /* 评分星：实心=已评（填色），空心=未评（描边） */
  .star { display: inline-flex; color: var(--c-text-soft); }
  .star .icon { width: 1em; height: 1em; }
  .star.on { color: var(--c-star); }
  .star.on .icon { fill: currentColor; }
  .star.off { opacity: .35; }

  .rb-stars, .rv-stars, .rt-stars, .score-stars { display: inline-flex; gap: 1px; color: var(--c-star); }

  /* 头部 */
  .brand-logo { width: 20px; height: 20px; }
  .theme-toggle .icon { width: 17px; height: 17px; }
  .header-search .hs-icon { width: 17px; height: 17px; flex: 0 0 auto; }

  /* 底栏 */
  .bn-icon { display: inline-flex; align-items: center; justify-content: center; height: 23px; }
  .bn-icon .icon { width: 22px; height: 22px; }
  @media (min-width: 860px) { .bn-icon .icon { width: 24px; height: 24px; } }

  /* 悬浮发帖按钮 */
  .fab .icon { width: 22px; height: 22px; }

  /* 统计/操作行内联图标 */
  .stat .icon, .rv-plain .icon, .rt-foot .icon, .rv-act .icon,
  .ac-meta .icon, .pl-label .icon, .pc-meta .icon, .si-meta .icon,
  .comment-row .stat .icon { width: 14px; height: 14px; }
  .rv-act .icon, .act .icon { width: 15px; height: 15px; }

  /* 体感标签 */
  .feel-icon { display: inline-flex; color: var(--c-primary); }
  .feel-icon .icon { width: 22px; height: 22px; }

  /* 年龄门 / 退出页 */
  .age-emoji, .age-leave-emoji { display: inline-flex; color: var(--c-primary); }
  .age-emoji .icon, .age-leave-emoji .icon { width: 46px; height: 46px; }

  /* 板块 Tab（交流页）图标 */
  .plate-tabs a .icon { width: 14px; height: 14px; }

  /* 空状态 */
  .empty-icon { display: inline-flex; color: var(--c-text-soft); }
  .empty-icon .icon { width: 34px; height: 34px; }

  /* ============================================================
     首页顶部：四宫格专区入口
     已删除「pill 内容筛选行」——它与底部 Tab 目的地重复；
     只保留这一排：杯友杂谈 / 活动福利 / 穿搭分享 / 热门圣杯（各自跳对应域）
     ============================================================ */
  .home-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin: 2px 0 12px;
  }
  .quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 2px 10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--c-text);
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, transform .18s ease;
  }
  .quick-item:hover { background: var(--c-surface-2); transform: translateY(-1px); }
  .quick-item:active { transform: scale(.96); }
  .quick-item:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -2px; }
  .qi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--c-primary-soft);
    color: var(--c-primary);
  }
  .qi-icon .icon { width: 22px; height: 22px; }
  .qi-label { font-size: 11.5px; font-weight: 700; line-height: 1.2; text-align: center; }

  /* 信息流排序 Tab */
  .home-feed-tabs {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 14px 0 10px;
    border-bottom: 1px solid var(--c-border);
  }
  .hft {
    position: relative;
    padding: 8px 2px 10px;
    border: none;
    background: none;
    color: var(--c-text-soft);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }
  .hft.active { color: var(--c-text); }
  .hft.active::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -1px;
    width: 22px; height: 3px;
    border-radius: 2px;
    background: var(--c-primary);
    transform: translateX(-50%);
  }
  .hft:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

  .home-feed { display: flex; flex-direction: column; gap: 12px; }
  /* 单品筛选下的「看全部」入口：与卡片区分开，避免误点进卡片 */
  .feed-more {
    display: block;
    margin-top: 4px;
    padding: 12px;
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface-2);
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }
  .feed-more:hover { border-color: var(--c-primary); }

  /* 帖子卡：作者信息统一置顶（与测评卡一致） */
  .post-item .pi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
  }
  .post-item .pi-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--c-text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
  }
  .post-item .pi-author span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .post-item .pi-author:hover { color: var(--c-primary); }
  .post-item .pi-time { flex: 0 0 auto; font-size: 12px; color: var(--c-text-soft); }
  .post-item .pi-foot {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--c-border);
    font-size: 12px;
    color: var(--c-text-soft);
  }
  .post-item .pi-foot .stat { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
  .post-item .pi-foot a.stat:hover { color: var(--c-primary); }
  /* 信息流里的测评卡：星级与「查看全文」沿用底栏节奏 */
  .post-item.rv-feed .pi-foot .stat .star .icon { width: 13px; height: 13px; }
  .post-item .pi-foot .rv-more {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-primary);
    text-decoration: none;
  }
  .post-item .pi-foot .rv-more:hover { text-decoration: underline; }
  .post-item .pi-foot .pi-del {
    margin-left: auto; flex: 0 0 auto; background: none; border: 1px solid var(--c-border);
    border-radius: var(--radius-md); color: var(--c-danger, #e5484d); font-size: 12px;
    padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  }
  .post-item .pi-foot .pi-del:hover { border-color: var(--c-danger, #e5484d); background: color-mix(in srgb, var(--c-danger, #e5484d) 10%, transparent); }
  .pa-btn.pa-del { color: var(--c-danger, #e5484d); border-color: color-mix(in srgb, var(--c-danger, #e5484d) 40%, var(--c-border)); }
  .pa-btn.pa-del:hover { background: color-mix(in srgb, var(--c-danger, #e5484d) 12%, transparent); border-color: var(--c-danger, #e5484d); color: var(--c-danger, #e5484d); }
}

/* ============================ UTILITIES ============================ */
@layer utilities {
  .back-link { display: inline-block; margin-bottom: 12px; color: var(--c-text-soft); font-size: 14px; }
  .back-link:hover { color: var(--c-primary); }
}

/* ==================== 交互细节增强：hover / 空状态 / 加载态 / Toast ==================== */
@layer components {

  /* —— 卡片 hover：统一可点击卡片悬停反馈（仅指针设备） —— */
  @media (hover: hover) {
    .card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-md);
      border-color: color-mix(in srgb, var(--c-primary) 40%, var(--c-border));
    }
    .rb-row {
      transition: background-color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);
    }
    .rb-row:hover { background: var(--c-surface-2); transform: translateX(3px); }
    .rb-row:hover .rb-name { color: var(--c-primary); }
    .side-row {
      transition: background-color var(--motion-fast) var(--ease);
      border-radius: var(--radius-sm);
    }
    .side-row:hover { background: var(--c-surface-2); }
    .side-row:hover .sr-name { color: var(--c-primary); }
    .quick-item:active { transform: scale(.97); }
  }

  /* —— 空状态增强 —— */
  .empty { gap: var(--sp-3); }
  .empty--card {
    background: var(--c-surface);
    border: 1px dashed color-mix(in srgb, var(--c-primary) 40%, var(--c-border));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin: var(--sp-4) 0;
  }
  .empty-icon { color: var(--c-primary); opacity: 1; display: inline-flex; }
  .empty-icon .icon { width: 38px; height: 38px; }
  .empty-action {
    margin-top: var(--sp-2);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-pill);
    background: var(--c-primary); color: var(--c-on-primary);
    font-weight: 700; font-size: 14px; border: 0; cursor: pointer;
    text-decoration: none;
    transition: background-color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);
  }
  .empty-action:hover { background: var(--c-primary-dark); }
  .empty-action:active { transform: scale(.97); }

  /* —— 加载态：骨架屏 —— */
  .skeleton {
    position: relative; overflow: hidden;
    background: var(--c-surface-2);
    border-radius: var(--radius-sm);
  }
  .skeleton::after {
    content: ""; position: absolute; inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c-surface) 85%, var(--c-text) 7%), transparent);
    animation: shimmer 1.2s infinite;
  }
  @keyframes shimmer { 100% { transform: translateX(100%); } }
  .sk-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius-md); padding: 14px 16px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .sk-line { height: 12px; border-radius: 6px; }
  .sk-line.w-40 { width: 40%; } .sk-line.w-60 { width: 60%; }
  .sk-line.w-80 { width: 80%; } .sk-line.w-100 { width: 100%; }
  .sk-thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); flex: none; }
  .sk-row { display: flex; gap: 12px; align-items: center; }
  .skeleton-wrap { display: flex; flex-direction: column; gap: 12px; }
  .sk-card, .sk-row { position: relative; }

  /* —— 加载态：全局遮罩（暗色细化） —— */
  .global-loading { background: color-mix(in srgb, var(--c-bg) 82%, transparent); backdrop-filter: blur(2px); }
  .loading-stage { width: 210px; height: 210px; }

  /* —— Toast 通知 —— */
  .toast-wrap {
    position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
    transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 10px; align-items: center;
    z-index: 2000; pointer-events: none; width: max-content; max-width: 90vw;
  }
  .toast {
    pointer-events: auto;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 16px; border-radius: var(--radius-pill);
    background: var(--c-text); color: var(--c-bg);
    font-size: 14px; font-weight: 600; line-height: 1.2;
    box-shadow: var(--shadow-lg);
    animation: toast-in .26s var(--ease) both;
  }
  .toast.leaving { animation: toast-out .22s var(--ease) both; }
  .toast .icon { width: 18px; height: 18px; flex: none; }
  .toast.toast-success { background: var(--c-primary); color: var(--c-on-primary); }
  .toast.toast-error { background: #e5484d; color: #fff; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.96); } }

  /* —— 动效降级守卫 —— */
  @media (prefers-reduced-motion: reduce) {
    .toast, .toast.leaving { animation: none; }
    .skeleton::after { animation: none; }
    .card:hover, .rb-row:hover, .side-row:hover { transform: none; }
  }
}
