*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:#0b1220;color:#e5e7eb;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  display:flex;align-items:center;justify-content:center;
  -webkit-user-select:none;user-select:none;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main{display:flex;flex-direction:column;align-items:center;gap:18px;width:100%;max-width:420px;padding:24px}
h1{font-size:20px;letter-spacing:.35em;font-weight:700;color:#94a3b8}
#agents{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.agent{
  background:#111c33;border:1px solid #1e293b;color:#cbd5e1;border-radius:14px;
  padding:12px 18px;font-size:16px;display:flex;flex-direction:column;gap:2px;align-items:center;
}
.agent small{color:#64748b;font-size:11px}
.agent.sel{border-color:#22c55e;background:#12233a;color:#fff}
#callbtn{
  width:120px;height:120px;border-radius:50%;border:none;cursor:pointer;
  background:#22c55e;color:#06220f;display:flex;align-items:center;justify-content:center;
  box-shadow:0 0 0 10px rgba(34,197,94,.12);
  transition:transform .1s, background .2s;
  touch-action:manipulation;-webkit-tap-highlight-color:transparent;
}
#callbtn:active{transform:scale(.94)}
#callbtn.on{background:#ef4444;color:#2b0505;box-shadow:0 0 0 10px rgba(239,68,68,.14)}
#btnlabel{font-size:15px;color:#94a3b8}
#timer{font-size:28px;font-variant-numeric:tabular-nums;color:#e5e7eb;min-height:34px}
#status{font-size:13px;color:#64748b;text-align:center;min-height:18px;padding:0 12px}

#mediarow{display:flex;gap:14px;justify-content:center;margin-top:14px}
.mediabtn{width:46px;height:46px;border-radius:50%;border:1px solid #334155;background:#1a2436;color:#e2e8f0;font-size:20px;display:grid;place-items:center;cursor:pointer}
.mediabtn:active{transform:scale(.94)}
.mediabtn.big{width:60px;height:60px;font-size:26px}
#camview{position:fixed;inset:0;background:#000;z-index:50;display:flex;flex-direction:column}
#camview[hidden]{display:none}
#camvideo{flex:1;object-fit:contain;width:100%}
.camrow{display:flex;gap:16px;justify-content:center;padding:16px}

/* --- login --- */
#login{position:fixed;inset:0;background:#0b1220;display:grid;place-items:center;z-index:50}
.loginbox{width:min(340px,88vw);text-align:center}
.loginbox h1{margin:0 0 4px}
.loginsub{color:#8b98ad;margin:0 0 22px;font-size:14px}
#googlebtn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;padding:13px;font-size:15px;border-radius:10px;border:1px solid #3a4456;background:#fff;color:#1f2430;font-weight:600;cursor:pointer}
.logindiv{display:flex;align-items:center;gap:10px;color:#5b6779;font-size:12px;margin:16px 0}
.logindiv:before,.logindiv:after{content:"";flex:1;height:1px;background:#2a3446}
#lemail,#lpass{width:100%;box-sizing:border-box;padding:13px;margin:0 0 10px;font-size:15px;border-radius:10px;border:1px solid #3a4456;background:#1a2436;color:#eee}
#emailbtn{width:100%;padding:13px;font-size:15px;border-radius:10px;border:0;background:#2b5fd9;color:#fff;font-weight:600;cursor:pointer}
.linkbtn{background:none;border:0;color:#7ea4f4;margin-top:12px;font-size:14px;cursor:pointer}
#loginerr{color:#ff7b72;font-size:13px;margin-top:10px;min-height:18px}
#logoutbtn{position:fixed;top:14px;right:14px;z-index:40;width:38px;height:38px;border-radius:50%;border:1px solid #3a4456;background:#1a2436;color:#8b98ad;font-size:16px;cursor:pointer}
#login[hidden]{display:none !important}

/* --- Fase 1: chat --- */
#chatbox{width:100%;display:flex;flex-direction:column;gap:8px;margin-top:4px}
#chatlog{display:flex;flex-direction:column;gap:8px;max-height:36dvh;overflow-y:auto;padding:4px 2px;-webkit-overflow-scrolling:touch}
.bubble{max-width:85%;padding:10px 14px;border-radius:16px;font-size:15px;line-height:1.4;white-space:pre-wrap;word-break:break-word;-webkit-user-select:text;user-select:text}
.bubble.me{align-self:flex-end;background:#2b5fd9;color:#fff;border-bottom-right-radius:4px}
.bubble.them{align-self:flex-start;background:#1a2436;border:1px solid #2a3446;color:#e5e7eb;border-bottom-left-radius:4px}
#chatrow{display:flex;gap:8px;align-items:center}
#chatinput{flex:1;padding:12px 14px;font-size:15px;border-radius:22px;border:1px solid #3a4456;background:#1a2436;color:#eee;min-width:0}
#sendbtn,#micbtn{width:44px;height:44px;border-radius:50%;border:1px solid #334155;background:#1a2436;color:#e2e8f0;font-size:17px;cursor:pointer;flex:none}
#micbtn.on{background:#ef4444;border-color:#ef4444;color:#fff}
