:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #111;
  --line: #292929;
  --muted: #999;
  --white: #f5f5f2;
  --soft: #d8d8d3;
  --green: #39d980;
  --red: #ff5b61;
  --amber: #f2c45c;
  --surface: rgba(17,17,17,.86);
  --hairline: rgba(255,255,255,.105);
  --deep-shadow: 0 28px 90px rgba(0,0,0,.42);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 82% -8%, rgba(255,255,255,.07), transparent 31rem),
    radial-gradient(circle at 8% 92%, rgba(255,255,255,.025), transparent 28rem),
    var(--bg);
  color: var(--white);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.01em;
  touch-action: manipulation;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.join-row button, .secondary-button, .control-button, .admin-menu-trigger, .admin-remove-button { transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.join-row button:active, .secondary-button:active, .control-button:active { transform: scale(.97); }
.hidden { display: none !important; }

.shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--hairline); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 18px; font-weight: 650; }
.brand-mark { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.brand-mark i { display: block; width: 3px; border-radius: 3px; background: var(--white); animation: pulse 1.7s ease-in-out infinite; }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 18px; animation-delay: -.35s; }
.brand-mark i:nth-child(3) { height: 13px; animation-delay: -.7s; }
@keyframes pulse { 50% { transform: scaleY(.55); opacity: .65; } }
.security-badge { display: flex; gap: 9px; align-items: center; color: var(--soft); font-size: 13px; }
.security-badge b { font-weight: 500; }
.security-badge span { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.1); }

.lobby { position: relative; min-height: calc(100vh - 89px); min-height: calc(100dvh - 89px); display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(360px, .84fr); align-items: center; gap: clamp(48px, 8vw, 118px); padding: 42px 0 60px; }
.lobby::before { content: ''; position: fixed; z-index: -1; inset: 0; pointer-events: none; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: radial-gradient(circle at 74% 46%, #000, transparent 58%); mask-image: radial-gradient(circle at 74% 46%, #000, transparent 58%); }
.lobby-copy { align-self: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-size: 11px; font-weight: 700; }
.lobby .eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: #e9e9e4; box-shadow: 0 0 0 5px rgba(255,255,255,.07); }
h1 { margin: 25px 0 25px; font-size: clamp(60px, 7.2vw, 104px); line-height: .91; letter-spacing: -.075em; font-weight: 650; }
h1 em { font-family: Georgia, serif; font-weight: 400; color: var(--muted); }
.lead { max-width: 560px; margin: 0; color: #929292; line-height: 1.65; font-size: 17px; }
.join-card { position: relative; overflow: hidden; padding: clamp(25px, 3.4vw, 40px); border: 1px solid rgba(255,255,255,.13); border-radius: 28px; background: linear-gradient(145deg, rgba(26,26,26,.88), rgba(10,10,10,.94)); box-shadow: 0 35px 100px rgba(0,0,0,.38), inset 0 1px rgba(255,255,255,.04); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.join-card::before { content: ''; position: absolute; width: 190px; height: 190px; right: -80px; top: -100px; border-radius: 50%; background: rgba(255,255,255,.07); filter: blur(38px); pointer-events: none; }
.join-card-top { position: relative; display: flex; align-items: center; justify-content: space-between; margin-bottom: 55px; color: #e5e5e2; font-size: 13px; font-weight: 600; }
.capacity { color: #696969; font-size: 11px; font-weight: 500; }
.join-form label { display: block; color: #7e7e7e; font-size: 11px; margin-bottom: 12px; letter-spacing: .04em; }
.join-row { display: grid; gap: 14px; }
.join-row input { min-width: 0; width: 100%; box-sizing: border-box; border: 1px solid #303030; border-radius: 15px; outline: 0; padding: 16px 17px; color: white; background: rgba(5,5,5,.6); font-size: 17px; transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease; }
.join-row input:focus { border-color: #747474; background: #0b0b0b; box-shadow: 0 0 0 4px rgba(255,255,255,.035); }
.join-row input::placeholder { color: #505050; }
.join-row button, .secondary-button { min-height: 54px; border: 1px solid #ddd; border-radius: 15px; background: #f4f4f0; color: #090909; padding: 0 18px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.join-arrow { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: #111; color: #fff; font-size: 16px; transition: transform .2s ease; }
.join-row button:hover .join-arrow { transform: translateX(2px); }
.join-row button:hover, .secondary-button:hover { background: white; transform: translateY(-1px); }
.compatibility { min-height: 18px; margin: 13px 0 0; color: #e2b3b3; font-size: 12px; }
.trust-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 26px; padding-top: 20px; border-top: 1px solid #242424; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; color: #737373; font-size: 10px; letter-spacing: .04em; }
.trust-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(57,217,128,.08); }

.call { padding: 70px 0 50px; animation: call-in .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes call-in { from { opacity: 0; transform: translateY(10px); } }
.call-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.heading-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: 620px; min-height: 45px; }
.heading-actions #lockButton { width: 160px; }
.heading-actions #copyButton { width: 190px; }
.call-heading h2 { margin: 12px 0 0; font-size: clamp(38px, 6vw, 72px); letter-spacing: -.055em; }
.call-heading h2 span { color: #666; font-family: Georgia, serif; font-weight: 400; }
.room-runtime { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 13px; color: #777; font-size: 12px; }
.room-runtime .secondary-button { min-height: 30px; width: auto; padding: 0 11px; border-radius: 9px; font-size: 10px; }
.room-runtime strong { color: #ddd; font-variant-numeric: tabular-nums; font-weight: 600; }
.room-runtime #roomAccess { color: var(--green); }
.room-runtime #roomAccess.closed { color: var(--red); }
.relay-notice { margin: 12px 0 0; color: #d8b97b; font-size: 11px; line-height: 1.5; }
.admin-label { border: 1px solid #494949; border-radius: 999px; padding: 4px 8px; color: #ccc; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.live-dot { display: inline-block; width: 7px; height: 7px; background: #fff; border-radius: 50%; margin-right: 5px; animation: blink 1.8s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.secondary-button { min-height: 45px; }
.secondary-button.admin-action { min-height: 40px; border-color: #444; background: #151515; color: #ddd; font-size: 11px; }
.secondary-button.admin-action[aria-pressed="true"] { border-color: #735258; background: #291518; color: #ff9da1; }
.secondary-button.copy-success { border-color: var(--green); background: var(--green); color: #07170e; }
.participants { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; margin: 46px 0 22px; }
.participant { position: relative; min-height: 175px; overflow: hidden; isolation: isolate; border: 1px solid var(--hairline); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(145deg, rgba(23,23,23,.96), rgba(11,11,11,.98)); box-shadow: 0 18px 50px rgba(0,0,0,.18); transition: min-height .36s cubic-bezier(.2,.8,.2,1), border-color .18s ease, box-shadow .18s ease, background-color .25s ease; animation: participant-in .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes participant-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.participant > :not(.participant-video) { position: relative; z-index: 2; }
.participant-info { min-height: 100%; display: flex; flex: 1; flex-direction: column; justify-content: space-between; }
.participant-video { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; border-radius: inherit; background: #090909; object-fit: contain; transform: none; transition: opacity .32s ease, filter .25s ease; pointer-events: auto; cursor: zoom-in; }
.participant.has-video { min-height: 0; aspect-ratio: var(--video-aspect, 4 / 3); color: #fff; align-self: start; width: 100%; padding: 0; }
.participant.has-video .participant-video { opacity: 1; }
.participant.self.has-video .participant-video { transform: none; }
.mirror-preview .participant.self.has-video:not(.is-screen-share) .participant-video { transform: scaleX(-1); }
.participant.is-screen-share { --video-aspect: 16 / 9; grid-column: 1 / -1; max-height: min(72vh, 760px); aspect-ratio: 16 / 9 !important; }
.participant.is-screen-share::before { content: 'Экран'; position: absolute; z-index: 4; left: 12px; top: 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 6px 9px; background: rgba(5,5,5,.62); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.participant.has-video .participant-info { position: absolute; z-index: 3; top: 12px; right: 12px; width: min(270px, calc(100% - 24px)); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding: 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; background: rgba(5,5,5,.58); box-shadow: 0 8px 30px rgba(0,0,0,.22); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.participant.has-video .participant-top { grid-column: 2; grid-row: 1; flex-direction: column; align-items: flex-end; }
.participant.has-video .participant-name { grid-column: 1; grid-row: 1; align-items: flex-start; }
.participant.has-video .participant-name .level { display: none; }
.participant.has-video .tech-data { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
.participant.has-video .avatar { width: 36px; height: 36px; font-size: 16px; }
.fullscreen-button { position: absolute !important; z-index: 4 !important; left: 12px; bottom: 12px; width: 40px; height: 40px; display: none; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 12px; background: rgba(5,5,5,.58); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.participant.has-video .fullscreen-button { display: grid; }
.fullscreen-button:hover { background: rgba(255,255,255,.18); transform: scale(1.04); }
.fullscreen-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.focus-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.desktop-only-setting { display: block; }
.participant:fullscreen { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; }
.participant:fullscreen .participant-video { object-fit: contain; }
.participant:fullscreen .participant-info { top: 18px; right: auto; left: 18px; width: min(300px, calc(100% - 36px)); }
.fullscreen-self-preview { display: none; }
.participant:fullscreen .fullscreen-self-preview { position: absolute; z-index: 8; top: 18px; right: 18px; display: block; width: clamp(150px, 20vw, 300px); max-height: 34vh; aspect-ratio: var(--preview-aspect, 16 / 9); border: 1px solid rgba(255,255,255,.34); border-radius: 18px; background: #080808; box-shadow: 0 18px 60px rgba(0,0,0,.5); object-fit: contain; transform: none; }
.participant:fullscreen .fullscreen-self-preview.mirrored { transform: scaleX(-1); }
.participant-video:fullscreen, .participant-video:-webkit-full-screen, .participant:fullscreen .participant-video { width: 100vw; height: 100vh; object-fit: contain; transform: none !important; background: #000; }
.participant.has-video::after { content: ''; position: absolute; z-index: 1; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.38), transparent 35%, rgba(0,0,0,.82)); }
.participant.has-video.muted::after { background: linear-gradient(180deg, rgba(92,15,20,.62), rgba(36,4,7,.26) 42%, rgba(91,13,18,.86)); }
.participant.has-video.muted .participant-video { filter: saturate(.65) sepia(.18); }
.participant.has-video .avatar { border-color: rgba(255,255,255,.55); background: rgba(0,0,0,.28); backdrop-filter: blur(8px); }
.participant.has-video .participant-state, .participant.self.has-video .participant-state, .participant.has-video .tech-data, .participant.has-video .identity-meta { color: rgba(255,255,255,.82); text-shadow: 0 1px 5px #000; }
.participant.speaking { border-color: var(--green); box-shadow: 0 0 0 2px rgba(57,217,128,.18), inset 0 0 24px rgba(57,217,128,.045); }
.participant.self { background: #121212; color: #fff; border-color: #353535; }
.participant.self.has-video { background: #080808; color: #fff; }
.participant.muted { border-color: #7a373d; background: linear-gradient(145deg, #281416, #160d0e); box-shadow: inset 0 0 32px rgba(255,91,97,.07); }
.participant.self.muted { border-color: #d36c70; background: #241214; color: #fff; box-shadow: inset 0 0 28px rgba(255,91,97,.08); }
.participant.self.speaking { border-color: #139653; box-shadow: 0 0 0 2px rgba(19,150,83,.22); }
.participant-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.avatar { width: 45px; height: 45px; border: 1px solid #3c3c3c; border-radius: 50%; display: grid; place-items: center; font-family: Georgia, serif; font-size: 20px; }
.self .avatar { border-color: #bbb; }
.participant-name { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 600; }
.participant-state { color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.self .participant-state { color: #9a9a9a; }
.participant.muted .participant-state { color: var(--red); }
.mic-state { display: none; align-items: center; gap: 5px; color: var(--red); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.participant.muted .mic-state { display: flex; }
.mic-state svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.tech-data { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 5px; margin-top: 11px; color: #777; font-size: 9px; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: .04em; }
.tech-data span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-data.self-tech { grid-template-columns: 1fr; }
.identity-meta { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; min-height: 18px; }
.country-flag { font-size: 18px; line-height: 1; }
.device-icon { display: inline-grid; place-items: center; color: #888; }
.device-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tech-data.good .latency { color: var(--green); }
.tech-data.medium .latency { color: var(--amber); }
.tech-data.bad .latency { color: var(--red); }
.self .tech-data { color: #777; }
.self .tech-data { color: #969696; }
.admin-menu { position: absolute !important; z-index: 6 !important; top: 13px; left: 13px; }
.admin-menu-trigger { width: 36px; height: 32px; display: grid; place-items: center; border: 1px solid var(--hairline); border-radius: 11px; background: rgba(8,8,8,.64); color: #ddd; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.admin-menu-trigger:hover { border-color: rgba(255,255,255,.24); background: rgba(30,30,30,.8); }
.admin-menu-trigger svg { width: 19px; height: 19px; fill: currentColor; }
.admin-remove-button { position: absolute; top: 39px; left: 0; min-width: 112px; min-height: 38px; border: 1px solid rgba(255,91,97,.28); border-radius: 12px; padding: 0 14px; background: rgba(30,9,11,.96); color: #ff9ca0; font-size: 11px; font-weight: 650; opacity: 0; visibility: hidden; transform: translateY(-4px); box-shadow: 0 18px 45px rgba(0,0,0,.4); }
.admin-menu.open .admin-remove-button { opacity: 1; visibility: visible; transform: translateY(0); }
.admin-remove-button:hover { background: #351216; color: #ffc1c3; }
.admin-menu .admin-ban-button { top: 82px; }
.admin-panel { margin-top: 14px; border: 1px solid var(--hairline); border-radius: 18px; padding: 16px; background: rgba(18,18,18,.82); box-shadow: 0 18px 50px rgba(0,0,0,.2); }
.admin-panel-heading, .admin-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #eee; font-size: 12px; }
.admin-panel-heading span, .admin-toggle small { color: #888; font-size: 10px; }
.admin-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid #303030; border-radius: 13px; cursor: pointer; }
.admin-toggle span { display: grid; gap: 4px; }
.admin-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.admin-toggle i { width: 38px; height: 22px; border-radius: 999px; background: #333; position: relative; transition: background .2s ease; }
.admin-toggle i::after { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: #aaa; transition: transform .2s ease, background .2s ease; }
.admin-toggle input:checked + i { background: #b9d6bf; }
.admin-toggle input:checked + i::after { transform: translateX(16px); background: #111; }
.admin-section { margin-top: 16px; }
.admin-list { display: grid; gap: 7px; margin-top: 8px; }
.admin-list-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid #2d2d2d; border-radius: 10px; color: #ccc; font-size: 11px; }
.admin-list-row button { border: 1px solid #4b4b4b; border-radius: 8px; padding: 6px 8px; background: #161616; color: #ddd; font-size: 10px; cursor: pointer; }
.join-request-row { justify-content: flex-start; flex-wrap: wrap; }
.join-request-row span { flex: 1 1 100%; }
.admin-empty { color: #777; font-size: 11px; }
.room-code-input { width: 100%; margin-top: 8px; letter-spacing: .18em; text-transform: uppercase; }
.level { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.level i { display: block; width: 2px; height: 5px; background: currentColor; border-radius: 2px; opacity: .35; }
.level i:nth-child(2) { height: 10px; }.level i:nth-child(3) { height: 14px; }.level i:nth-child(4) { height: 8px; }
.participant.speaking .level i { opacity: 1; animation: pulse .65s ease-in-out infinite alternate; }
.device-panel { position: fixed; z-index: 12; left: 50%; bottom: 160px; width: min(560px, calc(100% - 28px)); display: none; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; border: 1px solid #3b3b3b; border-radius: 18px; background: rgba(14,14,14,.96); box-shadow: 0 22px 70px rgba(0,0,0,.55); transform: translateX(-50%); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.device-panel.open { display: grid; animation: settings-in .2s ease both; }
@keyframes settings-in { from { opacity: 0; transform: translate(-50%, 8px) scale(.98); } }
.device-panel label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.device-panel select { width: 100%; border: 0; border-bottom: 1px solid #444; outline: 0; color: var(--white); background: #111; padding: 10px 4px; text-transform: none; letter-spacing: normal; font-size: 16px; }
.mirror-setting { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto !important; align-items: center; min-height: 52px; margin-top: 3px; padding-top: 14px; border-top: 1px solid #2d2d2d; cursor: pointer; text-transform: none !important; letter-spacing: normal !important; }
.mirror-setting > span { display: grid; gap: 4px; }
.mirror-setting strong { color: #e5e5e5; font-size: 13px; font-weight: 600; }
.mirror-setting small { color: #777; font-size: 10px; }
.mirror-setting input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mirror-setting i { position: relative; width: 42px; height: 24px; border: 1px solid #444; border-radius: 999px; background: #242424; transition: background-color .2s ease, border-color .2s ease; }
.mirror-setting i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #929292; transition: transform .2s ease, background-color .2s ease; }
.mirror-setting input:checked + i { border-color: #efefe9; background: #efefe9; }
.mirror-setting input:checked + i::after { background: #111; transform: translateX(18px); }
.mirror-setting input:focus-visible + i { outline: 2px solid #fff; outline-offset: 3px; }
.controls { display: flex; justify-content: center; gap: 12px; margin-top: 34px; }
.control-button { width: 104px; min-height: 84px; border: 1px solid var(--hairline); border-radius: 20px; background: linear-gradient(180deg, rgba(27,27,27,.94), rgba(15,15,15,.96)); color: var(--white); display: grid; place-items: center; align-content: center; gap: 6px; box-shadow: inset 0 1px rgba(255,255,255,.035), 0 12px 36px rgba(0,0,0,.16); }
.control-button:hover { border-color: rgba(255,255,255,.22); background: #1b1b1b; }
.control-button:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.24); }
.control-button[aria-pressed="true"] { background: var(--white); color: #111; }
.control-button:disabled { cursor: not-allowed; opacity: .42; transform: none; }
.control-button.leave { border-color: #573434; color: #efb5b5; }
.control-icon { font-size: 26px; line-height: 1; }
.camera-icon { display: grid; place-items: center; }
.camera-icon svg, .mic-icon svg, .settings-icon svg, .screen-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.screen-icon { display: grid; place-items: center; }
.settings-icon { display: grid; place-items: center; }
.mic-icon { display: grid; place-items: center; }
.mic-slash { opacity: 0; transition: opacity .18s ease; }
#muteButton[aria-pressed="true"] .mic-slash { opacity: 1; }
.control-button > span:last-child { font-size: 11px; }
.status { text-align: center; min-height: 18px; color: #8a8a8a; font-size: 12px; transition: color .2s ease; }
.call.reconnecting .status { color: var(--amber); }
.call.connection-lost .status { color: var(--red); }
.unlock-button { display: block; margin: 10px auto 0; min-height: 44px; border: 1px solid #555; border-radius: 999px; padding: 0 20px; background: #f5f5f2; color: #111; font-weight: 650; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); border: 1px solid #333; border-radius: 999px; background: #f5f5f2; color: #111; padding: 11px 18px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.camera-flip-button { grid-column: 1 / -1; min-height: 42px; border: 1px solid #333; border-radius: 12px; background: #171717; color: #ddd; font: inherit; cursor: pointer; }
.camera-flip-button:hover { background: #222; border-color: #555; }
.peer-volume { grid-column: 1 / -1; width: 100%; accent-color: #f1f1ec; margin-top: 6px; height: 18px; opacity: .78; }
.chat-panel { position: fixed; z-index: 20; right: 22px; bottom: 22px; width: min(360px, calc(100vw - 28px)); height: min(520px, calc(100dvh - 44px)); display: grid; grid-template-rows: auto 1fr auto; border: 1px solid #363636; border-radius: 22px; background: rgba(12,12,12,.97); box-shadow: 0 24px 80px rgba(0,0,0,.56); opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98); transition: opacity .2s ease, transform .2s ease, visibility .2s ease; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.chat-panel.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid #2c2c2c; color: #eee; }
.chat-header button { width: 30px; height: 30px; border: 0; border-radius: 9px; background: #222; color: #ddd; font-size: 20px; cursor: pointer; }
.chat-messages { overflow: auto; display: flex; flex-direction: column; gap: 9px; padding: 14px; }
.chat-message { max-width: 88%; align-self: flex-start; }
.chat-message.own { align-self: flex-end; }
.chat-message-meta { margin: 0 6px 4px; color: #777; font-size: 10px; }
.chat-message-body { padding: 9px 11px; border: 1px solid #303030; border-radius: 13px 13px 13px 4px; background: #1a1a1a; color: #eee; font-size: 13px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.own .chat-message-body { border-color: #4d4d4d; background: #f1f1ec; color: #111; border-radius: 13px 13px 4px 13px; }
.chat-form { display: grid; grid-template-columns: 1fr 42px; gap: 8px; padding: 11px; border-top: 1px solid #2c2c2c; }
.chat-form input { min-width: 0; border: 1px solid #363636; border-radius: 12px; padding: 0 12px; background: #171717; color: #fff; outline: 0; }
.chat-form input:focus { border-color: #777; }
.chat-form button { border: 0; border-radius: 12px; background: #f1f1ec; color: #111; font-size: 20px; cursor: pointer; }
.chat-control { position: relative; }
.chat-unread { position: absolute; top: 8px; right: 13px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #efb5b5; color: #111; font-size: 10px; line-height: 18px; font-weight: 700; }

@media (max-width: 650px) {
  .shell { width: min(100% - 24px, 1120px); padding-bottom: env(safe-area-inset-bottom); }
  .topbar { height: calc(68px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  .security-badge { font-size: 11px; }
  .lobby { min-height: calc(100dvh - 69px); display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 42px; padding: 42px 0 48px; }
  .lobby::before { background-size: 42px 42px; }
  h1 { margin-block: 18px; font-size: clamp(54px, 16vw, 76px); }
  .lead { max-width: 440px; font-size: 15px; }
  .join-card { padding: 24px; border-radius: 23px; }
  .join-card-top { margin-bottom: 36px; }
  .join-row button { min-height: 52px; padding: 0 14px 0 17px; }
  .call { padding-top: 44px; }
  .call-heading { align-items: start; flex-direction: column; }
  .heading-actions { width: 100%; max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
  .heading-actions .secondary-button, .heading-actions #lockButton, .heading-actions #copyButton { width: 100%; justify-content: center; min-height: 46px; padding-inline: 12px; }
  .participants { grid-template-columns: 1fr 1fr; margin-top: 34px; }
  .participant { min-height: 165px; padding: 15px; }
  .participant.has-video { min-height: 0; }
  .participant.is-screen-share { max-height: 56vh; }
  .participants { grid-template-columns: 1fr; }
  .tech-data { font-size: 10px; }
  .device-panel { bottom: calc(112px + env(safe-area-inset-bottom)); width: min(420px, calc(100% - 24px)); grid-template-columns: 1fr; }
  .device-panel .audio-device-setting { display: none; }
  .device-panel.open { display: grid; }
  .camera-flip-button { display: grid; }
  .controls { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 4; width: min(100%, 520px); margin-inline: auto; padding: 8px; border: 1px solid #252525; border-radius: 24px; background: rgba(8,8,8,.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .control-button { flex: 1 1 0; width: auto; min-width: 58px; min-height: 72px; }
  .control-button > span:last-child { font-size: 10px; }
}

@media (min-width: 651px) {
  .camera-flip-button { display: none; }
}

@media (pointer: coarse), (max-width: 650px) {
  .chat-panel { right: 12px; bottom: calc(94px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); height: min(66dvh, 480px); }
  .chat-control { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (pointer: coarse), (max-width: 650px) {
  .desktop-only-setting { display: none; }
  .mobile-ui #settingsButton, .mobile-ui #devicePanel { display: none !important; }
  .mobile-ui .participant { min-height: 142px; padding: 13px; border-radius: 16px; }
  .mobile-ui .participants { gap: 8px; margin-top: 26px; margin-bottom: 14px; }
  .mobile-ui .participant-name { font-size: 13px; }
  .mobile-ui .identity-meta { margin-top: 5px; }
  .mobile-ui .tech-data { margin-top: 7px; font-size: 8px; }
  .mobile-ui .controls { gap: 5px; border-radius: 19px; }
  .mobile-ui .control-button { min-width: 0; min-height: 62px; padding-inline: 5px; }
}

/* Compact participant rows inspired by the supplied reference. */
.participants { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.participant:not(.has-video) { min-height: 142px; padding: 17px 20px; border-radius: 24px; display: block; }
.participant:not(.has-video) .participant-info { display: grid; grid-template-columns: 68px minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 17px; align-items: center; }
.participant:not(.has-video) .participant-top { grid-column: 1; grid-row: 1 / 3; position: static; align-items: flex-start; justify-content: flex-start; height: 100%; }
.participant:not(.has-video) .avatar { width: 58px; height: 58px; font-size: 25px; border-color: #4b4e58; background: rgba(255,255,255,.035); }
.participant:not(.has-video) .participant-name { grid-column: 2; grid-row: 1; display: block; padding-right: 78px; }
.participant:not(.has-video) .participant-name .level { position: absolute; right: 22px; bottom: 22px; height: 22px; gap: 4px; color: #9aa0b1; }
.participant:not(.has-video) .participant-name .level i { width: 4px; }
.participant:not(.has-video) .participant-name .level i:nth-child(1) { height: 8px; }
.participant:not(.has-video) .participant-name .level i:nth-child(2) { height: 14px; }
.participant:not(.has-video) .participant-name .level i:nth-child(3) { height: 22px; }
.participant:not(.has-video) .participant-name .level i:nth-child(4) { height: 16px; }
.participant:not(.has-video) .participant-state { margin-top: 6px; text-transform: none; letter-spacing: normal; }
.participant:not(.has-video) .tech-data { grid-column: 2; grid-row: 2; margin-top: 8px; font-size: 13px; text-transform: none; letter-spacing: normal; }
.participant:not(.has-video) .latency::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 10px; border-radius: 50%; background: var(--green); vertical-align: 1px; box-shadow: 0 0 12px rgba(57,217,128,.45); }
.participant:not(.has-video) .tech-data.medium .latency::before { background: var(--amber); box-shadow: 0 0 12px rgba(238,190,86,.4); }
.participant:not(.has-video) .tech-data.bad .latency::before { background: var(--red); box-shadow: 0 0 12px rgba(255,91,97,.4); }
.participant:not(.has-video) .mic-state { position: absolute; top: 20px; right: 20px; font-size: 13px; text-transform: none; letter-spacing: normal; }
.participant:not(.has-video) .mic-state svg { width: 22px; height: 22px; }
.participant:not(.has-video).muted { background: linear-gradient(145deg, #24191c, #151113); border-color: #5a353b; }
.participant:not(.has-video).self { background: linear-gradient(145deg, #191919, #101010); border-color: #3a3a3a; }
.participant:not(.has-video).self.muted { background: linear-gradient(145deg, #2a181c, #171113); }
.participant:not(.has-video).speaking { border-color: var(--green); }
@media (pointer: coarse), (max-width: 650px) {
  .participant:not(.has-video) { min-height: 126px; padding: 14px 15px; border-radius: 19px; }
  .participant:not(.has-video) .participant-info { grid-template-columns: 58px minmax(0, 1fr); column-gap: 13px; }
  .participant:not(.has-video) .avatar { width: 50px; height: 50px; font-size: 21px; }
  .participant:not(.has-video) .mic-state { top: 16px; right: 15px; font-size: 11px; }
  .participant:not(.has-video) .participant-name { padding-right: 62px; }
  .participant:not(.has-video) .participant-name .level { right: 16px; bottom: 17px; }
  .participant:not(.has-video) .tech-data { font-size: 11px; }
  .mobile-ui .room-runtime { gap: 7px; font-size: 11px; }
  .mobile-ui .room-runtime .secondary-button { min-height: 28px; padding: 0 9px; font-size: 9px; }
}

/* Gallery: the media surface and participant metadata have separate space. */
.participants { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: start; }
.participant.has-video { display: flex; flex-direction: column; aspect-ratio: auto; padding: 0; }
.participant.has-video .participant-video { position: relative; inset: auto; width: 100%; height: clamp(180px, 34vh, 420px); flex: none; object-fit: contain; border-radius: 0; transform: none !important; }
.participant.has-video .participant-info { position: relative; inset: auto; width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px; border: 0; border-top: 1px solid #292929; border-radius: 0; background: #141414; backdrop-filter: none; min-height: 72px; }
.participant.has-video .participant-top { grid-column: 1; grid-row: 1 / 3; }
.participant.has-video .participant-name { grid-column: 2; grid-row: 1; }
.participant.has-video .tech-data { grid-column: 2; grid-row: 2; }
.participant.has-video .identity-meta { margin-top: 3px; }
.participant.has-video .participant-state { font-size: 10px; text-transform: none; }
.participant.has-video::after { display: none; }
.participant.has-video .fullscreen-button { bottom: 90px; }
.participant.is-screen-share { grid-column: auto; max-height: none; aspect-ratio: auto !important; }
.participant:not(.has-video) { min-height: 106px; padding: 12px 16px; }
.participant:not(.has-video) .avatar { width: 46px; height: 46px; font-size: 20px; }
.participant:not(.has-video) .participant-info { grid-template-columns: 48px minmax(0, 1fr); column-gap: 12px; }
.participant:not(.has-video) .tech-data { font-size: 11px; margin-top: 4px; }
.participant:fullscreen .participant-video { height: calc(100dvh - 88px); }
.participant:fullscreen .participant-info { position: relative; inset: auto; width: 100%; }
.moderation-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.moderation-actions button { font-size: 11px; min-height: 36px; }
.admin-menu { left: auto; right: 8px; top: 8px; }
.admin-remove-button { left: auto; right: 0; min-width: 162px; }
.admin-mute-button { top: 125px; }
@media (pointer: coarse), (max-width: 650px) {
  .participants { grid-template-columns: 1fr; gap: 8px; }
  .participant.has-video { width: 100%; aspect-ratio: auto !important; }
  .participant.has-video .participant-video { width: 100%; height: auto; min-height: 0; max-height: min(68dvh, 720px); aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; }
  .participant.has-video .participant-info { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .participant.has-video .participant-top { display: flex; grid-column: 1; grid-row: auto; flex-direction: row; justify-content: space-between; width: 100%; }
  .participant.has-video .avatar { width: 24px; height: 24px; font-size: 12px; }
  .participant.has-video .participant-name, .participant.has-video .tech-data { grid-column: 1; }
  .participant:not(.has-video) .participant-info { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; align-items: center; }
  .participant:not(.has-video) .participant-top { display: flex; grid-column: 1; grid-row: 1 / 3; height: 100%; align-items: flex-start; justify-content: flex-start; }
  .participant:not(.has-video) .avatar { width: 44px; height: 44px; font-size: 19px; }
  .participant:not(.has-video) .mic-state { position: absolute; top: 14px; right: 14px; font-size: 10px; }
  .participant:not(.has-video) .participant-name { grid-column: 2; grid-row: 1; padding-right: 64px; }
  .participant:not(.has-video) .tech-data { grid-column: 2; grid-row: 2; padding-right: 0; margin-top: 4px; }
  .participant:not(.has-video) .level { display: none; }
}
.participants:has(> .participant:nth-child(2):last-child) > .participant.has-video:not(.self) { grid-column: 1 / -1; grid-row: 1; }
.participants:has(> .participant:nth-child(2):last-child) > .participant.has-video:not(.self) .participant-video { height: auto; max-height: min(68dvh, 720px); aspect-ratio: var(--video-aspect, 16 / 9); }
.participants:has(> .participant:nth-child(2):last-child) > .participant.self.has-video .participant-video { height: auto; max-height: min(34dvh, 280px); aspect-ratio: var(--video-aspect, 16 / 9); }

.admin-panel-heading { position: relative; min-height: 32px; padding-right: 42px; }
.admin-panel-toggle { position: absolute; right: 0; top: 0; width: 32px; height: 28px; border: 1px solid #3b3b3b; border-radius: 9px; background: #191919; color: #e5e5e5; font: inherit; line-height: 1; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.admin-panel-toggle:hover { background: #242424; }
.admin-panel.open .admin-panel-toggle { transform: rotate(180deg); }
.admin-panel:not(.open) .admin-panel-body { display: none; }
.admin-panel-body { margin-top: 10px; }

@media (pointer: coarse), (max-width: 650px) {
  .participant:not(.has-video) .participant-name .level { display: flex; position: absolute; top: 16px; right: 16px; bottom: auto; height: 22px; gap: 4px; }
  .participant:not(.has-video) .participant-name .level i { width: 4px; }
  .participant:not(.has-video) .participant-name .level i:nth-child(1) { height: 8px; }
  .participant:not(.has-video) .participant-name .level i:nth-child(2) { height: 14px; }
  .participant:not(.has-video) .participant-name .level i:nth-child(3) { height: 22px; }
  .participant:not(.has-video) .participant-name .level i:nth-child(4) { height: 16px; }
  .participant:not(.has-video).muted .participant-name .level { right: 74px; }
}

/* Line refresh: one media surface, predictable proportions, compact controls. */
body { background: #08090b; }
.shell { width: min(1240px, calc(100% - 40px)); }
.call { padding: 34px 0 34px; }
.call-heading { padding: 18px 20px 20px; border: 1px solid #24272d; border-radius: 24px; background: linear-gradient(145deg, #121418, #0d0f12); box-shadow: 0 18px 55px rgba(0,0,0,.22); }
.call-heading h2 { margin-top: 9px; font-size: clamp(32px, 5vw, 58px); }
.room-runtime { margin-top: 10px; }
.participants { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 22px 0 18px; align-items: start; }
.participant { min-height: 154px; padding: 16px; border-radius: 22px; border-color: #252930; background: #111318; box-shadow: 0 14px 38px rgba(0,0,0,.2); }
.participant.has-video { display: grid; grid-template-rows: minmax(0, auto) auto; aspect-ratio: auto; padding: 0; overflow: hidden; background: #0b0d10; }
.participant.has-video .participant-video { grid-row: 1; position: relative; inset: auto; width: 100%; height: auto; min-height: 0; aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; border-radius: 0; background: #0b0d10; transform: none !important; }
.participant.has-video .participant-info { grid-row: 2; position: relative; inset: auto; width: 100%; min-height: 74px; padding: 10px 13px; border: 0; border-top: 1px solid #252930; border-radius: 0; background: #111318; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 10px; }
.participant.has-video .participant-top { grid-column: 1; grid-row: 1 / 3; }
.participant.has-video .participant-name { grid-column: 2; grid-row: 1; }
.participant.has-video .tech-data { grid-column: 2; grid-row: 2; margin-top: 2px; }
.participant.has-video .participant-video + .participant-info { z-index: 3; }
.participant.has-video::after { display: none; }
.participant.has-video .fullscreen-button { left: auto; right: 12px; bottom: 84px; width: 36px; height: 36px; border-radius: 11px; background: rgba(8,9,11,.65); }
.camera-flip-overlay { position: absolute; z-index: 7; right: 12px; bottom: 84px; width: 36px; height: 36px; display: none; place-items: center; border: 1px solid rgba(255,255,255,.34); border-radius: 50%; background: rgba(255,255,255,.78); color: #111; box-shadow: 0 8px 22px rgba(0,0,0,.28); backdrop-filter: blur(8px); cursor: pointer; }
.camera-flip-overlay svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.participant.self.has-video .camera-flip-overlay { display: grid; }
.participant:fullscreen { display: grid; grid-template-rows: minmax(0, 1fr); width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; padding: 0; border: 0; border-radius: 0; background: #050608; }
.participant:fullscreen .participant-video { grid-row: 1; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; object-fit: contain; background: #050608; }
.participant:fullscreen .participant-info { position: absolute; z-index: 8; top: 18px; left: 18px; right: auto; width: min(270px, calc(100% - 36px)); min-height: 0; padding: 9px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(7,8,10,.64); backdrop-filter: blur(14px); }
.participant:fullscreen .fullscreen-button { left: auto; right: 18px; bottom: 18px; }
.participant:fullscreen .camera-flip-overlay { right: 68px; bottom: 18px; }
.participant:fullscreen .fullscreen-self-preview { top: 18px; right: 18px; width: min(176px, 24vw); height: auto; max-height: 26vh; aspect-ratio: var(--preview-aspect, 16 / 9); object-fit: cover; }
.controls { flex-wrap: wrap; gap: 9px; margin-top: 18px; padding: 9px; border: 1px solid #252930; border-radius: 22px; background: #0e1013; }
.control-button { width: 94px; min-height: 72px; border-radius: 16px; background: #15181d; }
.control-button:hover { background: #1d2128; }
.status { margin-top: 11px; }
.chat-panel { right: 20px; bottom: 20px; }

@media (max-width: 650px) {
  .shell { width: min(100% - 20px, 720px); }
  .call { padding-top: 16px; }
  .call-heading { padding: 15px; border-radius: 19px; }
  .call-heading h2 { font-size: clamp(30px, 11vw, 48px); }
  .participants { grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
  .participant.has-video .participant-video { aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; }
  .participant.has-video .participant-info { min-height: 68px; padding: 8px 11px; }
  .participant.has-video .fullscreen-button { right: 10px; bottom: 78px; width: 34px; height: 34px; }
  .camera-flip-overlay { right: 10px; bottom: 78px; width: 34px; height: 34px; }
  .controls { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 15; margin-top: 12px; padding: 7px; gap: 6px; border-radius: 19px; }
  .control-button { min-width: 0; width: auto; flex: 1 1 0; min-height: 64px; padding: 5px 3px; border-radius: 14px; }
  .control-button > span:last-child { font-size: 9px; white-space: nowrap; }
  .control-icon svg { width: 24px; height: 24px; }
  .focusButton { display: grid; }
  .chat-panel { right: 10px; bottom: calc(88px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); height: min(68dvh, 500px); }
}

@media (pointer: coarse), (max-width: 650px) {
  .call { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .controls { position: relative; bottom: auto; }
  .participant.has-video .participant-video { width: 100%; height: auto; aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; object-position: center; }
  .participant.has-video .participant-info { position: relative; display: block; min-height: 86px; padding: 10px 12px; }
  .participant.has-video .participant-top { position: absolute; left: 12px; right: 12px; top: 10px; width: auto; height: 30px; display: flex; align-items: center; justify-content: flex-start; }
  .participant.has-video .participant-top .avatar { width: 28px; height: 28px; font-size: 13px; flex: 0 0 auto; }
  .participant.has-video .participant-top .mic-state { position: absolute; top: 0; right: 0; font-size: 10px; }
  .participant.has-video .participant-name { display: block; min-height: 40px; margin-left: 40px; padding-right: 86px; }
  .participant.has-video .participant-name .participant-state { margin-top: 3px; font-size: 10px; line-height: 1.2; white-space: nowrap; }
  .participant.has-video .tech-data { display: block; margin: 46px 0 0 40px; font-size: 11px; line-height: 1.2; }
  .participant.has-video .participant-name .level { display: none; }
  .participant.has-video .fullscreen-button { right: 10px; bottom: 98px; }
  .participant.self.has-video .camera-flip-overlay { right: 52px; bottom: 98px; }
}

/* Final mobile cleanup: compact metadata, neutral monochrome surfaces. */
.participants, .participant, .participant.has-video, .participant.has-video .participant-info,
.controls, .control-button, .chat-panel { background-color: #111; }
.participant.has-video { background: #0d0d0d; }
.participant.has-video .participant-info { background: #121212; border-color: #282828; }
.controls { background: #0d0d0d; border-color: #292929; }
.control-button { background: #151515; border-color: #2c2c2c; color: #f1f1ed; }
.control-button:hover { background: #1d1d1d; }
.call-heading { background: #111; border-color: #2a2a2a; }
.heading-actions { min-height: 0; }
.identity-meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.identity-meta .tech-data { display: inline-flex; grid-template-columns: none; align-items: center; gap: 0; margin: 0; color: #8d8d8d; font-size: 11px; text-transform: none; letter-spacing: 0; }
.identity-meta .tech-data .latency { white-space: nowrap; }

@media (pointer: coarse), (max-width: 650px) {
  .chat-control { display: none !important; }
  .controls { z-index: 30; pointer-events: auto; }
  .control-button { pointer-events: auto; }
  .participant.has-video .participant-info { height: 78px; min-height: 78px; max-height: 78px; overflow: hidden; padding: 9px 12px; }
  .participant.has-video .participant-top { top: 9px; height: 29px; }
  .participant.has-video .participant-top .avatar { width: 28px; height: 28px; }
  .participant.has-video .participant-name { min-height: 32px; margin-left: 40px; padding-right: 92px; }
  .participant.has-video .participant-name .identity-meta { margin-top: 2px; min-height: 16px; }
  .participant.has-video .participant-name .participant-state { display: none; }
  .participant.has-video .identity-meta .tech-data { position: static; display: inline-flex; margin: 0; font-size: 11px; line-height: 1; }
  .participant.has-video .fullscreen-button { right: 10px; bottom: 88px; }
  .participant.self.has-video .camera-flip-overlay { right: 52px; bottom: 88px; }
}

@media (pointer: coarse), (max-width: 650px) {
  .call-heading { min-height: 0; padding: 12px 14px 13px; }
  .call-heading .heading-actions { min-height: 0; height: auto; }
  .call-heading .room-runtime { margin-top: 7px; }
  .participant:not(.has-video) .identity-meta .tech-data { margin: 0; font-size: 11px; }
}


/* Final call layout polish. */
#securityBadge, #relayNotice { display: none !important; }
.join-actions { display: grid; gap: 10px; }
.create-room-button { min-height: 46px; border: 1px solid #3a3a3a; border-radius: 14px; background: #171717; color: #e8e8e3; font-weight: 600; }
.create-room-button:hover { background: #222; border-color: #666; }
.controls { position: fixed !important; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; width: min(720px, calc(100% - 24px)); margin: 0 !important; }
.call { padding-bottom: 130px; }
.participant.has-video:not(.is-screen-share) .participant-video { aspect-ratio: var(--video-aspect, 16 / 9) !important; object-fit: cover; }
.participant.has-video.is-screen-share .participant-video { object-fit: contain; }
@media (max-width: 900px) and (orientation: landscape) {
  .participants { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; align-items: start; }
  .participants > .participant { grid-column: auto !important; grid-row: auto !important; }
  .participant.has-video .participant-video { max-height: none; }
}
@media (max-width: 650px) {
  .controls { width: calc(100% - 20px); }
  .call { padding-bottom: 120px; }
}

.control-button[aria-pressed="true"] { background: #f5f5f2 !important; color: #111 !important; border-color: #f5f5f2 !important; }

#nameInput { width: 100%; }
.join-actions #joinButton { width: 100%; }
/* Join form controls after the code/name fields were separated. */
.join-form > input { min-height: 54px; width: 100%; box-sizing: border-box; border: 1px solid #303030; border-radius: 15px; outline: 0; padding: 16px 17px; color: #fff; background: rgba(5,5,5,.6); font-size: 17px; }
.join-form > input:focus { border-color: #747474; background: #0b0b0b; box-shadow: 0 0 0 4px rgba(255,255,255,.035); }
.join-actions #joinButton { min-height: 54px; border: 1px solid #ddd; border-radius: 15px; background: #f4f4f0; color: #090909; padding: 0 18px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 18px; }

/* Stable mobile geometry: controls fit their buttons and never stretch across the viewport. */
.controls { width: max-content !important; max-width: calc(100vw - 16px); }
.controls .control-button { flex: 0 0 94px; width: 94px; }
.participant.has-video { transition: none; }
.participant.has-video .participant-video { transition: opacity .18s ease; object-fit: contain; }
@media (max-width: 650px) {
  .controls { padding: 6px; gap: 6px; }
  .controls .control-button { flex: 0 0 72px; width: 72px; min-width: 72px; min-height: 60px; }
}

/* Every camera feed uses one stable landscape presentation surface. Portrait
   streams stay intact inside it instead of changing the card geometry. */
.participant.has-video { display: grid; grid-template-rows: auto auto; aspect-ratio: auto !important; }
.participant.has-video .participant-video-frame { grid-row: 1; position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #080808; }
.participant.has-video .participant-video-frame .participant-video { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto !important; object-fit: contain !important; background: #080808; }
.participant.has-video .participant-info { grid-row: 2; }
@media (max-width: 650px) {
  .participant.has-video .participant-video-frame { aspect-ratio: 16 / 9; max-height: none; }
}

/* Fill aspect-ratio side bars with a soft copy of the same stream. */
.participant.has-video .participant-video-frame .participant-video-backdrop { position: absolute; z-index: 0; inset: -10%; width: 120%; height: 120%; object-fit: cover; filter: blur(18px) brightness(.52); opacity: 0; transform: scale(1.04); pointer-events: none; background: #080808; }
.participant.has-video .participant-video-frame .participant-video { z-index: 1; }
.participant.has-video .participant-video-backdrop { opacity: 1; }
.participant.has-video.is-screen-share .participant-video-backdrop { display: none; }
.fullscreen-button { position: absolute; z-index: 6; top: 12px; right: 12px; width: 38px; height: 38px; display: none; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 11px; background: rgba(5,5,5,.62); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.participant.has-video .fullscreen-button { display: grid; }
.fullscreen-button:hover { background: rgba(255,255,255,.18); }
.fullscreen-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 650px) { .fullscreen-button { top: 10px; right: 10px; width: 34px; height: 34px; } }
/* The fullscreen control is the only entry point to fullscreen video. */
.participant.has-video .fullscreen-button { left: auto; top: 12px; right: 12px; bottom: auto !important; }
@media (max-width: 650px) { .participant.has-video .fullscreen-button { top: 10px; right: 10px; } }
/* Camera video fills the card edge to edge; portrait video uses contain to avoid crop. */
.participant.has-video .participant-video-frame { align-self: start; height: auto !important; min-height: 0; aspect-ratio: var(--video-aspect, 16 / 9) !important; }
.participant.has-video:not(.is-screen-share):not(.portrait-video) .participant-video-frame .participant-video { object-fit: cover !important; }
.participant.has-video.portrait-video .participant-video-frame .participant-video { object-fit: contain !important; }
.participant.has-video:not(.is-screen-share):not(.portrait-video) .participant-video-backdrop { display: none; }
.participant.has-video.is-screen-share .participant-video-frame .participant-video { object-fit: contain !important; }

/* Stability and accessibility polish. */
.join-actions { margin-top: 16px; gap: 12px; }
.join-actions button { min-height: 54px; }
.room-code-input, #shortRoom { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
#shortRoom { letter-spacing: .015em; }
.chat-icon { display: grid; place-items: center; }
.chat-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-form button { display: grid; place-items: center; }
.chat-form button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.participant.has-video .participant-video-frame { aspect-ratio: var(--video-aspect, 16 / 9) !important; min-height: 0; max-height: min(68vh, 720px); }
.participant.has-video .participant-video-frame .participant-video { object-fit: contain !important; object-position: center; }
.participant.has-video:not(.is-screen-share) .participant-video { object-fit: contain !important; }
.participant.has-video { min-width: 0; }
.participants:has(> .participant:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.participants:has(> .participant:nth-child(2):last-child) > .participant.has-video:not(.self),
.participants:has(> .participant:nth-child(2):last-child) > .participant.self.has-video { grid-column: auto; grid-row: auto; }
.participant.speaking { animation: none !important; border-color: var(--green) !important; box-shadow: 0 0 0 2px rgba(57,217,128,.28), inset 0 0 24px rgba(57,217,128,.045) !important; }
.participant.speaking .level i { animation: pulse .65s ease-in-out infinite alternate; }
.participant.has-video.muted, .participant.self.has-video.muted { border-color: #2b2e34 !important; background: #0d0f12 !important; box-shadow: 0 14px 38px rgba(0,0,0,.2) !important; }
.participant.has-video.muted::after { background: linear-gradient(180deg, rgba(0,0,0,.38), transparent 35%, rgba(0,0,0,.82)) !important; }
.participant.has-video.muted .participant-video { filter: none !important; }
.participant.has-video.muted .participant-info { background: #111318 !important; border-color: #252930 !important; }
.participant.has-video .admin-menu { top: 58px !important; right: 12px !important; left: auto !important; z-index: 8 !important; }
.participant.has-video .admin-menu-trigger { width: 36px; height: 32px; }
.participant.has-video .fullscreen-button { top: 12px !important; right: 12px !important; z-index: 7 !important; }
.mirror-render-canvas, .mirror-source-video { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: -10px; top: -10px; }
.device-panel .audio-device-setting { min-width: 0; }

@media (max-width: 650px) {
  .participants:has(> .participant:nth-child(2):last-child) { grid-template-columns: 1fr; }
  .participant.has-video .participant-video-frame { min-height: 0; }
  .device-panel .desktop-only-setting { display: none; }
}

/* =========================================
   ФИКС МАКЕТА ВИДЕОЗВОНКОВ (ПЕРЕОПРЕДЕЛЕНИЕ)
   ========================================= */

/* Сетка участников: стабильная и адаптивная */
.participants {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
  gap: 16px !important;
  align-items: stretch !important;
}

/* Когда ровно 2 участника - делим экран пополам */
.participants:has(> .participant:nth-child(2):last-child) {
  grid-template-columns: 1fr 1fr !important;
}
@media (max-width: 650px) {
  .participants:has(> .participant:nth-child(2):last-child) {
    grid-template-columns: 1fr !important;
  }
}

/* Отменяем ломающие макет псевдоклассы */
.participants:has(> .participant:nth-child(2):last-child) > .participant.has-video:not(.self),
.participants:has(> .participant:nth-child(2):last-child) > .participant.self.has-video {
  grid-column: auto !important;
  grid-row: auto !important;
}

/* Карточка видео: flex-контейнер, чтобы инфо-панель всегда была внизу */
.participant.has-video {
  display: flex !important;
  flex-direction: column !important;
  aspect-ratio: auto !important;
  height: 100% !important;
  min-height: 280px !important;
  max-height: 75vh !important;
  border-radius: 22px !important;
  overflow: hidden !important;
  background: #0b0d10 !important;
  padding: 0 !important;
}

/* Рамка видео: растягивается на всё свободное пространство сверху */
.participant.has-video .participant-video-frame {
  position: relative !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  background: #080808 !important;
}

/* Само видео: заполняет рамку без пустот */
.participant.has-video .participant-video-frame .participant-video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
  transform: none !important;
}

/* Демонстрация экрана: не обрезаем (contain) */
.participant.has-video.is-screen-share .participant-video-frame .participant-video {
  object-fit: contain !important;
}

/* Информационная панель (имя, пинг и т.д.): фиксируется строго внизу */
.participant.has-video .participant-info {
  position: relative !important;
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 74px !important;
  max-height: none !important;
  width: 100% !important;
  background: #111318 !important;
  border-top: 1px solid #252930 !important;
  border-radius: 0 !important;
  z-index: 10 !important;
}

/* Final video grid geometry: deterministic frame + bottom metadata. */
.participants {
  align-items: start !important;
}
.participant.has-video {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  align-self: start !important;
  display: flex !important;
  flex-direction: column !important;
}
.participant.has-video .participant-video-frame {
  flex: 0 0 auto !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: var(--video-aspect, 16 / 9) !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  background: #080808 !important;
}
.participant.has-video .participant-video-frame .participant-video {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
}
.participant.has-video.portrait-video .participant-video-frame .participant-video {
  object-fit: contain !important;
}
.participant.has-video.portrait-video .participant-video-backdrop {
  display: block !important;
}
.participant.has-video.is-screen-share .participant-video-frame {
  background: #050608 !important;
}
.participant.has-video.is-screen-share .participant-video-frame .participant-video {
  object-fit: contain !important;
}
.participant.has-video .participant-info {
  flex: 0 0 auto !important;
  min-height: 76px !important;
  height: 76px !important;
  box-sizing: border-box !important;
}
.participant.has-video .fullscreen-button {
  top: 12px !important;
  right: 12px !important;
  bottom: auto !important;
}
.participant.has-video .admin-menu {
  top: 56px !important;
  right: 12px !important;
  left: auto !important;
}
@media (max-width: 650px) {
  .participant.has-video .participant-video-frame { aspect-ratio: var(--video-aspect, 16 / 9) !important; }
  .participant.has-video .participant-info { height: 72px !important; min-height: 72px !important; }
}

/* Final monochrome call surface and uncropped self preview. */
.participant.has-video,
.participant.has-video .participant-video-frame,
.participant.has-video .participant-video,
.participant.has-video .participant-info,
.participant.has-video.muted,
.participant.has-video.muted .participant-info {
  background: #0b0b0b !important;
}
.participant.has-video.self .participant-video { object-fit: contain !important; background: #0b0b0b !important; }
.participant.has-video.muted::after { display: none !important; }
.participant.has-video.muted { border-color: rgba(224,76,76,.62) !important; }
.participant.has-video .participant-info { border-top: 2px solid #303030 !important; }
.screen-share-prompt {
  position: fixed; z-index: 30; left: 50%; top: 110px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 28px)); padding: 18px 20px; display: grid; gap: 8px;
  color: #f4f4f4; background: #101010; border: 2px solid #666; border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.62); animation: prompt-in .18s ease-out;
}
.screen-share-prompt span { color: #a6a6a6; font-size: 13px; }
.screen-share-prompt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.screen-share-prompt-actions button { min-height: 42px; padding: 0 14px; border: 1px solid #696969; border-radius: 11px; background: #f5f5f2; color: #111; font: inherit; cursor: pointer; }
.screen-share-prompt-actions .screen-share-cancel { background: #151515; color: #eee; }
@keyframes prompt-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Match each camera card to its real source ratio; never create a bottom bar. */
.participant.has-video .participant-video-frame { aspect-ratio: var(--video-aspect, 16 / 9) !important; }
.participant.has-video:not(.is-screen-share) .participant-video-frame .participant-video { object-fit: cover !important; }
.participant.has-video.self:not(.is-screen-share) .participant-video-frame .participant-video { object-fit: cover !important; }

/* Self camera is rendered in the camera's native portrait/4:3 surface. */
.participant.has-video.self:not(.is-screen-share) .participant-video-frame {
  aspect-ratio: 4 / 3 !important;
  height: auto !important;
  min-height: 0 !important;
  background: #0b0b0b !important;
}
.participant.has-video.self:not(.is-screen-share) .participant-video-frame .participant-video {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
  object-position: center !important;
  background: #0b0b0b !important;
}

/* Call UI performance and touch polish. */
.participant { contain: layout paint style; }
.participant-video-frame, .participant-video { backface-visibility: hidden; }
.controls { padding: 8px !important; border-color: #3b3b3b !important; box-shadow: 0 16px 48px rgba(0,0,0,.42) !important; }
.control-button { transition: background-color .16s ease, border-color .16s ease, transform .16s ease !important; }
.control-button:active { transform: translateY(1px) scale(.98); }
@media (max-width: 650px) {
  .controls { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .controls::-webkit-scrollbar { display: none; }
  .control-button { flex: 0 0 76px !important; width: 76px !important; }
  .call { padding-bottom: 112px !important; }
}

.participant:not(.has-video) { min-height: 92px !important; height: auto !important; max-height: 112px !important; padding: 12px 16px !important; align-self: start !important; }
.participant:not(.has-video) .participant-info { min-height: 0 !important; height: auto !important; }
.participant:not(.has-video) .participant-video-frame { display: none !important; }
.participant.has-video { align-self: start !important; }
.admin-lock-setting { width: 100%; margin: 0 0 12px; min-height: 46px; }
.admin-panel-body { padding-top: 14px !important; }
.controls { position: fixed !important; bottom: max(12px, env(safe-area-inset-bottom)) !important; }
@media (max-width: 650px) { .participant:not(.has-video) { min-height: 76px !important; max-height: 96px !important; padding: 10px 12px !important; } .admin-lock-setting { min-height: 42px; } }

/* Speaking state stays calm; no green flashing or pulsing. */
.participant.speaking,
.participant.speaking:hover {
  animation: none !important;
  border-color: inherit !important;
  box-shadow: inherit !important;
}
.participant.speaking .level i {
  animation: none !important;
}

/* Voice activity is not shown in the call UI. */
.level,
.participant .level,
.participant.speaking .level,
.voice-level,
.speaking-indicator {
  display: none !important;
}
.participant.speaking,
.participant.speaking:hover {
  animation: none !important;
  border-color: inherit !important;
  box-shadow: inherit !important;
}

.level,.participant .level,.participant.speaking .level,.voice-level,.speaking-indicator { display:none !important; }
.participant.speaking,.participant.speaking:hover { animation:none !important; border-color:inherit !important; box-shadow:inherit !important; }

/* Participant cards remain identical while anyone is speaking. */
.participant.speaking,
.participant.speaking:hover,
.participant.speaking:focus-within {
  animation: none !important;
  transform: none !important;
  filter: none !important;
  border-color: inherit !important;
  box-shadow: inherit !important;
}

/* Hard disable all voice-driven visual state and transitions. */
.participant.speaking,
.participant:not(.has-video).speaking,
.participant.has-video.speaking {
  animation: none !important;
  transition: none !important;
  transform: none !important;
  border-color: inherit !important;
  box-shadow: none !important;
}
.participant.speaking * { animation: none !important; transition: none !important; }

/* ================================================================
   Line polish: responsive ergonomics, focus states and touch comfort.
   Kept at the end so this small layer wins over legacy overrides above.
   ================================================================ */
:root {
  --focus-ring: 0 0 0 3px rgba(255,255,255,.22);
  --focus-ring-dark: 0 0 0 3px rgba(8,8,8,.85), 0 0 0 5px rgba(255,255,255,.58);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background:
    radial-gradient(70rem 38rem at 72% -18%, rgba(255,255,255,.085), transparent 62%),
    radial-gradient(50rem 28rem at -10% 112%, rgba(89,110,138,.11), transparent 64%),
    #08090b;
}

button,
input {
  -webkit-appearance: none;
  appearance: none;
}

button,
label,
select,
input[type="checkbox"] + i {
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-dark);
}

button:disabled {
  cursor: wait;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  min-height: 68px;
  height: calc(68px + var(--safe-top));
  padding-top: var(--safe-top);
  background: rgba(8,9,11,.78);
  border-bottom-color: rgba(255,255,255,.12);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
}

.brand {
  min-height: 44px;
  padding: 4px 0;
  border-radius: 10px;
  transition: opacity .18s ease, transform .18s ease;
}

.brand:hover {
  opacity: .82;
}

.brand:active {
  transform: scale(.98);
}

.lobby {
  min-height: calc(100svh - 68px);
  padding-block: clamp(30px, 5vw, 68px) calc(40px + var(--safe-bottom));
}

.lobby-copy,
.join-card {
  animation: surface-in .5s cubic-bezier(.2,.8,.2,1) both;
}

.join-card {
  animation-delay: 70ms;
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 34px 100px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.05);
}

.join-form > input,
.join-actions button,
.create-room-button {
  min-height: 56px;
}

.join-form > input {
  font-size: 16px;
  line-height: 1.2;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.join-form > input:hover {
  border-color: #454545;
}

.join-form > input:focus {
  border-color: #bcbcb7;
  box-shadow: 0 0 0 4px rgba(255,255,255,.07);
}

.join-form > input::placeholder {
  color: #666;
}

.join-actions #joinButton,
.create-room-button {
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.join-actions #joinButton:hover,
.create-room-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}

.join-actions #joinButton:active,
.create-room-button:active {
  transform: translateY(0) scale(.985);
}

.compatibility {
  line-height: 1.45;
}

.call {
  min-height: calc(100svh - 68px);
  padding-bottom: calc(128px + var(--safe-bottom));
}

.call-heading {
  position: relative;
  overflow: hidden;
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 20px 58px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.025);
}

.call-heading::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  pointer-events: none;
}

.room-runtime .secondary-button {
  min-height: 36px;
  min-width: 44px;
}

.participants {
  min-height: 88px;
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.participant {
  border-color: rgba(255,255,255,.12) !important;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease !important;
}

.participant:hover {
  border-color: rgba(255,255,255,.22) !important;
}

.participant.has-video .participant-video-frame {
  isolation: isolate;
}

.participant.has-video .participant-video-frame::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.16), transparent 28%, transparent 72%, rgba(0,0,0,.22));
}

.participant.has-video.is-screen-share .participant-video-frame::after {
  background: linear-gradient(180deg, rgba(0,0,0,.22), transparent 24%, transparent 76%, rgba(0,0,0,.32));
}

.controls {
  bottom: max(12px, calc(8px + var(--safe-bottom))) !important;
  border-color: rgba(255,255,255,.16) !important;
  background: rgba(12,13,15,.9) !important;
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  backdrop-filter: blur(22px) saturate(125%);
}

.control-button {
  min-height: 74px;
  border-color: rgba(255,255,255,.14);
}

.control-button:hover {
  border-color: rgba(255,255,255,.3);
}

.control-button[aria-pressed="true"] {
  box-shadow: 0 10px 26px rgba(0,0,0,.25), var(--focus-ring-dark);
}

.status {
  line-height: 1.45;
}

.device-panel,
.chat-panel,
.admin-panel,
.screen-share-prompt {
  border-color: rgba(255,255,255,.17);
}

.chat-panel {
  padding-bottom: var(--safe-bottom);
}

.chat-header button,
.chat-form button,
.admin-panel-toggle,
.fullscreen-button,
.admin-menu-trigger {
  min-width: 40px;
  min-height: 40px;
}

.chat-form input {
  min-height: 44px;
  font-size: 16px;
}

.toast {
  bottom: calc(88px + var(--safe-bottom));
  max-width: min(420px, calc(100vw - 32px));
  text-align: center;
  line-height: 1.35;
}

@keyframes surface-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: none) {
  .brand:hover,
  .join-actions #joinButton:hover,
  .create-room-button:hover,
  .control-button:hover,
  .participant:hover { transform: none; }
}

@media (max-width: 650px) {
  .shell {
    width: min(calc(100% - 20px), 720px);
  }

  .topbar {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .lobby {
    min-height: calc(100svh - 68px);
    justify-content: flex-start;
    gap: clamp(28px, 8vh, 52px);
    padding-top: clamp(30px, 7vh, 56px);
  }

  .lobby-copy {
    max-width: 32rem;
  }

  .lead {
    line-height: 1.55;
  }

  .join-card {
    width: 100%;
    padding: clamp(20px, 6vw, 28px);
  }

  .join-card-top {
    margin-bottom: 30px;
  }

  .join-form > input,
  .join-actions button {
    min-height: 56px;
  }

  .call {
    min-height: calc(100svh - 68px);
    padding-top: 14px;
    padding-bottom: calc(112px + var(--safe-bottom));
  }

  .call-heading {
    padding: 14px;
    border-radius: 18px;
  }

  .call-heading h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .room-runtime {
    row-gap: 8px;
  }

  .participants {
    min-height: 68px;
  }

  .controls {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    bottom: max(8px, calc(4px + var(--safe-bottom))) !important;
    padding: 6px !important;
  }

  .controls .control-button {
    flex: 0 0 72px !important;
    width: 72px !important;
    min-height: 62px;
  }

  .chat-panel {
    right: 10px;
    bottom: calc(84px + var(--safe-bottom));
    width: calc(100vw - 20px);
    height: min(70svh, 500px);
    border-radius: 20px;
  }

  .screen-share-prompt {
    top: calc(78px + var(--safe-top));
    padding: 16px;
  }

  .screen-share-prompt-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .screen-share-prompt-actions button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .shell {
    width: min(calc(100% - 16px), 720px);
  }

  .topbar {
    margin-inline: -8px;
    padding-inline: 8px;
  }

  h1 {
    font-size: clamp(48px, 16vw, 64px);
  }

  .capacity,
  .trust-row span {
    font-size: 9px;
  }

  .join-card {
    padding: 18px;
  }

  .controls {
    width: calc(100% - 10px) !important;
    max-width: calc(100% - 10px) !important;
  }

  .controls .control-button {
    flex-basis: 68px !important;
    width: 68px !important;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .lobby {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
    gap: 24px;
    align-items: center;
    padding-block: 28px calc(28px + var(--safe-bottom));
  }

  h1 {
    margin-block: 12px;
    font-size: clamp(42px, 8vw, 66px);
  }

  .lead {
    font-size: 14px;
  }

  .join-card {
    padding: 20px;
  }

  .join-card-top {
    margin-bottom: 20px;
  }
}

@media (prefers-contrast: more) {
  .join-card,
  .call-heading,
  .participant,
  .controls,
  .chat-panel {
    border-color: rgba(255,255,255,.48) !important;
  }

  .lead,
  .status,
  .compatibility,
  .participant-state,
  .tech-data {
    color: #d0d0cc;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lobby-copy,
  .join-card { animation: none; }
}


/* Voice activity, mobile chat and clean media corners. */
.participant.speaking,
.participant.speaking:hover,
.participant.speaking:focus-within {
  border-color: #39d980 !important;
  box-shadow: 0 0 0 2px rgba(57,217,128,.32), 0 0 22px rgba(57,217,128,.14) !important;
}
.participant.speaking .level { color: #39d980 !important; }
.participant.speaking .level i {
  background: #39d980 !important;
  opacity: 1 !important;
  animation: voice-meter .58s ease-in-out infinite alternate !important;
}
.participant.speaking .level i:nth-child(2) { animation-delay: -.16s !important; }
.participant.speaking .level i:nth-child(3) { animation-delay: -.31s !important; }
.participant.speaking .level i:nth-child(4) { animation-delay: -.22s !important; }
@keyframes voice-meter {
  from { transform: scaleY(.42); opacity: .58; }
  to { transform: scaleY(1); opacity: 1; }
}

/* Do not paint blurred dark wedges beside rounded video surfaces. */
.participant-video-backdrop { display: none !important; }
.participant.has-video .participant-video-frame { background: transparent !important; }
.participant.has-video .participant-video { background: transparent !important; }

/* Chat stays available on touch devices and uses the same icon rhythm as controls. */
.chat-control { display: grid !important; }
.chat-control .chat-icon,
.chat-control .chat-icon svg { width: 27px; height: 27px; }
.chat-control > span:last-child { font-size: 11px !important; }

/* The share choice opens at the same height as the device settings popover. */
.screen-share-prompt { top: auto !important; bottom: calc(160px + var(--safe-bottom, 0px)); }
@media (max-width: 650px) {
  .controls {
    width: calc(100% - 12px) !important;
    max-width: calc(100% - 12px) !important;
    gap: 4px !important;
  }
  .controls .control-button {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    padding-inline: 2px !important;
  }
  .screen-share-prompt { bottom: calc(112px + var(--safe-bottom, 0px)); }
}
@media (max-width: 390px) {
  .controls .control-button > span:last-child { font-size: 10px !important; }
  .controls .control-icon,
  .controls .control-icon svg { width: 25px; height: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  .participant.speaking .level i { animation: none !important; }
}

/* A clear speaking indicator remains visible in both audio and video cards. */
.participant.speaking .participant-name::after {
  content: '';
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 7px;
  border-radius: 999px;
  background: #39d980;
  box-shadow: 0 0 10px rgba(57,217,128,.6);
}
@media (max-width: 650px) {
  .participant.speaking .participant-name::after { width: 34px; height: 2px; margin-top: 5px; }
}

/* Speaking state: preserve card geometry and draw one quiet inner outline. */
.participant.speaking,
.participant.speaking:hover,
.participant.speaking:focus-within,
.participant:not(.has-video).speaking,
.participant.has-video.speaking {
  animation: none !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
  border-color: var(--hairline) !important;
  box-shadow: inset 0 0 0 2px rgba(57, 217, 128, .92) !important;
}
.participant.speaking .participant-name::after,
.participant.speaking .level,
.participant.speaking .level i {
  display: none !important;
  content: none !important;
  animation: none !important;
}


/* Never replay the card entrance animation when the speaking class changes. */
.participant {
  animation: none !important;
  transition: min-height .36s cubic-bezier(.2,.8,.2,1) !important;
}
.participant.speaking,
.participant.speaking:hover,
.participant.speaking:focus-within,
.participant:not(.has-video).speaking,
.participant.has-video.speaking {
  animation: none !important;
  transition: none !important;
  transform: none !important;
  border-color: var(--hairline) !important;
  box-shadow: inset 0 0 0 2px rgba(57, 217, 128, .92) !important;
}
.participant.speaking .participant-name::after { display: none !important; content: none !important; }

/* Landscape camera feeds use one shared 16:9 surface for both participants. */
.participant.has-video:not(.is-screen-share):not(.portrait-video) .participant-video-frame {
  aspect-ratio: 16 / 9 !important;
}
.participant.has-video:not(.is-screen-share):not(.portrait-video) .participant-video-frame .participant-video {
  aspect-ratio: auto !important;
  object-fit: cover !important;
}

/* Participants who joined from the native Линия app. */
.app-badge { display: inline-flex; align-items: flex-end; justify-content: center; gap: 1.5px; width: 20px; height: 20px; padding: 4px 0; border-radius: 50%; background: #f5f5f2; box-sizing: border-box; }
.app-badge i { display: block; width: 2.5px; border-radius: 2px; background: #0b0b0b; }
.app-badge i:nth-child(1) { height: 5px; }
.app-badge i:nth-child(2) { height: 10px; }
.app-badge i:nth-child(3) { height: 7px; }

/* Chat: multiline input, selectable text, copy menu. */
.chat-form { align-items: end; }
.chat-form textarea { min-width: 0; min-height: 44px; max-height: 120px; resize: none; border: 1px solid #363636; border-radius: 12px; padding: 11px 12px; background: #171717; color: #fff; outline: 0; font: inherit; font-size: 16px; line-height: 1.3; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.chat-form textarea:focus { border-color: #777; }
.chat-form button { align-self: end; min-height: 44px; }
.chat-message-body, .chat-message-body * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: none; }
.chat-message-body a { color: #6cb6ff; text-decoration: underline; word-break: break-all; }
.chat-message.own .chat-message-body a { color: #0b57d0; }
.chat-menu { position: fixed; z-index: 100; min-width: 168px; padding: 5px; border: 1px solid #3a3a3a; border-radius: 12px; background: rgba(24,24,24,.98); box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.chat-menu button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #f0f0ec; font-size: 14px; text-align: left; cursor: pointer; }
.chat-menu button:hover, .chat-menu button:active { background: #2a2a2a; }

/* Stage layout: others big, my own video as a small floating preview. */
#participants.stage { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)) !important; align-items: center !important; }
#participants.stage > .participant.has-video:not(.self) .participant-video-frame { max-height: min(78vh, 900px) !important; }
#participants.stage > .participant.has-video:not(.self) .participant-video-frame,
#participants.stage > .participant.self .participant-video-frame { cursor: zoom-in; }
#participants.stage > .participant.self { position: fixed !important; right: 14px; bottom: calc(132px + env(safe-area-inset-bottom)); z-index: 40; width: clamp(110px, 24vw, 230px); min-height: 0 !important; padding: 0 !important; border-radius: 16px !important; overflow: hidden; box-shadow: 0 10px 34px rgba(0,0,0,.6) !important; border: 1.5px solid rgba(255,255,255,.22) !important; }
#participants.stage > .participant.self:not(.has-video) { display: none !important; }
#participants.stage > .participant.self .participant-info,
#participants.stage > .participant.self .fullscreen-button { display: none !important; }
#participants.stage > .participant.self .participant-video-frame { max-height: none !important; }
#participants.stage > .participant.self .camera-flip-overlay { right: 6px; bottom: 6px; width: 30px; height: 30px; }
#participants.stage > .participant.self.speaking { border-color: var(--green) !important; }
#participants.stage { padding-bottom: 96px; }
@media (max-width: 650px) {
  #participants.stage > .participant.self { right: 10px; bottom: calc(112px + env(safe-area-inset-bottom)); width: clamp(96px, 28vw, 130px); }
}
.participant:fullscreen .fullscreen-button { display: none !important; }
