:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f1f3ff;
  background: #0b1020;
  --panel: #11182c;
  --chat: #0e1527;
  --surface: #19223e;
  --line: #293559;
  --dim: #aab6d5;
  --text: #f1f3ff;
  --accent: #85dfff;
  --violet: #bb9cff;
  --danger: #ffc2d3;
  --speaking: #74efbc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
h1, h2, h3, p, ol, ul { margin: 0; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.symbols { position: absolute; width: 0; height: 0; pointer-events: none; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand { display: flex; align-items: center; gap: .3rem; font-weight: 850; letter-spacing: -.055em; font-size: 1.3rem; white-space: nowrap; }
.brand > span:last-child { color: var(--accent); }
.brand-mark, .chat-symbol, .empty-symbol { display: grid; place-items: center; flex: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; color: #f0f6ff; background: linear-gradient(145deg,#1e6ce5,#6925ca); border: 1px solid #7facff; box-shadow: 0 0 22px #4b65f642, inset 0 1px 0 #c8d5ff44; margin-right: .5rem; }
.brand-mark .icon { width: 25px; height: 25px; stroke-width: 2; }
.gate { min-height: 100dvh; padding: 24px; display: grid; place-items: center; background: radial-gradient(ellipse at 36% 5%, #1a315e 0%, transparent 54%), radial-gradient(ellipse at 97% 100%, #2a194b 0%, #0b1020 55%); }
.gate-card { width: min(100%, 460px); border: 1px solid #3a4a76; border-radius: 26px; padding: clamp(24px, 6vw, 42px); background: #11192dea; box-shadow: 0 24px 80px #05071784; }
.gate-brand { margin-bottom: 30px; }
.gate h1 { font-size: clamp(1.9rem, 7vw, 2.75rem); letter-spacing: -.06em; line-height: 1.1; margin-bottom: 10px; }
.gate-intro, .gate-status { color: var(--dim); line-height: 1.5; }
.join-form, .find-form { display: grid; gap: 9px; margin-top: 24px; }
.join-form label, .find-form label { font-weight: 650; font-size: .9rem; }
.join-form input, .find-form input { background: var(--chat); border: 1px solid var(--line); color: var(--text); padding: 12px 13px; border-radius: 10px; width: 100%; }
.join-form button { margin-top: 5px; }
.gate-status, #find-status { color: var(--danger); font-size: .9rem; margin-top: 10px; }
.gate-status:empty, #find-status:empty { display: none; }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 720; padding: 0 13px; cursor: pointer; transition: background-color .15s, border-color .15s; font-size: .89rem; }
.primary { background: #91dcff; color: #08162a; }
.primary:hover:not(:disabled) { background: #b5eaff; }
.outline { background: var(--surface); border-color: var(--line); }
.outline:hover:not(:disabled) { background: #253356; border-color: #486498; }
.icon-only { width: 40px; padding: 0; flex: none; }
.button[aria-pressed="true"], .leave-voice { background: #45203c; border-color: #744465; color: var(--danger); }
.leave-voice:hover { background: #5c2b4e; }
.app { height: 100dvh; min-height: 450px; display: flex; flex-direction: column; margin: auto; max-width: 1700px; }
.topbar { height: 72px; padding: 0 clamp(12px, 3vw, 38px); display: flex; align-items: center; justify-content: space-between; flex: none; gap: 12px; }
.top-actions, .connection { display: flex; align-items: center; }
.top-actions { gap: 14px; min-width: 0; }
.connection { gap: 7px; color: var(--dim); font-size: .82rem; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #e9b96e; }
.connection.online .dot, .online-dot.online { background: #74efbc; box-shadow: 0 0 10px #74efbc50; }
.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(225px, 280px) minmax(0, 1fr); gap: 14px; padding: 0 clamp(12px, 3vw, 38px) 20px; }
.voice-panel, .chat { border: 1px solid var(--line); border-radius: 16px; min-width: 0; min-height: 0; }
.voice-panel { background: var(--panel); display: flex; flex-direction: column; overflow: hidden; }
.people-list { flex: 1; min-height: 0; overflow: auto; padding: 14px; scrollbar-width: thin; }
.voice-dock { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 8px; border-top: 1px solid var(--line); background: #141d35; }
.dock-profile, .dock-controls { display: flex; align-items: center; gap: 5px; }
.dock-profile, .dock-identity { min-width: 0; }
.dock-avatar { width: 30px; height: 30px; padding: 0; border: 0; cursor: pointer; }
.dock-controls { flex: none; }
.dock-controls .button { width: 34px; min-height: 34px; }
.dock-controls .icon { width: 17px; height: 17px; }
.profile-name, .profile-tag { display: flex; align-items: center; gap: 4px; background: none; border: 0; border-radius: 4px; padding: 1px 2px; min-width: 0; max-width: 100%; color: var(--text); cursor: pointer; }
.profile-name { font-weight: 720; font-size: .86rem; }
.profile-tag { font-size: .71rem; color: var(--dim); }
.profile-name:hover, .profile-tag:hover { color: var(--accent); }
.profile-name span, .profile-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name .icon, .profile-tag .icon { width: 12px; height: 12px; }
.panel-head, .chat-heading, .chat-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.panel-head, .chat-head { justify-content: space-between; }
.panel-head h2, .chat-head h1 { font-size: 1.08rem; font-weight: 780; letter-spacing: -.02em; }
.chat-head p { color: var(--dim); margin-top: 3px; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.chat-heading div { min-width: 0; }
.chat-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-heading { margin-top: 20px; }
.group-heading .button { width: 32px; min-height: 32px; }
.friends-empty { color: var(--dim); margin: 18px 0 0; font-size: .88rem; line-height: 1.5; }
#requests-box { border-bottom: 1px solid var(--line); padding: 7px 0 10px; }
#requests-box h3 { font-size: .82rem; color: var(--violet); margin: 6px 0; }
.members { padding: 0; margin-top: 10px; list-style: none; display: grid; gap: 6px; }
.friend, .request { display: flex; align-items: center; gap: 8px; min-width: 0; }
.friend { width: 100%; background: transparent; border: 1px solid transparent; padding: 7px; border-radius: 10px; text-align: left; cursor: pointer; }
.friend:hover, .friend.selected { background: var(--surface); border-color: var(--line); }
.friend.selected { border-color: #4665a4; }
.friend.speaking .avatar { box-shadow: 0 0 0 2px var(--speaking); }
.friend-info { flex: 1; min-width: 0; }
.friend-name, .friend-status { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-name { font-size: .9rem; font-weight: 690; }
.friend-status { font-size: .75rem; color: var(--dim); margin-top: 3px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #2a2953; color: #e5d3ff; flex: none; font-weight: 780; text-transform: uppercase; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.self { background: #173654; color: var(--accent); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #65718b; flex: none; }
.request { padding: 5px 0; }
.request .button { width: 32px; min-height: 32px; }
.chat { background: var(--chat); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { border-bottom: 1px solid var(--line); padding: 13px 16px; }
.chat-symbol { width: 38px; height: 38px; border-radius: 11px; background: var(--surface); color: var(--accent); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px; scrollbar-width: thin; }
.chat-empty { min-height: min(160px, 100%); height: 100%; display: grid; align-content: center; justify-items: center; text-align: center; gap: 6px; }
.empty-symbol { width: 56px; height: 56px; background: #1a2a4b; color: var(--accent); border: 1px solid #2f4f86; border-radius: 17px; margin-bottom: 6px; }
.empty-symbol .icon { width: 25px; height: 25px; }
.chat-empty h2 { font-size: clamp(1.05rem, 3vw, 1.5rem); }
.chat-empty p { color: var(--dim); font-size: .9rem; }
.messages { list-style: none; padding: 15px 0; display: grid; gap: 16px; }
.message { display: flex; gap: 9px; align-items: flex-start; }
.message > div { min-width: 0; }
.message-name { font-weight: 720; overflow-wrap: anywhere; }
.message-time { color: var(--dim); margin-left: 7px; font-size: .75rem; }
.message-text { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-entry { display: flex; align-items: flex-end; gap: 6px; }
.chat-form { margin: 8px 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 5px; display: grid; gap: 6px; }
.chat-form:focus-within { border-color: #6094d0; }
.attachment-preview { display: flex; align-items: center; gap: 8px; padding: 4px; min-width: 0; }
.attachment-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.attachment-preview span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.message-image { display: block; max-width: 100%; margin-top: 7px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; cursor: zoom-in; }
.message-image img { display: block; max-width: min(440px, 100%); max-height: 265px; object-fit: contain; }
.picture-dialog { width: min(1100px, calc(100vw - 30px)); max-height: calc(100dvh - 24px); background: #080c17; }
.picture-dialog img { display: block; margin: auto; max-width: 100%; max-height: calc(100dvh - 100px); object-fit: contain; }
.picture-dialog form { display: flex; justify-content: flex-end; padding: 7px; }
.chat-form textarea { flex: 1; height: 40px; min-width: 0; max-height: 110px; padding: 9px 7px; resize: none; background: none; border: 0; outline: 0; color: var(--text); line-height: 22px; field-sizing: content; }
.chat-form textarea:focus-visible { outline: none; }
.call-bar { background: #182544; display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.call-bar .button { min-height: 34px; }
.call-copy { min-width: 0; overflow-wrap: anywhere; }
.call-copy p { color: var(--dim); font-size: .82rem; margin-top: 2px; }
.call-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.call-speakers { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.speaker { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; max-width: 175px; color: var(--dim); background: var(--chat); border: 1px solid var(--line); border-radius: 8px; font-size: .79rem; }
.speaker .icon { width: 14px; height: 14px; }
.speaker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speaker.speaking { color: var(--speaking); border-color: var(--speaking); background: #193d38; }
.screens { background: #080c17; display: flex; gap: 8px; justify-content: center; padding: 7px; min-height: 0; }
.screen-view { position: relative; display: grid; place-items: center; min-width: 0; width: 100%; }
.screen-view:not([hidden]) + .screen-view { max-width: 25%; }
.screen-view video { display: block; max-height: min(35vh, 360px); width: 100%; min-width: 0; object-fit: contain; border-radius: 6px; }
.screen-view .fullscreen { position: absolute; bottom: 8px; right: 8px; opacity: .9; }
.screen-view .fullscreen:hover, .screen-view .fullscreen:focus-visible { opacity: 1; }
.screen-view:fullscreen { max-width: none !important; height: 100%; background: #080c17; }
.screen-view:fullscreen video { width: 100%; height: 100%; max-height: none; border-radius: 0; }
.screen-view:fullscreen .fullscreen { bottom: 16px; right: 16px; }
dialog { color: var(--text); border: 1px solid #415588; background: var(--panel); border-radius: 16px; width: min(420px, calc(100vw - 28px)); padding: 0; }
dialog::backdrop { background: #030613b8; }
.dialog-inner { padding: 20px; display: grid; gap: 10px; }
.dialog-inner h2 { font-size: 1.2rem; }
.audio-fields { display: grid; gap: 7px; }
.audio-fields label { font-size: .9rem; font-weight: 650; }
.audio-fields label:not(:first-child) { margin-top: 7px; }
.audio-fields select, #profile-name, .dialog-input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--chat); color: var(--text); }
.group-options { display: grid; gap: 6px; max-height: 40dvh; overflow: auto; }
.group-option { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 7px; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; }
.group-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-option input { accent-color: var(--accent); }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#avatar-preview .avatar { width: 80px; height: 80px; font-size: 1.8rem; }
.name-actions { display: flex; justify-content: flex-end; gap: 8px; }
.audio-fields output { float: right; color: var(--dim); }
.audio-fields input { margin: 0; accent-color: var(--accent); }
.audio-status { color: var(--dim); font-size: .85rem; line-height: 1.45; }
.find-form { margin-top: 5px; }
.find-result { display: grid; gap: 7px; padding: 10px 0 0; }
.screen-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 52vh; overflow: auto; }
.screen-source { display: grid; gap: 6px; text-align: left; min-width: 0; padding: 7px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
.screen-source img { width: 100%; aspect-ratio: 16/9; object-fit: contain; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 28px); background: #253456; border: 1px solid #516c9f; color: var(--text); border-radius: 9px; padding: 10px 13px; box-shadow: 0 6px 22px #0007; z-index: 5; }
@media (max-width: 650px) {
  .topbar { height: 58px; }
  .top-actions .connection { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding-bottom: 10px; }
  .people-list { max-height: 19vh; padding: 8px; }
  .voice-panel { max-height: 46vh; }
  .voice-panel .members { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); }
  .friend { padding: 4px; }
  .chat-head, .call-bar { padding: 7px 10px; }
  .chat-scroll { padding: 0 10px; }
  .chat-entry { display: flex; align-items: flex-end; gap: 6px; }
.chat-form { margin: 6px 9px 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
