/* axi0 Chat (/chat/): the axi0 family look (as Meet, Notes and Translate): true black or warm paper, Instrument Sans,
   the orange core as the one accent. No inline styles in the markup: the page runs under style-src 'self'; the few
   positions the script computes are custom properties. */
@font-face {
  font-family: "Instrument Sans";
  src: url(/axi0/fonts/instrument-sans-latin-var.woff2) format("woff2");
  font-weight: 400 700;
  font-display: optional;
}
:root {
  --bg: #000; --panel: #0a0a0c; --panel2: #111115; --field: #050506; --hover: #18181d; --mine: #17130d;
  --line: #1c1c21; --line2: #2a2a31; --field-line: #3a3a42;
  --head: #fff; --text: #d6d6dc; --soft: #b4b4bd; --lede: #a3a3ad; --mute: #8e8e98; --place: #7c7c87;
  --core: #f6a04d; --core-ink: #f6a04d; --core-hover: #ffb26a; --on-core: #000;
  --danger: #ff8f78; --shade: rgba(0, 0, 0, .6); --menu-shadow: 0 14px 44px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
html[data-axi0-theme="light"] {
  --bg: #f6f2ea; --panel: #fffdf9; --panel2: #efe8dc; --field: #fffdf9; --hover: #efe8dc; --mine: #f8eedf;
  --line: #e6dfd3; --line2: #d3cabb; --field-line: #8a8174;
  --head: #17140f; --text: #2c2823; --soft: #4a433b; --lede: #4f4940; --mute: #675f54; --place: #6f665a;
  --core-ink: #9a4a0a; --danger: #b3261e; --shade: rgba(23, 20, 15, .5); --menu-shadow: 0 14px 44px rgba(23, 20, 15, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  html:not([data-axi0-theme="dark"]) {
    --bg: #f6f2ea; --panel: #fffdf9; --panel2: #efe8dc; --field: #fffdf9; --hover: #efe8dc; --mine: #f8eedf;
    --line: #e6dfd3; --line2: #d3cabb; --field-line: #8a8174;
    --head: #17140f; --text: #2c2823; --soft: #4a433b; --lede: #4f4940; --mute: #675f54; --place: #6f665a;
    --core-ink: #9a4a0a; --danger: #b3261e; --shade: rgba(23, 20, 15, .5); --menu-shadow: 0 14px 44px rgba(23, 20, 15, .18);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text); background: var(--bg);
  font: 15px/1.55 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: var(--core-ink); text-underline-offset: 3px; }
::selection { background: rgba(246, 160, 77, .35); }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 30; padding: 8px 14px; border-radius: 999px; background: var(--core); color: var(--on-core); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--core-ink); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg use { pointer-events: none; }

/* ---- header (as Meet) ----------------------------------------------------------------------------------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 22px 20px 8px; }
.mark { display: inline-flex; align-items: baseline; gap: .12em; color: var(--head); text-decoration: none; font-size: 26px; font-weight: 600; letter-spacing: -.045em; white-space: nowrap; }
.mark-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--core); box-shadow: 0 0 9px var(--core); transform: translateY(-2px); }
.mark-s { color: var(--mute); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 14px; }
.top-nav { display: flex; gap: 20px; }
.top-nav a { color: var(--soft); text-decoration: none; font-size: 14px; line-height: 44px; }
.top-nav a:hover { color: var(--head); text-decoration: underline; }
.theme-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line2); border-radius: 50%;
  background: var(--panel); color: var(--soft); cursor: pointer;
}
.theme-btn:hover { border-color: var(--core); color: var(--head); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon, html[data-axi0-theme="light"] .theme-btn .i-sun { display: none; }
html[data-axi0-theme="light"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-axi0-theme="dark"]) .theme-btn .i-sun { display: none; }
  html:not([data-axi0-theme="dark"]) .theme-btn .i-moon { display: block; }
}
.me-slot { position: relative; flex: none; width: 36px; height: 36px; }
.me-slot:empty { display: none; }
@media (max-width: 560px) { .top-nav { display: none; } .top { padding-top: 14px; } }

/* ---- shared --------------------------------------------------------------------------------------------------- */
main { max-width: 1180px; margin: 0 auto; padding: 4px 20px 24px; }
h1 { margin: 22px 0 8px; color: var(--head); font-size: clamp(32px, 5vw, 44px); font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
h2 { margin: 0 0 10px; color: var(--head); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.lede { max-width: 46em; margin: 0; color: var(--lede); font-size: 16px; }
.card { padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.card > p { margin: 0 0 12px; }
label { display: block; margin: 16px 0 6px; color: var(--head); font-size: 14px; }
input[type="text"], textarea {
  width: 100%; min-height: 44px; padding: 9px 13px; border: 1px solid var(--field-line); border-radius: 12px;
  background: var(--field); color: var(--head); font: inherit; font-size: 15px;
}
input::placeholder, textarea::placeholder { color: var(--place); }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--core); box-shadow: 0 0 0 3px rgba(246, 160, 77, .2); }
.hint { margin: 6px 0 0; color: var(--mute); font-size: 13px; }
.error { margin: 10px 0 0; color: var(--danger); font-size: 14px; }
.note { margin: 8px 0 0; color: var(--core-ink); font-size: 13px; }
.error:empty, .note:empty, .hint:empty { display: none; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.row.tight { flex-wrap: nowrap; margin-top: 0; }
.row.tight input { flex: 1 1 auto; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 9px; margin: 12px 0 0; font-size: 14px; color: var(--text); cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--core); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; margin: 0;
  border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); color: var(--head); font: inherit; font-size: 14px;
  white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: rgba(246, 160, 77, .7); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { border-color: var(--core); background: var(--core); color: var(--on-core); font-weight: 600; }
.btn.primary:hover { background: var(--core-hover); }
.btn.big { min-height: 50px; padding: 0 26px; font-size: 16px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--soft); cursor: pointer; }
.icon:hover { background: var(--hover); color: var(--head); }
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.small { width: 32px; height: 32px; }
.icon.small svg { width: 18px; height: 18px; }
#i-more circle, .icon svg circle { fill: currentColor; stroke: none; }

/* ---- home ----------------------------------------------------------------------------------------------------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; margin-top: 22px; align-items: start; }
@media (max-width: 860px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.start label:first-of-type { margin-top: 4px; }
.join-form { margin-top: 20px; padding-top: 6px; border-top: 1px solid var(--line); }
.rooms { margin: 0; padding: 0; list-style: none; }
.rooms a {
  display: flex; align-items: center; min-height: 46px; margin-top: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px;
  color: var(--head); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.rooms a:hover { border-color: rgba(246, 160, 77, .7); }
.keybox { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.keybox .unlock label:first-child { margin-top: 12px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--lede); font-size: 14px; }
.facts li { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; }
.facts strong { display: block; margin-bottom: 4px; color: var(--head); font-weight: 600; }
@media (min-width: 860px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- a room --------------------------------------------------------------------------------------------------- */
body.v-room main { display: flex; height: calc(100dvh - 74px); padding-bottom: 16px; }
.room { flex: 1 1 auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; min-height: 0; min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; padding-top: 6px; }
.rail-h { margin: 0 0 2px; color: var(--mute); font-size: 13px; }
.rail ul { margin: 0 0 8px; padding: 0; list-style: none; }
.rail a:not(.btn) {
  display: block; padding: 9px 12px; border-radius: 12px; color: var(--soft); text-decoration: none; font-size: 14px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.rail a:not(.btn):hover { background: var(--hover); color: var(--head); }
.rail a[aria-current="page"] { background: var(--panel2); color: var(--head); font-weight: 600; }
.rail .btn { align-self: flex-start; }
.pane { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); overflow: hidden; }
.room-top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.room-top .back { display: none; margin-left: -8px; }
.room-title { flex: 1 1 auto; min-width: 0; }
.room-title h1 { margin: 0; font-size: 20px; letter-spacing: -.015em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.here { margin: 1px 0 0; color: var(--mute); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.here:empty::before { content: "\00a0"; }
.banner { margin: 0; padding: 9px 18px; border-bottom: 1px solid var(--line); background: var(--panel2); color: var(--soft); font-size: 13px; }
.log-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 18px 12px; overscroll-behavior: contain; }
.log-wrap:focus { outline: none; }
.older { display: flex; justify-content: center; padding: 8px 0 2px; }
.older:empty { display: none; }
.log { margin: 0; padding: 0; list-style: none; }
.day { display: flex; justify-content: center; margin: 14px 0 6px; }
.day span { padding: 2px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--mute); font-size: 12px; }
.sys { margin: 8px 0; text-align: center; }
.sys p { margin: 0; color: var(--mute); font-size: 13px; }
.msg { position: relative; margin: 0; padding: 8px 40px 2px 10px; border-radius: 12px; }
.msg.cont { padding-top: 0; }
.msg.mine { background: linear-gradient(90deg, transparent, var(--mine)); }
.msg.flash { background: rgba(246, 160, 77, .16); }
.msg .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; color: var(--mute); font-size: 12.5px; }
.msg .who { color: var(--head); font-size: 14px; font-weight: 600; }
.msg.mine .who { color: var(--core-ink); }
.tag { padding: 0 6px; border: 1px solid var(--line2); border-radius: 999px; font-size: 11.5px; }
.tag.pend { border-color: transparent; font-style: italic; }
.bubble .text { margin: 2px 0 2px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .text.gone { color: var(--mute); font-style: italic; }
.bubble .text a { overflow-wrap: anywhere; }
.quote {
  display: block; width: 100%; max-width: 560px; margin: 4px 0 2px; padding: 5px 10px; border: 0; border-left: 3px solid var(--core);
  border-radius: 6px; background: var(--panel2); color: var(--soft); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.quote b { color: var(--head); font-weight: 600; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 4px; }
.re {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; min-width: 44px; padding: 0 10px; border: 1px solid var(--line2);
  border-radius: 999px; background: var(--panel); color: var(--soft); font: inherit; font-size: 13px; cursor: pointer;
}
.re .e { font-size: 15px; line-height: 1; }
.re[aria-pressed="true"] { border-color: var(--core); background: rgba(246, 160, 77, .14); color: var(--head); }
.more { position: absolute; top: 4px; right: 4px; opacity: 0; }
.msg:hover .more, .msg:focus-within .more, .more:focus-visible { opacity: 1; }
@media (hover: none) { .more { opacity: .75; } }
.wrong { margin: 18px; }
.wrong h2 { font-size: 20px; }
.joinbar, .composer { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.joinbar label { margin-top: 0; }
.ctx { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 0 6px; padding-left: 10px; border-left: 3px solid var(--core); color: var(--soft); font-size: 13px; }
.ctx span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.compose-row textarea { flex: 1 1 auto; min-width: 0; height: 46px; max-height: 220px; resize: none; line-height: 1.45; padding-top: 11px; }
.send {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
  background: var(--core); color: var(--on-core); cursor: pointer;
}
.send:hover { background: var(--core-hover); }
.send:disabled { opacity: .45; cursor: default; }
.send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.count { margin: 5px 0 0; color: var(--mute); font-size: 12px; }
.count:empty { display: none; }
.count.over { color: var(--danger); }
.btn.call { min-height: 40px; padding: 0 14px; }

/* ---- menus and dialogs ---------------------------------------------------------------------------------------- */
.menu {
  position: fixed; z-index: 40; left: var(--x, 8px); top: var(--y, 8px); min-width: 230px; max-width: calc(100vw - 16px); padding: 6px;
  border: 1px solid var(--line2); border-radius: 14px; background: var(--panel); box-shadow: var(--menu-shadow);
}
.menu > button {
  display: block; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--head);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.menu > button:hover, .menu > button:focus-visible { background: var(--hover); outline: none; }
.menu > button.danger { color: var(--danger); }
.menu > button[aria-checked="true"]::after { content: "On"; float: right; color: var(--core-ink); font-size: 12px; }
.react-row { display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; justify-content: center; padding: 4px 4px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.re-pick { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; font-size: 21px; line-height: 1; cursor: pointer; }
.re-pick:hover, .re-pick:focus-visible { background: var(--hover); outline: none; }
.re-pick[aria-checked="true"] { background: rgba(246, 160, 77, .2); }
.dlg { width: min(480px, calc(100vw - 32px)); padding: 22px 24px 22px; border: 1px solid var(--line2); border-radius: 20px; background: var(--panel); color: var(--text); }
.dlg::backdrop { background: var(--shade); }
.dlg h2 { margin-bottom: 8px; }
.dlg p { margin: 0 0 10px; color: var(--lede); font-size: 14px; }
.dlg label { margin-top: 10px; }
.linkbox { display: flex; gap: 10px; }
.linkbox input { flex: 1 1 auto; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.qr { width: 184px; margin-top: 12px; padding: 12px; border-radius: 14px; background: #fff; }
.qr:empty { display: none; }
.qr svg { display: block; width: 100%; height: auto; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: min(92vw, 520px); margin: 0; padding: 10px 16px;
  border-radius: 12px; background: var(--head); color: var(--bg); font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.on { opacity: 1; }

/* ---- phones ---------------------------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .room { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .room-top .back { display: grid; }
}
@media (max-width: 640px) {
  body.v-room .top { display: none; }
  body.v-room main { height: 100dvh; padding: 0; }
  body.v-room .pane { border: 0; border-radius: 0; }
  .room-top { padding: 8px 6px 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
  .btn.call span { display: none; }
  .btn.call { width: 44px; min-height: 44px; padding: 0; }
  .log-wrap { padding: 4px 10px 10px; }
  .msg { padding-right: 36px; }
  .composer, .joinbar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .toast { bottom: 110px; }
  .card { padding: 18px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
