:root {
--ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
--spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--primary: #1C1C1E;
--primary-dark: #000000;
--primary-glow: rgba(0, 0, 0, 0.18);
--on-primary: #FFFFFF;
--bg: #F2F2F7;
--surface: rgba(255, 255, 255, 0.72);
--glass: rgba(255, 255, 255, 0.5);
--glass-border: rgba(0, 0, 0, 0.08);
--chat-bg: #E9E9EE;
--text: #1C1C1E;
--text-secondary: #6E6E73;
--hover: rgba(0, 0, 0, 0.05);
--message-out: #D8D8DC;
--message-in: #FFFFFF;
--danger: #48484A;
--toggle-thumb: #FFFFFF;
--toggle-thumb-active: #FFFFFF;
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.15);
}

body,
.app {
    --glass-fill: color-mix(in srgb, var(--message-in) 66%, transparent);
    --glass-fill-strong: color-mix(in srgb, var(--message-in) 88%, transparent);
    --blur: blur(var(--blur-val, 22px)) saturate(1.5);
    --rim-conic: conic-gradient(from -18deg,
        rgba(255,255,255,.38) 0deg, rgba(255,255,255,.339) 22.5deg, rgba(255,255,255,.24) 45deg, rgba(255,255,255,.141) 67.5deg,
        rgba(255,255,255,.10) 90deg, rgba(255,255,255,.141) 112.5deg, rgba(255,255,255,.24) 135deg, rgba(255,255,255,.339) 157.5deg,
        rgba(255,255,255,.38) 180deg, rgba(255,255,255,.339) 202.5deg, rgba(255,255,255,.24) 225deg, rgba(255,255,255,.141) 247.5deg,
        rgba(255,255,255,.10) 270deg, rgba(255,255,255,.141) 292.5deg, rgba(255,255,255,.24) 315deg, rgba(255,255,255,.339) 337.5deg,
        rgba(255,255,255,.38) 360deg);
}

.dark-theme {
--primary: #F2F2F7;
--primary-dark: #FFFFFF;
--primary-glow: rgba(255, 255, 255, 0.16);
--on-primary: #000000;
--bg: #000000;
--surface: rgba(28, 28, 30, 0.72);
--glass: rgba(28, 28, 30, 0.5);
--glass-border: rgba(255, 255, 255, 0.10);
--chat-bg: #000000;
--text: #F2F2F7;
--text-secondary: #98989D;
--hover: rgba(255, 255, 255, 0.08);
--message-out: #2C2C2E;
--message-in: #1C1C1E;
--danger: #98989D;
--toggle-thumb: #FFFFFF;
--toggle-thumb-active: #000000;
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app {
    width: 100%;
    height: 100%;
    max-width: 480px;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    body {
        align-items: flex-start;
        justify-content: flex-start;
    }
}

@media (min-width: 769px) {
    .app {
        border-radius: 24px;
        margin: 20px;
        height: calc(100vh - 40px);
        max-height: 820px;
        box-shadow: var(--shadow-lg);
    }
}

.header {
    padding: calc(8px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0));
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    flex-shrink: 0;
    min-height: calc(42px * var(--ui-scale, 1));
    position: relative;
    z-index: 5;
}

#screenMessages > .header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    gap: calc(10px * var(--ui-scale, 1));
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}

#screenMessages > .header > * {
    pointer-events: auto;
}

#screenMessages > .header .icon-button {
    width: calc(44px * var(--ui-scale, 1));
    height: calc(44px * var(--ui-scale, 1));
}

.chat-capsule {
    position: relative;
    flex: 0 1 auto;
    min-width: 48%;
    max-width: 72%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    border-radius: 999px;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.15s var(--spring);
}

.chat-capsule:active {
    transform: scale(0.98);
}

#screenMessages > .pinned-bar {
    position: absolute;
    top: var(--chat-header-h, 64px);
    left: calc(12px * var(--ui-scale, 1));
    right: calc(12px * var(--ui-scale, 1));
    z-index: 5;
    border: none;
    border-radius: calc(18px * var(--ui-scale, 1));
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
}

#screenMessages > .msg-area {
    padding-top: calc(var(--chat-header-h, 64px) + var(--chat-pinned-h, 0px) + calc(10px * var(--ui-scale, 1)));
    padding-bottom: calc(var(--chat-composer-h, 60px) + calc(10px * var(--ui-scale, 1)));
    margin-bottom: calc(-1 * var(--chat-composer-h, 60px));
}

#screenMessages:has(> .sticker-panel) > .msg-area {
    margin-bottom: 0;
}

.avatar.chat-header-avatar {
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
    cursor: pointer;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    font-weight: 700;
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-typing {
    font-size: calc(10.5px * var(--ui-scale, 1));
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-button {
    position: relative;
    width: calc(40px * var(--ui-scale, 1));
    height: calc(40px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: calc(17px * var(--ui-scale, 1));
    flex-shrink: 0;
    transition: transform 0.15s var(--spring), opacity 0.15s ease;
}

.icon-button:active {
    transform: scale(0.88);
    opacity: 0.8;
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.screen.active {
    display: flex;
}

.bottom-nav {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 400px;
    height: 56px;
    border-radius: 30px;
    padding: 0 12px;
    background: var(--glass-fill-strong);
    backdrop-filter: var(--bar-blur, blur(2px));
    -webkit-backdrop-filter: var(--bar-blur, blur(2px));
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 10;
}

body.glass-flat .bottom-nav {
    background: var(--surface);
}

.nav-item {
    flex: 0 1 auto;
    padding: 8px 10px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
    position: relative;
    z-index: 2;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: calc(20px * var(--ui-scale, 1));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active i {
    transform: translateY(-1px) scale(1.08);
}

.nav-icon-wrap {
    position: relative;
    display: inline-flex;
}

.nav-badge {
    position: absolute;
    top: calc(-6px * var(--ui-scale, 1));
    right: calc(-10px * var(--ui-scale, 1));
    min-width: calc(16px * var(--ui-scale, 1));
    height: calc(16px * var(--ui-scale, 1));
    padding: 0 calc(4px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    background: var(--danger);
    color: var(--on-primary);
    font-size: calc(10px * var(--ui-scale, 1));
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--bg);
}

.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(30px * var(--ui-scale, 1));
    gap: calc(16px * var(--ui-scale, 1));
}

.auth-card {
    width: 100%;
    background: var(--glass);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border-radius: calc(26px * var(--ui-scale, 1));
    padding: calc(32px * var(--ui-scale, 1)) calc(26px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.auth-card h2 {
    margin-bottom: calc(22px * var(--ui-scale, 1));
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.auth-input {
    width: 100%;
    padding: calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    margin-bottom: calc(12px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    border-radius: calc(14px * var(--ui-scale, 1));
    background: var(--surface);
    font-size: calc(15px * var(--ui-scale, 1));
    font-family: inherit;
    outline: none;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-link {
    color: var(--primary);
    cursor: pointer;
    font-size: calc(14px * var(--ui-scale, 1));
    margin-top: calc(8px * var(--ui-scale, 1));
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    overscroll-behavior-x: none;
    padding: calc(4px * var(--ui-scale, 1)) 0;
    min-height: 0;
}

.search-box {
    padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    position: sticky;
    top: 0;
    z-index: 2;
    background: transparent;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper i {
    position: absolute;
    left: calc(14px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-size: calc(14px * var(--ui-scale, 1));
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: calc(11px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)) calc(40px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    border-radius: calc(20px * var(--ui-scale, 1));
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    font-size: calc(15px * var(--ui-scale, 1));
    font-family: inherit;
    outline: none;
    color: var(--text);
    transition: box-shadow 0.15s ease;
}

.search-input:focus {
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-item {
    padding: calc(11px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    gap: calc(13px * var(--ui-scale, 1));
    cursor: pointer;
    margin: calc(1px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    border-radius: calc(16px * var(--ui-scale, 1));
    transition: background 0.15s ease, transform 0.15s var(--spring);
}

.chat-item:hover {
    background: var(--hover);
}

.chat-item:active {
    background: var(--surface);
    transform: scale(0.985);
}

.avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.online-dot {
    position: absolute;
    bottom: calc(1px * var(--ui-scale, 1));
    right: calc(1px * var(--ui-scale, 1));
    width: calc(13px * var(--ui-scale, 1));
    height: calc(13px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--primary);
    border: calc(2px * var(--ui-scale, 1)) solid var(--bg);
}

.avatar {
    position: relative;
    width: calc(52px * var(--ui-scale, 1));
    height: calc(52px * var(--ui-scale, 1));
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--on-primary);
    font-size: calc(19px * var(--ui-scale, 1));
    background: var(--primary);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: 700;
    font-size: calc(15px * var(--ui-scale, 1));
    color: var(--text);
    letter-spacing: -0.01em;
}

.chat-unread-badge {
    background: var(--primary);
    color: var(--on-primary);
    border-radius: calc(10px * var(--ui-scale, 1));
    min-width: calc(20px * var(--ui-scale, 1));
    height: calc(20px * var(--ui-scale, 1));
    padding: 0 calc(6px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: calc(4px * var(--ui-scale, 1));
    box-shadow: 0 2px 8px var(--primary-glow);
}

.chat-preview {
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: calc(1px * var(--ui-scale, 1));
}

.chat-meta {
    text-align: right;
    flex-shrink: 0;
}

.chat-time {
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.msg-area {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    display: flex;
    flex-direction: column;
    gap: calc(3px * var(--ui-scale, 1));
    background: var(--chat-bg);
}

.date-divider {
    align-self: center;
    width: fit-content;
    text-align: center;
    margin: calc(6px * var(--ui-scale, 1)) auto;
    padding: calc(4px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    position: relative;
    background: var(--glass-fill-strong);
    border-radius: calc(12px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.msg-wrap {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: calc(5px * var(--ui-scale, 1));
    width: 100%;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.msg-wrap.sent {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.msg-wrap.received {
    justify-content: flex-start;
}

.msg-bub {
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
    border-radius: calc(20px * var(--ui-scale, 1));
    font-size: calc(14.5px * var(--ui-scale, 1));
    line-height: 1.42;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    transition: transform 0.25s var(--ease-out);
}

.msg-wrap.pressing .msg-bub {
    transform: scale(0.96);
    transition-duration: 1s;
    transition-timing-function: linear;
}

.sent .msg-bub {
    background: var(--message-out);
    color: var(--text);
    box-shadow: var(--shadow-sm), inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent);
}

.received .msg-bub {
    background: var(--message-in);
    color: var(--text);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.sent.tail .msg-bub {
    border-bottom-right-radius: calc(5px * var(--ui-scale, 1));
}

.received.tail .msg-bub {
    border-bottom-left-radius: calc(5px * var(--ui-scale, 1));
}

.sent:not(.tail) .msg-bub {
    border-bottom-right-radius: calc(7px * var(--ui-scale, 1));
}

.received:not(.tail) .msg-bub {
    border-bottom-left-radius: calc(7px * var(--ui-scale, 1));
}

.msg-wrap:not(.tail) + .sent .msg-bub {
    border-top-right-radius: calc(7px * var(--ui-scale, 1));
}

.msg-wrap:not(.tail) + .received .msg-bub {
    border-top-left-radius: calc(7px * var(--ui-scale, 1));
}

.msg-wrap.tail {
    margin-bottom: calc(5px * var(--ui-scale, 1));
}

.is-sticker .msg-bub,
.is-note .msg-bub {
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.is-sticker .msg-sticker-img {
    display: block;
    border-radius: 0;
}

.is-photo .msg-bub {
    padding: 2px;
}

.is-photo .msg-img {
    display: block;
    border-radius: calc(18px * var(--ui-scale, 1));
}

.is-photo.has-caption .msg-text-row {
    padding: calc(6px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1));
}

.is-photo.has-caption .msg-reactions {
    padding: 0 calc(9px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
}

.is-sticker .msg-time-row,
.is-note .msg-time-row,
.is-photo.no-caption .msg-time-row {
    position: absolute;
    right: calc(8px * var(--ui-scale, 1));
    bottom: calc(8px * var(--ui-scale, 1));
    padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
    background: color-mix(in srgb, #000 42%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
}

.is-sticker .msg-time-row .msg-time,
.is-note .msg-time-row .msg-time,
.is-photo.no-caption .msg-time-row .msg-time {
    top: 0;
    opacity: 1;
}

.is-sticker .msg-time-row .msg-ticks,
.is-note .msg-time-row .msg-ticks,
.is-photo.no-caption .msg-time-row .msg-ticks {
    color: inherit;
}

.msg-avatar {
    width: calc(28px * var(--ui-scale, 1));
    height: calc(28px * var(--ui-scale, 1));
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--on-primary);
    font-size: calc(12px * var(--ui-scale, 1));
    background: var(--primary);
    overflow: hidden;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-avatar-hidden {
    visibility: hidden;
}

.msg-img {
    max-width: calc(220px * var(--ui-scale, 1));
    max-height: calc(220px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
    cursor: pointer;
    display: block;
    margin: 0;
}

.msg-time {
    font-size: calc(10px * var(--ui-scale, 1));
    opacity: 0.7;
    flex-shrink: 0;
    text-align: right;
    position: relative;
    top: calc(2px * var(--ui-scale, 1));
}

.msg-ticks {
    display: inline-flex;
    align-items: center;
    margin-left: calc(4px * var(--ui-scale, 1));
    color: var(--text-secondary);
    vertical-align: -1px;
}

.msg-ticks svg {
    height: calc(7.5px * var(--ui-scale, 1));
    width: auto;
    display: block;
    color: inherit;
}

.msg-ticks.read {
    color: var(--primary);
}

.msg-reply-block {
    border-left: 3px solid var(--primary);
    padding-left: calc(8px * var(--ui-scale, 1));
    margin-bottom: calc(6px * var(--ui-scale, 1));
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
}

.msg-reply-name {
    font-weight: 600;
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-reply-text {
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-reaction-chip {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: calc(13px * var(--ui-scale, 1));
    padding: calc(3px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(12.5px * var(--ui-scale, 1));
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.msg-reaction-chip:active {
    transform: scale(0.9);
}

.msg-reaction-chip.mine {
    background: color-mix(in srgb, var(--primary) 18%, var(--surface));
    border-color: var(--primary);
}

.msg-context-menu {
    position: absolute;
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(16px * var(--ui-scale, 1));
    box-shadow: var(--shadow-md);
    padding: calc(8px * var(--ui-scale, 1));
    z-index: 50;
    width: calc(268px * var(--ui-scale, 1));
    max-width: calc(88vw);
    border: 1px solid var(--glass-border);
    animation: modalIn 0.34s var(--spring);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.msg-views {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-right: 5px;
    opacity: 0.85;
}

.msg-views i {
    font-size: 0.85em;
}

.verified-badge {
    color: var(--primary);
    font-size: 0.82em;
    margin-left: 3px;
    vertical-align: middle;
}

.msg-wrap.msg-appear {
    animation: msgAppear 0.3s var(--ease-out);
}

.msg-wrap.sent.msg-appear {
    transform-origin: bottom right;
}

.msg-wrap.received.msg-appear {
    transform-origin: bottom left;
}

@keyframes msgAppear {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.92);
    }
    55% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-mention {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.msg-mention:hover {
    text-decoration: underline;
}

.input-container {
    flex-shrink: 0;
    position: relative;
    z-index: 6;
    pointer-events: none;
}

.input-container > * {
    pointer-events: auto;
}

.mention-suggestions {
    position: absolute;
    left: calc(10px * var(--ui-scale, 1));
    right: calc(10px * var(--ui-scale, 1));
    bottom: 100%;
    margin-bottom: calc(6px * var(--ui-scale, 1));
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: calc(14px * var(--ui-scale, 1));
    box-shadow: var(--shadow-md);
    max-height: calc(220px * var(--ui-scale, 1));
    overflow-y: auto;
    z-index: 40;
    animation: modalIn 0.34s var(--spring);
}

.mention-suggestion-row {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    cursor: pointer;
}

.mention-suggestion-row:hover {
    background: var(--hover);
}

.mention-suggestion-info {
    min-width: 0;
}

.mention-suggestion-name {
    font-size: calc(13px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-suggestion-uname {
    font-size: calc(11.5px * var(--ui-scale, 1));
    color: var(--primary);
}

.reply-bar {
    display: flex;
    align-items: center;
    gap: calc(6px * var(--ui-scale, 1));
    position: relative;
    margin: 0 calc(10px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    border-radius: calc(18px * var(--ui-scale, 1));
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    font-size: calc(12px * var(--ui-scale, 1));
}

.reply-bar.hidden {
    display: none;
}

.reply-preview {
    flex: 1;
    min-width: 0;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid var(--primary);
    padding-left: calc(8px * var(--ui-scale, 1));
}

.reply-close {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: calc(15px * var(--ui-scale, 1));
}

.input-row {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    pointer-events: none;
}

.cmp-btn {
    position: relative;
    flex: none;
    width: calc(44px * var(--ui-scale, 1));
    height: calc(44px * var(--ui-scale, 1));
    padding: 0;
    border-radius: 50%;
    border: none;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    touch-action: none;
    scale: var(--p, 1);
    transition: scale 0.3s var(--spring), translate 0.3s var(--ease-out), background 0.25s ease, border-color 0.25s ease, color 0.25s ease, width 0.38s var(--ease-out), margin 0.38s var(--ease-out), opacity 0.25s ease;
}

.cmp-btn:active {
    --p: 0.9;
}

.cmp-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.cmp-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (hover: hover) {
    .cmp-btn:hover {
        background: var(--hover);
    }
}

.cmp-ico {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    font-size: calc(18px * var(--ui-scale, 1));
    opacity: 0;
    scale: 0.4;
    rotate: -50deg;
    transition: opacity 0.2s ease, scale 0.38s var(--spring), rotate 0.38s var(--spring);
}

.cmp-left .cmp-ico-clip,
[data-mode=preview] .cmp-left .cmp-ico-trash,
.cmp-right[data-state=mic] .cmp-ico-mic,
.cmp-right[data-state=hold] .cmp-ico-mic,
.cmp-right[data-state=send] .cmp-ico-send,
.cmp-right[data-state=stop] .cmp-ico-stop {
    opacity: 1;
    scale: 1;
    rotate: 0deg;
}

[data-mode=preview] .cmp-left .cmp-ico-clip {
    opacity: 0;
    scale: 0.4;
    rotate: 50deg;
}

.cmp-ico-mic {
    color: var(--text);
}

.cmp-ico-send {
    color: var(--primary);
    font-size: calc(19px * var(--ui-scale, 1));
}

.cmp-ico-trash {
    color: var(--danger);
}

.cmp-stop-square {
    width: calc(14px * var(--ui-scale, 1));
    height: calc(14px * var(--ui-scale, 1));
    border-radius: calc(3.5px * var(--ui-scale, 1));
    background: currentColor;
}

[data-mode^=rec] .cmp-left {
    width: 0;
    margin-right: calc(-8px * var(--ui-scale, 1));
    opacity: 0;
    scale: 0.3;
    pointer-events: none;
}

.cmp-right {
    scale: calc(var(--s, 1) * var(--p, 1));
    translate: var(--tx, 0px) var(--ty, 0px);
}

.cmp-right.dragging {
    transition: scale 0.3s var(--spring), background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.cmp-right[data-state=hold] {
    --s: 1.32;
    --p: 1;
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.cmp-right[data-state=hold] .cmp-ico-mic {
    color: var(--on-primary);
}

.cmp-right.sent-pulse {
    animation: sendPulse 0.4s ease;
}

.cmp-halo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 30%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.09s linear, opacity 0.25s ease;
}

.cmp-halo-outer {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
}

.cmp-right[data-state=hold] .cmp-halo {
    opacity: 1;
    transform: scale(calc(1.15 + var(--lvl, 0) * 0.45));
}

.cmp-right[data-state=hold] .cmp-halo-outer {
    transform: scale(calc(1.45 + var(--lvl, 0) * 0.8));
}

.cmp-pill {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    border-radius: calc(22px * var(--ui-scale, 1));
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

.cmp-pill:focus-within {
    box-shadow: var(--shadow-sm), 0 0 0 2px color-mix(in srgb, var(--primary) 60%, transparent);
}

.cmp-text {
    transition: opacity 0.25s var(--ease-out), transform 0.38s var(--ease-out);
}

[data-mode^=rec] .cmp-text,
[data-mode=preview] .cmp-text {
    opacity: 0;
    transform: translateX(-24px);
    pointer-events: none;
}

.msg-input {
    display: block;
    width: 100%;
    min-height: calc(42px * var(--ui-scale, 1));
    max-height: calc(100px * var(--ui-scale, 1));
    padding: calc(11px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: calc(14.5px * var(--ui-scale, 1));
    line-height: calc(20px * var(--ui-scale, 1));
    caret-color: var(--primary);
    overflow-y: auto;
    scrollbar-width: none;
    transition: height 0.18s ease;
}

.msg-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.msg-input:focus::placeholder {
    opacity: 0.4;
}

.cmp-rec,
.cmp-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateX(28px);
    transition: opacity 0.25s var(--ease-out), transform 0.38s var(--ease-out);
}

.cmp-rec {
    gap: calc(12px * var(--ui-scale, 1));
    padding: 0 calc(16px * var(--ui-scale, 1));
}

.cmp-preview {
    gap: calc(6px * var(--ui-scale, 1));
    padding: 0 calc(16px * var(--ui-scale, 1)) 0 calc(5px * var(--ui-scale, 1));
}

[data-mode^=rec] .cmp-rec,
[data-mode=preview] .cmp-preview {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.cmp-dot {
    flex: none;
    width: calc(11px * var(--ui-scale, 1));
    height: calc(11px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--text);
    animation: cmpBlink 1.1s ease-in-out infinite;
}

.cmp-time {
    flex: none;
    min-width: calc(36px * var(--ui-scale, 1));
    font-size: calc(15px * var(--ui-scale, 1));
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.cmp-rec-mid {
    position: relative;
    flex: 1;
    height: 100%;
    min-width: 0;
}

.cmp-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}

.cmp-hint-in {
    display: flex;
    align-items: center;
    gap: calc(6px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-size: calc(14px * var(--ui-scale, 1));
    white-space: nowrap;
}

.cmp-hint-in i {
    font-size: calc(11px * var(--ui-scale, 1));
    animation: cmpNudge 1.4s ease-in-out infinite;
}

[data-mode=rec-lock] .cmp-hint {
    opacity: 0;
}

.cmp-live {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 92%, transparent);
}

[data-mode=rec-lock] .cmp-live {
    opacity: 1;
}

.cmp-play {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: calc(15px * var(--ui-scale, 1));
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease, scale 0.25s var(--spring);
}

.cmp-play:active {
    scale: 0.88;
}

.cmp-play i {
    grid-area: 1 / 1;
    transition: opacity 0.2s ease, scale 0.3s var(--spring);
}

.cmp-pause-icon,
.cmp-play.playing .cmp-play-icon {
    opacity: 0;
    scale: 0.5;
}

.cmp-play.playing .cmp-pause-icon {
    opacity: 1;
    scale: 1;
}

.cmp-preview-wave {
    flex: 1;
    min-width: 0;
    height: calc(32px * var(--ui-scale, 1));
    touch-action: pan-y;
    cursor: pointer;
}

.cmp-preview-time {
    min-width: calc(34px * var(--ui-scale, 1));
    text-align: right;
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.cmp-lock {
    position: absolute;
    right: calc(10px * var(--ui-scale, 1));
    bottom: calc(100% + 8px * var(--ui-scale, 1));
    width: calc(44px * var(--ui-scale, 1));
    height: calc(78px * var(--ui-scale, 1));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(8px * var(--ui-scale, 1));
    background: var(--glass-fill-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: calc(22px * var(--ui-scale, 1));
    box-shadow: var(--shadow-md);
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transform: translateY(24px) scale(0.7);
    transform-origin: 50% 100%;
    translate: 0 calc(var(--lp, 0) * 10px);
    transition: opacity 0.25s ease, transform 0.42s var(--spring);
}

[data-mode=rec-hold] .cmp-lock {
    opacity: 1;
    transform: none;
}

.cmp-lock-icon {
    position: relative;
    width: calc(20px * var(--ui-scale, 1));
    height: calc(20px * var(--ui-scale, 1));
    font-size: calc(17px * var(--ui-scale, 1));
}

.cmp-lock-open,
.cmp-lock-closed {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transition: opacity 0.15s ease;
}

.cmp-lock-closed {
    opacity: 0;
}

.cmp-lock.closed .cmp-lock-open {
    opacity: 0;
}

.cmp-lock.closed .cmp-lock-closed {
    opacity: 1;
}

.cmp-lock.closed .cmp-lock-icon {
    animation: cmpLockPop 0.35s var(--spring);
}

.cmp-lock-chevron {
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--text-secondary);
    opacity: calc(1 - var(--lp, 0));
}

@keyframes cmpBlink {
    50% { opacity: 0.3; }
}

@keyframes cmpNudge {
    50% { transform: translateX(-5px); }
}

@keyframes cmpLockPop {
    40% { transform: scale(1.25); }
}

@keyframes sendPulse {
    0% { transform: scale(1); }
    35% { transform: scale(0.82) rotate(-8deg); }
    70% { transform: scale(1.12) rotate(4deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.attach-menu {
    position: fixed;
    display: flex;
    flex-direction: column;
    min-width: calc(236px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) 0;
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(22px * var(--ui-scale, 1));
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transform-origin: 0 100%;
    transform: scale(0.5) translateY(12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.38s var(--spring), opacity 0.2s ease, visibility 0s linear 0.38s;
}

.attach-menu.show {
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.38s var(--spring), opacity 0.2s ease, visibility 0s;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: calc(16px * var(--ui-scale, 1));
    width: 100%;
    height: calc(52px * var(--ui-scale, 1));
    padding: 0 calc(20px * var(--ui-scale, 1));
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: calc(15px * var(--ui-scale, 1));
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.3s var(--ease-out), background 0.15s ease;
}

.attach-menu.show .attach-menu-item {
    opacity: 1;
    transform: none;
}

.attach-menu.show .attach-menu-item:nth-child(1) { transition-delay: 0.04s, 0.04s, 0s; }
.attach-menu.show .attach-menu-item:nth-child(2) { transition-delay: 0.08s, 0.08s, 0s; }
.attach-menu.show .attach-menu-item:nth-child(3) { transition-delay: 0.12s, 0.12s, 0s; }
.attach-menu.show .attach-menu-item:nth-child(4) { transition-delay: 0.16s, 0.16s, 0s; }

.attach-menu-item + .attach-menu-item {
    border-top: 1px solid var(--glass-border);
}

.attach-menu-item:active {
    background: rgba(128, 128, 128, 0.14);
}

@media (hover: hover) {
    .attach-menu-item:hover {
        background: var(--hover);
    }
}

.attach-menu-item i {
    flex: none;
    width: calc(24px * var(--ui-scale, 1));
    font-size: calc(18px * var(--ui-scale, 1));
    text-align: center;
}

.chat-menu {
    transform-origin: 100% 0;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}

.attach-menu-item.danger {
    color: var(--danger);
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(92px * var(--ui-scale, 1));
    z-index: 1200;
    max-width: calc(100% - 32px);
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-radius: calc(18px * var(--ui-scale, 1));
    background: var(--glass-fill-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-size: calc(13.5px * var(--ui-scale, 1));
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity 0.25s ease, transform 0.35s var(--spring);
}

.app-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.camera-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: #000;
    animation: overlayIn 0.22s ease;
}

.camera-video {
    flex: 1;
    min-height: 0;
    width: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-close {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 14px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.camera-shutter {
    position: absolute;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    translate: -50% 0;
    width: 74px;
    height: 74px;
    padding: 0;
    border: 4px solid #fff;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: scale 0.2s var(--spring);
}

.camera-shutter::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #fff;
}

.camera-shutter:active {
    scale: 0.9;
}

.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.msg-text-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.msg-text {
    flex: 1;
    min-width: 0;
    white-space: pre-wrap;
}

.msg-text-row .msg-time {
    min-width: 35px;
}

.msg-time-row {
    text-align: right;
}

.msg-edited {
    margin-right: 2px;
    font-size: 9.5px;
    opacity: 0.6;
}

.msg-bub video {
    display: block;
    max-width: calc(220px * var(--ui-scale, 1));
    max-height: calc(220px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
}

.form-group {
    margin-bottom: calc(12px * var(--ui-scale, 1));
}

.form-group label {
    display: block;
    font-size: calc(11px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: calc(4px * var(--ui-scale, 1));
}

.form-input {
    width: 100%;
    padding: calc(11px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    border-radius: calc(13px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
    font-family: inherit;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
    width: 100%;
    padding: calc(12px * var(--ui-scale, 1));
    border: none;
    border-radius: calc(13px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: calc(4px * var(--ui-scale, 1));
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-primary {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-danger {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
}

.settings-scroll {
    flex: 1;
    overflow-y: auto;
    padding: calc(12px * var(--ui-scale, 1));
}

.settings-group {
    background: var(--glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: calc(16px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    margin-bottom: calc(12px * var(--ui-scale, 1));
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.settings-row {
    padding: calc(15px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.15s ease;
}

.settings-row:active {
    background: var(--hover);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-left {
    display: flex;
    align-items: center;
    gap: calc(11px * var(--ui-scale, 1));
}

.settings-icon {
    width: calc(34px * var(--ui-scale, 1));
    height: calc(34px * var(--ui-scale, 1));
    border-radius: calc(11px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(15px * var(--ui-scale, 1));
}

.settings-text {
    font-size: calc(14px * var(--ui-scale, 1));
    color: var(--text);
}

.settings-value {
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.toggle {
    width: calc(46px * var(--ui-scale, 1));
    height: calc(27px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
    background: color-mix(in srgb, var(--text) 20%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: background 0.25s ease;
}

body.glass-flat .toggle {
    background: color-mix(in srgb, var(--text) 26%, var(--surface));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.toggle.active {
    background: var(--primary);
    box-shadow: none;
}

.toggle-thumb {
    position: absolute;
    top: calc(2.5px * var(--ui-scale, 1));
    left: calc(2.5px * var(--ui-scale, 1));
    width: calc(22px * var(--ui-scale, 1));
    height: calc(22px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--toggle-thumb);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: left 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), scale 0.2s var(--spring);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.toggle.active .toggle-thumb {
    background: var(--toggle-thumb-active);
    left: calc(19.5px * var(--ui-scale, 1));
}

.toggle.held .toggle-thumb {
    scale: 1.25;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.form-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: calc(6px * var(--ui-scale, 1));
    margin: calc(6px * var(--ui-scale, 1)) 0 calc(14px * var(--ui-scale, 1));
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary) calc(var(--rv, 50) * 1%), color-mix(in srgb, var(--text) 18%, transparent) calc(var(--rv, 50) * 1%), color-mix(in srgb, var(--text) 18%, transparent) 100%);
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: calc(22px * var(--ui-scale, 1));
    height: calc(22px * var(--ui-scale, 1));
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: none;
    margin-top: 0;
    transition: scale 0.2s var(--spring);
}

.form-range.held::-webkit-slider-thumb {
    scale: 1.3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.form-range::-moz-range-thumb {
    width: calc(22px * var(--ui-scale, 1));
    height: calc(22px * var(--ui-scale, 1));
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: none;
    transition: scale 0.2s var(--spring);
}

.form-range.held::-moz-range-thumb {
    scale: 1.3;
}

.form-range::-moz-range-track {
    height: calc(6px * var(--ui-scale, 1));
    border-radius: 999px;
    background: transparent;
}

body.glass-liquid .form-range.held::-webkit-slider-thumb,
body.glass-liquid .form-range.held::-moz-range-thumb {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset -1.5px -1.5px 0 rgba(255, 100, 60, 0.55), inset 1.5px 1.5px 0 rgba(60, 140, 255, 0.55);
}

body.glass-flat .form-range::-webkit-slider-thumb,
body.glass-flat .form-range::-moz-range-thumb {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--glass-border);
}

.form-range:active::-webkit-slider-thumb {
    transform: scale(1.1);
}

.modal {
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(26px * var(--ui-scale, 1));
    padding: calc(28px * var(--ui-scale, 1));
    width: 90%;
    max-width: calc(340px * var(--ui-scale, 1));
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalIn 0.34s var(--spring);
}

.modal .avatar {
    width: calc(72px * var(--ui-scale, 1));
    height: calc(72px * var(--ui-scale, 1));
    font-size: calc(26px * var(--ui-scale, 1));
    margin: 0 auto calc(10px * var(--ui-scale, 1));
}

.modal h3 {
    color: var(--text);
    margin-bottom: calc(3px * var(--ui-scale, 1));
    font-size: calc(17px * var(--ui-scale, 1));
}

.full-viewer {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
}

.fv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
}

.fv-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    padding-top: calc(calc(12px * var(--ui-scale, 1)) + env(safe-area-inset-top, 0px));
    pointer-events: none;
}

.fv-top > * {
    pointer-events: auto;
}

.fv-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(44px * var(--ui-scale, 1));
    height: calc(44px * var(--ui-scale, 1));
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    color: #fff;
    font-size: calc(17px * var(--ui-scale, 1));
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s var(--spring), opacity 0.2s ease;
}

.fv-btn:active {
    transform: scale(0.9);
}

.fv-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.fv-counter {
    padding: calc(8px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-radius: 999px;
    position: relative;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    color: #fff;
    font-size: calc(13.5px * var(--ui-scale, 1));
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fv-stage {
    position: relative;
    flex: 1;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
}

.fv-track {
    display: flex;
    width: 300%;
    height: 100%;
    will-change: transform;
}

.fv-slide {
    flex: 0 0 33.3333%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(64px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1));
}

.fv-slide img {
    flex-shrink: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.fv-nav {
    position: absolute;
    top: 50%;
    margin-top: calc(-22px * var(--ui-scale, 1));
    z-index: 3;
}

.fv-prev {
    left: calc(14px * var(--ui-scale, 1));
}

.fv-next {
    right: calc(14px * var(--ui-scale, 1));
}

@media (max-width: 768px) {
    .fv-nav {
        display: none;
    }
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: calc(40px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.empty-state i {
    font-size: calc(44px * var(--ui-scale, 1));
    opacity: 0.25;
    margin-bottom: calc(8px * var(--ui-scale, 1));
    display: block;
}

.chat-badge {
    display: inline-block;
    font-size: calc(10px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-radius: calc(8px * var(--ui-scale, 1));
    padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
    margin-left: calc(6px * var(--ui-scale, 1));
    vertical-align: middle;
}

.sender-name-label {
    font-size: calc(12px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--primary);
    margin-bottom: calc(2px * var(--ui-scale, 1));
}

.action-sheet-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(20px * var(--ui-scale, 1));
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 220;
    animation: overlayIn 0.22s ease;
}

.action-sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: calc(380px * var(--ui-scale, 1));
    max-height: 78vh;
    padding: calc(16px * var(--ui-scale, 1)) 0 calc(6px * var(--ui-scale, 1));
    overflow: hidden;
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(26px * var(--ui-scale, 1));
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.34s var(--spring);
}

.sheet-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.big-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 220;
    padding: calc(20px * var(--ui-scale, 1));
    animation: overlayIn 0.22s ease;
}

@keyframes overlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.big-modal {
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(26px * var(--ui-scale, 1));
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: calc(400px * var(--ui-scale, 1));
    max-height: 82vh;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.34s var(--spring);
}

.big-modal-header {
    padding: calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));
    font-weight: 700;
    font-size: calc(16px * var(--ui-scale, 1));
    color: var(--text);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.big-modal-body {
    padding: calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));
    overflow-y: auto;
    flex: 1;
}

.big-modal-footer {
    padding: calc(12px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(calc(12px * var(--ui-scale, 1)) + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.member-row {
    padding: calc(10px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    cursor: pointer;
    border-radius: calc(12px * var(--ui-scale, 1));
    transition: background 0.15s ease;
}

.member-row:active {
    background: var(--hover);
}

.member-row .avatar {
    width: calc(38px * var(--ui-scale, 1));
    height: calc(38px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
}

.member-row-info {
    flex: 1;
    min-width: 0;
}

.member-row-name {
    font-size: calc(14px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-row-sub {
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.member-check {
    width: calc(20px * var(--ui-scale, 1));
    height: calc(20px * var(--ui-scale, 1));
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    flex-shrink: 0;
}

.member-check.checked {
    background: var(--primary);
    border-color: var(--primary);
    position: relative;
}

.member-check.checked::after {
    content: '✓';
    position: absolute;
    inset: 0;
    color: var(--on-primary);
    font-size: calc(12px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.role-tag {
    font-size: calc(10px * var(--ui-scale, 1));
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    margin-left: calc(6px * var(--ui-scale, 1));
}

.member-row-menu {
    flex-shrink: 0;
    width: calc(30px * var(--ui-scale, 1));
    height: calc(30px * var(--ui-scale, 1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: calc(14px * var(--ui-scale, 1));
    transition: background 0.15s ease;
}

.member-row-menu:active {
    background: var(--hover);
}

.chat-info-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: calc(10px * var(--ui-scale, 1));
}

.chat-info-avatar-wrap .avatar {
    width: calc(72px * var(--ui-scale, 1));
    height: calc(72px * var(--ui-scale, 1));
    font-size: calc(26px * var(--ui-scale, 1));
}

.section-label {
    font-size: calc(12px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 14px 0 6px;
}

.channel-locked-input {
    padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    text-align: center;
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
    background: var(--surface);
}

.fab-new-chat {
    position: absolute;
    right: calc(18px * var(--ui-scale, 1));
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--on-primary);
    font-size: calc(22px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 22px var(--primary-glow), var(--shadow-lg);
    z-index: 30;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.fab-new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px var(--primary-glow), var(--shadow-lg);
}

.fab-new-chat:active {
    transform: scale(0.9);
}

.info-scroll {
    flex: 1;
    overflow-y: auto;
}

.tg-cover {
    min-height: calc(128px * var(--ui-scale, 1));
    background: var(--primary);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: calc(16px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
    gap: calc(12px * var(--ui-scale, 1));
    color: var(--on-primary);
    position: relative;
    border-radius: 0 0 calc(22px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1));
    box-shadow: var(--shadow-sm);
}

.tg-cover.has-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5));
    pointer-events: none;
}

.tg-cover .avatar,
.tg-cover-avatar-wrap,
.tg-cover-info,
.tg-cover-edit {
    position: relative;
    z-index: 1;
}

.tg-cover .avatar {
    width: calc(64px * var(--ui-scale, 1));
    height: calc(64px * var(--ui-scale, 1));
    font-size: 22px;
    border: 3px solid rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
    box-shadow: none;
}

.tg-cover-info {
    min-width: 0;
    padding-bottom: calc(2px * var(--ui-scale, 1));
}

.tg-cover-name {
    font-size: calc(18px * var(--ui-scale, 1));
    font-weight: 700;
    overflow-wrap: break-word;
}

.tg-cover-sub {
    font-size: calc(12px * var(--ui-scale, 1));
    opacity: 0.9;
    margin-top: calc(2px * var(--ui-scale, 1));
}

.tg-cover-edit {
    position: absolute;
    top: calc(10px * var(--ui-scale, 1));
    right: calc(10px * var(--ui-scale, 1));
    width: calc(32px * var(--ui-scale, 1));
    height: calc(32px * var(--ui-scale, 1));
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(13px * var(--ui-scale, 1));
    cursor: pointer;
    z-index: 2;
}

.tg-cover-edit:active {
    transform: scale(0.92);
}

.tg-cover-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.tg-cover-avatar-edit {
    position: absolute;
    bottom: calc(-2px * var(--ui-scale, 1));
    right: calc(-2px * var(--ui-scale, 1));
    width: calc(24px * var(--ui-scale, 1));
    height: calc(24px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg);
    color: var(--on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(10px * var(--ui-scale, 1));
    cursor: pointer;
    z-index: 2;
}

.tg-actions-row {
    display: flex;
    justify-content: center;
    gap: calc(34px * var(--ui-scale, 1));
    padding: calc(16px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    border-bottom: 1px solid var(--glass-border);
}

.tg-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(6px * var(--ui-scale, 1));
    cursor: pointer;
    color: var(--primary);
    font-size: calc(11px * var(--ui-scale, 1));
    text-align: center;
}

.tg-action-btn .circle {
    width: calc(48px * var(--ui-scale, 1));
    height: calc(48px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tg-action-btn:active .circle {
    transform: scale(0.9);
}

.tg-action-btn.danger {
    color: var(--danger);
}

.section-label.first {
    margin-top: calc(16px * var(--ui-scale, 1));
}

.tg-info-list {
    margin: calc(16px * var(--ui-scale, 1));
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: calc(18px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tg-info-row {
    padding: calc(11px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-bottom: 1px solid var(--glass-border);
}

.tg-info-row:last-child {
    border-bottom: none;
}

.tg-info-label {
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
    margin-bottom: calc(2px * var(--ui-scale, 1));
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tg-info-value {
    font-size: calc(15px * var(--ui-scale, 1));
    color: var(--text);
    word-break: break-word;
}

.tg-media-grid {
    margin: 0 calc(16px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(3px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
    overflow: hidden;
}

.tg-media-thumb {
    aspect-ratio: 1 / 1;
    cursor: pointer;
    background: var(--surface);
}

.tg-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tg-media-empty {
    margin: 0 calc(16px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    padding: calc(16px * var(--ui-scale, 1));
    text-align: center;
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
    background: var(--glass);
    border-radius: calc(14px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
}

.tg-edit-list {
    margin: calc(16px * var(--ui-scale, 1));
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: calc(18px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    box-shadow: var(--shadow-sm);
}

.tg-danger-list {
    margin: 0 16px 24px;
    background: var(--glass);
    border-radius: calc(18px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tg-danger-row {
    padding: calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    color: var(--danger);
    font-weight: 600;
    font-size: calc(14px * var(--ui-scale, 1));
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    transition: background 0.15s ease;
}

.tg-danger-row:last-child {
    border-bottom: none;
}

.tg-danger-row:active {
    background: var(--hover);
}

.tg-info-list .member-row {
    margin: 0;
    border-radius: 0;
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-bottom: 1px solid var(--glass-border);
}

.tg-info-list .member-row:last-child {
    border-bottom: none;
}

.stories-row {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    max-height: calc(94px * var(--ui-scale, 1));
    transition: max-height 0.22s ease, opacity 0.18s ease;
}

.stories-row.stories-hidden {
    max-height: 0;
    opacity: 0;
}

.stories-row-bg {
    position: absolute;
    inset: 0;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--glass-border);
}

.stories-row.stories-hidden .stories-row-bg {
    box-shadow: none;
}

.stories-row-content {
    position: relative;
    display: flex;
    gap: calc(14px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    transform: translateZ(0);
}

.stories-row-content::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(4px * var(--ui-scale, 1));
    flex-shrink: 0;
    width: calc(60px * var(--ui-scale, 1));
    cursor: pointer;
}

.story-avatar-wrap {
    position: relative;
    width: calc(56px * var(--ui-scale, 1));
    height: calc(56px * var(--ui-scale, 1));
    border-radius: 50%;
    padding: calc(2.5px * var(--ui-scale, 1));
}

.story-avatar-wrap.has-story {
    background: var(--primary);
}

.story-avatar-wrap.has-story.viewed {
    background: var(--glass-border);
}

.story-avatar-wrap .avatar {
    width: 100%;
    height: 100%;
    border: calc(2px * var(--ui-scale, 1)) solid var(--bg);
    font-size: calc(16px * var(--ui-scale, 1));
}

.story-add-badge {
    position: absolute;
    bottom: calc(-1px * var(--ui-scale, 1));
    right: calc(-1px * var(--ui-scale, 1));
    width: calc(19px * var(--ui-scale, 1));
    height: calc(19px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(10px * var(--ui-scale, 1));
    border: calc(2px * var(--ui-scale, 1)) solid var(--bg);
}

.story-name {
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.story-viewer-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 400;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.34s var(--spring);
}

.story-progress-row {
    display: flex;
    gap: calc(4px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) 0;
}

.story-progress-seg {
    flex: 1;
    height: calc(3px * var(--ui-scale, 1));
    border-radius: calc(2px * var(--ui-scale, 1));
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: calc(2px * var(--ui-scale, 1));
}

.story-progress-fill.full {
    width: 100%;
}

.story-viewer-header {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    position: relative;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.story-viewer-header .avatar {
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
    flex-shrink: 0;
}

.story-viewer-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: calc(1px * var(--ui-scale, 1));
}

.story-viewer-name {
    color: white;
    font-weight: 700;
    font-size: calc(14px * var(--ui-scale, 1));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-viewer-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: calc(11.5px * var(--ui-scale, 1));
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.story-viewer-close {
    color: white;
    font-size: calc(18px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1));
    cursor: pointer;
}

.story-viewer-img {
    flex: 1;
    width: 100%;
    min-height: 0;
    object-fit: contain;
    background: #000;
}

.story-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(74px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1));
    color: white;
    font-size: calc(14.5px * var(--ui-scale, 1));
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 12px rgba(0, 0, 0, 0.4);
    z-index: 2;
    word-break: break-word;
    pointer-events: none;
}

.story-caption::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc(-40px * var(--ui-scale, 1));
    bottom: calc(-90px * var(--ui-scale, 1));
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.6) 100%);
    z-index: -1;
    pointer-events: none;
}

.story-bottom-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: calc(12px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(calc(12px * var(--ui-scale, 1)) + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(10px * var(--ui-scale, 1));
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}

.story-viewers-btn {
    display: flex;
    align-items: center;
    gap: calc(7px * var(--ui-scale, 1));
    color: white;
    font-size: calc(13.5px * var(--ui-scale, 1));
    font-weight: 600;
    padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    border-radius: calc(20px * var(--ui-scale, 1));
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.story-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    border-radius: 50%;
    background: color-mix(in srgb, var(--danger) 85%, transparent);
    color: var(--on-primary);
    font-size: calc(14px * var(--ui-scale, 1));
    cursor: pointer;
}

.story-composer-overlay .story-viewer-img {
    flex: 1;
}

.story-composer-bar {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(calc(12px * var(--ui-scale, 1)) + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.55);
    z-index: 2;
}

.story-caption-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: calc(20px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    color: white;
    font-size: calc(14px * var(--ui-scale, 1));
    outline: none;
}

.story-caption-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.story-composer-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(40px * var(--ui-scale, 1));
    height: calc(40px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    font-size: calc(15px * var(--ui-scale, 1));
    cursor: pointer;
    flex-shrink: 0;
}

.story-composer-send:disabled {
    opacity: 0.6;
}

.story-viewers-sheet {
    padding-bottom: calc(6px * var(--ui-scale, 1));
}

.story-viewers-title {
    font-weight: 700;
    font-size: calc(15px * var(--ui-scale, 1));
    color: var(--text);
    text-align: center;
    padding: calc(6px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
}

.pinned-bar {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    background: var(--surface);
    border-bottom: 1px solid var(--glass-border);
    color: var(--primary);
    font-size: calc(13px * var(--ui-scale, 1));
    cursor: pointer;
    flex-shrink: 0;
}

.pinned-bar.hidden {
    display: none;
}

.pinned-bar-icon {
    color: var(--primary);
    font-size: calc(13px * var(--ui-scale, 1));
    flex-shrink: 0;
}

.pinned-bar-text {
    flex: 1;
    min-width: 0;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pinned-bar-close {
    color: var(--text-secondary);
    font-size: calc(14px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1));
    cursor: pointer;
}

.msg-pin-badge {
    position: absolute;
    top: calc(6px * var(--ui-scale, 1));
    right: calc(8px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-size: calc(11px * var(--ui-scale, 1));
    opacity: 0.75;
}

.msg-forward-label {
    display: flex;
    align-items: center;
    gap: calc(5px * var(--ui-scale, 1));
    font-size: calc(12px * var(--ui-scale, 1));
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: calc(4px * var(--ui-scale, 1));
}

.msg-bubble-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 78%;
    align-items: flex-start;
}

.msg-wrap.sent .msg-bubble-col {
    align-items: flex-end;
}

.msg-comments-pill {
    display: inline-flex;
    align-items: center;
    gap: calc(6px * var(--ui-scale, 1));
    margin-top: calc(4px * var(--ui-scale, 1));
    padding: calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: calc(12px * var(--ui-scale, 1));
    cursor: pointer;
    width: fit-content;
}

.comments-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.34s var(--spring);
}

.comments-header {
    display: flex;
    align-items: center;
    gap: calc(14px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    background: var(--glass);
    backdrop-filter: blur(26px) saturate(1.4);
    -webkit-backdrop-filter: blur(26px) saturate(1.4);
    box-shadow: 0 1px 0 var(--glass-border);
    flex-shrink: 0;
}

.comments-close {
    cursor: pointer;
    color: var(--text);
    font-size: calc(17px * var(--ui-scale, 1));
}

.comments-title {
    font-weight: 700;
    font-size: calc(15px * var(--ui-scale, 1));
    color: var(--text);
}

.comments-post-preview {
    display: flex;
    align-items: flex-start;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-bottom: 1px solid var(--glass-border);
    background: var(--surface);
    flex-shrink: 0;
    max-height: 26vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.comments-post-preview .avatar {
    width: calc(34px * var(--ui-scale, 1));
    height: calc(34px * var(--ui-scale, 1));
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: calc(13px * var(--ui-scale, 1));
    background: var(--primary);
    overflow: hidden;
}

.comments-post-preview .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comments-post-body {
    flex: 1;
    min-width: 0;
}

.comments-post-name {
    font-weight: 600;
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text);
    margin-bottom: calc(2px * var(--ui-scale, 1));
}

.comments-post-text {
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
    word-break: break-word;
}

.comments-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    display: flex;
    flex-direction: column;
    gap: calc(14px * var(--ui-scale, 1));
}

.comment-row {
    display: flex;
    align-items: flex-start;
    gap: calc(10px * var(--ui-scale, 1));
}

.comment-row .avatar {
    width: calc(30px * var(--ui-scale, 1));
    height: calc(30px * var(--ui-scale, 1));
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: calc(12px * var(--ui-scale, 1));
    background: var(--primary);
    overflow: hidden;
}

.comment-row .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-body {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border-radius: calc(12px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
}

.comment-name {
    font-weight: 600;
    font-size: calc(12.5px * var(--ui-scale, 1));
    color: var(--primary);
    margin-bottom: calc(2px * var(--ui-scale, 1));
}

.comment-text {
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

.comments-input-row {
    display: flex;
    align-items: flex-end;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(calc(10px * var(--ui-scale, 1)) + env(safe-area-inset-bottom, 0px));
    background: var(--glass);
    backdrop-filter: blur(26px) saturate(1.4);
    -webkit-backdrop-filter: blur(26px) saturate(1.4);
    box-shadow: 0 -1px 0 var(--glass-border);
    flex-shrink: 0;
}

.comments-input {
    flex: 1;
    border: 1px solid var(--glass-border);
    border-radius: calc(22px * var(--ui-scale, 1));
    padding: calc(9px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    background: var(--surface);
    color: var(--text);
    font-size: calc(14px * var(--ui-scale, 1));
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
}

.comments-send-btn {
    width: calc(38px * var(--ui-scale, 1));
    height: calc(38px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--on-primary);
    font-size: calc(14px * var(--ui-scale, 1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comments-send-btn:disabled {
    opacity: 0.6;
}

#screenChats .header {
    justify-content: space-between;
}

.desktop-header-actions {
    display: none;
    align-items: center;
    gap: calc(6px * var(--ui-scale, 1));
}

.dt-nav-btn {
    width: calc(30px * var(--ui-scale, 1));
    height: calc(30px * var(--ui-scale, 1));
    border-radius: calc(9px * var(--ui-scale, 1));
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: calc(13px * var(--ui-scale, 1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.dt-nav-btn:hover {
    background: var(--hover);
}

.dt-nav-btn.active {
    background: var(--surface);
    color: var(--primary);
}

.desktop-scale-control {
    display: flex;
    align-items: center;
    gap: calc(4px * var(--ui-scale, 1));
    margin-left: calc(4px * var(--ui-scale, 1));
    padding-left: calc(8px * var(--ui-scale, 1));
    border-left: 1px solid var(--glass-border);
}

.scale-btn {
    width: calc(24px * var(--ui-scale, 1));
    height: calc(24px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: calc(10px * var(--ui-scale, 1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.scale-btn:hover {
    background: var(--hover);
    color: var(--primary);
}

.scale-btn:active {
    transform: scale(0.9);
}

.scale-value {
    font-size: calc(10px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text-secondary);
    min-width: calc(30px * var(--ui-scale, 1));
    text-align: center;
}

@media (min-width: 980px) {
    .app {
        max-width: calc(1320px * var(--ui-scale, 1));
        max-height: none;
        height: calc(100vh - 40px);
    }

    .main-content {
        flex-direction: row;
    }

    #bottomNav {
        display: none;
    }

    #screenChats {
        display: flex;
        flex: 0 0 calc(340px * var(--ui-scale, 1));
        width: calc(340px * var(--ui-scale, 1));
        max-width: calc(340px * var(--ui-scale, 1));
        border-right: 1px solid var(--glass-border);
    }

    .screen:not(#screenChats) {
        flex: 1;
        min-width: 0;
    }

    .main-content:not(:has(#screenSettings.active)):not(:has(#screenProfile.active)):not(:has(#screenViewProfile.active)):not(:has(#screenChatInfo.active)) #screenMessages {
        display: flex;
    }

    #backBtn {
        display: none;
    }

    .desktop-header-actions {
        display: flex;
    }
}

.scroll-bottom-btn {
    position: absolute;
    right: calc(16px * var(--ui-scale, 1));
    bottom: calc(var(--chat-composer-h, 60px) + 14px);
    width: calc(40px * var(--ui-scale, 1));
    height: calc(40px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    color: var(--text);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(15px * var(--ui-scale, 1));
    cursor: pointer;
    z-index: 8;
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.scroll-bottom-btn.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.story-viewer-forward {
    color: white;
    font-size: calc(17px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1));
    cursor: pointer;
}

.story-reply-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(calc(12px * var(--ui-scale, 1)) + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}

.story-reply-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: calc(20px * var(--ui-scale, 1));
    padding: calc(9px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    color: white;
    font-size: calc(14px * var(--ui-scale, 1));
    outline: none;
}

.story-reply-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.story-quick-heart {
    position: relative;
    width: calc(38px * var(--ui-scale, 1));
    height: calc(38px * var(--ui-scale, 1));
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(16px * var(--ui-scale, 1));
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}

.story-quick-heart.reacted {
    background: rgba(255, 255, 255, 0.25);
}

.story-reply-send {
    width: calc(38px * var(--ui-scale, 1));
    height: calc(38px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--on-primary);
    font-size: calc(14px * var(--ui-scale, 1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.story-quick-emoji-popup {
    position: absolute;
    bottom: calc(48px * var(--ui-scale, 1));
    right: 0;
    background: rgba(30, 30, 30, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: calc(16px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1));
    display: flex;
    flex-wrap: wrap;
    gap: calc(4px * var(--ui-scale, 1));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: calc(220px * var(--ui-scale, 1));
    z-index: 5;
}

.story-quick-emoji-popup-item {
    font-size: calc(20px * var(--ui-scale, 1));
    cursor: pointer;
    padding: calc(3px * var(--ui-scale, 1));
    transition: transform 0.1s ease;
}

.story-quick-emoji-popup-item:active {
    transform: scale(1.3);
}

.story-viewer-reaction-mark {
    font-size: calc(17px * var(--ui-scale, 1));
    margin-left: auto;
    flex-shrink: 0;
}

.msg-story-reply-block {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    margin-bottom: calc(6px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
    background: rgba(127, 127, 127, 0.12);
    border-left: 3px solid var(--primary);
}

.msg-story-reply-thumb {
    width: calc(32px * var(--ui-scale, 1));
    height: calc(32px * var(--ui-scale, 1));
    border-radius: calc(6px * var(--ui-scale, 1));
    object-fit: cover;
    flex-shrink: 0;
}

.msg-story-reply-text {
    font-size: calc(12.5px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-style: italic;
}

.quick-react-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: calc(38px * var(--ui-scale, 1));
    pointer-events: none;
    z-index: 3;
    animation: quickReactBurst 0.7s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes quickReactBurst {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }
    30% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    55% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -120%) scale(0.9);
        opacity: 0;
    }
}

.quick-reaction-swatch {
    background: var(--surface);
    border: calc(2px * var(--ui-scale, 1)) solid var(--glass-border);
    font-size: calc(22px * var(--ui-scale, 1));
}

.quick-reaction-swatch.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 15%, var(--surface));
}

.msg-swipe-reply-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: calc(26px * var(--ui-scale, 1));
    height: calc(26px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(12px * var(--ui-scale, 1));
    opacity: 0;
    pointer-events: none;
}

.tg-chat-description {
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    border-bottom: 1px solid var(--glass-border);
}

.msg-sticker-img {
    max-width: calc(160px * var(--ui-scale, 1));
    max-height: calc(160px * var(--ui-scale, 1));
    cursor: pointer;
}

.sticker-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));
    max-height: 60vh;
    overflow-y: auto;
}

.sticker-tile, .sticker-add-tile {
    aspect-ratio: 1;
    border-radius: calc(14px * var(--ui-scale, 1));
    overflow: hidden;
    cursor: pointer;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sticker-add-tile {
    border: calc(2px * var(--ui-scale, 1)) dashed var(--glass-border);
    color: var(--text-secondary);
    font-size: calc(20px * var(--ui-scale, 1));
}

.sticker-empty-hint {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    font-size: calc(12.5px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
}

.msg-voice {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1));
    min-width: calc(180px * var(--ui-scale, 1));
}

.msg-voice-play {
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--on-primary);
    font-size: calc(13px * var(--ui-scale, 1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-voice-wave {
    flex: 1;
    height: calc(28px * var(--ui-scale, 1));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(2px * var(--ui-scale, 1));
}

.msg-voice-bar {
    flex: 1;
    max-width: calc(3px * var(--ui-scale, 1));
    min-width: calc(2px * var(--ui-scale, 1));
    border-radius: calc(2px * var(--ui-scale, 1));
    background: var(--primary);
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.sent .msg-voice-bar {
    background: var(--text);
    opacity: 0.35;
}

.msg-voice-bar.played,
.sent .msg-voice-bar.played {
    opacity: 1;
}

.msg-voice-dur {
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.sticker-panel {
    background: var(--surface);
    border-top: 1px solid var(--glass-border);
    height: calc(260px * var(--ui-scale, 1));
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sticker-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    font-weight: 700;
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text);
    flex-shrink: 0;
    border-bottom: 1px solid var(--glass-border);
}

.sticker-panel-close {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: calc(15px * var(--ui-scale, 1));
}

.sticker-panel .sticker-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(8px * var(--ui-scale, 1));
}

.user-badge {
    font-size: calc(13px * var(--ui-scale, 1));
    vertical-align: -1px;
    display: inline;
}

.badge-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1)) 0;
}

.badge-option {
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
    border: calc(2px * var(--ui-scale, 1)) solid var(--glass-border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(18px * var(--ui-scale, 1));
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.badge-option.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 15%, var(--surface));
}

.comment-reply-block {
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--text-secondary);
    border-left: 3px solid var(--primary);
    padding-left: calc(8px * var(--ui-scale, 1));
    margin-bottom: calc(4px * var(--ui-scale, 1));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-reply-name {
    font-weight: 600;
    color: var(--primary);
}

.comment-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: calc(4px * var(--ui-scale, 1));
    margin-top: calc(4px * var(--ui-scale, 1));
}

.comment-action-row {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    margin-top: calc(5px * var(--ui-scale, 1));
}

.comment-action-btn {
    font-size: calc(11.5px * var(--ui-scale, 1));
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-emoji-btn {
    font-size: calc(16px * var(--ui-scale, 1));
    cursor: pointer;
    line-height: 1;
    padding: calc(2px * var(--ui-scale, 1));
    border-radius: calc(6px * var(--ui-scale, 1));
    transition: transform 0.1s ease;
}

.comment-emoji-btn:active {
    transform: scale(1.3);
}

.folder-tabs-wrap {
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 calc(8px * var(--ui-scale, 1));
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 var(--glass-border);
}

.folder-tabs-wrap::-webkit-scrollbar { display: none; }

.folder-tabs {
    display: flex;
    gap: calc(4px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) 0;
    width: max-content;
    min-width: 100%;
}

.folder-tab {
    display: flex;
    align-items: center;
    gap: calc(5px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));
    border-radius: calc(20px * var(--ui-scale, 1));
    font-size: calc(12.5px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.folder-tab:active {
    transform: scale(0.95);
}

.folder-tab.active {
    background: var(--primary);
    color: var(--on-primary);
}

.folder-tab i, .folder-tab-emoji {
    font-size: calc(12px * var(--ui-scale, 1));
}

.folder-tab-badge {
    background: var(--danger, #EF4444);
    color: var(--on-primary);
    font-size: calc(9.5px * var(--ui-scale, 1));
    font-weight: 700;
    padding: 0 calc(5px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    min-width: calc(16px * var(--ui-scale, 1));
    height: calc(16px * var(--ui-scale, 1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.folder-tab-edit {
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px dashed var(--glass-border);
}

.folder-manager-list {
    padding-bottom: calc(10px * var(--ui-scale, 1));
}

.folder-chat-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(9px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
    border-radius: calc(12px * var(--ui-scale, 1));
    border: 1px solid var(--glass-border);
    margin-bottom: calc(6px * var(--ui-scale, 1));
    cursor: pointer;
    font-size: calc(13.5px * var(--ui-scale, 1));
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, background 0.15s;
}

.folder-chat-chip.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    color: var(--primary);
    font-weight: 600;
}

.folder-chat-chip i {
    color: var(--primary);
}

.compact-mode .msg-wrap {
    margin-bottom: 0;
}

.compact-mode .msg-area {
    gap: calc(1px * var(--ui-scale, 1));
}

.compact-mode .msg-bub {
    padding: calc(6px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
    font-size: calc(13px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
}

.compact-mode .chat-item {
    padding: calc(7px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
}

.compact-mode .avatar {
    width: calc(36px * var(--ui-scale, 1));
    height: calc(36px * var(--ui-scale, 1));
    font-size: calc(13px * var(--ui-scale, 1));
}

.msg-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 250;
    animation: overlayIn 0.22s ease;
}

.msg-menu-react-strip {
    position: relative;
    max-width: min(calc(340px * var(--ui-scale, 1)), calc(100vw - 24px));
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.34s var(--spring);
}

.msg-menu-react-scroll {
    display: flex;
    gap: calc(2px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    overflow-x: auto;
    border-radius: inherit;
    scrollbar-width: none;
}

.msg-menu-react-strip::-webkit-scrollbar { display: none; }

.msg-menu-react-btn {
    font-size: calc(22px * var(--ui-scale, 1));
    flex-shrink: 0;
    padding: calc(3px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    cursor: pointer;
    transition: transform 0.15s var(--spring);
}

.msg-menu-react-btn:active {
    transform: scale(1.3);
}

.msg-menu-actions {
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: calc(22px * var(--ui-scale, 1));
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    min-width: calc(220px * var(--ui-scale, 1));
    animation: modalIn 0.34s var(--spring);
}

.msg-menu-action {
    display: flex;
    align-items: center;
    gap: calc(12px * var(--ui-scale, 1));
    padding: calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    font-size: calc(14px * var(--ui-scale, 1));
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.1s ease;
}

.msg-menu-action:last-child {
    border-bottom: none;
}

.msg-menu-action:active {
    background: var(--surface);
}

.msg-menu-action i {
    width: calc(18px * var(--ui-scale, 1));
    text-align: center;
    color: var(--text-secondary);
    font-size: calc(15px * var(--ui-scale, 1));
    flex-shrink: 0;
}

.msg-menu-action.danger {
    color: var(--danger);
}

.msg-menu-action.danger i {
    color: var(--danger);
}

.msg-menu-sep {
    height: 1px;
    background: var(--glass-border);
}

.comment-emoji-strip {
    display: flex;
    gap: calc(3px * var(--ui-scale, 1));
    overflow-x: auto;
    padding: calc(6px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    scrollbar-width: none;
    background: var(--surface);
    border-radius: calc(12px * var(--ui-scale, 1));
    margin: calc(4px * var(--ui-scale, 1)) 0;
    animation: pop 0.12s ease;
}

.comment-emoji-strip::-webkit-scrollbar { display: none; }

.msg-gif {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(20px * var(--ui-scale, 1));
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: overlayIn 0.22s ease;
}

.dialog {
    position: relative;
    width: 100%;
    max-width: calc(320px * var(--ui-scale, 1));
    padding: calc(24px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
    border-radius: calc(26px * var(--ui-scale, 1));
    background: var(--glass-fill-strong);
    backdrop-filter: blur(30px) saturate(1.5);
    -webkit-backdrop-filter: blur(30px) saturate(1.5);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    text-align: center;
    animation: modalIn 0.34s var(--spring);
}

.dialog-wide {
    max-width: calc(360px * var(--ui-scale, 1));
    max-height: 80vh;
    overflow-y: auto;
}

.dialog-text {
    margin-bottom: calc(18px * var(--ui-scale, 1));
    font-size: calc(15px * var(--ui-scale, 1));
    line-height: 1.45;
    white-space: pre-line;
}

.dialog-actions {
    display: flex;
    gap: calc(10px * var(--ui-scale, 1));
}

.dialog-btn {
    position: relative;
    flex: 1;
    height: calc(44px * var(--ui-scale, 1));
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: calc(14px * var(--ui-scale, 1));
    font-weight: 600;
    color: var(--on-primary);
    cursor: pointer;
    transition: transform 0.15s var(--spring);
}

.dialog-btn:active {
    transform: scale(0.95);
}

.dialog-btn.primary {
    background: var(--primary);
}

.dialog-btn.danger {
    background: var(--danger);
}

.dialog-btn.neutral {
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    color: var(--text);
}

.morph-fab::before,
.icon-button::before,
.cmp-btn::before,
.cmp-pill::before,
.cmp-lock::before,
.chat-capsule::before,
.scroll-bottom-btn::before,
.date-divider::before,
.reply-bar::before,
.attach-menu::before,
.bottom-nav::before,
.fab-new-chat::before,
.msg-menu-actions::before,
.msg-menu-react-strip::before,
.action-sheet::before,
.modal::before,
.big-modal::before,
.dialog:not(.dialog-wide)::before,
.dialog-btn.neutral::before,
.app-toast::before,
#screenMessages > .pinned-bar::before,
.fv-btn::before,
.fv-counter::before,
.avatar::before,
.msg-note::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(to bottom,
        var(--border-light) 0%,
        var(--border-dark) 30%,
        var(--border-dark) 70%,
        var(--border-light) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.msg-ticks.pending {
    opacity: 0.7;
}

.msg-wrap.failed .msg-bub {
    background: color-mix(in srgb, var(--danger) 22%, var(--message-out));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 55%, transparent);
}

.msg-failed-row {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale, 1));
    margin-top: calc(4px * var(--ui-scale, 1));
    font-size: calc(12px * var(--ui-scale, 1));
    color: var(--danger);
}

.msg-failed-btn {
    padding: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    border: none;
    border-radius: 999px;
    background: var(--glass-fill);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.offline-bar {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 1300;
    padding: calc(7px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
    border-radius: 999px;
    background: var(--glass-fill-strong);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-md);
    color: var(--text);
    font-size: calc(12.5px * var(--ui-scale, 1));
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -16px);
    transition: opacity 0.25s ease, transform 0.35s var(--spring);
}

.offline-bar.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.sheet-item {
    display: flex;
    align-items: center;
    gap: calc(14px * var(--ui-scale, 1));
    width: 100%;
    padding: calc(14px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
    border: none;
    border-top: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: calc(15px * var(--ui-scale, 1));
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sheet-item i {
    width: calc(22px * var(--ui-scale, 1));
    text-align: center;
    color: var(--text-secondary);
}

.sheet-item.danger,
.sheet-item.danger i {
    color: var(--danger);
}

.sheet-item:active {
    background: var(--hover);
}

.dialog-form {
    text-align: left;
}

.dialog-title {
    margin-bottom: calc(14px * var(--ui-scale, 1));
    font-size: calc(17px * var(--ui-scale, 1));
    font-weight: 700;
    text-align: center;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: calc(6px * var(--ui-scale, 1));
    margin-bottom: calc(12px * var(--ui-scale, 1));
    font-size: calc(12.5px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.form-row-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-size: calc(14px * var(--ui-scale, 1));
    color: var(--text);
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--ui-scale, 1));
    margin-bottom: calc(10px * var(--ui-scale, 1));
}

.dialog-form .dialog-actions {
    margin-top: calc(6px * var(--ui-scale, 1));
}

.dialog-form .dialog-text {
    margin-bottom: calc(8px * var(--ui-scale, 1));
    text-align: center;
}

.scheduled-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: calc(13.5px * var(--ui-scale, 1));
}

.scheduled-row span {
    display: block;
    color: var(--text-secondary);
}

.rights-list {
    max-height: calc(200px * var(--ui-scale, 1));
    overflow-y: auto;
}

.share-box .form-input {
    margin-bottom: calc(12px * var(--ui-scale, 1));
}

.share-qr {
    display: flex;
    justify-content: center;
    margin-bottom: calc(12px * var(--ui-scale, 1));
}

.share-qr svg {
    width: calc(180px * var(--ui-scale, 1));
    height: calc(180px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
    background: #fff;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: calc(6px * var(--ui-scale, 1));
    margin: calc(4px * var(--ui-scale, 1)) 0 calc(16px * var(--ui-scale, 1));
}

.onboarding-dots span {
    width: calc(7px * var(--ui-scale, 1));
    height: calc(7px * var(--ui-scale, 1));
    border-radius: 50%;
    background: var(--glass-border);
    transition: background 0.2s ease, transform 0.2s ease;
}

.onboarding-dots span.on {
    background: var(--primary);
    transform: scale(1.3);
}

.chat-flag {
    margin-left: calc(4px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    color: var(--text-secondary);
}

.chat-draft {
    color: var(--danger);
}

.chat-unread-badge.muted {
    background: var(--text-secondary);
    box-shadow: none;
}

.chat-item.pressing {
    transform: scale(0.97);
}

.msg-voice-speed {
    padding: calc(2px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
    border: none;
    border-radius: 999px;
    background: var(--glass-fill);
    color: var(--text);
    font-family: inherit;
    font-size: calc(11px * var(--ui-scale, 1));
    font-weight: 700;
    cursor: pointer;
}

.msg-code {
    padding: 1px calc(5px * var(--ui-scale, 1));
    border-radius: calc(6px * var(--ui-scale, 1));
    background: rgba(128, 128, 128, 0.22);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.msg-code-block {
    display: block;
    margin: calc(4px * var(--ui-scale, 1)) 0;
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    border-radius: calc(10px * var(--ui-scale, 1));
    background: rgba(128, 128, 128, 0.22);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    overflow-x: auto;
}

.msg-link {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
}

.msg-poll {
    min-width: calc(220px * var(--ui-scale, 1));
}

.msg-poll-q {
    margin-bottom: calc(2px * var(--ui-scale, 1));
    font-weight: 700;
}

.msg-poll-hint {
    margin-bottom: calc(6px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    opacity: 0.7;
}

.msg-poll-opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale, 1));
    width: 100%;
    margin-bottom: calc(6px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: calc(12px * var(--ui-scale, 1));
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
}

.msg-poll-bar {
    position: absolute;
    inset: 0 auto 0 0;
    background: color-mix(in srgb, var(--primary) 30%, transparent);
    transition: width 0.35s var(--ease-out);
}

.msg-poll-mark {
    position: relative;
    flex-shrink: 0;
    width: calc(14px * var(--ui-scale, 1));
    height: calc(14px * var(--ui-scale, 1));
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0.6;
}

.msg-poll-opt.mine .msg-poll-mark {
    background: var(--primary);
    border-color: var(--primary);
    opacity: 1;
}

.msg-poll-text {
    position: relative;
    flex: 1;
}

.msg-poll-pct {
    position: relative;
    font-size: calc(12px * var(--ui-scale, 1));
    font-weight: 700;
}

.chat-search {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.35s var(--spring);
}

.chat-search.show {
    opacity: 1;
    transform: none;
}

.chat-search-field {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale, 1));
    height: calc(44px * var(--ui-scale, 1));
    padding: 0 calc(16px * var(--ui-scale, 1));
    border-radius: 999px;
    background: var(--glass-fill);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
}

.chat-search-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: calc(14.5px * var(--ui-scale, 1));
}

.chat-search-field span {
    font-size: calc(12px * var(--ui-scale, 1));
    white-space: nowrap;
}

#screenMessages.search-open > .header {
    opacity: 0;
    pointer-events: none;
}

.search-hit {
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm) !important;
}

.chat-menu::before {
    display: none;
}

.attach-menu.show .attach-menu-item:nth-child(n+5) {
    transition-delay: 0.2s, 0.2s, 0s;
}

.msg-note {
    position: relative;
    width: calc(200px * var(--ui-scale, 1));
    height: calc(200px * var(--ui-scale, 1));
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: #000;
    box-shadow: var(--shadow-md);
}

.msg-note-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-note-badge {
    position: absolute;
    top: calc(8px * var(--ui-scale, 1));
    left: calc(8px * var(--ui-scale, 1));
    padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    border-radius: 999px;
    background: color-mix(in srgb, #000 45%, transparent);
    color: #fff;
    font-size: calc(11px * var(--ui-scale, 1));
    font-variant-numeric: tabular-nums;
}

.msg-note.playing .msg-note-badge {
    opacity: 0;
}

body.glass-flat,
body.glass-flat .app {
    --glass: var(--message-in);
    --glass-fill: var(--message-in);
    --glass-fill-strong: var(--message-in);
    --blur: none;
}

body.glass-flat *,
body.glass-flat *::before,
body.glass-flat *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.glass-liquid,
body.glass-liquid .app {
    --glass-fill: color-mix(in srgb, var(--message-in) 40%, transparent);
    --glass-fill-strong: color-mix(in srgb, var(--message-in) 66%, transparent);
}

.lg {
  box-shadow: var(--panel-shadow) !important;
}

.msg-menu-overlay .msg-bub {
    box-shadow: var(--shadow-lg);
}

.msg-removing {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.attach-menu:not(.show),
.app-toast:not(.show),
.offline-bar:not(.show),
[data-mode=idle] .cmp-lock,
[data-mode=preview] .cmp-lock,
[data-mode=rec-lock] .cmp-lock {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

@keyframes overlayOut {
    to {
        opacity: 0;
    }
}

@keyframes modalOut {
    to {
        opacity: 0;
        transform: translateY(10px) scale(0.94);
    }
}

.closing {
    pointer-events: none;
    animation: overlayOut 0.22s ease forwards;
}

.closing > .dialog,
.closing > .action-sheet,
.closing > .big-modal,
.closing > .modal,
.closing > .msg-menu-react-strip,
.closing > .msg-menu-actions,
.closing.comments-overlay,
.closing.story-viewer-overlay,
.closing.camera-overlay {
    animation: modalOut 0.22s ease forwards;
}

.cmp-circle {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(70vw, calc(280px * var(--ui-scale, 1)));
    height: min(70vw, calc(280px * var(--ui-scale, 1)));
    padding: 4px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.2) 0);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.7);
    transition: opacity 0.25s ease, transform 0.42s var(--spring);
    z-index: 500;
}

[data-cam="1"] .cmp-circle {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cmp-circle video {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #000;
    transform: scaleX(-1);
}

.cmp-cam-text {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: calc(14px * var(--ui-scale, 1));
}

[data-cam="1"] .cmp-hint {
    opacity: 0;
}

[data-cam="1"] .cmp-cam-text {
    display: flex;
}

.cmp-preview-label {
    font-size: calc(13px * var(--ui-scale, 1));
    color: var(--text-secondary);
    white-space: nowrap;
}

.cmp-preview:has(#composerCircleVideo[src]) .cmp-preview-wave,
.cmp-preview:has(#composerCircleVideo[src]) .cmp-play i {
    display: none;
}

.cmp-ico-cam {
    color: var(--text);
    font-size: calc(17px * var(--ui-scale, 1));
}

.msg-file {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    min-width: calc(220px * var(--ui-scale, 1));
    max-width: calc(280px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1));
    border-radius: calc(14px * var(--ui-scale, 1));
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.msg-file-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(40px * var(--ui-scale, 1));
    height: calc(40px * var(--ui-scale, 1));
    border-radius: calc(12px * var(--ui-scale, 1));
    background: color-mix(in srgb, var(--primary) 22%, transparent);
    color: var(--primary);
    font-size: calc(17px * var(--ui-scale, 1));
}

.msg-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.msg-file-name {
    font-size: calc(13.5px * var(--ui-scale, 1));
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-file-size {
    font-size: calc(11.5px * var(--ui-scale, 1));
    opacity: 0.65;
}

.msg-file-download {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(28px * var(--ui-scale, 1));
    height: calc(28px * var(--ui-scale, 1));
    border-radius: 50%;
    background: color-mix(in srgb, var(--text) 10%, transparent);
    font-size: calc(11px * var(--ui-scale, 1));
}

.badge-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(15px * var(--ui-scale, 1));
    height: calc(15px * var(--ui-scale, 1));
    border-radius: 50%;
    vertical-align: -3px;
    font-size: calc(9px * var(--ui-scale, 1));
    color: rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.cropper-dialog {
    max-width: calc(340px * var(--ui-scale, 1));
}

.cropper-stage {
    position: relative;
    width: 100%;
    height: calc(220px * var(--ui-scale, 1));
    margin-bottom: calc(10px * var(--ui-scale, 1));
    overflow: hidden;
    border-radius: calc(16px * var(--ui-scale, 1));
    background: #000;
    touch-action: none;
    cursor: grab;
}

.cropper-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cropper-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.001);
    pointer-events: none;
}

.cropper-frame.is-circle {
    border-radius: 50%;
}

.cropper-frame.is-rect {
    border-radius: calc(10px * var(--ui-scale, 1));
}

.cropper-zoom {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale, 1));
    margin-bottom: calc(16px * var(--ui-scale, 1));
    color: var(--text-secondary);
    font-size: calc(13px * var(--ui-scale, 1));
}

.cropper-zoom .form-range {
    flex: 1;
    margin: 0;
}

.has-spotlight {
  scale: 1;
  transition: scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), translate 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.has-spotlight.is-dragging {
  transition: scale 0.08s linear, translate 0s linear;
}
.has-spotlight::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle 140px at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(255,255,255,0.13) 0%, rgba(255,255,255,0.06) 40%, rgba(255,255,255,0.02) 70%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.dark-theme .has-spotlight::after {
  background: radial-gradient(circle 140px at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 40%, rgba(255,255,255,0.01) 70%, transparent 100%);
}
.has-spotlight.is-pressed::after { opacity: 1; }
body.glass-flat .has-spotlight::after { display: none; }

.anim-value {
  display: inline-grid;
  grid-template-columns: auto;
  overflow: hidden;
  vertical-align: middle;
  height: 1.4em;
  line-height: 1.4;
  min-width: var(--min-w, 1ch);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
}
.anim-value > .anim-item {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes shake {
  0% { transform: translateX(0) translateY(0); }
  20% { transform: translateX(-2.5px) translateY(1.5px); }
  40% { transform: translateX(2.5px) translateY(-1.5px); }
  60% { transform: translateX(-2px) translateY(1px); }
  80% { transform: translateX(2px) translateY(-1px); }
  100% { transform: translateX(0) translateY(0); }
}
.shake { animation: shake 0.2s ease-in-out; }

.morph-fab {
  position: absolute;
  right: calc(18px * var(--ui-scale, 1));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--glass-fill-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--panel-shadow);
  cursor: pointer;
  z-index: 30;
  scale: 1;
  transition: background 0.4s ease, box-shadow 0.4s ease, scale 0.5s var(--spring), translate 0.5s var(--spring);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.morph-fab.is-dragging {
  transition: background 0.4s ease, box-shadow 0.4s ease, scale 0.08s linear, translate 0s linear;
}
.morph-fab .layer-closed {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  z-index: 2;
  color: var(--primary);
  font-size: calc(20px * var(--ui-scale, 1));
}
.morph-fab .layer-open {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(240px * var(--ui-scale, 1));
  height: calc(232px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(14px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  gap: 2px;
  pointer-events: none;
  opacity: 0;
  filter: blur(12px);
  transform: scale(0.95);
  z-index: 2;
}
.morph-fab.open .layer-open { pointer-events: auto; }
.morph-fab .menu-item {
  display: flex;
  align-items: center;
  gap: calc(14px * var(--ui-scale, 1));
  color: var(--text);
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 600;
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  background: transparent;
  border: none;
  border-radius: calc(14px * var(--ui-scale, 1));
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.1s ease, color 0.2s ease;
}
.morph-fab .menu-item i {
  color: var(--primary);
  width: calc(20px * var(--ui-scale, 1));
  text-align: center;
  font-size: calc(17px * var(--ui-scale, 1));
}
.morph-fab .menu-item:active { transform: scale(0.98); }
body.glass-flat .morph-fab {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.bottom-nav,
.nav-item,
.toggle,
.toggle-thumb,
.icon-button,
.chat-capsule,
.scroll-bottom-btn,
.morph-fab {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --border-light: rgba(255, 255, 255, 0.7);
  --border-dark: rgba(0, 0, 0, 0.08);
}
.dark-theme {
  --border-light: rgba(255, 255, 255, 0.11);
  --border-dark: rgba(0, 0, 0, 0.35);
}
.icon-button::before,
.cmp-btn::before,
.cmp-pill::before,
.cmp-lock::before,
.chat-capsule::before,
.scroll-bottom-btn::before,
.date-divider::before,
.reply-bar::before,
.attach-menu::before,
.bottom-nav::before,
.fab-new-chat::before,
.morph-fab::before,
.msg-menu-actions::before,
.msg-menu-react-strip::before,
.action-sheet::before,
.modal::before,
.big-modal::before,
.dialog:not(.dialog-wide)::before,
.dialog-btn.neutral::before,
.app-toast::before,
#screenMessages > .pinned-bar::before,
.fv-btn::before,
.fv-counter::before,
.avatar::before,
.msg-note::before {
  background: linear-gradient(to bottom,
    var(--border-light) 0%,
    var(--border-dark) 30%,
    var(--border-dark) 70%,
    var(--border-light) 100%);
}

.morph-fab::before,
.fab-new-chat::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(to bottom,
    var(--border-light) 0%,
    var(--border-dark) 30%,
    var(--border-dark) 70%,
    var(--border-light) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

body.glass-flat .has-spotlight::after {
  display: block;
}

.cmp-pill:focus-within {
  box-shadow: var(--shadow-sm);
}

@keyframes menuItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.action-sheet .sheet-item {
  animation: menuItemIn 0.25s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.action-sheet .sheet-item:nth-child(1) { animation-delay: 0.21s; }
.action-sheet .sheet-item:nth-child(2) { animation-delay: 0.24s; }
.action-sheet .sheet-item:nth-child(3) { animation-delay: 0.27s; }
.action-sheet .sheet-item:nth-child(4) { animation-delay: 0.30s; }
.action-sheet .sheet-item:nth-child(5) { animation-delay: 0.33s; }
.action-sheet .sheet-item:nth-child(6) { animation-delay: 0.36s; }
.action-sheet .sheet-item:nth-child(7) { animation-delay: 0.39s; }
.action-sheet .sheet-item:nth-child(8) { animation-delay: 0.42s; }
.msg-menu-actions .msg-menu-action {
  animation: menuItemIn 0.25s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.msg-menu-actions .msg-menu-action:nth-child(1) { animation-delay: 0.21s; }
.msg-menu-actions .msg-menu-action:nth-child(2) { animation-delay: 0.24s; }
.msg-menu-actions .msg-menu-action:nth-child(3) { animation-delay: 0.27s; }
.msg-menu-actions .msg-menu-action:nth-child(4) { animation-delay: 0.30s; }
.msg-menu-actions .msg-menu-action:nth-child(5) { animation-delay: 0.33s; }
.msg-menu-actions .msg-menu-action:nth-child(6) { animation-delay: 0.36s; }
.msg-menu-actions .msg-menu-action:nth-child(7) { animation-delay: 0.39s; }
.msg-menu-actions .msg-menu-action:nth-child(8) { animation-delay: 0.42s; }

:root {
  --primary: #1C1C1E;
  --primary-dark: #000000;
  --primary-glow: rgba(0, 0, 0, 0.18);
  --on-primary: #FFFFFF;
  --bg: #F2F2F7;
  --surface: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.5);
  --glass-fill: rgba(255, 255, 255, 0.55);
  --glass-fill-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(0, 0, 0, 0.08);
  --chat-bg: #E9E9EE;
  --text: #1C1C1E;
  --text-secondary: #6E6E73;
  --hover: rgba(0, 0, 0, 0.05);
  --message-out: #D8D8DC;
  --message-in: #FFFFFF;
  --danger: #48484A;
  --toggle-thumb: #FFFFFF;
  --toggle-thumb-active: #FFFFFF;
  --blur-val: 22px;
  --blur: blur(var(--blur-val)) saturate(1.5);
  --border-light: rgba(255, 255, 255, 0.7);
  --border-dark: rgba(0, 0, 0, 0.08);
  --glow-color: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.15);
  --panel-shadow:
    0 10px 30px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03),
    inset 0 5px 8px -4px var(--glow-color),
    inset 0 -5px 8px -4px var(--glow-color);
}

.dark-theme {
  --primary: #F2F2F7;
  --primary-dark: #FFFFFF;
  --primary-glow: rgba(255, 255, 255, 0.16);
  --on-primary: #000000;
  --bg: #000000;
  --surface: rgba(28, 28, 30, 0.72);
  --glass: rgba(28, 28, 30, 0.5);
  --glass-fill: rgba(255, 255, 255, 0.07);
  --glass-fill-strong: rgba(28, 28, 30, 0.72);
  --glass-border: rgba(255, 255, 255, 0.10);
  --chat-bg: #000000;
  --text: #F2F2F7;
  --text-secondary: #98989D;
  --hover: rgba(255, 255, 255, 0.08);
  --message-out: #2C2C2E;
  --message-in: #1C1C1E;
  --danger: #98989D;
  --toggle-thumb: #FFFFFF;
  --toggle-thumb-active: #000000;
  --border-light: rgba(255, 255, 255, 0.11);
  --border-dark: rgba(0, 0, 0, 0.35);
  --glow-color: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --panel-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 5px 8px -4px var(--glow-color),
    inset 0 -5px 8px -4px var(--glow-color);
}

.icon-button::before,
.cmp-btn::before,
.cmp-pill::before,
.cmp-lock::before,
.chat-capsule::before,
.chat-search-field::before,
.scroll-bottom-btn::before,
.date-divider::before,
.reply-bar::before,
.attach-menu::before,
.bottom-nav::before,
.fab-new-chat::before,
.morph-fab::before,
.msg-menu-actions::before,
.msg-menu-react-strip::before,
.action-sheet::before,
.modal::before,
.big-modal::before,
.dialog:not(.dialog-wide)::before,
.dialog-btn.neutral::before,
.app-toast::before,
.offline-bar::before,
#screenMessages > .pinned-bar::before,
.fv-btn::before,
.fv-counter::before,
.msg-note::before {
  content: '' !important;
  position: absolute !important;
  inset: 0 !important;
  padding: 1px !important;
  border-radius: inherit !important;
  background: linear-gradient(to bottom,
    var(--border-light) 0%,
    var(--border-dark) 30%,
    var(--border-dark) 70%,
    var(--border-light) 100%) !important;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0) !important;
  -webkit-mask-composite: xor !important;
  mask-composite: exclude !important;
  pointer-events: none !important;
  z-index: 3 !important;
  display: block !important;
  opacity: 1 !important;
}

body.glass-flat .icon-button::before,
body.glass-flat .cmp-btn::before,
body.glass-flat .cmp-pill::before,
body.glass-flat .chat-capsule::before,
body.glass-flat .attach-menu::before,
body.glass-flat .bottom-nav::before,
body.glass-flat .morph-fab::before,
body.glass-flat .action-sheet::before,
body.glass-flat .big-modal::before,
body.glass-flat .msg-menu-actions::before,
body.glass-flat .dialog:not(.dialog-wide)::before {
  display: block !important;
  opacity: 1 !important;
}

.has-spotlight {
  scale: 1;
  transition:
    scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    translate 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.has-spotlight.is-dragging {
  transition: scale 0.08s linear, translate 0s linear;
}
.has-spotlight::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle 140px at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(255,255,255,0.13) 0%, rgba(255,255,255,0.06) 40%, rgba(255,255,255,0.02) 70%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.dark-theme .has-spotlight::after {
  background: radial-gradient(circle 140px at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 40%, rgba(255,255,255,0.01) 70%, transparent 100%);
}
.has-spotlight.is-pressed::after { opacity: 1; }
body.glass-flat .has-spotlight::after { display: block !important; }

.nav-pill, #navPill { display: none !important; }
.nav-pill::before, .nav-pill.held::before { display: none !important; }
.avatar::before, .msg-avatar::before { display: none !important; }
.story-tap-zone { display: none !important; }

* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
*::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; background: transparent !important; }
*::-webkit-scrollbar-thumb { display: none !important; background: transparent !important; }
*::-webkit-scrollbar-track { display: none !important; background: transparent !important; }

.header {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.screen { position: relative; }
.screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(96px * var(--ui-scale, 1));
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 82%, transparent),
    transparent);
  pointer-events: none;
  z-index: 4;
}
.screen > .header { position: relative; z-index: 6; }

.header .icon-button {
  width: calc(44px * var(--ui-scale, 1)) !important;
  height: calc(44px * var(--ui-scale, 1)) !important;
  min-width: calc(44px * var(--ui-scale, 1)) !important;
  min-height: calc(44px * var(--ui-scale, 1)) !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
}
.header .icon-button svg { width: 20px; height: 20px; }
.header .icon-button i { font-size: 18px; line-height: 1; }

.cmp-pill:focus-within { box-shadow: var(--shadow-sm) !important; }
.cmp-pill textarea:focus,
.msg-input:focus,
.search-input:focus,
.form-input:focus { outline: none !important; box-shadow: none !important; }

@keyframes menuItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.action-sheet .sheet-item,
.msg-menu-actions .msg-menu-action,
.attach-menu .attach-menu-item {
  animation: menuItemIn 0.25s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.action-sheet .sheet-item:nth-child(1),
.msg-menu-actions .msg-menu-action:nth-child(1),
.attach-menu .attach-menu-item:nth-child(1) { animation-delay: 0.21s; }
.action-sheet .sheet-item:nth-child(2),
.msg-menu-actions .msg-menu-action:nth-child(2),
.attach-menu .attach-menu-item:nth-child(2) { animation-delay: 0.24s; }
.action-sheet .sheet-item:nth-child(3),
.msg-menu-actions .msg-menu-action:nth-child(3),
.attach-menu .attach-menu-item:nth-child(3) { animation-delay: 0.27s; }
.action-sheet .sheet-item:nth-child(4),
.msg-menu-actions .msg-menu-action:nth-child(4),
.attach-menu .attach-menu-item:nth-child(4) { animation-delay: 0.30s; }
.action-sheet .sheet-item:nth-child(5),
.msg-menu-actions .msg-menu-action:nth-child(5),
.attach-menu .attach-menu-item:nth-child(5) { animation-delay: 0.33s; }
.action-sheet .sheet-item:nth-child(6),
.msg-menu-actions .msg-menu-action:nth-child(6),
.attach-menu .attach-menu-item:nth-child(6) { animation-delay: 0.36s; }
.action-sheet .sheet-item:nth-child(7),
.msg-menu-actions .msg-menu-action:nth-child(7),
.attach-menu .attach-menu-item:nth-child(7) { animation-delay: 0.39s; }
.action-sheet .sheet-item:nth-child(8),
.msg-menu-actions .msg-menu-action:nth-child(8),
.attach-menu .attach-menu-item:nth-child(8) { animation-delay: 0.42s; }

.anim-value {
  display: inline-grid;
  grid-template-columns: auto;
  overflow: hidden;
  vertical-align: middle;
  height: 1.4em;
  line-height: 1.4;
  min-width: var(--min-w, 1ch);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
}
.anim-value > .anim-item {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes shake {
  0% { transform: translateX(0) translateY(0); }
  20% { transform: translateX(-2.5px) translateY(1.5px); }
  40% { transform: translateX(2.5px) translateY(-1.5px); }
  60% { transform: translateX(-2px) translateY(1px); }
  80% { transform: translateX(2px) translateY(-1px); }
  100% { transform: translateX(0) translateY(0); }
}
.shake { animation: shake 0.2s ease-in-out; }

.morph-fab {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--glass-fill-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--panel-shadow);
  cursor: pointer;
  z-index: 30;
  scale: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.4s ease, box-shadow 0.4s ease, scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), translate 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.morph-fab.is-dragging {
  transition: background 0.4s ease, box-shadow 0.4s ease, scale 0.08s linear, translate 0s linear;
}
.morph-fab .layer-closed {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 1;
  z-index: 2;
  color: var(--primary);
  font-size: calc(20px * var(--ui-scale, 1));
}
.morph-fab .layer-open {
  position: absolute;
  top: 0; left: 0;
  width: calc(240px * var(--ui-scale, 1));
  height: calc(232px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(14px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  gap: 2px;
  pointer-events: none;
  opacity: 0;
  filter: blur(12px);
  transform: scale(0.95);
  z-index: 2;
}
.morph-fab.open .layer-open { pointer-events: auto; }
.morph-fab .menu-item {
  display: flex;
  align-items: center;
  gap: calc(14px * var(--ui-scale, 1));
  color: var(--text);
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 600;
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  background: transparent;
  border: none;
  border-radius: calc(14px * var(--ui-scale, 1));
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.1s ease, color 0.2s ease;
}
.morph-fab .menu-item i {
  color: var(--primary);
  width: calc(20px * var(--ui-scale, 1));
  text-align: center;
  font-size: calc(17px * var(--ui-scale, 1));
}
.morph-fab .menu-item:active { transform: scale(0.98); }
body.glass-flat .morph-fab {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sticker-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px;
  padding: 8px 0;
}
.sticker-pack-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
}
.sticker-pack-item img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.sticker-pack-item:active { transform: scale(0.94); }
.sticker-pack-delete {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.camera-flip {
  position: absolute;
  right: 14px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 3;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.camera-flip:active { transform: scale(0.94); }
.camera-zoom-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(154px + env(safe-area-inset-bottom, 0px));
  width: min(70%, 320px);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 3;
}
.camera-zoom-wrap i { font-size: 12px; opacity: 0.85; }
.camera-zoom-wrap input[type="range"] { flex: 1; accent-color: #fff; height: 4px; }

.story-progress-row {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  gap: 3px;
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  z-index: 5;
  pointer-events: none;
}
.story-progress-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 0 2px 2px 0;
}
.story-progress-fill.full { width: 100%; }

.status-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  margin-left: 3px;
  height: 1em;
  vertical-align: bottom;
}
.status-dots i {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.28;
  animation: statusDotPulse 1.25s ease-in-out infinite;
}
.status-dots i:nth-child(2) { animation-delay: 0.14s; }
.status-dots i:nth-child(3) { animation-delay: 0.28s; }
@keyframes statusDotPulse {
  0%, 80%, 100% { opacity: 0.22; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

#cancelSelectBtn,
#forwardSelectedBtn,
#deleteSelectedBtn {
  display: none !important;
}

body.selection-mode #cancelSelectBtn,
body.selection-mode #forwardSelectedBtn,
body.selection-mode #deleteSelectedBtn {
  display: grid !important;
}

.camera-video {
  transform-origin: center center;
}

.camera-video.camera-front,
.camera-video[data-facing="user"] {
  transform: scaleX(-1);
}

.camera-video.camera-rear,
.camera-video[data-facing="environment"] {
  transform: none;
}

.icon-button:active,
.cmp-btn:active,
.cmp-lock:active,
.nav-item:active,
.dt-nav-btn:active,
.chat-item:active,
.settings-row:active,
.sheet-item:active,
.attach-menu-item:active,
.msg-menu-action:active,
.sticker-grid-item:active,
.sticker-strip-item:active,
.sticker-pack-item:active,
.morph-fab .menu-item:active,
.fv-btn:active,
.camera-shutter:active,
.camera-flip:active,
.tg-action-btn:active,
.member-row:active,
.dialog-btn:active,
.btn:active {
  transform: scale(1.035) !important;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.icon-button,
.cmp-btn,
.cmp-lock,
.nav-item,
.dt-nav-btn,
.chat-item,
.settings-row,
.sheet-item,
.attach-menu-item,
.msg-menu-action,
.sticker-grid-item,
.sticker-strip-item,
.sticker-pack-item,
.morph-fab .menu-item,
.fv-btn,
.camera-shutter,
.camera-flip,
.tg-action-btn,
.member-row,
.dialog-btn,
.btn {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease !important;
}

.sticker-panel-overlay {
  z-index: 330;
}

.sticker-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48vh;
  max-height: 88vh;
  background: var(--glass-fill-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-top: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 331;
  animation: stickerPanelIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.sticker-panel.expanded {
  height: 84vh;
}

@keyframes stickerPanelIn {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sticker-panel-header {
  position: relative;
  height: calc(56px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
}

.sticker-panel-header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 18%, transparent);
}

.sticker-panel-close {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.sticker-panel-title {
  font-weight: 700;
  font-size: calc(15px * var(--ui-scale, 1));
  color: var(--text);
}

.sticker-pack-strip {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 12px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.sticker-strip-item {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: none;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border-radius: 16px;
  padding: 4px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.sticker-strip-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}

.sticker-strip-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 9px;
  line-height: 1;
  color: #fff;
  background: rgba(0,0,0,0.45);
  padding: 3px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticker-panel-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px calc(18px + env(safe-area-inset-bottom, 0px));
}

.sticker-section-title {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--text-secondary);
  margin: 10px 4px 8px;
}

.sticker-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 4px 8px;
}

.sticker-section-head .sticker-section-title {
  margin: 0;
}

.sticker-pack-qr-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  font-size: 14px !important;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.sticker-grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
}

.sticker-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sticker-fav-mark {
  position: absolute;
  right: 4px;
  top: 4px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}

.sticker-panel-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.feed-dev-card {
  margin: 18px 14px;
  padding: 20px 18px;
  border-radius: 24px;
  background: var(--glass-fill-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.feed-dev-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  font-size: 22px;
}

.feed-dev-title {
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 8px;
}

.feed-dev-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.feed-mention-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.mention-suggestions {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  max-height: 230px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 20px;
  background: var(--glass-fill-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg);
  z-index: 35;
}

.mention-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.mention-item.active,
.mention-item:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.mention-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.mention-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mention-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mention-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-username {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*фикс*/
.has-spotlight {
  transition:
    scale 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    translate 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.has-spotlight.is-dragging {
  transition:
    scale 0.07s linear,
    translate 0s linear,
    transform 0.07s linear;
}

@media (hover: hover) {
  .icon-button:hover:not(:active),
  .cmp-btn:hover:not(:active),
  .chat-capsule:hover:not(:active),
  .scroll-bottom-btn:hover:not(:active),
  .morph-fab:hover:not(:active) {
    background: color-mix(in srgb, var(--glass-fill-strong) 90%, var(--text)) !important;
  }
}

.icon-button:active,
.cmp-btn:active,
.chat-capsule:active,
.scroll-bottom-btn:active,
.morph-fab:active {
  background: var(--glass-fill-strong) !important;
}

@keyframes composerIconSway {
    0% {
        transform: rotate(0deg) scale(1);
    }
    22% {
        transform: rotate(-10deg) scale(1.08);
    }
    48% {
        transform: rotate(8deg) scale(0.96);
    }
    72% {
        transform: rotate(-4deg) scale(1.03);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

.cmp-btn.cmp-sway .cmp-ico,
.cmp-btn.cmp-sway .cmp-ico i,
.cmp-btn.cmp-sway .cmp-ico svg {
    transform-origin: center center;
    animation: composerIconSway 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes composerIconSway {
    0% {
        transform: rotate(0deg) scale(1);
    }
    26% {
        transform: rotate(-6deg) scale(1.045);
    }
    54% {
        transform: rotate(4deg) scale(0.985);
    }
    78% {
        transform: rotate(-2deg) scale(1.015);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

.cmp-sway-icon {
    transform-origin: 50% 50%;
    animation: composerIconSway 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

#sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-mic {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-cam {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#sendBtn[data-state="mic"][data-kind="video"] .cmp-ico-cam {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#sendBtn[data-state="mic"][data-kind="video"] .cmp-ico-mic {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#inputContainer[data-cam="1"] #sendBtn[data-state="mic"] .cmp-ico-cam {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer[data-cam="1"] #sendBtn[data-state="mic"] .cmp-ico-mic {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#inputContainer:not([data-cam="1"]) #sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-mic {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer:not([data-cam="1"]) #sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-cam {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/*кнопочки*/
#inputContainer #sendBtn .cmp-ico {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#inputContainer #sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-mic,
#inputContainer #sendBtn[data-state="mic"]:not([data-kind="video"]) .cmp-ico-mic {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer #sendBtn[data-state="mic"][data-kind="video"] .cmp-ico-cam {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer #sendBtn[data-state="send"] .cmp-ico-send {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer #sendBtn[data-state="hold"] .cmp-ico-stop,
#inputContainer #sendBtn[data-state="stop"] .cmp-ico-stop {
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#inputContainer[data-cam="1"] #sendBtn[data-state="mic"][data-kind="voice"] .cmp-ico-cam,
#inputContainer:not([data-cam="1"]) #sendBtn[data-state="mic"][data-kind="video"] .cmp-ico-mic {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#sendBtn .cmp-ico i,
#sendBtn .cmp-ico svg {
    display: block;
    line-height: 1;
    font-size: inherit;
}

#sendBtn .cmp-stop-square {
    display: block;
    width: 13px;
    height: 13px;
    border-radius: 3px;
    background: currentColor;
}

/*затемнение фона при записи кружка*/
body.composer-recording-ui #inputContainer {
    position: relative;
    z-index: 2147483000 !important;
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
}

body.composer-recording-ui #inputContainer *,
body.composer-recording-ui .input-container,
body.composer-recording-ui .input-container *,
body.composer-recording-ui .input-row,
body.composer-recording-ui .input-row *,
body.composer-recording-ui .cmp-pill,
body.composer-recording-ui .cmp-pill *,
body.composer-recording-ui .cmp-btn,
body.composer-recording-ui .cmp-btn *,
body.composer-recording-ui .cmp-rec,
body.composer-recording-ui .cmp-rec *,
body.composer-recording-ui .cmp-preview,
body.composer-recording-ui .cmp-preview *,
body.composer-recording-ui .cmp-circle,
body.composer-recording-ui .cmp-circle *,
body.composer-recording-ui .cmp-lock,
body.composer-recording-ui .cmp-lock *,
body.composer-recording-ui .cmp-halo,
body.composer-recording-ui .cmp-halo *,
body.composer-recording-ui .cmp-hint,
body.composer-recording-ui .cmp-hint *,
body.composer-recording-ui #composerRecTime,
body.composer-recording-ui #composerLive,
body.composer-recording-ui #composerPlay,
body.composer-recording-ui #composerPreviewWave,
body.composer-recording-ui #composerPreviewTime {
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
}

body.composer-recording-ui .screen,
body.composer-recording-ui #screenMessages,
body.composer-recording-ui .header,
body.composer-recording-ui .pinned-bar,
body.composer-recording-ui .input-container {
    opacity: 1 !important;
    filter: none !important;
}

body.composer-recording-ui .msg-area {
    opacity: 0.42 !important;
}

body.composer-recording-ui .voice-recording-backdrop,
body.composer-recording-ui .recording-backdrop,
body.composer-recording-ui .record-dim,
body.composer-recording-ui .dim-overlay,
body.composer-recording-ui .composer-dim,
body.composer-recording-ui .msg-area::after {
    z-index: 1 !important;
    pointer-events: none !important;
}