/* ════════════════════════════════════════════════════════════════════════
   1:1 CALLS (2.6): header buttons + the full-screen call screen (call-ui.mjs). Own file so app.css stays as 2.5.5.
   The call screen is always dark gold (#14110d / #e0b84f / white), in every theme.
   ════════════════════════════════════════════════════════════════════════ */
#call-btn, #call-video-btn, #group-call-btn, #chat-overflow-btn { min-width: 44px; min-height: 44px; }
/* wide screens: voice then video (app.css gave the old group button and phone button their own order) */
#call-btn { order: 1; }
#call-video-btn { order: 2; }
#chat-overflow-btn { order: 3; }


/* phone header: three 44 px buttons + the name + the shield pill must fit 390 px, so the gaps are tight */
@media (max-width: 640px) {
  #chat-header { gap: 4px; padding-left: 8px; padding-right: 4px; }
  #chat-header-right { gap: 0; }
  #chat-header .chat-shield { padding: 3px 7px; }
  #chat-title-block { min-width: 0; flex: 1 1 auto; }
}

.tbl-call { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; align-items: center; background: #14110d; color: #fff;
  font-family: inherit; overflow: hidden; -webkit-user-select: none; user-select: none; touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-sizing: border-box; }
.tbl-call[hidden], .tbl-call [hidden] { display: none !important; }
.tbl-call button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
.tbl-call :focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
html.tbl-in-call, html.tbl-in-call body { overflow: hidden; }

.tbl-call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.tbl-call.has-remote-video .tbl-call-remote { display: block; }
.tbl-call-scrim { position: absolute; inset: 0; pointer-events: none; display: none;
  background: linear-gradient(to bottom, rgba(20,17,13,.78) 0, rgba(20,17,13,0) 26%, rgba(20,17,13,0) 58%, rgba(20,17,13,.86) 100%); }
.tbl-call.has-remote-video .tbl-call-scrim { display: block; }

.tbl-call-top { position: relative; z-index: 2; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: clamp(16px, 5vh, 44px) 64px 0; text-align: center; transition: opacity .25s; }
.tbl-call-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: rgba(224,184,79,.14); color: #e0b84f; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.tbl-call-name { margin: 6px 0 0; font-size: clamp(24px, 7vw, 32px); font-weight: 700; line-height: 1.15; color: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-call-status { font-size: 17px; color: #e0b84f; font-variant-numeric: tabular-nums; min-height: 1.4em; max-width: 30em; line-height: 1.35; }
.tbl-call-ringmute { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top) + 10px); right: calc(env(safe-area-inset-right) + 12px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

.tbl-call-stage { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tbl-call.has-remote-video .tbl-call-stage { visibility: hidden; }
.tbl-call-kind { display: none; }
.tbl-call-avatar { width: min(46vw, 190px, 26vh); aspect-ratio: 1; border-radius: 50%; background: #2c2618; border: 3px solid rgba(224,184,79,.6);
  display: flex; align-items: center; justify-content: center; font-size: clamp(44px, 16vw, 78px); font-weight: 700; color: #e0b84f; overflow: hidden; box-shadow: 0 0 0 0 rgba(224,184,79,.35); }
.tbl-call-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .tbl-call[data-mode="incoming"] .tbl-call-avatar, .tbl-call[data-mode="outgoing"] .tbl-call-avatar { animation: tblCallPulse 1.8s ease-out infinite; }
  @keyframes tblCallPulse { 0% { box-shadow: 0 0 0 0 rgba(224,184,79,.38); } 100% { box-shadow: 0 0 0 34px rgba(224,184,79,0); } }
}

.tbl-call-self { position: absolute; z-index: 3; right: calc(env(safe-area-inset-right) + 14px); bottom: calc(env(safe-area-inset-bottom) + 158px); width: 96px; height: 136px; border-radius: 16px; object-fit: cover; background: #000;
  border: 2px solid rgba(255,255,255,.28); box-shadow: 0 6px 22px rgba(0,0,0,.5); transform: scaleX(-1); display: none; touch-action: none; cursor: grab; }
.tbl-call[data-facing="environment"] .tbl-call-self { transform: none; }
.tbl-call.has-self-video .tbl-call-self { display: block; }

.tbl-call-controls, .tbl-call-incoming { position: relative; z-index: 2; width: 100%; box-sizing: border-box; display: flex; justify-content: center; align-items: flex-end; transition: opacity .25s; }
.tbl-call-controls { gap: 8px; padding: 12px 12px 24px; }
.tbl-call-incoming { gap: 64px; padding: 12px 12px 36px; }
.tbl-call.hide-controls .tbl-call-controls, .tbl-call.hide-controls .tbl-call-top { opacity: 0; pointer-events: none; }
.tbl-call-ctlwrap, .tbl-call-bigwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; }
.tbl-call-label { font-size: 12px; line-height: 1.2; color: #e8e2d2; text-align: center; white-space: nowrap; }
.tbl-call-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, transform .1s; }
.tbl-call-btn:active, .tbl-call-big:active { transform: scale(.94); }
.tbl-call-btn[aria-pressed="true"] { background: #e0b84f; color: #14110d; }
.tbl-call-btn.end { width: 72px; height: 72px; background: #e5484d; }
.tbl-call-btn.end svg, .tbl-call-big.decline svg { transform: rotate(135deg); }
.tbl-call-big { width: 72px; height: 72px; border-radius: 50%; border: 0; padding: 0; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tbl-call-big.accept { background: #2fb344; }
.tbl-call-big.decline { background: #e5484d; }
.tbl-call-after { position: relative; z-index: 2; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 24px 40px; }
.tbl-call-pill { min-height: 52px; min-width: 220px; padding: 0 28px; border-radius: 999px; border: 1px solid rgba(224,184,79,.55); background: transparent; color: #e0b84f; font-size: 17px; font-weight: 600; cursor: pointer; }
.tbl-call-pill.primary { background: #e0b84f; color: #14110d; border-color: #e0b84f; }

/* landscape / short screens */
@media (max-height: 520px) {
  .tbl-call-top { padding-top: 8px; gap: 2px; }
  .tbl-call-name { font-size: 22px; margin-top: 0; }
  .tbl-call-status { font-size: 15px; }
  .tbl-call-avatar { width: min(26vh, 110px); font-size: 40px; }
  .tbl-call-controls { padding-bottom: 10px; } .tbl-call-incoming { padding-bottom: 14px; gap: 90px; }
  .tbl-call-btn { width: 52px; height: 52px; } .tbl-call-btn.end, .tbl-call-big { width: 60px; height: 60px; }
  .tbl-call-self { bottom: calc(env(safe-area-inset-bottom) + 96px); width: 112px; height: 80px; }
  .tbl-call-after { padding-bottom: 12px; flex-direction: row; justify-content: center; }
  .tbl-call-pill { min-width: 0; }
}

/* the missed-call line in the chat: small, centred, no bubble */
.msg-wrap.tbl-call-line { align-self: center; width: auto; max-width: 90%; }
.msg-wrap.tbl-call-line .msg-bubble { background: transparent !important; box-shadow: none !important; border: 0 !important; padding: 2px 10px; text-align: center; color: var(--tb-text-2, #9aa3b2); font-size: 13px; }
.msg-wrap.tbl-call-line .msg-bubble::before { content: "\260E\00a0"; }
.msg-wrap.tbl-call-line .msg-meta, .msg-wrap.tbl-call-line .msg-ctx-btn { display: none; }
