/* 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; }


/* ---------- Vault: items that crumble (the Meet+ Pass) ----------
   The date it crumbles, small, in the slot's bottom-left corner. */
.slot { position: relative; }
.slot-expiry {
  position: absolute;
  left: 3px;
  bottom: 2px;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--heading);
  background: rgba(19, 16, 16, 0.78);
  pointer-events: none;
}

/* ---------- The Store: the tub (store_basket.rs, store_cart_rail.rs) ----------
   The cart is Infra's StoreTub model (never drawn here: CLAUDE.md, "Never
   model with CSS"), what is in the cart standing on its floor as its
   models, each placed by projecting its spot through the tub's camera
   (model_view.rs SceneCamera), so the scene keeps that camera's width to
   height (1.4). */
.basket__scene { position: relative; width: 100%; aspect-ratio: 1.4 / 1; }
.basket__tub { position: absolute; inset: 0; }
.basket__tub .game-model { width: 100%; height: 100%; }
.basket__thing {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  transform: translate(-50%, -100%);
  display: grid;
  place-items: center;
}
.basket__thing .game-model { width: 100%; height: 100%; }
.basket__thing > img { width: 70%; height: 70%; object-fit: contain; }
.basket__thing .badge { font-size: 0.7rem; }
.basket__qty {
  position: absolute;
  right: 0;
  top: 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
}
.basket__hint { min-height: 1.3em; margin: 2px 0 0; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.store-cart-rail.is-hot { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }

/* The list under the basket. */
.cart-row__head { gap: 8px; align-items: flex-start; }
.cart-row__remove {
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.cart-row__remove:hover { color: var(--heading); background: var(--surface-2); }

/* Store cards are picked up and carried to the basket. */
.store-card { cursor: grab; }
.store-card:active { cursor: grabbing; }
.store-card .btn { cursor: pointer; }
.store-card__buy { margin-top: auto; flex-wrap: wrap; gap: 8px; }

/* ---------- The Store: Plyril's shop (store.rs PlyrilCounter) ----------
   Plyril behind his desk in his shop, as Infra models on one camera: the
   room, the shelf with the goods on it, Plyril, the desk, a plant (back to
   front: each layer draws over the one behind). The scene keeps the
   camera's width to height (2.0), or the goods would leave the shelf.
   Click a good: he says what it is, and it flies into the tub. */
.counter { margin-bottom: 0.5rem; }
.counter__scene {
  position: relative;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 2 / 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
}
.counter__layer { position: absolute; inset: 0; pointer-events: none; }
.counter__layer .game-model { width: 100%; height: 100%; }
.counter__droid { animation: counter-bob 2.6s ease-in-out infinite; }
@keyframes counter-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.8%); } }

/* A good on the shelf: standing on its spot, turning; lit beneath when
   you point at it. */
.counter__good {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  transform: translate(-50%, -100%);
  cursor: pointer;
}
.counter__good:focus-visible { outline: none; }
/* The outline: each good renders alone in its own viewer (the per-object
   viewport), so its outline is an edge pass on that viewer's alpha, four
   offset copies of its silhouette in the heading colour, drawn only while it is
   pointed at (a filter on one small canvas, never on the whole scene). */
.counter__good:hover .counter__float .game-model,
.counter__good:focus-visible .counter__float .game-model {
  filter:
    drop-shadow(1.5px 0 0 var(--heading))
    drop-shadow(-1.5px 0 0 var(--heading))
    drop-shadow(0 1.5px 0 var(--heading))
    drop-shadow(0 -1.5px 0 var(--heading));
}
.counter__float { display: grid; place-items: center; width: 100%; height: 100%; }
.counter__float .game-model { width: 100%; height: 100%; }
.counter__float > img { width: 60%; height: 60%; object-fit: contain; }
.counter__tag {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 8%);
  white-space: nowrap;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--heading);
  background: rgba(19, 16, 16, 0.85);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.counter__good:hover .counter__tag,
.counter__good:focus-visible .counter__tag { opacity: 1; }
.counter__scene.is-saying .counter__tag { opacity: 0; }

/* What he says, under his head, pointing up at him. */
.counter__say {
  position: absolute;
  transform: translate(-50%, 0);
  max-width: 46%;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--heading);
  background: rgba(19, 16, 16, 0.92);
  border: 1px solid var(--border);
  z-index: 3;
}
.counter__say::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: inherit;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

/* A good on its way to the tub (page coordinates: it leaves the scene). */
.counter__flying {
  position: fixed;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1200;
  animation: counter-fly var(--fly) cubic-bezier(.4, 0, .6, 1) forwards;
}
.counter__flying .game-model { width: 100%; height: 100%; }
.counter__flying > img { width: 100%; height: 100%; object-fit: contain; }
@keyframes counter-fly {
  from { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(calc(-50% + var(--dx) * 0.45), calc(-50% + var(--dy) * 0.45 - 60px)) scale(0.9); }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.6); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .counter__droid, .counter__flying { animation: none; }
}

/* ---------- The Store: the tub (store_basket.rs, store_cart_rail.rs) ----------
   The cart is Infra's StoreTub model (never drawn here: CLAUDE.md, "Never
   model with CSS"), what is in the cart standing on its floor as its
   models, each placed by projecting its spot through the tub's camera
   (model_view.rs SceneCamera), so the scene keeps that camera's width to
   height (1.4). */
.basket__scene { position: relative; width: 100%; aspect-ratio: 1.4 / 1; }
.basket__tub { position: absolute; inset: 0; }
.basket__tub .game-model { width: 100%; height: 100%; }
.basket__thing {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  transform: translate(-50%, -100%);
  display: grid;
  place-items: center;
}
.basket__thing .game-model { width: 100%; height: 100%; }
.basket__thing > img { width: 70%; height: 70%; object-fit: contain; }
.basket__thing .badge { font-size: 0.7rem; }
.basket__qty {
  position: absolute;
  right: 0;
  top: 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
}
.basket__hint { min-height: 1.3em; margin: 2px 0 0; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.store-cart-rail.is-hot { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }

/* The list under the basket. */
.cart-row__head { gap: 8px; align-items: flex-start; }
.cart-row__remove {
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.cart-row__remove:hover { color: var(--heading); background: var(--surface-2); }


/* ---------- The hand (components/hand_cursor.rs) ----------
   The Dominara as the cursor, once Infra publishes it: the pointer's own
   cursor hidden (but the text cursor in a text field, where the hand steps
   aside), the hand's one viewer fixed and moved by a transform. */
html[data-hand],
html[data-hand] * { cursor: none !important; }
html[data-hand] :is(input, textarea, select, [contenteditable=""], [contenteditable="true"]) { cursor: text !important; }
.hand-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 128px;
  height: 128px;
  pointer-events: none;
  z-index: 2147483000;
  will-change: transform;
  /* the fingertip (hand_cursor.rs TIP_UP above the middle): the hand
     tilts about it, so it stays on the pointer */
  transform-origin: 64px 32px;
}
.hand-cursor.is-away,
.hand-cursor.is-text { visibility: hidden; }
.hand-cursor model-viewer {
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
}
/* What it holds: over everything else, the pointer passing through it to
   what is under it. */
[data-hand-held] { z-index: 60; pointer-events: none; transition: translate 90ms ease-out; }
.store-cart-rail[data-hand-over] { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---- The Pre-Alpha Stone (goods): its Store card and its checkout in the cart ---- */
.key-card { cursor: pointer; border: 1px solid var(--accent-700); }
.key-card:hover { border-color: var(--accent-600); }
.key-card:focus-visible { outline: 2px solid var(--accent-700); outline-offset: 2px; }
.key-card--owned { cursor: default; border-color: var(--border); }
.key-card__cta { margin-top: auto; align-self: flex-start; font-weight: 600; color: var(--accent-700); }
.key-card--owned .key-card__cta { color: var(--text-muted); }
.key-checkout__panel { margin-bottom: 10px; }
.key-checkout { gap: 8px; }
.key-pay { width: 100%; justify-content: center; }
.key-pay:not(:disabled) { background: var(--accent-700); color: var(--bg); border-color: var(--accent-700); }
.key-pay:disabled .pay-label__eth { opacity: 0.8; }

/* ---- The town (components/town.rs, static/js/town.js) ----
   The scene fills the page under the bar and beside the rail; the route's
   page is a paper panel over it. */
.town {
  position: fixed;
  top: var(--nav-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
  background: #a0cedf; /* SKY_MID, until the scene draws */
}
.shell-body--town.shell-body--cart .town { right: 320px; }
.town__canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.town-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  padding: 5px 11px;
  border-radius: 6px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  color: var(--text);
  font-size: 0.92rem;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.shell-body--town .shell-main.town-panel {
  position: fixed;
  z-index: 1;
  margin: 0;
  overflow: auto;
  background-color: var(--surface);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.shell-body--town .town-panel--home {
  left: calc(var(--sidebar-w) + 20px);
  top: calc(var(--nav-h) + 20px);
  width: min(430px, calc(100vw - var(--sidebar-w) - 40px));
  max-height: calc(100vh - var(--nav-h) - 40px);
  padding: 18px 22px;
}
.shell-body--town .town-panel--page {
  top: calc(var(--nav-h) + 16px);
  bottom: 16px;
  left: calc(var(--sidebar-w) + 16px);
  width: min(820px, calc((100vw - var(--sidebar-w)) * 0.52));
  padding: 22px 32px 48px;
  animation: town-panel-in 0.38s ease 1.05s both;
}
html:not([data-town-moved]) .shell-body--town .town-panel--page { animation-delay: 0.3s; }
.shell-body--town .town-panel--now { animation-delay: 0s; }
.shell-body--town.shell-body--cart .town-panel--page {
  width: min(460px, calc((100vw - var(--sidebar-w) - 320px) * 0.5));
}
@keyframes town-panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.town-back {
  position: sticky;
  top: -6px;
  z-index: 2;
  margin: -6px 0 14px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--paper-ink-line);
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.town-back:hover { border-color: var(--accent-700); }
.home--plaza .home__eyebrow { margin: 0 0 4px; }
.home--plaza .home__title { font-size: 1.6rem; margin: 0 0 8px; }
.home--plaza .home__lead { margin: 0 0 14px; font-size: 0.98rem; }
.home--plaza .home__cta-row { margin: 0; }
.home__plaza-stats { margin: -6px 0 12px; font-size: 0.9rem; color: var(--accent-700); }
.home__plaza-hint { margin: 12px 0 0; font-size: 0.88rem; color: var(--text-muted); }

@media (max-width: 900px) {
  /* Under the rail, not under it: the town is a block that stays at the
     top while the page's panel scrolls up over it. */
  .town { position: sticky; top: var(--nav-h); height: 58vh; }
  .shell-body--town .town + .shell-main.town-panel--page { margin-top: -6vh; }
  .shell-body--town .town + .shell-main.town-panel--home { margin-top: -10vh; }
  /* The page scrolls over the town: the town shows above the panel. */
  .shell-body--town .shell-main.town-panel {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    margin: 0 10px 16px;
    padding: 18px 16px 28px;
  }
  .shell-body--town.shell-body--cart .town-panel--page { width: auto; }
  .shell-body--town .store-cart-rail { position: relative; z-index: 1; }
}
.town-back--scene { position: absolute; top: auto; bottom: 18px; left: 50%; transform: translateX(-50%); margin: 0; z-index: 2; }
/* The Store in the town: everything on sale is in Plyril's shop, so its
   panel is a short note and the rail only pays. */
@media (min-width: 901px) {
  .shell-body--town.shell-body--cart .town-panel--short { bottom: auto; width: min(360px, 30vw); }
}
.store-content--shop h1 { font-size: 1.5rem; }
/* Plyril's words in the town (town.js say): a bubble over his head. */
.town-say {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 260px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  color: var(--text);
  font-size: 0.95rem;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.cart-row__count { color: var(--accent-700); font-weight: 600; }

/* ---- The Workshop's console (town.js screen): the Dev Blog read on its
   back screen, the latest posts on its desk screens. Each is laid over its
   screen in the scene by a matrix3d; hidden until it is. ---- */
.shell-body--town .shell-main.town-panel--screen,
.town-desk {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  bottom: auto;
  margin: 0;
  visibility: hidden;
  transform-origin: 0 0;
  background-color: color-mix(in srgb, #65c4da 10%, #071316);
  background-image: none;
  border: 1px solid color-mix(in srgb, #65c4da 45%, transparent);
  border-radius: 6px;
  box-shadow: 0 0 24px color-mix(in srgb, #65c4da 30%, transparent);
  color: #dff4f8;
}
.shell-body--town .shell-main.town-panel--screen {
  z-index: 1;
  width: 440px;
  height: 704px;
  max-height: none;
  padding: 16px 20px 32px;
  overflow: auto;
  animation: none;
  font-size: 15px;
}
.town-desk {
  z-index: 1;
  width: 260px;
  height: 150px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  overflow: hidden;
}
.town-desk:hover { border-color: #65c4da; }
.town-desk__date { font-size: 0.8rem; color: #9fd8e6; }
.town-desk__title { font-size: 1.05rem; font-weight: 600; line-height: 1.25; }
/* The Meeting Stone's question, under the stone. */
.town-ask {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 12px 16px;
  border-radius: 10px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.town-ask__q { margin: 0 0 10px; font-size: 1.05rem; }
.town-ask__row { display: flex; gap: 10px; justify-content: center; }

/* ---- The Library (pages/codex/library_scene.rs, static/js/library.js) ----
   The article a book on the lectern shows is laid out here, off screen, in
   CSS columns (one a page), and drawn onto the book's pages from where the
   browser put each word. While a book is read the Codex's panel steps
   aside; the desk under the book turns its pages. */
.library-src {
  position: fixed;
  left: -30000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  /* A book hand (library.js loads it when a book opens). */
  font-family: "Almendra", var(--font-display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.42;
  color: #000;
  background: none;
}
.library-src h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; font-weight: 700; }
.library-src h2 { font-size: 21px; line-height: 1.2; margin: 18px 0 6px; font-weight: 700; }
.library-src h3 { font-size: 18px; margin: 14px 0 4px; font-weight: 700; }
.library-src p { margin: 0 0 10px; }
.library-src .library-src__summary { font-style: italic; margin-bottom: 16px; }
.library-src ul, .library-src ol { list-style: none; margin: 0 0 10px; padding-left: 24px; }
.library-src li { margin: 0 0 3px; }
.library-src blockquote { margin: 0 0 10px; padding-left: 14px; font-style: italic; }
.library-src img { max-width: 100%; max-height: 300px; display: block; margin: 6px auto; }
.library-src figure { margin: 0 0 10px; }
.library-src details summary { list-style: none; font-style: italic; }
.library-src a { color: inherit; text-decoration: none; }
/* The Library is the Codex (owner): its panel is not shown, only the way
   back to the town. */
html[data-library] .shell-body--town .shell-main.town-panel--page {
  width: auto;
  bottom: auto;
  padding: 0;
  overflow: visible;
  background: none;
  border: 0;
  box-shadow: none;
}
html[data-library] .shell-body--town .town-panel--page > :not(.town-back) { display: none; }
html[data-library] .shell-body--town .town-panel--page > .town-back { margin: 0; }
.library-catalogue {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: min(280px, 30vw);
}
.library-catalogue .input {
  width: 100%;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.library-catalogue__hits {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  border-radius: 8px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.library-catalogue__hits button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.library-catalogue__hits button:hover { background: var(--surface-2); color: var(--heading); }
.library-desk {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  border: 1px solid var(--paper-ink-line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.library-desk__turn {
  width: 38px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--paper-ink-line);
  background: var(--surface-2);
  color: var(--heading);
  font: 600 1.3rem/1 var(--font-display);
  cursor: pointer;
}
.library-desk__turn:hover:not(:disabled) { border-color: var(--accent-700); }
.library-desk__turn:disabled { opacity: 0.35; cursor: default; }
.library-desk__pages { min-width: 92px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ---- The Vault in the Bank: the chosen item (vault.rs, vault_floor.rs) ----
   Its details over the grid, from a slot or from the bank's floor. */
.inventory-grid .slot.slot--chosen {
  background: color-mix(in srgb, var(--accent) 16%, rgba(228, 217, 195, 0.06));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.vault-chosen {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--paper-ink-line);
  border-radius: 12px;
  background-color: rgba(228, 217, 195, 0.04);
  background-image: var(--paper);
  min-width: 0;
}
.vault-chosen__head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.vault-chosen__name { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.vault-chosen__count { color: var(--text-muted); font-size: 0.9rem; }
.vault-chosen__close {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.vault-chosen__close:hover { color: var(--text); }
.vault-chosen__examine { margin: 6px 0 0; color: var(--text); }
.vault-chosen__expiry { margin: 4px 0 0; font-size: 0.88rem; }
.vault-chosen__act {
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--paper-ink-line));
  background: none;
  color: var(--accent-700);
  cursor: pointer;
}
/* The grid in the town's panel: as many slots as fit, not 14 squeezed. */
.town-panel .inventory-grid {
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}
.town-panel .inventory-grid .count { right: 5px; bottom: 3px; font-size: 11px; }
/* Get Akoma: the Pre-Alpha Stone's model on the box. */
.prealpha-box__stone { height: 140px; display: flex; justify-content: center; }
.prealpha-box__stone .game-model, .prealpha-box__stone img { width: 140px; height: 140px; }
/* The Dev Blog on the console's screen: one column, nothing wider than it. */
.town-panel--screen .devblog-page,
.town-panel--screen .container { max-width: none; width: auto; margin: 0; padding: 0; }
.town-panel--screen .devblog-render-grid { grid-template-columns: 1fr; gap: 12px; }
.town-panel--screen .devblog-card__hero--empty { display: none; }
.town-panel--screen img { max-width: 100%; height: auto; }
.town-panel--screen * { min-width: 0; }

/* ---- The town without instruction panels (owner): the Store is its
   scene alone; one small chip out of any building; the cart rail only
   while the basket holds something. ---- */
.shell-body--town .shell-main.town-panel--bare {
  top: calc(var(--nav-h) + 12px);
  left: calc(var(--sidebar-w) + 12px);
  width: auto;
  max-width: 420px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  pointer-events: none;
  animation: none;
}
.shell-body--town .shell-main.town-panel--bare > * { pointer-events: auto; }
.town-chip {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 16px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--paper-ink-line);
  background-color: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.town-chip:hover { color: var(--text); border-color: var(--accent-700); }
.shell-body--town.shell-body--cart .town-chip { right: calc(320px + 16px); }
html[data-cart-empty] .shell-body--town .store-cart-rail { display: none; }
html[data-cart-empty] .shell-body--town.shell-body--cart .town { right: 0; }
html[data-cart-empty] .shell-body--town.shell-body--cart .town-chip { right: 16px; }
@media (max-width: 900px) {
  .town-chip { top: calc(var(--nav-h) + 8px); right: 10px; }
  .shell-body--town.shell-body--cart .town-chip { right: 10px; }
}
/* The plaza's Pre-Alpha panel: small, tucked in its corner. */
.shell-body--town .town-panel--home { width: min(340px, calc(100vw - var(--sidebar-w) - 40px)); padding: 14px 16px; }
.home--plaza .home__title { font-size: 1.25rem; }
.home--plaza .home__lead { font-size: 0.88rem; margin-bottom: 10px; }
.home--plaza .home__cta { font-size: 0.95rem; padding: 8px 16px; }
.home--plaza .home__plaza-hint { margin-top: 8px; }
/* The plaza: the counts and the button only, small, bottom left over the
   scene (owner). */
.shell-body--town .shell-main.town-panel--home {
  top: auto;
  bottom: 18px;
  left: calc(var(--sidebar-w) + 18px);
  width: auto;
  max-width: 320px;
  padding: 10px 12px;
  background-color: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.home--plaza { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.home--plaza .home__plaza-stats { margin: 0; font-size: 0.85rem; }
.home--plaza .home__cta { margin: 0; font-size: 0.95rem; padding: 7px 16px; }
@media (max-width: 900px) {
  .shell-body--town .shell-main.town-panel--home { margin: -64px 10px 16px; max-width: none; }
}
.library-catalogue__hits button { display: flex; flex-direction: column; gap: 1px; }
.library-catalogue__title { color: var(--heading); }
.library-catalogue__summary {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
/* An editor's name and summary edit, over the desk at the lectern. */
.library-edit {
  position: absolute;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  width: min(420px, 80%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 10px;
  background-color: var(--bg-elevated);
  background-image: var(--paper);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
.library-edit .label { margin: 4px 0 0; }
.library-edit__note { margin: 4px 0 0; font-size: 0.85rem; }
.library-edit__error { margin: 4px 0 0; font-size: 0.9rem; color: #e0705f; }
.library-edit__row { display: flex; gap: 8px; margin-top: 8px; }
