/* Maira Meet: minimal, Apple-inspired, liquid glass */
:root {
  --bg: #06070c;
  --text: #f5f5f7;
  --muted: rgba(235, 235, 245, .6);
  --faint: rgba(235, 235, 245, .3);
  --blue: #0a84ff;
  --red: #ff453a;
  --green: #30d158;
  --r-xl: 32px;
  --r-lg: 26px;
  --r-md: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 var(--font);
  letter-spacing: -.01em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font: 13px ui-monospace, "SF Mono", Menlo, monospace; background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 6px; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- ambient light ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; transition: opacity .8s var(--ease); }
.ambient i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; opacity: .55; will-change: transform; }
.ambient .o1 { background: radial-gradient(circle, rgba(10,132,255,.55), transparent 62%); top: -25vmax; left: -15vmax; animation: drift1 38s ease-in-out infinite alternate; }
.ambient .o2 { background: radial-gradient(circle, rgba(191,90,242,.45), transparent 62%); top: -10vmax; right: -25vmax; animation: drift2 44s ease-in-out infinite alternate; }
.ambient .o3 { background: radial-gradient(circle, rgba(255,55,95,.32), transparent 62%); bottom: -35vmax; left: 10vmax; animation: drift3 50s ease-in-out infinite alternate; }
.ambient .o4 { background: radial-gradient(circle, rgba(100,210,255,.28), transparent 62%); bottom: -30vmax; right: -10vmax; animation: drift1 56s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, 18vmax) scale(.9); } }
@keyframes drift3 { to { transform: translate(12vmax, -16vmax) scale(1.1); } }
body:has(#call:not([hidden])) .ambient { opacity: .45; }

/* ---------- liquid glass ---------- */
.glass {
  position: relative;
  isolation: isolate;
  background: linear-gradient(150deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.06) 45%, rgba(255,255,255,.09) 100%);
  -webkit-backdrop-filter: blur(30px) saturate(190%) brightness(1.06);
  backdrop-filter: blur(30px) saturate(190%) brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.32),
    inset 0 -1px 0 rgba(255,255,255,.06),
    inset 0 0 22px rgba(255,255,255,.04),
    0 1px 2px rgba(0,0,0,.25),
    0 18px 50px -12px rgba(0,0,0,.55);
  border-radius: var(--r-xl);
}
/* luminous rim: bright top-left & bottom-right edges */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(135deg, rgba(255,255,255,.6), rgba(255,255,255,.08) 30%, rgba(255,255,255,0) 50%, rgba(255,255,255,.08) 70%, rgba(255,255,255,.38));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
/* specular sheen */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 60% at 20% -10%, rgba(255,255,255,.22), transparent 55%);
}
.pill { border-radius: 999px; }
/* Chromium: real refraction of what's behind the glass */
html.refract .glass.pill {
  -webkit-backdrop-filter: url(#liquid) blur(10px) saturate(200%) brightness(1.08);
  backdrop-filter: url(#liquid) blur(10px) saturate(200%) brightness(1.08);
}

/* ---------- basics ---------- */
.screen { min-height: 100%; }
.center { display: grid; place-items: center; padding: 40px 20px; min-height: 100vh; min-height: 100dvh; }
.muted { color: var(--muted); }
.note { color: #ffd60a; font-size: 13px; min-height: 1.2em; margin: 12px 4px 0; text-align: center; }
.error-text { color: #ff8a80; min-height: 1.2em; margin: 8px 0 0; font-size: 13px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 22px; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .25s var(--ease), background .25s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: rgba(255,255,255,.94); color: #000; box-shadow: 0 6px 24px -6px rgba(255,255,255,.35), inset 0 -1px 0 rgba(0,0,0,.08); }
.btn.primary:hover { background: #fff; }
.btn.ghost { background: rgba(255,255,255,.1); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,.18); }
.btn.big { padding: 15px 34px; font-size: 17px; }
.btn.small { padding: 8px 16px; font-size: 14px; }
.btn.wide { width: 100%; }

input[type=text] {
  font: inherit; font-size: 16px; color: var(--text); width: 100%;
  background: rgba(255,255,255,.07); border: 0; border-radius: var(--r-md);
  padding: 15px 18px; outline: none; transition: background .2s, box-shadow .2s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
input[type=text]::placeholder { color: var(--faint); }
input[type=text]:focus { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 0 0 4px rgba(10,132,255,.25); }

/* ---------- landing ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 560px; width: 100%; animation: rise .9s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.mark { width: 92px; height: 92px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 26px;
  box-shadow: 0 20px 60px -10px rgba(10,132,255,.55), 0 10px 30px -8px rgba(191,90,242,.5); }
.mark img { width: 92px; height: 92px; }
.hero h1 { font-size: clamp(44px, 9vw, 72px); font-weight: 700; letter-spacing: -.045em; line-height: 1; margin: 0; }
.sub { color: var(--muted); font-size: clamp(18px, 3.2vw, 22px); line-height: 1.35; letter-spacing: -.02em; margin: 16px 0 36px; }
.actions { display: flex; justify-content: center; margin-bottom: 16px; }
.join-form { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 8px; width: min(420px, 100%); }
.join-form input[type=text] { background: transparent; box-shadow: none; padding: 9px 12px; font-size: 15px; }
.join-form input[type=text]:focus { box-shadow: none; background: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 30px; }
.chip { font-size: 12.5px; color: var(--muted); padding: 7px 14px; border-radius: 999px; }

/* ---------- pre-join ---------- */
.prejoin { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 380px); gap: 28px; align-items: center; max-width: 1080px; width: 100%; animation: rise .8s var(--ease) both; }
.preview-wrap .tile { aspect-ratio: 16 / 10; border-radius: var(--r-xl); }
.prejoin-card { padding: 34px 30px 26px; display: flex; flex-direction: column; gap: 4px; }
.prejoin-card h2 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.035em; }
.prejoin-card .muted { margin: 4px 0 22px; }
.prejoin-card .btn { margin-top: 10px; }
.e2ee-line { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.e2ee-line svg { width: 14px; height: 14px; color: var(--green); }
.preview-controls { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 7px; z-index: 3; }
.round { width: 50px; height: 50px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .25s, transform .25s var(--ease), color .25s; }
.round:hover { background: rgba(255,255,255,.2); }
.round:active { transform: scale(.92); }
.round.off { background: rgba(255,255,255,.92); color: #1c1c1e; }

/* ---------- tiles ---------- */
.tile { position: relative; background: #0c0d13; border-radius: var(--r-lg); overflow: hidden; min-height: 0; min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 20px 50px -20px rgba(0,0,0,.6);
  transition: box-shadow .3s var(--ease); animation: tileIn .5s var(--ease) both; }
@keyframes tileIn { from { opacity: 0; transform: scale(.97); } }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.mirror video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; }
.tile .relay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.tile.relayed.rxvideo .relay-canvas { display: block; }
.tile.screen .relay-canvas { object-fit: contain; }
.tile .avatar { position: absolute; inset: 0; display: none; place-items: center; z-index: 1;
  background: radial-gradient(80% 80% at 30% 20%, rgba(10,132,255,.22), transparent 60%), radial-gradient(80% 80% at 80% 90%, rgba(191,90,242,.22), transparent 60%), #0c0d13; }
.tile.novideo .avatar { display: grid; }
.tile .avatar span { width: clamp(64px, 24%, 128px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(22px, 4vw, 44px); font-weight: 600; letter-spacing: -.02em; color: #fff;
  background: linear-gradient(150deg, rgba(255,255,255,.28), rgba(255,255,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 0 0 1px rgba(255,255,255,.12), 0 14px 40px -10px rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.tile.speaking { box-shadow: inset 0 0 0 2.5px rgba(255,255,255,.9), 0 0 40px -6px rgba(255,255,255,.35), 0 20px 50px -20px rgba(0,0,0,.6); }
.tile .label { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; max-width: calc(100% - 24px);
  background: rgba(30,30,36,.38); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 0 0 1px rgba(255,255,255,.08); }
.tile .label .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .label .mic-off { display: none; color: var(--red); }
.tile .label .mic-off svg { width: 15px; height: 15px; stroke-width: 2; }
.tile.muted .label .mic-off { display: inline-flex; }
.tile .status { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3; font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px; color: var(--text); max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
  background: rgba(30,30,36,.4); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.tile .status:empty { display: none; }

/* ---------- call layout ---------- */
#call { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px; }
.topinfo { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; font-size: 14px; }
.topinfo img { border-radius: 6px; }
.topinfo .title { font-weight: 600; }
.topinfo .sep { width: 1px; height: 14px; background: rgba(255,255,255,.2); }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); }
.conn { color: #ffd60a; font-size: 13px; }
.conn:empty { display: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px 8px 11px; border: 0; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); }
.badge svg { width: 15px; height: 15px; color: var(--green); }
.stage { flex: 1; display: flex; min-height: 0; gap: 14px; padding: 0 16px; }
.grid { flex: 1; display: grid; gap: 12px; min-height: 0; min-width: 0;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr)); }

/* side panel */
.side { width: 350px; flex: none; display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-xl); animation: slideIn .45s var(--ease) both; overflow: hidden; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.side-tabs { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.segmented { flex: 1; display: flex; padding: 3px; border-radius: 12px; background: rgba(118,118,128,.24); }
.tab { flex: 1; font-weight: 600; font-size: 13px; color: var(--muted); background: none; border: 0; padding: 7px 10px; border-radius: 9px; cursor: pointer; transition: background .25s var(--ease), color .25s; }
.tab.active { color: var(--text); background: rgba(255,255,255,.2); box-shadow: 0 3px 8px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.15); }
#people-count { color: var(--muted); font-weight: 500; margin-left: 2px; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.icon-btn:hover { background: rgba(255,255,255,.18); color: var(--text); }
.tab-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.chat-empty { color: var(--faint); font-size: 13px; text-align: center; margin: auto 10px; line-height: 1.6; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 85%; align-self: flex-start; animation: pop .35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg .meta { font-size: 11.5px; color: var(--faint); padding: 0 12px; }
.msg .meta b { color: var(--muted); font-weight: 600; }
.msg .text { background: rgba(255,255,255,.12); padding: 9px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .text { background: linear-gradient(180deg, #2b95ff, var(--blue)); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.msg.system { align-self: center; color: var(--faint); font-size: 12px; animation: none; }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 10px 12px 12px; }
.chat-form input[type=text] { border-radius: 999px; padding: 11px 16px; font-size: 15px; }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center; cursor: pointer; background: var(--blue); color: #fff; transition: transform .2s var(--ease); }
.send svg { width: 18px; height: 18px; stroke-width: 2.4; }
.send:active { transform: scale(.9); }
.people-list { list-style: none; margin: 0; padding: 4px 10px; overflow-y: auto; }
.people-list li { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 14px; }
.people-list li + li { border-top: 1px solid rgba(255,255,255,.06); }
.people-list .pa { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none;
  background: linear-gradient(150deg, rgba(255,255,255,.26), rgba(255,255,255,.08)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.people-list .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.people-list .pi { color: var(--muted); display: flex; gap: 6px; }
.people-list .pi svg { width: 17px; height: 17px; }
.people-list .pi .off { color: var(--red); }

/* dock */
.dock-wrap { display: flex; justify-content: center; padding: 14px 12px calc(16px + env(safe-area-inset-bottom)); }
.dock { display: flex; align-items: center; gap: 6px; padding: 8px; animation: rise .7s var(--ease) both; }
.dock-sep { width: 1px; height: 26px; background: rgba(255,255,255,.16); margin: 0 4px; }
.ctl { position: relative; width: 50px; height: 50px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer;
  transition: background .25s var(--ease), color .25s, transform .25s var(--ease); }
.ctl:hover { background: rgba(255,255,255,.12); }
.ctl:active { transform: scale(.9); }
.ctl.off { background: rgba(255,255,255,.92); color: #1c1c1e; }
.ctl.on { background: var(--blue); color: #fff; }
.ctl.danger { background: var(--red); color: #fff; width: 62px; border-radius: 999px; margin-left: 4px; box-shadow: 0 6px 20px -6px rgba(255,69,58,.6); }
.ctl.danger:hover { background: #ff5b52; }
.ctl .dot { position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px rgba(20,20,26,.8); }

/* cards, dialog, toasts */
.card { padding: 38px 34px; max-width: 420px; width: 100%; text-align: center; animation: rise .7s var(--ease) both; }
.card h2 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

dialog.glass { position: fixed; color: var(--text); border: 0; max-width: 500px; width: calc(100% - 32px); padding: 30px 30px 24px; border-radius: var(--r-xl);
  background: linear-gradient(150deg, rgba(60,60,70,.55), rgba(30,30,38,.55)); }
dialog::backdrop { background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
dialog[open] { animation: rise .45s var(--ease) both; }
dialog h3 { margin: 0 0 14px; font-size: 22px; letter-spacing: -.03em; }
dialog ul { padding-left: 18px; margin: 0 0 14px; }
dialog li { margin-bottom: 10px; color: rgba(235,235,245,.82); line-height: 1.5; }
dialog form { text-align: right; margin-top: 18px; }

.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; text-align: center;
  background: rgba(40,40,48,.55); -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 0 0 1px rgba(255,255,255,.08), 0 14px 40px -10px rgba(0,0,0,.6);
  animation: toastIn .5s var(--ease) both; transition: opacity .4s, transform .4s var(--ease); }
.toast.out { opacity: 0; transform: translateY(-8px) scale(.97); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .prejoin { grid-template-columns: 1fr; gap: 18px; max-width: 520px; }
  .side { position: fixed; inset: 10px 10px calc(96px + env(safe-area-inset-bottom)); width: auto; z-index: 20; }
  .topbar .badge span, .topinfo .title, .topinfo .sep { display: none; }
  .topinfo { padding: 8px 14px 8px 10px; }
  .stage { padding: 0 10px; }
  .grid { gap: 10px; }
}
@media (max-width: 480px) {
  .ctl { width: 42px; height: 42px; }
  .ctl svg { width: 20px; height: 20px; }
  .ctl.danger { width: 52px; }
  .dock { gap: 2px; padding: 6px; }
  .dock-sep { margin: 0 2px; }
  .tile { border-radius: 22px; }
  .prejoin-card { padding: 26px 22px 20px; }
}

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .tile .label, .tile .status, .toast { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: #1c1c22 !important; }
  .ambient { display: none; }
}
