/* ── Live action bar ── */
.live-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.live-bar .live-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.live-bar .live-btn:active { transform: scale(0.97); }

.live-bar .live-btn-primary {
  background: linear-gradient(135deg, var(--of-blue), #0088cc);
  color: #fff;
}

.live-bar .live-btn-primary:hover {
  box-shadow: 0 12px 36px rgba(0, 175, 240, 0.35);
}

.live-bar .live-btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}

.live-bar .live-btn-secondary:hover {
  border-color: var(--of-blue);
  color: var(--of-blue);
}

.live-bar .live-btn-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ── Feature modals base ── */
.feature-modal {
  max-width: 520px;
  width: 100%;
  text-align: left;
}

.feature-modal--pick {
  max-width: min(94vw, 640px);
  padding: 0;
  overflow: hidden;
}

.feature-modal--pick .pick-head {
  padding: 28px 28px 16px;
  border-bottom: 1px solid var(--border);
}

.feature-modal--pick .pick-head h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.feature-modal--pick .pick-body {
  padding: 20px 24px 24px;
}

.feature-modal--pick .pick-foot {
  padding: 0 24px 24px;
}

/* Model picker grid */
.chat-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: 4px 2px;
}

.chat-model-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.chat-model-card:hover {
  border-color: var(--of-blue);
  box-shadow: 0 8px 24px rgba(0, 175, 240, 0.12);
  transform: translateY(-2px);
}

.chat-model-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #e8f7fd;
}

.chat-model-card strong {
  font-size: 0.92rem;
  display: block;
}

.chat-model-card .online {
  color: #22c55e;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Chat messenger ── */
.feature-modal--chat {
  max-width: min(96vw, 580px);
  width: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(88vh, 760px);
  border-radius: 20px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #0f0e14, #1a1824);
  color: #fff;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-info strong {
  display: block;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status {
  font-size: 0.78rem;
  color: #4ade80;
  font-weight: 600;
}

.chat-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-close:hover { background: rgba(255, 255, 255, 0.2); }

.chat-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  background: linear-gradient(180deg, #f0f2f5 0%, #e8eaef 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.45;
  animation: chatIn 0.25s ease;
}

@keyframes chatIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.them {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, #00aff0, #0091d9);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 175, 240, 0.25);
}

.chat-msg .msg-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: 0.75;
}

.chat-msg.typing {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 14px 18px;
}

.chat-msg-actions {
  margin-top: 10px;
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--of-blue), #0088cc);
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}

.chat-action-btn:hover {
  transform: scale(1.03);
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  min-height: 280px;
}

.chat-empty-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 14px;
  border: 2px solid #e8f7fd;
}

.chat-empty-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-empty-state strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 6px;
}

.chat-empty-state p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-row input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-row input:focus {
  border-color: var(--of-blue);
  box-shadow: 0 0 0 3px rgba(0, 175, 240, 0.12);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--of-blue), #0088cc);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.chat-send-btn:hover { transform: scale(1.05); }
.chat-send-btn svg { width: 20px; height: 20px; }

/* ── Video call (immersive) ── */
.modal-overlay.immersive {
  padding: 16px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}

.modal-overlay.immersive .modal-wrap {
  width: 100%;
  max-width: min(96vw, 1320px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-modal--video {
  max-width: 100%;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
  background: #0a0a0f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.video-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(15, 14, 20, 0.95), rgba(15, 14, 20, 0.7));
  color: #fff;
  flex-shrink: 0;
}

.video-topbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.video-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.video-topbar-info strong {
  display: block;
  font-size: 1.1rem;
}

.video-topbar-info span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

.video-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.video-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.video-icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.btn-end-call {
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-end-call:hover { background: #dc2626; }

.video-shell {
  position: relative;
  width: 100%;
  height: min(78vh, 820px);
  background: #000;
}

.video-wrap {
  width: 100%;
  height: 100%;
  background: #000;
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-prejoin {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(99, 102, 241, 0.18), transparent 55%),
    linear-gradient(180deg, #12121a 0%, #0a0a0f 100%);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.video-prejoin.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.video-prejoin-inner {
  text-align: center;
  padding: 32px 24px;
  max-width: 360px;
}

.video-prejoin-avatar-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 20px;
}

.video-prejoin-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.video-prejoin-live {
  position: absolute;
  right: 6px;
  bottom: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #22c55e;
  border: 3px solid #12121a;
}

.video-prejoin-title {
  margin: 0 0 8px;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
}

.video-prejoin-sub {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.92rem;
  line-height: 1.5;
}

.btn-join-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 200px;
  padding: 16px 32px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-join-call:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.55);
}

.video-prejoin-hint {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.78rem;
}

.modal-overlay--top {
  z-index: 260;
}

.ext-help-modal {
  max-width: 480px;
  padding: 28px 28px 24px;
}

.ext-help-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.ext-help-lead {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

.ext-help-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  text-align: left;
}

.ext-help-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg, #f8f9fc);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ext-help-step--todo {
  border-style: dashed;
  opacity: 0.85;
}

.ext-help-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--of-blue, #00aff0);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ext-help-step p {
  margin: 2px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.ext-help-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ext-help-actions .btn {
  width: 100%;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 8px;
}

.btn-ghost:hover {
  color: var(--text);
}

/* Extension gate */
.ext-gate {
  text-align: center;
  padding: 8px 0;
}

.ext-gate p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

.ext-gate .btn { margin: 6px; }

/* Payments */
.pay-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.pay-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--of-blue);
  margin: 16px 0;
}

.pay-address {
  background: #f5f5f7;
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
}

.pay-address code {
  display: block;
  word-break: break-all;
  margin: 8px 0;
  font-size: 0.85rem;
}

.pay-note { font-size: 0.85rem; color: var(--muted); }

.pay-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.engagement-hint {
  display: none;
  position: fixed;
  bottom: 148px;
  right: 20px;
  left: auto;
  top: auto;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(201, 164, 92, 0.92), rgba(166, 124, 58, 0.92));
  backdrop-filter: blur(8px);
  color: #1a1408;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.76rem;
  z-index: 75;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(201, 164, 92, 0.22);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.2s;
  pointer-events: none;
}

.engagement-hint.show {
  display: flex;
  pointer-events: auto;
  opacity: 0.88;
  transform: translateY(0);
  animation: offerDrift 50s ease-in-out infinite;
}

.engagement-hint.show:hover {
  opacity: 1;
  animation-play-state: paused;
  box-shadow: 0 6px 20px rgba(201, 164, 92, 0.35);
}

.engagement-hint.is-hidden {
  display: none !important;
}

.engagement-hint-text {
  padding-right: 2px;
}

.engagement-hint-close {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  color: #1a1408;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  opacity: 0.7;
}

.engagement-hint-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.18);
}

@keyframes offerDrift {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(-10px, -14px); }
  66%      { transform: translate(6px, -6px); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .engagement-hint {
    bottom: 130px;
    right: 12px;
    font-size: 0.72rem;
    max-width: calc(100vw - 24px);
  }

  .engagement-hint.show {
    animation-duration: 45s;
  }

  .live-bar {
    bottom: 16px;
    right: 16px;
    left: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }

  .live-bar .live-btn {
    padding: 12px 16px;
    font-size: 0.82rem;
  }

  .feature-modal--chat {
    height: min(92vh, 100dvh);
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .modal-overlay:not(.immersive) {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay:not(.immersive) .modal-wrap {
    width: 100%;
  }

  .feature-modal--pick {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .chat-models-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 55vh;
  }

  .modal-overlay.immersive {
    padding: 0;
    align-items: stretch;
  }

  .modal-overlay.immersive .modal-wrap {
    max-width: 100%;
    height: 100%;
  }

  .feature-modal--video {
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .video-shell {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  .video-topbar {
    padding: 12px 14px;
  }

  .video-topbar-info strong { font-size: 0.95rem; }

  .btn-end-call {
    padding: 10px 16px;
    font-size: 0.82rem;
  }
}

@media (max-width: 500px) {
  .live-bar .live-btn span.live-btn-label { display: none; }
  .live-bar .live-btn { padding: 14px; border-radius: 50%; width: 52px; height: 52px; justify-content: center; }
  .chat-models-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .chat-model-card img { width: 56px; height: 56px; }
}
