/* Same Sofa - house theme: white + light grey, burgundy, serif headings. Theatre mode is the one dark screen. */
:root {
  --bg: #ffffff; --panel2: #f2f2f2; --panel3: #e9e9e9;
  --line: #cccccc; --line3: #e4e4e4;
  --ink: #000000; --text: #333333; --muted: #666666; --dim: #8c8c8c;
  --burgundy: #800020; --wine: #a8323e; --tint: #f6e9ec;
  --ok: #2e7d4f; --bad: #c62828; --badbg: #fdf3f3;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --r: 4px; --shadow: 0 6px 24px rgba(0, 0, 0, .10);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; border-top: 4px solid var(--burgundy); }
[hidden] { display: none !important; }
a { color: var(--burgundy); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
::selection { background: var(--burgundy); color: #fff; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--ink); margin: 0; text-wrap: balance; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 17px; margin-bottom: 8px; }
h3 { font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .dim { color: var(--dim); font-size: 12px; } .small { font-size: 12.5px; }
.grow { flex: 1; }
.err { color: var(--bad); background: var(--badbg); border: 1px solid #ebb4b4; border-radius: var(--r); padding: 7px 10px; margin: 8px 0 0; font-size: 13px; }

/* controls */
input, select, button, .btn { font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 8px 11px; min-width: 0; }
input:focus, select:focus, button:focus-visible, .btn:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 1px; }
button, .btn { cursor: pointer; white-space: nowrap; display: inline-block; text-align: center; }
button:hover, .btn:hover { border-color: var(--burgundy); color: var(--burgundy); text-decoration: none; }
button.primary, .btn.primary { background: var(--burgundy); border-color: var(--burgundy); color: #fff; font-weight: 700; }
button.primary:hover, .btn.primary:hover { background: var(--wine); border-color: var(--wine); color: #fff; }
button:disabled { opacity: .45; cursor: default; }
.wide { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 6px; }
input[type=range] { padding: 0; border: 0; accent-color: var(--burgundy); background: transparent; }
input[type=checkbox] { accent-color: var(--burgundy); width: 16px; height: 16px; padding: 0; }

/* top bar */
.top { display: flex; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fff; }
.brandmark { display: flex; align-items: center; gap: 10px; }
.brandmark:hover { text-decoration: none; }
.logo { width: 32px; height: 32px; border-radius: 50%; background: var(--burgundy); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 16px; flex: none; }
.logo.big { width: 48px; height: 48px; font-size: 24px; margin: 0 auto 14px; }
.co { font-family: var(--serif); font-weight: 700; color: var(--burgundy); font-size: 19px; }
.tagline { color: var(--muted); font-size: 13px; }
.roomtitle { font-family: var(--serif); font-size: 16px; color: var(--ink); padding-left: 14px; border-left: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: #a9d3b9; }
.chip.bad { color: var(--bad); border-color: #ebb4b4; }
.chip.solid { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.pill { background: var(--burgundy); color: #fff; border-radius: 20px; padding: 1px 8px; font-size: 11px; margin-left: 4px; letter-spacing: 0; }

/* ad spaces */
.ad { margin: 16px 0; min-height: 90px; }
.ad.placeholder { border: 1px dashed var(--line); border-radius: var(--r); display: grid; place-items: center; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; background: #fafafa; }

/* room */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; padding: 20px 24px 32px; max-width: 1500px; margin: 0 auto; }
.panel { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.side .panel { background: var(--panel2); }
.stage { position: relative; background: #000; aspect-ratio: 16/9; border-radius: var(--r); overflow: hidden; }
#player, #player > * { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#player video { object-fit: contain; background: #000; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #d8d0d2; padding: 24px; font-family: var(--serif); font-size: 19px; background: #1a1114; }
.empty small { display: block; font-family: var(--sans); font-size: 13px; color: #a8999d; margin-top: 8px; }
.notice { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(0, 0, 0, .78); color: #fff; padding: 7px 14px; border-radius: 20px; font-size: 13px; z-index: 6; max-width: 90%; text-align: center; }
.notice button { margin-left: 8px; padding: 3px 10px; }

.bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 26px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .82)); color: #fff; transition: opacity .25s; }
/* stays hoverable while hidden: a YouTube frame swallows mouse movement, so the bottom edge is what wakes the bar */
.stage.idle .bar { opacity: 0; }
.stage.idle { cursor: none; }
.bar .ic { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; padding: 5px 10px; font-size: 12.5px; }
.bar .ic:hover { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.bar .ic.on { background: var(--burgundy); border-color: var(--burgundy); }
.bar #bPlay { min-width: 62px; font-weight: 700; }
.bar #seek { flex: 1; }
.bar #myVol { width: 84px; }
.bar input[type=range] { accent-color: #fff; }
.bar input:disabled { opacity: .55; }
.time { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
.live { font-size: 11px; font-weight: 700; letter-spacing: .8px; background: var(--bad); padding: 1px 7px; border-radius: 3px; }

#floaters { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.floater { position: absolute; bottom: 60px; font-size: 38px; animation: rise 2.6s ease-out forwards; }
@keyframes rise { from { transform: translateY(0) scale(.7); opacity: 0; } 12% { opacity: 1; transform: translateY(-20px) scale(1.1); } to { transform: translateY(-260px) scale(1); opacity: 0; } }
#toasts { position: absolute; left: 14px; bottom: 64px; z-index: 4; display: none; flex-direction: column; gap: 6px; max-width: 46%; pointer-events: none; }
.toast { background: rgba(0, 0, 0, .7); color: #fff; padding: 6px 12px; border-radius: 14px; font-size: 13.5px; animation: fade 6s forwards; overflow-wrap: anywhere; }
.toast b { color: #f2b8c2; margin-right: 6px; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

.reacts { display: flex; gap: 8px; margin: 12px 0 14px; }
.reacts button { font-size: 19px; padding: 3px 12px; line-height: 1.4; }
.grid { display: grid; grid-template-columns: 1fr 160px; gap: 14px 24px; margin-top: 14px; align-items: end; }
.field span { display: block; }
.field b { color: var(--burgundy); }
.field input, .field select { width: 100%; }
.switch { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); margin: 0; cursor: pointer; grid-column: 1 / -1; }
.guestnote { margin: 0 0 4px; }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line3); }
.people li:last-child { border-bottom: 0; }
.people .av { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: var(--burgundy); font-size: 13px; flex: none; }
.people .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--burgundy); border: 1px solid var(--burgundy); border-radius: 3px; padding: 0 5px; }
.people button { padding: 2px 8px; font-size: 12px; }
.chatlog { height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; margin-bottom: 8px; }
.chatlog .msg { margin-bottom: 6px; overflow-wrap: anywhere; }
.chatlog .msg b { color: var(--burgundy); margin-right: 6px; }
.chatlog .sys { color: var(--dim); font-size: 12px; margin-bottom: 6px; }
#inviteUrl { font-size: 12px; }
#bNewInvite { display: inline-block; margin-top: 8px; }

/* cameras */
.cams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cam { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: var(--r); overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam.me video { transform: scaleX(-1); }
.cam span { position: absolute; left: 6px; bottom: 5px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.cams.float { position: absolute; top: 14px; right: 14px; width: 168px; display: flex; flex-direction: column; margin: 0; z-index: 4; }
.cams.float .cam { box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
/* a tile can be dragged out of the panel, moved anywhere and enlarged; "Put back" returns it */
.cam { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.cam.dragging { cursor: grabbing; }
.cam.out { position: fixed; z-index: 40; aspect-ratio: auto; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .25); }
.camtools { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.cam:hover .camtools, .cam.out .camtools, .camtools:focus-within { opacity: 1; }
.camtools button { padding: 1px 7px; font-size: 11px; line-height: 1.5; background: rgba(0, 0, 0, .62); color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; }
.camtools button:hover { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
@media (hover: none) { .camtools { opacity: 1; } }
#camPanel .switch { margin-top: 10px; }
.camnote { margin-top: 8px; }
.follownote { margin: 4px 0 0 30px; color: var(--burgundy); }

/* gates */
.gate { position: fixed; inset: 0; background: rgba(255, 255, 255, .94); display: grid; place-items: center; z-index: 50; padding: 20px; }
.card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--burgundy); border-radius: var(--r); padding: 28px; box-shadow: var(--shadow); text-align: center; }
.card h1 { margin-bottom: 6px; }
.card label { text-align: left; margin-top: 18px; }
.card input { width: 100%; margin-bottom: 14px; }

/* theatre mode: lights down, nothing but the picture */
body.theatre { background: #000; border-top-color: #000; overflow: hidden; }
body.theatre .top, body.theatre .side, body.theatre .panel, body.theatre .ad, body.theatre .reacts, body.theatre .guestnote { display: none !important; }
body.theatre .layout { display: block; padding: 0; max-width: none; }
body.theatre .stage { position: fixed; inset: 0; aspect-ratio: auto; border-radius: 0; }
body.theatre #toasts, .stage:fullscreen #toasts { display: flex; }
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; }

/* The foyer and viewing room share a warm paper and oxblood palette. */
:root {
  --bg:#fbf8f3; --panel2:#f6f0e9; --line:#d8cfc8; --line3:#e5dcd5;
  --ink:#322128; --text:#403237; --muted:#68595d; --dim:#746569;
  --burgundy:#79233b; --wine:#631b32; --r:10px;
}
body {font-size:1rem;border:0}
.top {padding:1.05rem max(5vw,calc((100vw - 1260px)/2));background:var(--bg);justify-content:space-between}
.brandmark {gap:.55rem}
.logo {background:transparent;color:var(--burgundy);width:34px;height:34px;border-radius:0}
.logo svg {display:block;width:100%;height:100%}
.co {font-size:1.65rem;letter-spacing:-.065em}
.top nav {display:flex;gap:2rem}
nav a {font-size:.91rem;color:var(--text);font-weight:600}
.home {max-width:1400px;margin:auto;padding:0 min(5%,70px)}
.hero {display:grid;grid-template-columns: .9fr 1.1fr;align-items:center;gap:clamp(2rem,5vw,5rem);padding:clamp(2.4rem,5vw,5.3rem) 0}
.hero h1 {font-size:clamp(3rem,5.5vw,4.9rem);font-weight:400;letter-spacing:-.067em;line-height:1.03}
.hero h1 em {color:var(--burgundy);font-weight:400}
.lead {max-width:36ch;margin:1.3rem 0 1.9rem;font-size:clamp(1rem,1.25vw,1.17rem);line-height:1.6;color:var(--muted)}
.create {max-width:29rem}
label {font-size:.875rem;letter-spacing:0;text-transform:none;color:var(--ink);font-weight:600}
.create label {margin-bottom:.55rem}
.create input,.create button,.card input,.card button,.card .btn {padding:.78rem 1rem}
.create .dim {margin:.65rem 0 0}
.dim,.small {font-size:.84rem}
.lounge {width:100%;height:auto;display:block;border-radius:18px}
.how,.faq {border-top:1px solid var(--line);padding:2.4rem 0 3rem;scroll-margin-top:1.25rem}
.home h2 {font-size:clamp(1.9rem,3vw,2.8rem);line-height:1.14;font-weight:400;letter-spacing:-.05em}
.steps {display:grid;grid-template-columns:repeat(3,1fr);gap:2.2rem;margin-top:1.75rem}
.steps article+article {border-left:1px solid var(--line);padding-left:2.2rem}
.steps svg {width:29px;height:29px;color:var(--burgundy);margin-bottom:.65rem}
h3 {font:500 1.4rem/1.25 var(--serif);color:var(--ink);text-transform:none;letter-spacing:-.035em}
.steps p,.faq p {margin:0;color:var(--muted);max-width:42ch}
.faq {display:grid;grid-template-columns:1fr 1.5fr;gap:2rem}
summary {cursor:pointer;font-weight:600}
.faq details {border-bottom:1px solid var(--line);padding:.85rem 0}
.faq details:first-child {padding-top:.3rem}
.faq summary {list-style:none;display:flex;justify-content:space-between;gap:1rem}
.faq summary::-webkit-details-marker {display:none}
.faq summary:after {content:'+';color:var(--burgundy)}
.faq details[open] summary:after {content:'−'}
.faq p {margin:.6rem 0;max-width:60ch}
.foot {padding:1.1rem max(5vw,calc((100vw - 1260px)/2));border-top:1px solid var(--line);font-family:var(--serif);color:var(--burgundy)}
.foot span {font:.8rem var(--sans);margin-left:.5rem;color:var(--muted)}
.ad.placeholder {display:none}
#room .top {justify-content:flex-start;padding:.8rem 3%}
.roomtitle {font-size:1.2rem}
.layout {grid-template-columns:minmax(0,1fr) minmax(300px,25%);gap:1.35rem;padding:1.5rem 3%}
.main,.side {min-width:0}
.panel,.side .panel {padding:1.15rem;background:#fffdfa;border-color:var(--line3);border-radius:14px}
.panel h3 {margin-bottom:.85rem}
#invitePanel {background:#f4e8e8}
.text-button {border:0;background:transparent;padding:2px 0;color:var(--burgundy);text-decoration:underline;font-size:.85rem}
.chatlog {background:var(--bg);height:clamp(9rem,22vh,17rem);padding:.8rem}
.chatlog .msg {line-height:1.4;margin-bottom:.5rem}
.settings {border-top:1px solid var(--line3);margin-top:1rem;padding-top:.8rem}
.settings summary,.camhelp summary {font-size:.9rem;color:var(--burgundy)}
.camhelp {margin-top:.75rem}
.stage {border-radius:15px}
.empty {display:flex;flex-direction:column;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 15%,#4b2b38,#251920 76%);font-size:clamp(1.2rem,2.5vw,2.3rem);color:#fff8f1;line-height:1.2}
.empty small {font:400 .9rem/1.4 var(--sans);color:#d4c5c9}
.bar {gap:.45rem}
.bar #seek {min-width:34px}
.stage.idle:focus-within .bar {opacity:1}
.reacts {flex-wrap:wrap;gap:.4rem}
.reacts button {border-radius:100px;background:#fffdfa}
.gate {background:linear-gradient(90deg,rgba(40,17,28,.67),rgba(40,17,28,.52)),url('lounge.webp') center/cover;overflow-y:auto}
.card {border:0;border-radius:18px;padding:2rem;background:var(--bg);max-width:410px}
.card h1 {font-size:2.1rem;font-weight:400;letter-spacing:-.05em}
.card .logo {margin-bottom:1rem}
:focus-visible {outline:3px solid #9b5266;outline-offset:3px}
@media(max-width:1060px){
  .layout {grid-template-columns:minmax(0,1fr) 285px;padding:1rem;gap:.9rem}
  .bar {flex-wrap:wrap}.bar #myVol {width:50px}
  #srcForm {flex-wrap:wrap}#srcForm input {flex-basis:100%}
}
@media(max-width:800px){
  .hero {grid-template-columns:1fr 1fr;gap:1.4rem}.hero h1 {font-size:3.1rem}
  .lounge {aspect-ratio:1/1.1;object-fit:cover}
  .create .row {flex-wrap:wrap}.create input {min-width:10rem}
  .layout {grid-template-columns:1fr}
}
@media(max-width:620px){
  .top {padding:1rem 5%;gap:.6rem}.co {font-size:1.4rem}.top nav {gap:.9rem}.top nav a {font-size:.83rem}
  .hero {grid-template-columns:1fr;padding:2rem 0;gap:1.5rem}
  .hero h1 {font-size:clamp(3.3rem,12.5vw,4.5rem)}.lead {margin:1rem 0 1.3rem}
  .lounge {aspect-ratio:4/3}.how,.faq {padding:1.8rem 0}
  .steps,.faq {grid-template-columns:1fr;gap:1rem}
  .steps article,.steps article+article {display:grid;grid-template-columns:32px 1fr;gap:.35rem .85rem;padding:0;border:0}
  .steps h3,.steps svg {margin:0}.steps p {grid-column:2}
  #room .top {flex-wrap:wrap}.roomtitle {flex:1;min-width:5ch}.grow {display:none}
  .layout {padding:.7rem}.stage {min-height:235px}
  .bar {gap:.3rem;padding:.4rem;background:rgba(18,12,16,.86)}
  .bar .ic {font-size:.8rem;padding:.35rem .5rem}
  .bar #seek {min-width:32%}.bar #myVol {width:45px}
  .cams.float {width:96px}.grid {grid-template-columns:1fr}
  .empty {padding:1rem 1rem 4.5rem}
}
@media(prefers-reduced-motion:reduce){.floater,.toast {animation-duration:.01s}}

/* ---- ready check, intermission, up next, quoted moments, setup check ---- */
.underbar {display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:12px 0 14px}
.underbar .reacts {margin:0}
.underbar > button {border-radius:100px;background:#fffdfa;font-size:.88rem;padding:.4rem .95rem}
body.theatre .underbar {display:none !important}
.readybox {position:absolute;left:14px;top:14px;z-index:6;width:min(250px,62%);background:rgba(34,19,26,.93);color:#fff8f1;border:1px solid rgba(255,255,255,.2);border-radius:14px;padding:.75rem .85rem;font-size:.85rem;box-shadow:0 6px 24px rgba(0,0,0,.4)}
.readybox .t {display:block;font-family:var(--serif);font-weight:400;font-size:1.15rem;letter-spacing:-.02em;line-height:1.2}
.readybox .n {color:#e7c9a5;font-weight:700}
.readybox ul {list-style:none;margin:.45rem 0 .6rem;padding:0;max-height:7.6rem;overflow-y:auto}
.readybox li {display:flex;justify-content:space-between;gap:.6rem;padding:.12rem 0;color:#bfaeb3}
.readybox li.on {color:#fff}
.readybox li span:first-child {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.readybox li span:last-child {font-size:.74rem;white-space:nowrap}
.readybox li.on span:last-child {color:#9fdcb5}
.readybox .row {gap:.4rem;flex-wrap:wrap}
.readybox button {padding:.3rem .8rem;font-size:.82rem}
.stage.idle .readybox {opacity:1}
.queue {list-style:none;margin:0 0 .6rem;padding:0}
.queue li {padding:.55rem 0;border-bottom:1px solid var(--line3)}
.queue li:first-child {padding-top:0}
.queue .ql {font-weight:600;color:var(--ink);overflow-wrap:anywhere;line-height:1.3}
.queue .qb {display:flex;align-items:center;gap:.4rem;margin-top:.3rem;font-size:.8rem;color:var(--muted)}
.queue .qb span {flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.queue button {padding:.15rem .6rem;font-size:.78rem}
#qEmpty {margin:0 0 .7rem}
#qForm input {min-width:0}
.stampbtn {font-size:.8rem;padding-left:.6rem;padding-right:.6rem}
.stampbtn.on {background:var(--burgundy);border-color:var(--burgundy);color:#fff}
#chatForm {flex-wrap:wrap}
#chatForm input {flex:1 1 100%}
#chatForm .stampbtn {flex:1}
.chatlog .stamp {display:inline-block;margin-right:6px;padding:0 .45rem;font:600 .74rem/1.5 var(--sans);border:1px solid var(--line);border-radius:100px;background:#fffdfa;color:var(--burgundy);cursor:pointer;vertical-align:1px}
.chatlog .stamp:hover {background:var(--burgundy);border-color:var(--burgundy);color:#fff}
.toast .stamp {margin-right:6px;opacity:.85}
.setup {text-align:left;margin:0 0 14px;border:1px solid var(--line3);border-radius:10px;padding:.55rem .8rem;background:#fffdfa}
.setup summary {cursor:pointer;font-size:.9rem;font-weight:600;color:var(--burgundy)}
.setup .row {margin-top:.6rem;gap:.4rem;flex-wrap:wrap}
.setup .row button {flex:1;font-size:.85rem}
.setup video {display:block;width:100%;aspect-ratio:4/3;object-fit:cover;background:#000;border-radius:8px;margin-top:.6rem;transform:scaleX(-1)}
.setup .switch {margin-top:.6rem}
.card .setup .switch input {width:auto;margin:0}
.card .setup label {margin-top:.6rem}
.setup p {margin:.5rem 0 0}
@media (max-width:620px) { .readybox {left:8px;top:8px;font-size:.8rem} }

/* ---- lower tiles sit under the player, beside the chat column ---- */
.lower {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;align-items:start;margin-top:.2rem}
.lower .panel {margin-bottom:0}
.lower + .ad {margin-top:1rem}
.guestnote {margin-bottom:.9rem}
@media (max-width:1180px) { .lower {grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:760px) { .lower {grid-template-columns:1fr} }

/* ---- fitted room: on a wide desktop window the whole room fits the window, nothing scrolls off ----
   three columns: player + controls | invite + chat | cameras + up next + people (each list scrolls inside itself) */
@media (min-width:1400px) and (min-height:600px) {
  body:not(.theatre) #room:not([hidden]) {height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
  body:not(.theatre) #room .top {flex:none;padding-top:.7rem;padding-bottom:.7rem}
  body:not(.theatre) .layout {flex:1;min-height:0;max-width:none;width:100%;margin:0;padding:1rem 2% 1rem;
    display:grid;gap:0 1.1rem;grid-template-columns:minmax(0,1fr) clamp(290px,18vw,360px) clamp(290px,18vw,360px);
    grid-template-rows:minmax(160px,1fr) auto auto auto auto}
  body:not(.theatre) .main {display:contents}
  body:not(.theatre) .stage {grid-area:1/1;aspect-ratio:auto;min-height:0;height:100%;width:100%}
  body:not(.theatre) .underbar {grid-area:2/1;margin:.6rem 0 0}
  body:not(.theatre) #hostPanel {grid-area:3/1;margin:.6rem 0 0;padding:.8rem 1rem}
  body:not(.theatre) #hostPanel h3 {margin-bottom:.5rem;font-size:1.1rem}
  body:not(.theatre) #hostPanel .settings {margin-top:.6rem;padding-top:.5rem}
  body:not(.theatre) .guestnote {grid-area:4/1;margin:.5rem 0 0}
  body:not(.theatre) .layout > .ad, body:not(.theatre) .main > .ad {grid-area:5/1;margin:.6rem 0 0}
  body:not(.theatre) .main > .ad.placeholder {display:none}
  body:not(.theatre) .side {grid-column:2;grid-row:1/-1;min-height:0;display:flex;flex-direction:column;gap:.8rem}
  body:not(.theatre) .lower {grid-column:3;grid-row:1/-1;min-height:0;display:flex;flex-direction:column;gap:.8rem;margin:0}
  body:not(.theatre) .side .panel, body:not(.theatre) .lower .panel {margin:0;padding:.9rem 1rem}
  body:not(.theatre) .side .panel h3, body:not(.theatre) .lower .panel h3 {margin-bottom:.55rem}
  body:not(.theatre) .lower {align-items:stretch}
  body:not(.theatre) #hostPanel .settings .grid {display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1.6rem;margin-top:.5rem}
  body:not(.theatre) #hostPanel .settings .field {flex:1 1 220px;margin:0}
  body:not(.theatre) #hostPanel .settings .field:nth-child(2) {flex:0 0 120px}
  body:not(.theatre) #hostPanel .settings .switch {flex:0 0 auto}
  body:not(.theatre) #invitePanel {flex:none}
  body:not(.theatre) .panel.chat {flex:1;min-height:0;display:flex;flex-direction:column}
  body:not(.theatre) .chatlog {flex:1;height:auto;min-height:3rem}
  body:not(.theatre) #camPanel {flex:0 1 auto;max-height:52%;overflow-y:auto}
  body:not(.theatre) #queuePanel {flex:1 1 0;min-height:7rem;overflow-y:auto}
  body:not(.theatre) .lower > .panel:last-child {flex:0 1 auto;max-height:30%;overflow-y:auto}
}

/* ---- phones and small tablets ---- */
/* join screen: a tall card (camera preview open) must scroll, never be cut off or wider than the screen */
.gate {grid-template-columns:minmax(0,1fr);place-items:start center;-webkit-overflow-scrolling:touch}
.gate > .card {margin:auto;min-width:0}
.setup, .setup video {min-width:0;max-width:100%}
.nofull #bFull, .noshare #bScreen {display:none !important}
@media (max-width:760px) {
  input, select, textarea {font-size:16px}              /* smaller fields make iPhones zoom the page on focus */
  .top {padding:.55rem .8rem;gap:.5rem}
  .co {font-size:1.3rem}
  .logo {width:28px;height:28px}
  .roomtitle {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.95rem}
  .card {padding:1.4rem 1.1rem}
  .card h1 {font-size:1.7rem}
  .gate {padding:12px}
  /* room: one column. The picture stays stuck to the top while chat and the rest scroll under it. */
  body:not(.theatre) #room .layout {display:flex;flex-direction:column;padding:0 0 1.4rem;gap:0}
  body:not(.theatre) #room .main, body:not(.theatre) #room .side, body:not(.theatre) #room .lower {display:contents}
  body:not(.theatre) #room .stage {order:1;position:sticky;top:0;z-index:20;border-radius:0;width:100%;min-height:0;aspect-ratio:16/9;max-height:56dvh}
  body:not(.theatre) #room .underbar {order:2;margin:.6rem .7rem .1rem}
  body:not(.theatre) #room #hostPanel {order:3}
  body:not(.theatre) #room .guestnote {order:3;margin:.5rem .9rem 0}
  body:not(.theatre) #room #invitePanel {order:4}
  body:not(.theatre) #room .panel.chat {order:5}
  body:not(.theatre) #room #camPanel {order:6}
  body:not(.theatre) #room #queuePanel {order:7}
  body:not(.theatre) #room .lower > .panel:last-child {order:8}
  body:not(.theatre) #room .ad {order:9;margin:.6rem .7rem 0}
  body:not(.theatre) #room .panel {margin:.6rem .7rem 0;padding:.9rem}
  .chatlog {height:11rem}
  .underbar .reacts {flex:1 1 100%;justify-content:space-between}
  .underbar .grow {display:none}
  .underbar > button {flex:1 1 auto;min-height:38px}
  .reacts button {padding:3px 9px}
  .bar {gap:5px;padding:22px 8px 8px}
  .bar .ic {padding:.4rem .55rem;min-height:36px;font-size:.78rem}
  .bar {flex-wrap:nowrap}
  .bar #tDur, .bar #myVol, .bar #bFull, .bar #bCamBar {display:none}
  .bar #seek {min-width:40px}
  #room .co {display:none}
  .readybox {width:auto;max-width:72%;padding:.5rem .65rem}
  .readybox ul {display:none}
  .readybox .t {font-size:1rem}
  .queue button, .people button {min-height:32px}
  .camtools button {min-height:28px;padding:2px 9px}
  #srcForm {flex-wrap:wrap} #srcForm input {flex-basis:100%} #srcForm button {flex:1}
  .settings .grid {grid-template-columns:1fr}
}
/* a phone held sideways: the picture takes the whole screen height, the rest is below it */
@media (max-height:520px) and (orientation:landscape) and (max-width:1000px) {
  body:not(.theatre) #room .top {display:none}
  body:not(.theatre) #room .stage {aspect-ratio:auto;height:100dvh;max-height:none}
}
