:root {
  --bg: #0b0f14;
  --card: #121821;
  --card2: #18212d;
  --line: #24303f;
  --text: #e8eef5;
  --muted: #93a2b4;
  --accent: #22c55e;
  --accent-ink: #04130a;
  --danger: #ef4444;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #14202b 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans SC", "Noto Naskh Arabic", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
html[dir="rtl"] body { font-family: "Vazirmatn", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif; }
html[lang="zh"] body { font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: .2px; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px 7px 7px 6px; border-radius: 3px; background: var(--accent-ink); }
.top-right { display: flex; align-items: center; gap: 8px; }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
main:has(#meet:not([hidden])) { max-width: 1100px; }

.view { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

h1 { font-size: clamp(24px, 5vw, 34px); line-height: 1.2; margin: 18px 0 10px; letter-spacing: -.4px; }
h2 { font-size: 22px; margin: 16px 0 6px; }
.sub { color: var(--muted); margin: 0 0 18px; max-width: 58ch; }

.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.f.compact { min-width: 0; }
input, select, button { font: inherit; }
input, select {
  width: 100%; color: var(--text); background: #0d131b;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
html[dir="rtl"] select { background-position: 13px 50%, 18px 50%; }
input:focus-visible, select:focus-visible, button:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
.lang-select { width: auto; min-height: 36px; padding: 6px 30px 6px 10px; border-radius: 999px; font-size: 14px; }
html[dir="rtl"] .lang-select { padding: 6px 10px 6px 30px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 12px; padding: 11px 16px; min-height: 46px; cursor: pointer;
  transition: transform .06s, background .15s, border-color .15s;
  font-weight: 600;
}
.btn:hover { border-color: #33455a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: #2fd46b; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
.btn[disabled] { opacity: .55; cursor: default; }
.joinline { display: flex; gap: 10px; }
.joinline input { text-transform: lowercase; letter-spacing: 1px; }
.msg { min-height: 1.2em; font-size: 14px; color: var(--muted); }
.msg.err { color: #fca5a5; }
.msg.ok { color: #86efac; }

.facts { list-style: none; padding: 0; margin: 18px 4px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }

.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); letter-spacing: 1px; }

.wait { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.meet-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.meet-bar .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pending { border: 1px solid #3b4c2a; background: #16210f; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.pending h3 { margin: 0 0 8px; font-size: 14px; color: #bef264; font-weight: 600; }
.pending ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pending li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pending .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }

.tile {
  position: relative; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(180deg, #16202b, #10161f);
  padding: 12px; min-height: 120px; display: flex; flex-direction: column; gap: 8px;
  overflow: hidden; transition: border-color .2s, box-shadow .2s;
}
.tile speaking { border-color: rgba(34, 197, 94, .65); box-shadow: 0 0 0 1px rgba(34,197,94,.35), 0 0 24px rgba(34,197,94,.12); }
.tile .tile-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #05230f; background: linear-gradient(135deg, #4ade80, #22c55e); font-size: 14px; }
.tile.host .avatar { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #2a1a00; }
.tile .who { min-width: 0; display: grid; }
.tile .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .lg { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .last { color: var(--muted); font-size: 13px; margin-top: auto; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .last b { color: var(--text); font-weight: 500; }
.tile .badges { display: flex; gap: 4px; }
.tile .badges span { font-size: 10px; border-radius: 6px; padding: 1px 5px; background: #0d131b; border: 1px solid var(--line); color: var(--muted); }
.tile .kick { position: absolute; top: 8px; inset-inline-end: 8px; min-height: 0; padding: 2px 8px; font-size: 12px; border-radius: 8px; }
.eq { position: absolute; bottom: 10px; inset-inline-end: 10px; display: none; gap: 3px; align-items: flex-end; height: 14px; }
.tile.speaking .eq { display: flex; }
.eq i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; }
.eq i:nth-child(3) { animation-delay: .3s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

.langbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
@media (min-width: 720px) { .langbar { grid-template-columns: repeat(4, minmax(0, 1fr)); } .langbar .f:nth-child(1) { grid-column: span 2; } }

.controls { display: flex; justify-content: center; gap: 14px; padding: 8px 0 4px; }
.ctl {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--card2); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.ctl:active { transform: scale(.96); }
.ctl[aria-pressed="false"] { background: #2a1414; border-color: #5b2525; }
.ctl.danger { background: var(--danger); border-color: transparent; }
.ctl .ic { display: block; width: 22px; height: 22px; background: currentColor; }
.ctl .ic { -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.ctl .ic:not(.cc):not(.spk):not(.hang) { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.9V21h2v-3.1A7 7 0 0 0 19 11z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.9V21h2v-3.1A7 7 0 0 0 19 11z'/%3E%3C/svg%3E"); }
#micBtn.off .ic { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3l18 18-1.4 1.4L17 18.8A7 7 0 0 1 13 20.9V24h-2v-3.1A7 7 0 0 1 5 14h2a5 5 0 0 0 7.4 4.4l-1.5-1.5a3 3 0 0 1-3.9-3.9L3 4.4zM19 11h-2a5 5 0 0 0-.2-1.4l1.6 1.6c.1.3.2.6.2.8zM12 2a3 3 0 0 1 3 3v5.2l-2-2V5a1 1 0 0 0-2 0v1.2L9 4.2V5a3 3 0 0 1 3-3z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3l18 18-1.4 1.4L17 18.8A7 7 0 0 1 13 20.9V24h-2v-3.1A7 7 0 0 1 5 14h2a5 5 0 0 0 7.4 4.4l-1.5-1.5a3 3 0 0 1-3.9-3.9L3 4.4zM19 11h-2a5 5 0 0 0-.2-1.4l1.6 1.6c.1.3.2.6.2.8zM12 2a3 3 0 0 1 3 3v5.2l-2-2V5a1 1 0 0 0-2 0v1.2L9 4.2V5a3 3 0 0 1 3-3z'/%3E%3C/svg%3E"); }
.ctl .ic.spk { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4zm11.5-1.5a5 5 0 0 1 0 9v-2a3 3 0 0 0 0-5zM17 4a9 9 0 0 1 0 16v-2a7 7 0 0 0 0-12z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4zm11.5-1.5a5 5 0 0 1 0 9v-2a3 3 0 0 0 0-5zM17 4a9 9 0 0 1 0 16v-2a7 7 0 0 0 0-12z'/%3E%3C/svg%3E"); }
.ctl .ic.cc { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 3V6a2 2 0 0 1 2-2zm3 5a3 3 0 0 0 0 4h1.5l-.7-1.6h-.8a1.2 1.2 0 0 1 0-1.8h.9L9 8.4zm6 0a3 3 0 0 0-2.6 1.5l1.3.8a1.2 1.2 0 0 1 1.3-.5 1.2 1.2 0 0 1 1.2.9l1.5-.7A3 3 0 0 0 13 9z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 3V6a2 2 0 0 1 2-2zm3 5a3 3 0 0 0 0 4h1.5l-.7-1.6h-.8a1.2 1.2 0 0 1 0-1.8h.9L9 8.4zm6 0a3 3 0 0 0-2.6 1.5l1.3.8a1.2 1.2 0 0 1 1.3-.5 1.2 1.2 0 0 1 1.2.9l1.5-.7A3 3 0 0 0 13 9z'/%3E%3C/svg%3E"); }
.ctl .ic.hang { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 9c-1.6 0-3.2.3-4.7.8L2.4 14.4a1 1 0 0 0-.3 1.4l2 3a1 1 0 0 0 1.3.4l3.6-1.5V15c1-.3 1.9-.5 3-.5s2 .2 3 .5v2.7l3.6 1.5a1 1 0 0 0 1.3-.4l2-3a1 1 0 0 0-.3-1.4l-4.9-4.6c-1.5-.5-3.1-.8-4.7-.8z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 9c-1.6 0-3.2.3-4.7.8L2.4 14.4a1 1 0 0 0-.3 1.4l2 3a1 1 0 0 0 1.3.4l3.6-1.5V15c1-.3 1.9-.5 3-.5s2 .2 3 .5v2.7l3.6 1.5a1 1 0 0 0 1.3-.4l2-3a1 1 0 0 0-.3-1.4l-4.9-4.6c-1.5-.5-3.1-.8-4.7-.8z'/%3E%3C/svg%3E"); }
#ttsBtn[aria-pressed="false"] .ic, #ccBtn[aria-pressed="false"] .ic { opacity: .45; }

.captions { margin-top: 12px; display: grid; gap: 6px; max-height: 34vh; overflow-y: auto; padding: 2px; scroll-behavior: smooth; }
.captions:empty { display: none; }
.cap { font-size: 14px; line-height: 1.45; color: var(--muted); background: #0e141c; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.cap b { color: var(--text); }
.cap .orig { font-size: 12px; opacity: .7; display: block; }
.cap.live { opacity: .7; }


.foot { text-align: center; color: #5b6b7e; font-size: 12px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }

@media (max-width: 480px) {
  .top { padding-top: 10px; padding-bottom: 10px; }
  .card { padding: 14px; }
  .controls { gap: 10px; }
  .ctl { width: 52px; height: 52px; }
  #ttl { display: none !important; }
}
