/* ═══════════════════════════════════════════════
   PrivateCall — Global Stylesheet v2
   Dark cinematic theme — WhatsApp / FaceTime style
   ═══════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────── */
:root {
  --bg: #090910;
  --bg-2: #111119;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.13);
  --text: #e8e8f2;
  --text-muted: rgba(232, 232, 242, 0.5);
  --accent: #7c5cfc;
  --accent-2: #5c8bfc;
  --accent-glow: rgba(124, 92, 252, 0.35);
  --danger: #f04545;
  --danger-glow: rgba(240, 69, 69, 0.4);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.35);
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --t: 0.2s ease;
  /* Safe area insets for notch / home indicator */
  --sai-top: env(safe-area-inset-top, 0px);
  --sai-bottom: env(safe-area-inset-bottom, 0px);
  --sai-left: env(safe-area-inset-left, 0px);
  --sai-right: env(safe-area-inset-right, 0px);
}

/* ── Reset ───────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* CRITICAL: [hidden] must always override component display rules */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ── Animated background orbs (home page only) ── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 12s ease-in-out infinite alternate;
}

.orb-1 {
  width: 520px;
  height: 520px;
  background: var(--accent);
  top: -120px;
  left: -120px;
  animation-duration: 14s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-2);
  bottom: -80px;
  right: -80px;
  animation-duration: 10s;
  animation-direction: alternate-reverse;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: #fc5cc8;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.09;
  animation-duration: 18s;
}

@keyframes orbFloat {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(30px, 20px) scale(1.08);
  }
}

/* ─────────────────────────────────────────────
   HOME PAGE
   ───────────────────────────────────────────── */
.home-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
}

.hero {
  text-align: center;
  padding: 48px 0 40px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(124, 92, 252, 0.1);
  border: 1px solid rgba(124, 92, 252, 0.2);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(110deg, var(--accent) 20%, var(--accent-2) 60%, #fc5cc8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.65;
}

.action-cards {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

.action-card {
  flex: 1;
  padding: 36px 32px;
  text-align: left;
}

.action-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.action-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.create-card .card-icon {
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent);
}

.join-card .card-icon {
  background: rgba(92, 139, 252, 0.15);
  color: var(--accent-2);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  position: relative;
}

.card-divider::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--border);
}

.card-divider span {
  position: relative;
  z-index: 1;
  background: var(--bg-2);
  padding: 6px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--t);
  width: 100%;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(92, 139, 252, 0.12);
  color: var(--accent-2);
  border: 1px solid rgba(92, 139, 252, 0.25);
}

.btn-secondary:hover {
  background: rgba(92, 139, 252, 0.2);
}

.btn-danger {
  background: rgba(240, 64, 64, 0.12);
  color: var(--danger);
  border: 1px solid rgba(240, 64, 64, 0.25);
}

.btn-danger:hover {
  background: rgba(240, 64, 64, 0.22);
}

.btn-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
  margin-top: 12px;
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.22);
}

/* Input */
.input-group {
  margin-bottom: 14px;
}

.call-id-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: var(--t);
  outline: none;
}

.call-id-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.call-id-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.join-error {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--danger);
  display: block;
}

.call-id-display {
  margin-top: 18px;
  animation: fadeUp 0.3s ease;
}

.call-id-display label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.call-id-box,
.waiting-id-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.call-id-text {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  flex: 1;
  color: var(--accent);
}

.copy-btn {
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.2);
  color: var(--accent);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  transition: var(--t);
  display: grid;
  place-items: center;
}

.copy-btn:hover {
  background: rgba(124, 92, 252, 0.25);
}

.copy-btn.copied {
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.2);
}

.call-id-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 40px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.feature-icon {
  font-size: 1rem;
}

.home-footer {
  text-align: center;
  margin-top: 36px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   CALL PAGE — Full Screen Video Interface
   ═══════════════════════════════════════════════ */
.call-page {
  background: #000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

/* ── Waiting screen ─────────────────────────── */
.waiting-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 200;
  overflow: hidden;
}

.waiting-bg-blur {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 30%, rgba(124, 92, 252, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 70%, rgba(92, 139, 252, 0.2) 0%, transparent 60%),
    #090910;
}

.waiting-card {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  max-width: 360px;
  width: 90%;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.waiting-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.2), rgba(92, 139, 252, 0.2));
  border: 1px solid rgba(124, 92, 252, 0.3);
  display: grid;
  place-items: center;
  margin: 0 auto 4px;
  color: var(--accent);
}

.waiting-spinner {
  width: 88px;
  height: 88px;
  margin: -16px auto 20px;
  color: var(--accent);
  animation: spin 1.4s linear infinite;
  opacity: 0.6;
}

.spinner-svg {
  width: 100%;
  height: 100%;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.waiting-card h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
  font-weight: 700;
}

.waiting-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.waiting-id-box {
  margin-bottom: 16px;
}

.waiting-leave {
  margin-top: 0;
}

/* ── Call screen ────────────────────────────── */
.call-screen {
  position: fixed;
  inset: 0;
  background: #000;
}

/* Remote video — fills entire screen */
.remote-wrapper {
  position: absolute;
  inset: 0;
  background: #111;
  overflow: hidden;
}

.remote-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Connecting overlay ──────────────────────── */
.connecting-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 9, 16, 0.9) 0%, rgba(9, 9, 16, 0.7) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.connecting-ring {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 2px solid rgba(124, 92, 252, 0.3);
  animation: ringPulse 2s ease-in-out infinite;
}

.connecting-ring::before,
.connecting-ring::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 252, 0.15);
  animation: ringPulse 2s ease-in-out infinite;
  animation-delay: 0.5s;
}

.connecting-ring::after {
  inset: -32px;
  animation-delay: 1s;
}

@keyframes ringPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(1.06);
  }
}

.connecting-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.25), rgba(92, 139, 252, 0.2));
  border: 2px solid rgba(124, 92, 252, 0.4);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
}

.connecting-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 20px;
}

.connecting-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Tap to unmute ───────────────────────────── */
.tap-unmute {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: tapPulse 2s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes tapPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
}

/* ── Top info bar (overlaid on video) ───────── */
.call-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--sai-top) + 14px) calc(var(--sai-right) + 16px) 14px calc(var(--sai-left) + 16px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  gap: 12px;
  transition: opacity 0.3s;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-right {
  justify-content: flex-end;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Connection quality indicator */
.connection-quality {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
}

.quality-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.qbar {
  width: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  transition: background 0.4s, height 0.4s;
}

.qbar:nth-child(1) {
  height: 5px;
}

.qbar:nth-child(2) {
  height: 8px;
}

.qbar:nth-child(3) {
  height: 11px;
}

.qbar:nth-child(4) {
  height: 14px;
}

/* Quality states */
.quality-excellent .qbar {
  background: var(--success);
}

.quality-good .qbar:nth-child(-n+3) {
  background: var(--success);
}

.quality-good .qbar:nth-child(4) {
  background: rgba(255, 255, 255, 0.2);
}

.quality-poor .qbar:nth-child(-n+2) {
  background: var(--warning);
}

.quality-poor .qbar:nth-child(n+3) {
  background: rgba(255, 255, 255, 0.2);
}

.quality-weak .qbar:nth-child(1) {
  background: var(--danger);
}

.quality-weak .qbar:nth-child(n+2) {
  background: rgba(255, 255, 255, 0.2);
}

.quality-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.3px;
}

/* Call timer */
.call-timer-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 12px;
}

.timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1.4s ease infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

.call-timer {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: 0.5px;
}

/* Resolution badge */
.res-badge {
  background: rgba(124, 92, 252, 0.25);
  border: 1px solid rgba(124, 92, 252, 0.4);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.5px;
}

/* Room chip */
.room-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Local video PiP ─────────────────────────── */
.local-wrapper {
  position: absolute;
  width: clamp(96px, 22vw, 160px);
  aspect-ratio: 3/4;
  bottom: calc(var(--sai-bottom) + 110px);
  right: calc(var(--sai-right) + 14px);
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 30;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s;
  touch-action: none;
}

.local-wrapper:hover {
  border-color: rgba(124, 92, 252, 0.6);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(124, 92, 252, 0.2);
}

.local-wrapper:active {
  cursor: grabbing;
}

.local-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  /* mirror selfie */
}

.local-label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.3px;
  pointer-events: none;
}

.pip-grip {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  pointer-events: none;
}

.local-wrapper.pip-fullscreen {
  inset: 0;
  width: 100%;
  aspect-ratio: unset;
  border-radius: 0;
  z-index: 35;
  bottom: 0;
  right: 0;
}

/* Camera off overlay */
.cam-off-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 16, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── Bottom Controls Bar ─────────────────────── */
.call-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 16px calc(var(--sai-right) + 8px) calc(var(--sai-bottom) + 20px) calc(var(--sai-left) + 8px);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  gap: 4px;
}

/* Control button */
.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 14px;
  transition: var(--t);
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  min-width: 64px;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ctrl-btn:active {
  transform: scale(0.93);
}

.ctrl-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  transition: background 0.2s, box-shadow 0.2s;
  position: relative;
}

.ctrl-icon svg {
  width: 22px;
  height: 22px;
  position: absolute;
  transition: opacity 0.15s;
}

.icon-hidden {
  opacity: 0;
  pointer-events: none;
}

.ctrl-btn.active .ctrl-icon {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.ctrl-btn.muted .ctrl-icon {
  background: rgba(240, 69, 69, 0.25);
  border-color: rgba(240, 69, 69, 0.4);
  box-shadow: 0 0 0 2px rgba(240, 69, 69, 0.2);
}

.ctrl-btn.cam-off .ctrl-icon {
  background: rgba(240, 69, 69, 0.25);
  border-color: rgba(240, 69, 69, 0.4);
}

/* End call button — larger, red */
.end-btn .ctrl-icon.end-icon {
  width: 68px;
  height: 68px;
  background: var(--danger);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 24px var(--danger-glow);
}

.end-btn:hover .end-icon {
  background: #d93232;
  box-shadow: 0 6px 32px var(--danger-glow);
}

.ctrl-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.2px;
}

.end-btn .ctrl-label {
  color: rgba(255, 255, 255, 0.85);
}

/* ── Stats panel ─────────────────────────────── */
.stats-panel {
  position: absolute;
  bottom: calc(var(--sai-bottom) + 140px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: rgba(9, 9, 16, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 18px;
  min-width: 220px;
  animation: fadeUp 0.2s ease;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 4px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-row strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Call Ended Screen ───────────────────────── */
.ended-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(240, 69, 69, 0.1) 0%, transparent 60%), var(--bg);
  display: grid;
  place-items: center;
  z-index: 200;
}

.ended-card {
  text-align: center;
  padding: 48px 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  backdrop-filter: blur(16px);
  max-width: 360px;
  width: 90%;
  animation: fadeUp 0.4s ease;
}

.ended-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(240, 69, 69, 0.15);
  border: 1px solid rgba(240, 69, 69, 0.3);
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  color: var(--danger);
}

.ended-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ended-duration {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.ended-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Error modal */
.error-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 300;
  padding: 24px;
}

.error-modal-card {
  background: var(--bg-2);
  border: 1px solid rgba(240, 69, 69, 0.25);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: fadeUp 0.3s ease;
}

.error-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.error-modal-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.error-modal-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

/* ── Animations ───────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 480px) {
  .action-cards {
    flex-direction: column;
  }

  .card-divider {
    width: auto;
    height: 40px;
    flex-direction: row;
  }

  .card-divider::before {
    top: 50%;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: 1px;
  }

  .ctrl-btn {
    min-width: 52px;
    padding: 4px 6px;
  }

  .ctrl-icon {
    width: 52px;
    height: 52px;
  }

  .end-btn .ctrl-icon.end-icon {
    width: 60px;
    height: 60px;
  }

  .local-wrapper {
    width: clamp(80px, 28vw, 120px);
    bottom: calc(var(--sai-bottom) + 106px);
  }

  .ctrl-label {
    font-size: 0.62rem;
  }
}

@media (min-width: 768px) {
  .call-controls {
    justify-content: center;
    gap: 16px;
    padding-bottom: calc(var(--sai-bottom) + 28px);
  }

  .local-wrapper {
    width: 160px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .call-topbar {
    padding-top: calc(var(--sai-top) + 8px);
  }

  .call-controls {
    padding-bottom: calc(var(--sai-bottom) + 8px);
  }

  .ctrl-icon {
    width: 46px;
    height: 46px;
  }

  .end-btn .ctrl-icon.end-icon {
    width: 52px;
    height: 52px;
  }

  .ctrl-label {
    display: none;
  }

  .local-wrapper {
    width: 90px;
    bottom: calc(var(--sai-bottom) + 80px);
    right: calc(var(--sai-right) + 8px);
  }
}