:root {
  --bg: #080a0f;
  --ink: #f4f7fb;
  --muted: #9aa5b5;
  --soft: #6f7c8f;
  --panel: #111720;
  --panel-2: #161e2a;
  --panel-3: #1d2633;
  --line: rgba(255,255,255,.10);
  --line-2: rgba(255,255,255,.18);
  --brand: #2f8cff;
  --brand-2: #12b5cb;
  --ok: #2fd181;
  --warn: #f0b84f;
  --danger: #ef6b73;
  --violet: #8b7cf6;
  --shadow: 0 18px 60px rgba(0,0,0,.34);
  --r: 8px;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(47,140,255,.08), transparent 340px),
    radial-gradient(circle at 12% 8%, rgba(18,181,203,.16), transparent 250px),
    radial-gradient(circle at 88% 18%, rgba(47,209,129,.10), transparent 260px),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  background: transparent;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(8,10,15,.82);
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47,140,255,.20);
}

input::placeholder { color: #667386; }

.hidden { display: none !important; }
.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: var(--ink); border-color: var(--line-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { width: 100%; min-height: 48px; font-size: 1rem; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: .82rem; }
.btn-icon { width: 42px; height: 42px; min-height: 42px; padding: 0; }
.btn.active { background: rgba(47,140,255,.16); color: #dceaff; border-color: rgba(47,140,255,.55); }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}
.chip-accent { color: #dceaff; border-color: rgba(47,140,255,.35); background: rgba(47,140,255,.14); }
.chip-ok { color: var(--ok); background: rgba(47,209,129,.12); border-color: transparent; }
.chip-warn { color: var(--warn); background: rgba(240,184,79,.13); border-color: transparent; }
.chip-err { color: var(--danger); background: rgba(239,107,115,.13); border-color: transparent; }

.toast {
  position: fixed;
  top: calc(16px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  width: min(420px, calc(100vw - 28px));
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(17,23,32,.96);
  box-shadow: var(--shadow);
  text-align: center;
}

/* Lobby */
.lobby-bg { display: none; }

.topbar {
  height: 68px;
  padding: calc(12px + var(--safe-t)) 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  background: #eaf2ff;
  color: #0a111b;
  font-size: .8rem;
}
.brand-text { letter-spacing: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--soft); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 5px rgba(47,209,129,.10); }
.status-dot.err { background: var(--danger); box-shadow: 0 0 0 5px rgba(239,107,115,.10); }

.lobby-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-content: start;
}

.hero {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(8,10,15,.20), rgba(8,10,15,.90)),
    linear-gradient(120deg, rgba(47,140,255,.35), transparent 46%),
    linear-gradient(35deg, rgba(47,209,129,.18), transparent 46%),
    #121a25;
  box-shadow: var(--shadow);
}
.hero h1 {
  max-width: 680px;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: 0;
}
.hero-sub { max-width: 560px; margin-top: 14px; color: #c1cad8; font-size: 1rem; }
.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.hero-metrics span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r);
  background: rgba(255,255,255,.08);
  color: #e6eef8;
  font-size: .82rem;
  font-weight: 800;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(17,23,32,.82);
}
.mode-btn {
  min-height: 42px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}
.mode-btn.active { background: #eef5ff; color: #08111d; }

.lobby-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17,23,32,.92);
  box-shadow: var(--shadow);
}
.card h2 { margin-bottom: 16px; font-size: 1.02rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.optional { color: var(--soft); font-weight: 500; }
.picked-room {
  margin: -2px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(47,209,129,.28);
  border-radius: var(--r);
  background: rgba(47,209,129,.10);
}
.picked-room span { display: block; color: var(--muted); font-size: .76rem; }
.picked-room strong { display: block; margin-top: 2px; color: #d9ffe9; font-size: .92rem; }

.rooms-list {
  max-height: 340px;
  overflow: auto;
  display: grid;
  gap: 8px;
}
.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(8,10,15,.62);
}
.room-card:hover { border-color: rgba(47,140,255,.55); background: rgba(47,140,255,.08); }
.room-card-name { font-weight: 800; }
.room-card-meta, .empty-hint { color: var(--muted); font-size: .82rem; }
.empty-hint { text-align: center; padding: 22px 8px; }

/* Room */
#room {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background: #07090d;
}

.room-topbar {
  min-height: 68px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,14,20,.96);
}
.room-topbar-left, .room-topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.room-topbar-right { flex-shrink: 0; }
.room-meta { min-width: 0; }
.room-meta strong {
  display: block;
  max-width: 46vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .96rem;
}
.room-meta-sub { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }

.room-stack {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(260px, 52vh) minmax(0, 1fr);
  overflow: hidden;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(47,140,255,.09), transparent 220px),
    #05070a;
  border-bottom: 1px solid var(--line);
}
.stage-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(8,10,15,.76);
}
.stage-head strong { display: block; font-size: .94rem; }
.stage-head span { color: var(--muted); font-size: .76rem; }
.stage-status { flex-shrink: 0; }
.live-strip {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,19,27,.95);
}
.layout-actions, .live-actions { display: flex; gap: 5px; align-items: center; }

.videos-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.videos-row:empty::before {
  content: "لا يوجد بث مباشر بعد - شغّل الكاميرا أو الميكروفون";
  width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  color: var(--muted);
  background: rgba(255,255,255,.035);
  text-align: center;
  font-size: .86rem;
}
.videos-row video {
  width: 88px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  object-fit: cover;
  background: #000;
}
.videos-row video.local { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(47,140,255,.16); }
.videos-row video.audio-only {
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(47,140,255,.18), rgba(47,209,129,.12)),
    #0a0f16;
}

.stage-no-youtube {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.stage-has-youtube {
  grid-template-rows: auto auto minmax(0, 1fr);
}
.stage-idle {
  grid-template-rows: auto auto auto;
}
.stage-idle .live-strip {
  align-items: center;
}
.stage-idle .videos-row {
  min-height: 56px;
}
.stage-idle .videos-row:empty::before {
  min-height: 54px;
  padding: 10px 12px;
}
.stage-audio-only .videos-row {
  min-height: 76px;
}
.stage-no-youtube .live-strip {
  height: 100%;
  align-items: stretch;
}
.stage-no-youtube .videos-row {
  min-height: 100%;
  align-content: stretch;
  align-items: stretch;
  padding: 2px;
}
.stage-no-youtube .videos-row.layout-grid,
.stage-no-youtube .videos-row.layout-auto.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  overflow-y: auto;
}
.stage-no-youtube .videos-row.layout-grid video,
.stage-no-youtube .videos-row.layout-auto.layout-grid video {
  width: 100%;
  height: auto;
  min-height: 120px;
  aspect-ratio: 4 / 3;
}
.stage-no-youtube .videos-row.layout-focus {
  display: grid;
  grid-template-columns: 1fr;
  overflow-y: auto;
}
.stage-no-youtube .videos-row.layout-focus video:first-child {
  width: 100%;
  height: auto;
  min-height: 190px;
  aspect-ratio: 16 / 9;
}
.stage-no-youtube .videos-row.layout-focus video:not(:first-child) {
  width: 110px;
  height: 74px;
}

.yt-block {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #000;
}
.player-wrap { position: relative; min-height: 0; background: #000; }
#player { width: 100%; height: 100%; min-height: 160px; }
.player-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8,10,15,.82);
  color: var(--muted);
}
.transport {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(14,19,27,.98);
}
.transport-seek { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 8px; align-items: center; }
.time-label { color: var(--muted); font-size: .76rem; text-align: center; font-variant-numeric: tabular-nums; }
#ytSeek {
  min-height: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--panel-3);
  box-shadow: none;
}
.transport-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; margin-top: 10px; }
.transport-left, .transport-right, .transport-mid { display: flex; gap: 6px; align-items: center; }
.transport-mid input { min-width: 120px; }
.btn-play { border-radius: 50%; width: 46px; height: 46px; }

.yt-cta {
  margin: 8px;
  padding: 10px;
  border: 1px solid rgba(47,140,255,.25);
  border-radius: var(--r);
  background: rgba(47,140,255,.08);
}
.yt-cta-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }

.chat-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--panel);
}
.msg-list {
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
}
.msg-list li {
  width: fit-content;
  max-width: min(86%, 620px);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 4px;
  background: rgba(255,255,255,.055);
  word-break: break-word;
}
.msg-list li.me {
  align-self: flex-end;
  border-radius: 10px 10px 4px 10px;
  background: rgba(47,140,255,.17);
  border-color: rgba(47,140,255,.25);
}
.msg-list li.system {
  align-self: center;
  width: auto;
  max-width: 92%;
  color: var(--warn);
  background: rgba(240,184,79,.10);
  border-color: rgba(240,184,79,.18);
  font-size: .82rem;
}
.msg-list .name { display: block; margin-bottom: 2px; color: #9fc4ff; font-size: .76rem; font-weight: 800; }
.chat-compose {
  padding: 9px;
  padding-bottom: calc(9px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(10,14,20,.98);
}
.compose-tools, .emoji-row, .compose-row { display: flex; align-items: center; gap: 6px; }
.compose-tools { margin-bottom: 6px; }
.emoji-row {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
}
.emoji-row button {
  width: 34px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: var(--r);
  background: rgba(255,255,255,.05);
}
.compose-row input { flex: 1; min-width: 0; }
.msg-media { margin-top: 8px; }
.msg-media img, .msg-media video { max-width: min(260px, 72vw); max-height: 220px; border-radius: var(--r); display: block; }
.msg-media audio { width: min(280px, 72vw); }
.msg-file { color: #cbe2ff; text-decoration: none; }
.voice-bar {
  margin-top: 7px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(239,107,115,.22);
  border-radius: var(--r);
  background: rgba(239,107,115,.10);
}

.drawer, .modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.drawer-backdrop, .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.62);
}
.drawer-sheet, .modal-sheet {
  position: relative;
  width: min(460px, 100%);
  max-height: 76vh;
  max-height: 76dvh;
  overflow: auto;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-b));
  border: 1px solid var(--line-2);
  border-radius: 10px 10px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.drawer-sheet h3, .modal-sheet h3 { margin-bottom: 12px; }
.people-list { list-style: none; display: grid; gap: 8px; margin-bottom: 12px; }
.people-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255,255,255,.04);
}
.people-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--ok));
  font-weight: 900;
}
.people-info { min-width: 0; }
.pname { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prole, .modal-sub { color: var(--muted); font-size: .8rem; }
.people-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.share-code {
  padding: 14px;
  margin: 10px 0;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  background: rgba(8,10,15,.75);
  text-align: center;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: .12em;
  direction: ltr;
}
.share-url { direction: ltr; text-align: left; }

.player-bar, .mobile-nav, .side-col { display: none !important; }

@media (min-width: 720px) {
  .lobby-main { grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); align-items: start; }
  .hero { grid-row: span 2; min-height: 520px; }
  .mode-switch { grid-column: 2; }
  .lobby-cards { grid-column: 2; }
  .card { padding: 20px; }
  .drawer, .modal { align-items: center; }
  .drawer-sheet, .modal-sheet { border-radius: 10px; padding-bottom: 18px; }
}

@media (min-width: 980px) {
  .room-stack {
    grid-template-rows: none;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 28vw);
  }
  .stage { border-bottom: 0; border-inline-end: 1px solid var(--line); }
  .chat-panel { min-width: 0; }
  .stage-no-youtube .videos-row.layout-grid,
  .stage-no-youtube .videos-row.layout-auto.layout-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }
  .stage-no-youtube .videos-row.layout-grid video,
  .stage-no-youtube .videos-row.layout-auto.layout-grid video { min-height: 190px; }
  .stage-no-youtube .videos-row.layout-focus video:first-child { min-height: 410px; }
  .room-meta strong { max-width: 360px; }
}

@media (min-width: 1380px) {
  .room-stack { grid-template-columns: minmax(0, 1fr) 420px; }
  .lobby-main { width: min(1320px, 100%); }
  .hero { min-height: 600px; }
}

@media (max-width: 520px) {
  .topbar { height: 60px; padding-inline: 12px; }
  .brand-text { font-size: .96rem; }
  .lobby-main { padding: 12px; }
  .hero { min-height: 250px; padding: 18px; }
  .lobby-cards { gap: 10px; }
  .card { padding: 14px; }
  .room-topbar { align-items: flex-start; }
  .room-topbar-right .btn { padding-inline: 9px; }
  .room-stack { grid-template-rows: minmax(260px, 46vh) minmax(0, 1fr); }
  .room-stack.stack-stage-idle { grid-template-rows: auto minmax(0, 1fr); }
  .room-stack.stack-stage-audio-only { grid-template-rows: minmax(168px, 24vh) minmax(0, 1fr); }
  .room-stack.stack-stage-has-video { grid-template-rows: minmax(260px, 46vh) minmax(0, 1fr); }
  .room-stack.stack-stage-youtube { grid-template-rows: minmax(320px, 58vh) minmax(0, 1fr); }
  .stage {
    grid-template-rows: minmax(0, 1fr) auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .stage-no-youtube { grid-template-rows: minmax(0, 1fr) auto; }
  .stage-has-youtube { grid-template-rows: auto minmax(0, 1fr); }
  .stage-head { display: none; }
  .live-strip {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 1fr);
    align-items: stretch;
    min-height: 0;
  }
  .stage-idle {
    overflow: visible;
  }
  .stage-idle .stage-head {
    min-height: 40px;
    padding-block: 6px;
  }
  .stage-idle .stage-status {
    display: none;
  }
  .stage-idle .live-strip {
    grid-template-rows: auto;
    gap: 6px;
    padding: 7px 8px;
  }
  .stage-idle .layout-actions {
    display: none;
  }
  .stage-idle .videos-row {
    min-height: 46px;
    height: 46px;
    padding: 0;
    overflow: hidden;
  }
  .stage-idle .videos-row:empty::before {
    content: "انقر لإظهار أدوات الاستوديو";
    min-height: 46px;
    padding: 8px 10px;
    font-size: .78rem;
  }
  .stage-idle .live-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    gap: 7px;
  }
  .stage-idle .live-actions .btn-icon {
    width: 100%;
  }
  .stage-audio-only .live-strip {
    grid-template-rows: auto minmax(58px, auto) auto;
  }
  .stage-audio-only .videos-row,
  .stage-audio-only .videos-row video {
    min-height: 58px;
    height: 58px;
    aspect-ratio: auto;
  }
  .stage-no-youtube .live-strip { height: auto; min-height: 0; }
  .stage-no-youtube .videos-row,
  .videos-row {
    min-height: 180px;
    align-items: stretch;
  }
  .stage-no-youtube .videos-row.layout-grid,
  .stage-no-youtube .videos-row.layout-auto.layout-grid {
    grid-template-columns: 1fr;
  }
  .stage-no-youtube .videos-row.layout-grid video,
  .stage-no-youtube .videos-row.layout-auto.layout-grid video,
  .videos-row video {
    width: 100%;
    height: auto;
    min-height: 180px;
    aspect-ratio: 16 / 9;
  }
  .stage-idle.stage-no-youtube .live-strip {
    height: auto;
    grid-template-rows: auto;
  }
  .stage-idle.stage-no-youtube .videos-row,
  .stage-idle.stage-no-youtube .videos-row.layout-grid,
  .stage-idle.stage-no-youtube .videos-row.layout-auto.layout-grid,
  .stage-idle.stage-no-youtube .videos-row.layout-focus {
    display: block;
    min-height: 46px;
    height: 46px;
    padding: 0;
    overflow: hidden;
  }
  .stage-idle.stage-no-youtube .videos-row:empty::before {
    content: "انقر لإظهار أدوات الاستوديو";
  }
  .layout-actions,
  .live-actions {
    position: absolute;
    left: 8px;
    right: 8px;
    z-index: 12;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: rgba(8,10,15,.76);
    backdrop-filter: blur(10px);
  }
  .layout-actions {
    top: 8px;
  }
  .live-actions {
    bottom: 8px;
  }
  .stage-controls-open .layout-actions,
  .stage-controls-open .live-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .stage-idle .layout-actions {
    display: none;
  }
  .stage-idle .live-actions {
    top: 7px;
    bottom: auto;
  }
  .stage-idle.stage-controls-open .videos-row:empty::before {
    color: transparent;
  }
  .stage-audio-only.stage-no-youtube .videos-row,
  .stage-audio-only.stage-no-youtube .videos-row.layout-grid,
  .stage-audio-only.stage-no-youtube .videos-row.layout-auto.layout-grid {
    min-height: 58px;
    display: flex;
    overflow-x: auto;
  }
  .stage-audio-only.stage-no-youtube .videos-row video,
  .stage-audio-only.stage-no-youtube .videos-row.layout-grid video,
  .stage-audio-only.stage-no-youtube .videos-row.layout-auto.layout-grid video {
    width: 132px;
    min-width: 132px;
    min-height: 58px;
    height: 58px;
    aspect-ratio: auto;
  }
  .stage-has-youtube .live-strip {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(92px, auto) auto;
  }
  .stage-has-youtube .videos-row {
    min-height: 92px;
    display: flex;
    overflow-x: auto;
  }
  .stage-has-youtube .videos-row video {
    width: 128px;
    min-width: 128px;
    min-height: 86px;
    height: 86px;
    aspect-ratio: 4 / 3;
  }
  .chat-panel {
    min-height: 0;
  }
  .msg-list {
    padding: 14px 12px;
    gap: 9px;
  }
  .chat-compose {
    padding-bottom: calc(12px + var(--safe-b));
  }
  .layout-actions, .live-actions { justify-content: center; flex-wrap: wrap; }
  .live-actions .btn-icon, .layout-actions .btn-icon { width: 44px; height: 42px; min-height: 42px; }
  .transport-row { grid-template-columns: 1fr; }
  .transport-left, .transport-right, .transport-mid { justify-content: center; }
  .yt-cta { margin: 8px; padding: 10px; }
  .yt-cta-row { grid-template-columns: 1fr; }
  .people-list li { align-items: flex-start; flex-wrap: wrap; }
  .people-info { flex: 1 1 130px; }
  .people-actions { width: 100%; justify-content: stretch; }
  .people-actions .btn { flex: 1 1 auto; }
  .msg-list li { max-width: 94%; }
}
