@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&display=swap');

: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: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  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('https://images.unsplash.com/photo-1638342863994-ae4eee256688?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
  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);
}

.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(4rem, 8.5vw, 8.4rem);
  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;
}

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

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,
.badges {
  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.approved {
  border-color: rgba(251, 191, 36, 0.72);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.16),
    0 0 28px rgba(251, 191, 36, 0.16);
}

.approved-badge {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(251, 191, 36, 0.42);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.28);
  font-size: clamp(0.95rem, 0.35vw + 0.86rem, 1.08rem);
  font-weight: 700;
}

.thread-node {
  display: grid;
  width: 100%;
  gap: clamp(0.7rem, 1vw, 1rem);
}

.thread-children {
  display: grid;
  gap: clamp(0.8rem, 1.2vw, 1.1rem);
  margin-left: clamp(0.65rem, 1.8vw, 1.4rem);
  padding-left: clamp(0.65rem, 1.6vw, 1.1rem);
  border-left: 2px solid rgba(125, 211, 252, 0.18);
}

.depth-1 .message,
.depth-2 .message,
.depth-3 .message,
.depth-4 .message,
.depth-5 .message,
.depth-6 .message {
  background: rgba(2, 6, 18, 0.54);
}

.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;
}

.mention {
  display: inline;
  border-radius: 6px;
  padding: 0.05rem 0.2rem;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.16);
  text-decoration: none;
  font-weight: 700;
}

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

.message-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);
}

.message-actions button.icon-action {
  width: clamp(2.9rem, 2.6vw, 3.25rem);
  min-width: clamp(2.9rem, 2.6vw, 3.25rem);
  padding-inline: 0;
  font-size: clamp(1.2rem, 0.7vw + 1rem, 1.45rem);
  line-height: 1;
}

button.vote.is-active {
  border-color: rgba(251, 191, 36, 0.78);
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

button.approve {
  border-color: rgba(251, 191, 36, 0.54);
  background: rgba(125, 211, 252, 0.1);
}

button.collapse {
  justify-self: start;
  min-height: 2.5rem;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: clamp(0.95rem, 0.35vw + 0.86rem, 1.08rem);
}

.message.deleted {
  gap: 0.5rem;
  padding-block: clamp(0.75rem, 1.1vw, 1rem);
  border-style: dashed;
  background: rgba(2, 6, 18, 0.38);
  opacity: 0.82;
}

.message.deleted .message-text {
  color: var(--muted);
  font-style: italic;
  font-size: clamp(1.02rem, 0.42vw + 0.92rem, 1.18rem);
}

.reply-form {
  margin-top: 0.25rem;
}

.reply-context {
  color: #bae6fd;
  font-weight: 700;
  font-size: clamp(1rem, 0.4vw + 0.9rem, 1.16rem);
}

.mention-menu {
  display: grid;
  gap: 0.25rem;
  width: min(18rem, 100%);
  max-height: 13rem;
  overflow: auto;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 8px;
  padding: 0.35rem;
  background: rgba(2, 6, 18, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

.mention-menu button {
  justify-content: flex-start;
  min-height: 2.1rem;
  border: 0;
  background: transparent;
  text-align: left;
}

.mention-menu button:hover,
.mention-menu button.is-active {
  background: rgba(125, 211, 252, 0.16);
}

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

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

@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;
  }

  .thread-children {
    margin-left: 0.2rem;
    padding-left: 0.55rem;
  }

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

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