/* Palette: deep pine ink on warm paper, jade for own messages.
   Local font stack only, so nothing loads from a third party. */
/* --ui-zoom scales the whole page. The macOS app sets it from the screen size
   so the phone width layout grows to fill a desktop window instead of sitting
   in a small strip, and every vh rule above divides by it to stay inside the
   window. A browser leaves it at 1. */
:root { --ui-zoom: 1; }
html { zoom: var(--ui-zoom); }

:root {
  --pine: #16211e;
  --pine-soft: #23332d;
  --paper: #f6f3ea;
  --paper-raise: #fffdf7;
  --jade: #1f6b52;
  --jade-deep: #14493a;
  --amber: #c8842a;
  --clay: #a6483a;
  --line: rgba(22, 33, 30, .14);
  --shadow: 0 18px 40px rgba(22, 33, 30, .18);
  --radius: 14px;
  --font: "Avenir Next", "Optima", "Futura", "Helvetica Neue", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color-scheme: light;
  font: 16px/1.55 var(--font);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--pine); min-height: calc(100vh / var(--ui-zoom, 1)); }
input, button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------- gate screen ---------- */
#gate {
  min-height: calc(100vh / var(--ui-zoom, 1)); display: grid; place-items: center; padding: 28px 18px;
  position: relative; animation: gate-in .5s ease-out both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(14px); } }
.gate-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(31, 107, 82, .22), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(200, 132, 42, .20), transparent 38%),
    radial-gradient(circle at 70% 88%, rgba(22, 33, 30, .16), transparent 46%),
    linear-gradient(150deg, #1b2a25 0%, #22332c 48%, #2c3b31 100%);
}
.gate-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 253, 247, .05) 1px, transparent 1px);
  background-size: 100% 26px;
  mask-image: radial-gradient(circle at 50% 40%, #000 10%, transparent 72%);
}

.gate-card {
  width: min(430px, 100%); background: var(--paper-raise);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 26px 24px 22px;
}
/* Wordmark: 聊生活 followed by l.xai.cool, where the amber period is the dot
   between the two halves and nothing else carries a period. */
.brand, .side-brand { display: flex; align-items: baseline; gap: 9px; }
.brand-cn { font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; }
.brand-en { display: flex; align-items: baseline; }
.mark { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.dot { font-size: 1.9rem; font-weight: 700; color: var(--amber); }
.tld { font-size: 1.15rem; font-weight: 600; color: var(--jade); }
.tagline { margin: 6px 0 16px; font-size: .86rem; color: rgba(22, 33, 30, .62); }

#status {
  margin: 0 0 16px; padding: 9px 12px; border-radius: 10px; font-size: .88rem;
  background: rgba(31, 107, 82, .10); border-left: 3px solid var(--jade);
}
#status[data-tone="warn"] { background: rgba(166, 72, 58, .12); border-left-color: var(--clay); }

#join { display: grid; gap: 16px; }
.identity { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--jade), var(--jade-deep)); color: #fffdf7;
  font-weight: 700; font-size: 1.15rem;
}
.field { display: grid; gap: 5px; flex: 1; }
.field > span { font-size: .78rem; letter-spacing: .04em; color: rgba(22, 33, 30, .6); }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 11px; background: #fff;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--jade); outline-offset: 1px;
}

/* Preset avatars on the gate. Four faces drawn from the shared table, with the
   nickname initial used when none is picked. */
.avatar-pick { display: grid; gap: 7px; margin: 2px 0 4px; }
.pick-label { font-size: .76rem; color: rgba(22, 33, 30, .58); }
.avatar-choices { display: flex; gap: 8px; flex-wrap: wrap; }
/* Each choice is the face plus its name underneath, so the four presets can be
   picked by name as well as by look. */
.avatar-option { display: grid; justify-items: center; gap: 4px; }
.avatar-name { font-size: .74rem; color: rgba(22, 33, 30, .62); }
.avatar-option:has(.avatar-choice[aria-checked="true"]) .avatar-name {
  color: var(--jade-deep); font-weight: 600;
}
.avatar-choice {
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper-raise);
  display: grid; place-items: center; overflow: hidden;
  transition: border-color .14s ease, background .14s ease;
}
.avatar-choice:hover { background: #fff; border-color: rgba(31, 107, 82, .45); }
.avatar-choice[aria-checked="true"] {
  border-color: var(--jade); background: rgba(31, 107, 82, .12);
  box-shadow: 0 0 0 2px rgba(31, 107, 82, .28);
}
.avatar-choice svg { width: 100%; height: 100%; display: block; }
/* The gate avatar grows to the same box as the choices so the picked face is
   visible where it was chosen. */
.identity .avatar svg { width: 100%; height: 100%; display: block; }

/* Small face beside a member name or above a received bubble. */
.mini-avatar {
  flex: none; width: 22px; height: 22px; border-radius: 7px; display: inline-grid;
  place-items: center; background: rgba(22, 33, 30, .1); overflow: hidden;
  font-size: .68rem; font-weight: 700; color: rgba(22, 33, 30, .68);
  vertical-align: middle;
}
.mini-avatar svg { width: 100%; height: 100%; display: block; }
.member .mini-avatar { background: rgba(255, 253, 247, .14); color: rgba(243, 239, 228, .82); }
.msg .who { display: flex; align-items: center; gap: 6px; }

/* Menu-style room setup: rows split by hairlines, like a settings list. */
.menu { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.menu-title {
  padding: 10px 14px 8px; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(22, 33, 30, .52); background: rgba(22, 33, 30, .04);
}
.row {
  display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px;
  padding: 11px 14px; border-top: 1px solid var(--line);
}
.row-label { font-size: .9rem; font-weight: 600; }
.row input { border: none; background: transparent; padding: 4px 0; text-align: right; }
.row-actions { display: flex; gap: 7px; }
.ghost {
  border: 1px solid var(--line); background: rgba(31, 107, 82, .08); color: var(--jade-deep);
  padding: 6px 11px; border-radius: 9px; font-size: .82rem;
}
.ghost[data-copied="yes"] { background: rgba(31, 107, 82, .2); color: var(--jade-deep); }
.primary {
  border: none; border-radius: 13px; padding: 13px; font-size: 1.02rem; font-weight: 700;
  color: #fffdf7; background: linear-gradient(135deg, var(--jade), var(--jade-deep));
  box-shadow: 0 10px 22px rgba(20, 73, 58, .28);
  transition: transform .16s ease, box-shadow .16s ease;
}
.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 26px rgba(20, 73, 58, .34); }
.primary:disabled { opacity: .62; box-shadow: none; }
.hint { margin: 0; font-size: .8rem; color: rgba(22, 33, 30, .58); }

/* ---------- room screen ---------- */
/* A fixed height keeps both columns on the screen: the message stream and the
   sidebar scroll inside their own column, so a long member list or an open
   history panel cannot push the composer below the fold. */
#chat { display: grid; grid-template-columns: 272px 1fr; height: calc(100vh / var(--ui-zoom, 1)); }
.side {
  display: flex; flex-direction: column; gap: 16px; padding: 18px 16px;
  background: linear-gradient(170deg, var(--pine) 0%, var(--pine-soft) 100%);
  color: #f3efe4; border-right: 1px solid rgba(0, 0, 0, .3);
  overflow-y: auto;
}
.side .mark { color: #fffdf7; }
.side .tld { color: #8fd9ae; }
.room-card {
  padding: 13px 14px; border-radius: var(--radius);
  background: rgba(255, 253, 247, .09); border: 1px solid rgba(255, 253, 247, .16);
}
.room-name { font-size: 1.16rem; font-weight: 700; }
.room-meta { display: flex; align-items: center; gap: 7px; font-size: .82rem; color: rgba(243, 239, 228, .78); margin-top: 4px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.pip[data-state="ready"] { background: #59c08c; box-shadow: 0 0 0 3px rgba(89, 192, 140, .28); }
.pip[data-state="blocked"] { background: var(--clay); }

/* Copy menu: opens under the room card so the code can be handed over. */
.copy-toggle {
  margin-top: 11px; width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: 1px solid rgba(255, 253, 247, .22); background: rgba(255, 253, 247, .1);
  color: #f3efe4; padding: 8px 11px; border-radius: 10px; font-size: .84rem;
}
.copy-toggle:hover { background: rgba(255, 253, 247, .18); }
.chev { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .18s ease; }
.copy-toggle[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.copy-menu {
  margin-top: 7px; display: grid; gap: 6px; padding: 7px; border-radius: 11px;
  background: rgba(0, 0, 0, .26); border: 1px solid rgba(255, 253, 247, .16);
  animation: menu-in .18s ease-out both;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.copy-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  border: none; background: rgba(255, 253, 247, .07); color: #f3efe4;
  padding: 8px 10px; border-radius: 9px; font-size: .84rem;
}
.copy-item:hover { background: rgba(255, 253, 247, .16); }
.copy-label { color: rgba(243, 239, 228, .7); }
.copy-value { font-weight: 700; letter-spacing: .04em; }
.copy-item[data-copied="yes"] { background: rgba(89, 192, 140, .26); }
.copy-item[data-copied="yes"] .copy-value { color: #a9e6c4; }

/* Room capacity lock. The control lives in the light conversation header so it
   stays reachable on narrow screens, where the sidebar sits below the stream. */
.head-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.head-actions .lock-state { font-size: .82rem; color: rgba(22, 33, 30, .62); white-space: nowrap; }
.head-actions .lock-state[data-locked="yes"] { color: var(--amber); font-weight: 600; }
.head-lock {
  border: 1px solid var(--line); background: rgba(200, 132, 42, .1); color: #7d5218;
  padding: 7px 13px; border-radius: 10px; font-size: .84rem; font-weight: 600; white-space: nowrap;
}
.head-lock:hover:not(:disabled) { background: rgba(200, 132, 42, .2); }
.head-lock:disabled { opacity: .45; }
.lock-bar { display: grid; gap: 8px; padding: 10px clamp(14px, 4vw, 22px) 0; }
/* The bar collapses itself through the hidden attribute in chat.js. */
.lock-bar[hidden] { display: none; }
.lock-panel {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--paper-raise);
  box-shadow: var(--shadow); animation: menu-in .18s ease-out both;
}
.lock-hint { font-size: .8rem; color: rgba(22, 33, 30, .62); }
.lock-choices { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.lock-choice {
  min-width: 46px; border: 1px solid var(--line); background: rgba(22, 33, 30, .05);
  color: var(--pine); padding: 6px 9px; border-radius: 8px; font-size: .82rem;
}
.lock-choice:hover { background: rgba(200, 132, 42, .18); }
.lock-panel .ghost { margin-left: auto; }
.lock-proposal {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 11px;
  border: 1px solid rgba(200, 132, 42, .45); border-radius: 11px; background: rgba(200, 132, 42, .12);
}
.lock-proposal p { margin: 0; font-size: .84rem; color: #6d4714; flex: 1; min-width: 200px; }
/* Consent buttons keep their own palette. They must not inherit the sidebar's
   .inline-field styling, which pairs near white text with the pale proposal
   background and leaves the labels unreadable. */
.proposal-actions { display: flex; gap: 7px; }
.lock-proposal .agree, .lock-proposal .decline {
  border-radius: 9px; padding: 7px 14px; font-size: .84rem; font-weight: 600;
}
.lock-proposal .agree {
  border: 1px solid var(--jade-deep); background: var(--jade); color: #fffdf7;
}
.lock-proposal .agree:hover { background: var(--jade-deep); }
.lock-proposal .decline {
  border: 1px solid rgba(166, 72, 58, .55); background: rgba(255, 253, 247, .82); color: #7d2f24;
}
.lock-proposal .decline:hover { background: #fffdf7; }

.side-section { display: grid; gap: 8px; }
.side-title { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(243, 239, 228, .58); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px;
  background: rgba(255, 253, 247, .07); font-size: .9rem;
  animation: member-in .26s ease-out both;
}
@keyframes member-in { from { opacity: 0; transform: translateX(-8px); } }
.member .state { margin-left: auto; font-size: .74rem; color: rgba(243, 239, 228, .62); }
.member[data-link="on"] .state { color: #8fd9ae; }
.inline-field { display: flex; gap: 7px; }
.inline-field input { background: rgba(255, 253, 247, .1); border-color: rgba(255, 253, 247, .22); color: #f3efe4; }
.inline-field .ghost { background: rgba(255, 253, 247, .14); color: #f3efe4; border-color: rgba(255, 253, 247, .24); }

#history { display: grid; gap: 8px; }
#history > summary {
  cursor: pointer; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(243, 239, 228, .58);
}
#history .field > span { color: rgba(243, 239, 228, .68); }
#history { color-scheme: dark; }
#history select {
  background: rgba(255, 253, 247, .1); border-color: rgba(255, 253, 247, .22); color: #f3efe4;
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, rgba(243, 239, 228, .72) 50%),
                  linear-gradient(135deg, rgba(243, 239, 228, .72) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 6px 6px; background-repeat: no-repeat;
}
#history select option { background: #1d2b26; color: #f3efe4; padding: 6px; }
#history-status { margin: 0; font-size: .8rem; color: rgba(243, 239, 228, .66); }
#saved-messages {
  list-style: none; margin: 0; padding: 0; max-height: calc(30vh / var(--ui-zoom, 1)); overflow: auto;
  display: grid; gap: 8px; font-size: .82rem;
}
#saved-messages li {
  padding: 7px 9px; border-radius: 9px; background: rgba(255, 253, 247, .07);
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.danger {
  border: 1px solid rgba(200, 122, 108, .5); background: rgba(166, 72, 58, .22);
  color: #f7dcd5; padding: 8px; border-radius: 9px; font-size: .84rem;
}
.leave {
  margin-top: auto; border: 1px solid rgba(255, 253, 247, .28); background: transparent;
  color: #f3efe4; padding: 10px; border-radius: 11px;
}
.leave:hover { background: rgba(255, 253, 247, .12); }

/* Conversation column */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.stage-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--paper-raise);
}
.stage-heading { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.stage-title { font-size: 1.12rem; font-weight: 700; }
.stage-sub { font-size: .84rem; color: rgba(22, 33, 30, .62); }
.head-copy {
  border: 1px solid var(--line); background: rgba(31, 107, 82, .08); color: var(--jade-deep);
  padding: 7px 13px; border-radius: 10px; font-size: .84rem; font-weight: 600; white-space: nowrap;
}
.head-copy:hover { background: rgba(31, 107, 82, .16); }
/* Clear the visible conversation. Kept visibly quieter than the copy action so
   the destructive-looking control is not the most prominent one in the header. */
.head-clear {
  border: 1px solid var(--line); background: rgba(22, 33, 30, .05); color: rgba(22, 33, 30, .68);
  padding: 7px 13px; border-radius: 10px; font-size: .84rem; font-weight: 600; white-space: nowrap;
}
.head-clear:hover { background: rgba(166, 72, 58, .14); color: #7d2f24; }
.head-copy[data-copied="yes"] { background: rgba(31, 107, 82, .22); }

.stream {
  list-style: none; margin: 0; padding: 22px clamp(14px, 4vw, 40px) 10px; flex: 1;
  overflow-y: auto; display: grid; gap: 14px; align-content: start;
  background-image: radial-gradient(rgba(22, 33, 30, .06) 1px, transparent 1px);
  background-size: 22px 22px;
}
.msg { display: grid; gap: 4px; max-width: min(76%, 620px); animation: msg-in .22s ease-out both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.msg .who { font-size: .76rem; color: rgba(22, 33, 30, .55); }
.msg .bubble {
  padding: 10px 14px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--paper-raise); border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(22, 33, 30, .06);
}
.msg .when { font-size: .72rem; color: rgba(22, 33, 30, .42); }
.msg.mine { justify-self: end; text-align: right; }
.msg.mine .bubble {
  background: linear-gradient(150deg, var(--jade), var(--jade-deep)); color: #fffdf7;
  border-color: transparent;
}
.msg .when[data-state="sent"] { color: var(--jade-deep); }
.msg .when[data-state="failed"] { color: var(--clay); }
.day {
  justify-self: center; font-size: .76rem; color: rgba(22, 33, 30, .5);
  padding: 4px 12px; border-radius: 999px; background: rgba(22, 33, 30, .07);
}
.note {
  justify-self: center; max-width: 70%; text-align: center; font-size: .84rem;
  color: rgba(22, 33, 30, .62); padding: 8px 14px; border-radius: 12px;
  background: rgba(200, 132, 42, .12); border: 1px dashed rgba(200, 132, 42, .42);
}

.composer {
  display: flex; gap: 10px; align-items: center; padding: 12px clamp(14px, 4vw, 40px) 16px;
  border-top: 1px solid var(--line); background: var(--paper-raise);
}
.composer .grow { flex: 1; }
.attach {
  flex: none; border: 1px solid var(--line); background: rgba(31, 107, 82, .08);
  color: var(--jade-deep); padding: 12px 10px; border-radius: 12px;
  font-size: .8rem; font-weight: 600;
}
.attach:hover:not(:disabled) { background: rgba(31, 107, 82, .16); }
.attach:disabled { opacity: .5; }
/* The content menu sits above its button, since the composer is at the bottom
   of the window and a menu that opened downwards would fall outside it. */
.attach-menu { position: relative; flex: none; }
.attach-items {
  position: absolute; left: 0; bottom: calc(100% + 8px); display: grid; gap: 5px;
  padding: 6px; border-radius: 12px; background: var(--paper-raise);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: menu-in .18s ease-out both; min-width: 96px;
}
.attach-items[hidden] { display: none; }
.attach-item {
  display: block; width: 100%; text-align: center; border: none; border-radius: 9px;
  background: rgba(31, 107, 82, .08); color: var(--jade-deep);
  padding: 8px 12px; font-size: .84rem; font-weight: 600;
}
.attach-item:hover:not(:disabled) { background: rgba(31, 107, 82, .18); }
.attach-item:disabled { background: rgba(22, 33, 30, .05); color: rgba(22, 33, 30, .42); }
.msg .bubble.image-bubble { padding: 6px; background: var(--paper-raise); }
.msg .bubble.image-bubble img {
  display: block; max-width: min(420px, 100%); max-height: calc(46vh / var(--ui-zoom, 1));
  border-radius: 11px; object-fit: contain;
}
/* A picture in the stream is looked at through the in room viewer, so it invites
   the click without pretending to be a link. */
.msg .bubble.image-bubble img.zoomable { cursor: zoom-in; }

/* Conversation layout shared by the browser and the packaged Mac client. */
#chat { grid-template-columns: 228px minmax(0, 1fr); background: #f5f5f5; }
.side { background: #ededed; color: #202724; border-right: 1px solid #d9dedb; }
.side .mark { color: #16211e; }
.side .tld { color: #168450; }
.side .side-title, .side .room-meta { color: #61716a; }
.side .room-card { background: #fff; border-color: #e0e5e2; }
.side .copy-toggle, .side .copy-item { color: #20342b; background: #f6f8f7; border-color: #dce5df; }
.side .copy-menu { background: #fff; border-color: #dce5df; }
.side .copy-label { color: #66746d; }
.side .member { background: #fff; }
.side .member .state { color: #75867c; }
.side .member[data-link="on"] .state { color: #168450; }
.side .inline-field input { background: #fff; border-color: #dce5df; color: #20342b; }
.side .inline-field .ghost { background: #fff; border-color: #dce5df; color: #20342b; }
.side #history { color-scheme: light; }
.side #history > summary, .side #history .field > span, .side #history-status { color: #66746d; }
.side #history select {
  background-color: #fff; border-color: #dce5df; color: #20342b;
  background-image: linear-gradient(45deg, transparent 50%, #66746d 50%),
                    linear-gradient(135deg, #66746d 50%, transparent 50%);
}
.side #history select option { background: #fff; color: #20342b; }
.side #saved-messages li { background: #fff; }
.side .danger { background: #fff1ef; border-color: #e4b1a9; color: #8e3f35; }
.side .leave { background: #fff; border-color: #dce5df; color: #384c40; }
.stage { background: #f5f5f5; }
.stage-head { background: #fff; border-bottom: 1px solid #e3e7e4; }
.stream { background: #f5f5f5; }
.msg.mine .bubble { background: #a9e9ad; color: #172b1e; }
.composer { background: #fff; padding: 11px 18px; }
.head-actions { gap: 8px; }
.room-actions { position: relative; }
.room-actions summary { list-style: none; cursor: pointer; border-radius: 9px; padding: 5px 11px; font-size: 1.1rem; color: #4b5d54; }
.room-actions summary::-webkit-details-marker { display: none; }
.room-actions summary:hover { background: #edf3ef; }
.room-actions-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 8; display: grid; gap: 5px; width: 160px; padding: 8px; background: #fff; border: 1px solid #dae3dd; border-radius: 12px; box-shadow: 0 12px 28px #1a33231f; }
.room-actions:not([open]) .room-actions-menu { display: none; }
.room-actions-menu button { width: 100%; text-align: left; background: transparent; border: 0; color: #26362d; padding: 9px; border-radius: 8px; }
.room-actions-menu button:hover { background: #eef6f0; }
.voice-panel, .call-panel { position: fixed; z-index: 20; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: #fff; color: #24332b; padding: 14px 18px; border-radius: 14px; box-shadow: 0 10px 32px #17291c38; }
.voice-panel[hidden], .call-panel[hidden] { display: none; }
.voice-panel button, .call-panel button { border: 0; border-radius: 9px; padding: 8px 12px; background: #eaf4ec; }
#voice-send { background: #168450; color: white; }
#call-leave { background: #c74842; color: white; }
.voice-bubble { display: inline-flex; align-items: center; gap: 9px; min-width: 170px; }
.voice-bubble button { border: 0; background: transparent; color: inherit; font-weight: 600; cursor: pointer; }

/* Enlarged view of a picture. It sits over the room, and its only controls are
   zoom and close: there is no way to take the picture out of here. */
.viewer {
  position: fixed; inset: 0; z-index: 30; display: grid;
  grid-template-rows: auto 1fr auto; background: rgba(10, 16, 14, .92);
  animation: menu-in .18s ease-out both;
}
.viewer[hidden] { display: none; }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(14px, 4vw, 26px); color: #f3efe4;
  background: rgba(10, 16, 14, .6); border-bottom: 1px solid rgba(255, 253, 247, .14);
}
.viewer-title { font-size: .86rem; color: rgba(243, 239, 228, .82); }
.viewer-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.viewer-actions button {
  min-width: 40px; border: 1px solid rgba(255, 253, 247, .26); border-radius: 9px;
  background: rgba(255, 253, 247, .1); color: #f3efe4; padding: 7px 11px; font-size: .84rem;
}
.viewer-actions button:hover:not(:disabled) { background: rgba(255, 253, 247, .2); }
.viewer-actions button:disabled { opacity: .4; }
#viewer-close { background: rgba(166, 72, 58, .5); border-color: rgba(226, 158, 143, .5); }
.viewer-stage {
  overflow: auto; display: flex; padding: 18px;
  /* centred while it is smaller than the window, and held to the near edge once
     it is larger, so that the scrollbars can still reach every part of it. */
  align-items: safe center; justify-content: safe center;
  cursor: zoom-out;
}
.viewer-stage img {
  /* No max size here: the script sets the picture in pixels, and a percentage
     cap would be measured against the stage and freeze the picture at the
     window whatever the script asked for. flex: none keeps it at that size
     instead of being squeezed back down to fit. */
  flex: none; object-fit: contain; border-radius: 8px; cursor: default;
  -webkit-user-drag: none; user-select: none;
}
.viewer-note {
  margin: 0; padding: 10px clamp(14px, 4vw, 26px); text-align: center;
  font-size: .8rem; color: rgba(243, 239, 228, .66);
  background: rgba(10, 16, 14, .6); border-top: 1px solid rgba(255, 253, 247, .14);
}
.composer input { border-radius: 12px; padding: 12px 14px; }
.composer input:disabled { background: rgba(22, 33, 30, .05); }
.send {
  border: none; border-radius: 12px; padding: 12px 20px; font-weight: 700; color: #fffdf7;
  background: linear-gradient(135deg, var(--jade), var(--jade-deep));
}
.send:disabled { background: rgba(22, 33, 30, .18); }

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  margin: 0; padding: 10px 16px; border-radius: 12px; font-size: .88rem;
  background: var(--pine); color: #fffdf7; box-shadow: var(--shadow);
  animation: toast-in .24s ease-out both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (max-width: 860px) {
  #chat { grid-template-columns: 1fr; height: auto; min-height: calc(100vh / var(--ui-zoom, 1)); }
  .side { order: 2; overflow: visible; }
  .stage { order: 1; min-height: calc(72vh / var(--ui-zoom, 1)); }
  .msg { max-width: 88%; }
  .row { grid-template-columns: 78px 1fr; }
  .row .row-actions { grid-column: 1 / -1; justify-self: end; }
  .stage-head { flex-wrap: wrap; }
  .head-actions { width: 100%; justify-content: flex-end; }
  .lock-proposal p { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
