/* Kiki Cast text-chat panel — soft Kiki Nation neon
   Phase-1: replaces Vapi Call UI for kiki-baby only. No secrets. */

:root {
  --cast-bg: rgba(8, 0, 18, 0.94);
  --cast-panel: rgba(18, 4, 36, 0.98);
  --cast-rose: #ff1493;
  --cast-pink: #ff69b4;
  --cast-violet: #bf00ff;
  --cast-cyan: #7ef9ff;
  --cast-text: rgba(255, 255, 255, 0.92);
  --cast-muted: rgba(255, 255, 255, 0.55);
  --cast-border: rgba(255, 20, 147, 0.35);
  --cast-glow: 0 0 28px rgba(255, 20, 147, 0.45);
  --cast-font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#cast-chat-root {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

#cast-chat-root.is-open {
  display: flex;
  pointer-events: auto;
}

.cast-chat-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(191, 0, 255, 0.18), rgba(0, 0, 0, 0.72));
  backdrop-filter: blur(4px);
}

.cast-chat-panel {
  position: relative;
  width: min(440px, calc(100vw - 24px));
  max-height: min(72vh, 640px);
  margin: 0 12px 18px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--cast-panel), rgba(6, 0, 14, 0.98));
  border: 1px solid var(--cast-border);
  border-radius: 18px;
  box-shadow: var(--cast-glow), 0 16px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: var(--cast-font);
  color: var(--cast-text);
}

.cast-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 20, 147, 0.22);
  background: linear-gradient(90deg, rgba(255, 20, 147, 0.12), rgba(191, 0, 255, 0.08));
}

.cast-chat-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cast-chat-title strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--cast-pink), var(--cast-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cast-chat-title span {
  font-size: 0.75rem;
  color: var(--cast-muted);
}

.cast-chat-close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cast-text);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.cast-chat-close:hover {
  border-color: var(--cast-rose);
  box-shadow: 0 0 12px rgba(255, 20, 147, 0.4);
}

.cast-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cast-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.cast-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.28), rgba(191, 0, 255, 0.2));
  border: 1px solid rgba(255, 20, 147, 0.35);
  border-bottom-right-radius: 4px;
}

.cast-msg-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(126, 249, 255, 0.22);
  border-bottom-left-radius: 4px;
}

.cast-msg-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--cast-muted);
}

.cast-chat-status {
  min-height: 1.2em;
  padding: 0 16px 4px;
  font-size: 0.75rem;
  color: var(--cast-cyan);
  opacity: 0.9;
}

.cast-chat-composer {
  display: flex;
  gap: 8px;
  padding: 12px 12px 14px;
  border-top: 1px solid rgba(255, 20, 147, 0.18);
  background: rgba(0, 0, 0, 0.25);
}

.cast-chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cast-text);
  font: inherit;
  outline: none;
}

.cast-chat-input:focus {
  border-color: var(--cast-pink);
  box-shadow: 0 0 0 2px rgba(255, 20, 147, 0.2);
}

.cast-chat-send {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 650;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--cast-rose), var(--cast-violet));
  box-shadow: 0 0 16px rgba(255, 20, 147, 0.35);
}

.cast-chat-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(255, 20, 147, 0.55);
}

.cast-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cast-gate {
  position: relative;
  margin: auto;
  width: min(380px, calc(100vw - 32px));
  padding: 24px 22px;
  border-radius: 18px;
  background: var(--cast-panel);
  border: 1px solid var(--cast-border);
  box-shadow: var(--cast-glow);
  text-align: center;
  z-index: 1;
}

.cast-gate h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--cast-pink);
}

.cast-gate p {
  margin: 0 0 18px;
  color: var(--cast-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.cast-gate-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.cast-gate-btn {
  appearance: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid transparent;
}

.cast-gate-yes {
  color: #fff;
  background: linear-gradient(135deg, var(--cast-rose), var(--cast-violet));
}

.cast-gate-no {
  color: var(--cast-text);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 480px) {
  .cast-chat-panel {
    width: 100%;
    margin: 0;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
  }
}

/* Roster card status chip (filled by cast-chat.js decorate) */
.video-card .vc-status .cast-live-badge {
  margin-left: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.video-card .cast-next-label {
  width: 100%;
  margin-top: 6px;
  font-size: 0.68rem;
}


/* Tip button (Phase B economy) */
.cast-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cast-tip-btn {
  appearance: none;
  border: 1px solid rgba(126, 249, 255, 0.35);
  background: rgba(126, 249, 255, 0.1);
  color: #7ef9ff;
  border-radius: 999px;
  padding: 7px 12px;
  font: 600 0.78rem/1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.cast-tip-btn:hover { background: rgba(126, 249, 255, 0.2); }
