:root {
  --bg: #0b0c0f;
  --elev: #12141a;
  --card: #161922;
  --text: #e7e8eb;
  --muted: #a5adba;
  --line: #242837;
  --accent: #2f5aae;
  --accent-2: #252cff;
  --good: #3fb950;
  --bad: #da3633;
  --shadow: 0 6px 20px rgba(0, 0, 0, .4);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
}
body.light {
  --bg: #fafafa;
  --elev: #ffffff;
  --card: #f5f5f5;
  --text: #111;
  --muted: #444;
  --line: #ddd;
  --shadow: 0 6px 20px rgba(0, 0, 0, .1);
}
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Noto Sans", Arial;
}
a {
  color: var(--accent);
}
a:hover {
  color: var(--accent-2);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}
@media screen and (max-width: 420px) {
  .container {
    padding: 0px;
  }
}
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(6px);
  background: linear-gradient(180deg, rgb(44 97 255 / 85%), rgb(187 193 94 / 65%));
  border-bottom: 1px solid var(--line);
}
header a {
  color: var(--card);
}
.site-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  position: relative;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.logo svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.grow {
  flex: 1;
}
.nav {
  display: flex;
  gap: 14px;
  align-items: center;
}
.nav a {
  opacity: .9;
  text-decoration: none;
}
main.layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  main.layout {
    grid-template-columns: 1fr 320px;
  }
}
.thread {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.question {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--elev), var(--card));
}
.question h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.3;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.messages {
  padding: 10px 0;
  max-height: none;
  overflow: visible;
  scroll-behavior: smooth;
}
.msg {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.msg:last-child {
  border-bottom: none;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #23283a;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #b8bef0;
}
.bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 14px;
  position: relative;
}
.bubble .author {
  font-weight: 600;
}
.bubble .content {
  margin: 6px 0 10px;
  white-space: pre-wrap;
}
.msg-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.vote {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vote button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.vote button:hover {
  border-color: var(--accent);
  color: var(--text);
}
.vote .up.active {
  background: rgba(63, 185, 80, .12);
  border-color: var(--good);
  color: #c9ffd6;
}
.vote .down.active {
  background: rgba(218, 54, 51, .12);
  border-color: var(--bad);
  color: #ffd0ce;
}
.vote .score {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: #d9dbe7;
}
.composer-wrap {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgb(8 65 234 / 50%), rgb(122 138 226 / 85%));
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  z-index: 40;
}
form#composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
textarea#message {
  flex: 1;
  min-height: 46px;
  max-height: 35vh;
  resize: none;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}
button.send {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button.send:hover {
  filter: brightness(1.08);
}

/* (mobile composer tweaks are injected in static template) */
.sidebar {
  display: grid;
  gap: 16px;
}
.card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #d5d8e3;
}
.related a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #00248f;
  border: 1px solid transparent;
}
.related a:hover {
  background: var(--card);
  border-color: var(--line);
}
.bottom-related {
  padding: 12px 16px;
  border-top: 1px dashed var(--line);
  background: rgb(22 82 245 / 63%);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
h3 {
  color: #8597dd !important;
}
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}
.followup {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.followup:hover {
  border-color: var(--accent);
  color: var(--text);
}
.citations {
  margin: 8px 0 0;
  padding: 8px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.citation {
  margin: 4px 0;
}
.typing {
  opacity: .75;
  font-style: italic;
}
.error {
  color: #ffb4b4;
}
.burger {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.burger-box {
  display: inline-grid;
  gap: 4px;
}
.burger-line {
  width: 20px;
  height: 2px;
  background: var(--text);
  display: block;
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.burger[aria-expanded="true"] .burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.burger[aria-expanded="true"] .burger-line:nth-child(2) {
  opacity: 0;
}
.burger[aria-expanded="true"] .burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
@media (max-width: 900px) {
  .burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .nav {
    position: absolute;
    top: 56px;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--elev);
    box-shadow: var(--shadow);
  }
  .nav a {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
  }
  .nav.open {
    display: flex;
  }
  header .lang-switch {
    display: none;
  }
  #toggleTheme {
    display: none;
  }
}
header .site-inner {
  position: relative;
}
