:root {
  --bg: #0b0d12;
  --bg-soft: #12151d;
  --bg-panel: #12161f;
  --line: #222835;
  --line-soft: #1a1f2a;
  --text: #e7ebf3;
  --muted: #8b95a7;
  --dim: #626c7e;
  --accent: #5b8cff;
  --accent-2: #22d3a6;
  --danger: #ff5f74;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 输入框 / 卡片 / 悬停这类次级底色，抽出来好换主题 */
  --field: #0b0e14;
  --hover: #151a24;
  --shimmer-mid: #1a2029;
  --shimmer-edge: #12161f;
  --card-soft: #151a24;

  /* 娱乐区独立配色 */
  --game-bg: #1b1c21;
  --game-panel: #232529;
  --game-field: #131417;
  --game-key: #31343d;
  --game-key-hover: #3e424e;
  --game-text: #f3f4f8;
  --game-muted: #8b909c;

  /* 正文色：深色下是浅灰，浅色下必须压深，否则一片糊 */
  --text-body: #c9d2e0;
  --link-accent: #cddaff;

  /* 悬停态：浅色主题下要跟着变，否则白底一悬停就变黑 */
  --line-strong: #38415a;
  --card-hover: #141924;
  --text-strong: #ffffff;

  /* 滚动条 */
  --scroll-track: #0a0c11;
  --scroll-thumb: #2c3444;
  --scroll-thumb-hover: #435071;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* 常驻纵向滚动条：否则某些环境下滚动条自动隐藏，用户会以为页面滚不动 */
  overflow-y: scroll;
}

/* hidden 属性必须压过组件自身的 display（.form 用了 display:grid） */
[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -12%, rgba(91, 140, 255, .18), transparent 60%),
    radial-gradient(900px 520px at 92% 4%, rgba(34, 211, 166, .12), transparent 62%),
    var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

code {
  font-family: var(--mono);
  font-size: .9em;
  background: #1a1f2b;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .4em;
  color: #b9c6ff;
}

a { color: var(--accent); }

/* ================= 导航 ================= */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(18px, 5vw, 56px);
  background: rgba(11, 13, 18, .78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  color: var(--accent);
  font-size: 14px;
  filter: drop-shadow(0 0 10px rgba(91, 140, 255, .8));
}

.nav-links { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color .18s ease; }
.nav-links a:hover,
.nav-links a.is-active { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-links + .nav-actions { margin-left: 0; }

.who { color: var(--muted); font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid rgba(34, 211, 166, .35);
  background: rgba(34, 211, 166, .09);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ================= 布局 ================= */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(32px, 7vw, 76px) clamp(18px, 5vw, 32px) 64px;
}

main.narrow { max-width: 780px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--muted);
  margin: 0 0 18px;
}

.hero h1,
.page-head h1 {
  font-size: clamp(30px, 5.6vw, 52px);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: 0 0 18px;
  font-weight: 680;
}

.page-head h1 { font-size: clamp(26px, 4vw, 36px); }
.page-head { margin-bottom: 28px; }

.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 首页主标题：「欢迎来到」做引子，「资源技术论坛」做主体 */
.hero h1 .welcome {
  display: block;
  font-size: .56em;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 4px;
}

.hero h1 .site-name {
  display: block;
  letter-spacing: .01em;
  /* 渐变文字加点辉光，暗底上更立得住 */
  filter: drop-shadow(0 0 32px rgba(34, 211, 166, .22));
}

.lede { max-width: 62ch; color: #b3bdcd; margin: 0 0 28px; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ================= 按钮 ================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 560;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--text);
  background: #151923;
  cursor: pointer;
  transition: transform .14s ease, border-color .18s ease, background .18s ease, opacity .16s;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #6a97ff, #4a7bf0);
  border-color: #5b8cff;
  color: #06090f;
  font-weight: 650;
  box-shadow: 0 8px 26px -10px rgba(91, 140, 255, .85);
}

.btn.ghost { background: transparent; }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn.block { width: 100%; }

.btn.danger {
  background: linear-gradient(180deg, #ff7286, #e8475c);
  border-color: #ff5f74;
  color: #1a0508;
  font-weight: 650;
  box-shadow: 0 10px 28px -12px rgba(255, 95, 116, .9);
}

/* ================= 封禁通知遮罩 ================= */

.ban-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 4, 6, .84);
  backdrop-filter: blur(7px);
  animation: banFade .18s ease;
}

@keyframes banFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ban-card {
  width: 100%;
  max-width: 440px;
  padding: 32px 30px 26px;
  text-align: center;
  background: linear-gradient(180deg, #1c1016, #140b10);
  border: 1px solid rgba(255, 95, 116, .38);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 95, 116, .08),
    0 40px 90px -40px rgba(0, 0, 0, .95),
    0 0 70px -20px rgba(255, 95, 116, .35);
  animation: banPop .22s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes banPop {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.ban-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(255, 95, 116, .16);
  border: 1px solid rgba(255, 95, 116, .45);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
}

.ban-card h2 {
  margin: 0 0 12px;
  font-size: 19px;
  letter-spacing: -.01em;
  color: #ffdbe0;
}

.ban-msg {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.7;
  color: #ffb3bd;
  overflow-wrap: anywhere;
}

.ban-hint {
  margin: 0 0 22px;
  font-size: 12.5px;
  color: #8d6f76;
}

.ban-card .btn { width: 100%; }

/* ================= 卡片网格 ================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 14px;
  margin: 56px 0 0;
}

.card {
  background: linear-gradient(180deg, #141822, #10131a);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  transition: border-color .2s ease, transform .2s ease;
}

.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.card h2 { font-size: 15.5px; margin: 0 0 10px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }
.card code { background: #0d1017; }

/* ================= 内容列表 ================= */

.list-section { margin-top: 64px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2 { font-size: 16px; margin: 0; }

.hint { color: var(--dim); font-size: 12.5px; font-family: var(--mono); }

.post-list {
  display: grid;
  /* 不写 minmax(0,1fr) 的话，列宽是 auto，会被 nowrap 的长标题撑破整页 */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.post-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  transition: border-color .2s ease;
}

.post-card:hover { border-color: var(--line-strong); }

.post-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.post-card h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.post-meta { color: var(--dim); font-size: 12px; font-family: var(--mono); white-space: nowrap; }

.post-body {
  color: #aab4c4;
  font-size: 14.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-list.compact .post-card { padding: 16px 18px; }
.post-list.compact .post-card h3 { font-size: 14.5px; }

.skeleton {
  height: 92px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--shimmer-edge), var(--shimmer-mid), var(--shimmer-edge));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty { color: var(--dim); font-size: 14px; text-align: center; padding: 26px 4px; }

/* 卡片是 <a>：整块可点 */
.post-card {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.post-card header { align-items: baseline; min-width: 0; }

/* flex 子项默认 min-width:auto，不改成 0 省略号不会生效 */
.post-card h3 { flex: 1 1 auto; min-width: 0; }
.post-card .post-meta { flex: 0 0 auto; }

.post-card:hover .clamp-1 { color: var(--text-strong); }

/* 截断：标题单行，正文两行 */
.clamp-1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 右下角「查看更多」 */
.section-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  text-decoration: none;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.more-link:hover {
  color: var(--text);
  border-color: #3a465f;
  background: #151923;
}

.more-link .arrow { transition: transform .18s ease; }
.more-link:hover .arrow { transform: translateX(3px); }

/* 列表页：加载更多 */
.load-more-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 22px;
}

.load-more-wrap .fineprint { margin: 0; }

/* 详情页 */
.post-detail { padding-top: 4px; }

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--dim);
  font-size: 13.5px;
  text-decoration: none;
}

.back-link:hover { color: var(--text); }

.post-title {
  margin: 0 0 14px;
  font-size: clamp(25px, 4vw, 36px);
  line-height: 1.25;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.post-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 13px;
  font-family: var(--mono);
}

.post-byline .dot { opacity: .5; }

.post-content {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-error { text-align: center; padding: 56px 20px; }
.post-error h1 { margin: 0 0 12px; font-size: 22px; }
.post-error p { margin: 0 0 8px; color: var(--muted); }
.post-error .cta-row { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

/* 用户中心底部：退出登录 */
.account-foot {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.btn.signout {
  padding: 10px 26px;
  color: var(--muted);
}

.btn.signout:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(255, 95, 116, .45);
  background: rgba(255, 95, 116, .07);
}

/* ================= 资料卡：头像 + 昵称 + 简介 ================= */

.profile-panel { padding-top: 26px; }

.profile-main {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.avatar-btn {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #2a3450, #1a2233);
  cursor: pointer;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .2s ease;
}

.avatar-btn:hover { transform: translateY(-2px); }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 34px;
  font-weight: 600;
  color: #cdd8ff;
  background: linear-gradient(160deg, #2c3a5c, #1b2233);
  user-select: none;
}

.avatar-hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 5px 0;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: #dfe6f5;
  background: rgba(8, 10, 16, .72);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity .18s ease, transform .18s ease;
}

.avatar-btn:hover .avatar-hint,
.avatar-btn:focus-visible .avatar-hint {
  opacity: 1;
  transform: translateY(0);
}

/* 右侧可编辑字段 */
.profile-fields {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.profile-field {
  position: relative;
  display: grid;
  gap: 5px;
}

.pf-label {
  font-size: 11.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

.profile-field input,
.profile-field textarea {
  width: 100%;
  padding: 9px 58px 9px 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.profile-field textarea {
  resize: none;
  line-height: 1.6;
  font-size: 14px;
}

.profile-field input:focus,
.profile-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}

.profile-field input::placeholder,
.profile-field textarea::placeholder { color: #4e5769; }

.pf-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  pointer-events: none;
}

.profile-field:has(textarea) .pf-count { bottom: 9px; }

.pf-count.is-limit { color: var(--warn, #ffb84d); }

.pf-status {
  margin: 0;
  min-height: 18px;
  font-size: 12.5px;
  color: var(--dim);
  transition: color .16s ease;
}

.pf-status.is-ok { color: var(--accent-2); }
.pf-status.is-error { color: var(--danger); }

.profile-meta {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

/* ================= 头像灯箱 ================= */

.avatar-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 12, .82);
  backdrop-filter: blur(6px);
  animation: banFade .16s ease;
}

.lightbox-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .95);
}

.lightbox-preview {
  width: min(60vw, 340px);
  height: min(60vw, 340px);
  border-radius: 14px;
  overflow: hidden;
  background: var(--field);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.lightbox-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lightbox-preview.is-empty::after {
  content: attr(data-letter);
  font-size: 96px;
  font-weight: 600;
  color: #2f3a52;
}

.lightbox-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.lightbox-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--dim);
}

/* ================= 面板 ================= */

.panel {
  margin-top: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px clamp(18px, 3vw, 26px);
}

.panel h2 { font-size: 16px; margin: 0 0 18px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 { margin-bottom: 18px; }

/* 键值表 */
.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0;
}

.kv > div {
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.kv dt {
  font-size: 11.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.pill {
  font-size: 11px;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 18px;
}

.pill.is-admin {
  color: var(--accent-2);
  border-color: rgba(34, 211, 166, .35);
  background: rgba(34, 211, 166, .09);
}

/* ================= 表单 ================= */

.form { display: grid; gap: 14px; }
.form.inline { grid-template-columns: 1fr auto; align-items: end; gap: 12px; }
.form.inline .field.grow { min-width: 0; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); }

.field input {
  width: 100%;
  padding: 11px 13px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}

.field input::placeholder { color: #4e5769; }

/* 密码框 + 右侧显示开关 */
.pwd-wrap {
  position: relative;
  width: 100%;
}

.pwd-wrap input { padding-right: 44px; }

.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #59637a;
  cursor: pointer;
  transition: color .16s ease, background .16s ease;
}

.pwd-toggle:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.pwd-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pwd-toggle[aria-pressed="true"] { color: var(--accent); }

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 95, 116, .1);
  border: 1px solid rgba(255, 95, 116, .3);
  color: #ff8b9c;
  font-size: 13px;
}

.fineprint { margin: 0; color: var(--dim); font-size: 12.5px; }

/* ================= 登录页 ================= */

.auth-body {
  display: grid;
  place-items: center;
  padding: 48px 20px;
  background:
    radial-gradient(900px 500px at 18% -8%, rgba(91, 140, 255, .18), transparent 60%),
    radial-gradient(700px 420px at 90% 6%, rgba(34, 211, 166, .11), transparent 62%),
    var(--bg);
}

.auth-back {
  position: fixed;
  top: 22px;
  left: 26px;
  color: var(--dim);
  font-size: 13.5px;
  text-decoration: none;
}

.auth-back:hover { color: var(--text); }

.auth-wrap { width: 100%; max-width: 420px; }

.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 30px 24px;
  box-shadow: 0 40px 100px -50px rgba(0, 0, 0, .95);
}

.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand-mark { font-size: 20px; display: block; margin-bottom: 12px; }
.auth-head h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.015em; }
.auth-head p { margin: 0; color: var(--dim); font-size: 13.5px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 22px;
}

.tab {
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  background: #1b2230;
  color: var(--text);
  font-weight: 560;
}

.auth-foot {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

.auth-foot a { color: var(--muted); text-decoration: none; }
.auth-foot a:hover { color: var(--accent); }

/* ================= 页脚 ================= */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 30px 18px 44px;
  border-top: 1px solid var(--line);
  color: #5f6a7c;
  font-size: 13px;
}

.foot .dot { opacity: .5; }
.foot-link { color: var(--dim); text-decoration: none; }
.foot-link:hover { color: var(--text); }

/* ================= toast ================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  z-index: 99;
  padding: 10px 18px;
  border-radius: 10px;
  background: #1b2230;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { border-color: rgba(255, 95, 116, .5); color: #ff9aa8; }

/* ================= 左侧分栏 ================= */

:root { --side-w: 212px; }

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px 16px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
}

.has-side-nav { padding-left: var(--side-w); }

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .01em;
}

.side-links { display: grid; gap: 3px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.side-link svg { flex: none; opacity: .85; }

.side-link:hover { background: var(--hover); color: var(--text); }

.side-link.is-active {
  background: rgba(91, 140, 255, .13);
  border-color: rgba(91, 140, 255, .3);
  color: var(--link-accent);
  font-weight: 560;
}

.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.side-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 166, .28);
  background: rgba(34, 211, 166, .07);
  color: var(--accent-2);
  font-size: 12.5px;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease;
}

.side-admin:hover {
  background: rgba(34, 211, 166, .14);
  border-color: rgba(34, 211, 166, .5);
}

.side-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  transition: background .16s ease;
}

.side-user:hover { background: var(--hover); }

.side-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(160deg, #2a3450, #1a2233);
}

.side-avatar.is-text {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #cdd8ff;
}

.side-user-name {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-role {
  flex: none;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid rgba(34, 211, 166, .5);
  border-radius: 4px;
  color: var(--accent-2);
  font-size: 10px;
  line-height: 15px;
}

.side-login {
  display: block;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  text-decoration: none;
}

.side-login + .side-login { margin-top: 7px; }

.side-login.primary {
  background: linear-gradient(180deg, #6a97ff, #4a7bf0);
  border-color: #5b8cff;
  color: #06090f;
  font-weight: 600;
}

@media (min-width: 901px) {
  /* 宽屏时侧边栏承担全部导航，顶部那排就整个收起来，省出垂直空间 */
  .has-side-nav .nav { display: none; }
  .has-side-nav .chat-main { height: 100vh; }
}

@media (max-width: 900px) {
  .side-nav { display: none; }
  .has-side-nav { padding-left: 0; }
}

/* ================= 聊天中心 ================= */

.chat-main {
  display: flex;
  flex-direction: column;
  max-width: 880px;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 26px) 14px;
  height: calc(100vh - 63px);
  position: relative; /* 浮动「新消息」提示以此定位 */
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.chat-head h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 右上角「公告」入口 */
.chat-notice-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 166, .32);
  background: rgba(34, 211, 166, .08);
  color: var(--accent-2);
  font-size: 12px;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease;
}

.chat-notice-link:hover {
  background: rgba(34, 211, 166, .16);
  border-color: rgba(34, 211, 166, .55);
}

/* 输入区右侧的管理员按钮 */
.chat-announce-btn {
  flex: none;
  white-space: nowrap;
}

.chat-online {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--mono);
}

/* 上方提示条 */
.chat-notice {
  margin: 12px 0 0;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  background: rgba(255, 95, 116, .1);
  border: 1px solid rgba(255, 95, 116, .34);
  color: #ff9aa8;
  animation: noticeIn .16s ease;
}

.chat-notice.is-ok {
  background: rgba(34, 211, 166, .1);
  border-color: rgba(34, 211, 166, .34);
  color: var(--accent-2);
}

@keyframes noticeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 4px 6px;
}

.chat-list { display: grid; gap: 12px; }

.chat-empty {
  margin: 0;
  padding: 40px 0;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
}

.chat-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-item.is-mine { flex-direction: row-reverse; }

.chat-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(160deg, #2a3450, #1a2233);
}

.chat-avatar.is-text {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #cdd8ff;
}

.chat-bubble {
  min-width: 0;
  max-width: min(78%, 560px);
  padding: 8px 12px 9px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
}

.chat-item.is-mine .chat-bubble {
  background: rgba(91, 140, 255, .1);
  border-color: rgba(91, 140, 255, .3);
}

.chat-item.is-gone .chat-bubble { opacity: .6; }

.chat-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
  font-size: 11.5px;
}

.chat-name {
  color: var(--muted);
  font-weight: 560;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 管理员标签：绿色描边框 */
.chat-role {
  flex: none;
  padding: 0 6px;
  border: 1px solid rgba(34, 211, 166, .55);
  border-radius: 4px;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  background: rgba(34, 211, 166, .08);
  letter-spacing: .02em;
}

.chat-time {
  margin-left: auto;
  color: #4d5666;
  font-family: var(--mono);
  font-size: 10.5px;
}

.chat-text {
  font-size: 14px;
  line-height: 1.6;
  color: #d3dae6;
  overflow-wrap: anywhere;
  /* 允许换行：消息里最多 10 行，服务端已保证 */
  white-space: pre-wrap;
}
/* 输入区 */
/* 新消息分隔线：横线 + 中间小字 */
.chat-new-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 4px 6px;
  color: #7f8da3;
  font-size: 11px;
  letter-spacing: .02em;
}

.chat-new-divider::before,
.chat-new-divider::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(91, 140, 255, .5), transparent);
}

.chat-new-divider span {
  flex: none;
  padding: 0 2px;
}

/* 浮动未读提示 */
.chat-new-badge {
  position: absolute;
  left: 50%;
  bottom: 82px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 8px 18px;
  border: 1px solid rgba(91, 140, 255, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, #5b8cff, #4470e0);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
  box-shadow: 0 10px 26px -10px rgba(91, 140, 255, .9);
  animation: badgeIn .18s ease;
}

.chat-new-badge:hover { filter: brightness(1.08); }

@keyframes badgeIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.chat-compose {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.chat-input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.chat-input-wrap textarea {
  display: block;
  width: 100%;
  padding: 11px 92px 11px 14px; /* 右侧留出齿轮 + 字数的位置 */
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  resize: none;
  overflow-y: auto;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.chat-input-wrap textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}

.chat-input-wrap textarea::placeholder { color: #4e5769; }

/* 输入框右下角：齿轮 + 字数，并排一组，避免叠在一起 */
.chat-input-tools {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.chat-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  line-height: 1;
}

/* 输入设置齿轮 */
.chat-settings-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  pointer-events: auto;
  transition: color .16s ease, background .16s ease, transform .3s ease;
}

.chat-settings-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .07);
}

.chat-settings-btn.is-open {
  color: var(--accent);
  background: rgba(91, 140, 255, .14);
  transform: rotate(45deg);
}

/* 齿轮浮出的设置面板 */
.chat-settings-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: 232px;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--hover);
  box-shadow: 0 22px 50px -20px rgba(0, 0, 0, .9);
  animation: cspIn .14s ease;
}

@keyframes cspIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.csp-title {
  margin: 0 0 9px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .04em;
}

.csp-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.csp-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.csp-hint {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--dim);
}

.chat-count.is-limit { color: var(--warn, #ffb84d); }

.chat-compose .btn { flex: none; min-width: 84px; }

@media (max-width: 640px) {
  .chat-main {
    height: calc(100vh - 57px);
    padding: 12px 12px 10px;
  }
  .chat-bubble { max-width: 84%; }
  .chat-compose .btn { min-width: 68px; padding: 10px 14px; font-size: 13px; }
}

/* ================= 公告 ================= */

/* 聊天室顶部横幅 */
.chat-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 10px 9px 13px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 166, .3);
  background: linear-gradient(180deg, rgba(34, 211, 166, .1), rgba(34, 211, 166, .05));
  animation: noticeIn .18s ease;
}

.banner-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 166, .5);
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 16px;
}

.banner-title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-strong);
  font-size: 13.5px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-title:hover { color: var(--text-strong); text-decoration: underline; }

.banner-close {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.banner-close:hover { background: rgba(255, 255, 255, .08); color: var(--text); }

/* 模态弹窗（发布公告等） */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 12, .72);
  backdrop-filter: blur(4px);
  animation: banFade .16s ease;
}

.modal-card {
  width: min(100%, 520px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 22px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .95);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 620;
}

.modal-close {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.modal-close:hover { background: rgba(255, 255, 255, .08); color: var(--text); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* 详情页返回：宽屏时顶部导航被收起，返回键必须放在内容里 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  padding: 6px 13px 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.back-link:hover {
  color: var(--text);
  border-color: #33405a;
  background: var(--hover);
}

/* 公告列表 */
.notice-list { display: grid; gap: 12px; }

.notice-card {
  display: block;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  text-decoration: none;
  color: inherit;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}

.notice-card:hover {
  border-color: #33405a;
  background: #141924;
  transform: translateY(-1px);
}

.notice-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.notice-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-pin {
  flex: none;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 184, 77, .45);
  color: #ffb84d;
  font-size: 10.5px;
  line-height: 16px;
}

.notice-excerpt {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notice-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--dim);
}

.notice-meta .dot { opacity: .5; }

/* 公告详情 */
.notice-detail {
  padding: 26px 28px 30px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

.notice-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.notice-badge {
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 166, .5);
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
}

.notice-detail-head h1 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.notice-body {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.profile-actions .btn {
  padding: 9px 24px;
  font-size: 13.5px;
}

/* ================= 公开资料页 ================= */

.user-card { padding: 28px; }

.user-card-body {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.user-card-avatar {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(160deg, #2a3450, #1a2233);
}

.user-card-avatar.is-text {
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 600;
  color: #cdd8ff;
}

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

.user-card-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-card-name h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-bio {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.user-card-bio .is-muted { color: var(--dim); font-style: italic; }

.user-card-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--dim);
}

/* 聊天里的头像/昵称可点 */
.chat-avatar-link {
  display: block;
  flex: none;
  border-radius: 50%;
  text-decoration: none;
  transition: transform .14s ease, box-shadow .16s ease;
}

.chat-avatar-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, .4);
}

a.chat-name { text-decoration: none; }
a.chat-name:hover { color: var(--text); text-decoration: underline; }

/* 表单里的勾选项 */
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.65;
  resize: vertical;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}

/* ================= 帖子 ================= */

.thread-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px clamp(14px, 3vw, 26px) 90px;
}

.thread-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.thread-head h1 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: -.01em;
}

.thread-sorts {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.sort-btn {
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.sort-btn:hover { color: var(--text); }

.sort-btn.is-active {
  background: rgba(91, 140, 255, .16);
  color: var(--link-accent);
  font-weight: 560;
}

.thread-list { display: grid; gap: 12px; }

.thread-card {
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  transition: border-color .16s ease, background .16s ease;
}

.thread-card:hover { border-color: var(--line-strong); background: var(--card-hover); }

.thread-card-main {
  display: block;
  padding: 17px 20px 12px;
  text-decoration: none;
  color: inherit;
}

.thread-card h2 {
  margin: 0 0 8px;
  font-size: 16.5px;
  font-weight: 620;
  color: var(--text);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-excerpt {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 14px;
  font-size: 11.5px;
  color: var(--dim);
}

.thread-author {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
  min-width: 0;
}

.thread-author:hover { color: var(--text); }

.thread-avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(160deg, #2a3450, #1a2233);
}

.thread-avatar.is-text {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #cdd8ff;
}

.thread-time { margin-left: auto; font-family: var(--mono); }

.thread-stats {
  display: inline-flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
}

.thread-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.thread-stat svg { opacity: .8; }

/* 右下角发帖 */
.fab-compose {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #6a97ff, #4a7bf0);
  color: #06090f;
  font: inherit;
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 14px 34px -14px rgba(91, 140, 255, .8);
  transition: transform .16s ease, box-shadow .16s ease;
}

.fab-compose:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -14px rgba(91, 140, 255, .95);
}

/* 帖子详情 */
.thread-detail {
  padding: 26px 28px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

.thread-detail-head h1 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.4;
  letter-spacing: -.01em;
}

.thread-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--dim);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.thread-detail-meta .dot { opacity: .5; }

.thread-body {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-detail-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.thread-owner-actions { display: flex; gap: 8px; }

/* 资料页统计 */
.user-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.user-stat svg { opacity: .75; }

/* 点赞按钮 */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.like-btn:hover:not(:disabled) {
  color: #ff7a8f;
  border-color: rgba(255, 95, 116, .45);
  background: rgba(255, 95, 116, .07);
}

.like-btn.is-liked {
  color: #ff7a8f;
  border-color: rgba(255, 95, 116, .5);
  background: rgba(255, 95, 116, .1);
}

.like-btn.is-liked .like-icon { transform: scale(1.1); }

.like-icon { color: #ff5f74; }

.like-count {
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid rgba(255, 255, 255, .12);
  font-family: var(--mono);
  font-size: 12px;
}

.like-btn.small { padding: 5px 14px; font-size: 12.5px; }

/* 评论 */
.comment-block { margin-top: 24px; }

.comment-title {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--muted);
}

.comment-title span { color: var(--dim); font-family: var(--mono); }

.comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.comment-form textarea {
  flex: 1 1 auto;
  padding: 10px 13px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}

.comment-form .btn { flex: none; }

.comment-list { display: grid; gap: 14px; }

.comment-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.comment-body {
  margin: 6px 0 4px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-time { font-size: 10.5px; color: var(--dim); font-family: var(--mono); }

/* 资料页的点赞区 */
.user-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.user-like-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-like-count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.small-note { font-size: 12px; }

/* 工具大全占位 */
.tool-placeholder { text-align: center; padding: 48px 24px; }

.tool-placeholder-icon { font-size: 44px; margin-bottom: 14px; }

.tool-placeholder h2 { margin: 0 0 8px; font-size: 17px; }

.tool-placeholder p { margin: 0 0 20px; font-size: 13.5px; }

.tool-placeholder .btn { display: inline-block; }

/* 表单字段的标签 + 计数 */
.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.field-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

.field-count.is-limit { color: var(--warn, #ffb84d); }

/* ================= 通知 ================= */

/* 侧边栏红点 */
.side-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff4d63;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  letter-spacing: 0;
}

.notice-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.notify-unread {
  flex: none;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 77, 99, .4);
  background: rgba(255, 77, 99, .1);
  color: #ff8093;
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
}

.notify-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.notify-tabs .sort-btn { padding: 6px 14px; }

.tab-n {
  margin-left: 4px;
  font-family: var(--mono);
  font-size: 11px;
  opacity: .7;
}

.notify-list { display: grid; gap: 8px; }

.notify-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  transition: background .16s ease, border-color .16s ease;
}

.notify-item.is-unread {
  border-color: rgba(91, 140, 255, .35);
  background: rgba(91, 140, 255, .06);
}

.notify-icon {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.notify-icon.thread_like { color: #ff7a8f; border-color: rgba(255, 95, 116, .35); }
.notify-icon.thread_comment { color: var(--accent-2); border-color: rgba(34, 211, 166, .35); }
.notify-icon.feedback_reply { color: #9db4ff; border-color: rgba(91, 140, 255, .45); }
.notify-icon.message_revoked { color: #b08cff; border-color: rgba(176, 140, 255, .4); }

/* 发言被撤回：比普通通知淡一档，别抢戏 */
.notify-item.is-revoked { background: rgba(176, 140, 255, .05); }
.notify-item.is-revoked .notify-quote {
  border-left-color: rgba(176, 140, 255, .45);
  color: #b7aed0;
  text-decoration: line-through;
  text-decoration-color: rgba(176, 140, 255, .5);
}

/* 反馈回信：未读期间一直排在最前，给个更醒目的底 */
.notify-item.is-pinned {
  border-color: rgba(91, 140, 255, .5);
  background: rgba(91, 140, 255, .09);
  box-shadow: inset 3px 0 0 rgba(91, 140, 255, .7);
}

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

.notify-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.notify-actor {
  color: var(--link-accent);
  font-weight: 560;
  text-decoration: none;
}

.notify-actor:hover { text-decoration: underline; color: var(--text-strong); }
.notify-actor.is-gone { color: var(--dim); }

.notify-thread {
  color: var(--muted);
  text-decoration: none;
}

a.notify-thread:hover { color: var(--text); text-decoration: underline; }

.notify-times {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .07);
  color: #9fb0c9;
  font: inherit;
  font-family: var(--mono);
  font-size: 10.5px;
  vertical-align: 1px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.notify-times:hover {
  background: rgba(91, 140, 255, .18);
  color: #cddaff;
  border-color: rgba(91, 140, 255, .35);
}

.notify-times .chev {
  display: inline-block;
  margin-left: 2px;
  transition: transform .16s ease;
}

.notify-times.is-open .chev { transform: rotate(180deg); }

/* 明细 */
.notify-events {
  margin-top: 10px;
  padding: 4px 0 2px 12px;
  border-left: 2px solid rgba(255, 255, 255, .1);
  display: grid;
  gap: 6px;
}

.notify-event {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  color: #a9b5c7;
}

.notify-event time {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
}

.notify-event span { overflow-wrap: anywhere; }

.notify-event-empty {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--dim);
}

/* 评论预览：超过两行截断，点一下展开全文 */
.notify-quote {
  margin: 6px 0 0;
  padding: 7px 10px;
  border-left: 2px solid rgba(34, 211, 166, .4);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, .03);
  font-size: 12.5px;
  line-height: 1.6;
  color: #b9c3d4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  cursor: pointer;
  transition: background .16s ease;
}

.notify-quote:hover { background: rgba(255, 255, 255, .06); }

.notify-quote.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.notify-quote::after {
  content: '（点击查看全文）';
  color: var(--dim);
  font-size: 10.5px;
}

.notify-quote:not(.is-clamped)::after { content: ''; }

/* 评论详情小窗口 */
.comment-modal-card { width: min(100%, 620px); }

.comment-modal-body { display: grid; gap: 14px; }

.cm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--dim);
}

.cm-meta .dot { opacity: .5; }

.cm-actor {
  color: var(--link-accent);
  font-weight: 560;
  text-decoration: none;
}

.cm-actor:hover { text-decoration: underline; color: var(--text-strong); }
.cm-actor.is-gone { color: var(--dim); }

.cm-thread { color: var(--muted); text-decoration: none; }
a.cm-thread:hover { color: var(--text); text-decoration: underline; }

.cm-text {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 52vh;
  overflow-y: auto;
}

/* 明细里可点的评论行 */
.notify-event.is-clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 6px;
  margin-left: -6px;
  transition: background .14s ease;
}

.notify-event.is-clickable:hover { background: rgba(255, 255, 255, .05); }

.notify-event-text {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notify-time {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--dim);
  font-family: var(--mono);
}

/* ================= 反馈 ================= */

.panel-title {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--muted);
}

.feedback-actions { display: flex; justify-content: flex-end; }

.feedback-list { display: grid; gap: 12px; }

.fb-item {
  padding: 15px 17px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.fb-item.is-replied { border-color: rgba(34, 211, 166, .28); }

.fb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.fb-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-badge {
  flex: none;
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 184, 77, .35);
  background: rgba(255, 184, 77, .1);
  color: #ffb84d;
  font-size: 10.5px;
  white-space: nowrap;
}

.fb-badge.is-replied {
  border-color: rgba(34, 211, 166, .4);
  background: rgba(34, 211, 166, .1);
  color: var(--accent-2);
}

.fb-body {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fb-time {
  display: block;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--dim);
  font-family: var(--mono);
}

.fb-reply {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 2px solid rgba(34, 211, 166, .5);
  background: rgba(34, 211, 166, .06);
}

.fb-reply-head {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--accent-2);
  font-family: var(--mono);
}

.fb-reply-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ================= 账号申述 ================= */

.appeal-link {
  display: block;
  margin: 26px auto 0;
  padding: 8px 16px;
  border: 1px dashed rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.appeal-link:hover {
  color: var(--muted);
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .03);
}

/* 登录失败是封禁时，把它点亮引起注意 */
.appeal-link.is-hint {
  color: #ff8093;
  border-color: rgba(255, 77, 99, .5);
  background: rgba(255, 77, 99, .08);
  animation: appealPulse 1.6s ease-in-out 2;
}

@keyframes appealPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 99, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 77, 99, .15); }
}

.appeal-tip {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 2px solid rgba(255, 184, 77, .5);
  background: rgba(255, 184, 77, .07);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-body);
}

.appeal-done {
  margin: 0;
  padding: 18px 0 6px;
  text-align: center;
  font-size: 13.5px;
  color: var(--accent-2);
}

/* ================= 管理员右键菜单 ================= */

.ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 176px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: #1b2231;
  box-shadow:
    0 24px 60px -16px rgba(0, 0, 0, .95),
    0 0 0 1px rgba(0, 0, 0, .6);
  animation: ctxIn .12s ease;
}

/* 只做位移 + 缩放，不做透明度 —— 否则刚弹出那一瞬是半透明的 */
@keyframes ctxIn {
  from { transform: scale(.97) translateY(-2px); }
  to { transform: none; }
}

.ctx-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-body);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, color .14s ease;
}

.ctx-item:hover { background: rgba(91, 140, 255, .22); color: #fff; }
.ctx-item.is-danger { color: #ff8f9f; }
.ctx-item.is-danger:hover { background: rgba(255, 77, 99, .2); color: #ffc2ca; }

.ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: rgba(255, 255, 255, .1);
}

/* 撤回的消息 */
.chat-item.is-revoked .chat-bubble { opacity: .72; }

.chat-text.is-revoked {
  color: var(--dim);
  font-style: italic;
  font-size: 12.5px;
}

/* 禁言提示条 */
.chat-muted-bar {
  margin: 8px 0 4px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 77, 99, .35);
  background: rgba(255, 77, 99, .09);
  color: #ff9aa9;
  font-size: 12.5px;
  text-align: center;
}

.chat-input-wrap textarea:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ================= 福利 ================= */

.welfare-list { display: grid; gap: 16px; }

.welfare-card {
  padding: 20px 22px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(91, 140, 255, .05), rgba(0, 0, 0, 0) 60%), var(--bg-soft);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .8);
}

.welfare-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 12px;
}

.welfare-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.welfare-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
  white-space: nowrap;
}

.welfare-body {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.welfare-by {
  margin: 14px 0 0;
  font-size: 11.5px;
  color: var(--dim);
}

/* ================= 侧边栏社交圆按钮 ================= */

.side-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 12px;
}

.side-social {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: #c3cddd;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .12s ease;
}

.side-social:hover {
  color: #fff;
  border-color: rgba(91, 140, 255, .55);
  background: rgba(91, 140, 255, .14);
  transform: translateY(-1px);
}

/* 链接还没配：看着是占位，点了也没反应 */
.side-social.is-placeholder {
  color: #5b6579;
  border-style: dashed;
  background: transparent;
  cursor: not-allowed;
}

.side-social.is-placeholder:hover {
  color: #5b6579;
  border-color: var(--line);
  background: transparent;
  transform: none;
}

/* ================= 娱乐大厅 ================= */

.narrow.wide { max-width: 1000px; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.game-grid-note {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--dim);
  font-family: var(--mono);
}

.game-card {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .16s ease, transform .14s ease, box-shadow .16s ease;
}

a.game-card:hover {
  border-color: rgba(91, 140, 255, .55);
  transform: translateY(-3px);
  box-shadow: 0 22px 44px -26px rgba(0, 0, 0, .9);
}

.game-card.is-locked {
  opacity: .58;
  cursor: default;
}

.game-card-thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 112px;
  background:
    radial-gradient(circle at 30% 20%, rgba(91, 140, 255, .16), transparent 60%),
    linear-gradient(180deg, var(--shimmer-mid), var(--bg-soft));
  border-bottom: 1px solid var(--line);
}

.game-card-soon {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .45);
  color: var(--muted);
  font-size: 10px;
}

.game-card-body { padding: 13px 15px 16px; }

.game-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.game-card-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.game-card-tag {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(91, 140, 255, .35);
  background: rgba(91, 140, 255, .1);
  color: #9db4ff;
  font-size: 10px;
  white-space: nowrap;
}

.game-card-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* 游戏内的返回按钮 */
.game-back {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color .14s ease;
}

.game-back:hover { color: var(--accent); }

/* ================= 娱乐 / 俄罗斯方块 ================= */

.game-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.game-head { margin-bottom: 20px; }

.game-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  background: var(--game-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

/* --- 左面板 --- */

.game-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.game-stats {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--game-panel);
}

.game-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 3px 0;
}

.game-stat span {
  font-size: 11.5px;
  color: var(--game-muted);
}

.game-stat strong {
  font-size: 19px;
  font-weight: 700;
  color: var(--game-text);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.game-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.game-preview-box {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.game-preview-box > span {
  font-size: 10.5px;
  color: var(--game-muted);
}

.game-preview-box canvas {
  border-radius: 8px;
  background: var(--game-field);
}

.game-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.game-btn {
  padding: 9px 6px;
  border: 0;
  border-radius: 8px;
  background: var(--game-key);
  color: var(--game-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease;
}

.game-btn:hover { background: var(--game-key-hover); }
.game-btn:active { transform: translateY(1px); }

.game-keys {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
  font-size: 11px;
  color: var(--game-muted);
}

.game-keys kbd {
  display: inline-block;
  min-width: 18px;
  margin-right: 3px;
  padding: 1px 5px;
  border: 1px solid #3a3e48;
  border-radius: 4px;
  background: var(--game-panel);
  color: #c8cedb;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

/* --- 棋盘 --- */

.game-field {
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: start;
}

#g-board {
  display: block;
  border-radius: 8px;
  background: var(--game-field);
  touch-action: none;
}

.game-status {
  margin: 0;
  font-size: 11px;
  color: var(--game-muted);
  font-family: var(--mono);
}

/* --- 触屏按键：默认不显示 --- */

.game-touch { display: none; }

/* --- 窄屏 / 触摸设备 --- */

@media (max-width: 860px), (pointer: coarse) {
  /* 手机上一屏要装下 面板 + 棋盘 + 按键，标题区先让位 */
  .game-head { display: none; }

  .game-page { padding: 8px 8px 14px; }

  .game-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
  }

  /* 面板压到棋盘上方，横排显示 */
  .game-side {
    order: -1;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .game-keys { display: none; }

  .game-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 6px 10px;
    text-align: center;
  }

  .game-stat {
    flex-direction: column;
    gap: 0;
    padding: 2px 0;
  }

  .game-stat span { font-size: 10px; }
  .game-stat strong { font-size: 15px; }

  .game-previews {
    justify-content: center;
    gap: 16px;
  }

  .game-preview-box { gap: 2px; }
  .game-preview-box > span { font-size: 9.5px; }

  /* 预览画布在手机上缩到 56，尺寸由 JS 同步 */
  .game-preview-box canvas {
    width: 56px !important;
    height: 56px !important;
  }

  .game-buttons { gap: 6px; }
  .game-btn { padding: 7px 4px; font-size: 11px; }

  .game-status { font-size: 10px; }

  .game-touch {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas:
      "rotate rotate drop  hold"
      "left   down   right right";
    gap: 8px;
    margin-top: 2px;
  }

  .tbtn {
    display: grid;
    place-items: center;
    min-height: 54px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: var(--game-panel);
    color: #dfe5f0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s ease, transform .08s ease;
  }

  .tbtn:active,
  .tbtn.is-hit {
    background: #3a3f4b;
    transform: scale(.96);
  }

  .tbtn-rotate { grid-area: rotate; }
  .tbtn-left { grid-area: left; }
  .tbtn-down { grid-area: down; }
  .tbtn-right { grid-area: right; }
  .tbtn-drop { grid-area: drop; background: #2c3340; }
  .tbtn-hold { grid-area: hold; }
}

/* 窄屏时棋盘占满宽度 */
@media (max-width: 860px) {
  .game-field { width: 100%; }
  #g-board { max-width: 100%; }
}

/* ================= 浅色主题 ================= */

[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-soft: #ffffff;
  --bg-panel: #ffffff;
  --line: #dce3ee;
  --line-soft: #e9eef6;
  --text: #17202e;
  --muted: #5b6678;
  --dim: #5f6a7a;
  --accent: #2563eb;
  --accent-2: #0d9f6e;
  --danger: #dc2f45;

  --field: #f7f9fc;
  --hover: #eef2f8;
  --shimmer-mid: #e9eef6;
  --shimmer-edge: #f4f6fa;
  --card-soft: #f4f6fa;

  --game-bg: #ffffff;
  --game-panel: #f4f6fa;
  --game-key: #e6ecf5;
  --game-key-hover: #d8e2ef;
  --game-text: #17202e;
  --game-muted: #5b6678;
  /* 棋盘保持深色，和方块配色更协调 */
  --game-field: #131417;

  /* 正文与强调 */
  --text-body: #2b3444;
  --link-accent: #1d4ed8;

  /* 悬停态 */
  --line-strong: #b9c5d6;
  --card-hover: #f2f5fa;
  --text-strong: #0f172a;

  /* 滚动条跟着变浅，别在浅色页面上留两条黑边 */
  --scroll-track: #eef1f6;
  --scroll-thumb: #c6d0de;
  --scroll-thumb-hover: #a9b5c6;
}

/* 浅色下要单独调的地方 */

[data-theme="light"] .side-nav {
  box-shadow: 1px 0 0 var(--line);
}

[data-theme="light"] .nav {
  background: rgba(255, 255, 255, .88);
  border-bottom-color: var(--line);
}

[data-theme="light"] .chat-bubble {
  background: #eef2f8;
  border-color: var(--line);
}

[data-theme="light"] .chat-item.is-mine .chat-bubble {
  background: rgba(37, 99, 235, .1);
  border-color: rgba(37, 99, 235, .22);
}

[data-theme="light"] .game-shell {
  background: var(--bg-soft);
  box-shadow: 0 12px 30px -24px rgba(23, 32, 46, .25);
}

[data-theme="light"] .welfare-card {
  background: var(--bg-soft);
  box-shadow: 0 12px 26px -22px rgba(23, 32, 46, .3);
}

[data-theme="light"] .ctx-menu {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 20px 44px -18px rgba(23, 32, 46, .28);
}

[data-theme="light"] .ctx-item { color: #243044; }
[data-theme="light"] .ctx-item:hover { background: rgba(37, 99, 235, .1); color: #0f172a; }

[data-theme="light"] .modal-card { background: #ffffff; }
[data-theme="light"] .notify-item { background: var(--bg-soft); }

/* 聊天气泡里的文字在浅色下要压深，否则白底浅字看不清 */
[data-theme="light"] .chat-text { color: #1f2937; }
[data-theme="light"] .chat-time { color: #8b95a7; }
[data-theme="light"] .chat-name { color: #4b5563; }
[data-theme="light"] .chat-text.is-revoked { color: #98a2b3; }

[data-theme="light"] .game-status,
[data-theme="light"] .game-keys { color: var(--muted); }

/* ================= 主题切换按钮 ================= */

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: rgba(91, 140, 255, .5);
  background: var(--hover);
}

.theme-toggle svg { transition: transform .3s ease; }
.theme-toggle:hover svg { transform: rotate(18deg); }

/* 顶栏里的位置：紧跟右侧按钮组 */
.theme-toggle.nav-theme { margin-left: 10px; flex: none; }

/* 侧边栏里的位置：用户区上方，和社交按钮同一行 */
.side-theme-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px 0 4px;
}

[data-theme="light"] .theme-toggle { border-color: var(--line); }

/* ================= 邮箱验证码 ================= */

.code-row {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1 1 auto;
  min-width: 0;
  letter-spacing: .18em;
  font-family: var(--mono);
}

.code-send {
  flex: none;
  padding: 0 14px;
  font-size: 12px;
  white-space: nowrap;
}

.code-send:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ================= 聊天室 @AI ================= */

.chat-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid rgba(34, 211, 166, .45);
  border-radius: 999px;
  background: rgba(34, 211, 166, .1);
  color: var(--accent-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.chat-ai-btn:hover {
  background: rgba(34, 211, 166, .2);
  border-color: rgba(34, 211, 166, .7);
}

.chat-ai-btn:active { transform: scale(.95); }

[data-theme="light"] .chat-ai-btn {
  color: #0d9f6e;
  border-color: rgba(13, 159, 110, .4);
  background: rgba(13, 159, 110, .08);
}

/* AI 的消息：左边一条绿色细边，和真人区分开 */
.chat-item.is-ai .chat-bubble {
  border-color: rgba(34, 211, 166, .35);
  background: rgba(34, 211, 166, .06);
  box-shadow: inset 3px 0 0 rgba(34, 211, 166, .6);
}

[data-theme="light"] .chat-item.is-ai .chat-bubble {
  border-color: rgba(13, 159, 110, .3);
  background: rgba(13, 159, 110, .05);
  box-shadow: inset 3px 0 0 rgba(13, 159, 110, .55);
}

.chat-item.is-ai .chat-name { color: var(--accent-2); }

.chat-ai-badge {
  flex: none;
  padding: 0 6px;
  border: 1px solid rgba(34, 211, 166, .55);
  border-radius: 4px;
  background: rgba(34, 211, 166, .12);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
}

/* AI 正在打字 */
.chat-item.is-ai.is-thinking .chat-text::after {
  content: '···';
  animation: aiBlink 1.2s steps(4, end) infinite;
}

@keyframes aiBlink {
  0%, 20% { opacity: .2; }
  50% { opacity: 1; }
  100% { opacity: .2; }
}

/* ================= 滚动条 ================= */

/*
 * 滚动条。
 *
 * 注意：不要同时写 scrollbar-width / scrollbar-color。
 * 那两个标准属性一旦声明，浏览器会用它们接管滚动条，
 * 并让 ::-webkit-scrollbar 的自定义宽度失效（实测 width 会被忽略）。
 * 只保留 webkit 写法，Chromium 系浏览器才会按这里给的尺寸和配色画。
 */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 3px solid var(--scroll-track);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}

/* ================= 响应式 ================= */

/* 窗口不够高时先压扁 hero —— 内容不该被挤到首屏之外 */
@media (max-height: 900px) {
  main {
    padding-top: clamp(20px, 3vw, 36px);
    padding-bottom: 32px;
  }
  .hero h1 {
    font-size: clamp(25px, 4vw, 36px);
    margin-bottom: 12px;
  }
  .hero .lede {
    margin-bottom: 0;
    font-size: 15px;
    line-height: 1.7;
  }
  .list-section { margin-top: 30px; }
  .post-list { gap: 10px; }
  .post-card { padding: 16px 19px; }
  .section-foot { margin-top: 12px; }
  .page-head { margin-bottom: 22px; }
}

@media (max-height: 700px) {
  main { padding-top: 20px; }
  .hero h1 { font-size: clamp(23px, 3.4vw, 30px); }
  .hero .lede { font-size: 14.5px; line-height: 1.7; }
  .list-section { margin-top: 26px; }
  .page-head h1 { font-size: 24px; }
  .panel { padding: 18px; }
  .post-card { padding: 15px 17px; }
}

/* 窗口压得很扁时，优先让内容露出来，说明文字先让位 */
@media (max-height: 560px) {
  .nav { padding: 9px 16px; }
  main { padding-top: 14px; padding-bottom: 24px; }
  .hero h1 { font-size: 20px; margin-bottom: 8px; }
  .hero .lede { display: none; }
  .eyebrow { margin-bottom: 10px; font-size: 10px; }
  .list-section { margin-top: 18px; }
  .section-head { margin-bottom: 10px; }
  .post-card { padding: 12px 15px; }
  .post-list { gap: 8px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head .lede { display: none; }
}

/* 宽度适配 */
@media (max-width: 1024px) {
  main {
    padding-left: clamp(16px, 4vw, 28px);
    padding-right: clamp(16px, 4vw, 28px);
  }
}

@media (max-width: 680px) {
  .nav { gap: 14px; padding: 12px 16px; }
  .nav-links { display: none; }
  .nav-actions { margin-left: auto; gap: 8px; }
  .who { max-width: 96px; }
  .form.inline { grid-template-columns: 1fr; }

  /* 竖排后必须 stretch，否则标题按内容宽度铺开，nowrap 会把整页撑破 */
  .post-card header {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .post-card h3 { width: 100%; }

  .post-card .post-meta { font-size: 11.5px; }
  .section-foot { justify-content: stretch; }
  .more-link { width: 100%; justify-content: center; }
  .post-title { font-size: 24px; }
  .kv { grid-template-columns: 1fr; }
  .ban-card { padding: 26px 20px 20px; }
}

@media (max-width: 420px) {
  main { padding-left: 14px; padding-right: 14px; }
  .hero h1 { font-size: 24px; }
  .hero .lede { font-size: 14.5px; }
  .eyebrow { font-size: 10.5px; letter-spacing: .12em; }
  .post-card { padding: 14px 15px; }
  .btn { padding: 10px 16px; font-size: 13.5px; }
  .foot { font-size: 12px; gap: 8px; }
}
