:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  background: #0b0b0c;
  color: #f5f5f5;
}
* { box-sizing: border-box; }
body { margin: 0; background: #0b0b0c; }
button, select { font: inherit; }
.app { width: min(760px, 100%); margin: 0 auto; padding: 18px 14px 48px; }
header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
h1 { margin: 3px 0 4px; font-size: clamp(26px, 7vw, 40px); }
h2 { margin: 0 0 10px; font-size: 19px; }
p { line-height: 1.45; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .16em; font-weight: 800; opacity: .72; }
.muted, .hint { color: #b8b8bd; margin: 4px 0 0; }
.hint { font-size: 13px; }
.badge, .status-pill { display: inline-flex; align-items: center; border: 1px solid #38383d; border-radius: 999px; padding: 7px 10px; font-size: 12px; background: #171719; white-space: nowrap; }
.card { background: #141416; border: 1px solid #29292d; border-radius: 18px; padding: 16px; margin: 12px 0; box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.preview-card { position: relative; padding: 0; overflow: hidden; aspect-ratio: 16 / 9; background: #000; }
video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-overlay { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
button, select, .device-display { min-height: 46px; border-radius: 12px; border: 1px solid #3a3a40; background: #202024; color: #fff; padding: 10px 12px; }
button { cursor: pointer; font-weight: 700; }
button:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
button.primary { width: 100%; min-height: 54px; background: #f2f2f2; color: #101012; border-color: #f2f2f2; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid label { display: block; margin: 0 0 6px; font-weight: 750; }
.grid select { width: 100%; }
.full { grid-column: 1 / -1; }
.output-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.device-display { display: flex; align-items: center; color: #ddd; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.actions h2, .actions audio, .full-action { grid-column: 1 / -1; }
audio { width: 100%; margin-top: 5px; }
.result { margin-top: 12px; border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.result.neutral { background: #212125; }
.result.ok { background: #12351f; }
.result.bad { background: #3a1717; }
.diagnostics { margin: 0; }
.diagnostics div { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid #29292d; }
.diagnostics div:last-child { border-bottom: 0; }
dt { color: #aaaab0; }
dd { margin: 0; text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.target { line-height: 1.8; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; color: #cfcfd4; font-size: 12px; max-height: 320px; overflow: auto; }
summary { cursor: pointer; font-weight: 800; }
.meter-block { padding-top: 2px; }
.meter-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.meter-head span { color:#cfcfd4; font-size:13px; font-weight:700; }
.meter { height: 14px; border-radius:999px; background:#27272c; overflow:hidden; margin-top:8px; border:1px solid #38383d; }
.meter > div { height:100%; width:0%; background:linear-gradient(90deg,#5fcf7a,#e7cc62,#ef6d6d); transition:width 80ms linear; }
.small-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
@media (max-width: 560px) {
  header { display: block; }
  header .badge { margin-top: 10px; }
  .grid, .actions { grid-template-columns: 1fr; }
  .actions h2, .actions audio, .full-action { grid-column: auto; }
  .output-row, .small-actions { grid-template-columns: 1fr; }
  .diagnostics div { grid-template-columns: 1fr; }
  dd { text-align: left; }
}

.button-link { display:flex; align-items:center; justify-content:center; min-height:46px; border-radius:12px; border:1px solid #3a3a40; background:#202024; color:#fff; padding:10px 12px; text-decoration:none; font-weight:800; margin-top:10px; }
.button-link:hover { background:#29292e; }
.mode-link p { margin-top:6px; }
.source-note { border-left:3px solid #666; padding-left:10px; margin-top:10px; }
.pc-only { background:#111827; border-color:#263a58; }
.track-ok { color:#75dc91; }
.track-bad { color:#f08a8a; }
.inline-row { display:grid; grid-template-columns:1fr auto; gap:8px; }
@media (max-width:560px){ .inline-row { grid-template-columns:1fr; } }

/* V4 call UI */
.text-input { width:100%; min-height:46px; border-radius:12px; border:1px solid #3a3a40; background:#202024; color:#fff; padding:10px 12px; font:inherit; }
.danger { background:#4b1717; border-color:#743030; }
.copy-row { display:grid; grid-template-columns:1fr auto; gap:8px; margin-top:8px; }
.invite-box { margin-top:14px; }
.preview-pair { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.mini-video-box { aspect-ratio:16/9; border-radius:14px; overflow:hidden; background:#000; border:1px solid #29292d; }
.call-stage { position:relative; width:100%; aspect-ratio:9/16; max-height:72vh; background:#000; overflow:hidden; border-radius:20px; border:1px solid #29292d; margin:12px 0; }
.video-pane { position:absolute; overflow:hidden; background:#000; transition:all .2s ease; }
.video-pane video { width:100%; height:100%; object-fit:cover; }
.main-pane { inset:0; z-index:1; }
.pip-pane { width:30%; aspect-ratio:9/16; right:12px; top:12px; z-index:3; border-radius:14px; border:2px solid rgba(255,255,255,.7); box-shadow:0 8px 22px rgba(0,0,0,.45); }
.video-label { position:absolute; left:7px; bottom:7px; padding:5px 7px; border-radius:999px; background:rgba(0,0,0,.58); font-size:10px; font-weight:800; letter-spacing:.08em; }
.resume-audio { position:absolute; z-index:5; left:50%; top:50%; transform:translate(-50%,-50%); background:#f2f2f2; color:#111; }
.call-controls { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.call-controls button { min-width:0; padding:9px 6px; font-size:13px; }
.compact-diag { margin:10px 0; }
@media (orientation:landscape) and (max-height:650px) {
  .call-app { max-width:none; padding:6px; }
  .call-app header,.call-app #inviteCard,.call-app #deviceCard,.call-app #statusCard,.call-app details { display:none; }
  .call-stage { width:100vw; height:calc(100vh - 72px); max-height:none; aspect-ratio:auto; border-radius:0; margin:0; }
  .call-controls { margin:4px 0; }
}
@media (max-width:700px){ .preview-pair{grid-template-columns:1fr;} .copy-row{grid-template-columns:1fr;} .call-controls{grid-template-columns:repeat(3,1fr);} }
