/* =============================================================
   牢大之家 · 奶块攻略论坛主题
   浅色 / 深色双主题（html[data-theme]）
   ============================================================= */

/* ============ 设计变量：浅色（默认） ============ */
:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --bg-2: #fbf7f1;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-2: #fdf3e3;
  --surface-hover: #fff3e2;
  --border: #e7e0d6;
  --border-soft: #eee5d8;
  --text: #2b2622;
  --text-2: #4a4139;
  --muted: #5b524a;
  --muted-2: #9a8d7e;
  --accent: #b45e00;
  --accent-2: #8f4a00;
  --accent-soft: rgba(180, 94, 0, 0.12);
  --accent-grad: linear-gradient(135deg, #c66a00, #b45e00);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.12);
  --success: #3f8a4a;
  --warning: #b07a16;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(59, 42, 23, 0.05), 0 2px 8px rgba(59, 42, 23, 0.06);
  --shadow-lg: 0 4px 12px rgba(59, 42, 23, 0.09), 0 12px 28px rgba(59, 42, 23, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

/* ============ 设计变量：深色 ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1510;
  --bg-2: #241c15;
  --panel: rgba(48, 35, 25, 0.78);
  --panel-2: #3a2a1c;
  --surface-hover: #33251a;
  --border: #473525;
  --border-soft: #3a2c1f;
  --text: #f3e9dc;
  --text-2: #ddcfbd;
  --muted: #b3a08b;
  --muted-2: #8a7862;
  --accent: #ff9d4d;
  --accent-2: #ffb478;
  --accent-soft: rgba(255, 157, 77, 0.16);
  --accent-grad: linear-gradient(135deg, #ffb478, #f08a2c);
  --danger: #e0614f;
  --danger-soft: rgba(224, 97, 79, 0.16);
  --success: #62b95f;
  --warning: #e0b74a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 18px; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* 主题切换图标 */
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

/* ============ 布局 ============ */
#app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  z-index: 76;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  overflow-y: auto;
}
#sidebar-inner { display: flex; flex-direction: column; height: 100%; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 17px;
  color: var(--text);
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  font-size: 17px;
}
.brand-text { color: var(--text); }
img.brand-mark { object-fit: cover; background: none; }
.auth-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { flex: 0 0 auto; opacity: 0.85; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.side-user { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.side-user-main { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.side-user-main:hover { background: var(--surface-hover); }
.side-user-text { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.side-user-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-actions { display: flex; gap: 8px; margin-top: 10px; }

.mini-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mini-btn:hover { color: var(--text); border-color: var(--muted-2); background: var(--surface-hover); }
.mini-btn.danger { color: var(--danger); border-color: rgba(217, 83, 79, 0.45); background: transparent; }
.mini-btn.danger:hover { background: var(--danger-soft); }
.mini-btn.warning { color: var(--warning); border-color: rgba(184, 134, 11, 0.45); background: transparent; }
.mini-btn.warning:hover { background: rgba(184, 134, 11, 0.12); }
.mini-btn.primary { color: #fff; border-color: var(--accent); background: var(--accent); }
.mini-btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.shell { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
}
.brand-mobile { display: none; font-weight: 700; letter-spacing: 0.12em; font-size: 15px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }
.badge-dot {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
}
.avatar-btn { border: none; background: none; padding: 0; margin-left: 4px; border-radius: 50%; }
.avatar-btn .avatar { border: 1px solid var(--border); }
.avatar-btn .top-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
}
.avatar-btn .top-login:hover { background: var(--accent-2); }

.view { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 22px 90px; flex: 1; }

.only-mobile { display: none; }
.overlay { display: none; }

/* ============ 通用组件 ============ */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--panel-2);
}
.avatar-gen {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(140deg, hsl(var(--h, 200) 55% 50%), hsl(calc(var(--h, 200) + 40) 55% 42%));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted-2); background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(0.94); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--muted-2); }
.chip.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(0, 136, 204, 0.35); font-weight: 600; }
html[data-theme="dark"] .chip.active { border-color: rgba(62, 166, 224, 0.45); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field textarea, .form-stack input, .form-stack textarea, .form-stack select,
.searchbar input, .comment-form input, .chat-form textarea, .compose-row select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
.field input:focus, .field textarea:focus, .form-stack input:focus, .form-stack textarea:focus,
.form-stack select:focus, .searchbar input:focus, .comment-form input:focus, .chat-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card h3 { font-size: 16px; margin-bottom: 14px; }

.skeleton {
  height: 110px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-emoji { font-size: 36px; margin-bottom: 10px; }
.empty p { font-size: 15px; color: var(--text); }
.empty small { display: block; margin-top: 6px; color: var(--muted); }

.back-link { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 14px; background: none; border: none; padding: 0; font-family: inherit; cursor: pointer; }
.back-link:hover { color: var(--accent); }

/* ============ 首页 / 信息流 ============ */
.feed-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.feed-hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.feed-hero p { color: var(--muted); font-size: 14px; margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 18px; }
.searchbar input { flex: 1; }
.search-hint { color: var(--muted); font-size: 13px; margin: -10px 0 14px; }

.post-list {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-card {
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
  padding: 16px 18px;
  transition: background 0.15s;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: var(--surface-hover); }
.post-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.post-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pa-text { display: flex; flex-direction: column; min-width: 0; }
.pa-text strong { font-size: 14px; }
.pa-text span { font-size: 12px; color: var(--muted); }
.tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 4px;
  color: var(--accent);
  background: var(--accent-soft);
  white-space: nowrap;
  font-weight: 500;
}
.post-title { display: block; font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.post-title:hover { color: var(--accent); }
.post-body { color: var(--text-2); font-size: 14px; }
.post-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-img { display: block; margin-top: 12px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-soft); }
.post-img img { display: block; width: 100%; max-height: 420px; object-fit: cover; }
.post-actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.act:hover { color: var(--text); background: var(--panel-2); }
.act.liked { color: var(--danger); }
.act.danger { margin-left: auto; color: var(--danger); }
.act.static { cursor: default; }
.act.static:hover { background: transparent; color: var(--muted); }
.act svg { display: block; }

.list-footer { display: flex; justify-content: center; margin-top: 18px; }

/* ============ 板块 ============ */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.board-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s, background 0.15s;
}
.board-card:hover { border-color: var(--accent); background: var(--surface-hover); }
.board-icon { font-size: 28px; }
.board-info { flex: 1; min-width: 0; }
.board-info strong { font-size: 15px; }
.board-info p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.board-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ============ 帖子详情 ============ */
.post-list > .post-card.detail { border-bottom: none; }
.post-card.detail {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  cursor: default;
}
.post-card.detail:hover { background: var(--panel); }
.detail-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 14px; }
.detail-body { font-size: 15.5px; color: var(--text-2); line-height: 1.8; }
.detail-img { margin-top: 16px; }

.comments { margin-top: 26px; }
.comments h3 { font-size: 16px; margin-bottom: 14px; }
.comments h3 .muted { font-weight: 400; }
.comment-form { display: flex; gap: 8px; margin-bottom: 18px; }
.comment-form input { flex: 1; }
.comment-list { display: flex; flex-direction: column; gap: 2px; }
.comment {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 6px;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-soft);
}
.comment:last-child { border-bottom: none; }
.comment:hover { background: var(--surface-hover); }
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.comment-meta a { font-size: 13.5px; font-weight: 600; }
.comment-meta span { font-size: 11.5px; color: var(--muted); }
.comment-main p { font-size: 14px; color: var(--text-2); word-break: break-word; }
.comment-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* ============ 个人主页 ============ */
.profile-cover {
  height: 112px;
  border-radius: var(--radius);
  background:
    radial-gradient(320px 160px at 15% 0%, var(--accent-soft), transparent 70%),
    var(--panel-2);
  border: 1px solid var(--border-soft);
  margin-bottom: -42px;
}
.profile-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0 22px 20px;
  position: relative;
}
.profile-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding-top: 14px; }
.profile-top .avatar { border: 4px solid var(--panel); margin-top: -42px; box-shadow: var(--shadow); }
.profile-actions { display: flex; gap: 8px; padding-bottom: 4px; }
.profile-card h1 { font-size: 22px; margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-uid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.profile-uid strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.profile-handle { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.profile-bio { color: var(--text-2); font-size: 14px; margin-top: 10px; }
.profile-stats { display: flex; gap: 22px; margin-top: 14px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.profile-stats strong { color: var(--text); font-size: 15px; margin-right: 3px; }

.tabs { display: flex; gap: 4px; margin: 20px 0 14px; border-bottom: 1px solid var(--border-soft); }
.tab {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.user-list { display: flex; flex-direction: column; gap: 6px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s, background 0.15s;
}
.user-row:hover { border-color: var(--accent); background: var(--surface-hover); }
.user-row div { display: flex; flex-direction: column; }
.user-row strong { font-size: 14px; }
.user-row span { font-size: 12.5px; color: var(--muted); }

/* ============ 角色徽章 / UID ============ */
.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.role-badge.role-owner { color: #8a5a00; background: #fff4d6; border-color: #f0d9a0; }
.role-badge.role-co { color: #a1386e; background: #fdeef5; border-color: #f4cfe0; }
.role-badge.role-admin { color: #1467a8; background: #e8f4fc; border-color: #c2e0f5; }
.role-badge.role-member { color: #55606e; background: #f1f3f6; border-color: #e0e4e9; }
.role-badge.role-guest { color: #6b7280; background: #f3f4f6; border-color: #e5e7eb; }
html[data-theme="dark"] .role-badge.role-owner { color: #f0c15c; background: rgba(240, 193, 92, 0.12); border-color: rgba(240, 193, 92, 0.32); }
html[data-theme="dark"] .role-badge.role-co { color: #f08cbd; background: rgba(240, 140, 189, 0.12); border-color: rgba(240, 140, 189, 0.3); }
html[data-theme="dark"] .role-badge.role-admin { color: #6db8e8; background: rgba(109, 184, 232, 0.12); border-color: rgba(109, 184, 232, 0.3); }
html[data-theme="dark"] .role-badge.role-member { color: #aeb6c2; background: rgba(174, 182, 194, 0.1); border-color: rgba(174, 182, 194, 0.26); }
html[data-theme="dark"] .role-badge.role-guest { color: #9aa3b2; background: rgba(154, 163, 178, 0.1); border-color: rgba(154, 163, 178, 0.26); }

.uid-chip {
  display: inline-block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 0 4px;
  white-space: nowrap;
  vertical-align: middle;
}
.side-user-text strong { display: flex; align-items: center; gap: 5px; min-width: 0; }
.side-user-text strong .role-badge { flex: none; }
.side-user-text .side-uid { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.side-user-text .side-handle { font-size: 11px; color: var(--muted-2); }
.guest-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px dashed var(--border);
  flex: 0 0 auto;
}

/* ============ 私信 ============ */
.msg-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 14px;
  height: calc(100vh - 60px - 70px);
  height: calc(100dvh - 130px);
  min-height: 460px;
}
.conv-list {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.panel-title { font-size: 15px; font-weight: 700; padding: 4px 8px 10px; }
.conv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
}
.conv:hover { background: var(--surface-hover); }
.conv.active { background: var(--accent-soft); }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-top strong { font-size: 14px; }
.conv-top span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.conv-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.unread-pill {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.chat-pane {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-empty { margin: auto; color: var(--muted); font-size: 14px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.chat-user { display: flex; align-items: center; gap: 10px; }
.chat-user div { display: flex; flex-direction: column; }
.chat-user strong { font-size: 14px; }
.chat-user span { font-size: 12px; color: var(--muted); }
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
  background: var(--bg);
}
html[data-theme="dark"] .chat-messages { background: var(--bg); }
.chat-empty-inline { margin: auto; color: var(--muted); font-size: 13.5px; }
.bubble {
  max-width: 74%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  position: relative;
}
.bubble.them { align-self: flex-start; background: var(--panel); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { display: block; font-size: 10px; opacity: 0.6; margin-top: 3px; text-align: right; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border-soft); background: var(--panel); }
.chat-form textarea { flex: 1; resize: none; max-height: 110px; }

/* ============ 通知 ============ */
.notif-list { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.notif {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}
.notif:last-child { border-bottom: none; }
.notif.unread { background: var(--accent-soft); }
.notif-main { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; color: var(--text-2); }
.notif-text a { color: var(--accent); font-weight: 600; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ============ 管理后台 / 管理中心 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card span { font-size: 12.5px; color: var(--muted); }
.stat-card strong { font-size: 24px; font-weight: 700; color: var(--text); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-hover); }
.cell-user { display: flex; align-items: center; gap: 9px; }
.cell-user span { display: flex; flex-direction: column; font-size: 13.5px; }
.cell-user small { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.admin-table td { vertical-align: middle; }
.admin-table .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.role-select {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12.5px;
  outline: none;
}
.role-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ban-tag { color: var(--danger); font-size: 12px; font-weight: 600; }
.ok-tag { color: var(--success); font-size: 12px; }
.row-banned td { opacity: 0.72; }
.self-tag { color: var(--accent); font-size: 10.5px; border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
.cell-sub { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.cat-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger-soft, rgba(220, 53, 69, 0.14));
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mod-excerpt { max-width: 320px; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.avatar-review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.avatar-review-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.avatar-review-info strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-review-info small { color: var(--muted-2); font-size: 11px; }
.ai-policy-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.policy-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.policy-history li { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.policy-history-text { font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.policy-history small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 11px; }
#ai-policy-form textarea { min-height: 160px; }

/* ============ 设置 ============ */
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.file-label { cursor: pointer; }
#avatar-preview .avatar { border: 1px solid var(--border); }

/* ============ 弹窗 ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 18px 18px;
  animation: fadeIn 0.16s ease;
}
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.18s ease;
  max-height: 84vh;
  overflow-y: auto;
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-head h3 { font-size: 17px; }
#compose-form { padding: 14px 20px 20px; }
.compose-title { font-size: 17px !important; font-weight: 600; }
.compose-row { display: flex; gap: 9px; align-items: center; }
.compose-row select { flex: 1; }
#compose-preview { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
#compose-preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
#compose-preview .mini-btn { position: absolute; top: 8px; right: 8px; background: var(--panel); }

/* 自定义操作弹窗（封禁 / 解封 / 删除 / 改角色） */
.action-modal { max-width: 440px; }
.action-modal-body { padding: 14px 20px 20px; }
.action-modal-text { color: var(--text-2); font-size: 14px; line-height: 1.6; margin: 0; }
.action-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.action-modal-actions .btn { min-width: 88px; }

/* 访客登录引导 */
.login-prompt { text-align: center; padding: 26px 24px 20px; max-width: 380px; }
.login-prompt-icon { font-size: 34px; margin-bottom: 8px; }
.login-prompt h3 { font-size: 18px; margin-bottom: 8px; }
.login-prompt p { font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.login-prompt-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin: 18px 0 12px; }
.login-prompt .mini-btn { margin: 0 auto; }
.login-required { padding-top: 60px; }
.login-required .login-prompt-actions { margin-top: 20px; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ============ AI 助手 ============ */
.ai-launch {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  transition: background 0.18s, border-color 0.18s;
}
.ai-launch:hover { border-color: var(--accent); background: var(--accent-soft); }
.ai-launch svg { color: var(--accent); }

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 84px;
  z-index: 80;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn 0.18s ease;
}
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--border-soft); }
.ai-title { display: flex; align-items: center; gap: 10px; }
.ai-title div { display: flex; flex-direction: column; }
.ai-title strong { font-size: 14px; letter-spacing: 0.04em; }
.ai-title small { font-size: 11px; color: var(--muted); }
.ai-orb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #8ed8f5, var(--accent) 55%, #1d6fa5);
  flex: 0 0 auto;
}
.ai-orb.big { width: 48px; height: 48px; margin: 0 auto 10px; }
.ai-orb-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}
.ai-orb-img.big { width: 66px; height: 66px; display: block; margin: 0 auto 10px; }
.ai-launch-img { width: 34px; height: 34px; object-fit: contain; }

.ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-welcome { text-align: center; margin-top: 24px; }
.ai-welcome h4 { font-size: 16px; margin-bottom: 5px; }
.ai-welcome p { font-size: 13px; color: var(--muted); max-width: 260px; margin: 0 auto 14px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ai-suggest .chip { font-size: 12px; padding: 5px 11px; }

.ai-msg { display: flex; gap: 8px; align-items: flex-start; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
.ai-msg.user .ai-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.assistant .ai-bubble { background: var(--panel-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.ai-bubble code { background: rgba(127, 127, 127, 0.16); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.ai-bubble pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px; overflow-x: auto; margin: 6px 0; }
.ai-bubble pre code { background: none; padding: 0; }
.ai-bubble ul { margin: 6px 0 6px 18px; }
.ai-bubble h3, .ai-bubble h4, .ai-bubble h5 { margin: 8px 0 4px; font-size: 14px; }
.ai-mini-orb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 3px;
  background: radial-gradient(circle at 32% 28%, #8ed8f5, var(--accent) 55%, #1d6fa5);
}
img.ai-mini-orb { background: none; object-fit: contain; border-radius: 4px; }
.ai-bubble.typing { display: flex; gap: 4px; align-items: center; }
.ai-bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.ai-bubble.typing i:nth-child(2) { animation-delay: 0.2s; }
.ai-bubble.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.ai-form { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--border-soft); align-items: flex-end; background: var(--panel); }
.ai-form textarea {
  flex: 1;
  resize: none;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13.5px;
  max-height: 120px;
  outline: none;
}
.ai-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-send {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.ai-send:hover { background: var(--accent-2); }

/* ============ 登录页 ============ */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}
.auth-aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(520px 380px at 18% 8%, var(--accent-soft), transparent 65%),
    radial-gradient(460px 360px at 85% 92%, var(--accent-soft), transparent 65%),
    var(--bg);
}
.auth-theme {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  background: var(--panel);
  border: 1px solid var(--border);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s ease;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
  color: #fff;
}
.auth-brand h1 { font-size: 21px; letter-spacing: 0.1em; }
.auth-brand p { font-size: 12.5px; color: var(--muted); }
.auth-tabs {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { margin-top: 4px; padding: 11px; }
.auth-hint { font-size: 12px; color: var(--muted); text-align: center; }
.verify-channels { display: flex; gap: 8px; }
.verify-channels .chip { flex: 1; justify-content: center; padding: 7px 10px; font-size: 13px; }
.verify-row { display: flex; gap: 8px; align-items: stretch; }
.verify-row input { flex: 1; min-width: 0; }
.verify-row .btn { white-space: nowrap; padding: 0 12px; font-size: 13px; }
.verify-row .btn:disabled { opacity: 0.6; cursor: default; }
#verify-status { margin: 0; min-height: 16px; text-align: left; }
#verify-status.is-error { color: var(--danger); }
.auth-error {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(217, 83, 79, 0.35);
}
.auth-visitor { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; }
.auth-guest-link { display: block; text-align: center; font-size: 13px; color: var(--muted); margin-top: 10px; }
.auth-guest-link:hover { color: var(--accent); }

/* ============ 响应式 / 移动端适配 ============ */
:root { --topbar-h: calc(60px + env(safe-area-inset-top)); }

@media (max-width: 1000px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.3, 0.8, 0.4, 1);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.18);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: translateX(0); }
  .shell { margin-left: 0; }
  .overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 74;
  }
  .brand-mobile { display: block; }
  .only-mobile { display: grid; }

  .topbar {
    height: var(--topbar-h);
    padding-top: env(safe-area-inset-top);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  /* 私信：进入会话后整屏聊天 */
  .msg-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .conv-list { max-height: calc(100dvh - 220px); }
  .msg-layout.chat-open .conv-list { display: none; }
  .msg-layout:not(.chat-open) .chat-pane { display: none; }
  .msg-layout.chat-open .chat-pane {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    height: calc(100dvh - var(--topbar-h));
    z-index: 45;
    display: flex;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .chat-form { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  body:has(.msg-layout.chat-open) { overflow: hidden; }
  body:has(.msg-layout.chat-open) .ai-launch,
  body:has(.msg-layout.chat-open) .ai-panel { display: none; }

  .ai-panel {
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    height: calc(100dvh - 120px);
    max-height: none;
  }
}

@media (max-width: 640px) {
  .view { padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }
  .feed-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
  .feed-hero h1 { font-size: 21px; }
  .board-grid { grid-template-columns: 1fr; }
  .detail-title { font-size: 20px; }
  .profile-card { padding: 0 15px 16px; }
  .profile-stats { gap: 14px; }
  .ai-launch { right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); padding: 10px 14px; }
  .ai-launch span { display: none; }
  .ai-panel {
    right: 8px;
    left: 8px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    height: calc(100dvh - 92px - env(safe-area-inset-bottom));
    border-radius: var(--radius-lg);
  }
  .ai-form { padding-bottom: calc(11px + env(safe-area-inset-bottom)); }
  .comment-form { flex-wrap: wrap; }
  .comment-form input { flex: 1 1 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* 输入框统一 16px，避免 iOS 聚焦时自动放大页面 */
  .field input, .field textarea, .form-stack input, .form-stack textarea, .form-stack select,
  .searchbar input, .comment-form input, .chat-form textarea, .ai-form textarea, .compose-row select {
    font-size: 16px;
  }

  /* 触控热区不小于 44px */
  .icon-btn { width: 44px; height: 44px; }
  .act { padding: 9px 12px; font-size: 13.5px; }
  .mini-btn { padding: 9px 14px; }
  .chip { padding: 8px 14px; }

  /* 弹窗改为底部抽屉 */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none;
    max-height: 90dvh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheetIn 0.24s ease;
  }
  .modal-head { padding: 15px 18px 0; }
  #compose-form { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
  .compose-row { flex-wrap: wrap; }
  .compose-row select { flex: 1 1 100%; }

  /* 长内容不撑破屏幕 */
  .post-body, .detail-body, .bubble, .ai-bubble, .notif-text { overflow-wrap: anywhere; }
  .post-card { padding: 14px 15px; }
  .post-card.detail { padding: 16px; }
  .post-head { gap: 8px; }
  .pa-text { min-width: 0; }
  .pa-text strong, .pa-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }

  /* 登录页 */
  .auth-body { padding: max(18px, env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); align-content: center; }
  .auth-card { padding: 24px 20px; }
  .auth-brand h1 { font-size: 19px; }
  .auth-theme { top: max(10px, env(safe-area-inset-top)); right: 10px; }
}

@keyframes sheetIn { from { opacity: 0.6; transform: translateY(36px); } to { opacity: 1; transform: none; } }

/* ============ 声明书与同意 ============ */
.consent-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(8, 10, 14, 0.66);
  backdrop-filter: blur(6px);
}
.consent-gate.hidden { display: none; }
body.consent-locked { overflow: hidden; }
.consent-panel {
  width: min(720px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}
.consent-head h2 { margin: 0 0 6px; font-size: 19px; }
.consent-head p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.consent-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 6px 4px 0;
  margin-bottom: 12px;
}
.consent-doc-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 8px 12px;
  margin-bottom: 8px;
}
.consent-doc-item summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.consent-doc { margin-top: 8px; max-height: 260px; overflow-y: auto; padding-right: 4px; color: var(--text-2); font-size: 13px; line-height: 1.7; }
.consent-doc h4 { margin: 10px 0 4px; font-size: 13px; color: var(--text); }
.consent-doc p { margin: 0 0 6px; }
.consent-doc ul { margin: 0 0 6px; padding-left: 20px; }
.consent-check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.consent-check input { margin-top: 2px; accent-color: var(--accent); }
.consent-leave { margin: 8px 0 0; text-align: center; color: var(--muted-2); font-size: 12px; }
.auth-consent { margin: 4px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.auth-consent .consent-doc-item { background: transparent; }
.auth-consent .consent-doc { max-height: 200px; }
.auth-consent .consent-check { margin: 10px 0 0; }
.auth-consent .consent-check.is-warn { color: var(--danger); }

.backup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
.backup-meta strong { color: var(--text); }
.backup-error { color: var(--danger); }

@media (max-width: 640px) {
  .consent-gate { padding: 0; }
  .consent-panel { width: 100%; height: 100%; max-height: none; border-radius: 0; padding: max(16px, env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .consent-doc { max-height: 210px; }
}

/* ============ 暖色攻略站皮肤（参考 nkwiki.cc） ============ */

/* 暖米色底 + 暖光晕 */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(255, 168, 76, 0.16), transparent 62%),
    radial-gradient(900px 520px at -8% 6%, rgba(255, 226, 180, 0.32), transparent 58%);
  background-attachment: fixed;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(1000px 560px at 88% -10%, rgba(255, 157, 77, 0.1), transparent 62%),
    radial-gradient(760px 480px at -6% 4%, rgba(120, 80, 40, 0.22), transparent 60%);
}

/* 毛玻璃面板 */
.card, .ai-panel, .modal, .login-prompt, .consent-panel, .action-modal,
.post-list, .stat-card, .profile-card, .conv-list, .chat-pane {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.post-list { overflow: hidden; }
.post-list .post-card { background: transparent; }
.post-list .post-card:hover { background: var(--surface-hover); }

/* 顶栏 / 侧栏：半透明玻璃 */
.topbar {
  background: rgba(255, 253, 248, 0.72);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
html[data-theme="dark"] .topbar { background: rgba(30, 22, 15, 0.72); }
.sidebar {
  background: rgba(255, 253, 248, 0.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border-soft);
}
html[data-theme="dark"] .sidebar { background: rgba(32, 24, 16, 0.84); }

/* 导航项 */
.nav-item { border-radius: 10px; }
.nav-item.active {
  background: var(--surface-hover);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* 按钮 */
.btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, filter 0.15s ease;
}
html[data-theme="dark"] .btn { background: rgba(255, 255, 255, 0.05); }
.btn:hover { background: #fff; border-color: var(--border); box-shadow: var(--shadow); }
html[data-theme="dark"] .btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(180, 94, 0, 0.28);
}
.btn-primary:hover { background: var(--accent-grad); border-color: transparent; filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-glass {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
.mini-btn { border-radius: 8px; }
.mini-btn.primary { background: var(--accent-grad); border-color: transparent; }

/* 输入框 */
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { background: rgba(255, 255, 255, 0.06); }

/* 标签 / 徽章：药丸 */
.chip { border-radius: 999px; background: rgba(255, 255, 255, 0.7); }
.chip.active { background: #fff3e2; border-color: #efd3ae; color: var(--accent); }
html[data-theme="dark"] .chip.active { background: rgba(255, 157, 77, 0.16); border-color: rgba(255, 157, 77, 0.35); }
.tag { border-radius: 999px; background: #fdf3e3; border: 1px solid #f3ddc0; color: #b45309; }
html[data-theme="dark"] .tag { background: rgba(255, 157, 77, 0.14); border-color: rgba(255, 157, 77, 0.3); color: var(--accent); }
.role-badge, .uid-chip { border-radius: 999px; }
.avatar { border-radius: 50%; }

/* 分区标题：左侧橙色竖条 */
.feed-hero h1 { position: relative; padding-left: 14px; }
.feed-hero h1::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 1.05em;
  border-radius: 3px;
  background: var(--accent-grad);
}
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3::before {
  content: '';
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent-grad);
}

/* 首页英雄横幅 */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  min-height: 330px;
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("/img/hero-laoda.jpg");
  background-size: cover;
  background-position: center right;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(28, 17, 8, 0.86) 0%, rgba(28, 17, 8, 0.6) 40%, rgba(28, 17, 8, 0.06) 74%);
}
.hero-inner { position: relative; padding: 34px 32px; max-width: 470px; color: #fff; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.36);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hero h1 {
  font-size: 40px;
  line-height: 1.12;
  margin: 12px 0 8px;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.hero p { font-size: 15px; color: rgba(255, 255, 255, 0.88); }
.hero-search { display: flex; gap: 8px; margin-top: 18px; }
.hero-search input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.94);
  color: #2b2622;
}
.hero-search .btn { border-radius: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hero-actions .btn { border-radius: 12px; }

/* 分区标题（更多链接） */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 12px;
}
.section-head h2 { font-size: 17px; letter-spacing: 0.02em; }
.section-head a { font-size: 13px; color: var(--accent); }
.section-head a:hover { text-decoration: underline; }
.home-boards { margin-bottom: 20px; }

/* 板块入口卡 */
.board-grid { gap: 14px; }
.board-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 18px;
  border-radius: 14px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.board-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-grad);
}
.board-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #e8d2b4;
  background: var(--panel);
}
.board-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 12px;
  background: #fff3e2;
  border: 1px solid #f3ddc0;
  flex: 0 0 auto;
}
html[data-theme="dark"] .board-icon { background: rgba(255, 157, 77, 0.14); border-color: rgba(255, 157, 77, 0.28); }
.board-count { font-size: 12px; color: #b45309; background: #fdf3e3; border-radius: 999px; padding: 3px 10px; }
html[data-theme="dark"] .board-count { background: rgba(255, 157, 77, 0.14); color: var(--accent); }

/* AI 浮标 */
.ai-launch {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.ai-launch:hover { background: #fff; border-color: #efd3ae; }
html[data-theme="dark"] .ai-launch { background: rgba(48, 35, 25, 0.9); }

/* 登录页 */
.auth-theme { background: rgba(255, 255, 255, 0.82); border: 1px solid var(--border-soft); }
.auth-tabs { border-radius: 10px; background: var(--panel-2); }
.auth-card { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* 移动端底部导航 */
.bottom-nav { display: none; }
@media (max-width: 1000px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 73;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 248, 0.9);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border-soft);
  }
  html[data-theme="dark"] .bottom-nav { background: rgba(30, 22, 15, 0.92); }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 0 3px;
    font-size: 11px;
    color: var(--muted);
    border-radius: 10px;
  }
  .bottom-nav a.active { color: var(--accent); background: var(--surface-hover); font-weight: 600; }
  .ai-launch { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* 移动端英雄横幅 */
@media (max-width: 640px) {
  .hero { min-height: 300px; border-radius: 16px; }
  .hero-inner { padding: 24px 20px; max-width: none; }
  .hero h1 { font-size: 29px; }
  .hero p { font-size: 13.5px; }
  .hero-search { margin-top: 14px; }
  .hero-bg { background-position: 68% center; }
  .hero::after { background: linear-gradient(180deg, rgba(28, 17, 8, 0.5) 0%, rgba(28, 17, 8, 0.82) 62%); }
}

/* 后台板块管理 */
.board-admin-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.board-admin-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  font-size: 14px;
}
html[data-theme="dark"] .board-admin-item { background: rgba(255, 255, 255, 0.06); }
.board-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.board-add-row input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  background: var(--bg-2);
  color: var(--text);
}

.brand-mobile-img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  vertical-align: -5px;
  margin-right: 6px;
}

/* ============ 装备图鉴（只读） ============ */
.codex-controls { margin-bottom: 16px; }
.codex-search { width: 100%; padding: 11px 14px; margin-bottom: 12px; font-size: 14.5px; }
.codex-groups { margin-bottom: 12px; }
.codex-filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.codex-filter-row select { flex: 1; min-width: 140px; padding: 9px 12px; font-size: 14px; }
.codex-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.codex-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px 12px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--tier, var(--border-soft));
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.codex-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.codex-tier {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--tier);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--tier);
}
html[data-theme="dark"] .codex-tier { background: rgba(0, 0, 0, 0.35); }
.codex-img { width: 64px; height: 64px; display: grid; place-items: center; margin-top: 10px; }
.codex-img img { max-width: 64px; max-height: 64px; object-fit: contain; image-rendering: pixelated; }
.codex-name { font-size: 14px; line-height: 1.35; }
.codex-cat { font-size: 11.5px; color: var(--muted); }
.codex-stats { font-size: 11.5px; color: var(--accent); min-height: 1em; }
.codex-pager { display: flex; justify-content: center; gap: 12px; margin: 18px 0 6px; }

/* 图鉴聚合页 */
.atlas-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.atlas-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.atlas-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.atlas-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.atlas-ico svg { width: 24px; height: 24px; }
.atlas-card strong { font-size: 16px; }
.atlas-count { font-size: 12px; color: var(--accent); font-weight: 600; }
.atlas-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 640px) { .atlas-grid { grid-template-columns: 1fr; } }

/* 装备图鉴页内 Tab（列表 / 强化表） */
.codex-page-tabs { margin: 0 0 16px; gap: 8px; }

/* 图鉴详情：字段表与分节 */
.codex-kv {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 13px;
}
.codex-kv dt { color: var(--muted); }
.codex-kv dd { margin: 0; color: var(--text); word-break: break-word; }
.codex-sections { display: flex; flex-direction: column; gap: 6px; }
.codex-sections p {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

/* 图鉴详情弹窗 */
.codex-detail {
  position: relative;
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px 22px 18px;
  border-top: 4px solid var(--tier, var(--accent));
}
.codex-close { position: absolute; top: 10px; right: 10px; }
.cd-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.cd-img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 6px;
  flex: 0 0 auto;
}
.cd-head-text h3 { font-size: 20px; margin: 4px 0; }
.cd-head-text p { font-size: 13px; color: var(--muted); }
.cd-head-text .codex-tier { position: static; display: inline-block; }
.codex-detail h4 { font-size: 14px; margin: 16px 0 8px; padding-left: 8px; border-left: 3px solid var(--accent); }
.cd-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cd-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.cd-stat strong { color: var(--accent); }
.cd-gems { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-gem {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  text-transform: capitalize;
}
.cd-gem.gem-green { color: #2f8f3f; border-color: #9ed7a8; }
.cd-gem.gem-red { color: #c0392b; border-color: #efb3ab; }
.cd-gem.gem-blue { color: #2470c7; border-color: #a9cdec; }
.cd-gem.gem-yellow, .cd-gem.gem-gold { color: #b07a16; border-color: #ecd9a0; }
.cd-mats { display: flex; flex-direction: column; gap: 6px; }
.cd-mat {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.cd-mat img { width: 28px; height: 28px; object-fit: contain; }
.cd-mat span { flex: 1; }
.cd-mat strong { color: var(--accent); }
.cd-template { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.cd-attrs { display: flex; flex-direction: column; gap: 8px; }
.cd-attr { display: flex; gap: 10px; align-items: flex-start; }
.cd-attr img { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; margin-top: 2px; }
.cd-attr strong { font-size: 13.5px; }
.cd-attr p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cd-desc { font-size: 13px; color: var(--text-2); }
.cd-note { margin-top: 16px; font-size: 12px; color: var(--muted-2); text-align: center; }

@media (max-width: 640px) {
  .codex-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .codex-card { padding: 12px 6px 10px; }
  .codex-name { font-size: 12.5px; }
  .codex-stats { display: none; }
  .codex-detail { padding: 18px 16px 14px; max-height: 88vh; }
}

/* ============ 宝石图鉴（只读） ============ */
.gem-tabs { margin-bottom: 12px; }
.gem-card {
  min-height: 240px;
  justify-content: flex-start;
  padding: 18px 12px 14px;
  gap: 6px;
  border-top-color: #5a9a4c;
}
.gem-card.gem-color-blue { border-top-color: #4386c6; }
.gem-card.gem-color-purple { border-top-color: #8a59b8; }
.gem-card.gem-color-orange { border-top-color: #d88635; }
.gem-series {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  color: #8f4a00;
  background: #fff3e2;
  border: 1px solid #efd3ae;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
html[data-theme="dark"] .gem-series { color: var(--accent); background: rgba(255, 157, 77, 0.14); border-color: rgba(255, 157, 77, 0.28); }
.gem-grid .codex-img { width: 96px; height: 96px; margin-top: 4px; }
.gem-grid .codex-img img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; image-rendering: auto; }
.gem-grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; }
.gem-card .codex-stats {
  margin-top: auto;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--accent);
  border: 1px solid var(--border-soft);
  min-height: 1em;
}

/* ============ 装备强化表 ============ */
.enchant-subtabs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.enchant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-1);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.enchant-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--fg-2);
}
.enchant-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  line-height: 1.6;
}
.enchant-table tr:last-child td { border-bottom: none; }
.enchant-table tr:hover td { background: var(--bg-2); }
.enchant-table td.neg { color: #c4564a; font-weight: 600; }
.enchant-badge {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 2px 1px 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.enchant-badge.lvl {
  background: #e8f4e8;
  color: #4c8a4c;
}
html[data-theme="dark"] .enchant-badge.lvl { background: rgba(92,168,92,.15); color: #8fd08f; }
.enchant-badge.hidden {
  background: #fff3e2;
  color: #b06b1e;
}
html[data-theme="dark"] .enchant-badge.hidden { background: rgba(210,140,60,.18); color: #eab475; }
.enchant-badge.lvl-sm {
  background: var(--bg-2);
  color: var(--accent);
  border: 1px solid var(--border-soft);
  font-size: 11px;
}
.enchant-levels { display: inline-block; margin-left: 4px; }
.gem-attribute-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.gem-attribute-card {
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.gem-attribute-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gem-attribute-head strong { font-size: 15px; }
.gem-attribute-head span { font-size: 11px; color: var(--muted); text-align: right; }
.gem-attribute-card > p { margin: 9px 0 12px; color: var(--text-2); font-size: 12.5px; line-height: 1.55; }
.gem-bonus-row { display: flex; flex-wrap: wrap; gap: 6px; }
.gem-bonus-row span { padding: 4px 7px; border-radius: 7px; background: var(--bg-2); color: var(--muted); font-size: 11px; }
.gem-bonus-row b { margin-left: 2px; color: var(--accent); }
.gem-attribute-card small { display: block; margin-top: 9px; color: var(--muted-2); font-size: 11px; }
.gem-detail-img { object-fit: contain; }
.gem-intro { margin: 12px 0 8px; color: var(--accent); font-weight: 600; font-size: 13px; }
.gem-detail-tabs { margin: 12px 0; }
.gem-detail-attrs { display: flex; flex-direction: column; gap: 9px; }
.gem-detail-attr { padding: 11px 12px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--bg-2); }
.gem-detail-attr > div:first-child { display: flex; align-items: center; gap: 8px; }
.gem-detail-attr strong { font-size: 13.5px; }
.gem-detail-attr p { margin: 6px 0 8px; color: var(--text-2); font-size: 12.5px; line-height: 1.55; }
.gem-detail-attr small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.gem-destiny { padding: 2px 7px; border-radius: 999px; color: #8b51ad; background: #f2e8f8; font-size: 10px; }
html[data-theme="dark"] .gem-destiny { color: #d0a6e8; background: rgba(160, 100, 200, 0.18); }
@media (max-width: 640px) {
  .gem-attribute-grid { grid-template-columns: 1fr; }
  .gem-attribute-card { padding: 12px; }
}
