/* ============================================================================
   PairText — Botanical / Organic Serif design system
   Vanilla CSS, no build step, CSP-safe (self-hosted fonts, no CDN).
   ========================================================================== */

@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/fonts/playfair-600.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/fonts/playfair-700.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display"; font-style: italic; font-weight: 600;
  font-display: swap; src: url("/fonts/playfair-600-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/fonts/source-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("/fonts/source-sans-500.woff2") format("woff2");
}

:root {
  /* palette */
  --bg: #F9F8F4;
  --text: #2D3A31;
  --text-2: #6F786F;
  --sage: #8C9A84;
  --clay: #DCCFC2;
  --surface-1: #F2F0EB;
  --card: #FFFFFF;
  --border: #E6E2DA;
  --hover: #C27B66;      /* terracotta */
  --moss: #7C8B5E;
  --ochre: #C9A227;

  /* type */
  --serif: "Playfair Display", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;

  /* radii */
  --r-panel: 32px;
  --r-item: 16px;
  --r-bubble: 24px;
  --r-composer: 28px;

  /* shadows */
  --sh-sm: 0 4px 10px rgba(45, 58, 49, 0.04);
  --sh-md: 0 12px 30px rgba(45, 58, 49, 0.06);
  --sh-float: 0 20px 50px rgba(45, 58, 49, 0.10);

  /* motion */
  --e-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win, even over the display rules below,
   so the lobby and room are never both laid out (and can't be scrolled between). */
[hidden] { display: none !important; }

html, body { height: 100%; }

/* When a room is open the page itself never scrolls — only the message list
   (.conv-scroll) does — so the lobby can't be revealed by scrolling up. */
body:has(.chat:not([hidden])) { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* soft daylight wash */
  background-image:
    radial-gradient(120% 80% at 15% -10%, rgba(140, 154, 132, 0.10), transparent 60%),
    radial-gradient(120% 80% at 100% 0%, rgba(194, 123, 102, 0.06), transparent 55%);
  background-attachment: fixed;
}

.grain {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none; opacity: 0.02;
  background-repeat: repeat;
}

::selection { background: rgba(194, 123, 102, 0.22); }

/* ---- buttons & controls ------------------------------------------------- */

.btn-primary, .btn-ghost {
  font: inherit; font-weight: 500; cursor: pointer;
  border-radius: 999px; border: 1px solid transparent;
  transition: background 300ms var(--e-soft), color 300ms var(--e-soft),
              border-color 300ms var(--e-soft), transform 300ms var(--e-soft),
              box-shadow 300ms var(--e-soft);
}
.btn-primary {
  background: var(--text); color: #F4F5F1;
  padding: 12px 22px; box-shadow: var(--sh-sm);
}
.btn-primary:hover { background: var(--hover); transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn-lg { font-size: 1.05rem; padding: 15px 28px; width: 100%; }
.btn-ghost {
  background: var(--card); color: var(--text);
  border-color: var(--border); padding: 12px 20px;
}
.btn-ghost:hover { border-color: var(--sage); color: var(--moss); }

.icon-btn {
  font: inherit; font-size: 0.9rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 14px;
  background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: 999px;
  transition: background 300ms var(--e-soft), color 300ms var(--e-soft), border-color 300ms var(--e-soft);
}
.icon-btn:hover { background: var(--surface-1); color: var(--text); border-color: var(--border); }

/* accessible focus: soft sage ring, never the browser blue */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(140, 154, 132, 0.45);
  border-radius: 999px;
}
.composer-input:focus-visible, .pill-input:focus-visible { box-shadow: none; }

/* ---- lobby -------------------------------------------------------------- */

.lobby {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom));
}
.lobby-card {
  width: 100%; max-width: 560px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  box-shadow: var(--sh-md);
  padding: 44px 40px;
  text-align: center;
  animation: rise 700ms var(--e-soft) both;
}
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sage); margin: 0 0 18px; font-weight: 500;
}
.lobby-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  line-height: 1.25; margin: 0 0 12px; color: var(--text);
}
.lobby-title em { font-style: italic; color: var(--moss); }
.lobby-sub { color: var(--text-2); margin: 0 0 28px; }
.lobby-or {
  position: relative; text-align: center; margin: 26px 0 18px;
  color: var(--text-2); font-size: 0.82rem;
}
.lobby-or::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.lobby-or span { position: relative; background: var(--card); padding: 0 14px; }
.join-row { display: flex; gap: 10px; }
.pill-input {
  flex: 1; font: inherit; color: var(--text);
  padding: 13px 18px; border-radius: 999px;
  background: var(--surface-1); border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.1em;
  transition: border-color 300ms var(--e-soft), box-shadow 300ms var(--e-soft), background 300ms var(--e-soft);
}
.pill-input::placeholder { color: var(--text-2); letter-spacing: normal; text-transform: none; }
.pill-input.plain { text-transform: none; letter-spacing: normal; }
.pill-input:focus { outline: none; background: var(--card); border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(140, 154, 132, 0.28); }
.error { color: var(--hover); font-size: 0.9rem; margin: 14px 0 0; }
.lobby-note { color: var(--text-2); font-size: 0.78rem; margin: 22px 0 0; line-height: 1.6; }
.lobby-hint-sm { color: var(--text-2); font-size: 0.78rem; margin: 8px 0 0; }

/* lobby: hero action + colour-coded method cards */
.lobby-inner { width: 100%; max-width: 760px; animation: rise 700ms var(--e-soft) both; }
.lobby-head { text-align: center; margin-bottom: 26px; }

.hero-create {
  width: 100%; display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 18px 22px; border-radius: 26px; cursor: pointer;
  background: var(--text); color: #F4F5F1; border: 1px solid var(--text);
  box-shadow: var(--sh-md);
  transition: background 300ms var(--e-soft), transform 300ms var(--e-soft), box-shadow 300ms var(--e-soft);
}
.hero-create:hover { background: var(--hover); border-color: var(--hover); transform: translateY(-2px); box-shadow: var(--sh-float); }
.hc-icon { flex: none; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.13); }
.hc-text { display: flex; flex-direction: column; gap: 2px; }
.hc-text strong { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; }
.hc-text small { color: rgba(244, 245, 241, 0.78); font-size: 0.85rem; }
.hc-arrow { margin-left: auto; font-size: 1.3rem; opacity: 0.7; transition: transform 300ms var(--e-soft); }
.hero-create:hover .hc-arrow { transform: translateX(4px); }

.methods-label { text-align: center; color: var(--text-2); font-size: 0.76rem;
  letter-spacing: 0.16em; text-transform: uppercase; margin: 26px 0 16px; }

.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.method {
  --acc: var(--sage);
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px 18px; box-shadow: var(--sh-sm);
  transition: transform 500ms var(--e-soft), box-shadow 500ms var(--e-soft), border-color 500ms var(--e-soft);
}
.method:hover { transform: translateY(-3px); box-shadow: var(--sh-md);
  border-color: color-mix(in srgb, var(--acc) 55%, var(--border)); }
.method::before { content: ""; position: absolute; top: -1px; left: 22px; width: 40px; height: 3px;
  border-radius: 0 0 4px 4px; background: var(--acc); }
.method-code   { --acc: #8C9A84; }
.method-nearby { --acc: #7C8B5E; }
.method-phrase { --acc: #C27B66; }

.m-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: var(--acc); background: color-mix(in srgb, var(--acc) 15%, #fff); margin-bottom: 14px; }
.m-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; margin: 0 0 5px; }
.m-desc { color: var(--text-2); font-size: 0.84rem; line-height: 1.5; margin: 0 0 16px; flex: 1; }

.m-form { display: flex; gap: 8px; }
.m-form .pill-input { flex: 1; min-width: 0; padding: 10px 14px; font-size: 0.95rem; }
.m-go, .m-action {
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  border-radius: 999px; border: 1px solid var(--text);
  color: #F4F5F1; background: var(--text); padding: 10px 18px;
  transition: background 300ms var(--e-soft), border-color 300ms var(--e-soft), transform 300ms var(--e-soft);
}
.m-go:hover, .m-action:hover { background: var(--hover); border-color: var(--hover); transform: translateY(-1px); }
.m-action { width: 100%; margin-top: auto; }

@media (max-width: 640px) {
  .methods { grid-template-columns: 1fr; }
  .m-desc { min-height: 0; }
}

/* join methods as a segmented selector with progressive disclosure */
.join-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--sh-sm); overflow: hidden;
}
.join-tabs {
  display: flex; gap: 4px; padding: 6px;
  background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.join-tab {
  --acc: var(--sage);
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 8px 10px; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 0.92rem;
  color: var(--text-2); background: transparent;
  border: 1px solid transparent; border-radius: 999px;
  transition: background 300ms var(--e-soft), color 300ms var(--e-soft), box-shadow 300ms var(--e-soft);
}
.join-tab svg { color: var(--text-2); transition: color 300ms var(--e-soft); }
.join-tab:hover { color: var(--text); }
.join-tab.is-active { color: var(--text); background: var(--card); box-shadow: var(--sh-sm); }
.join-tab.is-active svg { color: var(--acc); }
.join-tab.method-code   { --acc: #8C9A84; }
.join-tab.method-nearby { --acc: #7C8B5E; }
.join-tab.method-phrase { --acc: #C27B66; }

.join-body { padding: 20px 20px 22px; }
.join-pane { animation: fade 300ms var(--e-soft) both; }
.pane-desc { color: var(--text-2); font-size: 0.9rem; line-height: 1.6; margin: 0 0 16px; }
.pane-desc b { color: var(--text); font-weight: 600; }

@media (max-width: 400px) {
  .join-tab span { font-size: 0.85rem; }
}

/* nearby-pairing overlay */
.nearby-panel {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 20px;
  background: rgba(249, 248, 244, 0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade 300ms var(--e-soft) both;
}
.nearby-card {
  width: 100%; max-width: 420px; text-align: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-panel); box-shadow: var(--sh-float);
  padding: 36px 30px;
}
.nearby-title { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; margin: 0 0 8px; }
.nearby-title em { font-style: italic; color: var(--moss); }
.nearby-hint { color: var(--text-2); font-size: 0.9rem; margin: 0 0 18px; }
.nearby-dots { justify-content: center; padding: 8px 0 20px; }
.nearby-list { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; }
.nearby-list li { margin-bottom: 10px; }
.nearby-pick {
  width: 100%; font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-item);
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
  transition: transform 500ms var(--e-soft), border-color 500ms var(--e-soft);
}
.nearby-pick:hover { transform: translateX(3px); border-color: var(--sage); }
.nearby-pick .np-glyph { color: var(--sage); }

/* ---- chat shell --------------------------------------------------------- */

.chat { display: flex; flex-direction: column; height: 100%; }

.chat-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: rgba(249, 248, 244, 0.82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--sage);
}
.ch-title { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.ch-label { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); }
.ch-code { font-family: var(--serif); font-weight: 600; font-size: 1.4rem; letter-spacing: 0.06em; color: var(--text); }
.ch-actions { display: flex; align-items: center; gap: 6px; }
.ch-status { font-size: 0.82rem; color: var(--text-2); margin-right: 6px; }
.lock-glyph { font-size: 0.95rem; }
.chat-header .ch-divider {
  position: absolute; left: 0; right: 0; bottom: -7px; width: 100%; height: 8px;
  color: var(--border);
}

.chat-body {
  flex: 1; min-height: 0;
  display: flex; gap: 0;
}

/* ---- conversation column ------------------------------------------------ */

.conversation {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  position: relative;
}
.conv-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.conv-inner {
  max-width: 820px; margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 40px) 8px;
  min-height: 100%;
  display: flex; flex-direction: column;
}

.messages { list-style: none; margin: 0; padding: 0; flex: 1; }
.messages li {
  max-width: 76%; margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--r-bubble);
  line-height: 1.7;
  animation: rise 500ms var(--e-soft) both;
}
/* received: warm paper, left */
.messages li.theirs {
  background: var(--card); border: 1px solid var(--border);
  border-bottom-left-radius: 8px; box-shadow: var(--sh-sm);
  margin-right: auto;
}
/* mine: soft sage, right */
.messages li.mine {
  background: linear-gradient(180deg, #E7ECDF, #DFE6D3);
  color: #26311F; border: 1px solid #D3DBC5;
  border-bottom-right-radius: 8px; margin-left: auto;
}
/* organic asymmetry: every other received bubble a touch wider */
.messages li.theirs:nth-of-type(even) { max-width: 82%; }

.msg-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.72rem; color: var(--text-2); margin-bottom: 3px;
}
.msg-head .who { font-weight: 500; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Message actions are always visible (not hover-revealed) so they're reachable
   on touch and don't hide functionality. */
.msg-actions { margin-top: 8px; display: flex; gap: 8px; }
.msg-actions button, .msg-actions a {
  font: inherit; font-size: 0.76rem; cursor: pointer; text-decoration: none;
  color: var(--text-2); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px;
  transition: color 300ms var(--e-soft), border-color 300ms var(--e-soft);
}
.msg-actions button:hover, .msg-actions a:hover { color: var(--hover); border-color: var(--hover); }

/* ---- typing indicator --------------------------------------------------- */

.typing { display: flex; align-items: center; gap: 6px; padding: 4px 4px 16px; color: var(--text-2); }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); opacity: 0.5;
  animation: breathe 1200ms var(--e-soft) infinite; }
.typing-dot:nth-child(2) { animation-delay: 200ms; }
.typing-dot:nth-child(3) { animation-delay: 400ms; }
.typing-label { font-size: 0.8rem; font-style: italic; font-family: var(--serif); }

/* ---- empty state -------------------------------------------------------- */

.empty-state { text-align: center; padding: 48px 8px 24px; margin: auto 0; }
.empty-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--text); margin: 0 0 10px; }
.empty-title em { font-style: italic; color: var(--hover); }
.empty-sub { color: var(--text-2); margin: 0 auto 26px; max-width: 40ch; }
.prompt-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.prompt {
  font: inherit; cursor: pointer; color: var(--text);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 11px 20px; box-shadow: var(--sh-sm);
  transition: transform 500ms var(--e-soft), border-color 500ms var(--e-soft), box-shadow 500ms var(--e-soft);
}
.prompt:hover { transform: translateY(-2px); border-color: var(--sage); box-shadow: var(--sh-md); }
.prompt:nth-child(2) { transform: translateY(6px); }
.prompt:nth-child(2):hover { transform: translateY(3px); }

/* ---- composer (floating ceramic tray) ----------------------------------- */

.composer {
  position: sticky; bottom: 0;
  padding: 10px clamp(14px, 4vw, 40px) calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(249,248,244,0) 0%, var(--bg) 40%);
}
.composer-tray {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-composer);
  padding: 8px 10px 8px 8px;
  box-shadow: var(--sh-float);
  transition: box-shadow 500ms var(--e-soft), transform 500ms var(--e-soft), border-color 500ms var(--e-soft);
}
.composer-tray:focus-within { transform: translateY(-2px); border-color: var(--sage); }
.tray-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.05rem; cursor: pointer; color: var(--text-2);
  background: var(--surface-1); border: 1px solid var(--border);
  transition: color 300ms var(--e-soft), border-color 300ms var(--e-soft);
}
.tray-btn:hover { color: var(--moss); border-color: var(--sage); }
.composer-input {
  flex: 1; font: inherit; color: var(--text); resize: none;
  border: none; background: transparent; padding: 10px 6px;
  max-height: 40vh; line-height: 1.6;
}
.composer-input:focus { outline: none; }
.composer-input::placeholder { color: var(--text-2); }
.send-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  color: #F4F5F1; background: var(--text); border: none;
  box-shadow: var(--sh-sm);
  transition: background 300ms var(--e-soft), transform 300ms var(--e-soft);
}
.send-btn:hover { background: var(--hover); transform: rotate(-8deg) scale(1.04); }
.send-btn:active { transform: scale(0.96); }
.status { max-width: 820px; margin: 6px auto 0; padding: 0 6px; color: var(--text-2); font-size: 0.8rem; min-height: 1.1em; }

/* persistent door-state indicator, always visible just above the composer */
.door-state {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  max-width: 820px; margin: 0 auto; padding: 4px 14px 2px;
  font-size: 0.8rem; color: var(--text-2);
  transition: color 300ms var(--e-soft);
}
.door-state.locked { color: #9c4b38; }
.door-state .door-glyph { font-size: 0.95rem; }

.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { font-size: 0.82rem; padding: 8px 16px; margin-top: 12px; }

/* ---- context panel ------------------------------------------------------ */

.context {
  flex: none; width: 312px;
  margin: 8px 20px 20px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  box-shadow: var(--sh-md);
  padding: 22px 20px;
  overflow-y: auto;
  position: relative;
}
.context-close { display: none; position: absolute; top: 12px; right: 12px; }
.qr-box { text-align: center; background: var(--surface-1); border-radius: 20px; padding: 16px; margin-bottom: 20px; }
.qr-img { background: #fff; border-radius: 14px; padding: 8px;
  /* organic arch-ish mask on the card, not the code itself */
}
.qr-hint { color: var(--text-2); font-size: 0.78rem; margin: 10px 0 0; line-height: 1.5; }
.ctx-section { margin-bottom: 18px; }
.ctx-label { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-2); font-weight: 500; margin: 0 0 12px; }
.participants { list-style: none; margin: 0; padding: 0; }
.participants li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface-1); border-radius: var(--r-item);
  transition: transform 500ms var(--e-soft);
}
.participants li:hover { transform: translateX(3px); }
.p-name { font-weight: 500; font-size: 0.92rem; }
.p-name .p-you { color: var(--moss); font-style: italic; font-family: var(--serif); }
.p-meta { color: var(--text-2); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.kick-btn {
  flex: none; font: inherit; font-size: 0.74rem; cursor: pointer;
  color: var(--hover); background: transparent;
  border: 1px solid transparent; border-radius: 999px; padding: 4px 10px;
  transition: background 300ms var(--e-soft), border-color 300ms var(--e-soft);
}
.kick-btn:hover { border-color: var(--hover); background: rgba(194, 123, 102, 0.08); }
.ctx-note { color: var(--text-2); font-size: 0.78rem; line-height: 1.6; margin: 4px 0 0; }

/* ---- banners ------------------------------------------------------------ */

.banner {
  max-width: 820px; margin: 0 auto 14px; padding: 10px 16px;
  border-radius: var(--r-item); font-size: 0.88rem;
  animation: rise 500ms var(--e-soft) both;
}
.banner.warn { background: rgba(201, 162, 39, 0.12); color: #8a6d15; }
.banner.danger { background: rgba(194, 123, 102, 0.12); color: #9c4b38; }
.banner.ok { background: rgba(124, 139, 94, 0.14); color: var(--moss); }

/* ---- context drawer toggle helpers -------------------------------------- */

.only-narrow { display: none; }
.context-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(45, 58, 49, 0.28);
  backdrop-filter: blur(2px);
  animation: fade 300ms var(--e-soft) both;
}

/* ---- animations --------------------------------------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 0.9; transform: translateY(-2px); } }

/* ---- tablet: hide context panel, keep centered column ------------------- */

@media (max-width: 1024px) {
  .context {
    position: fixed; top: 0; right: 0; z-index: 40;
    width: min(340px, 86vw); height: 100%;
    margin: 0; border-radius: 24px 0 0 24px;
    transform: translateX(105%);
    transition: transform 500ms var(--e-soft);
    box-shadow: var(--sh-float);
  }
  .context.open { transform: none; }
  .context-close { display: block; }
  .only-narrow { display: inline-flex; }
}

/* ---- mobile ------------------------------------------------------------- */

@media (max-width: 640px) {
  .messages li { max-width: 88%; }
  .messages li.theirs:nth-of-type(even) { max-width: 88%; }
  .ch-code { font-size: 1.2rem; }
  .ch-status { display: none; }
  .lobby-card { padding: 32px 22px; }
  .conv-inner { padding: 18px 14px 6px; }
}

/* ---- reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
