: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('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);
}

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

.message.forum-admin-author.approved {
  border-color: rgba(251, 191, 36, 0.78);
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.18), rgba(14, 116, 144, 0.09)),
    var(--panel-strong);
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.38),
    0 0 28px rgba(251, 191, 36, 0.18);
}

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

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

.depth-1 .message.forum-admin-author,
.depth-2 .message.forum-admin-author,
.depth-3 .message.forum-admin-author,
.depth-4 .message.forum-admin-author,
.depth-5 .message.forum-admin-author,
.depth-6 .message.forum-admin-author {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.16), rgba(14, 116, 144, 0.08)),
    rgba(2, 6, 18, 0.66);
}

.message.patron-post {
  position: relative;
  overflow: hidden;
  border-style: solid;
  border-width: 1.5px;
  border-color: var(--patron-border);
  background: var(--patron-background);
  box-shadow:
    inset 0 1px 0 var(--patron-inset-highlight),
    0 0 18px var(--patron-glow);
}

.message.patron-post::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.012) 0,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 5px
  );
  opacity: 0.32;
}

.message.patron-post > * {
  position: relative;
  z-index: 1;
}

.message.patron-post.approved {
  box-shadow:
    inset 0 1px 0 var(--patron-inset-highlight),
    0 0 0 1px rgba(251, 191, 36, 0.42),
    0 0 18px var(--patron-glow);
}

.message.patron-post.forum-admin-author {
  box-shadow:
    inset 0 1px 0 var(--patron-inset-highlight),
    0 0 0 1px rgba(125, 211, 252, 0.38),
    0 0 18px var(--patron-glow);
}

.message.patron-post.forum-admin-author.approved {
  box-shadow:
    inset 0 1px 0 var(--patron-inset-highlight),
    0 0 0 1px rgba(125, 211, 252, 0.42),
    0 0 0 2px rgba(251, 191, 36, 0.38),
    0 0 18px var(--patron-glow);
}

.message.patron-bronze {
  --patron-border: #bd731f;
  --patron-inset-highlight: rgba(255, 191, 104, 0.09);
  --patron-glow: rgba(165, 86, 20, 0.08);
  --patron-flair-color: #ffe37a;
  --patron-flair-border: #b97517;
  --patron-flair-background: linear-gradient(
    180deg,
    rgba(94, 55, 11, 0.96),
    rgba(48, 25, 3, 0.96)
  );
  --patron-flair-inset: rgba(255, 224, 139, 0.12);
  --patron-flair-glow: rgba(180, 105, 19, 0.08);
  --patron-background:
    radial-gradient(
      circle at 52% 5%,
      rgba(183, 100, 34, 0.28) 0%,
      rgba(119, 57, 16, 0.14) 28%,
      transparent 58%
    ),
    linear-gradient(110deg, #170b03 0%, #4a250d 24%, #2f1607 53%, #110b07 100%);
}

.message.patron-silver {
  --patron-border: #a7a7a7;
  --patron-inset-highlight: rgba(255, 255, 255, 0.08);
  --patron-glow: rgba(180, 180, 180, 0.05);
  --patron-flair-color: #f3f3f3;
  --patron-flair-border: #a9a9a9;
  --patron-flair-background: linear-gradient(
    180deg,
    rgba(101, 101, 101, 0.96),
    rgba(55, 55, 55, 0.96)
  );
  --patron-flair-inset: rgba(255, 255, 255, 0.14);
  --patron-flair-glow: transparent;
  --patron-background:
    radial-gradient(
      circle at 52% 0%,
      rgba(190, 190, 190, 0.2) 0%,
      rgba(122, 122, 122, 0.12) 31%,
      transparent 61%
    ),
    linear-gradient(110deg, #191919 0%, #4a4a4a 25%, #303030 57%, #171717 100%);
}

.message.patron-heart {
  --patron-border: #ee3138;
  --patron-inset-highlight: rgba(255, 123, 127, 0.09);
  --patron-glow: rgba(223, 31, 39, 0.08);
  --patron-flair-color: #ffd2d4;
  --patron-flair-border: #ef444a;
  --patron-flair-background: linear-gradient(
    180deg,
    rgba(177, 29, 36, 0.98),
    rgba(103, 11, 16, 0.98)
  );
  --patron-flair-inset: rgba(255, 188, 191, 0.12);
  --patron-flair-glow: rgba(232, 45, 52, 0.09);
  --patron-background:
    radial-gradient(
      circle at 53% 3%,
      rgba(224, 50, 56, 0.3) 0%,
      rgba(154, 22, 27, 0.18) 34%,
      transparent 62%
    ),
    linear-gradient(110deg, #240304 0%, #821216 25%, #5b0a0d 57%, #210304 100%);
}

.patron-flair {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 13px;
  border: 1px solid var(--patron-flair-border);
  border-radius: 999px;
  color: var(--patron-flair-color);
  background: var(--patron-flair-background);
  box-shadow:
    inset 0 1px 0 var(--patron-flair-inset),
    0 0 8px var(--patron-flair-glow);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.patron-flair__icon {
  flex: 0 0 auto;
  font-size: 1em;
  line-height: 1;
}

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

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

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

@media (max-width: 480px) {
  .patron-flair {
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.86rem;
  }
}
