/* Tabadul. Phone first; on a wide screen the app sits in a centered column. */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --ink: #1d1c19;
  --ink-2: #5c5850;
  --ink-3: #8f897e;
  --line: #e4ded3;
  --brand: #0e6b4f;
  --brand-ink: #ffffff;
  --brand-soft: #dcefe7;
  --accent: #e0803a;
  --danger: #c2412d;
  --online: #22a55b;
  --bubble-me: #0e6b4f;
  --bubble-me-ink: #ffffff;
  --bubble-them: #ffffff;
  --shadow: 0 1px 2px rgb(30 25 15 / 6%), 0 4px 16px rgb(30 25 15 / 6%);
  --radius: 16px;
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121412;
    --surface: #1b1e1b;
    --surface-2: #242823;
    --ink: #eeece6;
    --ink-2: #b4b0a6;
    --ink-3: #7f7b72;
    --line: #2d322c;
    --brand: #3fb489;
    --brand-ink: #08130e;
    --brand-soft: #1d3a2e;
    --bubble-me: #2d8f6b;
    --bubble-me-ink: #ffffff;
    --bubble-them: #242823;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }

#app {
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
@media (min-width: 600px) {
  #app { border-inline: 1px solid var(--line); }
}

/* ── bars ─────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.topbar .sub { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand b { font-size: 19px; letter-spacing: -0.01em; }
.brand span { color: var(--ink-3); font-size: 15px; font-family: "IBM Plex Sans Arabic", var(--font); }

.tabs {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--brand); }
.tabs .badge { position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); }

main { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ── pieces ───────────────────────────────────────────────── */

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.brand { color: var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 20px; height: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--size, 48px);
  height: var(--size, 48px);
  border-radius: 50%;
  background: var(--tint, var(--brand-soft));
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--size, 48px) * 0.4);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .dot {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 28%;
  height: 28%;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--surface);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.learn { background: var(--brand-soft); color: var(--brand); }
.pill.match { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.section-title { margin: 8px 4px 0; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

/* ── sign in ──────────────────────────────────────────────── */

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: calc(env(safe-area-inset-top) + 40px) 24px calc(env(safe-area-inset-bottom) + 32px);
}
.welcome .logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: var(--shadow); }
.welcome h1 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
.welcome h1 span { display: block; color: var(--brand); font-family: "IBM Plex Sans Arabic", var(--font); font-size: 28px; margin-top: 4px; }
.welcome p { margin: 0; color: var(--ink-2); font-size: 17px; }
.welcome .points { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.welcome .points li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); }
.welcome .points svg { flex: none; width: 22px; height: 22px; color: var(--brand); margin-top: 1px; }
.signin { display: grid; gap: 12px; justify-items: stretch; }
/* Google's button frame is light; matching its color scheme keeps the frame transparent in dark mode. */
.signin .google { min-height: 44px; display: flex; justify-content: center; color-scheme: light; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 14px; font-weight: 500; }
.notice.warn { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.dev-row { display: flex; gap: 8px; }
.dev-row .btn { flex: 1; }

/* ── forms ────────────────────────────────────────────────── */

form.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--ink-3); font-size: 13px; }
input[type="text"], textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
  font-size: 16px;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 88px; }
.lang-list { display: grid; gap: 8px; }
.lang-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.lang-row b { flex: 1; font-weight: 600; }
.lang-row select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; margin-top: 1px; }
.rules { margin: 0; padding: 14px 16px 14px 34px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }

/* ── partner list ─────────────────────────────────────────── */

.person {
  display: flex;
  gap: 14px;
  padding: 14px;
  text-align: start;
  width: 100%;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.person .info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.person .top { display: flex; align-items: baseline; gap: 8px; }
.person .top b { font-size: 16.5px; }
.person .top .when { margin-inline-start: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.person .intro { color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mine { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 2px 4px; }

/* ── chats list ───────────────────────────────────────────── */

.chat-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}
.chat-row + .chat-row { border-top: 1px solid var(--line); }
.chat-row .info { flex: 1; min-width: 0; }
.chat-row .line { display: flex; gap: 8px; align-items: baseline; }
.chat-row .line b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .line time { font-size: 12.5px; color: var(--ink-3); }
.chat-row .last { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 14px; }
.chat-row .last span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.unread .last span { color: var(--ink); font-weight: 600; }

/* ── one chat ─────────────────────────────────────────────── */

.chat-head { gap: 8px; padding-inline: 8px; }
.chat-head .who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head .who > div { flex: 1; min-width: 0; }
.chat-head .who b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who small { color: var(--ink-3); font-size: 12.5px; }
.chat-head .who small.on { color: var(--online); font-weight: 600; }

.thread { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; overflow-y: auto; }
.bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 18px;
  background: var(--bubble-them);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  align-self: flex-start;
  unicode-bidi: plaintext;
}
.bubble.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-ink); border-color: transparent; }
.bubble time { display: block; margin-top: 2px; font-size: 11px; opacity: 0.65; text-align: end; }
.bubble + .bubble.me, .bubble.me + .bubble:not(.me) { margin-top: 6px; }
.call-log {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}
.call-log svg { width: 16px; height: 16px; }
.call-log.missed { color: var(--danger); }
.day { align-self: center; margin: 10px 0 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.intro-card { padding: 20px; display: grid; gap: 10px; justify-items: center; text-align: center; margin: 8px 0 16px; }
.intro-card p { margin: 0; color: var(--ink-2); }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.starters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; }

.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.composer textarea { min-height: 44px; max-height: 140px; border-radius: 22px; padding: 11px 16px; resize: none; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); border: 0; display: grid; place-items: center; flex: none; }
.composer .send svg { width: 20px; height: 20px; }
.blocked-bar { padding: 14px 16px calc(env(safe-area-inset-bottom) + 14px); text-align: center; color: var(--ink-3); border-top: 1px solid var(--line); font-size: 14px; }

/* ── sheets, menus, toast ─────────────────────────────────── */

.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 40%);
  animation: fade 0.15s ease-out;
}
.sheet {
  width: min(560px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px);
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  display: grid;
  gap: 12px;
  animation: rise 0.2s ease-out;
}
.sheet h2 { margin: 0 0 4px; font-size: 19px; }
.sheet .reasons { display: grid; gap: 8px; }
.sheet .reasons label { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.sheet .reasons input { accent-color: var(--brand); width: 18px; height: 18px; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; }

/* ── calls ────────────────────────────────────────────────── */

.ring {
  position: fixed;
  inset-inline: 12px;
  top: calc(env(safe-area-inset-top) + 12px);
  z-index: 70;
  max-width: 536px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: #16201b;
  color: #fff;
  box-shadow: 0 12px 40px rgb(0 0 0 / 35%);
  animation: rise 0.25s ease-out;
}
.ring .info { flex: 1; min-width: 0; }
.ring .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring .info small { opacity: 0.75; }
.round {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(255 255 255 / 16%);
  flex: none;
}
.round svg { width: 24px; height: 24px; }
.round.accept { background: #22a55b; animation: pulse 1.4s ease-in-out infinite; }
.round.end { background: #e0483a; }
.round.off { background: #fff; color: #16201b; }

.call {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  flex-direction: column;
  background: #0d1411;
  color: #fff;
}
.call video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0d1411; }
.call.audio video.remote, .call.waiting video.remote { visibility: hidden; }
.call video.local {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 16px);
  inset-inline-end: 16px;
  z-index: 2;
  width: 104px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  background: #1f2a24;
  box-shadow: 0 6px 20px rgb(0 0 0 / 40%);
  transform: scaleX(-1);
}
.call.audio video.local { display: none; }
.call video.local.back-camera { transform: none; }
.call .stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
.call.video:not(.waiting) .stage { justify-content: flex-start; padding-top: calc(env(safe-area-inset-top) + 22px); align-items: flex-start; text-shadow: 0 1px 4px rgb(0 0 0 / 60%); }
.call.video:not(.waiting) .stage .avatar { display: none; }
.call .stage b { font-size: 24px; }
.call .stage .status { opacity: 0.8; font-variant-numeric: tabular-nums; }
.call .controls {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 20px 20px calc(env(safe-area-inset-bottom) + 28px);
  background: linear-gradient(transparent, rgb(0 0 0 / 55%));
}
.call .controls .round { width: 60px; height: 60px; }
.call .controls .round svg { width: 26px; height: 26px; }

/* ── rooms ────────────────────────────────────────────────── */

.rooms-list { display: grid; gap: 12px; }
.room-card { padding: 14px; display: grid; gap: 12px; }
.room-head { display: flex; gap: 12px; align-items: flex-start; }
.room-head .info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.room-head .info b { font-size: 16.5px; }
.room-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.room-icon.video { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.room-icon svg { width: 22px; height: 22px; }
.room-foot { display: flex; align-items: center; gap: 12px; }
.room-foot .faces { flex: 1; display: flex; align-items: center; }
.room-foot .faces .avatar + .avatar { margin-inline-start: -8px; box-shadow: 0 0 0 2px var(--surface); }
.pill.live { background: color-mix(in srgb, var(--online) 16%, transparent); color: var(--online); font-weight: 700; }
.pill.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }

.room-call { background: #0d1411; }
.room-top { position: relative; z-index: 2; display: flex; align-items: baseline; gap: 10px; padding: calc(env(safe-area-inset-top) + 18px) 20px 10px; }
.room-top b { font-size: 20px; }
.room-kind { opacity: 0.7; font-size: 14px; }
.room-call .grid {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 0 12px;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  min-height: 0;
}
.room-call .grid[data-count="2"] { grid-template-rows: 1fr 1fr; }
.room-call .grid[data-count="3"] { grid-template-columns: 1fr 1fr; }
.room-call .grid[data-count="3"] .tile:first-child { grid-column: span 2; }
.room-call .grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
.room-call .grid:empty { display: none; }
.tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #1a2620;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile audio { display: none; }
.tile .name {
  position: absolute;
  inset-inline-start: 10px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 45%);
  font-size: 13px;
  font-weight: 600;
}
.tile[data-state="connecting"] .name::after, .tile[data-state="new"] .name::after { content: " · connecting"; opacity: 0.7; font-weight: 400; }
.room-status { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; opacity: 0.75; text-align: center; padding: 20px; }
.room-status:empty { display: none; }
.room-call video.self {
  position: absolute;
  inset-inline-end: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 118px);
  z-index: 3;
  width: 92px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  background: #1f2a24;
  box-shadow: 0 6px 20px rgb(0 0 0 / 40%);
  transform: scaleX(-1);
}
.room-call video.self.back-camera { transform: none; }

/* ── minimized calls and rooms ────────────────────────────── */

.call .minimize {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  inset-inline-start: 12px;
  z-index: 4;
  color: #fff;
  background: rgb(0 0 0 / 30%);
}
.room-call .minimize { position: static; flex: none; margin-inline-start: -6px; }
.mini-bar { display: none; }
.call.mini {
  inset: auto;
  inset-inline-end: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 76px);
  width: 156px;
  height: 208px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgb(0 0 0 / 40%);
  cursor: pointer;
}
.call.mini > :not(video.remote, .mini-bar, .grid) { display: none !important; }
.call.mini video.local, .call.mini .room-top, .call.mini .room-status { display: none; }
.call.mini .mini-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: linear-gradient(transparent, rgb(0 0 0 / 70%));
}
.mini-info { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.mini-info b, .mini-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mini-info small { opacity: 0.8; font-size: 12px; font-variant-numeric: tabular-nums; }
.mini-bar .round { width: 38px; height: 38px; }
.mini-bar .round svg { width: 18px; height: 18px; }
.mini-bar .avatar { --size: 32px !important; }
/* Voice calls and voice rooms shrink to a pill: there is no picture to show. */
.call.audio.mini { width: min(320px, calc(100% - 24px)); height: 60px; border-radius: 999px; }
.call.audio.mini .mini-bar { background: none; padding: 10px 10px 10px 12px; }
.call.audio.mini .grid { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.room-call.mini .grid { padding: 4px; gap: 4px; flex: 1; }
.room-call.mini .tile .name { display: none; }
.room-call.mini.video .mini-bar .room-icon { display: none; }
.room-call .mini-bar .room-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgb(255 255 255 / 14%); flex: none; }
.room-call .mini-bar .room-icon svg { width: 18px; height: 18px; }

/* ── talking, room chat, seen ─────────────────────────────── */

.tile { transition: box-shadow 0.15s; }
.tile.speaking { box-shadow: inset 0 0 0 3px #3fd67f, 0 0 18px rgb(63 214 127 / 35%); }
.round.chat-btn { position: relative; }
.round.chat-btn .badge { position: absolute; top: -2px; inset-inline-end: -2px; }
.room-chat {
  display: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 5;
  max-height: 62%;
  flex-direction: column;
  background: #16201b;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgb(0 0 0 / 35%);
  padding-bottom: env(safe-area-inset-bottom);
}
.room-call.chatting .room-chat { display: flex; }
.room-chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px 18px; }
.room-chat-head b { flex: 1; }
.room-chat-head .small { opacity: 0.6; }
.room-chat-head .icon-btn { color: #fff; }
.room-chat-list { flex: 1; overflow-y: auto; padding: 4px 18px 10px; display: grid; gap: 8px; align-content: start; min-height: 120px; }
.room-msg { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.room-msg b { color: #8fe0b6; }
.room-msg.me b { color: #f2b27c; }
.room-msg time { margin-inline-start: 6px; font-size: 11px; opacity: 0.5; }
.room-chat-input { display: flex; gap: 8px; padding: 8px 12px 12px; }
.room-chat-input input {
  flex: 1;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 22px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font-size: 16px;
  outline: none;
}
.room-chat-input .send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #2d8f6b; color: #fff; display: grid; place-items: center; }
.room-chat-input .send svg { width: 20px; height: 20px; }
.seen { align-self: flex-end; margin: -1px 6px 4px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

/* ── corrections ──────────────────────────────────────────── */

.bubble[role="button"] { cursor: pointer; }
.bubble[role="button"]:active { filter: brightness(0.96); }
.correction {
  align-self: flex-start;
  max-width: 82%;
  margin: 4px 0;
  padding: 10px 13px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface));
}
.correction.me { align-self: flex-end; }
.corr-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand); }
.corr-label svg { width: 15px; height: 15px; }
.corr-diff { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.corr-diff del { color: var(--danger); text-decoration-thickness: 2px; background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 4px; padding: 0 2px; }
.corr-diff ins { color: var(--brand); text-decoration: none; font-weight: 600; background: color-mix(in srgb, var(--brand) 14%, transparent); border-radius: 4px; padding: 0 2px; }
.corr-note { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); font-style: italic; }
.correction time { display: block; margin-top: 2px; font-size: 11px; opacity: 0.6; text-align: end; }
.quote { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── voice messages ───────────────────────────────────────── */

.composer .mic-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--brand); }
.composer:not(.has-text) > .send { display: none; }
.composer.has-text > .mic-btn { display: none; }
.composer .rec-bar { display: none; }
.composer.recording > :not(.rec-bar) { display: none; }
.composer.recording .rec-bar { display: flex; flex: 1; align-items: center; gap: 10px; min-height: 44px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s ease-in-out infinite; }
.rec-label { font-weight: 600; }
.rec-time { flex: 1; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rec-bar .send { display: grid; }
@keyframes blink { 50% { opacity: 0.25; } }
.voice-bubble { min-width: 220px; }
.voice { display: flex; align-items: center; gap: 10px; }
.voice audio { display: none; }
.voice-play { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--brand); color: var(--brand-ink); }
.bubble.me .voice-play { background: rgb(255 255 255 / 22%); color: #fff; }
.voice-play svg { width: 18px; height: 18px; fill: currentColor; }
.voice-bar { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 22%, transparent); overflow: hidden; }
.voice-bar i { display: block; height: 100%; width: 0; background: currentColor; transition: width 0.2s linear; }
.voice-time { font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: 0.8; min-width: 32px; text-align: end; }
[dir="rtl"] svg[data-icon="play"] { transform: scaleX(-1); }

/* ── languages and right-to-left ──────────────────────────── */

[dir="rtl"] svg[data-icon="back"], [dir="rtl"] svg[data-icon="send"] { transform: scaleX(-1); }
[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
.welcome-top { display: flex; align-items: flex-start; justify-content: space-between; }
.lang-switch {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
}
.lang-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; font-weight: 600; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.segmented button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--ink-2); font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ── admin ────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats .card { padding: 12px; display: grid; gap: 2px; }
.stats b { font-size: 24px; }
.stats span { font-size: 12.5px; color: var(--ink-3); }
input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
  font-size: 16px;
}
.members { padding: 4px 0; }
.member-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: start;
}
.member-row + .member-row { border-top: 1px solid var(--line); }
.member-row .info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.member-row .line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.member-row .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgb(34 165 91 / 0%); } 0%, 100% { box-shadow: 0 0 0 0 rgb(34 165 91 / 50%); } }

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