/* ==========================================================================
   MeetEase — Microsoft Teams-grade WebRTC Design System
   ========================================================================== */

/* Universal [hidden] rule with top priority to prevent flex/grid phantom space */
[hidden] {
  display: none !important;
}

/* ============ Design tokens ============ */
:root, [data-theme="light"] {
  --bg:            #f5f6fa;
  --bg-elevated:   #ffffff;
  --bg-sunken:     #eef0f6;
  --surface:       #ffffff;
  --surface-hover: #f4f5fa;
  --border:        #e4e7ef;
  --border-strong: #d5d9e5;
  --text:          #141826;
  --text-muted:    #5f6879;
  --accent:        #5b5fc7;
  --accent-2:      #7b7fd4;
  --accent-hover:  #4f53b8;
  --accent-soft:   #eef0ff;
  --accent-ring:   rgba(91, 95, 199, .28);
  --accent-text:   #ffffff;
  --success:       #10b981;
  --success-soft:  #dffaf0;
  --danger:        #c4314b;
  --danger-hover:  #a8283e;
  --video-bg:      #0b0e16;
  --video-border:  #e4e7ef;
  --shadow:        0 1px 2px rgba(20, 24, 38, .05), 0 8px 24px rgba(20, 24, 38, .07);
  --shadow-lg:     0 2px 6px rgba(20, 24, 38, .06), 0 16px 44px rgba(20, 24, 38, .12);
  --shadow-accent: 0 6px 20px rgba(91, 95, 199, .35);
  --chip-bg:       rgba(10, 13, 22, .65);
  --orb-1:         rgba(91, 95, 199, .13);
  --orb-2:         rgba(123, 127, 212, .11);
  --orb-3:         rgba(16, 185, 129, .08);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg:            #0d0e12;
  --bg-elevated:   #15161d;
  --bg-sunken:     #090a0d;
  --surface:       #1b1d26;
  --surface-hover: #222531;
  --border:        #252836;
  --border-strong: #32364a;
  --text:          #e9edf7;
  --text-muted:    #8b96b0;
  --accent:        #7b7fd4;
  --accent-2:      #9ea2e6;
  --accent-hover:  #9296e2;
  --accent-soft:   #23263d;
  --accent-ring:   rgba(123, 127, 212, .35);
  --accent-text:   #ffffff;
  --success:       #34d399;
  --success-soft:  #10332a;
  --danger:        #e0415d;
  --danger-hover:  #c4314b;
  --video-bg:      #04060c;
  --video-border:  #252836;
  --shadow:        0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg:     0 2px 6px rgba(0, 0, 0, .4), 0 16px 44px rgba(0, 0, 0, .45);
  --shadow-accent: 0 6px 22px rgba(123, 127, 212, .3);
  --chip-bg:       rgba(0, 0, 0, .6);
  --orb-1:         rgba(91, 95, 199, .18);
  --orb-2:         rgba(123, 127, 212, .15);
  --orb-3:         rgba(52, 211, 153, .08);
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background .3s ease, color .3s ease;
  min-height: 100vh;
}
/* ambient gradient orbs */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(640px 340px at 12% 6%,  var(--orb-1), transparent 62%),
    radial-gradient(760px 420px at 88% 2%,  var(--orb-2), transparent 60%),
    radial-gradient(560px 340px at 82% 96%, var(--orb-3), transparent 62%);
}
header#site-header, main.view { position: relative; z-index: 1; }
button { font: inherit; cursor: pointer; border: none; }
input  { font: inherit; }
svg { display: block; width: 1.15em; height: 1.15em; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* thin scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Landing Header ============ */
header#site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg-elevated) 76%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.18rem; letter-spacing: -.02em; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: var(--shadow-accent);
}
.beta-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  line-height: 1;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  user-select: none;
  vertical-align: middle;
}
.header-spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem 1.1rem; border-radius: 10px; font-weight: 600; font-size: .92rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  transition: background .15s, transform .12s, box-shadow .2s, border-color .15s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent; box-shadow: var(--shadow-accent);
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 26px var(--accent-ring); }
.btn.primary:active { transform: translateY(0) scale(.98); }
.btn.primary.small { padding: .4rem .8rem; font-size: .82rem; border-radius: 8px; }
.btn.icon { padding: .55rem; border-radius: 50%; }

/* ============ Landing / join ============ */
.view {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.5rem clamp(1rem, 4vw, 2.5rem) 1.5rem clamp(1rem, 4vw, 2.5rem);
}
.hero {
  display: grid;
  gap: clamp(1.5rem, 3.5vw, 3rem);
  align-items: center;
  padding-block: 0.25rem 1.5rem;
}
@media (min-width: 880px) {
  .hero {
    grid-template-columns: 1.12fr 0.88fr;
  }
}
@media (max-width: 879px) {
  .hero {
    grid-template-columns: 1fr;
  }
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  padding: .32rem .75rem; border-radius: 999px; margin-bottom: 1.1rem;
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 24%, transparent); }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.08; letter-spacing: -.04em; font-weight: 800; }
.hero h1 .grad {
  background: linear-gradient(92deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { color: var(--text-muted); font-size: clamp(1rem, 1.5vw, 1.14rem); max-width: 47ch; margin-top: 1.1rem; }

.join-card {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(1.25rem, 2.6vw, 1.9rem); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1rem;
  width: 100%;
  max-width: 480px;
  justify-self: center;
}
.join-card h2 { font-size: 1.18rem; letter-spacing: -.01em; font-weight: 700; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; }
.field input {
  width: 100%; padding: .78rem .95rem; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg-sunken); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 4px var(--accent-ring); }
.join-card .primary { padding-block: .85rem; font-size: 1rem; border-radius: 12px; }

/* Device preview inside join card */
.device-preview {
  position: relative; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden;
  background: var(--video-bg);
  border: 1px solid var(--video-border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  color: #9aa4b8;
}
.device-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.device-preview .camera-off { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(120% 120% at 50% 20%, #1c2742, #101827 70%); }
.device-preview video:not([hidden]) ~ .camera-off { display: none; }
.avatar-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #4f53b8, #3b3e8c);
  border: 2px solid rgba(255,255,255,.14);
  display: grid; place-items: center; font-size: 1.45rem; font-weight: 700; color: #e8eefc;
  letter-spacing: .02em;
}
.preview-hint { position: absolute; bottom: .6rem; left: 0; right: 0; text-align: center; font-size: .74rem; color: #8b96ac; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.preview-toggles { position: absolute; bottom: .6rem; right: .6rem; display: flex; gap: .4rem; }
.mini-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--chip-bg); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.16); color: #fff; display: grid; place-items: center;
  transition: background .15s, transform .12s;
}
.mini-toggle:hover { transform: scale(1.06); }
.mini-toggle.off { background: var(--danger); border-color: transparent; }

/* Device selectors inside join card */
.device-select-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.8rem 0.95rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: fadeIn .18s ease;
}
.device-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.device-select-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.device-select-label svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.device-dropdown {
  width: 100%;
  padding: 0.58rem 0.78rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.device-dropdown:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1.9rem;
}
@media (max-width: 600px) {
  .feature-row {
    grid-template-columns: 1fr;
  }
}
.feature {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 1.05rem 1.15rem; display: flex; flex-direction: column; gap: .45rem; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.feature .f-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 16%, var(--accent-soft)));
  color: var(--accent); display: grid; place-items: center;
}
.feature b { font-size: .95rem; letter-spacing: -.01em; }
.feature span { font-size: .83rem; color: var(--text-muted); }

/* ==========================================================================
   MICROSOFT TEAMS MEETING EXPERIENCE
   ========================================================================== */

.call-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100dvh;
  background: #14151a;
  color: #f3f4f6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* --- Teams Top Bar --- */
.teams-top-bar {
  height: 52px;
  background: #191b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 110;
}
.teams-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.teams-mini-logo .logo-badge {
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
  border-radius: 8px;
}
.teams-brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #f3f4f6;
}
.teams-mini-logo .beta-tag {
  font-size: 0.58rem;
  padding: 0.12rem 0.42rem;
  color: #c7c9f8;
  background: rgba(123, 127, 212, 0.2);
  border: 1px solid rgba(123, 127, 212, 0.38);
}
.teams-room-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e5e7eb;
}
.teams-room-pill .pill-icon {
  width: 13px;
  height: 13px;
  color: #9ca3af;
}
.teams-room-pill .pill-action-btn {
  background: none;
  color: #9ca3af;
  display: grid;
  place-items: center;
  margin-left: 2px;
  padding: 2px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.teams-room-pill .pill-action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.teams-top-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.teams-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #d1d5db;
  font-variant-numeric: tabular-nums;
}
.teams-timer-pill .timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.teams-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.teams-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d1d5db;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.teams-nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* --- Stage Container --- */
.teams-stage-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  overflow: hidden;
  background: #14151a;
}

/* --- Video Grid (Teams Adaptive Stage) --- */
.video-grid {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 14px;
  padding: 14px 16px 88px 16px; /* space for floating dock at bottom */
  align-content: center;
  justify-content: center;
  place-items: center;
  overflow: hidden; /* zero page/stage scrolling */
}

/* Case 1: 1 Participant (Single Caller) */
.video-grid[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.video-grid[data-count="1"] .tile {
  width: 100%;
  height: 100%;
  max-width: min(calc((100dvh - 154px) * (16 / 9)), calc(100vw - 32px));
  max-height: min(calc(100dvh - 154px), calc((100vw - 32px) * (9 / 16)));
  aspect-ratio: 16 / 9;
  margin: auto;
}

/* Case 2: 2 Participants */
@media (min-width: 720px) {
  .video-grid[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
  .video-grid[data-count="2"] .tile {
    width: 100%;
    height: 100%;
    max-width: min(calc((100dvh - 154px) * (16 / 9)), calc((100vw - 46px) / 2));
    max-height: min(calc(100dvh - 154px), calc(((100vw - 46px) / 2) * (9 / 16)));
    aspect-ratio: 16 / 9;
    margin: auto;
  }
}
@media (max-width: 719px) {
  .video-grid[data-count="2"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .video-grid[data-count="2"] .tile {
    width: 100%;
    height: 100%;
    max-width: min(calc(((100dvh - 168px) / 2) * (16 / 9)), calc(100vw - 32px));
    max-height: min(calc((100dvh - 168px) / 2), calc((100vw - 32px) * (9 / 16)));
    aspect-ratio: 16 / 9;
    margin: auto;
  }
}

/* Case 3 & 4: 3-4 Participants (2x2) */
.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.video-grid[data-count="3"] .tile,
.video-grid[data-count="4"] .tile {
  width: 100%;
  height: 100%;
  max-width: min(calc(((100dvh - 168px) / 2) * (16 / 9)), calc((100vw - 46px) / 2));
  max-height: min(calc((100dvh - 168px) / 2), calc(((100vw - 46px) / 2) * (9 / 16)));
  aspect-ratio: 16 / 9;
  margin: auto;
}

/* Case 5 & 6: 5-6 Participants */
@media (min-width: 900px) {
  .video-grid[data-count="5"],
  .video-grid[data-count="6"] {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .video-grid[data-count="5"] .tile,
  .video-grid[data-count="6"] .tile {
    width: 100%;
    height: 100%;
    max-width: min(calc(((100dvh - 168px) / 2) * (16 / 9)), calc((100vw - 60px) / 3));
    max-height: min(calc((100dvh - 168px) / 2), calc(((100vw - 60px) / 3) * (9 / 16)));
    aspect-ratio: 16 / 9;
    margin: auto;
  }
}
@media (max-width: 899px) {
  .video-grid[data-count="5"],
  .video-grid[data-count="6"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .video-grid[data-count="5"] .tile,
  .video-grid[data-count="6"] .tile {
    width: 100%;
    height: 100%;
    max-width: min(calc(((100dvh - 182px) / 3) * (16 / 9)), calc((100vw - 46px) / 2));
    max-height: min(calc((100dvh - 182px) / 3), calc(((100vw - 46px) / 2) * (9 / 16)));
    aspect-ratio: 16 / 9;
    margin: auto;
  }
}

/* Spotlight layout (Screen Share) */
.video-grid.spotlight {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 12px 16px 88px 16px;
  overflow: hidden;
}
.video-grid.spotlight .tile.spot {
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 270px);
  aspect-ratio: 16 / 9;
  margin: auto;
}
.video-grid.spotlight .filmstrip {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}
.video-grid.spotlight .filmstrip .tile {
  width: clamp(140px, 15vw, 220px);
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

/* Fullscreen pure screenshare mode: show only the remote presenter's screen */
:fullscreen #call-view.remote-sharing .teams-top-bar,
:fullscreen #call-view.remote-sharing .teams-dock,
:fullscreen #call-view.remote-sharing .teams-drawer,
:fullscreen #call-view.remote-sharing .filmstrip,
:fullscreen #call-view.remote-sharing .tile.spot .tile-info-pill,
:fullscreen #call-view.remote-sharing .tile.spot .tile-top-badges,
:fullscreen #call-view.remote-sharing .tile.spot .placeholder,
:fullscreen:has(#call-view.remote-sharing) .toast {
  display: none !important;
}
:fullscreen #call-view.remote-sharing .teams-stage-wrapper {
  background: #000;
}
:fullscreen #call-view.remote-sharing .video-grid.spotlight {
  padding: 0;
  gap: 0;
  grid-template-rows: 1fr;
}
:fullscreen #call-view.remote-sharing .video-grid.spotlight .tile.spot {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

@media (display-mode: fullscreen) {
  #call-view.remote-sharing .teams-top-bar,
  #call-view.remote-sharing .teams-dock,
  #call-view.remote-sharing .teams-drawer,
  #call-view.remote-sharing .filmstrip,
  #call-view.remote-sharing .tile.spot .tile-info-pill,
  #call-view.remote-sharing .tile.spot .tile-top-badges,
  #call-view.remote-sharing .tile.spot .placeholder,
  body:has(#call-view.remote-sharing) .toast {
    display: none !important;
  }
  #call-view.remote-sharing .teams-stage-wrapper {
    background: #000;
  }
  #call-view.remote-sharing .video-grid.spotlight {
    padding: 0;
    gap: 0;
    grid-template-rows: 1fr;
  }
  #call-view.remote-sharing .video-grid.spotlight .tile.spot {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #000;
  }
}

/* --- Microsoft Teams Video Tile Card --- */
.tile {
  position: relative;
  background: #1e2027;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tile-fade-in .25s ease-out;
}
@keyframes tile-fade-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.tile.active-speaker {
  border-color: #5b5fc7;
  box-shadow: 0 0 0 2px #5b5fc7, 0 8px 24px rgba(91, 95, 199, 0.35);
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile video[hidden] {
  display: none !important;
}

/* Mirror self view (camera) just like Microsoft Teams / Zoom */
.tile.is-self video:not(.screen-share) {
  transform: scaleX(-1);
}

/* Shared screen must not be mirrored and must be fully contained without crop */
.tile.screen-share video,
.tile.spot video {
  object-fit: contain;
  background: #000;
  transform: none !important;
}

/* Placeholder when camera is off */
.tile .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(120% 120% at 50% 20%, #252836, #161822 75%);
}
.tile .placeholder[hidden] {
  display: none !important;
}

.avatar-circle-teams {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f53b8, #3b3e8c);
  border: 2px solid rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-inline: auto;
}
.avatar-name-label {
  color: #9ca3af;
  font-size: 0.82rem;
  margin-top: 10px;
  font-weight: 500;
}

/* Frosted Bottom-Left Name Pill */
.tile .tile-info-pill {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 20, 26, 0.78);
  backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 5;
  pointer-events: none;
}
.tile .tile-info-pill .mic-status-icon {
  width: 14px;
  height: 14px;
  color: #10b981;
}
.tile .tile-info-pill .mic-status-icon.muted {
  color: #f87171;
}

/* Top Right Badges (Hand raised, Screen sharing) */
.tile .tile-top-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 5;
}
.tile .badge-hand {
  background: #5b5fc7;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(91, 95, 199, 0.4);
  animation: bounce-in .25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes bounce-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tile .badge-screen {
  background: #10b981;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
}

/* --- Microsoft Teams Floating Control Dock --- */
.teams-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  width: max-content;
  max-width: calc(100vw - 16px);
  background: rgba(26, 28, 35, 0.88);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(255, 255, 255, 0.06);
  z-index: 150;
  user-select: none;
  box-sizing: border-box;
}

.teams-dock .dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  color: #e5e7eb;
  padding: 6px 10px;
  border-radius: 12px;
  min-width: 52px;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.teams-dock .dock-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.teams-dock .dock-btn:active {
  transform: scale(0.95);
}

.teams-dock .dock-btn .btn-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  transition: background .15s, color .15s;
}
.teams-dock .dock-btn:hover .btn-icon-wrapper {
  background: rgba(255, 255, 255, 0.16);
}

/* Button active / off states */
.teams-dock .dock-btn.off .btn-icon-wrapper {
  background: #c4314b;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(196, 49, 75, 0.4);
}
.teams-dock .dock-btn.active-accent .btn-icon-wrapper {
  background: #5b5fc7;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(91, 95, 199, 0.4);
}
.teams-dock .dock-btn.active-share .btn-icon-wrapper {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
}

.teams-dock .dock-btn .btn-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #9ca3af;
}
.teams-dock .dock-btn:hover .btn-label {
  color: #f3f4f6;
}

.teams-dock .dock-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.14);
  margin-inline: 4px;
}

/* Distinctive Teams Red Leave Pill */
.teams-dock .dock-btn.leave-btn {
  background: #c4314b;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  flex-direction: row;
  gap: 8px;
  min-width: auto;
  box-shadow: 0 4px 14px rgba(196, 49, 75, 0.4);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.teams-dock .dock-btn.leave-btn:hover {
  background: #b02a40;
  box-shadow: 0 6px 18px rgba(196, 49, 75, 0.55);
}
.teams-dock .dock-btn.leave-btn:active {
  transform: scale(0.97);
}
.teams-dock .dock-btn.leave-btn .btn-icon-wrapper {
  width: auto;
  height: auto;
  background: transparent;
}
.teams-dock .dock-btn.leave-btn .btn-icon-wrapper svg {
  transform: rotate(137deg);
}
.teams-dock .dock-btn.leave-btn .btn-label {
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
}

/* --- Mobile Responsive Teams Meeting UI (<= 640px) --- */
@media (max-width: 640px) {
  /* Top Bar Adaptation */
  .teams-top-bar {
    padding: 0 10px;
    height: 48px;
    gap: 6px;
  }
  .teams-top-left {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }
  .teams-brand-title,
  .teams-mini-logo .beta-tag {
    display: none;
  }
  .teams-room-pill {
    padding: 3px 8px;
    font-size: 0.76rem;
    max-width: 105px;
  }
  .teams-room-pill .room-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .teams-timer-pill {
    padding: 3px 8px;
    font-size: 0.74rem;
    gap: 5px;
  }
  .teams-top-right {
    gap: 4px;
    flex-shrink: 0;
  }
  .teams-nav-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
    gap: 4px;
  }

  /* Video Stage Spacing */
  .video-grid.spotlight {
    padding: 8px 8px 66px 8px;
    gap: 8px;
  }
  .video-grid:not(.spotlight) {
    padding: 8px 8px 66px 8px;
    gap: 8px;
  }

  /* Compact Floating Control Dock */
  .teams-dock {
    bottom: 12px;
    padding: 4px 6px;
    gap: 4px;
    width: max-content;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
  .teams-dock::-webkit-scrollbar {
    display: none;
  }

  .teams-dock .dock-btn {
    min-width: auto;
    padding: 0;
    gap: 0;
    flex-shrink: 0;
  }

  .teams-dock .dock-btn .btn-icon-wrapper {
    width: 38px;
    height: 38px;
  }
  .teams-dock .dock-btn .btn-icon-wrapper svg {
    width: 18px;
    height: 18px;
  }

  /* Hide text labels on mobile so all buttons fit in a single row */
  .teams-dock .dock-btn .btn-label {
    display: none !important;
  }

  /* Compact circular Leave button */
  .teams-dock .dock-btn.leave-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
  }
  .teams-dock .dock-btn.leave-btn .btn-label {
    display: none !important;
  }
  .teams-dock .dock-btn.leave-btn .btn-icon-wrapper {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
  }
  .teams-dock .dock-btn.leave-btn .btn-icon-wrapper svg {
    width: 18px;
    height: 18px;
    transform: rotate(137deg);
  }

  .teams-dock .dock-sep {
    height: 20px;
    margin-inline: 2px;
    flex-shrink: 0;
  }

  /* Slide-over Drawers on Mobile */
  .teams-drawer {
    top: 48px;
    width: 100vw;
    max-width: 100vw;
    border-left: none;
  }
}

/* --- Slide-Over Participants Drawer --- */
.teams-drawer {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: #1a1c24;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.45);
  z-index: 120;
  display: flex;
  flex-direction: column;
  animation: slide-drawer .22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-drawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f3f4f6;
}
.drawer-close-btn {
  background: none;
  color: #9ca3af;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: color .15s, background .15s;
}
.drawer-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.drawer-invite-card {
  margin: 14px 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drawer-invite-card .invite-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f3f4f6;
  display: block;
}
.drawer-invite-card .invite-sub {
  font-size: 0.74rem;
  color: #9ca3af;
  display: block;
}

.drawer-peer-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.drawer-peer-section .section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 10px;
}
.drawer-peer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-peer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: background .15s;
}
.drawer-peer-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.drawer-peer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-peer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.drawer-peer-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e5e7eb;
}
.drawer-peer-status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af;
}
.drawer-status-icon.muted {
  color: #f87171;
}
.drawer-status-icon.hand {
  color: #a78bfa;
}

/* Device Settings Drawer */
.drawer-devices-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.drawer-device-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-device-group .device-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}
.drawer-device-group .device-group-title svg {
  width: 15px;
  height: 15px;
  color: #7b7fd4;
}
.device-select-container {
  position: relative;
  width: 100%;
}
.teams-device-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #252834;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.teams-device-select:hover {
  background: #2c303e;
  border-color: rgba(255, 255, 255, 0.22);
}
.teams-device-select:focus {
  border-color: #7b7fd4;
  box-shadow: 0 0 0 3px rgba(123, 127, 212, 0.35);
}
.devices-footer-hint {
  margin-top: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  color: #9ca3af;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2128;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  padding: .65rem 1.15rem;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  font-size: 0.86rem;
  font-weight: 600;
  z-index: 200;
  animation: toast-in .2s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px) scale(.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.footnote { text-align: center; color: var(--text-muted); font-size: .78rem; margin-top: 1.1rem; }
