:root { --bg: #f6f6f4; --fg: #1d1d1b; --muted: #6b6b66; --card: #fff; --accent: #2f5d50; --danger: #a33; --line: #ddd; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #141414; --fg: #eee; --muted: #9a9a94; --card: #1f1f1f; --accent: #6fb39d; --danger: #e06666; --line: #333; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* #call and others set display; hidden must still win */
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 system-ui, -apple-system, sans-serif; }
.card { max-width: 34rem; margin: 2rem auto; padding: 1.5rem; background: var(--card); border-radius: 12px; }
h1 { margin-top: 0; font-size: 1.4rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.error { color: var(--danger); }
label { display: block; margin: .5rem 0 .25rem; }
input { width: 100%; padding: .6rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.button { display: inline-block; margin: .75rem .4rem 0 0; padding: .6rem 1rem; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; text-decoration: none; cursor: pointer; }
.button.danger { background: var(--danger); }
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.links { list-style: none; padding: 0; }
.links li { border-top: 1px solid var(--line); padding: .75rem 0; }
.links code { display: block; word-break: break-all; font-size: .8rem; color: var(--muted); }
#call { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.tiles { flex: 1; display: grid; gap: 4px; padding: 4px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); overflow: auto; }
.tile { position: relative; background: #222; border-radius: 8px; overflow: hidden; min-height: 160px; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .who { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .85rem; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom)); background: #111; }
.bar .button { margin: 0; }
.badge { color: #ddd; font-size: .85rem; padding: 0 .5rem; }
.badge.ok { color: #7fd1a8; } .badge.bad { color: #ff8a8a; }
.tile.screen { grid-column: 1 / -1; min-height: 50vh; }
.tile.screen video { object-fit: contain; background: #000; }
.bar .quality { display: inline-flex; align-items: center; gap: .3rem; margin: 0; color: #ddd; font-size: .85rem; }
.bar select { padding: .5rem; font: inherit; border-radius: 8px; border: 1px solid #444; background: #222; color: #eee; }
