:root { color-scheme: dark; }
    body { margin:0; background:#202124; color:#e8eaed; font-family: Roboto, system-ui, sans-serif; }
    .app { max-width:1200px; margin:0 auto; min-height:100vh; display:flex; flex-direction:column; }
    .topbar { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; }
    .title { font-size:18px; font-weight:600; }
    .badge { font-size:12px; padding:6px 10px; border-radius:999px; background:#2d2f31; color:#9aa0a6; }
    .badge.ok { color:#8ee4a1; }
    .badge.warn { color:#f9ab00; }
    .badge.err { color:#f28b82; }

    .precall { padding:16px; display:grid; gap:12px; grid-template-columns: 1fr 280px; }
    .card { background:#2b2c2f; border:1px solid #3c4043; border-radius:16px; padding:14px; }
    .row { display:flex; gap:8px; align-items:center; }
    input, button { background:#1f232a; color:#e8eaed; border:1px solid #3c4043; border-radius:12px; padding:10px 12px; font-size:14px; }
    input { width:100%; }
    button { cursor:pointer; }
    .primary { background:#1a73e8; border-color:#1a73e8; }
    .danger { background:#d93025; border-color:#d93025; }
    .muted { color:#9aa0a6; font-size:12px; }
    #myNpub { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; word-break:break-all; }
    #qr { width:240px; max-width:100%; border-radius:12px; background:#fff; }

    .scanWrap { display:none; margin-top:8px; }
    #scanVideo { width:100%; max-width:320px; border-radius:12px; border:1px solid #3c4043; }

    .stage { flex:1; padding:10px 16px 6px; display:none; }
    .videoStage { position:relative; border-radius:22px; overflow:hidden; background:#111; min-height:56vh; max-height:90vh; height:90vh; border:1px solid #3c4043; }
    #remoteVideo { width:100%; height:100%; object-fit:contain; background:#111; }
    .remote-landscape #remoteVideo { object-fit:contain; }
    .remote-portrait #remoteVideo { object-fit:contain; }
    #localVideo { position:absolute; right:16px; top:16px; width:22%; min-width:160px; max-width:280px; border-radius:12px; border:1px solid #3c4043; background:#000; object-fit:cover; }
    .overlayStatus { position:absolute; left:14px; top:14px; padding:8px 10px; border-radius:12px; background:rgba(32,33,36,.72); font-size:12px; color:#d2d7dc; backdrop-filter: blur(6px); }

    .controls { position:sticky; bottom:10px; display:flex; justify-content:center; gap:10px; padding:12px; }
    .ctrl { width:44px; height:44px; border-radius:50%; border:1px solid #3c4043; background:#2d2f31; color:#e8eaed; display:flex; align-items:center; justify-content:center; }
    .ctrl svg { width:20px; height:20px; stroke: currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
    .ctrl.off { color:#f28b82; border-color:#5b2a2a; }
    .ctrl.wide { width:auto; padding:0 16px; border-radius:999px; font-size:14px; }

    .debug { margin:8px 16px 16px; }
    details { background:#2b2c2f; border:1px solid #3c4043; border-radius:12px; padding:10px 12px; }
    #stats { margin-top:8px; white-space:pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; color:#8ab4f8; }

    #incomingWrap { display:none; margin-top:8px; }
    #incomingList > div { margin-top:8px; }

    dialog { border:1px solid #3c4043; border-radius:14px; background:#2b2c2f; color:#e8eaed; max-width:520px; width:92vw; }
    @media (max-width: 860px) {
      .precall { grid-template-columns: 1fr; }
      .videoStage { min-height:0; height:auto; max-height:90vh; aspect-ratio:16/9; }
      #remoteVideo { object-position:center top; }
      #localVideo { width:15%; min-width:96px; right:8px; top:8px; }
      .controls { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    }
