:root {
  --bg: #0b0c10;
  --panel: #13151b;
  --panel-2: #1b1e26;
  --panel-3: #232731;
  --line: #2a2f3a;
  --text: #eceef3;
  --muted: #9aa1ae;
  --dim: #6b7280;
  --accent: #f2b544;
  --accent-2: #ffcf70;
  --accent-ink: #1d1503;
  --danger: #f06363;
  --ok: #4cc38a;
  --radius: 12px;
  --side-w: clamp(290px, 24vw, 400px);
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .icon { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.ibtn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; border: 0; background: transparent; color: var(--text); flex: none;
}
.ibtn:hover { background: rgba(255,255,255,.1); }
.ibtn.small { width: 30px; height: 30px; }
.ibtn.on { color: var(--accent); }
.round {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-3);
  display: inline-flex; align-items: center; justify-content: center;
}
.round:hover { background: #2c313d; }
.round.off { background: color-mix(in srgb, var(--danger) 22%, var(--panel-2)); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: #ffb4b4; }
.field {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); outline: none; min-width: 0;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.select { width: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 13px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip i { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.chip.me { cursor: pointer; }
.chip.ok i { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 3.5px var(--ok); }
.chip.wait i { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 3.5px var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.spin {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18);
  border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }

/* ---------- login ---------- */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.login-card .muted { margin: 0 0 6px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.logo .icon { width: 28px; height: 28px; color: var(--accent); }

/* ---------- home ---------- */
.home { max-width: 1240px; margin: 0 auto; padding: 0 20px 60px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 18px 0; }
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center;
  padding: 28px; border-radius: 20px; border: 1px solid var(--line);
  background: radial-gradient(120% 140% at 0% 0%, #2a2112 0%, var(--panel) 55%);
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.02em; line-height: 1.1; }
.hero p { margin: 0; max-width: 52ch; }
.rooms { display: flex; flex-direction: column; gap: 10px; }
.room-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px;
  border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid var(--line);
}
.rc-title { font-weight: 700; font-size: 17px; }
.room-card.small .rc-title { font-size: 15px; }
.new-room { align-self: flex-start; }

/* ---------- library ---------- */
.library { margin-top: 26px; }
.lib-head { font-size: 20px; margin: 0 0 12px; }
.add-form { display: flex; gap: 8px; }
.add-form .field[type=url] { flex: 1; }
.disk { color: var(--dim); font-size: 13px; margin: 8px 2px 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); min-width: 0;
}
.card.current { border-color: var(--accent); }
.poster { position: relative; aspect-ratio: 16 / 9; background: #07080a; cursor: default; overflow: hidden; }
.card.ready .poster { cursor: pointer; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card.ready .poster:hover img { transform: scale(1.04); }
.poster .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--dim); background: linear-gradient(135deg, #1a1d25, #0d0f13); }
.poster .ph .icon { width: 40px; height: 40px; }
.play-hover {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
  background: rgba(0,0,0,.35); color: #fff;
}
.play-hover .icon { width: 46px; height: 46px; }
.poster:hover .play-hover { opacity: 1; }
.badge {
  position: absolute; left: 8px; top: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em;
}
.card-body { padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.details { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { color: var(--muted); font-size: 13px; }
.meta.err { color: var(--danger); overflow-wrap: anywhere; }
.meta.busy { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.bar { height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s; }
.card-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--line); border-radius: 14px; }
.empty .icon { width: 36px; height: 36px; color: var(--dim); }
.empty p { max-width: 46ch; margin: 10px auto 0; }

.popmenu {
  position: fixed; z-index: 60; width: 200px; padding: 6px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.popmenu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0;
  background: transparent; border-radius: 8px; text-align: left; font-size: 14px;
}
.popmenu button:hover { background: var(--panel-3); }
.popmenu button.danger { color: var(--danger); }
.popmenu .icon { width: 18px; height: 18px; }

.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.modal h2 { margin: 0 0 10px; font-size: 18px; }
.modal-body p { margin: 0 0 6px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: min(560px, 92vw); transition: opacity .3s, transform .3s;
}
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- room ---------- */
.room { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); height: 100vh; height: 100dvh; background: #000; }
.room.theater { grid-template-columns: minmax(0, 1fr) 0; }
.room.theater .side { display: none; }
.stage { position: relative; min-width: 0; min-height: 0; background: #000; }
.side {
  display: flex; flex-direction: column; min-height: 0; background: var(--panel);
  border-left: 1px solid var(--line);
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 6px 14px; }
.room-name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.conn-dot.on { background: var(--ok); }
.head-btns { display: flex; gap: 2px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }

.tiles { display: grid; gap: 6px; padding: 0 10px; flex: 0 1 auto; min-height: 0; overflow: auto; }
.tiles[data-count="3"], .tiles[data-count="4"], .tiles[data-count="5"] { grid-template-columns: 1fr 1fr; }
.tile {
  position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: #0d0f14;
  border: 2px solid transparent; transition: border-color .15s;
}
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0d0f14; }
.tile.self video { transform: scaleX(-1); }
.tile .avatar, .gate-preview .avatar {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px;
  border-radius: 50%; display: none; place-items: center; font-size: 28px; font-weight: 800; color: #111;
}
.tile.nocam video { visibility: hidden; }
.tile.nocam .avatar { display: grid; }
.tile .label {
  position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; max-width: calc(100% - 12px);
  background: rgba(0,0,0,.6); padding: 2px 8px 2px 6px; border-radius: 7px; font-size: 12px; font-weight: 600;
}
.tile .label .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .mic-off { display: none; width: 15px; height: 15px; color: #ff9b9b; }
.tile.muted .mic-off { display: inline-flex; }
.tile .conn {
  position: absolute; right: 6px; top: 6px; font-size: 11px; background: rgba(0,0,0,.6); padding: 2px 7px; border-radius: 6px; color: var(--muted);
  display: none;
}
.tile[data-conn="new"] .conn, .tile[data-conn="connecting"] .conn, .tile[data-conn="disconnected"] .conn, .tile[data-conn="failed"] .conn { display: block; }
.tiles[data-count="3"] .tile .avatar, .tiles[data-count="4"] .tile .avatar, .tiles[data-count="5"] .tile .avatar { width: 44px; height: 44px; font-size: 20px; }

.callbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.callbar .round { width: 40px; height: 40px; }
.cv { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); }
.cv .icon { width: 18px; height: 18px; }
.vol { width: 90px; accent-color: var(--accent); }

.chat { display: flex; flex-direction: column; flex: 1 1 200px; min-height: 160px; }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.cm { padding: 4px 0; }
.cm.cont { padding-top: 0; }
.cm-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.cm-head time { color: var(--dim); font-size: 11px; }
.cm-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.cm.sys { color: var(--dim); font-size: 12px; text-align: center; padding: 3px 0; }
.react-bar { display: flex; gap: 2px; padding: 4px 8px 0; flex-wrap: wrap; }
.react-bar button { border: 0; background: transparent; font-size: 19px; padding: 3px 5px; border-radius: 8px; line-height: 1; }
.react-bar button:hover { background: var(--panel-3); transform: scale(1.12); }
.chat-form { display: flex; gap: 6px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }

/* ---------- library panel over the stage ---------- */
.libpanel { position: absolute; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; padding: 18px 20px 40px; }
.libpanel-head { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; }
.libpanel-head h2 { margin: 0; font-size: 20px; }
.libpanel .close-lib { display: none; }
.libpanel.closable .close-lib { display: inline-flex; }
.libpanel-body { max-width: 1100px; margin: 0 auto; }
.libpanel .library { margin-top: 14px; }

/* ---------- player ---------- */
.player { position: absolute; inset: 0; background: #000; overflow: hidden; container-type: size; --sub-scale: 1; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player.idle { cursor: none; }
.subs {
  position: absolute; left: 4%; right: 4%; bottom: 7%; display: flex; flex-direction: column; align-items: center; gap: .15em;
  pointer-events: none; text-align: center; transition: bottom .2s; z-index: 3;
  font-size: calc(var(--sub-scale) * clamp(15px, 4.6cqh, 52px)); line-height: 1.25; font-weight: 600;
}
.player:not(.idle) .subs, .player.paused .subs { bottom: calc(7% + 70px); }
.cue span {
  background: rgba(0,0,0,.62); color: #fff; padding: .06em .35em; border-radius: .18em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
}
.center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 4; }
.center > * { pointer-events: auto; }
.center .msg {
  display: flex; align-items: center; gap: 12px; background: rgba(10,11,15,.82); padding: 12px 18px;
  border-radius: 12px; font-weight: 600; max-width: 90%; flex-wrap: wrap; justify-content: center;
}
.center .msg.err { color: #ffc2c2; }
.bigplay {
  width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(242,181,68,.92); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 10px 40px rgba(0,0,0,.45); transition: transform .15s, opacity .2s;
}
.bigplay:hover { transform: scale(1.06); }
.bigplay .icon { width: 40px; height: 40px; margin-left: 4px; }
.big-cta { padding: 14px 24px; font-size: 17px; }
.endcard { background: rgba(12,13,18,.92); border: 1px solid var(--line); padding: 24px; border-radius: 16px; text-align: center; max-width: min(520px, 92%); }
.endcard .end-title { font-size: 26px; font-weight: 800; }
.endcard p { color: var(--muted); }
.endcard .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ptop {
  position: absolute; left: 0; right: 0; top: 0; padding: 14px 16px 30px; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  background: linear-gradient(rgba(0,0,0,.65), transparent); transition: opacity .3s;
}
.ptitle { font-weight: 700; font-size: 16px; text-shadow: 0 1px 3px #000; max-width: 80%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .3s; }
.player.idle:not(.paused) .ptitle { opacity: 0; }
.player.idle:not(.paused) .ptop { background: none; }
.ptoasts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ptoast {
  background: rgba(16,18,24,.88); border: 1px solid rgba(255,255,255,.08); padding: 7px 12px; border-radius: 9px; font-size: 14px;
  max-width: min(520px, 80cqw); overflow-wrap: anywhere; transition: opacity .4s, transform .4s;
}
.ptoast.out { opacity: 0; transform: translateY(-4px); }
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 26px 12px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.82)); transition: opacity .3s;
}
.player.idle:not(.paused) .controls { opacity: 0; pointer-events: none; }
.player.paused.idle { cursor: default; }
.player.empty .controls, .player.empty .ptop { display: none; }
.controls .row { display: flex; align-items: center; gap: 2px; }
.controls .ibtn { color: #fff; }
.controls .ibtn.big .icon { width: 26px; height: 26px; }
.time { font-variant-numeric: tabular-nums; font-size: 14px; color: #e3e5ea; margin-left: 8px; white-space: nowrap; }
.volwrap { display: inline-flex; align-items: center; }
.volwrap .vol { width: 0; opacity: 0; transition: width .2s, opacity .2s; }
.volwrap:hover .vol, .volwrap:focus-within .vol { width: 80px; opacity: 1; margin-right: 4px; }
.seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; margin: 0 6px 2px; touch-action: none; }
.seek .track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); overflow: hidden; transition: height .12s; }
.seek:hover .track, .seek.drag .track { height: 6px; }
.seek .buf { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.32); }
.seek .played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.seek .thumb { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .12s; }
.seek:hover .thumb, .seek.drag .thumb { transform: scale(1); }
.seek .tip {
  position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(0,0,0,.85); padding: 2px 7px; border-radius: 6px;
  font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; white-space: nowrap;
}
.seek:hover .tip { opacity: 1; }
.pmenu {
  position: absolute; right: 12px; bottom: 70px; z-index: 7; width: 290px; max-height: calc(100% - 100px); overflow-y: auto;
  background: rgba(20,22,28,.97); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 16px 50px rgba(0,0,0,.6);
}
.pmenu .mh { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: 8px 10px 4px; font-weight: 700; }
.pmenu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; text-align: left; }
.pmenu button:hover { background: rgba(255,255,255,.08); }
.pmenu .tick { width: 18px; height: 18px; visibility: hidden; color: var(--accent); }
.pmenu .sel .tick { visibility: visible; }
.pmenu .sel { font-weight: 700; }
.pmenu .add { color: var(--accent); }
.pmenu .mnote { font-size: 12px; color: var(--dim); padding: 4px 10px 8px; }
.stepper { display: flex; align-items: center; gap: 6px; padding: 2px 8px 8px; }
.stepper button { width: auto; padding: 6px 10px; background: var(--panel-3); justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper .val { min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.reacts { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.react { position: absolute; bottom: 70px; display: flex; flex-direction: column; align-items: center; animation: floatup 3.2s ease-out forwards; }
.react .e { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.react .n { font-size: 12px; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px; margin-top: 2px; }
@keyframes floatup { 0% { transform: translateY(20px) scale(.6); opacity: 0; } 12% { transform: translateY(0) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translateY(-46cqh); opacity: 0; } }

/* ---------- join gate ---------- */
.gate-back { position: fixed; inset: 0; z-index: 70; background: rgba(5,6,9,.92); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.gate {
  width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
}
.gate h2 { margin: 12px 0 0; }
.gate p { margin: 0; }
.gate-note { color: var(--accent); font-size: 14px; min-height: 1em; margin: 6px 0 10px !important; }
.gate-preview { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #07080a; }
.gate-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.gate.nocam .gate-preview video { visibility: hidden; }
.gate.nocam .gate-preview .avatar { display: grid; }
.gate-ctl { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 12px; }
.gate-ctl .round { width: 50px; height: 50px; background: rgba(30,33,42,.85); }

/* ---------- full screen ---------- */
.room.fs { --side-w: clamp(260px, 21vw, 360px); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .add-form { flex-wrap: wrap; }
  .add-form .field[type=url] { flex-basis: 100%; }
  .add-form .select { flex: 1; }
}
@media (max-width: 860px) and (orientation: portrait) {
  .room { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .room.theater { grid-template-columns: 1fr; grid-template-rows: 1fr 0; }
  .stage { aspect-ratio: 16 / 9; width: 100%; }
  .room.theater .stage { aspect-ratio: auto; height: 100%; }
  .room:has(.libpanel) .stage { aspect-ratio: auto; height: 62dvh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .side-head { padding-top: 6px; }
  .tiles { display: flex; overflow-x: auto; padding-bottom: 4px; flex: none; }
  .tile { flex: 0 0 132px; aspect-ratio: 4 / 3; }
  .tile .avatar { width: 40px; height: 40px; font-size: 18px; }
  .controls .ibtn { width: 34px; height: 34px; }
  .time { font-size: 12px; margin-left: 4px; }
  .volwrap .vol { display: none; }
  .pmenu { right: 6px; left: 6px; width: auto; bottom: 60px; }
}
@media (max-width: 860px) and (orientation: landscape) {
  .room { --side-w: 240px; }
  .tile { aspect-ratio: 16 / 9; }
}
@media (max-width: 520px) {
  .controls [title^="Back 10"], .controls [title^="Forward 10"] { display: none; }
  .home { padding: 0 14px 40px; }
  .room-card { flex-direction: column; align-items: stretch; }
}
