:root {
  color-scheme: dark;
  --bg: #060814;
  --bg-2: #090d18;
  --panel: rgba(255,255,255,.035);
  --panel-2: rgba(255,255,255,.055);
  --line: rgba(255,255,255,.09);
  --text: #f4f7fb;
  --muted: #a8b3c7;
  --blue: #1b17ff;
  --blue-2: #1b17ff;
  --danger: #ff8091;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0, rgba(27,23,255,.15), transparent 30rem),
    radial-gradient(circle at 90% 8%, rgba(255,255,255,.035), transparent 24rem),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.forum-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(10,13,26,.82);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 14px; font-weight: 800; }
.brand img { width: 126px; height: auto; }
.brand span { padding-left: 14px; border-left: 1px solid var(--line); color: var(--muted); }
.header-actions, .user-menu { display: flex; align-items: center; gap: 12px; }
.header-actions > a { color: var(--muted); }

.primary-btn, .ghost-btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 19px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.primary-btn { background: var(--blue); box-shadow: 0 14px 30px rgba(27,23,255,.24); }
.primary-btn:hover { transform: translateY(-1px); background: #2824ff; }
.ghost-btn { border-color: rgba(255,255,255,.10); background: rgba(255,255,255,.045); }
.ghost-btn:hover { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.07); }
.wide { width: 100%; }

main { width: min(1200px, calc(100% - 40px)); margin: 0 auto; padding: 62px 0 92px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 36px; padding: 20px 0 38px; }
.hero h1 { max-width: 820px; margin: 10px 0 16px; font-size: clamp(36px, 4.55vw, 54px); line-height: 1.04; letter-spacing: -.03em; }
.hero p { max-width: 700px; margin: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.55; }
.eyebrow { color: #8684ff; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.new-topic-btn { min-width: 170px; }

.search-panel {
  margin-bottom: 62px;
  padding: 0;
  border: 0;
  background: transparent;
}
.search-panel form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255,255,255,.035);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(27,23,255,.9); box-shadow: 0 0 0 3px rgba(27,23,255,.14); }
textarea { resize: vertical; line-height: 1.55; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin: 7px 0 0; font-size: 28px; letter-spacing: -.02em; }
.category-grid {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.category-card {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(320px, 1.3fr) auto;
  align-items: center;
  gap: 28px;
  min-height: 92px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: background .16s ease, padding .16s ease;
}
.category-card:last-child { border-bottom: 0; }
.category-card:hover { padding-left: 14px; padding-right: 14px; background: rgba(255,255,255,.025); }
.category-card h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.category-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.category-stats { color: #8d91ff; font-size: 13px; font-weight: 700; white-space: nowrap; }

.topics-section { margin-top: 70px; }
.topic-list { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; }
.topic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .16s ease, padding .16s ease;
}
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { padding-left: 14px; padding-right: 14px; background: rgba(255,255,255,.025); }
.topic-row h3 { margin: 0 0 8px; font-size: 17px; }
.topic-meta { color: var(--muted); font-size: 13px; }
.topic-metrics { display: flex; align-items: center; gap: 18px; color: var(--muted); white-space: nowrap; }
.pin { display: inline-block; margin-right: 8px; color: #8d91ff; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.empty { padding: 30px; color: var(--muted); text-align: center; }

.text-btn { padding: 0; border: 0; color: #9598ff; background: transparent; font-weight: 700; cursor: pointer; }
.notice { display: none; margin-bottom: 24px; padding: 14px 18px; border-radius: 14px; background: rgba(27,23,255,.15); color: #cbd0ff; }
.notice.show { display: block; }
.notice.error { background: rgba(255,128,145,.12); color: #ffb5bf; }

.topic-view > .text-btn { margin-bottom: 20px; }
.topic-header { padding: 28px; border: 1px solid var(--line); border-radius: 22px 22px 0 0; background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.03)); }
.topic-header h1 { margin: 10px 0 12px; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; }
.posts { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 22px 22px; overflow: hidden; }
.post { display: grid; grid-template-columns: 180px 1fr; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.025); }
.post:last-child { border-bottom: 0; }
.post-author { padding: 24px; border-right: 1px solid var(--line); color: #d9dcff; font-weight: 800; }
.post-author small { display: block; margin-top: 8px; color: var(--muted); font-weight: 400; }
.post-content { min-width: 0; padding: 24px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; color: #e4e6f0; }
.post-actions { margin-top: 20px; text-align: right; }
.reply-box { margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.03); }
.reply-box h3 { margin-top: 0; }

label { display: grid; gap: 8px; margin-bottom: 16px; color: #d8dbe8; font-size: 14px; font-weight: 700; }
.consent-label { grid-template-columns: 20px 1fr; align-items: start; line-height: 1.45; font-weight: 500; }
.consent-label input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--blue); }
.consent-label a { color: #969eff; text-decoration: underline; }
.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2,3,10,.78);
  backdrop-filter: blur(10px);
}
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #101521;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.modal-card h2 { margin: 0 40px 8px 0; font-size: 30px; }
.modal-note { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.modal-close { position: absolute; top: 18px; right: 20px; border: 0; color: var(--muted); background: none; font-size: 30px; cursor: pointer; }
.auth-switch { display: block; margin: 20px auto 0; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px max(24px, calc((100vw - 1200px) / 2));
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
}
footer div { display: flex; gap: 20px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .category-card { grid-template-columns: 1fr auto; gap: 8px 20px; }
  .category-card p { grid-column: 1 / -1; }
  .post { grid-template-columns: 1fr; }
  .post-author { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .forum-header { align-items: flex-start; }
  .brand span, .header-actions > a { display: none; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  main { width: min(100% - 24px, 1200px); padding-top: 36px; }
  .hero h1 { font-size: 40px; }
  .category-card { grid-template-columns: 1fr; padding: 18px 2px; }
  .category-card p { grid-column: auto; }
  .category-stats { white-space: normal; }
  .search-panel form { grid-template-columns: 1fr; }
  .topic-row { grid-template-columns: 1fr; }
  .topic-metrics { font-size: 12px; }
  footer, footer div { flex-direction: column; }
}
