:root {
  color-scheme: dark;
  --bg: #090c11;
  --bg-soft: #0d121a;
  --panel: #111823;
  --panel-2: #151e2b;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #eef2f7;
  --muted: #9aa6b6;
  --muted-2: #6d7a8b;
  --red: #e3352b;
  --red-2: #ff6a5e;
  --gold: #ffd166;
  --green: #55d68b;
  --blue: #7bb8ff;
  --radius: 16px;
  --max: 1180px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(227, 53, 43, .14), transparent 62%),
    radial-gradient(720px 420px at 88% 0%, rgba(123, 184, 255, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(227, 53, 43, .4); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 17, .82);
  backdrop-filter: blur(18px) saturate(140%);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 70px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-ball {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, var(--red) 0 44%, #0b0e13 44% 56%, #f3f6fb 56% 100%);
  box-shadow: 0 0 0 3px rgba(255,255,255,.07), 0 0 18px rgba(227,53,43,.35);
  position: relative;
}
.brand-ball::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 11px; height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #f3f6fb;
  box-shadow: inset 0 0 0 3px #0b0e13;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 18px; font-weight: 900; letter-spacing: .02em; }
.brand-text small { margin-top: 4px; color: var(--muted-2); font-size: 8px; letter-spacing: .14em; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.main-nav a:hover, .main-nav a.on { color: var(--text); background: rgba(255,255,255,.06); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.online-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.online-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(85,214,139,.8); }
.online-pill b { color: var(--text); }
.auth-area { display: flex; align-items: center; gap: 7px; }
.user-chip { display: flex; align-items: center; gap: 7px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.user-chip .avatar { width: 27px; height: 27px; font-size: 11px; }
.user-chip span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

/* ---------- layout ---------- */
.site-main { max-width: var(--max); margin: 0 auto; padding: 26px 22px 60px; }
.site-footer { max-width: var(--max); margin: 0 auto; padding: 18px 22px 30px; color: var(--muted-2); font-size: 10px; display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); }
.site-footer a:hover { color: var(--text); }
.loading-card, .empty-card { padding: 48px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-card h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font-size: 12px; font-weight: 700; transition: .18s; }
.btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.btn-primary { border-color: rgba(227,53,43,.55); background: linear-gradient(180deg, #f04a3e, #c92f26); color: #fff; box-shadow: 0 8px 22px rgba(227,53,43,.18); }
.btn-primary:hover { background: linear-gradient(180deg, #ff5b4e, #db382e); }
.btn-danger { border-color: rgba(255,95,109,.45); background: rgba(255,95,109,.12); color: #ff9aa2; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 27px; padding: 4px 9px; font-size: 10.5px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.link-btn { border: 0; background: none; color: var(--blue); padding: 0; font-size: 11px; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---------- home hero ---------- */
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 30px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(520px 260px at 85% 10%, rgba(227,53,43,.19), transparent 70%),
    linear-gradient(135deg, #121a26, #0b1017 60%);
  margin-bottom: 18px;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -70px; bottom: -110px;
  width: 300px; height: 300px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 0 0 28px rgba(255,255,255,.018), 0 0 0 56px rgba(255,255,255,.012);
}
.eyebrow { color: var(--red-2); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.hero-card h1 { margin: 7px 0 6px; font-size: clamp(25px, 4vw, 38px); line-height: 1.12; letter-spacing: -.02em; }
.hero-card h1 em { color: var(--gold); font-style: normal; }
.hero-card p { margin: 0; max-width: 560px; color: var(--muted); font-size: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; color: var(--muted-2); font-size: 10px; }
.hero-meta b { color: var(--text); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 26px 2px 10px; }
.section-head h2 { margin: 0; font-size: 16px; }
.section-head p { margin: 3px 0 0; color: var(--muted-2); font-size: 10px; }
.section-head a { color: var(--muted); font-size: 10.5px; }
.section-head a:hover { color: var(--text); }

/* ---------- boards ---------- */
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.board-card { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(180deg, var(--panel), var(--bg-soft)); transition: .2s; }
.board-card:hover { transform: translateY(-2px); border-color: rgba(255,209,102,.3); }
.board-card .board-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(227,53,43,.12); color: var(--red-2); font-size: 15px; margin-bottom: 10px; }
.board-card h3 { margin: 0; font-size: 14px; }
.board-card p { margin: 5px 0 12px; min-height: 34px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.board-card footer { display: flex; gap: 10px; color: var(--muted-2); font-size: 9px; }
.board-card footer b { color: var(--text); }

/* ---------- thread list ---------- */
.thread-list { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: var(--panel); }
.thread-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); transition: .15s; }
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: rgba(255,255,255,.035); }
.thread-avatar, .avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #263447, #131b26); color: var(--gold); font-size: 11px; font-weight: 900; overflow: hidden; }
.avatar img, .thread-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.thread-main { min-width: 0; flex: 1; }
.thread-main h3 { margin: 0 0 3px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-main h3 .pin { color: var(--red-2); font-size: 9px; margin-right: 4px; }
.thread-main p { margin: 0; color: var(--muted-2); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-stats { display: flex; gap: 12px; flex: none; color: var(--muted-2); font-size: 9.5px; text-align: right; }
.thread-stats b { display: block; color: var(--text); font-size: 12px; }
.board-thread-head { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); margin-bottom: 12px; }
.board-thread-head h1 { margin: 4px 0; font-size: 22px; }
.board-thread-head p { margin: 0; color: var(--muted); font-size: 11px; }
.board-thread-head .hero-actions { margin-top: 12px; }

/* ---------- thread view ---------- */
.thread-head { padding: 22px; border: 1px solid var(--line); border-radius: 16px 16px 0 0; background: linear-gradient(180deg, var(--panel), var(--bg-soft)); }
.thread-head h1 { margin: 6px 0 8px; font-size: clamp(20px, 3vw, 28px); line-height: 1.25; }
.thread-head .thread-byline { display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 10px; flex-wrap: wrap; }
.thread-op { padding: 22px; border: 1px solid var(--line); border-top: 0; background: var(--panel); }
.thread-op .post-body { min-height: 60px; }
.post { display: flex; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-top: 0; background: var(--panel-2); }
.post:last-child { border-radius: 0 0 16px 16px; }
.post-head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.post-head b { font-size: 11px; }
.post-head small { color: var(--muted-2); font-size: 9px; }
.post-body { color: #dbe2eb; font-size: 12.5px; line-height: 1.8; overflow-wrap: anywhere; }
.post-actions { display: flex; gap: 10px; margin-top: 9px; }
.post-action { border: 0; background: none; color: var(--muted-2); font-size: 9.5px; padding: 0; }
.post-action:hover { color: var(--text); }
.reply-box { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.reply-box textarea { width: 100%; min-height: 100px; }
.reply-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- forms / dialog ---------- */
.dialog { position: relative; width: min(440px, calc(100vw - 28px)); padding: 22px; border: 1px solid var(--line-strong); border-radius: 17px; background: #101722; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.dialog.wide { width: min(680px, calc(100vw - 28px)); }
.dialog::backdrop { background: rgba(2, 5, 9, .72); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.dialog-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.dialog-head h2 { margin: 5px 0 3px; font-size: 20px; }
.dialog-head p { margin: 0 0 14px; color: var(--muted); font-size: 10.5px; }
.auth-tabs { display: flex; gap: 3px; padding: 3px; margin-bottom: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.auth-tab { flex: 1; padding: 6px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 11px; }
.auth-tab.on { background: var(--panel-2); color: var(--text); }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10.5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 3px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1119;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
  font-size: 12px;
}
input:focus, select:focus, textarea:focus { border-color: rgba(227,53,43,.6); box-shadow: 0 0 0 3px rgba(227,53,43,.1); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-hint { margin: 0; color: var(--muted-2); font-size: 9.5px; }
.form-error { margin-top: 9px; padding: 8px 10px; border: 1px solid rgba(255,95,109,.3); border-radius: 8px; background: rgba(255,95,109,.1); color: #ff9aa2; font-size: 10.5px; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 100; transform: translateX(-50%); padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: #111a26; color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 11px; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.admin-tab { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 10px; }
.admin-tab.on { border-color: rgba(255,209,102,.4); color: var(--gold); }
.admin-panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.admin-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: 11px; }
.admin-row:last-child { border-bottom: 0; }
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row small { color: var(--muted-2); font-size: 9px; }
.admin-row .btn { flex: none; }
.admin-form { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px; border-bottom: 1px solid var(--line); }
.admin-form input { flex: 1 1 150px; width: auto; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 8.5px; }
.badge.admin { background: rgba(255,209,102,.14); color: var(--gold); }
.badge.mod { background: rgba(123,184,255,.14); color: var(--blue); }
.badge.banned { background: rgba(255,95,109,.14); color: #ff9aa2; }

/* ---------- setup ---------- */
.setup-notice { padding: 10px 18px; background: #3b2410; border-bottom: 1px solid rgba(255,209,102,.25); color: #ffd89a; font-size: 11px; text-align: center; }
.setup-card { max-width: 720px; margin: 40px auto; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.setup-card h1 { margin: 0 0 8px; font-size: 23px; }
.setup-card p { color: var(--muted); font-size: 12px; }
.setup-card code { display: inline; margin: 0 2px; padding: 1px 5px; border-radius: 4px; background: #080d14; color: var(--gold); font-size: 10.5px; overflow-wrap: anywhere; }
.setup-card ol { color: var(--muted); font-size: 12px; padding-left: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; gap: 9px 14px; padding: 10px 16px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .main-nav a { white-space: nowrap; }
  .header-right { gap: 7px; }
  .site-main { padding: 18px 14px 46px; }
  .board-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { padding: 22px 18px; }
}
@media (max-width: 560px) {
  .board-grid { grid-template-columns: 1fr; }
  .online-pill { display: none; }
  .brand-text small { display: none; }
  .thread-row { padding: 10px; gap: 9px; }
  .thread-avatar { width: 29px; height: 29px; }
  .thread-stats { display: none; }
  .thread-head, .thread-op, .post { padding: 15px; }
  .dialog { padding: 18px; }
  .site-footer { font-size: 9px; }
}
