:root { color: #1b2330; background: #edf1f7; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow: hidden; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #d7dfeb; border-radius: 8px; outline: none; background: #fff; color: #172032; }
input:focus, select:focus { border-color: #2f80ed; box-shadow: 0 0 0 3px rgb(47 128 237 / .14); }
h1, h2, p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.auth-page { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 430px; min-height: 100vh; background: radial-gradient(circle at 24% 20%, rgb(47 128 237 / .22), transparent 32%), radial-gradient(circle at 72% 64%, rgb(22 160 133 / .16), transparent 30%), #edf1f7; }
.auth-visual { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 8vw; }
.brand-mark, .app-logo { display: grid; place-items: center; color: #fff; background: #2f80ed; }
.brand-mark { width: 68px; height: 68px; border-radius: 18px; }
.brand-mark svg { width: 34px; height: 34px; }
.auth-visual h1 { font-size: clamp(3rem, 8vw, 6.8rem); line-height: .9; }
.auth-visual p { max-width: 640px; color: #536174; font-size: 1.25rem; line-height: 1.5; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; }
.trust-row span, .security-list span, .chat-header p, .profile-card span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row span { min-height: 38px; padding: 0 12px; border-radius: 8px; background: #dff8ef; color: #164437; font-weight: 800; }
.trust-row svg { width: 16px; }
.auth-panel { align-self: center; display: grid; gap: 16px; width: min(100% - 36px, 390px); margin: 0 auto; padding: 20px; border: 1px solid #dde5f0; border-radius: 8px; background: rgb(255 255 255 / .86); box-shadow: 0 24px 70px rgb(34 48 74 / .14); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 8px; background: #eef3f9; }
.mode-switch button { min-height: 38px; border-radius: 7px; background: transparent; color: #586579; }
.mode-switch button.is-active { background: #fff; color: #172032; box-shadow: 0 4px 14px rgb(45 62 92 / .1); }
label { display: grid; gap: 7px; color: #5c6878; font-size: .88rem; font-weight: 800; }
.primary-button, .new-group-button, .call-start { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 8px; background: #2f80ed; color: #fff; font-weight: 900; }
.error-text { color: #c63f3f; font-size: .9rem; }
.advanced-settings { border: 1px solid #dce5ef; border-radius: 8px; background: rgb(247 249 252 / .75); }
.advanced-settings summary { padding: 10px 12px; color: #697789; cursor: pointer; font-size: .8rem; font-weight: 800; }
.advanced-settings > div { display: grid; gap: 10px; padding: 0 12px 12px; }
.advanced-settings label { font-size: .75rem; }
.advanced-settings input { min-height: 36px; font-size: .78rem; }
.advanced-settings .checkbox { display: flex; align-items: center; }
.advanced-settings .checkbox input { width: 16px; min-height: 16px; }

.messenger-shell { position: relative; display: grid; grid-template-columns: 72px 330px minmax(0, 1fr) 310px; height: 100vh; min-height: 0; overflow: hidden; background: #edf1f7; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 12px; background: #182030; }
.app-logo { width: 44px; height: 44px; margin-bottom: 12px; border-radius: 8px; }
.rail button, .header-actions button, .composer button, .call-controls button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; }
.rail button { background: transparent; color: #bac6d8; }
.rail button.is-active, .rail button:hover:not(:disabled) { background: #273246; color: #fff; }
.rail-bottom { margin-top: auto; }
.dialogs-pane, .details-pane { display: flex; flex-direction: column; gap: 16px; min-height: 0; padding: 16px; overflow: auto; background: #fff; }
.dialogs-pane { border-right: 1px solid #dce5ef; }
.details-pane { border-left: 1px solid #dce5ef; }
.profile-card { display: flex; align-items: center; gap: 12px; }
.profile-avatar, .dialog-avatar, .big-avatar { display: grid; place-items: center; border-radius: 50%; background: #16a085; color: #fff; font-weight: 900; }
.profile-avatar { width: 48px; height: 48px; }
.profile-card div:last-child { display: grid; gap: 3px; }
.profile-card span { color: #5c6878; font-size: .83rem; }
.profile-card i { width: 7px; height: 7px; border-radius: 50%; background: #16a085; box-shadow: 0 0 0 3px rgb(22 160 133 / .12); }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 1px solid #dce5ef; border-radius: 8px; background: #f7f9fc; }
.search-box svg { flex: 0 0 auto; width: 17px; }
.search-box input { border: 0; background: transparent; box-shadow: none; }
.new-group-button { width: 100%; }
.dialogs-list { display: grid; gap: 8px; }
.conversation-empty { padding: 12px 8px; color: #697789; font-size: .86rem; line-height: 1.45; }
.invite-notice { padding: 10px 12px; border-radius: 8px; background: #e6f7f1; color: #087f5b; font-size: .82rem; line-height: 1.4; }
.invite-notice.is-error { background: #fff0f0; color: #b93838; }
.dialog-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; min-height: 62px; padding: 9px; border-radius: 8px; background: #fff; color: #172032; text-align: left; }
.dialog-item.is-active, .dialog-item:hover { background: #eef5ff; }
.dialog-avatar { width: 44px; height: 44px; background: #2f80ed; }
.dialog-item > span:nth-child(2) { position: relative; display: grid; gap: 4px; min-width: 0; padding-right: 30px; }
.dialog-item strong, .dialog-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-item small { color: #697789; }
.dialog-unread { position: absolute; top: 50%; right: 0; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #2f80ed; color: #fff; font-size: .72rem; font-weight: 900; line-height: 1; transform: translateY(-50%); box-shadow: 0 4px 12px rgb(47 128 237 / .25); }
.contacts-box, .details-pane section { display: grid; gap: 10px; }
.contacts-box h2, .details-pane h2 { color: #172032; font-size: .92rem; }
.contacts-box p, .details-pane p { color: #697789; font-size: .86rem; line-height: 1.45; }

.chat-workspace { position: relative; display: grid; grid-template-rows: auto minmax(220px, 38vh) auto minmax(0, 1fr) auto; height: 100vh; min-height: 0; overflow: hidden; }
.chat-workspace.has-full-video { grid-template-rows: auto minmax(260px, 55vh) auto minmax(0, 1fr) auto; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #dce5ef; background: rgb(255 255 255 / .84); }
.chat-header h1 { font-size: 1.45rem; }
.chat-header p { margin-top: 4px; color: #697789; font-size: .88rem; }
.chat-header p svg { width: 14px; height: 14px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions .call-start { display: inline-flex; width: auto; padding: 0 16px; color: #fff; }
.call-window { position: relative; min-width: 0; min-height: 0; z-index: 2; }
.call-stage { display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); gap: 12px; height: 100%; padding: 14px; background: #dfe7f1; }
.chat-workspace.has-full-video .call-stage { min-height: 0; padding: 8px; background: #0f1723; }
.video-tile { position: relative; display: grid; place-items: center; min-height: 210px; overflow: hidden; border-radius: 8px; background: #111926; color: #d9e5f5; }
.chat-workspace.has-full-video .video-tile { min-height: 0; }
.video-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-tile audio { display: none; }
.local-tile video { transform: scaleX(-1); }
.video-placeholder { display: grid; place-items: center; gap: 12px; color: #91a0b5; font-size: .9rem; }
.video-placeholder > svg { width: 30px; height: 30px; }
.video-tile > span, .video-tile > small { position: absolute; bottom: 12px; z-index: 3; padding: 7px 9px; border-radius: 8px; background: rgb(7 12 20 / .7); color: #fff; }
.video-tile > span { left: 12px; }
.video-tile > small { right: 12px; color: #d8e4f5; font-size: .75rem; }
.big-avatar { width: 78px; height: 78px; background: #8e63ce; font-size: 2rem; }
.video-tile.has-video .video-placeholder { display: none; }
.call-controls { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; border-bottom: 1px solid #dce5ef; background: #fff; }
.call-controls button { background: #edf3fb; color: #172032; }
.call-controls .call-start { background: #16a085; color: #fff; }
.call-controls .control-muted.is-active { background: #dff7ed; color: #087f5b; }
.call-controls .hangup { display: inline-flex; width: auto; padding: 0 16px; gap: 8px; background: #d94848; color: #fff; }
.call-notice { position: absolute; right: 14px; bottom: calc(100% + 10px); max-width: min(430px, calc(100vw - 28px)); padding: 10px 13px; border: 1px solid rgb(47 128 237 / .18); border-radius: 8px; background: rgb(255 255 255 / .9); color: #1769aa; font-size: .8rem; font-weight: 800; box-shadow: 0 10px 30px rgb(23 32 50 / .16); backdrop-filter: blur(10px); z-index: 10; }
.call-notice.is-error { border-color: rgb(217 72 72 / .2); color: #b93838; }
.messages-area { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 18px 20px; overflow: auto; }
.new-messages-button { position: sticky; right: 0; bottom: 4px; align-self: center; display: flex; align-items: center; gap: 8px; min-height: 38px; width: auto; padding: 8px 10px 8px 14px; border: 1px solid rgb(255 255 255 / .7); border-radius: 999px; background: rgb(23 32 50 / .76); color: #fff; font-size: .78rem; font-weight: 800; box-shadow: 0 10px 28px rgb(23 32 50 / .2); backdrop-filter: blur(10px); z-index: 8; }
.new-messages-button:hover { background: rgb(23 32 50 / .9); }
.new-messages-button svg { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: rgb(255 255 255 / .13); }
.message-bubble { align-self: flex-start; max-width: min(70%, 620px); padding: 10px 12px; border-radius: 8px; background: #fff; box-shadow: 0 6px 18px rgb(38 52 78 / .07); }
.message-bubble.is-own { align-self: flex-end; background: #2f80ed; color: #fff; }
.message-bubble strong { display: block; margin-bottom: 4px; font-size: .78rem; opacity: .8; }
.message-bubble p { line-height: 1.45; white-space: pre-wrap; }
.message-bubble time { display: block; margin-top: 5px; font-size: .72rem; opacity: .72; text-align: right; }
.message-attachment { display: grid; gap: 8px; min-width: min(280px, 56vw); }
.attachment-name { overflow: hidden; font-size: .84rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.message-attachment img, .message-attachment video { display: block; width: min(420px, 58vw); max-height: 320px; border-radius: 8px; object-fit: contain; background: #111926; }
.message-attachment audio { width: min(320px, 58vw); height: 40px; }
.attachment-download { min-height: 36px; padding: 0 12px; border-radius: 8px; background: #e8f2ff; color: #1769aa; font-weight: 800; }
.message-bubble.is-own .attachment-download { background: rgb(255 255 255 / .2); color: #fff; }
.connection-log { align-self: stretch; margin-top: auto; border: 1px solid #dce5ef; border-radius: 8px; background: rgb(255 255 255 / .7); }
.connection-log summary { padding: 8px 10px; color: #697789; cursor: pointer; font-size: .75rem; font-weight: 800; }
.log { max-height: 120px; margin: 0; padding: 0 10px 10px; overflow: auto; color: #526174; font: .7rem/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.composer { position: relative; display: flex; align-items: center; gap: 9px; padding: 14px 20px; border-top: 1px solid #dce5ef; background: #fff; }
.composer input { border-radius: 8px; background: #f7f9fc; }
.composer button { flex: 0 0 auto; background: #2f80ed; color: #fff; }
.composer .voice-message-button { display: grid; grid-template-columns: auto auto; place-content: center; gap: 5px; width: 44px; transition: width .18s ease, background-color .18s ease; }
.composer .voice-message-button.is-recording { width: 78px; background: #d94848; animation: voicePulse 1.2s ease-in-out infinite; }
.voice-message-button span { font-size: .72rem; font-weight: 900; }
.attachment-button { position: relative; display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; overflow: hidden; border-radius: 8px; background: #2f80ed; color: #fff; cursor: pointer; font-size: 1.4rem; }
.attachment-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.secret-output { position: absolute; right: 20px; bottom: 70px; max-width: 70%; padding: 10px; border-radius: 8px; background: #fff7e6; color: #7b5412; font-size: .7rem; white-space: pre-wrap; }
.security-list { display: grid; gap: 8px; }
.security-list span { min-height: 36px; padding: 0 10px; border-radius: 8px; background: #e4f8f0; color: #164437; font-size: .82rem; font-weight: 800; }
.technical-value { overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; }

@keyframes voicePulse { 50% { box-shadow: 0 0 0 6px rgb(217 72 72 / .14); } }

.incoming-call-backdrop { position: fixed; left: 18px; bottom: 18px; z-index: 50; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.incoming-call-modal { position: relative; isolation: isolate; display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px 14px; width: 100%; padding: 14px; overflow: hidden; border-radius: 8px; background: #fff; color: #172032; box-shadow: 0 18px 55px rgb(0 0 0 / .24); pointer-events: auto; }
.incoming-call-modal::after { position: absolute; z-index: 2; inset: 3px; border: 3px solid transparent; border-radius: 5px; box-shadow: inset 0 0 0 0 rgb(22 160 133 / 0); content: ""; pointer-events: none; animation: incomingEdgePulse 1.15s ease-in-out infinite; }
@keyframes incomingEdgePulse {
  0%, 100% { border-color: rgb(22 160 133 / .18); box-shadow: inset 0 0 8px rgb(22 160 133 / .08); }
  50% { border-color: rgb(22 160 133 / .95); box-shadow: inset 0 0 22px rgb(22 160 133 / .48); }
}
.incoming-call-avatar { display: grid; place-items: center; grid-row: span 3; width: 56px; height: 56px; border-radius: 50%; background: #16a085; color: #fff; font-size: 1.35rem; font-weight: 900; }
.incoming-call-modal p { color: #697789; font-size: .82rem; font-weight: 800; }
.incoming-call-modal h2 { min-width: 0; overflow: hidden; font-size: 1.12rem; text-overflow: ellipsis; white-space: nowrap; }
.incoming-call-modal span { min-width: 0; overflow: hidden; color: #5c6878; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.incoming-call-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 4px; }
.incoming-call-actions button { min-height: 46px; border-radius: 8px; color: #fff; font-weight: 900; }
.decline-call { background: #d94848; }
.accept-call { background: #16a085; }

.permission-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgb(23 32 50 / .48); backdrop-filter: blur(8px); }
.permission-modal { display: grid; justify-items: center; width: min(440px, 100%); padding: 28px; border-radius: 8px; background: #fff; color: #172032; text-align: center; box-shadow: 0 24px 70px rgb(0 0 0 / .24); }
.permission-camera { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 14px; border-radius: 18px; background: #e8f2ff; color: #2f80ed; }
.permission-camera svg { width: 30px; height: 30px; }
.permission-modal > p:first-of-type { color: #2f80ed; font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.permission-modal h2 { margin-top: 5px; font-size: 1.35rem; }
.permission-modal > span { margin-top: 8px; color: #697789; font-size: .9rem; line-height: 1.5; }
.invite-modal input { margin-top: 18px; font-size: .8rem; }
.permission-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 22px; }
.permission-actions button { min-height: 44px; border-radius: 8px; font-weight: 900; }
.permission-actions .secondary { border: 1px solid #d7dfeb; background: #fff; color: #536174; }
.notify-button { width: 100%; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #e8f2ff; color: #1769aa; font-weight: 800; }

@media (max-width: 1220px) { .messenger-shell { grid-template-columns: 64px 300px minmax(0, 1fr); } .details-pane { display: none; } }
@media (max-width: 860px) {
  body { overflow: auto; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { gap: 12px; padding: 34px 24px 12px; }
  .auth-visual h1 { font-size: 3rem; }
  .auth-visual p { font-size: 1rem; }
  .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
  .auth-panel { align-self: start; margin: 20px auto 34px; }
  .messenger-shell { grid-template-columns: 58px minmax(0, 1fr); }
  .dialogs-pane { display: none; }
  .chat-header { padding: 12px; }
  .chat-header h1 { font-size: 1.05rem; }
  .chat-header p { font-size: .72rem; }
  .header-actions .call-start { width: 44px; padding: 0; font-size: 0; }
  .header-actions .call-start svg { width: 20px; }
  .call-stage { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; padding: 8px; gap: 8px; }
  .video-tile { min-height: 0; }
  .message-bubble { max-width: 86%; }
  .incoming-call-backdrop { left: 10px; bottom: 10px; width: calc(100vw - 20px); }
}
@media (max-width: 520px) {
  .messenger-shell { grid-template-columns: 1fr; }
  .rail { position: fixed; right: 8px; bottom: 8px; left: 8px; z-index: 40; flex-direction: row; justify-content: center; height: 58px; padding: 7px; border-radius: 10px; box-shadow: 0 12px 34px rgb(0 0 0 / .28); }
  .app-logo { width: 40px; height: 40px; margin: 0 auto 0 0; }
  .rail button { width: 40px; height: 40px; }
  .rail-bottom { margin: 0 0 0 auto; }
  .chat-workspace { height: 100vh; padding-bottom: 66px; grid-template-rows: auto minmax(250px, 42vh) auto minmax(0, 1fr) auto; }
  .call-controls { padding: 8px; }
  .call-controls button { width: 40px; height: 40px; }
  .call-controls .hangup { width: 40px; padding: 0; font-size: 0; }
  .call-controls .hangup svg { width: 20px; height: 20px; }
  .composer { padding: 9px; }
  .composer > input { min-width: 0; }
  .attachment-button, .composer button { width: 40px; height: 40px; }
}

/* Previous dark editorial experiment kept disabled for reference.
2026 editorial redesign: dark, typographic, intentionally high contrast. */
/*
:root {
  --ink: #0a0a0a;
  --paper: #f2f0ea;
  --acid: #d7ff3f;
  --violet: #7357ff;
  --line-dark: rgb(255 255 255 / .13);
  --line-light: rgb(10 10 10 / .14);
  color: #121212;
  background: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, system-ui, sans-serif;
}
body { background: var(--ink); }
button, input, select, .auth-panel, .advanced-settings, .mode-switch, .video-tile,
.message-bubble, .connection-log, .incoming-call-modal, .permission-modal,
.attachment-button, .security-list span { border-radius: 0; }
button { transition: transform .18s ease, background-color .18s ease, color .18s ease; }
button:hover:not(:disabled) { transform: translateY(-2px); }
input, select { min-height: 48px; border: 1px solid var(--line-light); border-radius: 0; background: transparent; }
input:focus, select:focus { border-color: #111; box-shadow: inset 0 -2px #111; }

.auth-page {
  isolation: isolate;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .55fr);
  background: var(--ink);
  color: #fff;
}
.auth-page::before {
  position: absolute; inset: 0 34% 0 0; z-index: -1; content: "";
  background:
    linear-gradient(90deg, transparent 49.8%, rgb(255 255 255 / .08) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgb(255 255 255 / .08) 50%, transparent 50.2%),
    radial-gradient(circle at 72% 32%, var(--violet) 0 12%, transparent 12.3%),
    radial-gradient(circle at 74% 35%, transparent 0 18%, rgb(215 255 63 / .9) 18.2% 18.8%, transparent 19%),
    #0a0a0a;
  background-size: 86px 86px, 86px 86px, auto, auto, auto;
  mask-image: linear-gradient(90deg, #000 65%, transparent 100%);
}
.auth-visual { position: relative; justify-content: flex-end; gap: 20px; min-height: 100vh; padding: 5vw; }
.auth-kicker { position: absolute; top: 36px; right: 5vw; left: 5vw; display: flex; justify-content: space-between; color: #aaa; font-size: .7rem; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }
.brand-mark { width: 72px; height: 72px; border: 1px solid var(--acid); border-radius: 50%; background: transparent; color: var(--acid); }
.auth-visual h1 { max-width: 900px; font-size: clamp(4.8rem, 11vw, 10.5rem); font-weight: 950; letter-spacing: -.085em; line-height: .72; text-transform: uppercase; }
.auth-visual h1 span { display: block; color: var(--acid); }
.auth-visual p { max-width: 540px; color: #bbb; font-size: clamp(1rem, 1.5vw, 1.35rem); }
.trust-row span { min-height: 34px; padding: 0; margin-right: 18px; border-bottom: 1px solid #555; border-radius: 0; background: transparent; color: #ddd; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.auth-panel { align-self: stretch; align-content: center; width: 100%; margin: 0; padding: clamp(32px, 5vw, 76px); border: 0; border-left: 1px solid var(--line-dark); background: var(--paper); color: #111; box-shadow: none; }
.auth-panel::before { content: "Welcome back"; margin-bottom: 18px; font-size: clamp(2.2rem, 4vw, 4rem); font-weight: 950; letter-spacing: -.06em; line-height: .9; text-transform: uppercase; }
.mode-switch { gap: 0; padding: 0; border-bottom: 1px solid #aaa; border-radius: 0; background: transparent; }
.mode-switch button { border-radius: 0; background: transparent !important; box-shadow: none !important; }
.mode-switch button.is-active { border-bottom: 3px solid #111; }
.auth-panel label { color: #333; letter-spacing: .05em; text-transform: uppercase; }
.primary-button, .new-group-button, .call-start { min-height: 50px; border-radius: 0; background: var(--acid); color: #111; letter-spacing: .04em; text-transform: uppercase; }
.advanced-settings { border-color: var(--line-light); border-radius: 0; background: transparent; }

.messenger-shell { grid-template-columns: 76px 326px minmax(0, 1fr) 292px; background: var(--paper); }
.rail { gap: 18px; padding: 18px 12px; border-right: 1px solid var(--line-dark); background: var(--ink); }
.app-logo { width: 48px; height: 48px; border: 1px solid var(--acid); border-radius: 50%; background: transparent; color: var(--acid); }
.rail button { border-radius: 50%; color: #858585; }
.rail button.is-active, .rail button:hover:not(:disabled) { background: var(--acid); color: #111; }
.dialogs-pane, .details-pane { gap: 20px; padding: 20px; background: var(--paper); }
.dialogs-pane { border-color: var(--line-light); }
.details-pane { border-color: var(--line-light); background: #e6e3dc; }
.profile-avatar, .dialog-avatar, .big-avatar { background: var(--violet); color: #fff; }
.profile-card i { background: var(--acid); box-shadow: 0 0 0 3px rgb(215 255 63 / .25); }
.search-box { padding: 0 10px; border-color: var(--line-light); border-radius: 0; background: transparent; }
.dialog-item { min-height: 70px; padding: 10px 4px; border-bottom: 1px solid var(--line-light); border-radius: 0; background: transparent; }
.dialog-item.is-active, .dialog-item:hover { padding-left: 10px; background: var(--acid); }
.contacts-box { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-light); }
.chat-workspace { background: #d9d6ce; }
.chat-header { padding: 18px 24px; border-color: var(--line-light); background: rgb(242 240 234 / .92); backdrop-filter: blur(14px); }
.chat-header h1 { font-size: clamp(1.4rem, 2.3vw, 2.4rem); font-weight: 950; letter-spacing: -.05em; text-transform: uppercase; }
.call-stage { gap: 1px; padding: 0; background: #353535; }
.video-tile { border-radius: 0; background: #101010; }
.video-tile::after { position: absolute; inset: 10px; border: 1px solid rgb(255 255 255 / .1); content: ""; pointer-events: none; }
.video-tile > span, .video-tile > small { border-radius: 0; background: var(--acid); color: #111; font-weight: 900; text-transform: uppercase; }
.video-tile > small { background: #fff; color: #111; }
.call-controls { gap: 12px; padding: 14px; border-color: var(--line-dark); background: var(--ink); }
.call-controls button { border: 1px solid #444; border-radius: 50%; background: transparent; color: #fff; }
.call-controls .call-start { background: var(--acid); color: #111; }
.call-controls .control-muted.is-active { background: #fff; color: #111; }
.call-controls .hangup { border-radius: 0; background: #ff4b4b; }
.messages-area { background-image: linear-gradient(var(--line-light) 1px, transparent 1px), linear-gradient(90deg, var(--line-light) 1px, transparent 1px); background-size: 32px 32px; }
.message-bubble { border: 1px solid var(--line-light); border-radius: 0; background: var(--paper); box-shadow: 8px 8px 0 rgb(10 10 10 / .08); }
.message-bubble.is-own { background: var(--violet); color: #fff; }
.composer { border-color: var(--line-light); background: var(--paper); }
.composer input { border: 0; border-bottom: 1px solid #888; border-radius: 0; background: transparent; }
.composer button, .attachment-button { border-radius: 50%; background: #111; color: var(--acid); }
.security-list span { border: 1px solid var(--line-light); background: transparent; color: #111; }
.notify-button { border-bottom: 2px solid #111; border-radius: 0; background: transparent; color: #111; }
.permission-backdrop { background: rgb(10 10 10 / .76); }
.permission-modal, .incoming-call-modal { border: 1px solid #111; background: var(--paper); box-shadow: 14px 14px 0 var(--violet); }
.permission-camera, .incoming-call-avatar { border-radius: 50%; background: var(--acid); color: #111; }

@media (max-width: 1220px) { .messenger-shell { grid-template-columns: 66px 290px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-page::before { inset: 0; opacity: .6; }
  .auth-visual { justify-content: flex-end; min-height: 48vh; padding: 70px 24px 28px; }
  .auth-visual h1 { font-size: clamp(4rem, 18vw, 7rem); }
  .auth-panel { min-height: 52vh; border-top: 1px solid var(--line-dark); border-left: 0; }
}
@media (max-width: 520px) {
  .rail { border: 1px solid #333; border-radius: 999px; background: rgb(10 10 10 / .94); }
  .app-logo, .rail button { width: 40px; height: 40px; }
  .chat-header h1 { font-size: 1.1rem; }
  .call-controls { gap: 7px; }
}
*/

/* Light Muzli-inspired motion layer. */
@keyframes authGlowDrift {
  0%, 100% { background-position: 0% 0%, 100% 70%; }
  50% { background-position: 12% 8%, 88% 58%; }
}
@keyframes authReveal {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0); box-shadow: 0 12px 30px rgb(47 128 237 / .18); }
  50% { transform: translateY(-8px) rotate(-3deg); box-shadow: 0 20px 42px rgb(47 128 237 / .3); }
}
@keyframes trustPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes shellReveal {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes orbitOne { from { transform: rotate(0deg) translateX(118px) rotate(0deg); } to { transform: rotate(360deg) translateX(118px) rotate(-360deg); } }
@keyframes orbitTwo { from { transform: rotate(180deg) translateX(158px) rotate(-180deg); } to { transform: rotate(540deg) translateX(158px) rotate(-540deg); } }
@keyframes messageFlyOne { 0%, 12% { opacity: 0; transform: translate(-18px, 15px) scale(.92); } 22%, 70% { opacity: 1; transform: translate(0, 0) scale(1); } 82%, 100% { opacity: 0; transform: translate(18px, -12px) scale(.96); } }
@keyframes messageFlyTwo { 0%, 32% { opacity: 0; transform: translate(18px, 15px) scale(.92); } 43%, 82% { opacity: 1; transform: translate(0, 0) scale(1); } 94%, 100% { opacity: 0; transform: translate(-12px, -10px) scale(.96); } }
@keyframes signalWave { 0%, 100% { height: 7px; } 50% { height: 26px; } }

.auth-page {
  background:
    radial-gradient(circle at 18% 18%, rgb(94 158 255 / .28), transparent 34%),
    radial-gradient(circle at 72% 72%, rgb(57 211 180 / .2), transparent 32%),
    #edf1f7;
  background-size: 125% 125%, 125% 125%, auto;
  animation: authGlowDrift 13s ease-in-out infinite;
}
.messenger-motion { position: absolute; top: 16%; right: 32%; width: 330px; height: 330px; border: 1px solid rgb(47 128 237 / .12); border-radius: 50%; pointer-events: none; }
.messenger-motion::before, .messenger-motion::after { position: absolute; inset: 50%; width: 9px; height: 9px; border-radius: 50%; background: #2f80ed; content: ""; box-shadow: 0 0 0 12px rgb(47 128 237 / .09); }
.messenger-motion::after { width: 180px; height: 180px; margin: -86px; border: 1px dashed rgb(47 128 237 / .2); background: transparent; box-shadow: none; }
.motion-orbit { position: absolute; top: calc(50% - 25px); left: calc(50% - 25px); display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: #fff; color: #2f80ed; box-shadow: 0 12px 30px rgb(35 63 104 / .16); }
.orbit-one { animation: orbitOne 11s linear infinite; }
.orbit-two { animation: orbitTwo 15s linear infinite; }
.motion-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #7357ff; color: #fff; font-size: .8rem; font-weight: 900; }
.motion-orbit i { position: absolute; right: -22px; top: -7px; padding: 2px 7px 5px; border-radius: 10px; background: #16a085; color: #fff; font-style: normal; letter-spacing: 2px; }
.motion-message { position: absolute; z-index: 2; padding: 11px 15px; border-radius: 15px 15px 15px 4px; background: #fff; color: #263247; box-shadow: 0 12px 30px rgb(35 63 104 / .12); font-size: .82rem; font-weight: 800; }
.message-one { top: 98px; left: -35px; animation: messageFlyOne 6s ease-in-out infinite; }
.message-two { right: -28px; bottom: 78px; border-radius: 15px 15px 4px; background: #2f80ed; color: #fff; animation: messageFlyTwo 6s ease-in-out infinite; }
.motion-message b { color: #baf4df; }
.motion-signal { position: absolute; left: 50%; bottom: 55px; display: flex; align-items: center; gap: 4px; height: 30px; transform: translateX(-50%); }
.motion-signal span { width: 4px; height: 8px; border-radius: 4px; background: #16a085; animation: signalWave 1.1s ease-in-out infinite; }
.motion-signal span:nth-child(2) { animation-delay: -.8s; }.motion-signal span:nth-child(3) { animation-delay: -.55s; }.motion-signal span:nth-child(4) { animation-delay: -.3s; }
.auth-fields { display: grid; gap: 16px; }
.registration-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.registration-methods button { min-height: 38px; border: 1px solid #d7dfeb; border-radius: 8px; background: #fff; color: #667386; font-weight: 800; }
.registration-methods button.is-active { border-color: #2f80ed; background: #eaf3ff; color: #1769aa; }
.registration-code-row { display: grid; gap: 8px; }
.registration-hint { padding: 9px 11px; border-radius: 8px; background: #e6f7f1; color: #087f5b; font-size: .78rem; line-height: 1.4; }
.error-text.registration-success { padding: 9px 11px; border-radius: 8px; background: #e6f7f1; color: #087f5b; }

/* Капча: галочка «Вы человек?», за ней сетка 4x2 фигур. Показывается перед
   входом и перед выдачей кода регистрации. */
.captcha-field { display: grid; gap: 10px; padding: 12px; border: 1px solid #dde5f0; border-radius: 8px; background: #f7f9fc; }
.captcha-field.is-loading { opacity: .6; }
.captcha-gate { display: flex; align-items: center; gap: 10px; color: #445267; font-size: .86rem; font-weight: 700; cursor: pointer; }
/* Сброс общего оформления `input`: оно рассчитано на текстовые поля и
   превратило бы флажок в прямоугольник с рамкой и отступами. */
.captcha-gate-box { flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; appearance: checkbox; accent-color: #2f80ed; cursor: pointer; }
.captcha-puzzle { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid #e4eaf3; }
.captcha-header { display: flex; align-items: center; gap: 12px; }
.captcha-prompt-tile { flex: none; width: 60px; height: 60px; border: 1px solid #c9d7ea; border-radius: 8px; background: #fff; }
.captcha-prompt-tile canvas { display: block; width: 100%; height: 100%; }
.captcha-prompt { color: #445267; font-size: .82rem; font-weight: 700; line-height: 1.35; }
.captcha-submit { min-height: 38px; border: 1px solid #2f80ed; border-radius: 8px; background: #eaf3ff; color: #1769aa; font-weight: 800; }
.captcha-submit:disabled { border-color: #d7dfeb; background: #fff; color: #9aa7b8; }
.captcha-field.is-solved .captcha-gate { color: #087f5b; }
.captcha-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.captcha-tile { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid #d7dfeb; border-radius: 8px; background: #fff; }
.captcha-tile canvas { display: block; width: 100%; height: 100%; }
.captcha-tile:hover { border-color: #9dbdea; }
.captcha-tile.is-selected { border-color: #2f80ed; box-shadow: inset 0 0 0 2px #2f80ed; background: #eaf3ff; }
.captcha-status { color: #667386; font-size: .76rem; line-height: 1.35; }
.captcha-status:empty { display: none; }
@media (max-width: 420px) { .captcha-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
.auth-visual > * { animation: authReveal .72s cubic-bezier(.2,.75,.25,1) both; }
.auth-visual .brand-mark { animation: authReveal .72s cubic-bezier(.2,.75,.25,1) both, logoFloat 4.8s ease-in-out .8s infinite; }
.auth-visual h1 { animation-delay: .1s; }
.auth-visual > p { animation-delay: .18s; }
.auth-visual .trust-row { animation-delay: .26s; }
.trust-row span { transition: transform .25s ease, box-shadow .25s ease; }
.trust-row span:nth-child(2) { animation: trustPulse 3.2s ease-in-out .6s infinite; }
.trust-row span:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgb(22 160 133 / .12); }
.auth-panel { animation: authReveal .8s cubic-bezier(.2,.75,.25,1) .12s both; }
.primary-button, .new-group-button, .call-start, .notify-button { transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.primary-button:hover:not(:disabled), .new-group-button:hover:not(:disabled), .call-start:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgb(47 128 237 / .23); filter: saturate(1.08); }

.messenger-shell:not(.hidden) { animation: shellReveal .5s ease-out both; }
.dialogs-pane, .details-pane, .chat-header, .composer { background-color: rgb(255 255 255 / .9); backdrop-filter: blur(16px); }
.dialog-item { transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease; }
.dialog-item:hover { transform: translateX(4px); box-shadow: 0 10px 24px rgb(39 55 82 / .08); }
.video-tile { transition: transform .25s ease, box-shadow .25s ease; }
.video-tile:hover { transform: translateY(-3px); box-shadow: 0 16px 35px rgb(25 36 55 / .18); }
.message-bubble { animation: authReveal .35s ease-out both; transition: transform .2s ease, box-shadow .2s ease; }
.message-bubble:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgb(38 52 78 / .12); }
.rail button, .call-controls button, .composer button, .attachment-button { transition: transform .18s ease, background-color .18s ease, color .18s ease; }
.rail button:hover:not(:disabled), .call-controls button:hover:not(:disabled), .composer button:hover:not(:disabled), .attachment-button:hover { transform: translateY(-3px) scale(1.04); }
.incoming-call-modal, .permission-modal { animation: authReveal .35s cubic-bezier(.2,.75,.25,1) both; }

@media (prefers-reduced-motion: reduce) {
  .incoming-call-modal::after { animation-duration: 2.4s; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media (max-width: 1100px) { .messenger-motion { right: 30%; transform: scale(.72); } }
@media (max-width: 860px) { .messenger-motion { display: none; } }
