/* static/css/04_paper.css
   The paper layer: ako.ma on dark paper, inked in cream, with painted
   headings. Loaded last, so it re-tints the design tokens (00_tokens.css)
   and dresses the shell (02_shell.css) without touching either; delete the
   <link> in index.html to go back.

   Paper is near-black stock, #131010, with a fine pale fibre grain and
   small, dense markings, very faint (within one level of #131010 on a
   screenshot). The site is dark paper only.

   Kept cheap to paint: both textures are small tiles that scroll with the
   page, rasterised once. No background-attachment: fixed, which repaints
   the whole window on every scroll, and no blur behind the top bar. The
   noise tiles seamlessly because each filter region is the tile itself and
   baseFrequency x tile size is a whole number (.85 x 220, .076923 x 260,
   .1 x 260).
*/

/* ---------- Paper (dark) ---------- */

:root,
:root[data-theme="light"],
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #131010;
  --bg-elevated: #1a1615;
  --surface: #1c1817;
  --surface-2: #211c1a;
  --border: #3a312b;

  --text: #e4d9c3;
  --text-muted: #a6977e;
  --heading: #f2e9d6;

  /* Akoma green, as on the brand mark: bright ink on dark stock. */
  --accent: #24d599;
  --accent-600: #1fbf86;
  --accent-700: #3fdda6;
  --accent-800: #10734f;
  --accent-contrast: #0b1712;

  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);

  --shadow-1:
    0 1px 0 rgba(242, 233, 214, 0.04) inset,
    0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2:
    0 1px 0 rgba(242, 233, 214, 0.05) inset,
    0 2px 3px rgba(0, 0, 0, 0.35),
    0 10px 26px rgba(0, 0, 0, 0.45);

  --wiki-glow: transparent;
  --wiki-panel: color-mix(in srgb, var(--surface) 90%, transparent);
  --wiki-panel-strong: color-mix(in srgb, var(--surface-2) 94%, transparent);
  --wiki-hairline: rgba(228, 217, 195, 0.07);

  --font-display: "EB Garamond", "Cormorant Garamond", Georgia, "Times New Roman", serif;

  /* Fine pale fibres and small paper markings, both as tiles. */
  --paper-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='g' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .89  0 0 0 0 .85  0 0 0 0 .76  0 0 0 .005 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
  --paper-mottle: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='m' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.076923 .1' numOctaves='3' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .36  0 0 0 0 .30  0 0 0 .016 -.007'/></filter><rect width='100%' height='100%' filter='url(%23m)'/></svg>");
  --paper-ink-line: rgba(228, 217, 195, 0.13);

  /* The whole texture, for any area: fibres over markings. Both SVGs carry
     their tile size, so no background-size is needed. */
  --paper: var(--paper-grain), var(--paper-mottle);

  /* The bare stock under the grain and markings, which only add light: a
     shade under --bg so the finished page measures #131010 (median, on a
     screenshot). */
  --paper-stock: #121010;
}

/* ---------- The sheet ---------- */

body {
  background-color: var(--paper-stock);
  background-image: var(--paper);
}

/* The shell lets the sheet show through instead of repainting its own. */
.shell {
  background: transparent;
}

/* The rail and the bar are the same paper, a shade lifted, ruled off in ink.
   The bar is opaque: a blur behind it re-renders on every scroll. */
.topbar {
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border-bottom: 1px solid var(--paper-ink-line);
  backdrop-filter: none;
}

.topbar__brandwrap,
.shell-body > .sidebar {
  background-color: var(--surface-2);
  background-image: var(--paper), linear-gradient(90deg, transparent 92%, rgba(0, 0, 0, 0.18));
  border-color: var(--paper-ink-line);
}

/* ---------- Every other area is the same paper ----------
   03_components.css paints each panel with the background shorthand, which
   clears any image, so the paper is laid back on here (this file loads
   last). Hover states keep their own colours; the texture is too faint to
   miss on them. */

/* Flat-coloured areas: the paper over their own colour. */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select,
.input,
.textarea,
table,
.notice,
.notice.success,
.notice.warn,
.auth-logged-in,
.auth-modal,
.profile-dropdown,
.pill-btn,
.pill-menu,
.notify,
.tooltip,
.store-cart-rail,
.cart-row,
.akoma-balance,
.ako-balance-pill,
.slot,
.user-card,
.user-pill,
.profile-card,
.profile-stat,
.profile__header,
.achievement-card,
.achievement,
.achievement-row,
.board-feed-loading,
.ako-wheel,
.wiki-create,
.devblog-card,
.devblog-post-hero,
.devblog-md,
.chat--full,
.chat__actions,
.chat__composer textarea,
.tx-bubble--in,
.prealpha-box--locked,
.error,
.swapped-modal {
  background-image: var(--paper);
}

/* Areas with a top-down sheen: the paper over the sheen. */
.surface,
.card,
.settings__group,
.board-post-card,
.board-card,
.devblog-post-card,
.devblog-update-card,
.wiki-home-section,
.wiki-search-card,
.wiki-search-item,
.profile__card,
.vault-card {
  background-image:
    var(--paper),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.004));
}

.devblog-editor-grid {
  background-color: var(--surface);
  background-image: var(--paper), linear-gradient(180deg, var(--bg-elevated), var(--surface));
}

/* ---------- Painted type ---------- */

h1, h2, h3,
.home__title,
.devblog-detail__titleblock h1,
.wiki-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.home__title {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
}

.home__eyebrow {
  color: var(--accent-700);
}

/* An ink rule that fades out, like a pen lifting. */
.home__rule {
  background: linear-gradient(90deg, var(--accent) 0%, var(--paper-ink-line) 30%, transparent 80%);
}

/* ---------- Cards are sheets laid on the page ---------- */

.home__card,
.home__clip,
.prealpha-box,
.storyprompt {
  background-color: var(--surface);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  box-shadow: var(--shadow-2);
}

/* A slight, alternating tilt: hand-placed, not gridded. */
.home__clip:nth-child(odd) { transform: rotate(-0.35deg); }
.home__clip:nth-child(even) { transform: rotate(0.3deg); }
.home__clip:hover { transform: rotate(0) translateY(-2px); }
.home__clip { transition: transform 0.2s ease; }

.home__clip img {
  border-bottom: 1px solid var(--paper-ink-line);
}

.home__clip figcaption {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-style: italic;
  color: var(--text-muted);
}

.home__card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--paper-ink-line));
}

/* The call to action: a wax-green stamp. */
.home__cta {
  background: var(--accent);
  background-image: var(--paper);
  color: var(--accent-contrast);
  border: 1px solid var(--accent-700);
  border-radius: 6px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 2px 0 var(--accent-800),
    0 8px 18px rgba(26, 143, 102, 0.22);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.home__cta:hover:not(:disabled) {
  background-color: var(--accent-600);
}

/* ---------- Reading pages ---------- */

.devblog-md__image img,
.wiki-md img {
  border: 1px solid var(--paper-ink-line);
  border-radius: 4px;
  box-shadow: var(--shadow-1);
}

blockquote {
  border-left: 3px solid var(--paper-ink-line);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08em;
}

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--paper-ink-line), transparent);
}

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- Devblog: the change list (+ features, ~ changes, - removals) ---------- */

.changelog {
  display: grid;
  gap: 14px;
  margin: 28px 0 8px;
}

.changelog__section {
  --cl: #8cc95a;        /* features: leaf green */
  --cl-band: rgba(140, 201, 90, 0.14);
  border: 1px solid var(--paper-ink-line);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--surface);
  background-image: var(--paper);
  box-shadow: var(--shadow-1);
}

.changelog__section--change {
  --cl: #e2b440;        /* changes: ochre yellow */
  --cl-band: rgba(226, 180, 64, 0.14);
}

.changelog__section--remove {
  --cl: #e0705f;        /* removals: brick red */
  --cl-band: rgba(224, 112, 95, 0.14);
}

.changelog__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--cl-band), transparent 85%);
  border-bottom: 1px solid var(--paper-ink-line);
  color: var(--cl);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.changelog__mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cl);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

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

.changelog__list li {
  position: relative;
  padding: 9px 16px 9px 34px;
  color: var(--text);
  border-bottom: 1px solid var(--wiki-hairline);
}

.changelog__list li:nth-child(even) {
  background: rgba(228, 217, 195, 0.03);
}

.changelog__list li:last-child {
  border-bottom: 0;
}

.changelog__list li::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--cl);
}

/* ---------- Devblog: live edits (admin) ---------- */

.tx-tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin: 6px 0 2px;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.tx-frag:hover .tx-tools,
.tx-tools--block,
.tx-tools:focus-within {
  opacity: 1;
}

.tx-tools__btn {
  border: 1px solid var(--paper-ink-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 2px 10px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.tx-tools__btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tx-tools__btn--danger:hover {
  color: #e0705f;
  border-color: #e0705f;
}

.tx-edit {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  padding: 12px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: var(--surface);
}

.tx-edit__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Devblog: comments (anyone) ---------- */

.devblog-comments {
  margin: 36px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--paper-ink-line);
}

.devblog-comments__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
}

.devblog-comments__list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.devblog-comment {
  padding: 10px 14px;
  border: 1px solid var(--paper-ink-line);
  border-radius: 8px;
  background-color: var(--surface);
  background-image: var(--paper);
}

.devblog-comment__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.86rem;
}

.devblog-comment__name {
  font-weight: 700;
  color: var(--heading);
}

.devblog-comment__guest {
  padding: 0 6px;
  border: 1px solid var(--paper-ink-line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.devblog-comment__when {
  color: var(--text-muted);
}

.devblog-comment__head .tx-tools__btn {
  margin-left: auto;
}

.devblog-comment__body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.devblog-comments__form {
  display: grid;
  gap: 8px;
}

.devblog-comments__form .btn {
  justify-self: end;
}

.devblog-comments__name {
  max-width: 260px;
}

/* ---------- Linux install dialog (launcher_download.rs) ---------- */

.storyprompt.linux-install { width: min(600px, 92vw); max-width: 600px; }
.linux-install__cmd {
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
  color: var(--text);
}
.linux-install__cmd code {
  background: none;
  color: inherit;
  padding: 0;
  border: 0;
  box-shadow: none;
  font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
}
.linux-install__cmd { text-align: left; }
.linux-install__alt { margin: 12px 0 0; font-size: 0.85rem; }
.linux-install__alt a { color: var(--accent-700); text-decoration: underline; }

/* ---------- Swapped card checkout (store_cart_rail.rs) ---------- */

.swapped-modal {
  width: min(480px, 94vw);
  height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.swapped-modal__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.swapped-modal__bar a { margin-left: auto; font-size: 0.85rem; color: var(--accent-700); }
.swapped-modal__close {
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.swapped-modal__body { position: relative; flex: 1; display: flex; }
.swapped-modal__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
}
.swapped-modal__frame { flex: 1; width: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .2s; }
.swapped-modal__frame.is-loaded { opacity: 1; }

/* ---------- Codex: pages that come from the game (wiki.rs) ---------- */

.wiki-from-game {
  align-self: center;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--paper-ink-line));
  color: var(--accent-700);
}

/* ---------- Codex: lists, quotes and the 3D model (wiki.rs) ---------- */

.codex-list { margin: 0 0 1em; padding-left: 1.4em; }
.codex-list li { margin: 0.2em 0; }

.codex-quote {
  /* Beside the model's panel, not underneath it. */
  overflow: hidden;
  margin: 0 0 1em;
  padding: 0.4em 1em;
  border-left: 3px solid var(--paper-ink-line);
  color: var(--text-muted);
}

/* The thing itself, turning, set into the article: no frame, on the page. */
.codex-model {
  float: right;
  width: min(340px, 100%);
  margin: 0 0 12px 24px;
}
.codex-model model-viewer {
  display: block;
  width: 100%;
  /* An explicit height: the element's own default (150 px) beats aspect-ratio. */
  height: 320px;
  background: transparent;
  --poster-color: transparent;
}
.codex-model figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.7;
}
@media (max-width: 720px) {
  .codex-model { float: none; margin: 0 auto 16px; }
}

/* ---------- The tip jar, in 3D (tip_jar.rs) ---------- */

.floating-tip--3d {
  width: 88px;
  height: 110px;
}
.floating-tip__model {
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
  /* The jar is a link: clicks go to it, not to the viewer. */
  pointer-events: none;
}

/* ---------- Game things as their models (model_view.rs GameModel) ---------- */

/* Each takes the place of the icon it replaces. */
.game-model {
  display: block;
  background: transparent;
  --poster-color: transparent;
  /* Clicks go to what the icon sat in (a slot, a card, a button). */
  pointer-events: none;
}
.gear-media .game-model { width: 140px; height: 140px; }
.slot .game-model { width: 78%; height: 78%; }
.storyprompt .game-model { width: 96px; height: 96px; margin: 0 auto 8px; }
.daily-claim__icn .game-model { width: 100%; height: 100%; }
.ako-wheel__pointer .game-model { width: 34px; height: 34px; }

/* ---------- The Vault: slots without frames (vault.rs) ---------- */

/* The same grid and slots; shading tells them apart instead of borders. */
.vault-card:has(.inventory-grid) {
  border: 0;
  box-shadow: none;
  background: none;
}
.inventory-grid .slot {
  border: 0;
  border-radius: 12px;
  background: rgba(228, 217, 195, 0.028);
}
.inventory-grid .slot.filled {
  background: rgba(228, 217, 195, 0.06);
}
.inventory-grid .slot:hover {
  background: color-mix(in srgb, var(--accent) 10%, rgba(228, 217, 195, 0.06));
}
.inventory-grid .count {
  border: 0;
  background: none;
  padding: 0;
  right: 9px;
  bottom: 7px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Turning or dragging a model shows only the model: no focus outline. */
model-viewer:focus,
model-viewer:focus-visible {
  outline: none;
}

/* ---------- Pay by card: what happens next (store_cart_rail.rs) ---------- */

.swapped-modal__note {
  margin: 0;
  padding: 8px 14px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--paper-ink-line);
}

/* ---------- Attaching images to an update (devblog_slug.rs) ---------- */

.devblog-compose.is-drop .devblog-composer {
  outline: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 4px;
  border-radius: 12px;
}
.devblog-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}
.devblog-attachment {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(228, 217, 195, 0.05);
}
.devblog-attachment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.devblog-attachment__wait {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.devblog-attachment__remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  cursor: pointer;
}
.devblog-attach {
  align-self: stretch;
  padding: 0 14px;
  border: 1px solid var(--paper-ink-line);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.devblog-attach:hover { color: var(--text); border-color: var(--accent); }
.devblog-attach__input { display: none; }

/* ---------- Full-size images (lightbox.rs) ---------- */

img[data-expand] { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 6, 6, 0.88);
  cursor: zoom-out;
}
.lightbox__img {
  /* As large as the window allows, small pictures included. */
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* ---------- Tip page coins as their models (tip.rs coin_button) ---------- */

.tip-coin .game-model { width: 64px; height: 64px; }

/* ---------- Phones: no launcher (launcher_download.rs is_mobile) ---------- */

/* A note, not a button: nothing to press on a phone. */
.home__cta.home__cta--desktop-only:disabled {
  opacity: 1;
  cursor: default;
  background-color: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
  box-shadow: none;
}
.prealpha-box.prealpha-box--desktop-only { cursor: default; }
.prealpha-box--desktop-only .prealpha-box__cta {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- Profiles: the sigil avatar and your bio (user.rs) ---------- */

.profile-avatar--sigil {
  display: block;
  overflow: hidden;
  padding: 0;
  line-height: 0;
}
.profile-avatar--sigil svg { width: 100%; height: 100%; display: block; }
.profile-bio { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.profile-bio__text { margin: 0; }
.profile-bio--edit { align-items: stretch; white-space: normal; }
.profile-bio__input { width: 100%; resize: vertical; min-height: 96px; font: inherit; line-height: 1.5; }
.profile-bio__bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.profile-bio__bar .muted { margin-right: auto; font-size: 0.8rem; }

/* ---------- Chat: channels, questions, threads (board/chat.rs) ---------- */

/* Sidebar (channels, who's online) + the open channel. */
.chat--irc { flex-direction: row; }
.chat__side {
  flex: none;
  width: 232px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 55%, var(--bg));
  overflow-y: auto;
}
.chat__side .chat__back { align-self: flex-start; margin-bottom: 10px; }
.chat__side-label {
  margin: 12px 8px 4px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.chat__chans { display: flex; flex-direction: column; gap: 2px; }
.chat__chan {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  font-weight: 700;
  text-decoration: none;
}
.chat__chan:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.chat__chan--active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.chat__chan-hash { opacity: 0.5; font-size: 1.1rem; }
.chat__names { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 3px; }
.chat__name { color: var(--text); font-size: 0.86rem; text-decoration: none; }
.chat__name:hover { color: var(--accent); }
.chat__name--anon { color: var(--text-muted); font-size: 0.78rem; }

.chat__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat__header .chat__channel { white-space: nowrap; }
.chat__header { min-height: 52px; }
.chat__topic {
  margin-left: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.chat__online { flex: none; }
.chat__online--connecting .chat__online-dot { background: var(--text-muted); box-shadow: none; }

/* Sigil avatars, as on profiles. */
.chat__avatar--sigil { background: none; overflow: hidden; border-radius: 10px; line-height: 0; }
.chat__avatar--sigil svg { width: 100%; height: 100%; display: block; }
.chat__avatar--link { cursor: pointer; }

/* Sent, not yet acknowledged. */
.chat__row--pending { opacity: 0.55; }
.chat__dev {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-contrast);
  background: var(--accent);
}

/* #ask-the-devs: the questions, as cards. */
.chat__askbtn {
  flex: none;
  margin-left: 12px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  color: var(--accent-contrast);
  background: var(--accent);
  cursor: pointer;
}
.chat__list--questions { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.chat__qcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  background-image: var(--paper);
  color: var(--text);
  text-decoration: none;
}
.chat__qcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.chat__qcard-tags { display: flex; gap: 6px; }
.chat__tag {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}
.chat__tag--answered { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.chat__qcard-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.chat__qcard-snippet {
  color: var(--text-muted);
  font-size: 0.86rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat__qcard-author { color: var(--text); font-weight: 700; }
.chat__qcard-foot { display: flex; gap: 14px; font-size: 0.76rem; color: var(--text-muted); }
.chat__askform {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 10px;
  background: var(--bg-elevated);
}
.chat__asktitle,
.chat__askform textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.chat__asktitle { font-weight: 700; }
.chat__askform textarea { resize: vertical; min-height: 90px; }
.chat__askbar { display: flex; justify-content: flex-end; }
.chat__askbar .chat__send { padding: 9px 18px; }
.chat__empty { margin: 40px auto; color: var(--text-muted); text-align: center; }

/* A thread: the question first, then the answers. */
.chat__crumb { color: var(--text-muted); text-decoration: none; font-weight: 700; white-space: nowrap; }
.chat__crumb:hover { color: var(--text); }
.chat__crumb-sep { color: var(--text-muted); }
.chat__channel--thread { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat__row--lead { padding: 10px 12px 12px; }
.chat__qtitle { margin: 2px 0 6px; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.25; }
.chat__thread-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 6px 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}
.chat__thread-rule::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Phones: channels as tabs on top, no name list. */
@media (max-width: 720px) {
  .chat--irc { flex-direction: column; }
  .chat__side {
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .chat__side .chat__back { margin: 0 6px 0 0; }
  .chat__side-label,
  .chat__names { display: none; }
  .chat__chans { flex-direction: row; }
  .chat__topic { display: none; }
}

/* ---------- A load that failed: the reason and a Retry (api.rs get_for_page) ---------- */

.load-error { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.load-error .btn { flex: none; }
/* Chat is instant, like a live stream's chat: nothing in it animates. */
.chat--irc,
.chat--irc * { animation: none !important; transition: none !important; }

/* ---------- Two-factor setup and sign-in (two_factor.rs, magic_link.rs) ---------- */

.tfa-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 6, 6, 0.86);
  overflow-y: auto;
}
.tfa-card {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  background-image: var(--paper);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.tfa-card .badge { align-self: flex-start; }
.tfa-title { margin: 0; font-family: var(--font-display); font-size: 1.4rem; }
.tfa-sub { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }
.tfa-qr {
  align-self: center;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  line-height: 0;
}
.tfa-qr svg { width: 220px; height: 220px; }
.tfa-key summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
.tfa-secret {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  word-break: break-all;
  user-select: all;
}
.tfa-form { display: flex; flex-direction: column; gap: 8px; }
.tfa-label { font-size: 0.85rem; color: var(--text-muted); }
.auth-input--code { font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.tfa-error { margin: 0; color: #e98a7f; font-size: 0.85rem; }
.tfa-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
/* The recovery phrase: 12 numbered words, as MetaMask shows a wallet's. */
.tfa-phrase {
  margin: 0;
  padding: 12px;
  list-style: none;
  counter-reset: word;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-radius: 8px;
  background: var(--bg);
}
.tfa-phrase li {
  counter-increment: word;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.tfa-phrase li::before { content: counter(word) "."; min-width: 1.6em; color: var(--text-muted); font-size: 0.78rem; text-align: right; }
.tfa-word { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95rem; user-select: all; }
@media (max-width: 420px) { .tfa-phrase { grid-template-columns: repeat(2, 1fr); } }
.tfa-copy { align-self: flex-start; }
.tfa-saved { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }

/* ---- Get Akoma: the latest build (version and its changes) ---- */
.latest-build {
  margin: 28px 0 0 24px;
  max-width: 640px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.latest-build__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.latest-build__label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.latest-build__version { font-size: 1.15rem; font-weight: 600; }
.latest-build__more { display: inline-block; margin-top: 10px; }

