/* JARVIS Nova - live voice call overlay. Sits above the chat and work views (z 80), below sheets (90) and toasts (120). */

/* while the message box is empty the send button is the live-voice button */
.nv-send.is-call .ic { width: 22px; height: 22px; }

.nv-live {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  padding-top: var(--safe-t);
  background:
    radial-gradient(120% 70% at 50% 12%, rgba(255, 122, 26, .17), transparent 58%),
    radial-gradient(90% 60% at 50% 104%, rgba(94, 169, 255, .10), transparent 60%),
    rgba(4, 6, 12, .91);
  -webkit-backdrop-filter: blur(22px) saturate(1.15); backdrop-filter: blur(22px) saturate(1.15);
  opacity: 0; transform: scale(1.015); transition: opacity .25s ease, transform .25s ease;
}
.nv-live.is-on { opacity: 1; transform: none; }
.nv-live:focus { outline: 0; }

/* ---------------------------------------------------------------- top bar */
.nv-live__top { display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 12px; flex: none; }
.nv-live__top .grow { flex: 1; }
.nv-live__link {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--nv-glass-3); border: 1px solid var(--nv-line); color: var(--nv-ink-2);
  font: 500 12px/1 var(--f-body); max-width: 68vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nv-live__link span { overflow: hidden; text-overflow: ellipsis; }
.nv-live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nv-warn); flex: none; }
.nv-live__dot[data-on="1"] { background: var(--nv-ok); box-shadow: 0 0 10px var(--nv-ok); }
.nv-live__dot[data-on="x"] { background: var(--nv-bad); box-shadow: 0 0 10px var(--nv-bad); }

/* ---------------------------------------------------------------- stage */
.nv-live__stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 0 18px; }
.nv-live__orbwrap { width: min(58vw, 280px, 34dvh); aspect-ratio: 1; flex: none; margin-top: 1.5dvh; display: grid; place-items: center; }
.nv-live__orb { display: block; }
.nv-live__status { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 6px; min-height: 52px; text-align: center; }
.nv-live__state { font: 600 20px/1.1 var(--f-display); letter-spacing: .24em; text-transform: uppercase; color: var(--nv-ink); transition: color .25s; }
.nv-live[data-state="listening"] .nv-live__state { color: var(--nv-or-2); }
.nv-live[data-state="hearing"] .nv-live__state { color: #ffc690; }
.nv-live[data-state="thinking"] .nv-live__state { color: #b8afff; }
.nv-live[data-state="speaking"] .nv-live__state { color: #a9d0ff; }
.nv-live[data-state="muted"] .nv-live__state, .nv-live[data-state="connecting"] .nv-live__state { color: var(--nv-ink-3); }
.nv-live[data-state="reconnecting"] .nv-live__state { color: var(--nv-warn); }
.nv-live[data-state="failed"] .nv-live__state { color: var(--nv-bad); }
.nv-live__hint { color: var(--nv-ink-3); font-size: 13px; min-height: 18px; max-width: 34ch; }

.nv-live__caps {
  flex: 1; min-height: 0; width: min(100%, 640px); overflow-y: auto; padding: 10px 4px 16px;
  display: flex; flex-direction: column; gap: 16px;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 100%); mask-image: linear-gradient(transparent, #000 16%, #000 100%);
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.nv-live__turn { display: flex; flex-direction: column; gap: 6px; opacity: .5; transition: opacity .3s; }
.nv-live__turn.is-last { opacity: 1; }
.nv-live__turn p { margin: 0; overflow-wrap: anywhere; }
.nv-live__turn .u { align-self: flex-end; max-width: 88%; text-align: right; font-size: 14.5px; line-height: 1.4; color: var(--nv-ink-3); }
.nv-live__turn .j { font-size: 19px; line-height: 1.45; color: var(--nv-ink); }
.nv-live__turn:not(.is-last) .j { font-size: 16px; }

/* ---------------------------------------------------------------- problems, said plainly */
.nv-live__banner {
  flex: none; margin: 0 14px 8px; padding: 10px 12px; border-radius: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  font-size: 13.5px; line-height: 1.4; background: var(--nv-bad-a); border: 1px solid rgba(255, 95, 109, .4); color: #ffb3ba;
}
.nv-live__banner[data-kind="warn"] { background: rgba(255, 194, 71, .12); border-color: rgba(255, 194, 71, .4); color: #ffd98a; }
.nv-live__banner .nv-btn { flex: none; }

/* ---------------------------------------------------------------- controls */
.nv-live__dock { flex: none; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 16px calc(18px + var(--safe-b)); }
.nv-live__modes { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--nv-glass-3); border: 1px solid var(--nv-line); }
.nv-live__modes button { height: 30px; padding: 0 14px; border-radius: 999px; font: 500 12.5px/1 var(--f-body); color: var(--nv-ink-2); transition: background .15s, color .15s; }
.nv-live__modes button[aria-selected="true"] { background: var(--nv-or-a); color: var(--nv-or-2); box-shadow: inset 0 0 0 1px rgba(255, 138, 43, .45); }
.nv-live__ctl { display: flex; align-items: center; justify-content: center; gap: 26px; }

.nv-live__btn { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--nv-ink-2); font-size: 11.5px; }
.nv .nv-live__btn .ic {
  width: 54px; height: 54px; padding: 15px; border-radius: 50%; background: var(--nv-glass-2); border: 1px solid var(--nv-line-2);
  transition: background .15s, border-color .15s, transform .12s;
}
.nv-live__btn:hover .ic { border-color: rgba(255, 255, 255, .28); }
.nv-live__btn:active .ic { transform: scale(.93); }
.nv-live__btn.is-on .ic { background: var(--nv-bad-a); border-color: rgba(255, 95, 109, .55); color: #ff9aa4; }
.nv-live__btn--end { color: #ff9aa4; }
.nv .nv-live__btn--end .ic { background: linear-gradient(180deg, #ff6b78, #e5384a); border-color: rgba(255, 140, 150, .6); color: #fff; box-shadow: 0 6px 20px rgba(229, 56, 74, .35); }

.nv-live__main {
  width: 92px; height: 92px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--nv-glass-2); border: 1px solid var(--nv-line-2); color: var(--nv-ink); font-size: 11px; letter-spacing: .04em;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .12s, box-shadow .2s, background .2s, border-color .2s;
}
.nv .nv-live__main .ic { width: 30px; height: 30px; }
.nv-live__main[data-mode="auto"][data-busy="1"] { border-color: rgba(94, 169, 255, .6); color: #bcd9ff; box-shadow: 0 0 0 6px rgba(94, 169, 255, .12); }
.nv-live__main[data-mode="ptt"] {
  background: linear-gradient(180deg, #ff9440, #ff6a0a); color: #1d0c00; font-weight: 600; border-color: rgba(255, 175, 100, .6);
  box-shadow: 0 8px 28px rgba(255, 106, 10, .4);
}
.nv-live__main.is-held { transform: scale(.94); box-shadow: 0 0 0 9px rgba(255, 122, 26, .25), 0 8px 34px rgba(255, 106, 10, .6); }
.nv-live__main:disabled { opacity: .45; }

@media (max-height: 660px) {
  .nv-live__orbwrap { width: min(44vw, 170px, 26dvh); }
  .nv-live__hint { display: none; }
  .nv-live__main { width: 78px; height: 78px; }
  .nv-live__dock { gap: 10px; padding-bottom: calc(12px + var(--safe-b)); }
  .nv-live__turn .j { font-size: 17px; }
}
@media (min-width: 900px) {
  .nv-live__orbwrap { width: min(30vw, 300px, 36dvh); }
}
@media (prefers-reduced-motion: reduce) {
  .nv-live, .nv-live__turn, .nv-live__main, .nv .nv-live__btn .ic { transition: none; }
}
