/* ══════════════════════════════════════════════════════
   Tango — Glassmorphism Dark Theme (with Light Mode)
   Matches 01-glassmorphism-dark-prototype.html exactly.
   ══════════════════════════════════════════════════════ */

/* ── Theme Variables ───────────────────────────────── */
:root {
  --bg: #0a0a0b;
  --text: #e4e8f1;
  --text-muted: rgba(255,255,255,.55);
  --text-faint: rgba(255,255,255,.35);
  --text-ghost: rgba(255,255,255,.25);
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(255,255,255,.15);
  --surface: rgba(255,255,255,.05);
  --surface-hover: rgba(255,255,255,.08);
  --surface-strong: rgba(255,255,255,.08);
  --surface-overlay: rgba(10,10,11,.7);
  --surface-card: rgba(18,18,20,.75);
  --surface-panel: rgba(10,10,11,.6);
  --surface-prejoin: rgba(10,10,11,.92);
  --surface-input: rgba(255,255,255,.06);
  --surface-input-focus: rgba(255,255,255,.08);
  --msg-self-bg: linear-gradient(135deg, rgba(249,115,22,.3), rgba(234,88,12,.25));
  --msg-self-border: rgba(249,115,22,.2);
  --msg-self-text: #fff7ed;
  --msg-remote-bg: rgba(255,255,255,.06);
  --msg-remote-border: rgba(255,255,255,.08);
  --msg-remote-text: rgba(255,255,255,.8);
  --stage-bg: linear-gradient(145deg, #111113 0%, #0d0d0e 40%, #141416 100%);
  --pip-bg: linear-gradient(145deg, #1a1a1c 0%, #111113 100%);
  --blob-1: radial-gradient(circle, rgba(249,115,22,.7) 0%, transparent 70%);
  --blob-2: radial-gradient(circle, rgba(220,38,38,.5) 0%, transparent 70%);
  --blob-opacity: .15;
  --ctrl-active-bg: rgba(255,255,255,.1);
  --ctrl-inactive-bg: rgba(255,255,255,.04);
  --ctrl-inactive-hover: rgba(255,255,255,.08);
  --shadow-card: 0 24px 80px rgba(0,0,0,.5);
  --scrollbar-thumb: rgba(255,255,255,.1);
  color-scheme: dark;
}

html.light {
  --bg: #f0f2f5;
  --text: #1a1d23;
  --text-muted: rgba(0,0,0,.6);
  --text-faint: rgba(0,0,0,.4);
  --text-ghost: rgba(0,0,0,.25);
  --border: rgba(0,0,0,.08);
  --border-hover: rgba(0,0,0,.15);
  --surface: rgba(255,255,255,.7);
  --surface-hover: rgba(255,255,255,.85);
  --surface-strong: rgba(255,255,255,.8);
  --surface-overlay: rgba(255,255,255,.85);
  --surface-card: rgba(255,255,255,.82);
  --surface-panel: rgba(255,255,255,.7);
  --surface-prejoin: rgba(240,242,245,.95);
  --surface-input: rgba(0,0,0,.04);
  --surface-input-focus: rgba(0,0,0,.06);
  --msg-self-bg: linear-gradient(135deg, rgba(249,115,22,.15), rgba(234,88,12,.12));
  --msg-self-border: rgba(249,115,22,.15);
  --msg-self-text: #7c2d12;
  --msg-remote-bg: rgba(0,0,0,.03);
  --msg-remote-border: rgba(0,0,0,.06);
  --msg-remote-text: rgba(0,0,0,.75);
  --stage-bg: linear-gradient(145deg, #e2e6ed 0%, #dde1e8 40%, #e8ecf2 100%);
  --pip-bg: linear-gradient(145deg, #d8dce5 0%, #e2e6ed 100%);
  --blob-1: radial-gradient(circle, rgba(249,115,22,.25) 0%, transparent 70%);
  --blob-2: radial-gradient(circle, rgba(220,38,38,.2) 0%, transparent 70%);
  --blob-opacity: .5;
  --ctrl-active-bg: rgba(0,0,0,.07);
  --ctrl-inactive-bg: rgba(0,0,0,.03);
  --ctrl-inactive-hover: rgba(0,0,0,.06);
  --shadow-card: 0 24px 80px rgba(0,0,0,.1);
  --scrollbar-thumb: rgba(0,0,0,.12);
  color-scheme: light;
}

/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
}

/* Ambient background blobs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  opacity: var(--blob-opacity);
  transition: opacity .6s ease;
}
body::before {
  width: 600px; height: 600px;
  background: var(--blob-1);
  top: -120px; left: -100px;
}
body::after {
  width: 500px; height: 500px;
  background: var(--blob-2);
  bottom: -80px; right: -60px;
}

/* ── Glass Utilities ──────────────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
}
.glass-strong {
  background: var(--surface-strong);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-hover);
}

/* ── Theme Toggle ─────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: scale(1.08);
}
.theme-toggle svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .3s ease;
}
.theme-toggle:hover svg { transform: rotate(20deg); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html.light .theme-toggle .icon-sun { display: block; }
html.light .theme-toggle .icon-moon { display: none; }
html.light .home-brand-logo,
html.light .brand-logo { filter: invert(1); }

/* ── Shared ───────────────────────────────────────── */
.hidden { display: none !important; }

.btn-primary {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
  letter-spacing: .3px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(249,115,22,.35);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  padding: 10px 20px;
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  background: var(--surface-input);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.input-field {
  width: 100%;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.input-field::placeholder { color: var(--text-ghost); }
.input-field:focus {
  border-color: rgba(249,115,22,.5);
  background: var(--surface-input-focus);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}

.select-field {
  width: 100%;
  background-color: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 32px 10px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .2s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(128,128,128,0.5)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.select-field:focus { border-color: rgba(249,115,22,.4); }
.select-field option { background: var(--bg); color: var(--text); }

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
  display: block;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in-scale {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(.95); }
}

/* ══════════════════════════════════════════════════════
   PAGE: HOME / LANDING
   ══════════════════════════════════════════════════════ */
.page-home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.home-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}
.home-card {
  width: 100%;
  max-width: 480px;
  border-radius: 24px;
  padding: 48px 40px;
  background: var(--surface-card);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: fade-in-scale .4s ease;
}
.home-brand-logo {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 4px;
}
.home-tagline {
  font-size: 15px;
  color: var(--text-faint);
  margin-bottom: 36px;
  font-weight: 400;
}
.home-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.home-field {
  display: flex;
  flex-direction: column;
}
.home-form .btn-primary {
  margin-top: 8px;
  padding: 14px;
  font-size: 15px;
  width: 100%;
}
.home-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.home-divider::before, .home-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.home-divider span {
  font-size: 12px;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}
.join-row {
  display: flex;
  gap: 10px;
}
.join-row .input-field { flex: 1; }
.home-status {
  text-align: center;
  font-size: 13px;
  min-height: 20px;
  transition: color .2s;
}
.home-status.error { color: #f87171; animation: shake .4s ease; }
.home-status.success { color: #4ade80; }
.home-features {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 24px;
}
.home-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-ghost);
  font-weight: 500;
}
.home-feature svg {
  width: 14px; height: 14px;
  stroke: var(--text-ghost);
  fill: none;
  stroke-width: 2;
}

/* ══════════════════════════════════════════════════════
   PAGE: CALL (contains pre-join + in-call)
   ══════════════════════════════════════════════════════ */
.page-call {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 1fr;
}

/* ── Call Header ─────────────────────────────────── */
.call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 50;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}
.brand-logo {
  height: 22px;
  width: auto;
  display: block;
}
.divider-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-ghost); }
.meeting-name { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-timer {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 10px;
  border-radius: 20px;
}
.badge-encrypted {
  background: rgba(220,38,38,.15);
  color: #fed7aa;
  border: 1px solid rgba(220,38,38,.25);
}
.badge-encrypted svg { width: 12px; height: 12px; stroke: #fed7aa; fill: none; stroke-width: 2; }

/* ── Call Body ───────────────────────────────────── */
.call-body {
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.call-app {
  position: absolute;
  inset: 0;
}
.call-app.drag-over::after {
  content: 'Drop file to send';
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fdba74;
  background: rgba(249,115,22,.08);
  border: 2px dashed rgba(249,115,22,.4);
  border-radius: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

/* ── Pre-join Shell (overlay) ────────────────────── */
.prejoin-shell {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-prejoin);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in .3s ease;
}
.prejoin-modal {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  width: min(900px, calc(100vw - 48px));
  max-height: calc(100vh - 120px);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: fade-in-scale .35s ease;
}
.prejoin-stage {
  background: var(--stage-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  padding: 32px;
  min-height: 360px;
}
.prejoin-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 40%, rgba(249,115,22,.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 60%, rgba(220,38,38,.05) 0%, transparent 70%);
  pointer-events: none;
}
.prejoin-video-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.prejoin-placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 2;
}
.prejoin-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(249,115,22,.15), 0 8px 32px rgba(0,0,0,.4);
  z-index: 1;
}
.prejoin-cam-label {
  font-size: 13px;
  color: var(--text-faint);
  z-index: 1;
}

.prejoin-settings {
  display: flex;
  flex-direction: column;
  padding: 32px;
  gap: 20px;
  justify-content: center;
}
.prejoin-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: -4px;
}
.prejoin-subheading {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.prejoin-settings .field-group {
  display: flex;
  flex-direction: column;
}
.prejoin-settings .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-top: 4px;
}

/* ── Meeting Shell ──────────────────────────────── */
.meeting-shell {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: 1fr;
  grid-template-areas: "stage panel";
  min-height: 0;
}
.meeting-shell.panel-collapsed {
  grid-template-columns: 1fr;
  grid-template-areas: "stage";
}
.meeting-shell.panel-collapsed .panel { display: none; }

/* ── Stage ───────────────────────────────────────── */
.stage {
  grid-area: stage;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  min-height: 0;
}
.remote-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: var(--stage-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid var(--border);
  transition: background .4s ease;
}
.remote-video-container::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 40%, rgba(249,115,22,.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 60%, rgba(220,38,38,.05) 0%, transparent 70%);
  pointer-events: none;
}
.remote-video-container .video-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.avatar-circle {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(249,115,22,.15), 0 8px 32px rgba(0,0,0,.4);
}
.remote-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Waiting state */
.remote-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.waiting-state {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}
.waiting-dots {
  display: flex;
  gap: 6px;
}
.waiting-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(249,115,22,.5);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: .2s; }
.waiting-dots span:nth-child(3) { animation-delay: .4s; }
.waiting-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
}
.waiting-sublabel {
  font-size: 13px;
  color: var(--text-faint);
  max-width: 280px;
}
.waiting-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.waiting-link-box code {
  font-size: 12px;
  color: var(--text-faint);
  font-family: 'Inter', monospace;
}
.waiting-link-box button {
  background: none;
  border: none;
  color: #fdba74;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background .2s;
}
.waiting-link-box button:hover { background: rgba(249,115,22,.15); }

/* Remote avatar state */
.remote-avatar-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

/* Stage badges */
.stage-badges {
  position: absolute;
  top: 16px; left: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.stage-badge.hidden,
.stage-diagnostics.hidden {
  display: none;
}
.badge-connected {
  background: rgba(34,197,94,.14);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.2);
}
.badge-connected[data-route="relay"] {
  background: rgba(249,115,22,.14);
  color: #fdba74;
  border-color: rgba(249,115,22,.24);
}
.badge-connected .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
}
.badge-connected[data-route="relay"] .dot {
  background: #fdba74;
  box-shadow: 0 0 6px #fdba74;
}
.badge-waiting {
  background: rgba(251,191,36,.14);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,.2);
}
.badge-waiting .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.badge-screenshare {
  background: rgba(249,115,22,.14);
  color: #fdba74;
  border: 1px solid rgba(249,115,22,.2);
}
.badge-screenshare svg {
  width: 14px; height: 14px;
  stroke: #fdba74;
  fill: none;
  stroke-width: 2;
}
.stage-diagnostics {
  position: absolute;
  top: 54px;
  left: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 8px 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(8, 15, 28, .48);
  border: 1px solid rgba(148, 163, 184, .16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.diagnostics-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 110px;
}
.diagnostics-label {
  font-size: 11px;
  color: rgba(226, 232, 240, .6);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stage-diagnostics strong {
  font-size: 12px;
  color: rgba(248, 250, 252, .92);
  font-weight: 600;
}
.reaction-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 11;
}
.reaction-burst {
  position: absolute;
  bottom: 64px;
  left: clamp(18%, var(--reaction-x, 50%), 82%);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  filter: drop-shadow(0 8px 20px rgba(15, 23, 42, .28));
  animation: reaction-float 2.4s ease-out forwards;
}

/* Name overlay on remote */
.remote-name-overlay {
  position: absolute;
  bottom: 16px; left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  z-index: 10;
}
.remote-name-overlay svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Stage toggle button */
.stage-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 24px; height: 64px;
  border-radius: 8px 0 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: all .2s;
  z-index: 10;
}
.stage-toggle:hover { background: var(--surface-hover); color: var(--text-muted); }
.stage-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.stage-toggle i { font-size: 12px; }

/* ── Local PiP ────────────────────────────────────── */
.local-pip {
  position: absolute;
  bottom: 28px; right: 28px;
  width: 200px; height: 140px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--pip-bg);
  border: 2px solid var(--border-hover);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
  cursor: grab;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.local-pip:hover {
  border-color: rgba(251,146,60,.3);
  box-shadow: 0 8px 32px rgba(249,115,22,.15);
}
.local-pip video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Side Panel ───────────────────────────────────── */
.panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 0;
  animation: fade-in .2s ease;
}
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-tab {
  flex: 1;
  padding: 14px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-faint);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}
.panel-tab:hover { color: var(--text-muted); }
.panel-tab.active { color: #fdba74; border-bottom-color: #f97316; }
.panel-tab svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.panel-tab i { font-size: 14px; }

.panel-body { flex: 1; min-height: 0; position: relative; }
.panel-content { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* Chat */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }

.msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fade-in .2s ease;
}
.msg-self { align-self: flex-end; align-items: flex-end; }
.msg-remote { align-self: flex-start; align-items: flex-start; }
.msg-meta {
  font-size: 11px;
  color: var(--text-faint);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-author { font-weight: 600; color: var(--text-muted); }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.msg-self .msg-bubble {
  background: var(--msg-self-bg);
  border: 1px solid var(--msg-self-border);
  border-bottom-right-radius: 4px;
  color: var(--msg-self-text);
}
.msg-remote .msg-bubble {
  background: var(--msg-remote-bg);
  border: 1px solid var(--msg-remote-border);
  border-bottom-left-radius: 4px;
  color: var(--msg-remote-text);
}
.msg-system {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 4px 12px;
  background: var(--surface);
  border-radius: 20px;
}

.chat-composer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer-input {
  flex: 1;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.composer-input::placeholder { color: var(--text-ghost); }
.composer-input:focus { border-color: rgba(249,115,22,.4); background: var(--surface-input-focus); }
.composer-send {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .2s ease;
  flex-shrink: 0;
}
.composer-send:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(249,115,22,.35); }
.composer-send svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-send i { font-size: 16px; }

/* Files */
.files-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background .2s;
  animation: fade-in .2s ease;
}
.file-item:hover { background: var(--surface-hover); }
.file-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon.pdf { background: rgba(239,68,68,.15); color: #fca5a5; }
.file-icon.img { background: rgba(249,115,22,.15); color: #fdba74; }
.file-icon.doc { background: rgba(34,197,94,.15); color: #4ade80; }
.file-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.file-download {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--surface-input);
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.file-download:hover { background: rgba(249,115,22,.2); color: #fdba74; }
.file-download svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.files-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-ghost);
  text-align: center;
  padding: 32px;
}
.files-empty svg { width: 40px; height: 40px; stroke: var(--text-ghost); fill: none; stroke-width: 1.5; opacity: .6; }
.files-empty i { opacity: .6; }
.files-empty span { font-size: 13px; }

.files-composer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.file-upload-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed var(--border-hover);
  background: var(--surface);
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s;
}
.file-upload-btn:hover {
  border-color: rgba(249,115,22,.3);
  background: rgba(249,115,22,.05);
  color: #fdba74;
}
.file-upload-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* hide the native file input */
.upload-input { display: none; }

/* ── Control Bar ──────────────────────────────────── */
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 12px 16px 20px;
  z-index: 40;
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.controls .control-bar { pointer-events: auto; }
.controls.controls-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.control-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 60px;
  background: var(--surface-strong);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-card);
}
.ctrl-btn {
  width: 48px; height: 48px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease, color .2s ease;
  position: relative;
  font-family: inherit;
}
.ctrl-btn svg {
  width: 22px; height: 22px;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
  transition: stroke .2s ease;
}
.ctrl-btn i {
  font-size: 18px;
  transition: color .2s ease;
}
.ctrl-btn.active { background: var(--ctrl-active-bg); color: var(--text); }
.ctrl-btn.active:hover { background: var(--surface-hover); transform: scale(1.08); }
.ctrl-btn.inactive { background: var(--ctrl-inactive-bg); color: var(--text-faint); }
.ctrl-btn.inactive:hover { background: var(--ctrl-inactive-hover); color: var(--text-muted); transform: scale(1.08); }
.ctrl-btn.off { background: rgba(239,68,68,.2); color: #fca5a5; }
.ctrl-btn.off:hover { background: rgba(239,68,68,.3); transform: scale(1.08); }
.ctrl-btn.danger { background: rgba(239,68,68,.2); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.ctrl-btn.danger:hover { background: rgba(239,68,68,.35); transform: scale(1.08); box-shadow: 0 0 20px rgba(239,68,68,.2); }
.ctrl-reactions {
  position: relative;
}
.reactions-tray {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 12px 36px rgba(15, 23, 42, .28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}
.reaction-chip {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.reaction-chip:hover {
  transform: translateY(-2px) scale(1.06);
  background: rgba(255,255,255,.14);
  border-color: rgba(251,146,60,.22);
}
.ctrl-sep { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
.ctrl-label {
  position: absolute;
  bottom: -22px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.ctrl-btn:hover .ctrl-label { opacity: 1; }

/* ── Device Picker ───────────────────────────────── */
.ctrl-group {
  position: relative;
  display: flex;
  align-items: center;
}
.ctrl-chevron {
  width: 20px; height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--ctrl-active-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
  transition: background .2s ease, color .2s ease, transform .15s ease;
  z-index: 1;
}
.ctrl-chevron i { font-size: 8px; }
.ctrl-chevron:hover { background: var(--surface-hover); color: var(--text); transform: scale(1.1); }
.device-picker {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: 320px;
  background: var(--surface-strong);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 8px 0;
  z-index: 100;
  animation: picker-in .15s ease;
}
@keyframes picker-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.device-picker.hidden { display: none; }
.device-picker-title {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
}
.device-picker-list { display: flex; flex-direction: column; }
.device-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: background .15s ease, color .15s ease;
}
.device-picker-item:hover { background: var(--surface-hover); color: var(--text); }
.device-picker-item.selected { color: var(--primary); }
.device-picker-item .check-icon {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--primary);
}
.device-picker-item.off-item { color: var(--text-faint); }
.device-picker-item.off-item:hover { color: #fca5a5; }

/* ── Toast Notifications ─────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-hover);
  animation: toast-in .25s ease;
  pointer-events: auto;
}
.toast.fade-out { animation: toast-out .25s ease forwards; }
.toast-info { background: rgba(249,115,22,.2); color: #fdba74; }
.file-offer-toast {
  padding: 16px 20px;
  pointer-events: auto;
  cursor: default;
}
.toast-success { background: rgba(34,197,94,.2); color: #4ade80; }
.toast-warning { background: rgba(251,191,36,.2); color: #fbbf24; }

/* ══════════════════════════════════════════════════════
   PAGE: ERROR
   ══════════════════════════════════════════════════════ */
.page-error {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.error-card {
  text-align: center;
  max-width: 420px;
  border-radius: 24px;
  padding: 48px 40px;
  background: var(--surface-card);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: fade-in-scale .4s ease;
}
.error-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(239,68,68,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.error-icon svg { width: 28px; height: 28px; stroke: #f87171; fill: none; stroke-width: 2; }
.error-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.error-desc { font-size: 14px; color: var(--text-faint); margin-bottom: 28px; line-height: 1.6; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
  .meeting-shell { grid-template-columns: 1fr; grid-template-areas: "stage"; }
  .meeting-shell .panel { display: none; }
  .meeting-shell.mobile-panel-open .panel {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 60;
    border-left: none;
  }
  .prejoin-modal {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .prejoin-stage { min-height: 200px; padding: 24px; }
}
@media (max-width: 600px) {
  .call-header { padding: 0 12px; }
  .meeting-name, .divider-dot { display: none; }
  .local-pip { width: 130px; height: 96px; bottom: 16px; right: 16px; }
  .ctrl-btn { width: 42px; height: 42px; }
  .ctrl-btn svg { width: 18px; height: 18px; }
  .ctrl-chevron { width: 16px; height: 16px; margin-left: -4px; }
  .ctrl-chevron i { font-size: 7px; }
  .control-bar { gap: 4px; padding: 6px 10px; }
  .stage { padding: 8px; }
  .remote-video-container { border-radius: 12px; }
  .avatar-circle { width: 64px; height: 64px; font-size: 26px; }
  .home-card { padding: 32px 24px; }
  .home-features { flex-wrap: wrap; gap: 12px; }
}

@keyframes reaction-float {
  0% { transform: translate(-50%, 0) scale(.8); opacity: 0; }
  12% { transform: translate(-50%, -12px) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--reaction-drift, 0px)), -180px) scale(1.08); opacity: 0; }
}
