/* ─────────────────────────────────────────────
   ELIX WEB — Threads-style RWA (near-white / true-ink)
   Serif = content · Sans = UI chrome · Mono = handles/DID
   Light tokens on :root; dark tokens via
   scene theme attributes or system dark.
   ───────────────────────────────────────────── */
:root {
  color-scheme: light;
  --background: #FFFFFF;
  --background-soft: #F6F6F6;
  --surface: #FFFFFF;
  --surface-raised: #F6F6F6;
  --surface-deep: #ECECEC;
  --border: #E6E6E6;
  --border-soft: #F0F0F0;
  --muted-fill: #ECECEC;
  --accent: #B97A3C;
  --warning: #9A4A24;
  --danger: #9A4A24;
  --success: #4A6B5E;
  --text: #0A0A0A;
  --muted: #5C5C5C;
  --faint: #9A9A9A;
  --serif: "Noto Serif TC", Newsreader, Georgia, serif;
  --serif-en: Newsreader, "Noto Serif TC", Georgia, serif;
  --sans: "Noto Sans TC", Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    Menlo, monospace;
  font-family: var(--sans);
}

/* Ink (dark) theme — explicit selection */
.forum-shell[data-theme="dark"] {
  color-scheme: dark;
  --background: #000000;
  --background-soft: #0E0E0E;
  --surface: #000000;
  --surface-raised: #0E0E0E;
  --surface-deep: #1A1A1A;
  --border: #242424;
  --border-soft: #161616;
  --muted-fill: #1A1A1A;
  --accent: #D69968;
  --warning: #C97B52;
  --danger: #C97B52;
  --success: #7AA39B;
  --text: #F4F4F4;
  --muted: #A4A4A4;
  --faint: #606060;
}

/* Ink (dark) theme — auto: follow the system */
@media (prefers-color-scheme: dark) {
  .forum-shell[data-theme="auto"] {
    color-scheme: dark;
    --background: #000000;
    --background-soft: #0E0E0E;
    --surface: #000000;
    --surface-raised: #0E0E0E;
    --surface-deep: #1A1A1A;
    --border: #242424;
    --border-soft: #161616;
    --muted-fill: #1A1A1A;
    --accent: #D69968;
    --warning: #C97B52;
    --danger: #C97B52;
    --success: #7AA39B;
    --text: #F4F4F4;
    --muted: #A4A4A4;
    --faint: #606060;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

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

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

a:hover {
  color: var(--warning);
}

.focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

/* ── Shell ─────────────────────────────────── */
.forum-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
}

/* ── Top bar (wtop) ────────────────────────── */
.command-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 13px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  position: sticky;
  top: 0;
  z-index: 6;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand-lockup:hover {
  color: var(--text);
}

.elix-mark {
  width: 34px;
  height: 34px;
  color: var(--text);
  flex-shrink: 0;
}

.elix-mark path {
  stroke: currentColor;
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
}

.elix-mark circle {
  fill: currentColor;
}

.elix-mark__center {
  fill: var(--accent) !important;
}

.brand-word {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-host {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--faint);
  text-transform: uppercase;
  margin-left: 2px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--background-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  width: min(460px, 100%);
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
}

.command-context {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
}

.command-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.command-nav a,
.route-links a {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}

.command-nav a[aria-current="page"],
.command-nav a:hover,
.route-links a:hover {
  color: var(--text);
  font-weight: 600;
}

.route-title,
.label-mono {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--faint);
  text-transform: uppercase;
}

.route-title {
  white-space: nowrap;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
  color: var(--text);
}

.session-chip span {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.session-chip strong {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
}

.session-chip.is-anonymous span {
  font-weight: 500;
  color: var(--muted);
}

.session-chip.is-anonymous strong {
  color: var(--faint);
}

.header-action,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--background);
  border: 1px solid var(--text);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}

.header-action:hover,
.primary-action:hover {
  opacity: 0.88;
  color: var(--background);
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}

.secondary-action:hover {
  color: var(--text);
  border-color: var(--text);
}

.danger-action,
.header-action.is-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

.danger-action:hover,
.header-action.is-danger:hover {
  background: var(--danger);
  color: var(--background);
}

/* ── Main surface ──────────────────────────── */
.forum-main {
  width: 100%;
  flex: 1;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── Three-column social layout ────────────── */
.cols {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 30px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 26px 26px 60px;
  align-items: start;
}

/* Left rail */
.rail,
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-self: start;
  position: sticky;
  top: 84px;
  min-width: 0;
}

.rail-label {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--faint);
  text-transform: uppercase;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
}

.rail-nav a:hover {
  background: var(--background-soft);
  color: var(--text);
}

.rail-nav a[aria-current="page"] {
  background: var(--background-soft);
  font-weight: 700;
}

.rail-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.rail-icon path,
.rail-icon rect,
.rail-icon circle {
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.rail-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-block span,
.rail-muted {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--faint);
  padding: 3px 12px;
}

/* Board rows in the rail (hash tile + meta) */
.rail-board-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 8px;
  border-radius: 9px;
  color: var(--text);
}

.rail-board-row:hover {
  background: var(--background-soft);
  color: var(--text);
}

.rail-board-row .hashav {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--background-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  flex-shrink: 0;
}

.rail-board-row .meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.rail-board-row .meta .n {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-board-row .meta .h {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right rail cards */
.side-panel,
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--background);
}

.side-panel .section-label {
  margin-bottom: 12px;
}

.side-panel a {
  display: block;
  padding: 8px 0;
  border-top: 1px solid var(--border-soft);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.side-panel a:first-of-type {
  border-top: none;
}

.side-panel a:hover {
  color: var(--accent);
}

.thread-context-rail .thread-board-card {
  padding-top: 18px;
  padding-bottom: 18px;
}

.thread-board-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}

.thread-board-meta {
  margin: 10px 0 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.side-panel span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
}

.side-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
  padding: 0 6px;
}

.card h2,
.card h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.card p {
  font-size: 14px;
}

/* ── Feed column ───────────────────────────── */
.feed {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: min(680px, 100%);
  margin: 0 auto;
}

.feed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px 14px;
  border-bottom: 1px solid var(--border);
}

.feed-head h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
}

.feed-head p {
  font-family: var(--serif);
  font-size: 14px;
  margin: 0;
}

.permission-copy {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  padding-top: 6px;
}

/* Mobile focus surface, reused as the center feed canvas on desktop. */
.mobile-focus-stage {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.scene-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--background-soft);
}

.scene-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.scene-tab[aria-selected="true"] {
  border-color: var(--border);
  background: var(--background);
  color: var(--text);
}

.inline-elix-mark {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.inline-elix-mark path {
  stroke: currentColor;
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
}

.inline-elix-mark circle {
  fill: currentColor;
}

.scene-help {
  margin: 0;
  font-family: var(--serif);
  font-size: 13.5px;
  font-style: italic;
  color: var(--faint);
}

.swipe-coachmark {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--background-soft);
}

.swipe-coachmark h3,
.swipe-coachmark p {
  margin-bottom: 4px;
}

.swipe-coachmark button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
}

.scene-viewport {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}

.scene-track {
  display: flex;
  width: 200%;
  transform: translateX(0);
  transition: transform 220ms ease;
}

.mobile-focus-stage[data-active-scene="forum"] .scene-track {
  transform: translateX(-50%);
}

.scene-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  padding: 18px;
}

.scene-meta-row,
.personal-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.scene-meta-row {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.personal-board-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.personal-board-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}

.forum-list {
  display: flex;
  flex-direction: column;
}

.signed-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.scene-inline-action {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mobile-compose-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--text);
  color: var(--background);
  font-size: 28px;
  line-height: 1;
  z-index: 8;
}

/* Compose row (Threads-style inline) */
.compose {
  display: grid;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.compose-prompt {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.compose-prompt p {
  flex: 1;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--faint);
  margin: 0;
}

.thread-draft-form {
  display: grid;
  gap: 14px;
  margin: 0 0 16px;
  padding: 16px;
}

.thread-draft-form .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.thread-draft-form h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.35;
}

.thread-draft-label {
  display: grid;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.thread-draft-label input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
}

.thread-draft-label input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thread-draft-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-deep);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 16px;
  flex-shrink: 0;
}

.compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-left: 52px;
}

.compose-actions button,
.compose-actions a:not(.primary-action) {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
}

.compose-actions span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.compose-actions .primary-action {
  min-width: 0;
}

/* Post card (Threads-style) */
.post {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border);
}

.post-source {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.post-author {
  display: flex;
  align-items: center;
  gap: 11px;
}

.post-author .avatar {
  width: 44px;
  height: 44px;
  font-size: 17px;
}

.post-author strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.post-author span {
  display: block;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
}

.post-body {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  margin: 0;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.post-actions button,
.post-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
}

.post-actions button:hover,
.post-actions a:hover {
  background: var(--background-soft);
  color: var(--text);
}

.post-actions span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.signed-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.empty-state {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  color: var(--faint);
  padding: 14px 4px;
}

/* ── Board page ────────────────────────────── */
.board-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border);
}

.board-head .heading h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.board-head .heading p {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
  max-width: 56ch;
  margin-bottom: 4px;
}

.permission-state {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.permission-state .lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.permission-state .val {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  vertical-align: middle;
}

.gate-requirement {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--accent);
}

.gate-blocked {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.gate-blocked .primary-action:disabled {
  opacity: 0.45;
}

.gate-blocked p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--warning);
  margin: 0;
}

/* Thread list (board threads) */
.thread-list {
  border: none;
  border-radius: 0;
  padding: 0;
}

.thread-list .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 4px 10px;
}

.thread-list .head h3 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.thread-list ul,
.directory ul,
.scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.board-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 17px 4px;
  border-bottom: 1px solid var(--border);
}

.board-thread-link {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 13px;
  color: var(--text);
  overflow-wrap: normal;
  text-decoration: none;
}

.board-thread-link:hover,
.board-thread-link:focus-visible {
  color: var(--text);
}

.board-thread-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-deep);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 17px;
  flex-shrink: 0;
}

.board-thread-row.is-signed .board-thread-avatar {
  background: var(--accent);
  color: #fff;
}

.board-thread-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.board-thread-status {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

.board-thread-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}

.board-thread-by,
.thread-hd-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
}

.thread-title-link {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
}

.thread-title-link:hover,
.thread-title-link:focus-visible {
  text-decoration: underline;
}

.thread-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.did-handle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pk-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0;
  color: var(--text);
  background: var(--background);
  white-space: nowrap;
}

.board-thread-time,
.thread-time,
.thread-post-time,
.thread-reply-time {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}

.board-thread-tools {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.post-tombstone {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--faint);
  margin: 0;
}

.locked-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 2px 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warning);
  vertical-align: middle;
}

.locked-banner {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--warning);
  margin: 4px 0 0;
}

.locked-no-reply {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
}

.thread-detail .back-link {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.thread-detail .back-link:hover,
.thread-detail .back-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.thread-detail-shell {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0 4px 18px;
}

.thread-hd {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
}

.thread-crumb {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.thread-hd h1 {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  color: var(--text);
}

.thread-conversation {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thread-op {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 13px;
  padding: 22px 0 14px;
}

.thread-post-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.thread-op-avatar,
.thread-reply-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--serif);
}

.thread-op-avatar {
  background: var(--text);
  color: var(--background);
  font-size: 18px;
}

.thread-reply-avatar {
  background: var(--surface-deep);
  color: var(--muted);
  font-size: 17px;
}

.thread-reply-avatar.is-anonymous {
  background: var(--background-soft);
  color: var(--faint);
  font-family: var(--mono);
}

.thread-line {
  width: 2px;
  flex: 1;
  min-height: 18px;
  background: var(--border);
}

.thread-post-content,
.thread-reply-content {
  min-width: 0;
}

.thread-post-top,
.thread-reply-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 6px;
}

.thread-author,
.thread-reply-name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.thread-source {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
}

.thread-source-strong {
  color: var(--text);
  font-weight: 600;
}

.thread-body-copy p,
.thread-reply-body p {
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.72;
  margin: 0 0 9px;
  overflow-wrap: anywhere;
}

.thread-body-copy p:last-child,
.thread-reply-body p:last-child {
  margin-bottom: 0;
}

.thread-action-row,
.thread-mini-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.thread-action,
.thread-mini-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  padding: 3px 0;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.thread-action:hover,
.thread-action:focus-visible,
.thread-mini-action:hover,
.thread-mini-action:focus-visible {
  color: var(--text);
}

.thread-action-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.thread-action-icon path {
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.thread-reply-composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border-soft);
}

.thread-composer-field {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background-soft);
  color: var(--faint);
  font-family: var(--sans);
  font-size: 13.5px;
  text-align: left;
}

.thread-composer-field:hover,
.thread-composer-field:focus-visible {
  color: var(--muted);
}

.thread-composer-send {
  min-height: 36px;
  border: 1px solid var(--text);
  border-radius: 999px;
  padding: 0 15px;
  background: var(--text);
  color: var(--background);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.thread-replies {
  padding-top: 16px;
}

.thread-replies-head {
  margin-bottom: 2px;
}

.thread-replies-head h3 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.thread-reply-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 13px;
  padding: 16px 0;
}

.thread-reply-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 64px;
  bottom: -8px;
  width: 2px;
  background: var(--border-soft);
}

.thread-reply-item.is-removed .thread-reply-content {
  padding: 2px 0;
}

.thread-reply-name.is-anonymous {
  color: var(--muted);
}

.thread-mini-actions {
  gap: 10px;
  margin-top: 9px;
}

.thread-mini-action {
  font-size: 11.5px;
}

.thread-mini-action .thread-action-icon {
  width: 15px;
  height: 15px;
}

/* ── Directory (boards page) ───────────────── */
.directory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.directory {
  border: none;
  border-radius: 0;
  padding: 8px 0 0;
}

.directory h3 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.directory li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
}

.directory li a {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.directory li a:hover {
  color: var(--accent);
}

.directory li .descr {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.directory li .perm {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.directory li .perm.read {
  color: var(--faint);
}

/* ── External (fediverse) section ──────────── */
.external-section {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.external-section .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.external-origin-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 2px 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.external-disclaimer {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--faint);
  margin: 8px 0 4px;
}

.external-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.external-item {
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.external-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.external-origin {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.external-body {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 6px 0 4px;
}

.external-actor {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  margin: 0;
}

.compliance-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--faint);
}

.compliance-badge.is-compatible {
  border-color: var(--success);
  color: var(--success);
}

.compliance-badge.is-unknown {
  border-color: var(--border);
  color: var(--faint);
}

/* ── Reporting ─────────────────────────────── */
.report-control {
  margin-top: 4px;
}

.report-trigger {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
}

.report-trigger:hover {
  color: var(--warning);
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background-soft);
}

.report-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.report-field span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.report-field select,
.report-field textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13.5px;
}

.report-note-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--faint);
  margin: 0;
}

/* ── Moderation console ────────────────────── */
.moderation-console .feed-head p {
  max-width: 62ch;
}

.moderation-state {
  margin-top: 20px;
}

.moderation-forbidden h3 {
  color: var(--warning);
}

.moderation-queue,
.moderation-audit {
  margin-top: 20px;
}

.moderation-board-group {
  padding: 10px 0;
}

.moderation-report {
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
}

.moderation-report-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.moderation-report-meta .target-kind {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.moderation-report-meta code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.moderation-report-meta .ago {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
  margin-left: auto;
}

.reason-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 1px 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
}

.moderation-note,
.moderation-reporter {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--muted);
  margin: 6px 0 0;
}

.moderation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.moderation-action-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.moderation-action-btn.is-primary {
  border-color: var(--text);
  color: var(--text);
}

.moderation-action-btn:hover {
  background: var(--background-soft);
}

.moderation-audit ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.moderation-audit-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
}

.moderation-audit-entry code {
  font-family: var(--mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.moderation-audit-entry .ago {
  margin-left: auto;
  color: var(--faint);
}

/* ── Info banners / notices ────────────────── */
.info-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--background-soft);
}

.info-banner .icon {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.info-banner strong {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.info-banner span {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.info-banner.is-warning .icon,
.info-banner.is-danger .icon {
  background: var(--warning);
}

.info-banner.is-success .icon {
  background: var(--success);
}

/* ── Login (QR → app) ──────────────────────── */
.login-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
  width: 100%;
  min-height: 520px;
  border-bottom: 1px solid var(--border);
}

.qr-block {
  background: var(--background-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
}

.qr-block .label-mono {
  color: var(--muted);
}

.qr-hint {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.6;
}

.challenge-payload-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 220px;
  min-height: 220px;
  border-radius: 10px;
  background: var(--background);
  border: 1px solid var(--border);
  padding: 20px;
  justify-content: center;
}

.challenge-payload-preview strong {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.challenge-payload-preview span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
  overflow-wrap: anywhere;
}

.qr-code {
  width: 160px;
  height: 160px;
  shape-rendering: crispEdges;
}

.login-page {
  border: none;
  border-radius: 0;
  padding: 44px 46px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.login-page .section-label {
  color: var(--accent);
}

.login-page h2 {
  font-size: 30px;
  font-weight: 700;
  margin: 0;
}

.login-page > p {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
}

.challenge-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  margin: 6px 0 0;
}

.challenge-details > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}

.challenge-details dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  flex-shrink: 0;
}

.challenge-details dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  text-align: right;
}

.challenge-details code {
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.scope-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.scope-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--border-soft);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.scope-list li::after {
  content: "✓";
  margin-left: auto;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.scope-empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--faint);
}

/* ── Settings (sessions page) ──────────────── */
.settings-home {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 30px 26px 60px;
  display: flex;
  flex-direction: column;
}

.settings-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-bottom: 14px;
}

.settings-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  text-align: center;
}

.settings-done {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  justify-self: end;
}

.settings-identity-hero {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-avatar svg {
  width: 34px;
  height: 34px;
}

.settings-avatar svg path,
.settings-avatar svg circle {
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
}

.settings-identity-hero h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.settings-identity-hero p {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.settings-edit {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.settings-group {
  margin-top: 26px;
}

.settings-group-label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--faint);
  padding-bottom: 10px;
  margin: 0;
}

.settings-list {
  display: flex;
  flex-direction: column;
}

.settings-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: 15px;
  align-items: center;
  padding: 16px 2px;
  border-top: 1px solid var(--border-soft);
}

.settings-row-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
}

.settings-row-icon svg {
  width: 20px;
  height: 20px;
}

.settings-row-icon svg path,
.settings-row-icon svg circle {
  stroke: currentColor;
  stroke-width: 1.3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-row-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
}

.settings-row-title em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-transform: uppercase;
  margin-left: 4px;
}

.settings-row-detail {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--muted);
}

.settings-row-value {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.settings-row-value.is-danger {
  color: var(--danger);
}

.settings-chevron {
  color: var(--faint);
  font-size: 13px;
}

.pk-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
}

/* Theme picker (Paper / Ink / Auto) */
.theme-option-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.theme-option {
  flex: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  align-items: stretch;
  text-align: center;
}

.theme-option.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(185, 122, 60, 0.26);
}

.theme-swatch {
  display: block;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.theme-swatch.is-light {
  background: #FFFFFF;
}

.theme-swatch.is-dark {
  background: #000000;
  border-color: #000000;
}

.theme-swatch.is-auto {
  background: #FFFFFF;
}

.theme-swatch.is-auto::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  right: -18px;
  width: 60%;
  background: #000000;
  transform: skewX(-20deg);
}

.settings-session-card {
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.settings-version {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  margin: 30px 0 0;
}

/* ── Not found ─────────────────────────────── */
.not-found-page {
  width: min(560px, calc(100% - 52px));
  margin: 40px auto;
}

.route-links {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

/* ── Footer ────────────────────────────────── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.app-footer a {
  color: var(--faint);
}

.app-footer a:hover {
  color: var(--text);
}

/* ── Mobile tab bar ────────────────────────── */
.mobile-tabbar {
  display: none;
  align-items: center;
  padding: 8px 8px 12px;
  border-top: 1px solid var(--border-soft);
  background: var(--background);
  position: sticky;
  bottom: 0;
  z-index: 6;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
}

.mobile-tab[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.mobile-tab:hover {
  color: var(--text);
}

.mobile-tab .elix-mark,
.mobile-icon {
  width: 24px;
  height: 24px;
  color: currentColor;
}

.mobile-icon path,
.mobile-icon rect,
.mobile-icon circle {
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* ── Tablet · 768–1023 ─────────────────────── */
@media (max-width: 1023px) {
  .cols {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 22px;
    padding: 22px 22px 50px;
  }

  .right-rail {
    display: none;
  }

  .rail-nav a {
    justify-content: center;
    padding: 11px;
  }

  .rail-nav a span {
    display: none;
  }

  .rail-label,
  .rail-block {
    display: none;
  }

  .searchbox {
    width: min(320px, 100%);
  }

  .command-nav {
    display: none;
  }

  .login-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .qr-block {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 30px;
  }

  .login-page {
    padding: 28px 26px;
  }

  .login-page h2 {
    font-size: 26px;
  }

  .board-thread-row {
    display: block;
    gap: 8px;
  }

  .board-thread-tools {
    justify-content: flex-start;
    padding-left: 57px;
  }
}

/* Legacy contract breakpoint — keep tablet rules coherent below 900px too. */
@media (max-width: 900px) {
  .route-title {
    display: none;
  }
}

/* ── Mobile · <768 ─────────────────────────── */
@media (max-width: 767px) {
  .cols {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 16px 76px;
  }

  .rail {
    display: none;
  }

  .command-header {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 12px 16px;
  }

  .searchbox {
    display: none;
  }

  .brand-host {
    display: none;
  }

  .elix-mark {
    width: 26px;
    height: 26px;
  }

  .feed {
    width: 100%;
  }

  .feed-head h1 {
    font-size: 20px;
  }

  .board-head .heading h1 {
    font-size: 26px;
  }

  .thread-hd h1 {
    font-size: 32px;
  }

  .thread-detail-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .thread-op,
  .thread-reply-item,
  .thread-reply-composer {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
  }

  .thread-reply-composer {
    grid-template-areas:
      "avatar field"
      ". send";
  }

  .thread-reply-composer .thread-reply-avatar {
    grid-area: avatar;
  }

  .thread-composer-field {
    grid-area: field;
  }

  .thread-composer-send {
    grid-area: send;
    width: fit-content;
  }

  .thread-op-avatar,
  .thread-reply-avatar,
  .board-thread-avatar {
    width: 38px;
    height: 38px;
  }

  .board-thread-link {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
  }

  .board-thread-tools {
    padding-left: 49px;
  }

  .thread-reply-item:not(:last-child)::after {
    left: 18px;
    top: 58px;
  }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .mobile-compose-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-footer {
    padding-bottom: 84px;
  }

  .settings-home {
    padding: 18px 16px 90px;
  }

  .settings-identity-hero {
    grid-template-columns: 56px 1fr auto;
    gap: 13px;
    padding-bottom: 18px;
  }

  .settings-avatar {
    width: 56px;
    height: 56px;
  }

  .settings-identity-hero h2 {
    font-size: 19px;
  }

  .settings-group {
    margin-top: 18px;
  }

  .login-page {
    padding: 24px 16px;
  }

  .qr-block {
    padding: 26px 16px;
  }

  .challenge-payload-preview {
    width: 190px;
    min-height: 190px;
  }

  .qr-code {
    width: 140px;
    height: 140px;
  }

  .thread-list li {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .thread-list li .av {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .thread-list li .meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .theme-option-row {
    flex-wrap: wrap;
  }
}

/* Legacy 560px contract point — tab bar must be revealed at the smallest sizes. */
@media (max-width: 560px) {
  .mobile-tabbar {
    display: flex;
  }

  .forum-shell[data-page-id="home"] .mobile-tabbar {
    display: none;
  }
}
