@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --brand: #0e7490;
  --brand-2: #155e75;
  --mine: #e0f2fe;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 16px;
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.8; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; padding: 8px 14px; background: var(--brand); color: #fff; border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; text-align: left; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
[hidden] { display: none !important; }

.shell { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .25); width: min(100%, 920px); }

/* Join */
.join { width: min(100%, 420px); padding: 32px; }
.join h1 { font-size: 1.5rem; margin: 0 0 6px; }
.join > p { margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.field input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 116, 144, .18); }
.field input[aria-invalid="true"] { border-color: var(--err); }
.err { min-height: 20px; color: var(--err); font-size: 14px; margin-top: 4px; }
.status { min-height: 24px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.status.is-err { color: var(--err); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 12px; border: 1.5px solid transparent; font: inherit; font-weight: 700; cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not([disabled]) { background: var(--brand-2); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f1f5f9; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.chat { height: min(86vh, 720px); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.chat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chat__head h1 { font-size: 1.2rem; margin: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); margin-inline-end: 8px; vertical-align: middle; }
.dot.is-on { background: var(--ok); }
.dot.is-err { background: var(--err); }
.layout { display: grid; grid-template-columns: 1fr 200px; min-height: 0; }
.messages { list-style: none; margin: 0; padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg { max-width: 75%; padding: 8px 14px; border-radius: 14px; background: #f1f5f9; align-self: flex-start; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--mine); }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 14px; max-width: 100%; }
.msg__who { display: block; font-size: 13px; font-weight: 700; color: var(--brand-2); }
.msg__text { white-space: pre-wrap; }
.msg__time { display: block; font-size: 12px; color: var(--muted); }
.people { border-inline-start: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.small-title { font-size: 15px; margin: 0 0 10px; }
.people ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { font-size: 15px; padding: 4px 8px; border-radius: 8px; background: #f8fafc; }
.composer { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.composer input {
  flex: 1; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: #fff;
}
.composer input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 116, 144, .18); }

@media (max-width: 680px) {
  .layout { grid-template-columns: 1fr; }
  .people { display: none; }
  .msg { max-width: 88%; }
  .chat { height: 100vh; border-radius: 0; width: 100%; }
  .shell { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
