@font-face {
  font-family: "Vazirmatn";
  src: url("/vazirmatn.woff2") format("woff2-variations"), url("/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --tq: #22c2b4;
  --tq-l: #4fd8cb;
  --tq-d: #0fa89b;
  --bg: #0d0e11;
  --surface: #15171c;
  --surface2: #1c1f26;
  --border: #2a2e39;
  --text: #f6f7f9;
  --muted: #8792ab;
  --danger: #f83b47;
  --warn: #ffa520;
  --ok: #6aae33;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
svg.ico { width: 20px; height: 20px; flex-shrink: 0; display: block; }
svg.ico-sm { width: 15px; height: 15px; flex-shrink: 0; display: block; }
svg.ico-lg { width: 28px; height: 28px; flex-shrink: 0; display: block; }
.hidden { display: none !important; }

/* ---------- Lobby ---------- */
.lobby {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 15%, rgba(25, 195, 177, .15), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(25, 195, 177, .10), transparent 40%),
    var(--bg);
}
.home-card {
  width: min(500px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}
.brand.center {
  flex-direction: column;
  text-align: center;
  margin-bottom: 22px;
}
.brand-icon.lg { width: 62px; height: 62px; font-size: 30px; border-radius: 18px; }
.btn-primary.lg { width: 100%; padding: 15px 18px; font-size: 16px; }
.btn-primary.sm { flex: 0 0 auto; padding: 10px 14px; font-size: 13px; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12.5px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.join-code-row { display: flex; gap: 8px; }
.join-code-row input { flex: 1; }
.created-box { text-align: center; }
.created-badge {
  display: inline-block;
  background: rgba(25, 195, 177, .14);
  color: var(--tq-l);
  border: 1px solid rgba(25, 195, 177, .35);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 10px;
}
.created-hint { font-size: 13.5px; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }
.share-link-box { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link-box input { flex: 1; font-size: 13px; color: var(--tq-l); }
.created-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.created-actions .btn-primary { min-width: 150px; }
.req { color: var(--danger); }
.link-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  margin-top: 12px;
  text-align: right;
  padding: 2px 0;
}
.link-btn:hover { color: var(--tq-l); }
.lobby-card {
  width: min(960px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}
.lobby-preview {
  position: relative;
  background: #020808;
  border-radius: 18px;
  overflow: hidden;
  min-height: 320px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.lobby-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.preview-off {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: radial-gradient(circle, #0e2426, #040d0e);
}
.avatar-lg {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 700;
  color: #032321;
  background: linear-gradient(135deg, var(--tq-l), var(--tq-d));
}
.preview-controls {
  position: absolute;
  bottom: 16px;
  display: flex;
  gap: 12px;
  z-index: 2;
}
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(13, 32, 34, .85);
  backdrop-filter: blur(8px);
  cursor: pointer;
  font-size: 20px;
  display: grid;
  place-items: center;
  transition: .15s;
}
.icon-btn:hover { border-color: var(--tq); transform: scale(1.05); }
.icon-btn.off { background: var(--danger); border-color: var(--danger); }
.mic-meter {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,.08);
}
.mic-meter-bar {
  height: 100%;
  width: 0%;
  background: var(--tq);
  transition: width 80ms linear;
}

.lobby-form { display: flex; flex-direction: column; justify-content: center; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, var(--tq-l), var(--tq-d));
  display: grid; place-items: center; font-size: 22px;
}
.brand h1 { font-size: 22px; }
.brand p { font-size: 13px; color: var(--muted); margin-top: 2px; }

label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 5px; }
input, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}
input:focus, select:focus { border-color: var(--tq); box-shadow: 0 0 0 3px rgba(25, 195, 177, .18); }
.room-row { display: flex; gap: 8px; }
.room-status { font-size: 12.5px; color: var(--tq-l); margin-top: 6px; min-height: 18px; }
.device-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.lobby-actions { display: flex; gap: 10px; margin-top: 18px; }

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--tq), var(--tq-d));
  color: #042a29;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.btn-outline:hover { border-color: var(--tq); }
.btn-outline.sm { padding: 8px 12px; font-size: 13px; width: 100%; }
.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
}
.err-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Call View ---------- */
.call-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 54px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.top-right, .top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}
.brand-mini {
  font-weight: 700;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sep { color: var(--border); flex-shrink: 0; }
.room-pill, .timer-pill, .lock-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lock-badge { color: var(--warn); border-color: rgba(255,165,32,.4); }
.chip-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip-btn:hover { border-color: var(--tq); }
.chip-btn.primary-chip {
  border-color: rgba(34, 194, 180, .38);
  color: var(--tq-l);
}
.net-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.net-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.net-badge.warn .dot { background: var(--warn); }
.net-badge.bad .dot { background: var(--danger); }

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 12px;
  gap: 12px;
}
.media-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.media-area.has-stage {
  display: grid;
  grid-template-columns: 1fr 240px;
}
.stage-wrap {
  position: relative;
  background: #000;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
}
.stage-wrap video { width: 100%; height: 100%; object-fit: contain; }
.stage-bar {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.stage-bar span, .stage-actions { pointer-events: auto; }
#stageLabel {
  background: rgba(7, 19, 20, .8);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--tq-l);
}
.stage-actions { display: flex; gap: 6px; }
.mini-btn {
  background: rgba(7, 19, 20, .8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

/* Grid */
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(140px, 1fr);
}
.media-area.has-stage .grid {
  grid-template-columns: 1fr;
  grid-auto-rows: 150px;
  overflow-y: auto;
  align-content: start;
}

.tile {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: border-color .15s, box-shadow .15s;
}
.tile.speaking {
  border-color: var(--tq);
  box-shadow: 0 0 0 2px rgba(25, 195, 177, .35);
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile.self video.cam-video { transform: scaleX(-1); }
.tile-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #102a2d, #071314);
}
.tile-avatar .av {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700; color: #032321;
  background: linear-gradient(135deg, var(--tq-l), var(--tq-d));
}
.tile-footer {
  position: absolute;
  bottom: 8px; right: 8px; left: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.tile-name {
  background: rgba(7, 19, 20, .78);
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  max-width: 75%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-badges { display: flex; gap: 4px; }
.tile-badge {
  background: rgba(7, 19, 20, .82);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 12px;
}
.tile-pin {
  position: absolute;
  top: 8px; left: 8px;
  opacity: 0;
  background: rgba(7, 19, 20, .8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
  transition: opacity .15s;
}
.tile:hover .tile-pin { opacity: 1; }

/* Side Panel */
.side-panel {
  width: 330px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.side-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 8px;
  gap: 6px;
}
.side-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}
.side-tab.active { background: var(--surface2); color: var(--tq-l); font-weight: 600; }
.close-side {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 16px;
}
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-item {
  background: var(--surface2);
  border-radius: 12px;
  padding: 8px 11px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--tq-l);
  margin-bottom: 3px;
}
.chat-meta span:last-child { color: var(--muted); }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.chat-form input { flex: 1; padding: 9px 12px; }
.chat-form button {
  background: var(--tq);
  color: #032321;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
}

.host-controls { padding: 10px; border-bottom: 1px solid var(--border); }
.people-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13.5px;
}
.person-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person-av {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #032321;
  background: linear-gradient(135deg, var(--tq-l), var(--tq-d));
  flex-shrink: 0;
}
.person-actions { display: flex; align-items: center; gap: 6px; }
.p-act {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
}
.p-act.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Bottom Bar */
.bottom-bar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.bar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: center;
}
.bar-sep {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}
.mob-only { display: none; }
.more-wrap { position: relative; }
.more-menu {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  width: 185px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
  z-index: 35;
}
.more-menu button {
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  text-align: right;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text);
}
.more-menu button:hover, .more-menu button.on {
  background: var(--surface2);
  color: var(--tq-l);
}
.ctrl-btn {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  font-size: 19px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: .15s;
}
.ctrl-btn:hover { border-color: var(--tq); transform: translateY(-1px); }
.ctrl-btn.on { background: var(--tq); color: #032321; border-color: var(--tq); }
.ctrl-btn.off { background: var(--danger); border-color: var(--danger); }
.ctrl-btn.end { background: var(--danger); border-color: var(--danger); width: 64px; border-radius: 24px; }
.badge {
  position: absolute;
  top: -4px; left: -4px;
  background: var(--tq);
  color: #032321;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.react-wrap { position: relative; }
.react-menu {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  display: flex;
  gap: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  z-index: 20;
}
.react-menu button {
  background: transparent;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  transition: transform .12s;
}
.react-menu button:hover { transform: scale(1.25); }

.reactions-layer {
  position: fixed;
  bottom: 84px;
  left: 24px;
  right: 24px;
  pointer-events: none;
  z-index: 30;
}
.float-react {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatUp 2.6s ease-out forwards;
}
.float-react .em { font-size: 34px; }
.float-react .nm {
  font-size: 11px;
  background: rgba(7,19,20,.8);
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 2px;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(.7); }
  15% { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { opacity: 0; transform: translateY(-220px) scale(1.1); }
}

.captions-bar {
  position: fixed;
  bottom: 82px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 19, 20, .88);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 16px;
  max-width: min(90vw, 640px);
  font-size: 14px;
  z-index: 25;
}

/* Modal & Toasts */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal-card {
  width: min(92vw, 440px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.shortcut-box {
  margin-top: 14px;
  background: var(--surface2);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.toasts {
  position: fixed;
  top: 66px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--tq);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}

@media (max-width: 820px) {
  .lobby-card { grid-template-columns: 1fr; }
  .media-area.has-stage { grid-template-columns: 1fr; grid-template-rows: 1fr 140px; }
  .media-area.has-stage .grid { grid-auto-flow: column; grid-auto-columns: 160px; grid-template-rows: 1fr; overflow-x: auto; }
  .side-panel { position: fixed; inset: 54px 0 70px 0; width: 100%; border-radius: 0; z-index: 40; }
}

@media (max-width: 720px) {
  .hide-sm, .desk-only, .brand-text { display: none !important; }
  .mob-only { display: block; }
  .topbar { padding: 8px 12px; }
  .bottom-bar { min-height: 68px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .bar-group { gap: 8px; }
  .ctrl-btn { width: 44px; height: 44px; }
  .ctrl-btn.end { width: 56px; border-radius: 22px; }
}

@media (max-width: 420px) {
  .hide-xs { display: none; }
}
