/* WebFones Meet — every color is a token; light is :root, dark by preference or data-theme. */
:root {
	color-scheme: light;
	--ground: #f5f6f3; --paper: #ffffff; --ink: #1b2430; --ink-2: #4a5563; --muted: #6f7a86;
	--line: #d6dbd4; --line-2: #e6eae4; --accent: #0e7c86; --accent-ink: #0b646c; --accent-soft: #e3f1f2; --on-accent: #ffffff;
	--warn: #b9651a; --warn-soft: #fbf0e4; --danger: #b8322f; --danger-soft: #f9e6e5; --ok: #2f7d4f;
	--stage: #0f1418; --tile: #1a2229; --tile-ink: #e8ecea;
	--shadow: 0 6px 24px rgba(20, 30, 40, .12);
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--ground: #12181d; --paper: #182028; --ink: #e6eae6; --ink-2: #c2c9cf; --muted: #8c97a3;
		--line: #2a3340; --line-2: #222b36; --accent: #4fb3bc; --accent-ink: #7fd0d6; --accent-soft: #17323a; --on-accent: #0f1418;
		--warn: #e39a55; --warn-soft: #2e2318; --danger: #e0716d; --danger-soft: #3a1f1e; --ok: #6dbe8b;
		--shadow: 0 6px 24px rgba(0, 0, 0, .4);
	}
}
:root[data-theme="dark"] {
	color-scheme: dark;
	--ground: #12181d; --paper: #182028; --ink: #e6eae6; --ink-2: #c2c9cf; --muted: #8c97a3;
	--line: #2a3340; --line-2: #222b36; --accent: #4fb3bc; --accent-ink: #7fd0d6; --accent-soft: #17323a; --on-accent: #0f1418;
	--warn: #e39a55; --warn-soft: #2e2318; --danger: #e0716d; --danger-soft: #3a1f1e; --ok: #6dbe8b;
	--shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; display: flex; flex-direction: column; }
a { color: var(--accent-ink); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line-2); background: var(--paper); }
.brand { color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.brand span { color: var(--accent-ink); }
.topnav { display: flex; gap: 14px; font-size: 14px; }
.topnav a, .topnav button { color: var(--ink-2); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; padding: 0; }
.topnav a:hover, .topnav button:hover { color: var(--accent-ink); }
.app { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 40px; }
.card { width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 26px 26px 24px; box-shadow: var(--shadow); }
.card h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; text-wrap: balance; }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.card p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 4px; letter-spacing: .02em; }
input[type=text], input[type=email], input[type=tel] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--ground); color: var(--ink); font: inherit; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 26px; letter-spacing: .18em; text-align: center; text-transform: uppercase; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.link { border: 0; background: none; color: var(--accent-ink); font-weight: 500; padding: 4px 0; }
.btn[disabled] { opacity: .55; cursor: default; }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.info { background: var(--accent-soft); color: var(--accent-ink); border-radius: 6px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.meeting { border: 1px solid var(--line-2); border-radius: 6px; padding: 12px 14px; margin: 6px 0 14px; background: var(--ground); }
.meeting .title { font-weight: 600; }
.meeting .when { color: var(--ink-2); font-size: 14px; }
.codechip { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; background: var(--accent-soft); color: var(--accent-ink); padding: 2px 8px; border-radius: 4px; }
.toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--ink); color: var(--ground); padding: 10px 14px; border-radius: 6px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
/* ---- pre-join + call ---- */
.preview { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--stage); border-radius: 8px; overflow: hidden; margin: 8px 0 14px; }
.preview video, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--stage); }
.preview video.mirror, .tile.self video { transform: scaleX(-1); }
.stage { width: 100%; max-width: 1200px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; align-content: center; }
.grid.n1 { grid-template-columns: minmax(260px, 900px); justify-content: center; }
.tile { position: relative; background: var(--tile); color: var(--tile-ink); border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; min-height: 140px; }
.tile.screen { grid-column: 1 / -1; aspect-ratio: auto; max-height: 70vh; }
.tile.screen video { object-fit: contain; }
.tile .name { position: absolute; left: 10px; bottom: 8px; background: rgba(0, 0, 0, .55); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.tile.speaking { box-shadow: inset 0 0 0 3px var(--accent); }
.tile.connecting .name::after { content: "connecting…"; color: #f5c27a; font-size: 12px; }
.tile .avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 600; color: var(--tile-ink); background: var(--tile); }
.tile.cam-off video { visibility: hidden; }
.badge { display: inline-block; font-size: 11px; padding: 1px 5px; border-radius: 3px; background: rgba(255, 255, 255, .18); }
.badge.off { background: var(--danger); }
/* Control bar — mirrors the Mac app's WFVideoViewController: a black 64pt bar,
   44pt self-drawn circles on a 60pt pitch (share · camera · hang up · mute),
   white 17pt symbols, grey idle, lighter grey when muted/camera-off, red hang up,
   blue while sharing, 18% white blend on hover. Icon-only with tooltips. */
.ctlbar { display: flex; justify-content: center; align-items: center; gap: 16px; height: 64px; background: #000; border-radius: 8px; padding: 0 12px calc(env(safe-area-inset-bottom) / 2); }
.ctl { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #fff;
       background: rgb(56, 56, 56); transition: background .12s, transform .08s; flex: 0 0 auto; }
.ctl svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.ctl:hover { background: rgb(92, 92, 92); }
.ctl:active { transform: scale(.96); }
.ctl.off { background: rgb(97, 97, 97); }
.ctl.off:hover { background: rgb(125, 125, 125); }
.ctl.red { background: rgb(255, 59, 48); }
.ctl.red:hover { background: rgb(255, 94, 85); }
.ctl.active { background: rgb(10, 133, 255); }
.ctl.active:hover { background: rgb(54, 155, 255); }
.ctl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ctl .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ctlbar.light { background: transparent; height: auto; padding: 4px 0 0; }
.ctlbar.light .ctl { background: rgb(56, 56, 56); }
.ctlbar.light .ctl.off { background: rgb(97, 97, 97); }
.callhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px; }
.callhead .title { font-weight: 600; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); color: #fff; font-weight: 600; cursor: pointer; }
@media (max-width: 600px) {
	.app { padding: 16px 10px 24px; }
	.card { padding: 20px 18px; }
	.grid { grid-template-columns: 1fr; align-content: start; }
	.ctlbar { gap: 12px; }
}
@media (prefers-reduced-motion: no-preference) { .btn, a { transition: background .12s, color .12s; } }
