:root {
  color-scheme: dark;
  --bg: #060914;
  --panel: rgba(7, 13, 28, 0.78);
  --panel-strong: rgba(7, 13, 28, 0.9);
  --border: rgba(255, 255, 255, 0.16);
  --text: rgba(246, 249, 255, 0.98);
  --muted: rgba(246, 249, 255, 0.72);
  --accent: #7dd3fc;
  --danger: #fca5a5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.08rem, 0.72vw + 0.9rem, 1.28rem);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.forum-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(2, 6, 18, 0.58), rgba(2, 6, 18, 0.9)),
    url("/media/page-backgrounds/forum-unsplash-1638342863994.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.forum-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  background: rgba(6, 9, 20, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

a {
  color: inherit;
}

.brand,
.forum-nav nav a {
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(1rem, 0.45vw + 0.92rem, 1.18rem);
}

.forum-nav nav {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.forum-nav nav a {
  padding: 0.62rem 0.78rem;
  border-radius: 8px;
  color: var(--muted);
  transition:
    color 160ms ease-out,
    background-color 160ms ease-out;
}

.forum-nav nav a:hover,
.forum-nav nav a:focus-visible,
.forum-nav nav a[aria-current='page'] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.forum-shell {
  width: min(96vw, 1600px);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 3rem) 0 4.5rem;
  display: grid;
  gap: clamp(1rem, 1.8vw, 1.6rem);
}

.forum-hero {
  min-height: clamp(15rem, 26vw, 22rem);
  display: grid;
  align-content: end;
  gap: 0.7rem;
  padding: clamp(1.35rem, 4vw, 3.2rem);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(7, 13, 28, 0.12), rgba(7, 13, 28, 0.72));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

.forum-hero p,
.forum-hero h1,
.forum-hero div {
  margin: 0;
}

.forum-hero p {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: clamp(1rem, 0.45vw + 0.9rem, 1.28rem);
}

.forum-hero h1 {
  font-size: clamp(3.5rem, 8vw, 7.8rem);
  line-height: 0.95;
}

.forum-hero div {
  max-width: 62rem;
  color: var(--muted);
  font-size: clamp(1.2rem, 0.8vw + 1rem, 1.65rem);
}

.notice,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.notice {
  padding: clamp(1rem, 1.4vw, 1.35rem);
  color: var(--muted);
  font-size: clamp(1.02rem, 0.45vw + 0.92rem, 1.22rem);
}

.notice.error {
  color: var(--danger);
}

.notice.ok {
  color: #bbf7d0;
}

.panel {
  width: 100%;
  padding: clamp(1rem, 2.2vw, 2rem);
  display: grid;
  gap: clamp(1rem, 1.6vw, 1.5rem);
}

.panel h2 {
  margin: 0;
  font-size: clamp(1.8rem, 1.6vw + 1.25rem, 2.8rem);
  line-height: 1.08;
}

form,
.posts {
  display: grid;
  width: 100%;
  gap: clamp(1rem, 1.5vw, 1.4rem);
}

label {
  font-weight: 700;
  color: var(--muted);
  font-size: clamp(1.08rem, 0.5vw + 0.95rem, 1.3rem);
}

textarea {
  width: 100%;
  min-height: clamp(10rem, 18vh, 14rem);
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: clamp(1rem, 1.2vw, 1.35rem);
  background: rgba(2, 6, 18, 0.68);
  color: var(--text);
  font: inherit;
  font-size: clamp(1.12rem, 0.7vw + 0.98rem, 1.42rem);
  line-height: 1.55;
}

button {
  min-height: clamp(3rem, 2.8vw, 3.55rem);
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  background: rgba(125, 211, 252, 0.14);
  color: var(--text);
  font: inherit;
  font-size: clamp(1rem, 0.45vw + 0.9rem, 1.18rem);
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 160ms ease-out,
    background-color 160ms ease-out,
    transform 160ms ease-out;
}

button:hover,
button:focus-visible {
  border-color: rgba(125, 211, 252, 0.76);
  background: rgba(125, 211, 252, 0.22);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.danger {
  border-color: rgba(252, 165, 165, 0.5);
  background: rgba(127, 29, 29, 0.34);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-row,
.thread-head,
.message-meta,
.message-actions,
.edit-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-row,
.thread-head {
  justify-content: space-between;
}

.message {
  display: grid;
  width: 100%;
  gap: clamp(0.75rem, 1vw, 1rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: clamp(1rem, 1.6vw, 1.6rem);
  background: var(--panel-strong);
}

.message.forum-admin-author {
  border-color: rgba(125, 211, 252, 0.72);
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.16), rgba(14, 116, 144, 0.08)),
    var(--panel-strong);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12);
}

.author-identity {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-width: 0;
}

.verified-badge-icon {
  width: 1.18em;
  height: 1.18em;
  flex: 0 0 auto;
  object-fit: contain;
}

.message-meta {
  justify-content: space-between;
  color: var(--muted);
  font-size: clamp(1rem, 0.45vw + 0.88rem, 1.18rem);
}

.author {
  color: var(--text);
  font-weight: 700;
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: clamp(1.2rem, 0.8vw + 1rem, 1.55rem);
  line-height: 1.6;
}

.message-actions {
  justify-content: flex-start;
}

.message-actions button,
.edit-actions button {
  min-height: clamp(2.65rem, 2.4vw, 3.1rem);
  padding: 0.55rem 0.78rem;
  font-size: clamp(0.98rem, 0.4vw + 0.88rem, 1.12rem);
}

.edit-form {
  margin-top: 0.75rem;
  padding: clamp(0.85rem, 1.4vw, 1.2rem);
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  background: rgba(2, 6, 18, 0.5);
}

.edit-form textarea {
  min-height: clamp(7rem, 12vh, 10rem);
}

.edited-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  margin: 0;
  padding: clamp(1.2rem, 2vw, 2rem);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.load-more {
  justify-self: center;
}

.rs-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 700px) {
  .forum-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .forum-nav nav {
    justify-content: flex-start;
  }

  .forum-shell {
    width: 100%;
    padding: 0.8rem 0.7rem 3rem;
  }

  .forum-hero,
  .panel,
  .notice {
    border-radius: 8px;
  }

  .message-actions button,
  .form-row > button,
  .thread-head button {
    width: 100%;
  }

  .form-row,
  .thread-head {
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .forum-nav nav a,
  button {
    transition: none;
  }

  button:active:not(:disabled) {
    transform: none;
  }
}
