[hidden] { display: none !important; }
:root {
  --bg: #F2F4F8; --surface: #FFFFFF; --ink: #111827; --muted: #5B6575; --line: #DCE1E8;
  --accent: #1A73E8; --accent-2: #1557B0; --bad: #D93025; --bad-soft: #FCE8E6; --ok: #188038;
  --call: #111827; --tile: #1F2937; --tile-2: #374151; --ctl: #2D3748; --ctl-on: #E8EAED;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F141B; --surface: #18202A; --ink: #E8EDF3; --muted: #9AA7B5; --line: #2B3644; --bad-soft: #3A1F1D; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Roboto, system-ui, Arial, sans-serif; font-size: 15px; }
button, input, textarea { font: inherit; color: inherit; }
.screen { min-height: 100%; }

/* home + left */
.home { display: grid; place-items: center; padding: 20px 16px; }
.home-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; }
.home-box.center { text-align: center; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand img { width: 52px; height: 52px; }
.brand h1 { margin: 0; font-size: 24px; }
.brand p { margin: 2px 0 0; color: var(--muted); }
.lbl { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
input[type=text], textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.big { width: 100%; margin-top: 14px; padding: 14px; font-size: 17px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); width: 100%; margin-top: 6px; }
.opts { margin-top: 10px; font-size: 14px; }
.opts summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.opts input { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 20px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.joinrow { display: flex; gap: 8px; }
.joinrow input { flex: 1; min-width: 0; }
#pass { margin-top: 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.hint.center { text-align: center; margin-top: 16px; }
.sub { color: var(--muted); margin: 6px 0 0; }
.sub b { color: var(--ink); }
.err { background: var(--bad-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 600; padding: 0; font-size: inherit; }

/* preview */
.preview { display: grid; place-items: center; padding: 16px; }
.pv-box { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 24px; align-items: center; width: 100%; max-width: 980px; }
.pv-video { position: relative; aspect-ratio: 16 / 9; background: #202124; border-radius: 16px; overflow: hidden; }
.pv-video video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pv-off { position: absolute; inset: 0; display: grid; place-items: center; }
.pv-off span, .avatar { width: 96px; height: 96px; border-radius: 50%; background: #5F6368; color: #fff; display: grid; place-items: center; font-size: 40px; font-weight: 600; }
.pv-ctrls { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 14px; }
.pv-side h2 { margin: 0; font-size: 24px; }
@media (max-width: 760px) { .pv-box { grid-template-columns: 1fr; } .pv-side { text-align: center; } }

/* round + control buttons */
.round { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center; cursor: pointer; }
.round.off { background: var(--bad); border-color: var(--bad); }
.round svg, .ctl svg { width: 24px; height: 24px; fill: currentColor; }

.call { background: var(--call); color: #fff; height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); font-size: 14px; }
.tb-left { display: flex; gap: 10px; align-items: center; }
.dim { color: #9CA3AF; }
.banner { background: #B45309; color: #fff; text-align: center; padding: 6px 12px; font-size: 14px; }
.stage { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 0 10px; }
.tiles { flex: 1; min-width: 0; position: relative; margin-bottom: 4px; }
.tile { position: absolute; background: var(--tile); border-radius: 12px; overflow: hidden; cursor: pointer; outline: 3px solid transparent; transition: outline-color .2s, left .25s, top .25s, width .25s, height .25s; }
.tile.speaking { outline-color: #34A853; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.contain video { object-fit: contain; }
.tile.me video { transform: scaleX(-1); }
.tile.me.screen video { transform: none; }
.tile .avatar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; font-size: 30px; }
.tile .nm { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; font-size: 13px; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); }
.tile .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .nm svg { width: 15px; height: 15px; fill: #F28B82; flex: none; }
.tile .hand { position: absolute; top: 8px; left: 8px; font-size: 22px; }
.tile .state { position: absolute; top: 8px; right: 8px; font-size: 12px; background: rgba(0,0,0,.55); border-radius: 6px; padding: 2px 7px; }
.tile.pinned { outline-color: rgba(138,180,248,.6); }

.panel { width: 340px; background: #fff; color: #111827; border-radius: 12px; display: flex; flex-direction: column; min-height: 0; }
.p-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #E5E7EB; }
.p-tabs { display: flex; gap: 4px; }
.p-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; color: #5B6575; cursor: pointer; }
.p-tabs button[aria-selected="true"] { background: #E8F0FE; color: var(--accent); }
.x { border: 0; background: none; font-size: 18px; cursor: pointer; color: #5B6575; }
.p-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 12px; }
.msgs { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.msgs li { margin-bottom: 10px; }
.msgs .who { font-weight: 700; font-size: 13px; }
.msgs .who small { font-weight: 400; color: #6B7280; margin-left: 6px; }
.msgs .tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.msgs .sys { color: #6B7280; font-size: 13px; font-style: italic; }
.send { display: flex; gap: 6px; margin-top: 8px; }
.send input { flex: 1; min-width: 0; padding: 10px; background: #F3F4F6; color: #111827; border-color: #E5E7EB; font-size: 15px; }
.people { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.people li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #F0F1F3; }
.people .pn { flex: 1; min-width: 0; }
.people .pn small { color: #6B7280; display: block; font-size: 12px; }
.people .mini { width: 32px; height: 32px; border-radius: 50%; background: #5F6368; color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.people .pa button { border: 1px solid #E5E7EB; background: #fff; border-radius: 7px; padding: 4px 8px; font-size: 12px; cursor: pointer; margin-left: 4px; }
.people .ico { font-size: 14px; }
.lockrow { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 10px 0; }
#invite2 { margin-top: 6px; }

.controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 10px 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.ctl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; border: 0; background: transparent; color: #E5E7EB; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.ctl .ic { width: 46px; height: 46px; border-radius: 50%; background: var(--ctl); display: grid; place-items: center; }
.ctl .lb { font-size: 11.5px; white-space: nowrap; }
.ctl:hover .ic { filter: brightness(1.25); }
.ctl.off .ic { background: var(--bad); }
.ctl.on .ic { background: var(--ctl-on); color: #111827; }
.ctl.leave .ic { background: var(--bad); width: 60px; border-radius: 23px; }
.badge { position: absolute; top: 2px; right: 12px; min-width: 18px; height: 18px; border-radius: 9px; background: #EA4335; color: #fff; font-size: 11px; font-style: normal; display: grid; place-items: center; padding: 0 4px; }

.dlg-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dlg { background: var(--surface); color: var(--ink); width: 100%; max-width: 440px; border-radius: 16px; padding: 20px; }
.dlg h2 { margin: 0; }
.dlg textarea { margin-top: 12px; resize: none; font-size: 14px; }
.dlg-btns { display: flex; gap: 8px; margin-top: 12px; }
.dlg-btns .ghost { width: auto; margin: 0 0 0 auto; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #E8EAED; color: #111827; padding: 10px 18px; border-radius: 20px; font-weight: 600; max-width: 92%; text-align: center; z-index: 20; box-shadow: 0 4px 16px rgba(0,0,0,.35); }

/* phones */
@media (max-width: 700px) {
  .stage { padding: 0 6px; }
  .panel { position: fixed; inset: 0; width: auto; border-radius: 0; z-index: 8; }
  .ctl { min-width: 54px; padding: 2px; }
  .ctl .ic { width: 42px; height: 42px; }
  .ctl .lb { font-size: 10.5px; }
  #b-invite, #b-low { display: none; }
}
