/* 熊圈论坛 - 现代化主题
   配色：靛蓝主调 + 琥珀点缀，支持深色模式 */

/* ===== 主题变量 ===== */
:root {
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --accent: #f59e0b;
  --accent-soft: #fff7ed;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --surface-3: #f2f4f9;

  --text: #0f172a;
  --text-2: #4b5563;
  --text-3: #94a3b8;

  --border: #e6e9f0;
  --border-2: #f0f2f7;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .09);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --header-h: 66px;
  --maxw: 1180px;
}

[data-theme="dark"] {
  --brand: #6366f1;
  --brand-2: #818cf8;
  --brand-dark: #4f46e5;
  --brand-soft: #1e2440;
  --accent: #fbbf24;
  --accent-soft: #2a2113;

  --bg: #0a0e1a;
  --surface: #121829;
  --surface-2: #161d31;
  --surface-3: #1b2338;

  --text: #e9edf7;
  --text-2: #a3aec6;
  --text-3: #6c7896;

  --border: #232c45;
  --border-2: #1a2237;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

a { color: var(--brand); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-dark); }

::selection { background: rgba(99, 102, 241, .22); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-left { flex-shrink: 0; }
.header-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.header-right { flex-shrink: 0; display: flex; gap: 10px; align-items: center; }

.logo-link { display: flex; align-items: center; gap: 11px; color: var(--text); }
.logo-link:hover { color: var(--text); }

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 55%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .32);
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.logo-link:hover .logo-icon { transform: rotate(-8deg) scale(1.06); }

.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-title {
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -.01em;
  background: linear-gradient(120deg, var(--text) 20%, var(--brand) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-subtitle { font-size: .68rem; color: var(--text-3); letter-spacing: .02em; }

/* 搜索框 */
.search-box { width: 100%; max-width: 340px; position: relative; }
.search-box::before {
  content: '';
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat center / contain;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 9px 15px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  background: var(--surface-3);
  color: var(--text);
  transition: all .2s ease;
  outline: none;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .13);
}

/* 主题切换按钮 */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s ease;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); }
.theme-toggle svg { width: 17px; height: 17px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: .855rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .18s cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .28);
}
.btn-primary:hover {
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .38);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline:hover { background: var(--brand-soft); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-block { width: 100%; padding: 11px 20px; }
.btn-sm { padding: 6px 14px; font-size: .8rem; border-radius: 9px; }

.btn svg { width: 15px; height: 15px; }

/* ===== Main ===== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, #4f46e5 0%, #6366f1 42%, #8b5cf6 100%);
  padding: 30px 32px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-md);
  color: #fff;
}
.hero::before {
  content: '';
  position: absolute;
  top: -70px; right: -50px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255, 255, 255, .2) 0%, transparent 68%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -90px; left: 12%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, .12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-text h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.hero-text p {
  font-size: .9rem;
  opacity: .9;
  margin: 0;
}

.hero-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-stat {
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 14px;
  padding: 11px 18px;
  min-width: 84px;
  text-align: center;
  transition: transform .2s ease, background .2s ease;
}
.hero-stat:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .24); }
.hero-stat b {
  display: block;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.hero-stat span {
  font-size: .74rem;
  opacity: .88;
  letter-spacing: .02em;
}

/* ===== 分类卡片 ===== */
.category-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.category-section:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--cat, var(--brand)) 35%, var(--border));
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--cat, var(--brand)) 7%, var(--surface)) 0%,
    var(--surface) 60%);
  transition: background .2s ease;
}
.category-header:hover {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--cat, var(--brand)) 13%, var(--surface)) 0%,
    var(--surface-2) 60%);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
}

.category-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cat, var(--brand)) 0%,
    color-mix(in srgb, var(--cat, var(--brand)) 65%, #fff) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--cat, var(--brand)) 38%, transparent);
}
.category-icon svg { width: 18px; height: 18px; }

.cat-count {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.category-toggle {
  color: var(--text-3);
  font-size: .8rem;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.category-toggle.collapsed { transform: rotate(-90deg); }

.category-body { transition: all .3s ease; }
.category-body.collapsed { display: none; }

/* ===== 子版块 ===== */
.subforum-list { width: 100%; }

.subforum-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: 15px;
  align-items: center;
  padding: 13px 20px;
  border-top: 1px solid var(--border-2);
  transition: background .16s ease;
  cursor: pointer;
}
.subforum-row:hover { background: var(--surface-2); }
.subforum-row:hover .subforum-name { color: var(--cat, var(--brand)); }

.subforum-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--cat, var(--brand)) 11%, var(--surface));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s ease, transform .18s ease;
}
.subforum-row:hover .subforum-icon {
  background: color-mix(in srgb, var(--cat, var(--brand)) 18%, var(--surface));
  transform: scale(1.05);
}
.subforum-icon svg { width: 21px; height: 21px; fill: none; }
.subforum-icon svg path, .subforum-icon svg circle, .subforum-icon svg rect { stroke: var(--cat, var(--brand)); }

.subforum-info { min-width: 0; }
.subforum-name {
  font-size: .94rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .16s ease;
}
.subforum-meta {
  font-size: .78rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subforum-stats {
  text-align: center;
  min-width: 66px;
  padding: 3px 8px;
  border-radius: 9px;
  background: var(--surface-3);
}
.subforum-stats .count {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.subforum-stats .label { font-size: .68rem; color: var(--text-3); }

.subforum-last {
  text-align: right;
  min-width: 108px;
  font-size: .76rem;
  color: var(--text-3);
  line-height: 1.4;
}
.subforum-last .last-user {
  color: var(--text-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 108px;
}

/* 三级子板块 */
.subsubforum-list {
  padding: 2px 16px 9px 76px;
  border-top: 1px solid var(--border-2);
  background: var(--surface-2);
}
.subsubforum-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 7px;
  transition: background .15s ease;
}
.subsubforum-row:hover { background: color-mix(in srgb, var(--cat, var(--brand)) 11%, transparent); }
.subsubforum-arrow { color: var(--text-3); font-size: .72rem; flex-shrink: 0; }
.subsubforum-name {
  font-size: .82rem;
  color: var(--text-2);
  font-weight: 500;
  transition: color .15s ease;
}
.subsubforum-row:hover .subsubforum-name { color: var(--cat, var(--brand)); }

/* ===== 面包屑 ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 16px;
  font-size: .84rem;
  color: var(--text-2);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb-sep { color: var(--text-3); }
.breadcrumb-current { color: var(--text); font-weight: 600; }

/* 版块标题条 */
.forum-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ===== 帖子列表 ===== */
.thread-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.thread-list-header {
  display: grid;
  grid-template-columns: 1fr 76px 76px 130px;
  gap: 14px;
  padding: 11px 20px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  font-size: .76rem;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: .02em;
}

.thread-row {
  display: grid;
  grid-template-columns: 1fr 76px 76px 130px;
  gap: 14px;
  align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-2);
  transition: background .16s ease;
  cursor: pointer;
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--surface-2); }

.thread-info { min-width: 0; }
.thread-title {
  font-size: .93rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.thread-row:hover .thread-title { color: var(--brand); }
.thread-meta { font-size: .77rem; color: var(--text-3); }
.thread-author { color: var(--brand); font-weight: 600; }

.thread-stat {
  text-align: center;
  font-size: .8rem;
  color: var(--text-3);
}
.thread-stat .num {
  font-weight: 700;
  color: var(--text-2);
  font-size: .88rem;
}

.thread-last {
  font-size: .76rem;
  color: var(--text-3);
  text-align: right;
  line-height: 1.45;
  overflow: hidden;
}

.pinned-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* ===== 帖子详情 ===== */
.thread-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 18px;
}

.thread-detail-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.thread-detail-title {
  font-size: 1.32rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
  letter-spacing: -.01em;
  color: var(--text);
}
.thread-detail-meta {
  font-size: .8rem;
  color: var(--text-2);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.thread-detail-meta span { display: inline-flex; align-items: center; gap: 5px; }

.post-item {
  display: flex;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-2);
  transition: background .16s ease;
}
.post-item:hover { background: var(--surface-2); }
.post-item:last-child { border-bottom: none; }

.post-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(79, 70, 229, .24);
}

.post-body { flex: 1; min-width: 0; }
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}
.post-author { font-weight: 700; font-size: .9rem; color: var(--text); }
.post-time { font-size: .76rem; color: var(--text-3); }
.post-floor {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 6px;
}
.post-floor.op { background: var(--brand-soft); color: var(--brand); }

.post-content {
  font-size: .92rem;
  line-height: 1.8;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.post-signature {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  font-size: .77rem;
  color: var(--text-3);
}

/* 回复框 */
.reply-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.reply-box h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.reply-box h3::before {
  content: '';
  width: 3px; height: 15px;
  border-radius: 2px;
  background: var(--brand);
}
.reply-box textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  resize: vertical;
  min-height: 118px;
  outline: none;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.7;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.reply-box textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.reply-box textarea::placeholder { color: var(--text-3); }

/* ===== 分页 ===== */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 22px 0 4px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all .16s ease;
  font-family: inherit;
}
.pagination button:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}
.pagination button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(79, 70, 229, .28);
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .18s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .24s cubic-bezier(.34, 1.4, .64, 1);
  max-height: 88vh;
  overflow-y: auto;
}
.modal-lg { max-width: 620px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.16rem; font-weight: 700; color: var(--text); }
.modal-close {
  background: var(--surface-3);
  border: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  font-size: 1.15rem;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all .16s ease;
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-2);
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .87rem;
  outline: none;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-3); }
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.form-group textarea { resize: vertical; line-height: 1.7; }
.form-error {
  color: #dc2626;
  font-size: .8rem;
  margin-bottom: 10px;
  min-height: 1em;
}

/* ===== 用户区 ===== */
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .86rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .26);
  transition: transform .18s ease;
}
.user-avatar:hover { transform: scale(1.06); }
.user-name { font-size: .86rem; font-weight: 600; color: var(--text); }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 76px; height: 76px; margin-bottom: 14px; opacity: .55; }
.empty-state h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-2);
}
.empty-state p { font-size: .84rem; }

/* ===== 加载骨架 ===== */
.loading { padding: 20px 0; }
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.skel-line {
  height: 13px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-2) 50%, var(--surface-3) 75%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite;
  margin-bottom: 10px;
}
.skel-line:last-child { margin-bottom: 0; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 30px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  font-size: .95rem;
}
.footer-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: .83rem;
}
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--brand); }
.footer-inner p { font-size: .8rem; color: var(--text-3); }
.footer-sub { margin-top: 4px; font-size: .76rem; }

/* ===== 民珍品牌矩阵 ===== */
.brand-matrix {
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}
.brand-matrix-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.brand-matrix-ico { font-size: 1.1rem; }
.brand-matrix-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}
.brand-matrix-desc {
  font-size: .74rem;
  color: var(--text-3);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.brand-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.brand-card:hover {
  transform: translateY(-3px);
  border-color: var(--b);
  background: var(--surface);
  box-shadow: 0 10px 24px -12px var(--b);
}
.brand-card-ico {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  border-radius: 12px;
  margin-bottom: 6px;
  background: color-mix(in srgb, var(--b) 16%, transparent);
}
.brand-card-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}
.brand-card-domain {
  font-size: .7rem;
  color: var(--text-3);
}
@media (max-width: 520px) {
  .brand-matrix-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .brand-matrix-desc { display: none; }
  .brand-card { padding: 13px 8px; }
  .brand-card-ico { width: 38px; height: 38px; font-size: 1.25rem; }
}

/* 备案号 */
.footer-beian { margin-top: 10px; font-size: .78rem; color: var(--text-3); }
.footer-beian a { color: var(--text-3); }
.footer-beian a:hover { color: var(--brand); }

/* ===== 返回顶部 ===== */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px; height: 42px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all .25s cubic-bezier(.34, 1.4, .64, 1);
  z-index: 300;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.to-top svg { width: 18px; height: 18px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .header-center { max-width: 220px; }
  .subforum-last { display: none; }
  .subforum-row { grid-template-columns: 44px 1fr auto; }
  .thread-row, .thread-list-header { grid-template-columns: 1fr 62px 62px; }
  .thread-last { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 60px; }

  .header-inner { padding: 0 14px; gap: 10px; }
  .header-center { display: none; }
  .logo-subtitle { display: none; }
  .main-content { padding: 16px 14px 40px; }

  .hero { padding: 22px 20px; border-radius: var(--radius-lg); }
  .hero-text h1 { font-size: 1.28rem; }
  .hero-stats { gap: 8px; width: 100%; }
  .hero-stat { flex: 1; min-width: 0; padding: 9px 10px; }
  .hero-stat b { font-size: 1.1rem; }

  .subforum-row {
    grid-template-columns: 40px 1fr;
    gap: 12px;
    padding: 12px 16px;
  }
  .subforum-stats { display: none; }
  .subsubforum-list { padding-left: 56px; }

  .thread-list-header { display: none; }
  .thread-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 12px 16px;
  }
  .thread-stat { display: none; }
  .thread-title { white-space: normal; }

  .post-item { padding: 16px; gap: 12px; }
  .post-avatar { width: 40px; height: 40px; font-size: 1rem; border-radius: 12px; }
  .thread-detail-header { padding: 18px 16px; }
  .thread-detail-title { font-size: 1.1rem; }

  .reply-box { padding: 18px 16px; }

  .to-top { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}

@media (max-width: 480px) {
  .header-right .btn { padding: 6px 12px; font-size: .78rem; }
  .logo-title { font-size: 1.02rem; }
  .category-header { padding: 13px 15px; }
  .category-title { font-size: .95rem; gap: 9px; }
  .category-icon { width: 30px; height: 30px; }
  .user-name { display: none; }
  .modal { padding: 20px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
