:root { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #202124; background: #fff; font-synthesis: none; --blue: #2563eb; --muted: #626973; --line: #e0e4ea; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--blue); text-underline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button, input, a { outline-offset: 4px; }
:focus-visible { outline: 3px solid var(--blue); }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; padding: 0 40px; max-width: 1440px; margin: auto; }
header { height: 88px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; }
.brand img { width: 130px; height: 32px; display: block; }
main { flex: 1; width: 100%; max-width: 1120px; margin: auto; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, 1fr); align-content: center; align-items: center; gap: 64px; padding: 36px 0 56px; }
.intro { grid-column: 2; grid-row: 1; min-width: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); font-weight: 500; line-height: 1.2; letter-spacing: -1px; margin: 0 0 12px; }
#setup-description { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0; }
.invitation-code { color: var(--muted); font-size: 14px; letter-spacing: 1px; overflow-wrap: anywhere; margin: 16px 0 0; }
.setup-panel { margin-top: 32px; }
label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 9px; }
input:not([type=checkbox]) { width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid #a4abb5; border-radius: 8px; color: #202124; background: #fff; font-size: 16px; transition: border-color .15s; }
input::placeholder { color: #68717d; opacity: 1; }
input:not([type=checkbox]):hover { border-color: #626973; }
input[aria-invalid=true] { border-color: #b3261e; }
#display-name { margin-bottom: 20px; }
.primary, .secondary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 24px; padding: 0 22px; font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.primary { background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: #1d4ed8; }
.secondary { background: #fff; border-color: var(--line); color: var(--blue); }
.secondary:hover:not(:disabled) { background: #f2f6ff; border-color: #b9cdfb; }
#start { min-width: 150px; }
.join-form { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.join-form label { color: var(--muted); font-weight: 400; }
.join-row { display: flex; gap: 10px; align-items: center; }
.join-row .secondary { padding: 0 18px; border-radius: 8px; }
.field-error { font-size: 13px; line-height: 1.5; color: #b3261e; margin: 9px 0 0; }
#name-error { margin: -10px 0 18px; }
.text-link, .text-button { color: var(--blue); font-size: 14px; }
.text-button { padding: 10px 4px; min-height: 44px; border: 0; background: transparent; font-weight: 500; }
.text-button:hover, .text-link:hover { text-decoration: underline; }
#new-room { display: inline-block; margin-top: 24px; }
.call-area { grid-column: 1; grid-row: 1; min-width: 0; }
.video-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #f2f4f7; border: 1px solid #e9ecf0; border-radius: 16px; overflow: hidden; }
#remote-video { width: 100%; height: 100%; display: block; object-fit: contain; }
.remote-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.stage-symbol { color: #747d89; margin-bottom: 18px; }
.stage-symbol svg { width: 40px; height: 40px; stroke-width: 1.4; }
.remote-placeholder h2 { font-size: 21px; font-weight: 500; margin: 0 0 10px; line-height: 1.3; overflow-wrap: anywhere; }
.remote-placeholder p { color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 340px; margin: 0; }
.self-preview { display: none; }
.self-preview video { position: absolute; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.avatar { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; color: #d8e5ff; background: #354868; font-size: 30px; font-weight: 500; margin-bottom: 20px; flex-shrink: 0; }
.self-preview .avatar { margin: 0; width: 64px; height: 64px; font-size: 24px; }
.has-preview .video-stage { background: #202124; border-color: transparent; }
.has-preview:not(.in-call) .self-preview { display: grid; place-items: center; position: absolute; inset: 0; }
.has-preview:not(.in-call) .remote-placeholder { display: none; }
.self-label { position: absolute; left: 14px; bottom: 14px; color: #fff; font-size: 13px; padding: 5px 9px; border-radius: 6px; background: #202124cc; max-width: calc(100% - 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#self-state { color: #cbd1da; }
.controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 14px; }
.control { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); background: #fff; color: #343b46; min-height: 46px; border-radius: 26px; padding: 0 18px; font-size: 13px; font-weight: 500; }
.control:hover:not(:disabled) { background: #f1f4f9; }
.control[aria-pressed=true] { background: #fce8e6; border-color: #f4c5c0; color: #a6241c; }
.off-slash { display: none; }
.control[aria-pressed=true] .off-slash { display: block; }
body:not(.in-call) .meeting-only, body:not(.in-call) .stage-top, body:not(.in-call) .stage-bottom { display: none; }
body:not(.has-preview):not(.in-call) .controls { display: none; }
.device-options { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 0 0; }
.audio-option { display: flex; align-items: center; gap: 9px; font-weight: 400; font-size: 13px; color: var(--muted); margin: 0; min-height: 44px; }
.audio-option input { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; }
.device-options .text-button { font-size: 13px; }
.status-area { margin-top: 14px; padding: 14px 16px; border-radius: 8px; background: #f3f6fb; }
.status { color: #475569; line-height: 1.55; font-size: 14px; margin: 0; }
.status.error { color: #a6241c; }
.status-area .text-button { padding-bottom: 0; min-height: 36px; margin-right: 16px; }
footer { flex: 0 0 auto; padding: 20px 0 24px; display: flex; gap: 24px; justify-content: flex-end; }
footer nav { display: flex; gap: 24px; }
footer a { font-size: 13px; color: var(--muted); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
footer a:hover { color: var(--blue); text-decoration: underline; }
/* The call fills the viewport; the controls never compete with a second footer. */
.in-call { background: #202124; color: #f1f3f4; overflow: hidden; }
.in-call .shell { height: 100dvh; min-height: 0; max-width: none; padding: 12px 16px max(8px, env(safe-area-inset-bottom)); }
.in-call header, .in-call footer, .in-call .intro, .in-call .device-options { display: none; }
.in-call main { display: block; max-width: none; height: 100%; min-height: 0; padding: 0; }
.in-call .call-area { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; min-height: 0; }
.in-call .video-stage { height: 100%; min-height: 0; aspect-ratio: auto; border: 0; background: #17191c; border-radius: 12px; }
.in-call .remote-placeholder { padding: 76px 32px 144px; }
.in-call .remote-placeholder p { color: #b7bec9; }
.in-call .remote-placeholder h2 { font-size: 25px; }
.in-call .stage-symbol { display: none; }
.stage-top { position: absolute; left: 20px; right: 20px; top: 18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #e0e4ea; font-size: 13px; }
.connection-status, #timer { background: #17191cbf; border-radius: 18px; padding: 7px 10px; }
.connection-status { display: inline-flex; align-items: center; gap: 8px; }
.tiny-dot { width: 6px; height: 6px; border-radius: 50%; background: #a6adba; }
.tiny-dot.connected { background: #a9cfb3; }
#timer { font-variant-numeric: tabular-nums; }
.stage-bottom { position: absolute; left: 22px; bottom: 20px; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 256px); padding: 6px 10px; border-radius: 6px; background: #17191cbf; font-size: 13px; }
#remote-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#remote-muted { color: #f5b6af; white-space: nowrap; }
#encryption-label { color: #b7bec9; font-size: 11px; }
.in-call .self-preview { display: grid; place-items: center; position: absolute; right: 20px; bottom: 20px; width: 192px; height: 128px; background: #2e333a; border: 1px solid #515862; border-radius: 10px; overflow: hidden; }
.in-call .self-label { left: 8px; bottom: 8px; font-size: 11px; max-width: calc(100% - 16px); }
.in-call .controls { padding-top: 12px; gap: 12px; min-height: 62px; }
.in-call .control { background: #35393f; border-color: #35393f; color: #f1f3f4; min-height: 48px; }
.in-call .control:hover:not(:disabled) { background: #464d55; }
.in-call .control[aria-pressed=true] { background: #f9dedb; color: #7a211a; border-color: #f9dedb; }
.in-call .hangup { background: #c4312a; border-color: #c4312a; min-width: 80px; }
.in-call .hangup:hover { background: #a92822; }
.in-call .utility { background: transparent; border-color: transparent; }
.toolbar-divider { height: 24px; width: 1px; background: #50545b; margin: 0 2px; }
.waiting-invite { display: flex; flex-direction: column; gap: 20px; align-items: center; margin-top: 24px; }
.waiting-code { font-size: 22px; letter-spacing: 4px; overflow-wrap: anywhere; max-width: 360px; }
.play-audio { position: absolute; left: 50%; bottom: 160px; transform: translateX(-50%); z-index: 3; padding: 12px 20px; border-radius: 24px; border: 0; color: var(--blue); background: #fff; font-size: 14px; white-space: nowrap; }
.in-call .status-area { position: absolute; z-index: 4; top: 76px; left: 50%; transform: translateX(-50%); width: min(480px, calc(100% - 48px)); margin: 0; background: #30363e; box-shadow: 0 6px 24px #0003; }
.in-call .status { color: #e5e9f0; }
.in-call .status.error { color: #ffb4ab; }
.in-call .status-area .text-button { color: #a8c7fa; }
/* Native dialog supplies keyboard focus containment and Escape dismissal. */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; color: #202124; background: #fff; box-shadow: 0 16px 64px #0003; }
dialog::backdrop { background: #10182880; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dialog-heading h2 { font-size: 21px; font-weight: 500; margin: 0; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: #f3f5f8; color: #475569; }
.icon-button:hover { background: #e8edf5; }
.room-code { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
.room-code strong { display: block; color: #202124; font-size: 24px; font-weight: 500; letter-spacing: 3px; margin-top: 8px; overflow-wrap: anywhere; }
.share-row { display: flex; gap: 10px; }
.share-row input { font-size: 14px; }
.share-row .primary { border-radius: 8px; padding: 0 16px; }
.small { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 16px 0 0; }
#copy-feedback:empty { display: none; }
.end-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 0 80px; max-width: 560px; margin: auto; }
.end-symbol { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #eef4ff; color: var(--blue); margin-bottom: 26px; }
.end-symbol svg { width: 30px; height: 30px; }
.end-error .end-symbol { display: none; }
.end-screen h1 { font-size: 32px; }
.end-screen p { font-size: 16px; color: var(--muted); line-height: 1.7; margin: 4px 0 28px; }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.noscript-note { padding: 16px 32px; margin: 0; background: #eff6ff; }
.document-page { max-width: 780px; padding: 0 24px; margin: auto; }
.document-page header { gap: 24px; }
.document-content { display: block; padding: 32px 0; font-size: 16px; line-height: 1.75; }
.document-content h1 { font-size: 32px; }
.document-content h2 { font-size: 20px; font-weight: 600; margin: 32px 0 10px; }
.document-content p { margin: 12px 0; }
.document-content li { margin: 8px 0; }
.document-content ul, .document-content ol { padding-left: 24px; }
.document-meta { color: var(--muted); font-size: 14px; }
@media (max-width: 1000px) {
  .shell { padding: 0 28px; }
  main { gap: 36px; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); }
  .video-stage { aspect-ratio: 4 / 3; }
  .device-options { gap: 6px; flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .shell { padding: 0 24px; }
  header { height: 76px; }
  .brand img { width: 120px; height: 30px; }
  main { display: flex; flex-direction: column; align-items: stretch; gap: 36px; padding: 24px 0; max-width: 440px; }
  .intro { order: 0; }
  .call-area { order: 1; }
  h1 { font-size: 30px; }
  .setup-panel { margin-top: 26px; }
  .join-form { margin-top: 24px; padding-top: 22px; }
  .video-stage { aspect-ratio: 16 / 11; min-height: 210px; border-radius: 12px; }
  .remote-placeholder { padding: 20px; }
  .remote-placeholder h2 { font-size: 19px; }
  .remote-placeholder p { font-size: 13px; }
  .stage-symbol { margin-bottom: 12px; }
  .stage-symbol svg { width: 32px; height: 32px; }
  .device-options { gap: 0; }
  footer { padding: 20px 0; }
  .in-call .shell { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .in-call .controls { gap: 8px; padding-top: 10px; min-height: 58px; }
  .in-call .control { width: 46px; min-height: 46px; padding: 0; }
  .in-call .hangup { width: 64px; min-width: 64px; }
  .in-call .control span { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .toolbar-divider { display: none; }
  .stage-top { left: 8px; right: 8px; top: 10px; font-size: 12px; gap: 8px; }
  .in-call .self-preview { width: 112px; height: 84px; right: 12px; bottom: 14px; }
  .self-preview .avatar { width: 42px; height: 42px; font-size: 18px; }
  .in-call .self-label { font-size: 10px; left: 5px; bottom: 5px; padding: 3px 5px; max-width: calc(100% - 10px); }
  .in-call #self-state, #encryption-label { display: none; }
  .stage-bottom { left: 10px; bottom: 16px; max-width: calc(100% - 142px); font-size: 12px; gap: 7px; flex-wrap: wrap; }
  .in-call .remote-placeholder { padding: 76px 20px 112px; }
  .in-call .remote-placeholder h2 { font-size: 22px; }
  .waiting-code { max-width: 240px; font-size: 20px; }
  .play-audio { bottom: 120px; }
  .end-screen { padding-bottom: 60px; }
  .end-screen h1 { font-size: 28px; }
  dialog { padding: 20px; }
  .share-row { flex-direction: column; }
  .share-row .primary { min-height: 44px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .in-call .remote-placeholder { padding: 60px 24px 24px; }
  .in-call .remote-placeholder .avatar { width: 52px; height: 52px; font-size: 22px; margin-bottom: 12px; }
  .waiting-invite { flex-direction: row; margin-top: 18px; }
  .in-call .self-preview { width: 112px; height: 78px; }
  .play-audio { bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.toast { position: fixed; z-index: 8; bottom: 90px; left: 50%; transform: translateX(-50%); margin: 0; background: #fff; color: #202124; box-shadow: 0 4px 20px #0002; border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px; font-size: 14px; white-space: nowrap; pointer-events: none; }

.setup-panel .audio-option { margin: -8px 0 16px; }
