/* =====================================================================
   AkiliChat V64 — Akili Live (rencontre vidéo aléatoire)
   Full-screen immersive module. The stage stays cinematic (dark) in every
   app theme, which keeps video contrast high and mirrors native live
   experiences, while the surrounding sheets reuse the V64 design tokens.
   ===================================================================== */

.live-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: #f2f6ff;
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(46, 139, 255, .30), transparent 62%),
    radial-gradient(760px 480px at 100% 0%, rgba(57, 208, 255, .18), transparent 58%),
    radial-gradient(700px 420px at 50% 120%, rgba(168, 255, 36, .12), transparent 60%),
    #050a13;
  overflow: hidden;
  isolation: isolate;
  animation: liveFadeIn .24s ease both;
}

@keyframes liveFadeIn {
  from { opacity: 0; transform: scale(.995); }
  to { opacity: 1; transform: none; }
}

body.live-open { overflow: hidden; }

.live-aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 60%;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  filter: blur(40px);
}
.live-aurora span {
  position: absolute;
  width: 42%;
  height: 90%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 139, 255, .55), transparent 68%);
  animation: liveDrift 18s ease-in-out infinite alternate;
}
.live-aurora span:nth-child(2) {
  left: 40%;
  background: radial-gradient(circle, rgba(57, 208, 255, .40), transparent 66%);
  animation-delay: -6s;
}
.live-aurora span:nth-child(3) {
  left: 68%;
  background: radial-gradient(circle, rgba(168, 255, 36, .26), transparent 64%);
  animation-delay: -11s;
}
@keyframes liveDrift {
  from { transform: translate3d(-4%, -3%, 0) scale(1); }
  to { transform: translate3d(6%, 4%, 0) scale(1.12); }
}

/* ------------------------------------------------------------------ header */
.live-header {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  flex: 0 0 auto;
}
.live-heading { flex: 1 1 auto; min-width: 0; text-align: center; }
.live-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: #eaf2ff;
}
.live-title strong {
  font-weight: 850;
  background: linear-gradient(100deg, #39d0ff, #a8ff24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.live-title__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b5c;
  box-shadow: 0 0 0 4px rgba(255, 59, 92, .18);
  animation: liveRec 1.8s ease-in-out infinite;
}
@keyframes liveRec {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
.live-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: #9fb0c8;
  letter-spacing: .01em;
}
.live-head-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.live-icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  color: #eaf2ff;
  cursor: pointer;
  transition: background .16s ease, transform .12s ease, border-color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.live-icon-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .24); }
.live-icon-btn:active { transform: scale(.95); }
.live-icon-btn .ic { width: 20px; height: 20px; }

/* -------------------------------------------------------------------- main */
.live-main {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 12px 12px;
  gap: 10px;
}

.live-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(600px 340px at 50% 0%, rgba(46, 139, 255, .18), transparent 65%),
    #05080f;
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .5), 0 26px 60px rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-remote,
.live-local {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05080f;
  transition: opacity .3s ease;
}
.live-remote { opacity: 0; }
.live-local { display: none; }

.live-root[data-live-state="connecting"] .live-remote,
.live-root[data-live-state="active"] .live-remote { opacity: 1; }

/* Searching: full-bleed dimmed self preview under the radar. */
.live-root[data-local="on"][data-live-state="searching"] .live-local {
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  opacity: .26;
  filter: saturate(.7) blur(1px);
}

/* Connected: picture-in-picture self view. */
.live-root[data-live-state="connecting"] .live-local,
.live-root[data-live-state="active"] .live-local {
  display: block;
  inset: auto 14px 14px auto;
  width: 104px;
  height: 148px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
  transform: scaleX(-1);
  object-fit: cover;
  z-index: 4;
  cursor: pointer;
  opacity: 1;
  filter: none;
}
.live-root[data-mode="audio"] .live-remote,
.live-root[data-mode="audio"] .live-local { display: none; }
.live-root[data-mode="audio"] .live-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(320px 320px at 50% 45%, rgba(57, 208, 255, .22), transparent 70%),
    repeating-radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .05) 0 1px, transparent 1px 64px);
  pointer-events: none;
}

.live-root[data-live-state="active"] .live-stage,
.live-root[data-live-state="connecting"] .live-stage { border-color: rgba(57, 208, 255, .28); }

/* ------------------------------------------------------------------- views */
.live-view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 20px;
  text-align: center;
  z-index: 3;
}
.live-root[data-live-state="idle"] .live-view--idle,
.live-root[data-live-state="searching"] .live-view--searching,
.live-root[data-live-state="connecting"] .live-view--connecting,
.live-root[data-live-state="ended"] .live-view--ended,
.live-root[data-live-state="error"] .live-view--error { display: flex; }

.live-view__title {
  margin: 0;
  font-size: clamp(24px, 5.2vw, 40px);
  line-height: 1.06;
  font-weight: 850;
  letter-spacing: -.04em;
  color: #f4f8ff;
  text-wrap: balance;
}
.live-view__title span {
  background: linear-gradient(100deg, #39d0ff, #a8ff24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.live-view__title--sm { font-size: clamp(20px, 3.8vw, 27px); letter-spacing: -.03em; }
.live-view__text {
  margin: 0;
  max-width: 46ch;
  font-size: 13.5px;
  line-height: 1.55;
  color: #aebdd3;
}
.live-view__hint { margin: 0; font-size: 11.5px; color: #8ea1bb; }
.live-view__error-icon {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 90, 118, .16);
  border: 1px solid rgba(255, 90, 118, .38);
  color: #ff9aab;
  font-size: 26px;
}
.live-view__error-icon .ic { width: 26px; height: 26px; }

/* Idle orbit */
.live-orbit {
  position: relative;
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.live-orbit__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(57, 208, 255, .42);
  animation: liveRipple 3.6s ease-out infinite;
}
.live-orbit__ring--2 { animation-delay: 1.2s; }
.live-orbit__ring--3 { animation-delay: 2.4s; }
@keyframes liveRipple {
  0% { transform: scale(.62); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}
.live-orbit__core {
  width: 74px; height: 74px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, #2e8bff, #39d0ff 60%, #a8ff24);
  box-shadow: 0 16px 40px rgba(46, 139, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #04121f;
}
.live-orbit__core .ic { width: 30px; height: 30px; }

.live-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 4px;
}
.live-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  font-size: 11px;
  color: #9fb0c8;
}
.live-stat strong { font-size: 13px; font-weight: 800; color: #eaf2ff; font-variant-numeric: tabular-nums; }

/* Radar (searching) */
.live-radar {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1px solid rgba(57, 208, 255, .28);
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(57, 208, 255, .10), transparent 70%);
  overflow: hidden;
  margin-bottom: 4px;
}
.live-radar::before,
.live-radar::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(57, 208, 255, .18);
}
.live-radar::before { inset: 26px; }
.live-radar::after { inset: 56px; }
.live-radar__sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(57, 208, 255, .55), transparent 28%);
  animation: liveSweep 2.6s linear infinite;
  opacity: .85;
}
@keyframes liveSweep { to { transform: rotate(360deg); } }
.live-radar__dot {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #a8ff24;
  box-shadow: 0 0 12px rgba(168, 255, 36, .8);
  animation: liveBlink 2.4s ease-in-out infinite;
}
.live-radar__dot--1 { top: 30%; left: 26%; animation-delay: .2s; }
.live-radar__dot--2 { top: 62%; left: 68%; animation-delay: .9s; }
.live-radar__dot--3 { top: 24%; left: 70%; animation-delay: 1.5s; }
@keyframes liveBlink {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}
.live-radar__core {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #2e8bff, #39d0ff);
  color: #04121f;
  box-shadow: 0 10px 26px rgba(46, 139, 255, .45);
}
.live-radar__core .ic { width: 22px; height: 22px; }

.live-search-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.live-search-meta__item {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  font-size: 11.5px;
  color: #aebdd3;
}
.live-search-meta strong { color: #eaf2ff; font-variant-numeric: tabular-nums; }

/* Connecting spinner */
.live-spinner { position: relative; width: 76px; height: 76px; }
.live-spinner span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #39d0ff;
  animation: liveSpin 1.1s linear infinite;
}
.live-spinner span:nth-child(2) { inset: 10px; border-top-color: #a8ff24; animation-duration: 1.6s; animation-direction: reverse; }
.live-spinner span:nth-child(3) { inset: 20px; border-top-color: #2e8bff; animation-duration: 2.1s; }
@keyframes liveSpin { to { transform: rotate(360deg); } }

/* Ended summary */
.live-ended-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .18);
  background: linear-gradient(145deg, rgba(46, 139, 255, .45), rgba(57, 208, 255, .25));
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
}
.live-ended-avatar img { width: 100%; height: 100%; object-fit: cover; }
.live-ended-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* -------------------------------------------------------------------- dock */
.live-dock {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(11, 20, 34, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .35);
}
.live-dock[hidden] { display: none; }

.live-dock-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 84px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: #eaf2ff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .16s ease, transform .12s ease, border-color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.live-dock-btn .ic { width: 22px; height: 22px; }
.live-dock-btn:hover { background: rgba(255, 255, 255, .13); }
.live-dock-btn:active { transform: scale(.95); }
.live-dock-btn[aria-pressed="true"] {
  background: rgba(255, 90, 118, .20);
  border-color: rgba(255, 90, 118, .5);
  color: #ffd7de;
}
.live-dock-btn[aria-pressed="true"] .live-dock-btn__on { display: none; }
.live-dock-btn__off { display: none; }
.live-dock-btn[aria-pressed="true"] .live-dock-btn__off { display: block; }
.live-dock-btn__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dock-btn__badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #a8ff24;
  color: #102000;
  font-size: 9.5px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.live-dock-btn--end {
  background: linear-gradient(135deg, #ff5a76, #e11d48);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(225, 29, 72, .35);
}
.live-dock-btn--end:hover { background: linear-gradient(135deg, #ff6d86, #f01f4e); }

.live-root[data-mode="audio"] #liveCamBtn,
.live-root[data-mode="audio"] #liveFlipBtn { display: none; }

/* ------------------------------------------------------------- partner chip */
.live-partner-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(6, 12, 22, .62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
  max-width: min(420px, calc(100% - 24px));
}
.live-partner-chip[hidden] { display: none; }
.live-partner-chip__avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(46, 139, 255, .7), rgba(57, 208, 255, .5));
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}
.live-partner-chip__avatar img { width: 100%; height: 100%; object-fit: cover; }
.live-partner-chip__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.live-partner-chip__text strong { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-partner-chip__meta { font-size: 10.5px; color: #9fb0c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-partner-chip__timer {
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(168, 255, 36, .14);
  border: 1px solid rgba(168, 255, 36, .3);
  color: #d8ffab;
}
.live-partner-chip__status {
  font-size: 10px;
  color: #9fb0c8;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-partner-chip__status:empty { display: none; }

/* ----------------------------------------------------------------- buttons */
.live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #f2f6ff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .005em;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .16s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.live-btn:hover { background: rgba(255, 255, 255, .15); }
.live-btn:active { transform: scale(.98); }
.live-btn--hero {
  border-color: transparent;
  background: linear-gradient(120deg, #2e8bff, #1b6fe0 55%, #39d0ff);
  color: #fff;
  box-shadow: 0 16px 36px rgba(46, 139, 255, .38);
}
.live-btn--hero:hover { background: linear-gradient(120deg, #3f97ff, #2279ea 55%, #4ad6ff); }
.live-btn--ghost { background: rgba(255, 255, 255, .06); color: #dbe6f7; }
.live-btn--danger-ghost { background: rgba(255, 90, 118, .12); border-color: rgba(255, 90, 118, .38); color: #ffbdc8; }
.live-btn--compact { min-height: 44px; padding: 10px 16px; font-size: 13.5px; }
.live-btn--send {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 14px;
  border-color: transparent;
  background: linear-gradient(135deg, #2e8bff, #1b6fe0);
  color: #fff;
}
.live-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.live-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #ffbdc8;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.live-link-btn:hover { background: rgba(255, 90, 118, .12); }

/* -------------------------------------------------------------------- chat */
.live-chat {
  position: absolute;
  right: 16px;
  bottom: 92px;
  z-index: 8;
  width: min(360px, calc(100% - 24px));
  max-height: min(60%, 480px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(9, 16, 28, .94);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .55);
  overflow: hidden;
  animation: liveSheetUp .22s ease both;
}
.live-chat[hidden] { display: none; }
.live-chat__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}
.live-chat__title { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 750; }
.live-chat__title .ic { color: #39d0ff; }
.live-chat__sub { flex: 1 1 auto; min-width: 0; font-size: 11px; color: #9fb0c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-chat__messages {
  flex: 1 1 auto;
  min-height: 90px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.live-chat__msg {
  max-width: 86%;
  padding: 7px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .07);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.live-chat__msg--me {
  align-self: flex-end;
  background: linear-gradient(135deg, #2e8bff, #1b6fe0);
  border-color: transparent;
  color: #fff;
}
.live-chat__msg--system {
  align-self: center;
  background: transparent;
  border: 0;
  color: #8ea1bb;
  font-size: 11px;
  text-align: center;
  max-width: 100%;
}
.live-chat__msg--reaction { font-size: 22px; padding: 4px 10px; background: transparent; border: 0; }
.live-chat__typing { font-size: 11px; color: #8ea1bb; padding: 0 12px 4px; font-style: italic; }
.live-chat__quick {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  overflow-x: auto;
}
.live-chat__quick button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 19px;
  cursor: pointer;
  transition: background .14s ease, transform .12s ease;
}
.live-chat__quick button:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.live-chat__form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgba(255, 255, 255, .10); }
.live-chat__form input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #f2f6ff;
  font-size: 14px;
}
.live-chat__form input::placeholder { color: #8ea1bb; }
.live-chat__form input:focus { border-color: #39d0ff; box-shadow: 0 0 0 4px rgba(57, 208, 255, .18); outline: none; }
.live-chat__safety { padding: 2px 8px 8px; display: flex; justify-content: flex-end; }

/* ------------------------------------------------------------------- sheets */
.live-sheet {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.live-sheet[hidden] { display: none; }
.live-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, .66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: liveFadeIn .18s ease both;
}
.live-sheet__card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(88dvh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 26px 26px 0 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-bottom: 0;
  background: linear-gradient(180deg, #101c2e, #080f1b);
  color: #f2f6ff;
  box-shadow: 0 -30px 80px rgba(0, 0, 0, .55);
  animation: liveSheetUp .24s cubic-bezier(.2, .9, .3, 1) both;
  overflow: hidden;
}
@keyframes liveSheetUp {
  from { transform: translateY(22px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.live-sheet__grabber {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .22);
  margin: 8px auto 0;
  flex: 0 0 auto;
}
.live-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px 9px;
  flex: 0 0 auto;
}
.live-sheet__head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.025em; }
.live-sheet__body {
  padding: 4px 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}
.live-sheet__actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, .08);
  flex: 0 0 auto;
}
.live-sheet__actions .live-btn { flex: 1 1 auto; }

.live-field { display: flex; flex-direction: column; gap: 7px; border: 0; padding: 0; margin: 0; min-width: 0; }
.live-field legend,
.live-field > label,
.live-field__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #9fb0c8;
  padding: 0;
  margin: 0 0 1px;
}
.live-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #f2f6ff;
  font-family: inherit;
  font-size: 14px;
}
.live-field select:focus { border-color: #39d0ff; box-shadow: 0 0 0 4px rgba(57, 208, 255, .18); outline: none; }

.live-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
}
.live-segment button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #9fb0c8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.live-segment button[aria-checked="true"] {
  background: linear-gradient(135deg, #2e8bff, #1b6fe0);
  color: #fff;
  box-shadow: 0 8px 20px rgba(46, 139, 255, .3);
}
.live-segment .ic { width: 16px; height: 16px; }

.live-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.live-chips button {
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  color: #c9d6ea;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.live-chips button[aria-checked="true"] {
  background: rgba(168, 255, 36, .16);
  border-color: rgba(168, 255, 36, .45);
  color: #e6ffc4;
}
.live-range { display: flex; align-items: center; gap: 8px; }
.live-range select { flex: 1 1 0; }
.live-range__sep { font-size: 12px; color: #9fb0c8; }
.live-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(57, 208, 255, .22);
  background: rgba(57, 208, 255, .07);
  color: #b8c8dd;
  font-size: 11.5px;
  line-height: 1.5;
}
.live-note .ic { margin-top: 2px; color: #6fdcff; flex: 0 0 auto; }

.live-safety-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.live-safety-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: #b8c8dd; }
.live-safety-list strong { color: #f2f6ff; }
.live-safety-list__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(57, 208, 255, .28);
  background: rgba(57, 208, 255, .10);
  color: #7fdcff;
}
.live-check { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.45; color: #c9d6ea; cursor: pointer; }
.live-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  position: relative;
  margin: 0;
}
.live-check input:checked {
  background: linear-gradient(135deg, #a8ff24, #6fd400);
  border-color: transparent;
}
.live-check input:checked::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 7px;
  height: 12px;
  border: solid #0d2000;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(42deg);
}

/* -------------------------------------------------------------- toast/flash */
.live-toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 14px);
  z-index: 9600;
  max-width: min(420px, 88vw);
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(8, 15, 26, .96);
  color: #eaf2ff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.live-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.live-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(168, 255, 36, .45), transparent 60%);
}
.live-flash.is-on { animation: liveFlash .6s ease-out; }
@keyframes liveFlash {
  0% { opacity: .9; }
  100% { opacity: 0; }
}

/* ----------------------------------------------------------------- responsive */
@media (max-width: 920px) {
  .live-main { padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .live-stage { border-radius: 22px; }
  .live-view { padding: 18px 16px; gap: 10px; }
  .live-view__text { font-size: 12.5px; }
  .live-dock { gap: 5px; padding: 6px 6px; border-radius: 20px; }
  .live-dock-btn { min-height: 56px; border-radius: 14px; }
  .live-dock-btn .ic { width: 21px; height: 21px; }
  .live-chat {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(72%, 560px);
    border-radius: 22px;
  }
  .live-root[data-live-state="connecting"] .live-local,
  .live-root[data-live-state="active"] .live-local { width: 92px; height: 132px; border-radius: 16px; }
  .live-partner-chip { padding: 6px 9px; }
  .live-partner-chip__status { display: none; }
}

@media (max-width: 380px) {
  .live-dock-btn__label { font-size: 9px; }
  .live-dock-btn { min-height: 52px; }
  .live-view__title { font-size: 22px; }
  .live-orbit { width: 104px; height: 104px; }
  .live-orbit__core { width: 62px; height: 62px; }
  .live-radar { width: 140px; height: 140px; }
}

@media (min-width: 921px) {
  .live-main { align-items: center; }
  .live-stage { width: min(1080px, 100%); aspect-ratio: 16 / 10; flex: 0 1 auto; max-height: calc(100dvh - 210px); }
  .live-dock { width: min(560px, 100%); }
  .live-root[data-live-state="idle"] .live-stage { min-height: 420px; }
  .live-view--idle { padding: 28px 40px; }
  .live-chat { right: max(16px, calc(50% - 540px + 16px)); }
}

/* Landscape phones: keep the dock reachable without covering the video. */
@media (max-height: 520px) and (orientation: landscape) {
  .live-header { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .live-orbit { display: none; }
  .live-view--idle { gap: 8px; padding: 12px 18px; }
  .live-view__title { font-size: 21px; }
  .live-view__text { display: none; }
  .live-stats { margin: 0; }
  .live-dock { padding: 4px 6px; }
  .live-dock-btn { min-height: 46px; }
  .live-dock-btn__label { display: none; }
  .live-root[data-live-state="connecting"] .live-local,
  .live-root[data-live-state="active"] .live-local { width: 74px; height: 104px; }
}

/* Reduced motion: no sweeps, ripples or pulsing (still fully usable). */
@media (prefers-reduced-motion: reduce) {
  .live-aurora span,
  .live-title__dot,
  .live-orbit__ring,
  .live-radar__sweep,
  .live-radar__dot,
  .live-spinner span { animation: none !important; }
  .live-radar__sweep { opacity: .25; }
  .live-flash.is-on { animation: none !important; opacity: 0; }
}

/* Very high contrast preference. */
@media (prefers-contrast: more) {
  .live-view__text,
  .live-stat,
  .live-partner-chip__meta,
  .live-dock-btn__label { color: #e8f0ff; }
  .live-dock-btn,
  .live-icon-btn,
  .live-btn { border-width: 2px; }
}

@media (forced-colors: active) {
  .live-root { background: Canvas; color: CanvasText; }
  .live-stage { border: 2px solid CanvasText; }
  .live-dock-btn, .live-icon-btn, .live-btn { border: 1px solid ButtonBorder; }
}
