:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #121720;
  --panel-2: #0f131a;
  --text: #ffffff;
  --muted: #9aa3b2;
  --accent: #0d8aff;
  --answer: #2ac769;
  --border: #1e2633;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(1400px 900px at 50% -25%, rgba(13, 138, 255, 0.26) 0%, rgba(11, 14, 19, 0) 65%),
    radial-gradient(1000px 800px at 50% 20%, rgba(6, 92, 172, 0.18) 0%, rgba(11, 14, 19, 0) 60%),
    linear-gradient(180deg, #0b0e13 0%, #0a0d12 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  background-repeat: no-repeat;
  background-attachment: fixed;
  padding-bottom: 56px;
}
body, p, li, .body, .reply, .message { word-break: break-word; overflow-wrap: anywhere; }
main { max-width: 900px; margin: 24px auto 80px; padding: 0 20px; }
h1 { margin: 0 0 16px; font-size: 2.1rem; letter-spacing: 0.2px; }
p { margin: 6px 0 0; color: var(--text); }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
time { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 14, 19, 0.78);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--border);
}
.site-header__inner, .site-footer__inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
}
.site-header__brand img { width: 24px; height: 24px; }
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.site-header__nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  opacity: 0.85;
}
.site-header__nav a:hover { border-color: var(--border); background: var(--panel-2); opacity: 1; }
.site-header__menu-toggle { position: absolute; opacity: 0; pointer-events: none; }
.site-header__menu-button {
  display: none;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}
.site-header__menu-toggle:checked + .site-header__menu-button { border-color: var(--border); background: var(--panel-2); }

.intro { margin: 0 0 18px; color: var(--muted); font-size: 0.98rem; max-width: 820px; }
.thread-header h1 { font-size: 2rem; letter-spacing: 0.6px; }
.tags, .reactions, .answers-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 6px;
}
.tag, .reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 0.85rem;
  color: var(--text);
}
.tag img, .reaction img { width: 16px; height: 16px; }
.tag-emoji, .emoji { font-size: 1rem; line-height: 1; }
.reaction { padding: 2px 8px; }
.reaction em { font-style: normal; color: var(--muted); }

.discord-cta {
  position: fixed;
  right: 20px;
  bottom: 14px;
  z-index: 50;
}
.discord-cta a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(11, 14, 19, 0.75);
  backdrop-filter: blur(14px) saturate(1.1);
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  transition: all 160ms ease;
}
.discord-cta a:hover { background: #18202a; border-color: #223045; }

.thread-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.thread-list > li, .group, .answers-nav {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.answers-nav { margin: 16px 0; align-items: center; }
.answers-nav span { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.answers-nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(42, 199, 105, 0.1);
  border: 1px solid rgba(42, 199, 105, 0.3);
  color: var(--answer);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 160ms ease;
}
.answers-nav a:hover { background: var(--answer); color: #0b0e13; border-color: var(--answer); }

.group + .group { margin-top: 12px; }
.group > header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.group img { border-radius: 50%; border: 1px solid var(--border); }
.group img.role-icon { border: none; border-radius: 0; }
.group h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.role-icon { width: 22px; height: 22px; border: none; align-self: center; }
.message {
  padding: 10px 8px;
  border-top: 1px dashed var(--border);
  scroll-margin-top: 80px;
}
.message:first-child { border-top: none; }
.message[data-answer="true"] {
  background: linear-gradient(90deg, rgba(42,199,105,0.18), transparent);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(42,199,105,0.25);
}
.meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.badge {
  background: var(--answer);
  color: #0b0e13;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.reply {
  border-left: 2px solid var(--border);
  padding-left: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.reply a { color: var(--accent); }
.reply p { margin: 4px 0 0; }
.mention { font-weight: 600; background: rgba(13, 138, 255, 0.16); padding: 0 4px; border-radius: 4px; }

.body img, .body video { max-width: 100%; height: auto; border-radius: 6px; border: none; }
.body img.inline-emoji { width: 30px; height: 30px; max-width: none; border-radius: 0; vertical-align: text-bottom; }
.body audio { width: 100%; margin-top: 8px; }
.body ul, .body ol { margin: 8px 0 0; padding-left: 20px; }
.body ul { list-style: disc; }
.body ol { list-style: decimal; }
.body li { margin: 4px 0; }
.body a {
  color: var(--accent);
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.body code {
  font-family: Consolas, Monaco, monospace;
  font-size: 0.9em;
  background: rgba(13, 138, 255, 0.08);
  color: #7dd3fc;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid rgba(13, 138, 255, 0.12);
  word-break: break-word;
}
.body pre {
  background: #0a0d12;
  border: 1px solid #1e2633;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #e5e7eb;
  font-size: 0.88em;
  line-height: 1.6;
  display: block;
}
.body pre::-webkit-scrollbar { height: 8px; }
.body pre::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.body pre::-webkit-scrollbar-thumb { background: rgba(13, 138, 255, 0.3); border-radius: 4px; }
.body pre::-webkit-scrollbar-thumb:hover { background: rgba(13, 138, 255, 0.5); }
.body a code { background: rgba(13, 138, 255, 0.15); border-color: rgba(13, 138, 255, 0.25); }

.site-footer { margin-top: 40px; border-top: 1px solid var(--border); }
.site-footer__inner { padding: 14px 20px 24px; flex-wrap: wrap; justify-content: flex-start; color: var(--muted); font-size: 0.85rem; }
.footer-sep { font-weight: 700; }

@media (orientation: portrait) {
  main { padding: 0 12px; }
  body { padding-bottom: 110px; }
  .site-header__menu-button { display: inline-flex; }
  .site-header__nav {
    display: none;
    position: absolute;
    right: 6px;
    top: calc(100% + 8px);
    min-width: 200px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(18, 23, 32, 0.98);
    backdrop-filter: blur(14px) saturate(1.1);
    border: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 60;
  }
  .site-header__menu-toggle:checked + .site-header__menu-button + .site-header__nav { display: flex; }
  .discord-cta {
    left: 0;
    right: 0;
    bottom: 2px;
    display: flex;
    justify-content: center;
    padding: 8px 0 18px;
  }
  .discord-cta a { margin-bottom: 9px; }
  .discord-cta::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 120px;
    background: linear-gradient(0deg, rgba(6, 8, 12, 0.85), transparent);
    z-index: -1;
  }
}
