/* Friends Talk — application shell.
 *
 * The layout gives the conversation the middle of the screen and pushes
 * everything else to the edges. Controls that only make sense during a call
 * are not rendered until there is one, so an idle screen stays quiet.
 */

@import url('/css/site.css');

:root {
  --pane: 264px;
  --chat: 336px;
  --bar: 60px;
}

body.app-body {
  height: 100vh;
  /* dvh follows the mobile browser chrome as it hides and shows; vh does not,
     which is what leaves a fixed composer stranded under Safari's toolbar. */
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  /* Stops the whole page rubber-banding when a scrollable panel hits its end. */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Momentum scrolling inside panes, and no scroll chaining out of them. */
.pane, .panel, .chat-log, .stage-pane {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Keyboard users get a visible focus ring; mouse users do not, which is what
   :focus-visible is for. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ topbar */

.app-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.app-bar .brand { font-size: 1rem; gap: 9px; }
.app-bar .brand .mark { width: 26px; height: 26px; }

.presence {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  color: var(--text-faint);
  white-space: nowrap;
}
.presence b { color: var(--text-dim); font-weight: 600; }
.presence .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.6s ease-in-out infinite;
}
.presence-sep { width: 1px; height: 12px; background: var(--border-bright); }
@keyframes pulse { 50% { opacity: 0.4; } }

.bar-btn {
  display: none;
  width: 36px; height: 36px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.bar-btn svg { width: 100%; height: 100%; }
.bar-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* ------------------------------------------------------------------ layout */

.app-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--pane) minmax(0, 1fr) var(--chat);
}

.pane { min-height: 0; display: flex; flex-direction: column; }
.pane-left { border-right: 1px solid var(--border); background: var(--bg-raised); }
.pane-right { border-left: 1px solid var(--border); background: var(--bg-raised); }
.stage-pane { overflow-y: auto; }

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

.tabs {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 10px 10px 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--text-dim); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.panel { display: none; overflow-y: auto; padding: 18px 16px 26px; }
.panel.is-active { display: block; }

/* ------------------------------------------------------------------ fields */

.group { margin-bottom: 18px; }
.group-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}

input[type="text"], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.89rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]::placeholder { color: var(--text-faint); }
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 224, 208, 0.12);
}
select[multiple] { padding: 5px; }
select[multiple] option { padding: 5px 7px; border-radius: 5px; }

/* Segmented control — a binary choice should not be a dropdown. */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.seg svg { width: 14px; height: 14px; flex: none; }
.seg { font-size: 0.8rem; gap: 5px; padding: 8px 2px; }
.seg:hover { color: var(--text-dim); }
.seg.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: rgba(53, 224, 208, 0.1);
  color: var(--accent);
  font-size: 0.78rem;
}
.tag button {
  width: 15px; height: 15px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(53, 224, 208, 0.18);
  color: inherit;
  font-size: 0.8rem; line-height: 1;
  cursor: pointer;
}
.tag button:hover { background: var(--accent); color: #04121a; }

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  font-size: 0.87rem;
  color: var(--text-dim);
  cursor: pointer;
}
.switch input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.badge {
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(91, 141, 255, 0.16);
  color: var(--accent-2);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.more { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
.more summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-faint);
  padding: 4px 0 10px;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '+ '; color: var(--accent); }
.more[open] summary::before { content: '− '; }
.more summary:hover { color: var(--text-dim); }

.hint { margin: 7px 0 0; font-size: 0.76rem; line-height: 1.5; color: var(--text-faint); }

/* ------------------------------------------------------------------- stage */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 36px 24px;
  text-align: center;
}

.partner-card {
  display: none;
  align-items: center;
  gap: 13px;
  padding: 10px 18px 10px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.partner-card.show { display: flex; }
.partner-avatar {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-weight: 700;
}
.partner-meta { text-align: left; }
.partner-meta .nm { font-size: 0.94rem; font-weight: 600; line-height: 1.3; }
.partner-meta .sub { font-size: 0.76rem; color: var(--text-faint); }
.timer {
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--border-bright);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.timer:empty { display: none; }

.viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 64px;
  width: min(360px, 80%);
  /* Isolates the bars so their animation cannot invalidate layout elsewhere. */
  contain: strict;
}
/* Bars are laid out once at full height and scaled by transform. Animating
   transform stays on the compositor; animating height would re-run layout for
   the whole row on every frame. */
.viz i {
  width: 4px;
  height: 56px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.5;
  transform: scaleY(0.08);
  transform-origin: center bottom;
  will-change: transform;
}
.viz.is-live i { opacity: 0.85; }

.status-line {
  margin: 0;
  min-height: 22px;
  font-size: 0.97rem;
  color: var(--text-dim);
}
.status-line strong { color: var(--text); font-weight: 600; }

/* Participant list for group rooms. Each row lights up while that person is
   speaking, which is the only cue a voice-only room can give about who is
   talking. */
.roster {
  width: min(420px, 100%);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.roster[hidden] { display: none; }
.roster-head {
  margin: 0 0 10px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.roster-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.roster-item.speaking {
  border-color: var(--accent);
  background: rgba(53, 224, 208, 0.07);
}
.roster-avatar {
  width: 28px; height: 28px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-size: 0.76rem;
  font-weight: 700;
}
.roster-item .nm { font-size: 0.87rem; font-weight: 550; }
.roster-item .sub { font-size: 0.73rem; color: var(--text-faint); }
.roster-item .you {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.roster-item .state { margin-left: auto; font-size: 0.72rem; color: var(--text-faint); }
.roster-item.speaking .state { color: var(--accent); }

.queue-note {
  margin: -14px 0 0;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.queue-note[hidden] { display: none; }
.queue-note .relaxed { color: var(--warn); }

/* Captions sit under the status line, newest at the bottom, capped at two
   lines so a long conversation cannot push the call button off screen. */
.captions {
  width: min(560px, 100%);
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  text-align: left;
}
.captions[hidden] { display: none; }
.caption-line {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  transition: opacity 0.2s ease;
}
.caption-line:empty { display: none; }
.caption-line.them { color: var(--text); }
.caption-line.me { margin-top: 5px; color: var(--text-faint); font-size: 0.82rem; }
.caption-line .lang-note {
  margin-left: 6px;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.call-btn {
  position: relative;
  width: 116px; height: 116px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  cursor: pointer;
  box-shadow: 0 14px 40px -14px var(--accent-glow);
  transition: transform 0.16s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.call-btn:hover { transform: translateY(-2px); box-shadow: 0 20px 46px -14px var(--accent-glow); }
.call-btn:active { transform: translateY(0); }
.call-icon { width: 26px; height: 26px; }
.call-btn .cap {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.call-btn.searching { animation: ring 1.8s ease-out infinite; }
.call-btn.live {
  background: linear-gradient(135deg, var(--danger), #ff8a5c);
  box-shadow: 0 14px 40px -14px rgba(255, 95, 109, 0.5);
}
.call-btn.live .call-icon { transform: rotate(135deg); }
@keyframes ring {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 22px rgba(53, 224, 208, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 208, 0); }
}

/* ---------------------------------------------------------------- controls */

.controls { display: flex; align-items: center; gap: 8px; }

.ctrl {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ctrl svg { width: 100%; height: 100%; }
.ctrl:hover { color: var(--text); border-color: var(--border-bright); background: var(--bg-raised); }
.ctrl.active { color: var(--warn); border-color: var(--warn); }
.ctrl[hidden] { display: none; }

.overflow { position: relative; }
.menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--border-bright);
  border-radius: 11px;
  background: var(--bg-card);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.75);
  z-index: 20;
}
.menu button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.menu button.danger:hover { background: rgba(255, 95, 109, 0.12); color: var(--danger); }

/* -------------------------------------------------------------------- game */

.game {
  padding: 16px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
}
.game-status { margin: 0 0 12px; font-size: 0.85rem; color: var(--text-dim); }
.board { display: grid; grid-template-columns: repeat(3, 52px); gap: 5px; }
.board button {
  width: 52px; height: 52px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.14s ease;
}
.board button:hover:not(:disabled) { border-color: var(--accent); }
.board button:disabled { cursor: default; }

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

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-empty {
  margin: auto;
  max-width: 26ch;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-faint);
}

.msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: msg-in 0.16s ease;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } }
.msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  border-bottom-right-radius: 5px;
}
.msg.them {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}
.msg.system, .msg.warn {
  align-self: center;
  max-width: 100%;
  text-align: center;
  font-size: 0.78rem;
  padding: 6px 12px;
}
.msg.system { background: none; color: var(--text-faint); }
.msg.warn {
  border-radius: 9px;
  background: rgba(255, 182, 72, 0.09);
  border: 1px solid rgba(255, 182, 72, 0.28);
  color: var(--warn);
}
.msg img { display: block; max-width: 100%; border-radius: 10px; }

.typing {
  flex: none;
  height: 17px;
  padding: 0 18px;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.composer {
  flex: none;
  display: flex;
  gap: 7px;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.composer input[type="text"] { flex: 1; border-radius: 999px; padding: 10px 15px; }

.icon-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.icon-btn svg { width: 100%; height: 100%; }
.icon-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.primary:not(:disabled) {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121a;
}

/* ------------------------------------------------------------------- lists */

.list { display: flex; flex-direction: column; gap: 7px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.list-item .avatar {
  width: 30px; height: 30px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(53, 224, 208, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 650;
}
.list-item .nm { font-size: 0.87rem; font-weight: 550; }
.list-item .sub { font-size: 0.74rem; color: var(--text-faint); }
.empty {
  padding: 30px 16px;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ------------------------------------------------------------------ dialog */

dialog.modal {
  padding: 0;
  width: calc(100% - 32px);
  max-width: 440px;
  border: 1px solid var(--border-bright);
  border-radius: 18px;
  background: var(--bg-card);
  color: var(--text);
}
dialog.modal::backdrop { background: rgba(3, 6, 12, 0.78); backdrop-filter: blur(3px); }
.modal-body { padding: 26px; }
.modal-body h2 { margin: 0 0 9px; font-size: 1.22rem; letter-spacing: -0.02em; }
.modal-body p { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.65; color: var(--text-dim); }
.modal-body ul { margin: 0; padding-left: 18px; font-size: 0.87rem; line-height: 1.75; color: var(--text-dim); }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.modal-actions .btn { padding: 10px 18px; font-size: 0.88rem; }

/* --------------------------------------------------------- incoming call */

.ring-body { text-align: center; }
.ring-avatar {
  width: 66px; height: 66px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-size: 1.6rem;
  font-weight: 750;
  animation: ring-pulse 1.8s ease-out infinite;
}
@keyframes ring-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 20px rgba(53, 224, 208, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 208, 0); }
}
.ring-actions { justify-content: center; }
.ring-actions .btn { min-width: 118px; }

/* Call and block buttons on a friends or recents row. */
.list-item .actions { margin-left: auto; display: flex; gap: 5px; flex: none; }
.row-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 7px;
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.row-btn svg { width: 100%; height: 100%; }
.row-btn.call:hover { color: var(--ok); border-color: var(--ok); }
.row-btn.block:hover { color: var(--danger); border-color: var(--danger); }

.toast-host {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.toast {
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: var(--bg-card);
  font-size: 0.85rem;
  box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.8);
  animation: rise 0.2s ease;
}
.toast.err { border-color: rgba(255, 95, 109, 0.5); color: var(--danger); }
.toast.ok { border-color: rgba(74, 222, 128, 0.5); color: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------------------- responsive */

/* ------------------------------------------------------------------- touch */

/* Hover styling is desktop-only on purpose. A touch browser applies :hover on
   tap and leaves it applied until you tap elsewhere, so every button a phone
   user pressed would stay lit. Wrapping the rules in a hover query removes the
   whole class of problem rather than patching each button. */
@media (hover: none) {
  .ctrl:hover, .icon-btn:hover, .bar-btn:hover, .tab:hover,
  .seg:hover, .menu button:hover, .board button:hover {
    background: inherit;
    color: inherit;
    border-color: inherit;
  }
  .card:hover, .call-btn:hover { transform: none; }
}

/* Feedback for a press, which is what touch actually needs instead of hover. */
.ctrl:active, .icon-btn:active, .seg:active, .tab:active { opacity: 0.65; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1060px) {
  .app-main { grid-template-columns: var(--pane) minmax(0, 1fr); }
  .bar-btn#toggle-right { display: block; }
  .pane-right { position: fixed; inset: var(--bar) 0 0 0; z-index: 45; display: none; border-left: 0; }
  .pane-right.is-open { display: flex; }
}

@media (max-width: 760px) {
  :root { --bar: 56px; }

  .app-main { grid-template-columns: minmax(0, 1fr); }
  .bar-btn { display: block; }
  .app-bar { gap: 8px; padding: 0 12px; }
  .app-bar .brand span { display: none; }
  .presence { padding: 5px 10px; font-size: 0.78rem; }

  /* Panels come up from the bottom rather than covering the whole screen. A
     sheet keeps the call visible behind it, so you never lose your place in a
     conversation to check a filter. */
  .pane-left, .pane-right {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 45;
    display: flex;
    max-height: 78vh;
    max-height: 78dvh;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: var(--bg-raised);
    box-shadow: 0 -18px 50px -20px rgba(0, 0, 0, 0.75);
    transform: translateY(101%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pane-left.is-open, .pane-right.is-open { transform: translateY(0); }

  /* Grab handle, so the sheet reads as draggable-looking and dismissible. */
  .pane-left::before, .pane-right::before {
    content: '';
    display: block;
    width: 38px;
    height: 4px;
    margin: 9px auto 3px;
    border-radius: 2px;
    background: var(--border-bright);
    flex: none;
  }

  #sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(3, 6, 12, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }
  #sheet-scrim.is-open { opacity: 1; pointer-events: auto; }

  .stage { gap: 18px; padding: 20px 16px 28px; justify-content: flex-start; padding-top: 28px; }
  .call-btn { width: 100px; height: 100px; }
  .call-icon { width: 23px; height: 23px; }
  .viz { height: 52px; width: 100%; }
  .viz i { height: 46px; }
  .roster, .captions { width: 100%; }

  /* 44px is the smallest reliable touch target; the desktop sizes are smaller
     because a mouse is precise and a fingertip is not. */
  .ctrl { width: 46px; height: 46px; padding: 12px; }
  .icon-btn { width: 44px; height: 44px; }
  .controls { gap: 10px; flex-wrap: wrap; justify-content: center; }
  .row-btn { width: 40px; height: 40px; padding: 10px; }
  .seg { padding: 13px 2px; min-height: 44px; }
  .tab { padding: 12px 6px; min-height: 44px; }
  /* These open the sheets — the most-tapped controls on a phone, so they get
     the full target even though the icon inside stays visually small. */
  .bar-btn { width: 44px; height: 44px; padding: 11px; }

  .composer { padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  /* Anything under 16px makes iOS Safari zoom the page when the field focuses. */
  .composer input[type="text"] { font-size: 16px; }
  input[type="text"], select { font-size: 16px; }

  .msg { max-width: 90%; }
  .board { grid-template-columns: repeat(3, 58px); }
  .board button { width: 58px; height: 58px; }
  .toast-host { bottom: calc(16px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { text-align: center; }
}

@media (max-width: 380px) {
  .seg { font-size: 0.74rem; }
  .seg svg { display: none; }
  .call-btn { width: 92px; height: 92px; }
}

/* Landscape on a phone is short, not narrow — the tall stack would not fit. */
@media (max-height: 460px) and (orientation: landscape) {
  .stage { flex-direction: row; flex-wrap: wrap; gap: 14px; padding: 14px; }
  .viz { height: 40px; width: 200px; }
  .viz i { height: 34px; }
  .call-btn { width: 76px; height: 76px; }
  .call-btn .cap { font-size: 0.64rem; }
}

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