/* ═══════════════════════════════════════════════════════════════
   Mulle.live — Main Stylesheet
   RTL / Persian / Vazirmatn
═══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0a0a0f;
  --bg2:       #12121a;
  --bg3:       #1a1a26;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.14);
  --text:      #f0f0f8;
  --text2:     #9090b0;
  --text3:     #5a5a7a;
  --primary:   #6366f1;
  --primary2:  #7c3aed;
  --accent:    #a855f7;
  --success:   #10b981;
  --danger:    #ef4444;
  --warn:      #f59e0b;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --font:      'Vazirmatn', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ────────────────────────────────────────────────── */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(7, 10, 16, 0.84);
  backdrop-filter: blur(20px);
}

.auth-gate.open { display: flex; }

.auth-card {
  width: min(100%, 420px);
  padding: 1.6rem;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    radial-gradient(circle at top right, rgba(99,102,241,0.2), transparent 35%),
    radial-gradient(circle at bottom left, rgba(16,185,129,0.18), transparent 30%),
    rgba(18,18,26,0.96);
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
}

.auth-badge {
  display: inline-flex;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: var(--text2);
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
}

.auth-card h2 {
  font-size: 1.45rem;
  margin-bottom: 0.55rem;
}

.auth-sub,
.auth-status {
  color: var(--text2);
  line-height: 1.7;
}

.auth-actions {
  display: grid;
  gap: 0.75rem;
  margin: 1.25rem 0 0.9rem;
}

.btn-google,
.btn-guest-entry {
  width: 100%;
}

.btn-google {
  background: #fff;
  color: #151515;
}

.btn-google:hover { background: #f1f5f9; }

.btn-guest-entry {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
}

.btn-guest-entry:hover { background: rgba(255,255,255,0.1); }

.session-pill {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.24);
  color: #b7f7d8;
  font-size: 0.82rem;
}

.screen { display: none; width: 100%; min-height: 100dvh; }
.screen.active {
  display: flex;
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  max-height: 100svh;
  overflow: hidden;
}

/* ═══════════════ SPLASH ════════════════════════════════════ */
#splash {
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
}

.splash-bg { position: absolute; inset: 0; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.orb-1 { width: 400px; height: 400px; background: var(--primary); top: -120px; right: -120px; }
.orb-2 { width: 300px; height: 300px; background: var(--accent); bottom: -80px; left: -80px; }
.orb-3 { width: 250px; height: 250px; background: var(--primary2); top: 50%; left: 50%; transform: translate(-50%,-50%); }

.splash-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.logo-text {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-dot { color: var(--primary); }

.splash-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.splash-sub {
  font-size: 1rem;
  color: var(--text2);
  font-weight: 400;
}

/* Mic check */
.mic-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.9rem;
  color: var(--text2);
  transition: all 0.3s ease;
}
.mic-check.ok { border-color: var(--success); color: var(--success); }
.mic-check.error { border-color: var(--danger); color: var(--danger); }
.mic-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.75rem;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  width: 100%;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(99,102,241,0.5); }

.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  width: 100%;
}
.btn-ghost:hover { background: var(--bg2); color: var(--text); }

.btn-outline {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-icon {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { background: var(--bg3); color: var(--text); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.terms {
  font-size: 0.78rem;
  color: var(--text3);
}
.terms a { color: var(--primary); text-decoration: none; }

.home-footer-pages {
  width: 100%;
  display: grid;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.footer-pages-label {
  font-size: 0.78rem;
  color: var(--text3);
}

.footer-pages-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  min-height: 20px;
}

.footer-pages-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.footer-pages-links a:hover {
  color: var(--text);
  border-color: rgba(99,102,241,0.35);
  background: rgba(99,102,241,0.12);
}

/* ═══════════════ CHAT SCREEN ═══════════════════════════════ */
#chatScreen {
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  height: 100dvh;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.user-chip-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.user-chip-text strong {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-text span {
  font-size: 0.72rem;
  color: var(--text2);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--text2);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-badge.searching .status-dot { background: var(--warn); animation: pulse 1.4s infinite; }
.status-badge.connected .status-dot { background: var(--success); }
.status-badge.disconnected .status-dot { background: var(--danger); }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Audio area */
.audio-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  flex-shrink: 0;
}

.avatar-pair {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 380px;
  justify-content: space-between;
}

.avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.avatar span { font-size: 0.8rem; color: var(--text2); }

.avatar-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  transition: all 0.3s;
  position: relative;
}
.avatar-ring.speaking {
  border-color: var(--success);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.2), 0 0 0 8px rgba(16,185,129,0.1);
}
.avatar.me .avatar-ring { color: var(--primary); border-color: rgba(99,102,241,0.4); }

.connection-line {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wave-dots {
  display: flex;
  gap: 5px;
}
.wave-dots span {
  width: 7px; height: 7px;
  background: var(--border2);
  border-radius: 50%;
  transition: background 0.3s;
}
.wave-dots.active span {
  background: var(--success);
  animation: wave 1.2s ease-in-out infinite;
}
.wave-dots.active span:nth-child(1) { animation-delay: 0s; }
.wave-dots.active span:nth-child(2) { animation-delay: 0.15s; }
.wave-dots.active span:nth-child(3) { animation-delay: 0.3s; }
.wave-dots.active span:nth-child(4) { animation-delay: 0.45s; }
.wave-dots.active span:nth-child(5) { animation-delay: 0.6s; }
@keyframes wave {
  0%,100% { transform: scaleY(1); }
  50% { transform: scaleY(1.8); }
}

/* Action bar */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.25rem 1rem;
  flex-shrink: 0;
}
.action-row {
  display: flex;
  gap: 0.6rem;
}
.action-row .btn { flex: 1; padding: 0.7rem 0.5rem; font-size: 0.85rem; }
.action-row-bottom .btn { padding: 0.65rem 0.5rem; font-size: 0.82rem; }

/* Video button active state */
#btnVideo.active,
.btn-video-chat.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

/* Text chat */
.text-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  overflow: hidden;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.msg-hint {
  text-align: center;
  color: var(--text3);
  font-size: 0.82rem;
  margin: auto;
}

.message {
  max-width: 75%;
  padding: 0.6rem 0.9rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}
.message.me {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  align-self: flex-end;
  border-bottom-left-radius: 4px;
}
.message.partner {
  background: var(--bg3);
  color: var(--text);
  align-self: flex-start;
  border-bottom-right-radius: 4px;
}

.message.system {
  background: transparent;
  color: var(--text3);
  font-size: 0.78rem;
  text-align: center;
  align-self: center;
  padding: 0.3rem 0.6rem;
  max-width: 100%;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-row input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  border-radius: 50px;
  outline: none;
  direction: rtl;
  transition: border-color 0.2s;
}
.input-row input::placeholder { color: var(--text3); }
.input-row input:focus { border-color: var(--primary); }

.btn-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.btn-send:hover { transform: scale(1.08); }
.btn-send:active { transform: scale(0.95); }

/* ═══════════════ GAME SCREEN ═══════════════════════════════ */
#gameScreen { flex-direction: column; }
.game-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  background: #141210;
  position: relative;
  overflow: hidden;
  /* iOS safe area */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #1C1A17;
  border-bottom: 1px solid #3A3020;
  flex-shrink: 0;
  min-height: 44px;
}

.game-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.game-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #C4A44A;
  letter-spacing: 0.03em;
}

.turn-indicator {
  font-size: 0.7rem;
  font-weight: 600;
  color: #888;
  transition: color 0.3s;
}

.board-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #141210;
  overflow: hidden;
  min-height: 0;
  position: relative; /* لازم است تا pip-item ها نسبت به این المان position بگیرند */
}

#backgammonCanvas {
  /* اندازه canvas توسط JS تنظیم می‌شود — فقط max را محدود می‌کنیم */
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  touch-action: none;
  box-shadow: 0 6px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(139,105,20,0.35);
}

.game-controls-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #1C1A17;
  border-top: 1px solid #3A3020;
  flex-shrink: 0;
  min-height: 48px;
  max-height: 64px;
  box-sizing: border-box;
}

.game-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-roll {
  min-width: 110px;
  background: linear-gradient(135deg, #8B6914, #C4A44A) !important;
  color: #1A1510 !important;
  font-weight: 800 !important;
  font-size: 0.82rem !important;
  padding: 0.5rem 0.9rem !important;
  border-radius: 8px !important;
  border: none !important;
  transition: all 0.2s !important;
  box-shadow: 0 2px 12px rgba(196,164,74,0.25);
  white-space: nowrap;
}
.btn-roll:disabled {
  background: #2A2520 !important;
  color: #5A5040 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
}
.btn-roll:not(:disabled):active {
  transform: scale(0.97);
}
.btn-roll:not(:disabled):hover {
  box-shadow: 0 4px 16px rgba(196,164,74,0.4) !important;
}

.btn-undo {
  background: #2A2520 !important;
  color: #F2ECD8 !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px !important;
  border: 1.5px solid #8B6914 !important;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s !important;
  animation: undo-appear 0.25s ease;
}
.btn-undo:hover {
  background: #3A3020 !important;
  border-color: #C4A44A !important;
  color: #FFE580 !important;
}
.btn-undo:active {
  transform: scale(0.97);
}
@keyframes undo-appear {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@media (max-width: 480px) {
  .btn-undo { font-size: 0.75rem !important; padding: 0.4rem 0.6rem !important; }
}

.game-log-mini {
  flex: 1;
  overflow: hidden;
  font-size: 0.72rem;
  color: #8A7A5A;
  direction: rtl;
  line-height: 1.4;
  max-height: 2.4rem;
  overflow-y: auto;
  scrollbar-width: none;
}
.game-log-mini > div {
  padding: 1px 0;
}

@media (max-width: 480px) {
  .game-header { padding: 0.4rem 0.6rem; }
  .game-controls-row {
    padding: 0.4rem 0.6rem;
    gap: 0.4rem;
    max-height: none;
  }
  .game-actions-stack { gap: 0.3rem; }
  .btn-roll { min-width: 95px; font-size: 0.78rem !important; padding: 0.45rem 0.7rem !important; }
  .btn-undo {
    align-items: center;
    justify-content: center;
    min-width: 95px;
    font-size: 0.75rem !important;
    padding: 0.4rem 0.6rem !important;
  }
  .game-log-mini {
    font-size: 0.68rem;
    max-height: 2rem;
  }
}

/* ═══════════════ MODALS ════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.modal-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal p { color: var(--text2); font-size: 0.9rem; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; }
.modal-actions .btn { flex: 1; }
.modal-close { margin-top: 0.75rem; }

.invite-link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.invite-link-box input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
  direction: ltr;
  text-align: left;
}
.btn-copy {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-copy:hover { background: var(--accent); }
.invite-note { font-size: 0.78rem; color: var(--text3); }

/* ═══════════════ TOASTS ════════════════════════════════════ */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-size: 0.88rem;
  color: var(--text);
  direction: rtl;
  pointer-events: all;
  max-width: 280px;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger);  }
.toast.info    { border-color: var(--primary);  }
.toast-rotate {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-left: 0.7rem;
}
.toast-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.toast-close:hover { color: var(--text); }
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0)    scale(1);    }
  to   { opacity: 0; transform: translateX(110%) scale(0.88); }
}

/* ═══════════════ RESPONSIVE ════════════════════════════════ */
@media (max-width: 480px) {
  .splash-title { font-size: 1.6rem; }
  .btn-lg { font-size: 1rem; }
  .chat-header {
    padding: 0.8rem;
    gap: 0.5rem;
  }
  .chat-identity {
    gap: 0.45rem;
    min-width: 0;
  }
  .logo-small span {
    display: none;
  }
  .user-chip {
    padding: 0.25rem 0.45rem;
  }
  .user-chip-avatar {
    width: 30px;
    height: 30px;
  }
  .user-chip-text strong {
    max-width: 86px;
  }
  .action-row .btn { font-size: 0.78rem; padding: 0.65rem 0.3rem; }
  .action-row .btn svg { flex-shrink: 0; }
  .avatar-ring { width: 60px; height: 60px; }
  .modal { padding: 1.5rem; }

  /* FIX: chat screen mobile - prevent keyboard from hiding input */
  #chatScreen {
    height: 100%;
    height: -webkit-fill-available;
  }
  .chat-layout {
    height: 100%;
    height: -webkit-fill-available;
  }
  .text-chat {
    /* Allow flex shrink so input stays visible when keyboard opens */
    flex: 1;
    min-height: 0;
  }
  .messages {
    /* Messages area shrinks when keyboard opens */
    flex: 1;
    min-height: 80px;
  }
  .input-row {
    /* Keep input pinned above keyboard */
    position: sticky;
    bottom: 0;
    bottom: env(safe-area-inset-bottom, 0);
    background: var(--bg);
    z-index: 10;
  }
  .input-row input {
    font-size: 16px; /* Prevent iOS auto-zoom on focus */
  }

  /* FIX: audio area smaller on mobile to give more room to chat */
  .audio-area {
    padding: 1rem 1.5rem;
  }

  /* FIX: action bar slightly more compact on mobile */
  .action-bar {
    padding: 0 0.75rem 0.75rem;
  }
}

@media (min-width: 600px) {
  #chatScreen, #gameScreen {
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
  }
}

/* ══════════════════════════════════════════════════════════════
   VIDEO CHAT
══════════════════════════════════════════════════════════════ */

.video-area {
  width: 100%;
  background: #000;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin: 0 0 8px 0;
  aspect-ratio: 16/9;
  max-height: 280px;
  flex-shrink: 0;
}

.video-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111;
  border-radius: 12px;
}

.pip-wrap {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
  transform-origin: bottom left;
  display: inline-block;
  user-select: none;
}
.local-video-pip {
  display: block;
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.25);
  background: #222;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.pip-resize-handle {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
  pointer-events: all;
  z-index: 50;
  opacity: 0.55;
  transition: opacity 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M2 12L12 2M6 12L12 6M10 12L12 10' stroke='white' stroke-width='1.5' stroke-linecap='round' opacity='0.9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.pip-resize-handle:hover,
.pip-resize-handle:active { opacity: 1; }

.btn-stop-video {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s;
}

.btn-stop-video:hover {
  background: rgba(239, 68, 68, 1);
}

/* Active state for video button */
#btnVideo.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

/* Compact chat layout when video is showing (non-call-mode) */
.chat-layout:not(.call-mode):has(#videoArea[style*="block"]) .audio-area {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   CALL MODE — فول‌اسکرین مثل گوگل میت
══════════════════════════════════════════════════════════════ */
.call-mode {
  position: fixed !important;
  inset: 0 !important;
  z-index: 500 !important;
  width: 100% !important;
  max-width: none !important;
  background: #000 !important;
}

/* ویدئو فول‌اسکرین */
.call-mode #videoArea {
  position: absolute !important;
  inset: 0 !important;
  max-height: none !important;
  aspect-ratio: unset !important;
  height: 100% !important;
  border-radius: 0;
}
.call-mode .video-wrapper { border-radius: 0; }
.call-mode #remoteVideo   { border-radius: 0; object-fit: cover; }
.call-mode .btn-stop-video { display: none !important; }

/* ویدئو لوکال — گوشه بالا-راست */
.call-mode .pip-wrap {
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 92px);
  left: 12px;
  top: auto;
  right: auto;
  transform-origin: bottom left;
}

@media (max-width: 899px) {
  .call-mode .pip-wrap {
    top: max(60px, env(safe-area-inset-top, 60px));
    bottom: auto;
    right: 12px;
    left: auto;
    transform-origin: top right;
  }
}

@media (min-width: 900px) {
  .call-mode .pip-wrap {
    left: 24px;
    bottom: 116px;
  }

  .call-mode .local-video-pip {
    width: 220px;
    height: 165px;
  }
}

/* هدر — overlay شفاف */
.call-mode .chat-header {
  position: absolute !important;
  top: 0; left: 0; right: 0;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%) !important;
  border-bottom: none !important;
  padding-top: max(1rem, env(safe-area-inset-top));
}

/* اودیو و حالت معمول — پنهان در call-mode */
.call-mode .audio-area { display: none !important; }

/* دکمه‌های کنترل — overlay پایین */
.call-mode .action-bar {
  position: absolute !important;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  padding: 0.6rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  flex-direction: column;
  gap: 0.5rem;
}
.call-mode .action-row .btn {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.13);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
  border-radius: 50px;
}
.call-mode .action-row .btn:hover,
.call-mode .action-row .btn:active {
  background: rgba(255,255,255,0.24);
}
.call-mode #btnSkip {
  background: rgba(239,68,68,0.75);
  border-color: transparent;
}
.call-mode #btnSkip:hover { background: rgba(239,68,68,0.95); }
.call-mode #btnVideo.active,
.call-mode .btn-video-chat.active {
  background: rgba(239,68,68,0.75);
  border-color: transparent;
  color: #fff;
}
.call-mode #btnToggleChat.chat-is-open {
  background: rgba(99,102,241,0.7);
  border-color: transparent;
}

/* پنل چت — از پایین اسلاید می‌شه */
.call-mode .text-chat {
  position: absolute !important;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  height: 55%;
  max-height: 55%;
  flex: none !important;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(10,10,18,0.93);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255,255,255,0.14);
  border-left: none;
  overflow: hidden;
}
.call-mode .text-chat.chat-open {
  transform: translateY(0);
}

/* هدر پنل چت */
.chat-panel-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem 0.6rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.call-mode .chat-panel-header { display: flex; }
.chat-panel-title { font-size: 0.9rem; font-weight: 600; color: var(--text2); }

/* نقطه خوانده‌نشده */
.chat-unread-dot {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: none;
  box-shadow: 0 0 6px rgba(239,68,68,0.7);
}
#btnToggleChat { position: relative; }
#btnToggleChat.has-unread .chat-unread-dot { display: block; }

/* ══════════════════════════════════════════════════════════════
   GAME PIP VIDEO — ویدئو کوچک روی تخته بازی (جداگانه، قابل تغییر اندازه)
   board-container دارد position:relative است — پس این پیپ‌ها نسبت به تخته قرار می‌گیرند
══════════════════════════════════════════════════════════════ */

.game-pip-item {
  position: absolute;
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform-origin: bottom left;
  pointer-events: none;        /* کانتینر کلیک‌ناپذیر — فقط دکمه‌ها و handle فعالند */
  border-radius: 8px;
  overflow: visible;
}

/* وب‌کم حریف — پایین چپ تخته */
#gamePipRemoteWrap {
  bottom: 10px;
  left: 10px;
}

/* وب‌کم شما — کنار حریف */
.game-pip-local-pos {
  bottom: 10px;
  left: 140px;
}

/* ویدئوهای داخل هر pip */
.game-pip-item video {
  width:  120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  background: #111;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  display: block;
  pointer-events: all;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.game-pip-item video:active { cursor: grabbing; }

#gamePipLocalWrap video {
  width:  100px;
  height: 75px;
  border-color: rgba(99,102,241,0.7);
  opacity: 0.9;
}

/* دکمه بستن (✕) هر وب‌کم */
.pip-close-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  z-index: 10;
  padding: 0;
  transition: background 0.15s;
}
.pip-close-btn:hover,
.pip-close-btn:active { background: rgba(220,50,50,0.9); }

/* برچسب نام (حریف / شما) */
.pip-label-tag {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  font-family: inherit;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  padding: 1px 4px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* دکمه‌های بازیابی در هدر */
.pip-cam-restore { opacity: 0.7; position: relative; }
.pip-cam-restore::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background: #4ADE80;
  border-radius: 50%;
  border: 1px solid #141210;
}
.pip-cam-restore:hover { opacity: 1; }

/* ── فول‌اسکرین: پیپ‌ها بزرگ‌تر ── */
#gameScreen:fullscreen .game-pip-item video,
#gameScreen:-webkit-full-screen .game-pip-item video {
  width:  180px;
  height: 135px;
}
#gameScreen:fullscreen #gamePipLocalWrap video,
#gameScreen:-webkit-full-screen #gamePipLocalWrap video {
  width:  140px;
  height: 105px;
}
#gameScreen:fullscreen .game-pip-local-pos,
#gameScreen:-webkit-full-screen .game-pip-local-pos {
  left: 200px;
}

/* ── موبایل: پیپ‌های کوچک‌تر ── */
@media (max-width: 480px) {
  .game-pip-item video { width: 80px; height: 60px; }
  #gamePipLocalWrap video { width: 64px; height: 48px; }
  .game-pip-local-pos { left: 104px; }
}

/* ══════════════════════════════════════════════════════════════
   FULLSCREEN GAME
══════════════════════════════════════════════════════════════ */

#gameScreen:fullscreen,
#gameScreen:-webkit-full-screen,
#gameScreen:-moz-full-screen,
#gameScreen:-ms-fullscreen {
  background: #141210;
  overflow: hidden;
}

#gameScreen:fullscreen .game-layout,
#gameScreen:-webkit-full-screen .game-layout {
  height: 100vh;
  max-width: 100vw;
}

#gameScreen:fullscreen .board-container,
#gameScreen:-webkit-full-screen .board-container {
  overflow: hidden;
  flex: 1;
}

#gameScreen:fullscreen #backgammonCanvas,
#gameScreen:-webkit-full-screen #backgammonCanvas {
  max-width: 100%;
  max-height: 100%;
}

/* دکمه fullscreen active state */
#btnFullscreen.active {
  background: var(--bg3);
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE FULLSCREEN SCROLL — landscape rotate
══════════════════════════════════════════════════════════════ */

@media (orientation: landscape) and (max-height: 500px) {
  /* ── Game screen landscape — تمام صفحه ── */
  #gameScreen.active {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    min-height: unset;
    z-index: 100;
  }
  .game-layout {
    height: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  .board-container {
    flex: 1;
    overflow: hidden;
    padding: 2px;
    min-height: 0;
  }
  .game-header { min-height: 36px; padding: 0.2rem 0.5rem; }
  .game-controls-row { min-height: 40px; padding: 0.2rem 0.5rem; }
  .btn-roll { font-size: 0.78rem !important; padding: 0.3rem 0.6rem !important; }

  /* ── Chat screen landscape — shrink audio area to preserve input visibility ── */
  #chatScreen,
  .chat-layout {
    height: 100dvh;
    height: -webkit-fill-available;
  }
  .audio-area {
    padding: 0.4rem 1.25rem;
  }
  .avatar-ring {
    width: 48px;
    height: 48px;
  }
  .avatar-pair {
    gap: 0.5rem;
  }
  .action-bar {
    padding: 0 0.75rem 0.4rem;
  }
  .action-row .btn {
    padding: 0.4rem 0.25rem;
    font-size: 0.74rem;
  }
}

/* ══════════════════════════════════════════════════════════════
   GAME CHAT PANEL
   پنل خارج از game-layout قرار دارد و position:fixed دارد
   تا هرگز تخته را کوچک نکند
══════════════════════════════════════════════════════════════ */

#gameScreen { position: relative; }

.game-chat-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: min(700px, 100%);
  max-height: 58vh;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-50%) translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(12,11,20,0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255,255,255,0.13);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.5);
}

.game-chat-panel.chat-open {
  transform: translateX(-50%) translateY(0);
}

/* نوار دستگیره بالای پنل */
.game-chat-handle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 8px;
  flex-shrink: 0;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.game-chat-handle-strip {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  display: block;
}

/* دکمه بستن — فقط وقتی پیام وجود دارد */
.game-chat-close-x {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text2);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.game-chat-close-x:hover  { background: rgba(255,255,255,0.16); }
.game-chat-close-x:active { background: rgba(255,255,255,0.26); color: #fff; }

#gameChatPanel.has-messages .game-chat-close-x {
  display: flex;
}

/* پیام‌ها اسکرول می‌شوند */
#gameChatPanel .messages {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* نقطه اعلان پیام جدید */
.game-chat-unread-dot {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: none;
  box-shadow: 0 0 6px rgba(239,68,68,0.7);
  animation: gcUnreadPulse 1.2s ease-in-out infinite;
}

@keyframes gcUnreadPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}

#btnGameChat { position: relative; }
#btnGameChat.has-unread .game-chat-unread-dot { display: block; }
#btnGameChat.chat-is-open {
  background: rgba(99,102,241,0.25);
  color: var(--primary);
}

/* fullscreen: پنل داخل fullscreen element باید با position absolute کار کند */
#gameScreen:fullscreen .game-chat-panel,
#gameScreen:-webkit-full-screen .game-chat-panel {
  position: absolute;
  left: 0;
  width: 100%;
  transform: translateY(100%);
}
#gameScreen:fullscreen .game-chat-panel.chat-open,
#gameScreen:-webkit-full-screen .game-chat-panel.chat-open {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .game-chat-panel { max-height: 62vh; }
}

/* ── Notch / safe-area padding ────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 480px) {
    .action-bar {
      padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
  }
}

/* ── Wallet UI ───────────────────────────────────────────────────────── */
#btnWallet { font-size: .78rem; gap: 4px; }
#walletBtnLabel { font-size: .75rem; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal input[type="number"],
.modal input[type="text"] {
  box-sizing: border-box;
}

#depositQrCanvas {
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

/* Bet amount input */
#betAmountInput::-webkit-inner-spin-button { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   PROFESSIONAL ANIMATIONS — Mulle.live
══════════════════════════════════════════════════════════════ */

/* ── Orb Floating ─────────────────────────────────────────── */
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  33%       { transform: translate(-28px, 22px) scale(1.06); opacity: 0.45; }
  66%       { transform: translate(18px, -18px) scale(0.94); opacity: 0.3; }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
  33%       { transform: translate(22px, -22px) scale(1.1); opacity: 0.5; }
  66%       { transform: translate(-18px, 28px) scale(0.92); opacity: 0.28; }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%,-50%) scale(1); opacity: 0.28; }
  50%       { transform: translate(-50%,-50%) scale(1.18); opacity: 0.42; }
}
.orb-1 { animation: orbFloat1 13s ease-in-out infinite; }
.orb-2 { animation: orbFloat2 15s ease-in-out infinite; animation-delay: -5s; }
.orb-3 { animation: orbFloat3 9s ease-in-out infinite; animation-delay: -2.5s; }

/* ── Stars / Particles ─────────────────────────────────────── */
@keyframes starTwinkle {
  0%, 100% { opacity: 0.15; }
  50%       { opacity: 0.8; }
}
.splash-bg::before,
.splash-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 8% 12%,  rgba(255,255,255,0.75) 0%, transparent 100%),
    radial-gradient(1px   1px   at 28% 72%,  rgba(255,255,255,0.5)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 52% 28%,  rgba(200,180,255,0.6)  0%, transparent 100%),
    radial-gradient(1px   1px   at 72% 52%,  rgba(255,255,255,0.6)  0%, transparent 100%),
    radial-gradient(1.2px 1.2px at 88% 18%,  rgba(255,255,255,0.4)  0%, transparent 100%),
    radial-gradient(1px   1px   at 18% 48%,  rgba(180,150,255,0.5)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 62% 88%,  rgba(255,255,255,0.5)  0%, transparent 100%),
    radial-gradient(1px   1px   at 42% 8%,   rgba(255,255,255,0.7)  0%, transparent 100%),
    radial-gradient(1.2px 1.2px at 92% 68%,  rgba(200,180,255,0.3)  0%, transparent 100%),
    radial-gradient(1px   1px   at 12% 92%,  rgba(255,255,255,0.5)  0%, transparent 100%);
  animation: starTwinkle 3.5s ease-in-out infinite alternate;
}
.splash-bg::after {
  background-image:
    radial-gradient(1px   1px   at 22% 32%,  rgba(255,255,255,0.5)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 62%,  rgba(180,150,255,0.4)  0%, transparent 100%),
    radial-gradient(1px   1px   at 78% 42%,  rgba(255,255,255,0.6)  0%, transparent 100%),
    radial-gradient(1.2px 1.2px at 44% 82%,  rgba(255,255,255,0.4)  0%, transparent 100%),
    radial-gradient(1px   1px   at 4%  58%,  rgba(200,180,255,0.6)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 96% 92%,  rgba(255,255,255,0.7)  0%, transparent 100%),
    radial-gradient(1px   1px   at 32% 44%,  rgba(255,255,255,0.3)  0%, transparent 100%),
    radial-gradient(1.2px 1.2px at 76% 14%,  rgba(180,150,255,0.5)  0%, transparent 100%),
    radial-gradient(1px   1px   at 55% 5%,   rgba(255,255,255,0.6)  0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 3%  25%,  rgba(255,255,255,0.4)  0%, transparent 100%);
  animation-delay: -1.8s;
  animation-duration: 4.5s;
}

/* ── Splash Content Staggered Entrance ────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(28px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0);   }
}
.splash-content > * {
  animation: fadeSlideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.splash-content > :nth-child(1) { animation-delay: 0.08s; }
.splash-content > :nth-child(2) { animation-delay: 0.18s; }
.splash-content > :nth-child(3) { animation-delay: 0.28s; }
.splash-content > :nth-child(4) { animation-delay: 0.38s; }
.splash-content > :nth-child(5) { animation-delay: 0.48s; }
.splash-content > :nth-child(6) { animation-delay: 0.56s; }
.splash-content > :nth-child(7) { animation-delay: 0.64s; }
.splash-content > :nth-child(8) { animation-delay: 0.7s;  }
.splash-content > :nth-child(9) { animation-delay: 0.76s; }

/* ── Logo SVG Glow Pulse ───────────────────────────────────── */
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(99,102,241,0.35)) drop-shadow(0 0 24px rgba(99,102,241,0.15)); }
  50%       { filter: drop-shadow(0 0 22px rgba(168,85,247,0.65)) drop-shadow(0 0 48px rgba(99,102,241,0.25)); }
}
.logo svg { animation: logoPulse 3.5s ease-in-out infinite; }

/* ── Title Shimmer Gradient ────────────────────────────────── */
@keyframes titleShimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}
.splash-title {
  background: linear-gradient(
    110deg,
    #e0e0ff 0%,
    #fff    18%,
    var(--accent)   34%,
    #fff    50%,
    var(--primary)  66%,
    #fff    82%,
    #e0e0ff 100%
  );
  background-size: 200% auto;
  animation: titleShimmer 5s linear infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Start Button Breathing Glow ───────────────────────────── */
@keyframes btnBreath {
  0%, 100% { box-shadow: 0 4px 20px rgba(99,102,241,0.35); }
  50%       { box-shadow: 0 6px 40px rgba(168,85,247,0.7), 0 0 80px rgba(99,102,241,0.2); }
}
#btnStart:not(:disabled) {
  animation: btnBreath 2.8s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
#btnStart:not(:disabled)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: titleShimmer 3s linear infinite;
}

/* ── Mic Check Pulse ───────────────────────────────────────── */
@keyframes micFloat {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}
.mic-check.ok .mic-icon { animation: micFloat 1.6s ease-in-out infinite; }

/* ── Auth Card Entrance ────────────────────────────────────── */
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(36px) scale(0.94); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0);   }
}
.auth-gate.open .auth-card {
  animation: authCardIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animated border shimmer on auth card */
@keyframes borderShimmer {
  0%, 100% { border-color: rgba(255,255,255,0.08); }
  50%       { border-color: rgba(99,102,241,0.35); }
}
.auth-card { animation: borderShimmer 4s ease-in-out infinite; }

/* ── Chat Screen Entrance ──────────────────────────────────── */
@keyframes screenSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
#chatScreen.active {
  animation: screenSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Header Glassmorphism Enhancement ──────────────────────── */
.chat-header {
  background: rgba(14,14,22,0.88) !important;
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 28px rgba(0,0,0,0.35);
}

/* ── Status Dot Ping Ring ───────────────────────────────────── */
.status-dot { position: relative; overflow: visible; }
@keyframes pingRing {
  0%       { transform: scale(1);   opacity: 0.8; }
  75%, 100% { transform: scale(2.6); opacity: 0; }
}
.status-badge.searching .status-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--warn);
  animation: pingRing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ── Avatar Ring Glow (Me) ──────────────────────────────────── */
@keyframes meGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(99,102,241,0.25), 0 0 12px rgba(99,102,241,0.15); }
  50%       { box-shadow: 0 0 0 4px rgba(99,102,241,0.2),  0 0 28px rgba(99,102,241,0.35); }
}
.avatar.me .avatar-ring {
  animation: meGlow 3.5s ease-in-out infinite;
}

/* ── Avatar Ring Pulse (Partner Searching) ──────────────────── */
@keyframes searchPulse {
  0%, 100% { transform: scale(1);    opacity: 0.65; }
  50%       { transform: scale(1.07); opacity: 1;    }
}
.avatar.partner .avatar-ring:not(.speaking) {
  animation: searchPulse 2.2s ease-in-out infinite;
}

/* ── Speaking Ring Ripple ───────────────────────────────────── */
@keyframes speakRipple {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.55), 0 0 0 0 rgba(16,185,129,0.3); border-color: var(--success); }
  100% { box-shadow: 0 0 0 12px rgba(16,185,129,0), 0 0 0 22px rgba(16,185,129,0); border-color: var(--success); }
}
.avatar-ring.speaking {
  animation: speakRipple 1s ease-out infinite !important;
}

/* ── Connection Line Pulse ──────────────────────────────────── */
@keyframes connGlow {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}
.connection-line {
  position: relative;
}
.connection-line::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.12), transparent);
  animation: connGlow 2.5s ease-in-out infinite;
  pointer-events: none;
}

/* ── Wave Dots Glow Enhancement ─────────────────────────────── */
.wave-dots.active span {
  background: linear-gradient(180deg, var(--success), #34d399) !important;
  box-shadow: 0 0 10px rgba(16,185,129,0.7);
}

/* ── Message Bubble Entrance ────────────────────────────────── */
@keyframes msgPop {
  from { opacity: 0; transform: translateY(10px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.message { animation: msgPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ── Input Focus Glow ───────────────────────────────────────── */
.input-row input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18), 0 0 20px rgba(99,102,241,0.12);
  outline: none;
}

/* ── Send Button Pop ────────────────────────────────────────── */
@keyframes sendPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.86); }
  65%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
.btn-send:active { animation: sendPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* ── Action Buttons Lift ────────────────────────────────────── */
.action-row .btn {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.action-row .btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.action-row .btn:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
}

/* ── Modal Enhanced ─────────────────────────────────────────── */
@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.86) translateY(28px); filter: blur(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    filter: blur(0);   }
}
.modal {
  animation: modalPopIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  background: rgba(14,14,22,0.96) !important;
  box-shadow: 0 28px 88px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.07) !important;
}

/* ── Toast Enhanced ─────────────────────────────────────────── */
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(110%) scale(0.88); }
  to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
.toast {
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(14,14,22,0.94) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Invite Ghost Button Shimmer ───────────────────────────── */
#btnInvite {
  position: relative;
  overflow: hidden;
}
@keyframes ghostShimmer {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(300%)  skewX(-15deg); }
}
#btnInvite::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: ghostShimmer 3.5s ease-in-out infinite;
  animation-delay: 1s;
}

/* ── Btn-icon Hover Glow ────────────────────────────────────── */
.btn-icon {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.btn-icon:active { transform: scale(0.92); }

/* ── Wallet Button Glow ─────────────────────────────────────── */
@keyframes walletPing {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }
}
#btnWallet:not(:disabled) {
  animation: walletPing 3s ease-in-out infinite;
  animation-delay: 2s;
}

/* ── reduce-motion safety ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
