/* ============ Onyx Forum — 精美浅色主题 ============ */
:root {
  --bg: #f2f4fb;
  --bg-2: #e9edf7;
  --card: #ffffff;
  --border: #e3e8f3;
  --text: #1e2433;
  --muted: #7a8299;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --violet: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 36, 51, .06), 0 8px 24px rgba(99, 102, 241, .08);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, .14);
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 80% -10%, rgba(139, 92, 246, .10), transparent 60%),
                    radial-gradient(900px 400px at 10% -10%, rgba(99, 102, 241, .08), transparent 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: min(960px, 94%); margin: 0 auto; }
.main { flex: 1; padding-bottom: 48px; }
.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.inline-form { display: inline; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; box-shadow: 0 4px 12px rgba(99, 102, 241, .35);
}
.brand-text { font-weight: 800; font-size: 1.15rem; letter-spacing: .2px; }
.brand-text em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav > a { color: var(--text); font-weight: 500; }
.nav > a:hover { color: var(--primary); text-decoration: none; }
.nav-admin { font-size: .85rem; color: var(--violet) !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer;
  font-size: .92rem; font-weight: 500; transition: all .15s ease; text-decoration: none;
}
.btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn-primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
.btn-primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 6px 20px rgba(99, 102, 241, .45); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 12px; font-size: .85rem; border-radius: 8px; }
.btn-danger { color: var(--red); border-color: rgba(239, 68, 68, .4); background: transparent; }
.btn-danger:hover { background: rgba(239, 68, 68, .08); border-color: var(--red); color: var(--red); }
.link-btn { background: none; border: none; color: var(--text); cursor: pointer; font-size: .95rem; padding: 0; font-weight: 500; }
.link-btn:hover { color: var(--primary); }

/* ---------- flash ---------- */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; margin: 18px 0;
  border: 1px solid; font-size: .94rem; animation: slide-in .25s ease;
}
.flash-icon { font-weight: 800; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.flash-info { background: #fffbeb; border-color: #fde68a; color: #92400e; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- notice banner ---------- */
.notice-banner {
  display: flex; gap: 14px; align-items: flex-start;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d; border-radius: var(--radius);
  padding: 14px 18px; margin: 22px 0 0; font-size: .94rem;
  box-shadow: 0 2px 10px rgba(217, 119, 6, .08);
}
.notice-icon { font-size: 1.5rem; line-height: 1.2; }
.notice-banner p { margin-top: 2px; }
.notice-banner b { color: #b45309; }

/* ---------- hero ---------- */
.hero-card {
  position: relative; overflow: hidden; text-align: center;
  margin: 26px 0 30px; padding: 52px 28px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #e0e7ff; border-radius: 20px;
  box-shadow: var(--shadow);
}
.hero-glow {
  position: absolute; top: -80px; left: 50%; transform: translateX(-50%);
  width: 420px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, .22), transparent);
  pointer-events: none;
}
.hero-card h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-card p { color: var(--muted); font-size: 1.02rem; }
.hero-stats { display: flex; gap: 26px; justify-content: center; margin: 18px 0 22px; color: var(--muted); font-size: .92rem; }
.hero-stats b { color: var(--text); font-size: 1.2rem; margin-right: 3px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }

/* ---------- section titles ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 12px; }
.section-title h2 { font-size: 1.2rem; font-weight: 700; }
.section-meta { color: var(--muted); font-size: .85rem; }
.section-link { font-size: .88rem; }

/* ---------- category grid ---------- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.category-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); transition: all .18s ease; color: var(--text);
}
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #c7d2fe; text-decoration: none; }
.category-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
}
.category-body { flex: 1; min-width: 0; }
.category-body h3 { font-size: 1.02rem; margin-bottom: 2px; }
.category-body p { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-meta { color: var(--muted); font-size: .78rem; }
.category-arrow { color: var(--muted); transition: transform .15s; }
.category-card:hover .category-arrow { transform: translateX(4px); color: var(--primary); }

/* ---------- panels ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 20px; }
.empty-hint { padding: 28px 0; text-align: center; color: var(--muted); }

/* ---------- thread list ---------- */
.thread-list { list-style: none; }
.thread-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 2px; border-bottom: 1px solid var(--bg-2);
}
.thread-item:last-child { border-bottom: none; }
.thread-main { min-width: 0; flex: 1; }
.thread-title { font-size: .99rem; font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-title:hover { color: var(--primary); text-decoration: none; }
.thread-meta { display: flex; gap: 12px; align-items: center; margin-top: 4px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.author { color: var(--primary); font-weight: 500; }
.time, .views { color: var(--muted); }
.thread-side { text-align: center; flex-shrink: 0; }
.reply-count { font-size: 1.15rem; font-weight: 700; color: var(--primary); display: block; }
.reply-label { font-size: .72rem; color: var(--muted); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: #eef2ff; color: var(--primary-dark); font-size: .75rem; font-weight: 600;
}
.badge-admin { background: #ecfdf5; color: #047857; }

/* ---------- page head ---------- */
.page-head { margin: 28px 0 18px; }
.page-head h1 { font-size: 1.5rem; font-weight: 800; }
.thread-h1 { word-break: break-word; }
.back-link { font-size: .88rem; color: var(--muted); display: inline-block; margin-bottom: 6px; }
.back-link:hover { color: var(--primary); }
.page-desc { color: var(--muted); margin: 4px 0 10px; }
.page-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.meta-row { display: flex; gap: 14px; align-items: center; margin-top: 8px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }

/* ---------- post cards ---------- */
.post-card {
  display: flex; gap: 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.post-card.post-op { border-color: #c7d2fe; }
.post-side { flex-shrink: 0; width: 88px; text-align: center; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 6px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, .3);
}
.avatar-op { background: linear-gradient(135deg, #f59e0b, #ef4444); box-shadow: 0 4px 10px rgba(239, 68, 68, .3); }
.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }
.post-username { display: block; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.post-role { font-size: .72rem; color: var(--muted); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .82rem; color: var(--muted); }
.floor { color: var(--primary); font-weight: 600; }
.post-content { font-size: .96rem; }
.post-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* ---------- replies ---------- */
.replies { margin-top: 4px; }

/* ---------- reply form ---------- */
.reply-form-panel { margin-top: 18px; padding: 20px; }
.reply-form-panel h3 { margin-bottom: 12px; font-size: 1.05rem; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 500; }
.form input, .form textarea, .form select {
  background: #fafbff; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 11px 14px; font-size: .95rem; font-family: inherit; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.form textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.form-panel { padding: 24px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row input { flex: 1; min-width: 140px; }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 22px 0; }
.page-btn {
  padding: 7px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: .88rem;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-info { color: var(--muted); font-size: .9rem; }

/* ---------- auth ---------- */
.auth-box {
  max-width: 420px; margin: 48px auto; background: var(--card);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 32px;
}
.auth-box h2 { font-size: 1.3rem; margin-bottom: 18px; text-align: center; }
.auth-foot { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--muted); }

/* ---------- profile ---------- */
.profile-hero {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin: 26px 0;
}
.profile-info { flex: 1; min-width: 160px; }
.profile-info h1 { font-size: 1.4rem; }
.profile-stats { display: flex; gap: 26px; }
.pstat { text-align: center; }
.pstat b { display: block; font-size: 1.3rem; color: var(--primary); }
.pstat span { font-size: .8rem; color: var(--muted); }

/* ---------- admin ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 14px 0; }
.admin-cat {
  background: #fafbff; border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.admin-cat summary { cursor: pointer; color: var(--primary); font-size: .85rem; }
.cat-form { gap: 8px; margin-top: 8px; }
.cat-form input { padding: 7px 10px; font-size: .85rem; }
.cat-form-new { border-top: 1px solid var(--bg-2); padding: 16px 0; }
.cat-form-new h4 { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--bg-2); text-align: left; font-size: .9rem; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }

/* ---------- 404 ---------- */
.center-box { text-align: center; padding: 90px 0; }
.big-num { font-size: 4.5rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: auto; background: var(--card); border-top: 1px solid var(--border);
  padding: 26px 0; text-align: center;
}
.footer-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.footer-brand { font-weight: 800; }
.footer-note { font-size: .85rem; color: var(--amber); }
.footer-sub { font-size: .8rem; color: var(--muted); }
.footer-sub a { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero-card { padding: 36px 18px; }
  .hero-card h1 { font-size: 1.5rem; }
  .post-card { flex-direction: column; }
  .post-side { width: auto; display: flex; align-items: center; gap: 10px; text-align: left; }
  .avatar { margin: 0; }
  .category-grid { grid-template-columns: 1fr; }
  .thread-item { flex-direction: column; align-items: flex-start; }
  .thread-side { display: flex; gap: 6px; align-items: baseline; }
}
