:root {
  --bg: #07080f;
  --panel: #0f1122;
  --panel-2: #181a33;
  --text: #f2f2f7;
  --muted: #9a9cb8;
  --accent: #ff9f1c;
  --accent-2: #ff7a18;
  --accent-ink: #07080f;
  --purple: #7c3aed;
  --line: rgba(255, 255, 255, .09);
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, Vazirmatn, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.lang-fa body, .lang-fa #landing, .fa-font { font-family: Vazirmatn, Inter, system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button, .filebtn, .iconbtn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .15s, filter .15s, background .15s;
}
button:hover, .filebtn:hover, .iconbtn:hover { border-color: rgba(255, 255, 255, .22); }
.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 14px;
  box-shadow: 0 12px 36px -12px rgba(255, 159, 28, .65);
}
.primary:hover { filter: brightness(1.08); border-color: transparent; }
input:not([type=range]):not([type=file]), select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:not([type=range]):not([type=file]):focus, select:focus {
  border-color: rgba(255, 159, 28, .6);
  box-shadow: 0 0 0 3px rgba(255, 159, 28, .15);
}
input::placeholder { color: #6d6f8c; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Landing (join screen) */
.screen { height: 100%; }
#landing {
  position: relative; min-height: 100%; overflow: hidden;
  display: flex; flex-direction: column;
}
.glow { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(120px); z-index: 0; }
.glow-a { width: 900px; height: 560px; top: -320px; left: 50%; transform: translateX(-50%); background: rgba(124, 58, 237, .28); }
.glow-b { width: 480px; height: 480px; bottom: -200px; inset-inline-end: -140px; background: rgba(255, 159, 28, .14); }

.topbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(1180px, 100%); margin: 0 auto; padding: 18px 22px;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.logo span { font-size: 24px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.lang-toggle { display: flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); }
.lang-toggle button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lang-toggle button.active { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px -4px rgba(255, 159, 28, .8); }
.pill-btn {
  padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--text); border: 1px solid var(--line); background: rgba(255, 255, 255, .05);
}
.pill-btn:hover { background: rgba(255, 255, 255, .1); }

.join-wrap {
  position: relative; z-index: 1; flex: 1;
  width: min(1180px, 100%); margin: 0 auto; padding: 24px 22px 56px;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 500;
  color: rgba(255, 255, 255, .75); border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 159, 28, .18); }
.join-copy h1 { margin: 20px 0 0; font-size: clamp(40px, 6vw, 68px); line-height: 1.05; font-weight: 800; letter-spacing: -.03em; }
.lang-fa .join-copy h1 { line-height: 1.35; letter-spacing: 0; }
.grad { background: linear-gradient(90deg, #ffc061, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 20px 0 0; max-width: 520px; font-size: 17px; color: rgba(255, 255, 255, .65); }
.how { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: rgba(255, 255, 255, .72); font-size: 14px; }
.how li { display: flex; align-items: center; gap: 12px; }
.how .num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--accent); background: rgba(255, 159, 28, .14);
}

.card {
  background: linear-gradient(160deg, rgba(124, 58, 237, .14), rgba(15, 17, 34, .92) 45%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 30px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
  backdrop-filter: blur(12px);
}
.card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.card label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 500; }
.card .primary { font-size: 16px; padding: 14px 18px; margin-top: 4px; }
.card-note { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }

.android-box { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.btn-secondary {
  display: block; width: 100%; text-align: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 159, 28, .5); color: var(--text);
  border-radius: 14px; padding: 12px 16px; text-decoration: none; font-weight: 600;
}
.android-box a.small { color: var(--muted); }

@media (max-width: 860px) {
  .join-wrap { grid-template-columns: 1fr; gap: 32px; padding-top: 8px; }
  .how { display: none; }
  .pill-btn { display: none; }
  .card { padding: 24px; border-radius: 24px; }
}

/* Room layout */
#roomScreen { display: flex; }
#stage { flex: 1; min-width: 0; display: flex; background: #000; }
#playerWrap { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; }
#video { width: 100%; height: 100%; max-height: 100vh; background: #000; }
#sidebar {
  width: 320px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 8px;
  border-left: 1px solid var(--line);
}
#sidebar header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.room-name { font-weight: 700; font-size: 18px; word-break: break-all; }
#sidebar h3 { margin: 10px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

#members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#members li { background: var(--panel-2); border-radius: 12px; padding: 8px 10px; }
#members .name { font-weight: 600; }
#members .me { color: var(--accent); font-weight: 400; font-size: 12px; }
#members .file { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

#chat {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  background: var(--panel-2);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#chat .msg b { color: var(--accent); }
#chat .sys { color: var(--muted); font-size: 12px; font-style: italic; }
.emoji-row { display: flex; gap: 4px; justify-content: space-between; }
.emoji-row button { flex: 1; padding: 4px 0; font-size: 18px; }

/* Overlays */
.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(7, 8, 15, .9);
  z-index: 5;
}
.overlay.dragging .drop { border-color: var(--accent); }
.drop {
  text-align: center;
  padding: 36px;
  border: 2px dashed rgba(255, 255, 255, .16);
  background: rgba(124, 58, 237, .06);
  border-radius: var(--radius);
  max-width: 420px;
  margin: 16px;
}
.drop .big { font-size: 48px; }
.filebtn { display: inline-block; margin-top: 8px; }

.banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(15, 17, 34, .92);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 4;
  font-size: 14px;
  max-width: calc(100% - 32px);
  text-align: center;
}

/* Controls */
#controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 14px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  z-index: 3;
  transition: opacity .25s;
}
#playerWrap.idle #controls { opacity: 0; }
#playerWrap.idle { cursor: none; }
#controls .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#controls .spacer { flex: 1; }
#controls button, #controls .iconbtn { background: rgba(255,255,255,.08); border-color: transparent; }
#controls select { width: auto; padding: 5px 6px; background: rgba(255,255,255,.08); border-color: transparent; }
#seek { width: 100%; accent-color: var(--accent); margin-bottom: 6px; }
#volume { width: 80px; accent-color: var(--accent); }
#time { font-variant-numeric: tabular-nums; font-size: 13px; }

/* Length-mismatch pop-up */
dialog#lengthDialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 22px;
  width: min(440px, calc(100% - 32px));
}
dialog#lengthDialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog#lengthDialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog#lengthDialog ul { padding-left: 18px; margin: 6px 0 10px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

/* Floating reactions */
#reactions { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.float {
  position: absolute; bottom: 80px;
  font-size: 36px;
  animation: floatUp 2.6s ease-out forwards;
  text-align: center;
}
.float small { display: block; font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000; }
@keyframes floatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { transform: translateY(-260px); opacity: 0; }
}

@media (max-width: 820px) {
  #roomScreen { flex-direction: column; height: auto; min-height: 100%; }
  #stage { min-height: 56vw; }
  #sidebar { width: 100%; border-left: 0; }
  #chat { min-height: 180px; }
}
