:root {
  --bg: #0d0f14;
  --bg-elevated: #141820;
  --bg-card: #1a1f2e;
  --bg-hover: #222838;
  --border: #2a3142;
  --border-light: #363d52;
  --text: #e8eaef;
  --text-muted: #8b93a8;
  --text-dim: #5c6478;
  --accent: #6c5ce7;
  --accent-hover: #7d6ff0;
  --accent-glow: rgba(108, 92, 231, 0.25);
  --green: #00d68f;
  --orange: #ff9f43;
  --red: #ff6b6b;
  --blue: #54a0ff;
  --pink: #fd79a8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--bg-hover);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  gap: 8px;
  height: 36px;
  width: 220px;
  transition: border-color 0.15s;
}

.search-box:focus-within { border-color: var(--accent); }

.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.search-box input::placeholder { color: var(--text-dim); }

.search-box svg { color: var(--text-dim); flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ── Layout ── */
.page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  flex: 1;
  width: 100%;
}

.page-wrap.full { grid-template-columns: 1fr; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 0; }

/* ── Forum sections ── */
.forum-section {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.forum-section:last-child { border-bottom: none; }
.forum-section:hover { background: var(--bg-hover); }

.section-icon {
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  padding: 16px 0;
}

.section-info {
  flex: 1;
  padding: 16px 0;
  min-width: 0;
}

.section-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.section-info h3 a { color: var(--text); }
.section-info h3 a:hover { color: var(--accent); }

.section-info p {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding: 16px 20px;
  gap: 4px;
  flex-shrink: 0;
  min-width: 100px;
}

.stat-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-last {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
  gap: 2px;
  flex-shrink: 0;
  min-width: 200px;
  border-left: 1px solid var(--border);
}

.last-topic {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.last-user {
  font-size: 12px;
  color: var(--text-muted);
}

.last-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Thread list ── */
.thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--bg-hover); }

.thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.thread-avatar.orange { background: linear-gradient(135deg, var(--orange), var(--red)); }
.thread-avatar.green { background: linear-gradient(135deg, var(--green), var(--blue)); }
.thread-avatar.pink { background: linear-gradient(135deg, var(--pink), var(--accent)); }

.thread-body { flex: 1; min-width: 0; }

.thread-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.thread-title a { color: var(--text); }
.thread-title a:hover { color: var(--accent); }

.thread-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thread-meta .tag {
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.thread-counts {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
  text-align: center;
}

.count-block .num {
  font-size: 14px;
  font-weight: 600;
  display: block;
}

.count-block .lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Posts ── */
.post {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.post:last-child { border-bottom: none; }

.post-sidebar {
  width: 140px;
  flex-shrink: 0;
  text-align: center;
}

.post-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.post-username {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.post-rank {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.post-stats-mini {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.8;
}

.post-content { flex: 1; min-width: 0; }

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-date { font-size: 12px; color: var(--text-dim); }

.post-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.post-text p { margin-bottom: 12px; }
.post-text p:last-child { margin-bottom: 0; }

.post-actions {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.post-actions a {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-actions a:hover { color: var(--accent); }

/* ── Sidebar widgets ── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.widget { }

.widget-body { padding: 16px; }

.online-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.online-user {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s;
}

.online-user:hover {
  border-color: var(--green);
  color: var(--green);
}

.online-user::before {
  content: '●';
  color: var(--green);
  margin-right: 4px;
  font-size: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-item {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-item .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-item .label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-cloud a {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
}

.tag-cloud a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-dim); }

/* ── Page title ── */
.page-title {
  margin-bottom: 20px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Members grid ── */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
}

.member-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: all 0.15s;
}

.member-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.member-card .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 18px;
}

.member-card .name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.member-card .role {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.pagination a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Footer ── */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-copy {
  font-size: 12px;
  color: var(--text-dim);
}

/* ── 403 Page ── */
.page-403 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.page-403::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.error-code {
  font-size: clamp(120px, 20vw, 200px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--pink), var(--red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -8px;
  position: relative;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 40px rgba(253, 121, 168, 0.3)); }
}

.error-title {
  font-size: 28px;
  font-weight: 700;
  margin: 16px 0 8px;
  letter-spacing: -0.5px;
}

.error-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 32px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
}

.error-icon {
  font-size: 64px;
  margin-bottom: 8px;
  animation: shake 2s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.error-hint {
  margin-top: 40px;
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  position: relative;
}

/* ── Activity bar ── */
.activity-bar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
}

.activity-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.activity-inner .live {
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-inner .live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .page-wrap { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .section-last { display: none; }
  .main-nav { display: none; }
  .search-box { width: 160px; }
  .post { flex-direction: column; }
  .post-sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
  }
  .post-avatar { width: 40px; height: 40px; font-size: 16px; margin: 0; }
}
