:root {
  --bg: #0b0e16;
  --bg2: #111622;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf5;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent2: #2dd4bf;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #2dd4bf 100%);
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
              radial-gradient(1000px 500px at -10% 10%, rgba(45, 212, 191, 0.12), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--panel-border);
  background: rgba(11, 14, 22, 0.7); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.logo { font-size: 30px; filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.6)); }
.brand-text h1 { margin: 0; font-size: 20px; letter-spacing: 0.5px;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.identity { cursor: pointer; }
.id-card {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 999px;
  transition: 0.2s;
}
.id-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15); }
.id-emoji { font-size: 24px; }
.id-meta { display: flex; flex-direction: column; line-height: 1.2; }
.id-name { font-size: 14px; font-weight: 600; }
.id-sub { font-size: 11px; color: var(--muted); }

/* tabs */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 22px 4px;
  scrollbar-width: thin;
}
.tab {
  flex: 0 0 auto; padding: 7px 15px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--muted);
  font-size: 13px; white-space: nowrap; transition: 0.18s;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: var(--accent-grad); border-color: transparent; box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35); }

/* 布局 */
.container { max-width: 880px; margin: 0 auto; padding: 18px 18px 60px; }
.list-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.search { flex: 1; }
.search input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: var(--bg2); color: var(--text); font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); }

/* 帖子卡 */
.thread-list { display: flex; flex-direction: column; gap: 12px; }
.t-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: 0.18s; position: relative; overflow: hidden;
}
.t-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent-grad); opacity: 0; transition: 0.18s;
}
.t-card:hover { transform: translateY(-2px); border-color: rgba(124, 92, 255, 0.4); box-shadow: var(--shadow); }
.t-card:hover::before { opacity: 1; }
.t-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); font-size: 19px; flex: 0 0 auto; }
.t-author { font-size: 13px; font-weight: 600; }
.t-cat { margin-left: auto; font-size: 11px; color: var(--accent2); background: rgba(45, 212, 191, 0.12);
  padding: 3px 9px; border-radius: 999px; }
.t-title { font-size: 16px; font-weight: 600; margin: 4px 0 6px; line-height: 1.4; }
.t-excerpt { font-size: 13px; color: var(--muted); line-height: 1.6; max-height: 44px; overflow: hidden; }
.t-meta { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.t-meta b { color: var(--text); font-weight: 600; }

/* 详情 */
.detail-view { animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.back { margin-bottom: 12px; }
.thread-detail {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px;
}
.thread-detail h2 { margin: 6px 0 12px; font-size: 22px; line-height: 1.4; }
.thread-detail .content { white-space: pre-wrap; line-height: 1.75; font-size: 15px; color: #cfd6e6; }
.detail-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.like-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; cursor: pointer;
  background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.3);
  color: #cbbcff; padding: 7px 14px; border-radius: 999px; font-size: 13px; transition: 0.18s;
}
.like-btn:hover { background: rgba(124, 92, 255, 0.22); }
.like-btn.liked { background: var(--accent-grad); color: #fff; border-color: transparent; }

/* 回复 */
.reply-box { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 22px; }
.reply-box textarea, .field textarea, .modal-card textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--panel-border); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font-size: 14px; resize: vertical; outline: none; font-family: inherit;
}
.reply-box textarea:focus { border-color: var(--accent); }
.reply-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.replies-title { font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.replies-title span { color: var(--accent2); }
.reply-list { display: flex; flex-direction: column; gap: 12px; }
.r-item { display: flex; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; }
.r-body { flex: 1; }
.r-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.r-name { font-size: 13px; font-weight: 600; }
.r-time { font-size: 11px; color: var(--muted); }
.r-content { font-size: 14px; line-height: 1.65; color: #d3dae9; white-space: pre-wrap; }
.r-like { margin-left: auto; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.r-like:hover { color: var(--accent2); }

/* 按钮 */
.btn { border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px; cursor: pointer; transition: 0.18s; font-weight: 600; }
.btn.primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(124, 92, 255, 0.3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--panel-border); }
.btn.ghost:hover { color: var(--text); border-color: var(--accent); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 12, 0.7); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 50; padding: 18px; }
.modal-card { width: 100%; max-width: 520px; background: var(--bg2); border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-tip { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 4px 0 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--panel-border);
  border-radius: 10px; color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field.row { display: flex; gap: 12px; }
.field.row .grow { flex: 1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--panel-border); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.hint { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 50px 0; }

/* toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 24, 36, 0.95); border: 1px solid var(--panel-border); color: var(--text);
  padding: 11px 20px; border-radius: 999px; font-size: 13.5px; z-index: 80; box-shadow: var(--shadow);
  animation: pop 0.25s; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.foot { text-align: center; color: var(--muted); font-size: 11.5px; padding: 24px 12px 30px; border-top: 1px solid var(--panel-border); margin-top: 20px; }

@media (max-width: 560px) {
  .brand-text p { display: none; }
  .list-head { flex-direction: column; align-items: stretch; }
  .thread-detail h2 { font-size: 19px; }
}

/* 等级徽章 */
.lv-badge { display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent-grad); padding: 1px 7px; border-radius: 999px; vertical-align: middle; margin-left: 4px; }

/* 注册门槛（AI 专属 / 挑战题 / honeypot） */
.cap-q { font-size: 13px; color: var(--text); background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.25); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; line-height: 1.5; }
.ai-check { margin-bottom: 14px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.check-line input { width: auto !important; margin: 0; }
