:root {
  --bg: #0b1220; --panel: #121a2b; --panel2: #1a2438; --line: #26324a; --text: #e8edf6; --muted: #8a97ad;
  --accent: #22c55e; --accent2: #16a34a; --mine: #1d3557; --theirs: #1f2a1f; --warn: #f59e0b; --err: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
[lang="ar"], [dir="rtl"] { font-family: "Noto Naskh Arabic", Inter, sans-serif; }
[lang="ur"] { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", sans-serif; line-height: 2.1; }
[hidden] { display: none !important; }
.screen { min-height: 100dvh; }
#home, #join { display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: grid; gap: 14px; }
h1 { margin: 0; font-size: 24px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
button { cursor: pointer; }
.primary { background: var(--accent); border-color: var(--accent); color: #04130a; font-weight: 700; font-size: 17px; padding: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.warn { color: var(--warn); }

#room { display: grid; grid-template-rows: auto auto 1fr auto; height: 100dvh; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.title { font-weight: 700; }
.tag { font-size: 11px; font-weight: 700; background: #f59e0b; color: #1a1200; border-radius: 6px; padding: 2px 6px; margin-inline-start: 6px; vertical-align: middle; }
.chk.fast { color: #fbbf24; font-weight: 600; }
.msg.typing { border-style: dashed; opacity: .85; }
.peers { font-size: 13px; color: var(--muted); margin-top: 2px; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.ok .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status.wait .dot { background: var(--warn); }
.status.err .dot { background: var(--err); }
.status.err { color: var(--err); }

.share { padding: 12px 16px; display: grid; gap: 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.share.compact .muted, .share.compact .wa { display: none; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; min-width: 0; direction: ltr; font-size: 14px; }
.wa { display: block; text-align: center; background: #25d366; color: #052e14; font-weight: 700; padding: 12px; border-radius: 10px; text-decoration: none; }

.feed { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; background: var(--theirs); border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; background: var(--mine); }
.msg.theirs { align-self: flex-start; }
[dir="rtl"] .msg.mine { align-self: flex-start; } [dir="rtl"] .msg.theirs { align-self: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .main { font-size: 20px; line-height: 1.6; }
.msg.mine .main { font-size: 16px; }
.msg .orig { font-size: 13px; color: var(--muted); margin-top: 4px; }
.msg.mine .orig { color: #b9d3ff; font-size: 15px; }
.dots { display: flex; gap: 4px; padding: 6px 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: b 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes b { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }

.controls { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); display: grid; gap: 10px; }
.meter { height: 4px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
#level { height: 100%; width: 0; background: var(--accent); transition: width .06s linear; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row select { max-width: 130px; }
.mic { width: 72px; height: 72px; border-radius: 50%; font-size: 30px; background: var(--panel2); border: 2px solid var(--line); touch-action: none; user-select: none; }
.mic.on { background: var(--accent2); border-color: var(--accent); box-shadow: 0 0 0 6px rgba(34, 197, 94, .18); }
.more { display: grid; gap: 10px; padding-top: 4px; }
.chk { display: flex; align-items: center; gap: 8px; color: var(--text); }
.chk input { width: 20px; height: 20px; }
.rng { display: flex; align-items: center; gap: 10px; color: var(--text); }
.rng input { flex: 1; padding: 0; }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: #000c; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; text-align: center; z-index: 9; }
