:root{
  --bg:#0b1220;
  --panel:#121b2f;
  --panel2:#0f172a;
  --text:#e7eefc;
  --muted:rgba(231,238,252,.65);
  --line:rgba(231,238,252,.12);
  --accent:#3b82f6;
  --danger:#ef4444;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1100px 700px at 20% 0%, rgba(59,130,246,.22), transparent 60%),
              radial-gradient(900px 600px at 80% 20%, rgba(16,185,129,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background: rgba(8,12,22,.7);
  backdrop-filter: blur(10px);
  position:sticky;
  top:0;
  z-index:10;
}
.brand{ font-weight:800; letter-spacing:.3px; }
.nav{ display:flex; gap:10px; align-items:center; }
.navlink{ color:var(--text); opacity:.9; }
.navlink:hover{ opacity:1; }

.page{
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 16px 30px;
  display:grid;
  gap:14px;
}

.card{
  background: rgba(18,27,47,.75);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:10px; }
input, textarea{
  width: 100%;
  max-width: 360px;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
}
textarea{ max-width: 720px; }

.btn{
  border:1px solid rgba(255,255,255,.14);
  background: rgba(59,130,246,.92);
  color:white;
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:700;
}
.btn:hover{ filter: brightness(1.05); }
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn.small{ padding:7px 10px; border-radius:10px; font-weight:700; }
.btn.ghost{
  background: rgba(0,0,0,.15);
  color: var(--text);
}
.btn.danger{ background: rgba(239,68,68,.92); }

.sep{ border:none; border-top:1px solid var(--line); margin:14px 0; }
.muted{ color:var(--muted); }
.small{ font-size:12px; }
.note{ margin-top:10px; color: var(--muted); }
.checkRow{ display:flex; gap:10px; align-items:center; margin-top:10px; }

.roomsGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px){
  .roomsGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px){
  .roomsGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.roomCard{
  display:grid;
  grid-template-rows: 56px 1fr;
  gap:10px;
  padding:12px;
  border-radius:16px;
  background: rgba(0,0,0,.18);
  border:1px solid var(--line);
  cursor:pointer;
  min-height: 170px;
}
.roomTop{
  display:flex; gap:10px; align-items:center;
}
.roomAvatar{
  width:56px; height:56px; border-radius: 14px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  overflow:hidden;
  flex:0 0 auto;
  display:flex; align-items:center; justify-content:center;
}
.roomAvatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.roomName{ font-weight:900; }
.roomMeta{ display:flex; gap:10px; align-items:center; margin-top:4px; }
.pill{
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.icon{
  width:14px; height:14px; display:inline-block;
}

.pager{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  margin-top: 14px;
}

.avatarPreview{
  width:120px;
  height:120px;
  border-radius:18px;
  object-fit:cover;
  border:1px solid var(--line);
}

/* ROOM layout full height */
.roomPage{
  height: calc(100vh - 58px);
  padding: 12px 16px 18px;
}
.roomGrid{
  height: 100%;
  display:grid;
  grid-template-columns: 260px 1fr 360px;
  gap: 14px;
}
@media (max-width: 1100px){
  .roomGrid{ grid-template-columns: 240px 1fr; }
  .chatPanel{ grid-column: 1 / -1; }
}

.panel{
  height: 100%;
  display:flex;
  flex-direction:column;
  background: rgba(18,27,47,.75);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  overflow:hidden;
}
.panelTitle{
  font-weight:900;
  letter-spacing:.4px;
  margin-bottom: 10px;
}
.usersList{
  overflow:auto;
  padding-right:6px;
}

.userRow{
  padding:8px 10px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius:12px;
  background: rgba(0,0,0,0.10);
  margin-bottom:8px;
}

.controlsRow{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}

.videosGrid{
  overflow:auto;
  padding-right:6px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content:start;
}
@media (max-width: 900px){
  .videosGrid{ grid-template-columns: 1fr; }
}

.tile{
  position: relative;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:14px;
  overflow:hidden;
  background: rgba(0,0,0,0.18);
}
.tile video{
  width:100%;
  height: 360px;
  object-fit: contain;
  background: black;
  display:block;
}
.tileOverlay{
  position:absolute;
  left:10px;
  bottom:10px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(0,0,0,0.55);
  font-size:12px;
  border:1px solid rgba(255,255,255,0.14);
}

.chatBox{
  flex: 1;
  overflow:auto;
  padding:10px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius:12px;
  background: rgba(0,0,0,0.14);
}
.chatLine{
  padding:8px 10px;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.chatInputRow{
  margin-top:10px;
  display:flex;
  gap:10px;
}
.chatInputRow input{
  flex:1;
  max-width: unset;
}

/* --- User menu (room user click actions) --- */
.userRow{ cursor:pointer; }
.roleBadges{ display:inline-flex; gap:6px; margin-left:6px; vertical-align:middle; }
.roleBadge{
  display:inline-flex;
  align-items:center;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(231,238,252,.06);
  font-size:11px;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.userMenu{
  position:absolute;
  width:220px;
  z-index:9999;
  border:1px solid var(--line);
  background: rgba(18,27,47,.98);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  border-radius: 12px;
  padding: 10px;

  max-height: 70vh;
  overflow: auto;
}
.userMenuTitle{
  font-weight: 700;
  margin-bottom: 8px;
}
.userMenuDivider{
  height:1px;
  background: var(--line);
  margin: 10px 0;
  opacity: .8;
}
.userMenuBtn{
  width:100%;
  text-align:left;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(231,238,252,.06);
  color: var(--text);
  cursor: pointer;
}
.userMenuBtn:hover{
  border-color: rgba(231,238,252,.22);
  background: rgba(231,238,252,.10);
}
.userMenuBtn.danger{
  border-color: rgba(255, 90, 90, .35);
  background: rgba(255, 90, 90, .08);
}
.userMenuBtn.danger:hover{
  border-color: rgba(255, 90, 90, .55);
  background: rgba(255, 90, 90, .14);
}
.userMenuRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin: 8px 0 6px 0;
}
.userMenuSlider{
  width: 120px;
}
