:root {
  --bg: #0b0b12;
  --panel: #14141f;
  --panel2: #1b1b29;
  --line: #2a2a3d;
  --text: #ecebf5;
  --muted: #9a98b3;
  --accent: #ff4d6d;
  --accent2: #ffb84d;
  --ok: #3ddc97;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2a1630 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
input {
  font: inherit; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-width: 0; flex: 1;
  outline: none;
}
input:focus { border-color: var(--accent); }
.muted { color: var(--muted); }

.btn {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: #44445f; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #ff7a59); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 13px 26px; font-size: 17px; border-radius: 12px; }
.btn.small { padding: 6px 12px; font-size: 13.5px; }

/* ---------- landing ---------- */
#landing { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.hero { max-width: 460px; width: 100%; text-align: center; }
.logo { font-size: 64px; line-height: 1; filter: drop-shadow(0 8px 24px rgba(255, 77, 109, .35)); }
.hero h1 { font-size: 56px; margin: 8px 0 0; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, #fff, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 17px; margin: 6px 0 28px; }
.row { display: flex; gap: 8px; margin-top: 16px; }
.how { text-align: start; color: var(--muted); margin: 36px auto 0; padding-inline-start: 22px; line-height: 2; }

/* ---------- room ---------- */
#room { height: 100%; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  border-bottom: 1px solid var(--line); background: rgba(11, 11, 18, .7); backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 19px; }
.nowplaying { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowplaying b { color: var(--text); }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }
.conn.off { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 16px; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.stage {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; max-height: calc(100vh - 230px); width: 100%;
  border: 1px solid var(--line);
}
.stage.theater { position: fixed; inset: 0; z-index: 50; width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; border: 0; }
body.theater-on { overflow: hidden; }
.fsbar { display: none; position: absolute; top: 12px; inset-inline: 12px; z-index: 4; gap: 8px; justify-content: space-between; align-items: center; opacity: .35; transition: opacity .2s; }
.fsbar:hover, .fsbar:focus-within { opacity: 1; }
.stage:fullscreen .fsbar, .stage:-webkit-full-screen .fsbar, .stage.theater .fsbar { display: flex; }
.fschat { display: flex; gap: 6px; width: min(420px, 70%); }
.fschat input { padding: 6px 10px; background: rgba(20, 20, 31, .85); }
.stage:fullscreen { border-radius: 0; border: 0; max-height: none; aspect-ratio: auto; }
.stage:-webkit-full-screen { border-radius: 0; border: 0; max-height: none; width: 100%; height: 100%; }
.stage video, .stage .yt, .stage .yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
video::cue { font-family: "Cairo", sans-serif; font-size: 1.15em; background: rgba(0, 0, 0, .6); }

.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 8, 14, .82); text-align: center; padding: 20px; z-index: 2;
}
#tapPlay { background: rgba(8, 8, 14, .55); }
.msg { display: flex; flex-direction: column; gap: 10px; align-items: center; font-size: 17px; max-width: 480px; }
.big-emoji { font-size: 46px; }
.fname { font-weight: 800; font-size: 18px; color: var(--accent2); word-break: break-all; }

.toasts { position: absolute; bottom: 70px; inset-inline-start: 16px; z-index: 3; display: flex; flex-direction: column; gap: 6px; pointer-events: none; max-width: 60%; }
.toast {
  background: rgba(20, 20, 31, .88); border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 12px; font-size: 14.5px; animation: pop .25s ease-out; backdrop-filter: blur(6px);
}
.toast b { color: var(--accent2); margin-inline-end: 6px; }
.toast.sys { color: var(--muted); font-size: 13px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { font: inherit; font-size: 14px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 6px 12px; cursor: pointer; }
.tab.active { color: var(--text); background: var(--panel2); border-color: var(--line); }
.panel { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel small { flex: 1; min-width: 200px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.subtools { display: inline-flex; gap: 6px; align-items: center; }
.spacer { flex: 1; }

.side { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.members { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.members h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; font-size: 12.5px; }
#members { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
#members li { background: var(--panel2); border-radius: 99px; padding: 3px 11px 3px 9px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
#members li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
#members li.me { border: 1px solid #3a3a55; }
#members li { border: 1px solid transparent; transition: box-shadow .12s, border-color .12s; }
#members li.speaking { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 151, .25); }
#members li.connecting::before { background: var(--accent2); }
.voice { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn.muted { color: var(--accent); border-color: var(--accent); }
#voiceHint { display: block; margin-top: 6px; font-size: 12.5px; }

.chat { flex: 1; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.chatlog { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.cm { max-width: 85%; align-self: flex-start; background: var(--panel2); border-radius: 12px; padding: 6px 11px; word-wrap: break-word; }
.cm .who { font-size: 12px; color: var(--accent2); font-weight: 700; }
.cm.mine { align-self: flex-end; background: #3a1d2c; }
.cm.mine .who { display: none; }
.cm.sys { align-self: center; background: transparent; color: var(--muted); font-size: 12.5px; padding: 0; text-align: center; }
.chatform { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }

.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(5, 5, 10, .75); backdrop-filter: blur(8px); padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.card h2 { margin: 0; }

@media (max-width: 900px) {
  #room { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .stage { max-height: none; }
  .chat { height: 380px; flex: none; }
  .top { padding: 8px 10px; gap: 8px; }
  .nowplaying { display: none; }
  .toasts { max-width: 85%; bottom: 56px; }
}
