:root {
    --primary: #00AFF0;
    --primary-dark: #0091D5;
    --bg-dark: #0D1117;
    --bg-dark-opacity: rgba(13, 17, 23, 0.7);
    --bg-card: #161B22;
    --bg-input: #21262D;
    --text-primary: #F0F6FC;
    --text-color: #F0F6FC;
    --text-secondary: #8B949E;
    --text-muted: #6E7681;
    --border-color: #30363D;
    --online: #3FB950;
    --offline: #6E7681;
    --message-sent: #2a4475;
    --message-received: #21262D;
    --danger: #F85149;
    --success: #238636;
    --link: #ffc65b;
    --link-hover: #79ff5b;
    --unread: #4b7e47;
    --tab-active: #2a4475;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

#app {
    width: 100%;
    height: 100%;
    background-color: var(--bg-card);
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
}

.under {
    margin-top: 10px;
}

.link {
    display: inline-block;
    background: transparent;
    padding: 16px 26px;
    color: var(--link);
    cursor: pointer;
    transition-duration: 100ms;
    border-radius: 12px;
    font-weight: bold;
    opacity: 0.8;
}

.link:hover {
    background: #30363D;
    opacity: 1;
}

.left {
    text-align: left;
}

.center {
    text-align: center;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.header {
    display: flex;
    align-items: center;
    padding: 18px 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    min-height: 64px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    flex-grow: 1;
    text-align: center;
    letter-spacing: -0.3px;
}

.sub-title {
    transition-duration: 200ms;
    padding-top: 5px;
    display: inline-block;
    opacity: 0.5;
    cursor: default;
}

.sub-title.copy {
    opacity: 1;
    color: var(--link);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn:active {
    transform: scale(0.95);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: 0 20px;
}

#auth-screen, #create-pixel, #add-contact-screen, #profile-screen, #create-group-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
    height: 100%;
}

#create-pixel {
    overflow-y: auto;
}

.logo {
    font-size: 56px;
    color: var(--primary);
    margin-bottom: 24px;
    text-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.logo img {
    width: 160px;
    border-radius: 20px;
}

.logo-text {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 48px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 16px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    resize: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 175, 240, 0.2);
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.other-btn {
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.other-btn:hover {
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.4);
}

.other-btn:active {

}

.other-btn:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.answer-preview {
    display: flex;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.close-btn {
    display: flex;
    align-content: center;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    padding: 6px;
}

.bottom-center {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.bottom-right {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.contact-list {
    flex-grow: 1;
    overflow-y: auto;
}

.contact {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    user-select: none;
}

.contact:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.profile-avatar-image {
    min-width: 152px;
    min-height: 152px;
    width: 152px;
    height: 152px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    cursor: pointer;
    object-fit: cover;
}

.profile-avatar {
    min-width: 152px;
    min-height: 152px;
    width: 152px;
    height: 152px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 50px;
    color: white;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    cursor: pointer;
}

.avatar {
    min-width: 52px;
    min-height: 52px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
    margin-right: 16px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /*overflow: hidden;*/
}

.avatar-image {
    min-width: 52px;
    min-height: 52px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    position: relative;
    object-fit: cover;
}

.stranger .avatar {
    background: linear-gradient(135deg, #444, #666); /* серый градиент вместо цветного */
    color: var(--text-muted);
}

.stranger .contact-name::after {
    content: " (НЕИЗВЕСТНЫЙ)";
    opacity: 0.7;
    font-size: 14px;
}

.stranger .contact-status {
    color: var(--text-muted);
    font-style: italic;
}

.blocked .avatar {
    background: linear-gradient(135deg, #444, #666); /* серый градиент вместо цветного */
    color: var(--text-muted);
}

.blocked .contact-name::after {
    content: " (ЗАБЛОКИРОВАН)";
    opacity: 0.7;
    font-size: 14px;
}

.blocked .contact-status {
    color: var(--text-muted);
    font-style: italic;
}

.status {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    bottom: 2px;
    right: 2px;
}

.status.online {
    background-color: var(--online);
}

.status.offline {
    background-color: var(--offline);
}

.contact-info {
    flex-grow: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 16px;
}

.contact-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.unread-badge {
    flex-shrink: 0;
    background-color: var(--unread);
    color: white;
    font-size: 16px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 18px;
    margin-left: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    min-height: 64px;
}

.chat-contact {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.chat-avatar {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 14px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.chat-info {
    flex-grow: 1;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 16px;
}

.chat-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-status.in-chat {
    color: var(--primary);
}

.chat-status.typing {
    color: var(--link);
}

.chat-status.voice {
    color: var(--link-hover);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 16px;
    display: flex;
    animation: messageAppear 0.3s ease;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
}

.message-content {
    padding: 14px 18px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid #00000000;
    transition: border-color 0.3s ease-out;
}

.message-content .message-code {
    display: inline-block;
    background: var(--bg-dark);
    color: var(--link);
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Consolas, monospace;
    font-size: 0.7em;
    overflow: auto;
    max-height: 500px;
    max-width: 70vw;
    padding: 12px;
    border-radius: 12px;
    white-space: break-spaces;
}

.message-content video {
    position: relative;
}

.message.received .message-content {
    background-color: var(--message-received);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-color);
}

.message.sent .message-content {
    background: linear-gradient(135deg, var(--message-sent), #1F5FAB);
    border-bottom-right-radius: 6px;
    color: white;
}

.message-info {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

.message-sender {
    font-size: 11px;
    text-align: left;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.read-status {
    opacity: 0.6;
    font-size: 11px;
}

.message.received .read-status {
    display: none;
}

.message.highlight .message-content {
    border-color: var(--link);
}

.message-font-bigest-x {
    font-size: 40px;
}

.message-font-bigest {
    font-size: 25px;
}

.message-font-big {
    font-size: 20px;
}

.message-link {
    background: var(--border-color);
    display: inline-block;
    max-width: 300px;
    word-break: break-all;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    border: none;
    border-radius: 4px;
    padding: 2px 8px 2px 24px;
    margin: 0 2px;
    font-size: 0.9em;
    line-height: 1.2;
    text-decoration: none;
    position: relative;
    cursor: pointer;
}

.message-link.secure {
    color: white;
}

.message-link.insecure {
    color: var(--offline);
}

.message-link.secure::before {
    content: "🔗";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

.message-link.insecure::before {
    content: "⚠️";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

.who-answer {
    font-size: small;
    display: block;
    margin-bottom: 4px;
}

.audio-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
    max-width: 280px;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 16px;
    padding: 6px 10px;
    cursor: pointer;
    transition-duration: 200ms;
}

.audio-player.playing {
    background: rgba(0, 0, 0, 0.1);
}

.message-content .image {
    max-width: 250px;
    max-height: 250px;
    cursor: pointer;
    border-radius: 14px;
    border: 1px solid var(--bg-dark);
    position: relative;
}

.flex {
    display: flex;
}

.play-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-size: 14px;
    user-select: none;
}

.timeline {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.timeline-fill {
    height: 100%;
    background: currentColor;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-duration {
    font-size: 12px;
    opacity: 0.8;
    min-width: 36px;
    text-align: right;
}

.info-panel {
    display: none;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--link);
    border-bottom: 1px solid var(--link);
    background-color: var(--bg-card);
    scrollbar-width: none;
    user-select: none;
}

.info-panel.active {
    display: block;
}

.message-content .play-btn-span {
    background: var(--bg-dark);
    border: 2px solid var(--text-secondary);
    color: var(--text-primary);
    position: absolute;
    left: 50%;
    top: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 46px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}


.message-content .duration-span {
    position: absolute;
    bottom: 42px;
    right: 26px;
    background: var(--border-color);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 16px;
    font-family: monospace;
}

.emoji-panel {
    display: flex;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    scrollbar-width: none;
    user-select: none;
    scroll-behavior: smooth;
}

.emoji-panel::-webkit-scrollbar {
    display: none;
}

.emoji {
    font-size: 18px;
    margin-right: 6px;
    margin-left: 6px;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.emoji:hover {
    transform: scale(1.2);
}

.input-area {
    display: flex;
    padding: 16px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    align-items: end;
}

.fill {
    width: 100%;
}

.message-input {
    min-width: auto;
    word-wrap: break-word;
    flex-grow: 1;
    padding: 14px 18px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    resize: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition-duration: 200ms;
    overflow: auto;
    white-space: pre-wrap;
}

.message-input:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
    pointer-events: none; /* чтобы не мешал клику */
    opacity: 1;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 175, 240, 0.15);
}

.message-input:focus::before {
    opacity: 0.5;
}

.auto-resize {
    min-height: 50px;
    max-height: 600px;
}

.send-button {
    margin-left: 12px;
    min-width: 48px;
    min-height: 48px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.send-button.record {
    background: linear-gradient(135deg, var(--unread), var(--success));
    box-shadow: 0 4px 12px rgba(88, 240, 0, 0.3);
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.4);
}

.send-button:active {
    transform: scale(0.95);
    display: inline-flex;
}

.send-button:disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    display: none;
}

.message-input.recording {
    background: var(--success);
    color: var(--text-primary);
    border-color: var(--link-hover);
    text-align: center;
    caret-color: transparent;
}

.spinner {
    animation: spin 1s linear infinite;
}

#alert-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20000;
}

.alert-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.69);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    /* Делаем overlay flex-контейнером */
    display: flex;
    justify-content: center;
    align-items: center;
}

.alert-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.alert-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.4;
    /* Убираем position и z-index — они не нужны внутри flex */
}

.alert-box.active {
    opacity: 1;
    transform: scale(1);
}

.alert-message {
    white-space: pre-line; /* сохраняет переносы \n, но не лишние пробелы */
}

.alert-button {
    margin-top: 40px;
    padding: 14px 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.alert-button:active {
    transform: translateY(0);
}

.group-list {
    flex-grow: 1;
    overflow-y: auto;
}

.group-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.group-avatar {
    min-width: 52px;
    min-height: 52px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
    margin-right: 16px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.group-info {
    flex-grow: 1;
    min-width: 0;
}

.group-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 16px;
}

.group-members {
    font-size: 14px;
    color: var(--text-secondary);
}

.group-unread-badge {
    flex-shrink: 0;
    background-color: var(--unread);
    color: white;
    font-size: 16px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 18px;
    margin-left: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tabs {
    display: flex;
    gap: 8px;
    flex-grow: 1;
    justify-content: center;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.tab.active {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.tab:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
}

#popup-menu-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    user-select: none;
}

.popup-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.69);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.popup-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-menu {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 220px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    z-index: 9100;
    display: flex;
    flex-direction: column;
}

.popup-menu.active {
    opacity: 1;
    transform: translateY(0);
}

.popup-menu-item {
    padding: 14px 28px;
    color: var(--text-primary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.popup-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.popup-menu-item.danger {
    color: var(--danger);
}

.popup-menu-item.warning {
    color: #D29922; /* жёлто-оранжевый, как GitHub warning */
}

.popup-menu-item.success {
    color: var(--success);
}

.popup-menu-item.muted {
    color: var(--text-muted);
    font-size: 14px;
}

.popup-menu-item.disabled {
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.5;
}

.popup-menu-item.with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.popup-menu-item.with-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.media-popup-menu {
    right: 16px;
    bottom: 72px; /* высота input-area + отступ */
    top: auto;
    left: auto;
}

.form-input-static {
    padding: 16px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
}

.radio-group {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.radio-item input[type="radio"] {
    display: none; /* прячем оригинальный radio */
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.radio-item:hover .radio-custom {
    border-color: var(--primary);
}

.radio-item input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
    background-color: var(--primary);
}

.radio-item input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

.radio-label-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.image-viewer-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.image-viewer-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    user-select: none;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.image-viewer-img.scaled {
    cursor: grab;
}

.image-viewer-img.scaled:active {
    cursor: grabbing;
}

.image-viewer-close {
    position: fixed;
    bottom: 20px;               /* внизу */
    left: 50%;                  /* по центру по горизонтали */
    transform: translateX(-50%); /* точное центрирование */
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    transition: all 0.2s ease;
    user-select: none;
}

.image-viewer-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.9);
}

/* Видео-вьювер: фон */
.video-viewer-bg {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-dark-opacity);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(80px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.video-viewer-bg.active {
    opacity: 1;
    pointer-events: all;
}

/* Контейнер видео */
.video-viewer-video-container {
    position: relative;
    /*width: 90%;*/
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Само видео */
.video-viewer-video {
    max-width: 90%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    outline: none;
    background: var(--bg-dark);
}

/* Панель управления — ТОЛСТАЯ и тач-дружелюбная */
.video-viewer-controls {
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
    background: var(--bg-input);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-viewer-play-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: 50%;
    padding: 0;
    opacity: 0.9;
    transition: opacity 0.2s, background 0.2s;
}

.video-viewer-play-btn:hover,
.video-viewer-play-btn:focus {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.video-viewer-play-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Таймлайн — высокий, с увеличенной зоной клика */
.video-viewer-timeline {
    flex: 1;
    height: 48px; /* зона клика — вся высота панели */
    position: relative;
    cursor: pointer;
}

/* Визуальный бар — внутри, тонкий, но красивый */
.video-viewer-timeline-bar {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    transform: translateY(-50%);
}

.video-viewer-timeline-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transform: translateY(-50%);
    transition: width 0.08s linear;
}

.video-viewer-duration {
    min-width: 52px;
    text-align: right;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: -0.5px;
}

/* Кнопка закрытия — внизу по центру (как просил) */
.video-viewer-close-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.2s ease;
    user-select: none;
    touch-action: manipulation;
}

.video-viewer-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.9);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    text-align: center;
    padding: 20px 10px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-subtext {
    font-size: 14px;
    opacity: 0.7;
}

.join-group-button {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 400px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.35);
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 100;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.join-group-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 175, 240, 0.45);
}

.join-group-button:active {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.join-group-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Стили для универсального динамического popup */
.dynamic-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.dynamic-popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.dynamic-popup {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.dynamic-popup.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.dynamic-popup-title {
    font-size: 20px;
    font-weight: 700;
    padding: 24px 24px 12px;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.dynamic-popup-description {
    padding: 12px 24px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.dynamic-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.dynamic-popup-buttons {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.dynamic-popup-button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.dynamic-popup-button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.dynamic-popup-button.cancel {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.dynamic-popup-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dynamic-popup-button:active {
    transform: translateY(0);
}

/* Стили для списка пользователей */
.invite-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.invite-user-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.user-checkbox {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.user-checkbox:checked + .checkbox-custom {
    background-color: var(--primary);
    border-color: var(--primary);
}

.user-checkbox:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 16px;
}

.user-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.loading-text, .error-text, .empty-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error-text {
    color: var(--danger);
}

.filler, .filler:hover {
    flex: 1;
    background: transparent;
    border-radius: 0;
    margin: 0;
    padding: 0;
    cursor: default;
    box-shadow: none;
}

/* Экран звонка */
.call-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 12px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    min-height: 72px;
}

.call-contact-info {
    flex-grow: 1;
    text-align: center;
}

.call-contact-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.call-timer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.call-self-video-container {
    width: 126px;
    height: 206px;
    position: absolute;
    top: 82px;
    right: 16px;
    z-index: 10;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
}

.call-self-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-main-video-container {
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: #000;
}

.call-main-video-container video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
}

.remote-video {
    transition-duration: 500ms;
    opacity: 0;
}

.remote-video.active {
    opacity: 1;
}

.call-no-video {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    color: var(--text-secondary);
    font-size: 16px;
    text-align: center;
    padding: 40px 20px;
    pointer-events: none;
    display: none;
}

.call-no-video.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 24px 16px 32px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.call-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-input);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}
.call-btn:hover {
    transform: scale(1.08);
    background: #30363D;
}
.call-btn:active {
    transform: scale(0.95);
}
.call-btn.hangup {
    background: linear-gradient(135deg, #F85149, #D9342B);
    box-shadow: 0 4px 12px rgba(248, 81, 73, 0.4);
}
.call-btn.hangup:hover {
    box-shadow: 0 6px 16px rgba(248, 81, 73, 0.5);
}
.call-btn.muted {
    color: var(--danger) !important;
}
.call-btn.muted svg {
    fill: var(--danger) !important;
}
.call-btn.video-off svg {
    color: var(--danger);
}
.call-btn video-off-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
}

.pulse-incoming {
    animation: pulse-incoming 1.8s ease-in-out infinite;
    background-color: rgba(174, 255, 128, 0.1); /* лёгкий фон */
    color: var(--link-hover) !important;
}

#incoming-call-banner {
    background-color: rgba(0, 0, 0, 0.69);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    display: none;
    border-radius: 14px;
    transition-duration: 200ms;
}

#incoming-call-banner .content {
    background: var(--bg-card);
    border: 2px solid var(--link-hover);
    border-radius: 14px;
    position: fixed;
    top: 22px;
    left: 22px;
    right: 22px;
    padding: 36px;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    pointer-events: auto;
    animation: pulse-incoming 1.8s ease-in-out infinite;
    flex: 1;
}

#incoming-call-banner .caller-name {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    display: flex;
    justify-content: space-between;
    padding-bottom: 30px;
}

#incoming-call-banner .btns {
    display: flex;
    gap: 22px;
}

#incoming-call-banner .btn {
    flex: 1;
    padding: 24px 8px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#incoming-call-banner .btn.accept {
    background: linear-gradient(135deg, var(--success), #1B702A);
    color: white;
}

#incoming-call-banner .btn.decline {
    background: linear-gradient(135deg, var(--danger), #D9342B);
    color: white;
}

#incoming-call-banner .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#incoming-call-banner .btn:active {
    transform: translateY(0);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 11000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    text-align: center;
    background: var(--bg-card);
    padding: 28px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 280px;
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.loading-bar {
    width: 100%;
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px;
    animation: loadingProgress 2.5s ease-in-out infinite;
}

#screen-label {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    z-index: 10000;
    pointer-events: none;
    text-align: center;
    color: var(--text-primary, #fff);
    background: var(--bg-card, rgba(0,0,0,0.7));
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    min-width: 160px;
    white-space: normal;
}

#screen-label.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

#camera-capture {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 9500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#camera-capture.active {
    pointer-events: auto;
    opacity: 1;
}

.camera-capture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    display: flex;
    flex-direction: column;
}

.camera-video-container {
    flex: 1;
    background: #000;
    overflow: hidden;
}

.camera-video {
    width: 100%;
    height: 100%;
    /*object-fit: cover;*/
    display: block;
    opacity: 0;
    transition-duration: 200ms;
}

.camera-video.active {
    opacity: 1;
}

.camera-controls {
    padding: 24px 16px 32px;
    background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.camera-action-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 360px;
}

.camera-btn {
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 52px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.camera-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.camera-btn.primary.recording {
    background: linear-gradient(135deg, var(--success), var(--unread));
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.4);
}

.camera-btn.primary.recording:hover {
    box-shadow: 0 6px 16px rgba(35, 134, 54, 0.5);
}

.camera-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.4);
}

.camera-btn.primary:active {
    transform: translateY(0);
}

.camera-bottom-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    justify-content: space-between;
}

.camera-btn.cancel,
.camera-btn.flip {
    width: 56px;
    height: 56px;
    max-width: 56px;
    max-height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.camera-btn.cancel:hover,
.camera-btn.flip:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.9);
}

.recording-timer {
    font-size: 16px;
    font-weight: 600;
    margin-right: 8px;
}

.answer-message {
    padding: 4px 12px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    display: none;
    cursor: pointer;
    transition-duration: 200ms;
}

.answer-message.active {
    display: block;
}

.answer-message.active:hover {
    background: rgba(255, 255, 255, 0.11);
}






/*////////////////////////////////////////////////////////*/





@keyframes loadingProgress {
    0%   { width: 0%; }
    50%  { width: 80%; }
    100% { width: 0%; transform: translateX(100%); }
}


@keyframes pulse-incoming {
    0%   { box-shadow: 0 0 0 0 rgba(149, 255, 106, 0.54); }        /* #FF5722 — оранжевый акцент */
    50%  { box-shadow: 0 0 0 12px rgba(133, 255, 34, 0); }
    100% { box-shadow: 0 0 0 0 rgba(82, 255, 34, 0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

@media (min-width: 900px) {
    body {
        max-width: 900px;
        margin: auto;
    }
}

@media (max-width: 500px) {
    .popup-menu-item {
        font-size: 12px;
    }

    .close-btn {
        font-size: 20px;
    }

    .info-panel {
        font-size: 11px;
        padding: 4px;
    }

    .call-no-video {
        font-size: 13px;
    }

    #screen-label {
        font-size: 12px;
    }

    #incoming-call-banner .caller-name {
        font-size: 12px;
    }

    #incoming-call-banner .btn {
        padding: 14px 8px;
        font-size: 13px;
    }

    #incoming-call-banner .content {
        top: 8px;
        left: 8px;
        right: 8px;
        padding: 16px;
    }

    .call-self-video-container {
        width: 102px;
        height: 162px;
        top: 90px;
        right: 12px;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .call-btn {
        width: 56px;
        height: 56px;
    }

    .call-contact-name {
        font-size: 16px;
    }
    .call-timer {
        font-size: 12px;
    }

    .dynamic-popup {
        width: 100%;
        max-width: 100%;
        margin: 5px;
        max-height: 100%;
        font-size: small;
    }

    .dynamic-popup-buttons {
        flex-direction: column;
    }

    .dynamic-popup-button {
        min-width: auto;
        width: 100%;
    }

    .invite-user-item {
        padding: 10px 8px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .user-name {
        font-size: 14px;
    }

    .message-input {
        font-size: 10px;
    }

    .header {
        padding: 5px 10px;
        min-height: 40px;
    }

    .tab {
        font-size: 11px;
        padding: 5px 12px;
    }

    .logo {
        font-size: 44px;
        margin-bottom: 20px;
    }

    .chat-name {
        font-size: 12px;
    }

    .chat-status {
        font-size: 10px;
    }

    .logo-text {
        font-size: 26px;
        margin-bottom: 36px;
    }
}

input, textarea, button {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}