/* ================================================================
   DXED Voice Chat (beta).

   The dock is fixed to the viewport and lives outside every page
   container, so navigation never disturbs it. On mobile it sits above
   the app's bottom nav and expands into a sheet rather than a modal —
   a live social room, not a phone-call screen.
   ================================================================ */

#dxv-root { --dxv-line: rgba(255,255,255,.10); --dxv-surface: #14151a; --dxv-ink: var(--text-primary);
  --dxv-ink-2: var(--text-secondary); --dxv-ink-3: var(--text-muted);
  --dxv-live: #5aa87a; --dxv-wait: #c39355; --dxv-bad: #d06468; }

.dxv-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#dxv-audio-sink { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── Dock ───────────────────────────────────────────────────── */

#dxv-dock { position: fixed; z-index: 900; left: 18px; bottom: 18px; width: 340px; max-width: calc(100vw - 36px); }
.dxv-dock { background: var(--dxv-surface); border: 1px solid var(--dxv-line); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.45); overflow: hidden; }
.dxv-dock-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; }
.dxv-dock-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 0; }
.dxv-dock-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dxv-dock-name { font-size: 13.5px; font-weight: 650; color: var(--dxv-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dxv-dock-meta { font-size: 11.5px; color: var(--dxv-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dxv-dock-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.dxv-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--dxv-ink-3); }
.dxv-dot.is-live { background: var(--dxv-live); }
.dxv-dot.is-wait { background: var(--dxv-wait); animation: dxv-pulse 1.4s ease-in-out infinite; }
.dxv-dot.is-off { background: var(--dxv-bad); }
@keyframes dxv-pulse { 50% { opacity: .35; } }

.dxv-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--dxv-line); background: transparent; color: var(--dxv-ink);
  font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dxv-icon:hover { background: rgba(255,255,255,.05); }
.dxv-icon.is-off { color: var(--dxv-bad); border-color: rgba(208,100,104,.4); }
.dxv-icon.dxv-leave:hover { border-color: rgba(208,100,104,.5); color: var(--dxv-bad); }

.dxv-dock-body { border-top: 1px solid var(--dxv-line); padding: 12px; max-height: 52vh; overflow-y: auto;
  overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; }
.dxv-block h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dxv-ink-3); margin-bottom: 8px; }
.dxv-room-type { font-size: 11.5px; color: var(--dxv-ink-3); text-transform: capitalize; }
.dxv-hint { font-size: 11.5px; color: var(--dxv-ink-3); line-height: 1.5; }
.dxv-prose { font-size: 13.5px; color: var(--dxv-ink-2); line-height: 1.6; }
.dxv-tag { font-size: 10px; color: var(--dxv-ink-3); border: 1px solid var(--dxv-line); border-radius: 4px; padding: 0 4px; }

/* ── Participants ───────────────────────────────────────────── */

.dxv-people { list-style: none; display: flex; flex-direction: column; }
.dxv-person { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--dxv-line); }
.dxv-person:last-child { border-bottom: 0; }
.dxv-person-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dxv-line); flex-shrink: 0;
  transition: background .12s ease, box-shadow .12s ease; }
/* Speaking is a ring + a screen-reader phrase, never colour alone. */
.dxv-person.is-speaking .dxv-person-dot { background: var(--dxv-live); box-shadow: 0 0 0 3px rgba(90,168,122,.22); }
.dxv-person.is-speaking .dxv-person-name::after { content: ' ▸'; color: var(--dxv-live); }
.dxv-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dxv-person-name { font-size: 13px; font-weight: 600; color: var(--dxv-ink); }
.dxv-person-meta { font-size: 11px; color: var(--dxv-ink-3); text-transform: capitalize; }
.dxv-person-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.dxv-vol input { width: 56px; accent-color: var(--dxv-ink-2); }
.dxv-mini { font-size: 10.5px; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--dxv-line);
  background: none; color: var(--dxv-ink-3); cursor: pointer; }
.dxv-mini:hover { color: var(--dxv-ink); }
.dxv-mini.dxv-danger:hover { color: var(--dxv-bad); border-color: rgba(208,100,104,.4); }

.dxv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dxv-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 34px;
  padding: 7px 12px; border-radius: 7px; border: 1px solid var(--dxv-line); background: transparent;
  color: var(--dxv-ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dxv-btn:hover { background: rgba(255,255,255,.05); }
.dxv-btn:disabled { opacity: .5; cursor: not-allowed; }
.dxv-btn-primary { background: var(--dxv-ink); border-color: var(--dxv-ink); color: #0a0b0f; }
.dxv-btn.dxv-danger { border-color: rgba(208,100,104,.4); color: var(--dxv-bad); }

#dxv-root :is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent-light, #c3c6cf); outline-offset: 2px; }

.dxv-error { font-size: 12.5px; color: var(--dxv-bad); background: rgba(208,100,104,.08);
  border: 1px solid rgba(208,100,104,.3); border-radius: 7px; padding: 8px 10px; line-height: 1.5; }

/* ── Dialogs ────────────────────────────────────────────────── */

.dxv-overlay { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center;
  justify-content: center; padding: 24px; }
.dxv-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.62); }
.dxv-dialog { position: relative; z-index: 1; width: 100%; max-width: 480px; max-height: min(86vh, 720px);
  display: flex; flex-direction: column; background: var(--bg-secondary, #0b0c0f);
  border: 1px solid var(--dxv-line); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.5); }
.dxv-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-bottom: 1px solid var(--dxv-line); }
.dxv-dialog-head h2 { font-size: 15.5px; font-weight: 650; }
.dxv-dialog-head p { font-size: 12.5px; color: var(--dxv-ink-3); margin-top: 3px; line-height: 1.5; }
.dxv-dialog-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dxv-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px;
  border-top: 1px solid var(--dxv-line); flex-wrap: wrap; }

.dxv-steps { margin: 0 0 4px 18px; font-size: 13px; color: var(--dxv-ink-2); line-height: 1.7; }
.dxv-field { display: flex; flex-direction: column; gap: 6px; }
.dxv-field > span { font-size: 12.5px; font-weight: 600; color: var(--dxv-ink-2); }
.dxv-field input, .dxv-field select, .dxv-field textarea {
  background: rgba(255,255,255,.03); border: 1px solid var(--dxv-line); border-radius: 7px;
  padding: 9px 11px; color: var(--dxv-ink); font: inherit; font-size: 13.5px; outline: none; width: 100%; }
.dxv-check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--dxv-ink-2);
  cursor: pointer; padding: 4px 0; }
.dxv-check input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent-light, #c3c6cf); flex-shrink: 0; }
.dxv-fieldset { border: 1px solid var(--dxv-line); border-radius: 8px; padding: 12px; display: flex;
  flex-direction: column; gap: 8px; }
.dxv-fieldset legend { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dxv-ink-3); padding: 0 6px; }

.dxv-meter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dxv-label { font-size: 12.5px; color: var(--dxv-ink-2); font-weight: 600; }
.dxv-meter { display: block; flex: 1; min-width: 120px; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.08); overflow: hidden; }
.dxv-meter > span { display: block; height: 100%; width: 0; background: var(--dxv-live); transition: width .06s linear; }

/* ── Voice pages (standalone, settings, admin) ───────────────── */

.dxv-page { max-width: 1080px; margin: 0 auto; padding: 0 24px 90px; }
.dxv-page-head { padding: 28px 0 16px; border-bottom: 1px solid var(--dxv-line); margin-bottom: 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.dxv-page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.dxv-page-head p { margin-top: 6px; font-size: 13.5px; color: var(--dxv-ink-3); line-height: 1.55; max-width: 620px; }
.dxv-beta { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--dxv-line); border-radius: 4px; padding: 2px 6px; color: var(--dxv-ink-3); margin-left: 8px;
  vertical-align: middle; }
.dxv-section { margin-bottom: 32px; }
.dxv-section > h2 { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--dxv-ink-2); padding-bottom: 9px; margin-bottom: 12px; border-bottom: 1px solid var(--dxv-line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dxv-rooms { display: flex; flex-direction: column; }
.dxv-room { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--dxv-line); }
.dxv-rooms > .dxv-room:last-child { border-bottom: 0; }
.dxv-room-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dxv-room-name { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dxv-room-meta { font-size: 12px; color: var(--dxv-ink-3); display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.dxv-room-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.dxv-empty { padding: 26px 0; border-top: 1px solid var(--dxv-line); }
.dxv-empty p { font-size: 13.5px; font-weight: 600; color: var(--dxv-ink-2); }
.dxv-empty span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--dxv-ink-3); line-height: 1.55; max-width: 46ch; }
.dxv-skel { background: rgba(255,255,255,.04); border-radius: 6px; height: 12px; }
.dxv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  border: 1px solid var(--dxv-line); border-radius: 10px; overflow: hidden; margin-bottom: 26px; }
.dxv-stat { padding: 13px 15px; border-right: 1px solid var(--dxv-line); display: flex; flex-direction: column; gap: 2px; }
.dxv-stat:last-child { border-right: 0; }
.dxv-stat strong { font-size: 19px; font-weight: 700; }
.dxv-stat span { font-size: 11.5px; color: var(--dxv-ink-3); }
.dxv-note { border: 1px solid var(--dxv-line); border-left-width: 3px; border-radius: 7px; padding: 11px 13px;
  font-size: 13px; color: var(--dxv-ink-2); line-height: 1.55; margin-bottom: 18px; }
.dxv-note[data-tone="warn"] { border-left-color: var(--dxv-wait); }
.dxv-note[data-tone="bad"] { border-left-color: var(--dxv-bad); }

/* ── Inline join buttons on host pages ──────────────────────── */

.dxv-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* ── Tablet + mobile ────────────────────────────────────────── */

@media (max-width: 900px) {
  #dxv-dock { left: 12px; right: 12px; width: auto;
    /* Clear of the app's bottom nav and the phone's home indicator. */
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .dxv-dock-body { max-height: 60vh; }
  .dxv-page { padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .dxv-page-head { padding: 20px 0 14px; }
  .dxv-page-head h1 { font-size: 20px; }
  .dxv-room { grid-template-columns: auto minmax(0,1fr); }
  .dxv-room-actions { grid-column: 1 / -1; }
  .dxv-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dxv-stat:nth-child(2n) { border-right: 0; }

  /* Dialogs become sheets; the footer stays reachable above the keyboard. */
  .dxv-overlay { padding: 0; align-items: flex-end; }
  .dxv-dialog { max-width: none; max-height: 92dvh; border-radius: 12px 12px 0 0; border-bottom: 0; }
  .dxv-dialog-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .dxv-dialog-foot .dxv-btn { flex: 1 1 auto; }
  /* Bigger primary controls on touch. */
  .dxv-icon { width: 40px; height: 40px; }
  .dxv-person-actions .dxv-mini { min-height: 30px; }
}

@media (max-width: 380px) {
  #dxv-dock { left: 8px; right: 8px; }
  .dxv-dock-meta { font-size: 11px; }
  .dxv-vol input { width: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .dxv-dot.is-wait { animation: none; }
  .dxv-person-dot, .dxv-meter > span { transition: none; }
}
