/* ===================== the frame, and comms in it =====================

   Loaded last on every page (from _app_head.html), after mobile.css, so the
   frame can take over from the masthead and nav it replaced. Everything is
   drawn from the tokens in athex.css: the paper, the rule, the accent and
   the stamp. Nothing here relies on a browser's own look for a control. */

:root {
  --rail-w: 68px;
  --side-w: 264px;
  --tab-h: 58px;
  --strip-h: 26px;
  --rail-bg: #0a0b0d;
  --hover: rgba(255, 255, 255, 0.045);
  --lit: rgba(200, 162, 74, 0.13);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* ------------------------------------------------------- page to page */

/* The frame stays where it is while the page inside it changes: both pages
   carry the rail, the strip and the tabs under the same names, so only the
   page itself crossfades. Browsers without cross-document transitions just
   load the next page, as they always did. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.14s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ------------------------------------------------------------ the rail */

.atx-rail {
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  width: calc(var(--rail-w) + env(safe-area-inset-left));
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(12px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--rail-bg);
  border-right: 1px solid var(--rule);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  view-transition-name: atx-rail;
}
.atx-rail::-webkit-scrollbar { display: none; }

@media (min-width: 761px) {
  body:has(> .page-list > .atx-rail) {
    padding-left: calc(var(--rail-w) + env(safe-area-inset-left));
  }
}

.atx-rail-item,
.atx-rail-you {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: var(--paper);
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-radius .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}
.atx-rail-item svg { width: 20px; height: 20px; }
.atx-rail-item:hover,
.atx-rail-item:focus-visible {
  border-radius: 8px;
  border-color: var(--accent);
  background: rgba(200, 162, 74, 0.09);
  color: var(--fg);
  outline: none;
}
.atx-rail-item.is-active {
  border-radius: 6px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}
/* The pill on the rail's edge: a dot for something waiting, a bar for here. */
.atx-rail-item::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 50%;
  width: 4px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--fg);
  transform: translateY(-50%);
  transition: height .16s ease;
}
.atx-rail-item.has-unread::before { height: 8px; }
.atx-rail-item:hover::before { height: 18px; }
.atx-rail-item.is-active::before { height: 32px; background: var(--accent); }

.atx-rail-home { border-color: rgba(200, 162, 74, 0.55); }
.atx-rail-sigil { font-size: 21px; line-height: 1; color: var(--accent); }
.atx-rail-home.is-active .atx-rail-sigil { color: var(--bg); }
.atx-rail-ordinal { font: 700 13px var(--mono); letter-spacing: 0.06em; }
.atx-rail-quiet { background: transparent; }
.atx-rail-sep { flex: none; width: 28px; height: 1px; margin: 2px 0; background: var(--rule); }
.atx-rail-fill { flex: 1 1 auto; min-height: 6px; }

.atx-rail-you { border-radius: 50%; overflow: visible; }
.atx-rail-you:hover, .atx-rail-you:focus-visible, .atx-rail-you[aria-expanded="true"] { border-color: var(--accent); outline: none; }
.atx-rail-you.is-active { border-color: var(--accent); }
.atx-rail-seal.atx-seal-slot { flex: none; width: 34px; height: 34px; background: transparent; box-shadow: none; }
/* This terminal, live. */
.atx-rail-presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4f9f6a;
  border: 2px solid var(--rail-bg);
}

/* A count: accent for something waiting, the stamp for something naming you. */
.atx-count {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--bg);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0;
}
.atx-count.is-mention,
.has-mention > .atx-count { background: var(--stamp); color: #f4ece4; }
.atx-count[hidden] { display: none; }
.atx-rail .atx-count {
  position: absolute;
  right: -7px;
  bottom: -5px;
  box-shadow: 0 0 0 3px var(--rail-bg);
}

.atx-rail-tip {
  position: fixed;
  z-index: 90;
  transform: translateY(-50%);
  padding: 7px 10px;
  background: #050506;
  border: 1px solid var(--rule);
  color: var(--fg);
  font: 700 10px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.atx-rail-tip::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #050506;
  border-left: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-50%) rotate(45deg);
}

/* ------------------------------------------------------------ the strip */

/* Across the whole window, under the rail's edge, on every page: fixed to
   the top, with the page pushed down by its height. Comms is a screen
   rather than a page, and carries it as the first row of its column. */
body:not(.atx-comms):has(> .page-list > .atx-strip) {
  padding-top: calc(env(safe-area-inset-top) + var(--strip-h));
}
body:not(.atx-comms) > .page-list > .atx-strip {
  position: fixed;
  z-index: 25;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-left: calc(var(--rail-w) + env(safe-area-inset-left) + 16px);
  padding-right: max(16px, env(safe-area-inset-right));
}
.atx-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 26px;
  margin: 0 -16px 16px;
  padding: 0 16px;
  background: var(--stamp);
  color: #f4ece4;
  font: 700 9px var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  view-transition-name: atx-strip;
}
.atx-strip-cls { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.atx-strip-session { flex: none; display: flex; gap: 14px; opacity: 0.8; }

/* ------------------------------------------------------ your own card */

.atx-you { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.32); }
.atx-you-card {
  position: absolute;
  box-sizing: border-box;
  width: 300px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  animation: atx-pop .14s ease-out;
}
@keyframes atx-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes atx-rise { from { transform: translateY(100%); } }
.atx-you-sheet .atx-you-card {
  left: 0 !important;
  right: 0;
  bottom: 0 !important;
  width: auto;
  border-radius: 14px 14px 0 0;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  animation: atx-rise .2s ease-out;
}
.atx-you-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.atx-you-seal.atx-seal-slot { flex: none; width: 46px; height: 46px; }
.atx-you-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.atx-you-name { font: 700 14px var(--mono); letter-spacing: 0.12em; color: var(--fg); }
.atx-you-tier { font: 700 9px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.atx-you-close {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font: 18px/1 var(--mono);
  cursor: pointer;
}
.atx-you-close:hover, .atx-you-close:focus-visible { color: var(--fg); border-color: var(--accent); outline: none; }
.atx-you .atx-session { margin: 0; padding: 10px 0; border-top: 0; border-bottom: 1px solid var(--rule); gap: 6px 14px; }
.atx-you-links { display: flex; flex-direction: column; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.atx-you-links a,
.atx-you-links button,
.atx-you .atx-signout {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 700 10.5px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.atx-you-links svg, .atx-you .atx-signout svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.atx-you-links a:hover, .atx-you-links a:focus-visible,
.atx-you-links button:hover, .atx-you-links button:focus-visible { background: var(--lit); color: var(--accent); outline: none; }
.atx-you-links a:hover svg, .atx-you-links button:hover svg { color: currentColor; }
.atx-you-links [aria-current] { color: var(--accent); }
.atx-you-phone { display: none !important; }
.atx-you .atx-signout-form { display: block; margin: 8px 0 0; }
.atx-you .atx-signout { border: 1px solid var(--stamp-dim); color: var(--stamp); }
.atx-you .atx-signout svg { color: currentColor; }
.atx-you .atx-signout:hover, .atx-you .atx-signout:focus-visible { background: var(--stamp); border-color: var(--stamp); color: #f4ece4; outline: none; }

/* ------------------------------------------------------------- the tabs */

.atx-tabbar { display: none; }

/* ------------------------------------------------------------ switcher */

.atx-switch-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.58);
}
.atx-switch {
  width: min(580px, 100%);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  animation: atx-pop .14s ease-out;
}
.atx-switch-field {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 15px var(--mono);
  letter-spacing: 0.03em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.atx-switch-field::placeholder { color: var(--muted); }
.atx-switch-list { max-height: 52vh; overflow-y: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.atx-switch-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.atx-switch-opt:hover { background: var(--hover); }
.atx-switch-opt.is-picked { background: var(--lit); box-shadow: inset 2px 0 var(--accent); }
.atx-switch-seal { flex: none; width: 26px; height: 26px; display: block; }
.atx-switch-seal svg { width: 100%; height: 100%; display: block; }
.atx-switch-mark {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: var(--accent);
  font: 700 13px var(--mono);
}
.atx-switch-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.atx-switch-label { font: 600 13.5px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atx-switch-hint { font: 10px var(--mono); letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atx-switch-kind { flex: none; font: 700 8.5px var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.atx-switch-none { margin: 0; padding: 18px; text-align: center; color: var(--muted); font: 11px var(--mono); letter-spacing: 0.06em; }
.atx-switch-foot { padding: 8px 14px; border-top: 1px solid var(--rule); font: 9px var(--mono); letter-spacing: 0.14em; color: var(--muted); }

/* ================================================================ comms */

body.atx-comms > .page-list.atx-comms-frame {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.atx-comms-frame > .atx-strip { margin: 0; flex: none; }
/* athex.css holds every child of a page column at its natural height
   (body > .page-list > *), which would let a long conversation stretch comms
   past the window. This one takes exactly what is left. */
body.atx-comms > .page-list > .atx-comms-app { flex: 1 1 0; min-height: 0; }
.atx-comms-app {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  /* One row, exactly the height left: without it the row grows to fit the
     conversation and the log never has a height to scroll in. */
  grid-template-rows: minmax(0, 1fr);
  position: relative;
}

/* Opening: everything under a blur until it is ready to be read. The
   animation is the failsafe: if the scripts never say so, the blur goes on
   its own after eight seconds rather than leaving comms unusable. */
.atx-comms-side, .atx-comms-main { transition: filter .28s ease, opacity .28s ease; }
.atx-comms-loading > .atx-comms-side,
.atx-comms-loading > .atx-comms-main {
  filter: blur(10px);
  opacity: 0.55;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  animation: atx-comms-giveup 0s linear 8s forwards;
}
@keyframes atx-comms-giveup { to { filter: none; opacity: 1; pointer-events: auto; } }
.atx-comms-veil {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font: 700 10px var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.atx-comms-veil .atx-veil-mark { width: 72px; height: 72px; border-radius: 16px; }
.atx-comms-veil span { animation: atx-council-breathe 1.4s ease-in-out infinite; }
.atx-comms-loading > .atx-comms-veil { animation: atx-comms-veil-giveup 0s linear 8s forwards; }
@keyframes atx-comms-veil-giveup { to { opacity: 0; visibility: hidden; } }
.atx-comms-app:not(.atx-comms-loading) > .atx-comms-veil { opacity: 0; visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .atx-comms-veil span { animation: none; } }

/* ---------------------------------------------------------- the list */

.atx-comms-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--rule);
}
.atx-comms-side-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 10px 6px 16px;
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.atx-comms-side-title { flex: 1; min-width: 0; }
.atx-comms-side-title h1 { margin: 2px 0 0; font: 700 14px var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg); }
.atx-comms-kicker { display: block; font: 700 8.5px var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atx-comms-icon {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.atx-comms-icon svg { width: 16px; height: 16px; }
.atx-comms-icon:hover, .atx-comms-icon:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.atx-comms-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 8px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.atx-comms-group { margin-top: 4px; }
.atx-comms-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 6px;
  font: 700 9.5px var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.atx-comms-plus {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: 700 15px/1 var(--mono);
  cursor: pointer;
}
.atx-comms-plus:hover, .atx-comms-plus:focus-visible { border-color: var(--accent); background: var(--lit); outline: none; }

/* The lines, drawn as the rows of a list rather than the old address book. */
.atx-comms .atx-message-add { margin: 0 4px 8px; padding: 10px; border: 1px solid var(--rule); background: var(--bg); }
.atx-comms .atx-message-add input {
  border-radius: 0;
  font: 12px var(--mono);
  letter-spacing: 0.06em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.atx-comms .atx-message-add input::placeholder { color: var(--muted); }
.atx-comms .atx-message-add input:focus { border-color: var(--accent); }
.atx-comms .atx-message-add button {
  margin-left: -1px;
  padding: 0 12px;
  border-radius: 0;
  font: 700 9.5px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.atx-comms .atx-message-add button:hover,
.atx-comms .atx-message-add button:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
.atx-comms .atx-message-filter { padding: 0 4px 8px; border-bottom: 0; }
.atx-comms .atx-message-contact-list { overflow: visible; }
.atx-comms .atx-message-contact {
  position: relative;
  margin: 1px 0;
  border-bottom: 0;
  border-radius: 4px;
  color: var(--muted);
}
.atx-comms .atx-message-contact:hover { background: var(--hover); color: var(--fg); }
.atx-comms .atx-message-contact:focus-within { outline: none; }
.atx-comms .atx-message-contact.active { background: transparent; box-shadow: none; }
body.atx-comms[data-view="dm"] .atx-message-contact.active { background: var(--lit); color: var(--fg); }
.atx-comms .atx-message-contact-open { padding: 6px 0 6px 6px; }
.atx-comms .atx-message-contact-seal { flex-basis: 30px; width: 30px; height: 30px; }
.atx-comms .atx-message-contact-copy { padding: 6px 4px 6px 10px; }
.atx-comms .atx-message-contact-name {
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  font: 600 14px/1.25 var(--sans);
  letter-spacing: 0;
}
.atx-comms .atx-message-contact-name[readonly] { cursor: pointer; }
.atx-comms .atx-message-contact-name.atx-nick-editing { padding: 2px 4px; margin: -3px 0 0 -5px; border: 1px solid var(--accent); background: var(--bg); }
.atx-comms .atx-message-contact-preview { margin-top: 2px; font: 12px/1.3 var(--sans); }
.atx-comms .atx-message-contact:has(> .atx-unread-circle) .atx-message-contact-name { color: var(--fg); font-weight: 800; }
.atx-comms .atx-message-contact:has(> .atx-unread-circle) .atx-message-contact-preview { color: var(--fg); }
.atx-comms .atx-message-contact:has(> .atx-unread-circle)::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 8px;
  border-radius: 0 3px 3px 0;
  background: var(--fg);
  transform: translateY(-50%);
}
.atx-comms .atx-message-contact > .atx-unread-circle {
  min-width: 18px;
  height: 18px;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
}
/* The council, first in the list and drawn as a line. */
.atx-comms-council { cursor: pointer; }
.atx-comms-council .atx-message-contact-name { display: block; }
.atx-comms-council > .atx-count { margin: 0 8px 0 2px; }
body.atx-comms[data-view="council"] .atx-comms-council.active { background: var(--lit); color: var(--fg); }
.atx-comms .atx-comms-council.has-unread .atx-message-contact-name { color: var(--fg); font-weight: 800; }
.atx-comms .atx-comms-council.has-unread .atx-message-contact-preview { color: var(--fg); }
.atx-comms .atx-comms-council.has-unread::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 8px;
  border-radius: 0 3px 3px 0;
  background: var(--fg);
  transform: translateY(-50%);
}
.atx-comms-council:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.atx-comms .atx-message-empty { margin: 10px 8px; text-align: left; font: 11px var(--mono); letter-spacing: 0.04em; }

/* ---------------------------------------------------------- the panes */

.atx-comms-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.atx-comms-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.atx-comms .atx-comms-bar {
  flex: none;
  min-height: 52px;
  margin: 0;
  padding: 0 12px 0 16px;
  gap: 10px;
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  background: var(--bg);
}
.atx-comms-back { display: none !important; }
.atx-comms-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.atx-comms-title-words { min-width: 0; }
.atx-comms-title-words h2 {
  margin: 1px 0 0;
  font: 700 15px/1.2 var(--sans);
  letter-spacing: 0.01em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atx-comms .atx-message-thread-seal { flex: 0 0 28px; width: 28px; height: 28px; }

.atx-comms .atx-notice { margin: 10px 16px 0; }
.atx-comms .atx-council-panel { padding: 0; border: 0; background: transparent; }
.atx-comms .atx-council-log { margin: 0; border: 0; padding: 16px 16px 8px; }
.atx-comms .atx-council-jump { width: auto; margin: 0 16px 8px; border-top: 1px solid var(--rule); }
.atx-comms .atx-council-form { padding: 4px 16px 18px; }
.atx-comms-dm .atx-message-thread { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.atx-comms-dm .atx-message-log { flex: 1 1 auto; min-height: 0; padding: 16px 16px 8px; }
.atx-comms .atx-message-compose { border-top: 0; }

.atx-comms-toast {
  position: absolute;
  z-index: 6;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 9px 14px;
  background: #050506;
  border: 1px solid var(--accent);
  color: var(--fg);
  font: 700 10px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------- words that are links */

.atx-fileref {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
a.atx-fileref:hover { border-bottom-style: solid; }
.atx-weblink { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }

/* --------------------------------------------------- a record, inline */

.atx-embeds { display: flex; flex-direction: column; gap: 6px; max-width: 520px; margin-top: 6px; white-space: normal; }
.atx-embed {
  display: block;
  position: relative;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--muted);
  background: var(--paper);
  color: var(--fg);
  text-decoration: none;
  transition: border-color .12s ease;
}
.atx-embed:hover, .atx-embed:focus-visible { border-color: var(--accent); outline: none; }
.atx-embed-top { display: flex; align-items: center; gap: 10px; font: 700 9px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.atx-embed-number { color: var(--accent); }
.atx-embed-level { margin-left: auto; }
.atx-embed-title {
  margin-top: 6px;
  font: 600 14px/1.35 var(--sans);
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.atx-embed-meta { margin-top: 5px; font: 10px var(--mono); letter-spacing: 0.05em; color: var(--muted); }
.atx-embed-meta:empty { display: none; }
.atx-embed-wait .atx-embed-title {
  color: var(--muted);
  font: 700 9.5px var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: atx-council-breathe 1.4s ease-in-out infinite;
}
.atx-embed-l1 { border-left-color: #6f8f78; }
.atx-embed-l2 { border-left-color: #5b8fc4; }
.atx-embed-l3 { border-left-color: var(--accent); }
.atx-embed-l4 { border-left-color: #d9894a; }
.atx-embed-l5 { border-left-color: var(--stamp); }
.atx-embed-sealed {
  border-left-color: var(--stamp);
  background:
    repeating-linear-gradient(-45deg, rgba(158, 59, 48, 0.07) 0 8px, transparent 8px 16px),
    var(--paper);
}
.atx-embed-sealed .atx-embed-level { color: var(--stamp); }
.atx-embed-bar { display: inline-block; height: 12px; margin: 4px 6px 0 0; background: #000; border: 1px solid #222329; vertical-align: middle; }
.atx-embed-none { opacity: 0.7; }
.atx-embed-none .atx-embed-title { font: 700 9.5px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.atx-message-content-wrap { min-width: 0; }

/* ------------------------------------------------------------ reactions */

.atx-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.atx-react {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  font: 700 11px var(--mono);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.atx-react:hover:not(:disabled) { border-color: var(--muted); }
.atx-react.is-mine { border-color: var(--accent); background: rgba(200, 162, 74, 0.14); color: var(--accent); }
.atx-react:disabled { cursor: default; opacity: 0.8; }
.atx-react-mark { font: 15px/1 var(--emoji); }
.atx-react[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 5px 8px;
  background: #050506;
  border: 1px solid var(--rule);
  color: var(--fg);
  font: 700 9.5px var(--mono);
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}
@media (hover: none) { .atx-react[data-tip]:hover::after { display: none; } }
.atx-react-layer { position: fixed; inset: 0; z-index: 75; }
.atx-react-pick {
  position: fixed;
  box-sizing: border-box;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6);
  animation: atx-pop .12s ease-out;
}
.atx-react-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; }
.atx-react-opt {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: 20px/1 var(--emoji);
  cursor: pointer;
  transition: transform .1s ease, background .1s ease;
}
.atx-react-opt:hover, .atx-react-opt:focus-visible { background: var(--lit); transform: scale(1.12); outline: none; }
.atx-react-sheet { background: rgba(0, 0, 0, 0.45); }
.atx-react-sheet .atx-react-pick {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 14px 14px 0 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  animation: atx-rise .2s ease-out;
}
.atx-react-sheet .atx-react-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.atx-react-sheet .atx-react-opt { width: auto; height: 46px; font-size: 25px; }

/* ------------------------------------------------- a record, shared out */

.atx-recordhead-share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.atx-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  color: var(--fg);
  font: 700 9.5px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}
.atx-share svg { width: 15px; height: 15px; color: var(--accent); }
.atx-share:hover, .atx-share:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }

/* --------------------------------------------------------- this device */

.atx-device-pick { display: flex; align-items: center; gap: 10px; font: 700 9.5px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.atx-device-pick select {
  min-height: 36px;
  padding-left: 10px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background-color: var(--bg);
  color: var(--fg);
  font: 12px var(--mono);
  letter-spacing: 0.04em;
}

/* ======================================================== on a phone */

@media (max-width: 760px) {
  .atx-rail { display: none; }
  :root { --strip-h: 24px; }
  .atx-strip { min-height: 24px; font-size: 7.5px; letter-spacing: 0.14em; gap: 10px; }
  .atx-strip-session { display: none; }
  body:not(.atx-comms) > .page-list > .atx-strip { padding-left: max(16px, env(safe-area-inset-left)); }
  .atx-you-phone { display: flex !important; }

  .atx-tabbar {
    display: flex;
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    padding: 5px max(6px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: rgba(10, 11, 13, 0.96);
    border-top: 1px solid var(--rule);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    view-transition-name: atx-tabbar;
  }
  .atx-tabbar > a,
  .atx-tabbar > button {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font: 700 8.5px var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .atx-tabbar svg { width: 22px; height: 22px; }
  .atx-tabbar .is-active, .atx-tabbar [aria-expanded="true"] { color: var(--accent); }
  .atx-tab-seal.atx-seal-slot { flex: none; width: 24px; height: 24px; background: transparent; box-shadow: none; }
  .atx-tabbar .atx-count { position: absolute; top: 0; left: calc(50% + 5px); box-shadow: 0 0 0 2px var(--rail-bg); }
  body:has(> .page-list > .atx-tabbar) { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }

  .atx-switch-layer { padding: calc(10px + env(safe-area-inset-top)) 10px 10px; }
  .atx-switch-field { font-size: 16px; }
  .atx-switch-foot { display: none; }
  .atx-switch-list { max-height: 60vh; }

  /* Comms: the list is a screen, and a conversation is a screen. */
  body.atx-comms > .page-list.atx-comms-frame {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--atx-vvh, 100dvh);
    transform: translateY(var(--atx-vvtop, 0px));
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    overflow: hidden;
  }
  .atx-comms-frame > .atx-strip { margin: 0; }
  .atx-comms-app { position: relative; grid-template-columns: minmax(0, 1fr); }
  .atx-comms-side { display: none; border-right: 0; }
  .atx-comms-app.is-list .atx-comms-side { display: flex; }
  .atx-comms-app.is-list .atx-comms-main { display: none; }
  .atx-comms-side-head { min-height: 56px; }
  .atx-comms-side-title h1 { font-size: 17px; }
  .atx-comms-icon { width: 40px; height: 40px; }
  .atx-comms-side-scroll { padding: 8px 10px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
  .atx-comms .atx-message-contact-name { font-size: 16px; }
  .atx-comms .atx-message-contact-seal { flex-basis: 36px; width: 36px; height: 36px; }
  .atx-comms .atx-message-contact-preview { font-size: 13px; }
  body.atx-comms-thread .atx-tabbar,
  .atx-kbd .atx-tabbar { display: none; }

  .atx-comms .atx-comms-bar { min-height: 50px; padding: 0 8px 0 4px; }
  .atx-comms-back { display: inline-flex !important; border: 0 !important; padding: 0 8px !important; }
  .atx-comms-back svg { width: 22px !important; height: 22px !important; color: var(--fg) !important; }
  .atx-comms-title-words h2 { font-size: 16px; }
  .atx-comms .atx-notice { margin: 8px 10px 0; }
  .atx-comms .atx-council-log { padding: 10px 6px 6px; }
  .atx-comms .atx-council-jump { margin: 0 10px 6px; }
  .atx-comms-dm .atx-message-log { padding: 12px 8px; }
  .atx-comms-toast { top: 58px; }
  .atx-embeds { max-width: 100%; }
}
