:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --fg: #17171a;
  --muted: #6a6a75;
  --line: #e3e3e8;
  --card: #ffffff;
  --accent: #0b5fff;
  --error: #b42318;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111114;
  --fg: #f1f1f4;
  --muted: #9b9ba7;
  --line: #2b2b33;
  --card: #17171b;
  --accent: #8ab0ff;
  --error: #ff9d94;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 1.75rem 0 1rem;
}

h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.75rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--fg);
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
}

.muted {
  color: var(--muted);
}

.meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.breadcrumb {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.85rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.body {
  margin-top: 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.topic-list,
.reply-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.topic-title {
  font-weight: 500;
}

.reply-list .card:first-child {
  margin-top: 1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stack h2 {
  margin: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
  color: inherit;
}

input,
textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

[type='email'],
[inputmode='numeric'] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

button {
  align-self: flex-start;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
}

button:hover {
  opacity: 0.88;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

#theme-toggle {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--fg);
}

.error {
  margin: 0;
  color: var(--error);
  font-size: 0.85rem;
}
