:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #101d29;
  --panel2: #152638;
  --line: #29425a;
  --text: #f5f8fb;
  --muted: #9db3c8;
  --cyan: #19a7df;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #123047 0, var(--bg) 44%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.shell { width: min(980px, 100%); margin: 0 auto; padding: 12px; }
.topbar, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-lockup img { width: clamp(86px, 16vw, 142px); height: auto; flex: 0 0 auto; object-fit: contain; }
h1, h2 { margin: 0; line-height: 1; letter-spacing: 0; }
h1 { font-size: clamp(24px, 5vw, 38px); }
h2 { font-size: clamp(18px, 3.5vw, 25px); }
.eyebrow { color: #20c8ff; font-size: 11px; font-weight: 800; margin-bottom: 5px; }
.status, .badge { border: 1px solid var(--line); background: rgba(16,29,41,.86); border-radius: 6px; padding: 9px 11px; font-weight: 800; white-space: nowrap; }
.status span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: #64748b; }
.status.on span { background: var(--green); }
.status.warn span { background: var(--amber); }
.card { background: rgba(16,29,41,.94); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; box-shadow: 0 18px 48px rgba(0,0,0,.26); }
.setup { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; align-items: end; gap: 10px; }
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-row { display: none; }
.guest-link { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.guest-link input { color: #bfe7ff; }
button { color: var(--text); background: #102235; border: 1px solid #395875; border-radius: 4px; min-height: 42px; padding: 0 14px; font-weight: 800; cursor: pointer; }
button.active, button.primary { background: #0b79a8; border-color: #18b7ef; }
button.danger { border-color: #b91c1c; background: #711c22; }
button:disabled { opacity: .45; cursor: not-allowed; }
label { color: var(--muted); font-size: 12px; font-weight: 800; }
input { display: block; width: 100%; margin-top: 5px; min-height: 42px; background: #06111b; color: var(--text); border: 1px solid #37536e; border-radius: 4px; padding: 0 10px; font-size: 16px; font-weight: 700; }
.hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 12px; }
.meter-wrap { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; margin: 16px 0; }
.avatar { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #0476a8, #142235); border: 1px solid #4b7894; font-weight: 900; }
.meter { height: 20px; border-radius: 5px; border: 1px solid #2e526c; background: #07131f; overflow: hidden; }
.meter-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #22c55e 0 70%, #facc15 80%, #ef4444 100%); transition: width .08s linear; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.participants-list { display: grid; gap: 8px; margin-top: 12px; min-height: 120px; }
.participants-list.empty { color: var(--muted); align-content: center; text-align: center; }
.participant { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; background: var(--panel2); border: 1px solid #2f4a62; border-radius: 6px; padding: 10px; }
.participant strong { display: block; font-size: 14px; }
.participant small { color: var(--muted); }
.remote-meter { height: 8px; border-radius: 999px; margin-top: 8px; background: #07131f; overflow: hidden; }
.remote-meter div { height: 100%; width: 0%; background: var(--green); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; min-height: 70px; }
video { width: 100%; aspect-ratio: 16/9; background: #020910; border: 1px solid #29425a; border-radius: 6px; object-fit: cover; }
body[data-role="guest"] .mode-row,
body[data-role="guest"] .guest-link,
body[data-role="guest"] label:has(#roomInput),
body[data-role="guest"] #speakerBtn,
body[data-role="guest"] #testAudioBtn {
  display: none;
}
body[data-role="guest"] .setup {
  grid-template-columns: 1fr auto;
}
body[data-role="guest"] .local .section-head .eyebrow {
  color: var(--green);
}
@media (max-width: 720px) {
  body { min-height: 100svh; background: #071019; }
  .shell { padding: 8px; min-height: 100svh; display: grid; grid-template-rows: auto auto 1fr auto; }
  .topbar { align-items: center; }
  .brand-lockup { gap: 10px; }
  .brand-lockup img { width: 58px; }
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  .eyebrow { font-size: 9px; margin-bottom: 3px; }
  .card { padding: 9px; margin-top: 8px; }
  .setup, .grid { grid-template-columns: 1fr; }
  .guest-link { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr 1fr; gap: 6px; }
  .mode-row { grid-template-columns: 1fr 1fr 1fr; }
  .status { font-size: 11px; padding: 7px; }
  button { min-height: 36px; padding: 0 10px; font-size: 12px; }
  input { min-height: 36px; font-size: 14px; }
  .hint { font-size: 11px; }
  .meter-wrap { grid-template-columns: 48px 1fr; gap: 8px; margin: 9px 0; }
  .avatar { width: 48px; height: 48px; border-radius: 8px; font-size: 13px; }
  .meter { height: 14px; }
  .participants-list { min-height: 54px; gap: 6px; margin-top: 8px; }
  .participant { grid-template-columns: 1fr 72px; padding: 7px; }
  .participant strong { font-size: 12px; }
  .participant small { font-size: 11px; }
  .video-strip { display: none; }
  .local .section-head { display: none; }
}

@media (max-width: 720px) and (orientation: portrait) {
  body[data-role="guest"] .brand-lockup img { width: 48px; }
  body[data-role="guest"] h1 { font-size: 18px; }
  body[data-role="guest"] .setup { grid-template-columns: 1fr; }
  body[data-role="guest"] .setup label,
  body[data-role="guest"] .setup button { width: 100%; }
  body[data-role="guest"] .grid { gap: 0; }
  body[data-role="guest"] .participants { min-height: 82px; }
  body[data-role="guest"] .local { order: -1; }
  body[data-role="guest"] .controls { grid-template-columns: 1fr 1fr; }
  body[data-role="guest"] #camBtn { display: none; }
  body[data-role="guest"] #micBtn { grid-column: 1 / -1; }
}
