html,
body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--tg-viewport-height, 100dvh);
    height: 100vh;
    height: 100dvh;
    height: var(--tg-viewport-height, 100dvh);
    background: var(--tg-bg);
    color: var(--tg-text);
    overflow: hidden;
}

.tg-app {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--tg-viewport-height, 100dvh);
    height: 100vh;
    height: 100dvh;
    height: var(--tg-viewport-height, 100dvh);
    width: min(520px, calc(100vw - 8px));
    max-width: 100vw;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    --tg-topbar-height: calc(env(safe-area-inset-top, 0px) + 66px);
}

html.tg-platform-mobile .tg-app {
    width: 100vw;
    margin: 0;
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-app {
        width: 100vw;
        margin: 0;
    }
}

.tg-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.tg-bg__wallpaper {
    position: absolute;
    inset: 0;
    opacity: 1;
    background-size: cover;
    background-position: center;
    filter: saturate(1.02) contrast(1.01);
    transform: scale(1.005);
}

.tg-bg__mesh {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(8, 14, 23, var(--tg-wallpaper-overlay-opacity, 0)),
        rgba(8, 14, 23, var(--tg-wallpaper-overlay-opacity, 0))
    );
}

.tg-topbar,
.tg-composer,
.tg-chat {
    position: relative;
    z-index: 1;
}

.tg-app > .tg-bg,
.tg-app > .tg-topbar,
.tg-app > .tg-chat,
.tg-app > .tg-composer {
    transition: filter 0.22s ease, opacity 0.22s ease;
}

.tg-app.is-modal-blurred > .tg-bg,
.tg-app.is-modal-blurred > .tg-topbar,
.tg-app.is-modal-blurred > .tg-chat,
.tg-app.is-modal-blurred > .tg-composer {
    filter: blur(8px) saturate(0.86) brightness(0.82);
}

.tg-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
    isolation: isolate;
}

.tg-topbar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: calc(var(--tg-topbar-height) + 20px);
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(12, 21, 34, 0.92) 0%,
        rgba(12, 21, 34, 0.74) 36%,
        rgba(12, 21, 34, 0.44) 68%,
        rgba(12, 21, 34, 0.16) 88%,
        rgba(12, 21, 34, 0) 100%
    );
}

.tg-topbar > * {
    position: relative;
    z-index: 1;
}

.tg-scroll-date-indicator {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    left: 50%;
    z-index: 7;
    max-width: min(72vw, 260px);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    color: rgba(238, 247, 255, 0.95);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    background: rgba(28, 42, 56, 0.72);
    border: 1px solid rgba(126, 182, 224, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px) saturate(1.1);
    -webkit-backdrop-filter: blur(14px) saturate(1.1);
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
    transition:
        opacity 220ms ease,
        transform 220ms ease;
}

.tg-scroll-date-indicator.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.tg-scroll-date-indicator.is-hidden {
    display: none;
}


.tg-topbar__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, #58b0f1, #246fbf);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.tg-topbar__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-topbar__meta {
    flex: 1;
    min-width: 0;
}

.tg-topbar__title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-topbar__subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: var(--tg-muted);
    line-height: 16px;
}

.tg-topbar__announcements {
    position: relative;
    height: 16px;
    overflow: hidden;
    mask-image: linear-gradient(180deg, transparent 0, #000 15%, #000 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 15%, #000 85%, transparent 100%);
}

.tg-topbar__announcement-track {
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateY(0);
}

.tg-topbar__announcement-track.is-animating {
    transition: transform 360ms cubic-bezier(0.2, 0.82, 0.25, 1);
    transform: translateY(-16px);
}

.tg-topbar__announcement-line {
    display: block;
    height: 16px;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #9bc8f0;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);
}

.tg-topbar__announcement-line--next {
    color: #89c4f7;
}

.tg-topbar__action {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: var(--tg-accent);
    background: rgba(83, 169, 235, 0.1);
}

.tg-topbar__action svg {
    width: 18px;
    height: 18px;
}

.tg-topbar__action--login {
    width: auto;
    min-width: 44px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    word-break: keep-all;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    color: #d8edff;
    background: rgba(83, 169, 235, 0.18);
    border: 1px solid rgba(111, 183, 238, 0.32);
}

.tg-topbar__menu-wrap {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}

.tg-topbar__action--menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 34.2px;
    height: 34.2px;
    border-radius: 50%;
    color: #8f452e;
    background:
        linear-gradient(145deg, rgba(255, 248, 241, 0.92), rgba(238, 188, 157, 0.92) 52%, rgba(174, 91, 58, 0.96) 100%) padding-box,
        linear-gradient(145deg, #fff1d6 0%, #ffbd82 28%, #c8754e 64%, #7e341f 100%) border-box;
    border: 1.8px solid transparent;
    box-shadow:
        0 0 0 1px rgba(255, 227, 203, 0.34),
        0 0 16px rgba(255, 170, 105, 0.4),
        0 9px 23px rgba(88, 36, 24, 0.36),
        inset 0 1px 3px rgba(255, 255, 255, 0.92),
        inset 0 -2.7px 5.4px rgba(128, 51, 30, 0.28);
    text-shadow: 0 1px 0 rgba(255, 242, 230, 0.7);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tg-topbar__action--menu:focus,
.tg-topbar__action--menu:focus-visible,
.tg-topbar__action--menu:active {
    outline: none;
}

.tg-topbar__action--menu span {
    width: 18.9px;
    height: 3.5px;
    border-radius: 999px;
    background: linear-gradient(180deg, #c8754e 0%, #65301f 48%, #35140b 100%);
    box-shadow:
        0 1px 0 rgba(255, 211, 180, 0.42),
        0 2px 6px rgba(31, 10, 5, 0.72),
        inset 0 1px 0 rgba(246, 174, 128, 0.48),
        inset 0 -1px 0 rgba(27, 9, 5, 0.68);
}

.tg-topbar__action--menu span + span {
    margin-top: 3.6px;
}

.tg-topbar-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 132px;
    padding: 7px;
    border-radius: 15px;
    border: 1px solid rgba(245, 173, 119, 0.34);
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 183, 126, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(24, 34, 49, 0.98), rgba(12, 22, 35, 0.98));
    box-shadow:
        0 22px 44px rgba(0, 0, 0, 0.42),
        0 0 24px rgba(255, 150, 91, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.21, 0.86, 0.3, 1);
}

.tg-topbar-menu.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tg-topbar-menu__item {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 11px;
    text-align: left;
    color: #f8e5dc;
    background: transparent;
    font-size: 14px;
    font-weight: 760;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.tg-topbar-menu__item:active {
    background: transparent;
    transform: none;
}

.tg-topbar-menu__item:focus,
.tg-topbar-menu__item:focus-visible {
    outline: none;
    background: transparent;
}

.tg-topbar-menu__item--reserved {
    color: #f8e5dc;
}

.tg-search-layer {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
}

.tg-search-layer__backdrop {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(8, 14, 24, 0.36);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: opacity 0.22s ease;
}

.tg-search-sheet {
    position: absolute;
    left: 10px;
    right: 10px;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(72vh, calc(100dvh - 120px));
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(119, 162, 208, 0.3);
    background:
        linear-gradient(180deg, rgba(16, 31, 48, 0.95), rgba(12, 24, 38, 0.96));
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.38);
    opacity: 0;
    transform: translateY(-14px) scale(0.99);
    transform-origin: top center;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.tg-search-layer.is-open {
    pointer-events: auto;
}

.tg-search-layer.is-open .tg-search-layer__backdrop {
    opacity: 1;
}

.tg-search-layer.is-open .tg-search-sheet {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tg-test-login-layer {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
}

.tg-test-login-layer__backdrop {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(8, 15, 24, 0.46);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: opacity 0.22s ease;
}

.tg-test-login-sheet {
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    padding: 14px 14px 12px;
    border-radius: 18px;
    border: 1px solid rgba(126, 168, 214, 0.34);
    background: linear-gradient(180deg, rgba(15, 31, 48, 0.96), rgba(11, 22, 35, 0.97));
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38);
    opacity: 0;
    transform: translateY(-12px) scale(0.985);
    transform-origin: top center;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.tg-test-login-layer.is-open {
    pointer-events: auto;
}

.tg-test-login-layer.is-open .tg-test-login-layer__backdrop {
    opacity: 1;
}

.tg-test-login-layer.is-open .tg-test-login-sheet {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tg-test-login-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tg-test-login-sheet__title {
    font-size: 16px;
    font-weight: 700;
    color: #e8f3ff;
}

.tg-test-login-sheet__close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #cde6ff;
    font-size: 22px;
    line-height: 1;
    background: rgba(94, 143, 193, 0.24);
}

.tg-test-login-sheet__desc {
    margin-top: 6px;
    font-size: 12px;
    color: #a8c5de;
    line-height: 1.5;
}

.tg-test-login-sheet__quick {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tg-test-login-sheet__quick button {
    min-height: 34px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    color: #d7ecff;
    background: rgba(88, 152, 214, 0.22);
    border: 1px solid rgba(133, 183, 232, 0.3);
}

.tg-test-login-sheet__form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tg-test-login-sheet__label {
    font-size: 12px;
    color: #9fc0db;
}

.tg-test-login-sheet__form input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(117, 162, 206, 0.34);
    background: rgba(17, 35, 55, 0.72);
    color: #eaf5ff;
    font-size: 14px;
}

.tg-test-login-sheet__form input::placeholder {
    color: #7f9db9;
}

.tg-test-login-sheet__error {
    min-height: 18px;
    font-size: 12px;
    color: #ffb6c2;
}

.tg-test-login-sheet__submit {
    min-height: 42px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #54a8f0, #3a76db);
    box-shadow: 0 10px 24px rgba(34, 103, 189, 0.3);
}

.tg-search-sheet__input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 14px;
    border: 1px solid rgba(108, 149, 193, 0.34);
    background:
        linear-gradient(180deg, rgba(24, 42, 65, 0.96), rgba(18, 33, 52, 0.98));
}

.tg-search-sheet__icon {
    width: 18px;
    height: 18px;
    color: #8fb3d1;
    flex: 0 0 auto;
}

.tg-search-sheet__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    color: var(--tg-text);
    font-size: 15px;
    background: transparent;
}

.tg-search-sheet__input::placeholder {
    color: #7f98b2;
}

.tg-search-sheet__close {
    height: 30px;
    padding: 0 10px;
    border-radius: 15px;
    color: #86c9ff;
    font-size: 13px;
    font-weight: 700;
    background: rgba(83, 169, 235, 0.14);
    flex: 0 0 auto;
}

.tg-search-sheet__meta {
    font-size: 12px;
    color: #9db5ca;
    padding: 0 2px;
}

.tg-search-sheet__results {
    flex: 1 1 auto;
    min-height: 110px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--tg-scrollbar-thumb) var(--tg-scrollbar-track);
}

.tg-search-sheet__results::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tg-search-sheet__results::-webkit-scrollbar-track {
    background: var(--tg-scrollbar-track);
    border-radius: 999px;
}

.tg-search-sheet__results::-webkit-scrollbar-thumb {
    background: var(--tg-scrollbar-thumb);
    border-radius: 999px;
    border: 1px solid rgba(12, 21, 31, 0.35);
}

.tg-search-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-search-group__date {
    position: sticky;
    top: 0;
    z-index: 1;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    color: #d5e6f6;
    background: rgba(70, 94, 120, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.tg-search-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    color: var(--tg-text);
    transition: transform 0.14s ease, background 0.14s ease;
}

.tg-search-item:active {
    transform: scale(0.99);
    background: rgba(255, 255, 255, 0.08);
}

.tg-search-item__time {
    flex: 0 0 auto;
    font-size: 12px;
    color: #8ea8bf;
    line-height: 1.45;
    white-space: nowrap;
}

.tg-search-item__avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(128, 168, 202, 0.26);
    box-shadow: inset 0 0 0 1px rgba(150, 194, 226, 0.24);
}

.tg-search-item__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-search-item__avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #dcedfb;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.tg-search-item__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tg-search-item__meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.tg-search-item__author {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #cfe6fb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.tg-search-item__text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.45;
    color: #e7f1fb;
}

.tg-search-item__text mark {
    color: #fff;
    padding: 0 2px;
    border-radius: 4px;
    background: rgba(91, 196, 255, 0.46);
    box-shadow: inset 0 0 0 1px rgba(188, 234, 255, 0.26);
}

.tg-search-item__empty {
    color: #91a7bb;
    font-style: italic;
}

.tg-search-empty {
    padding: 16px 12px;
    border-radius: 14px;
    text-align: center;
    font-size: 13px;
    color: #9cb3c8;
    background: rgba(255, 255, 255, 0.05);
}

.tg-chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tg-chat::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 112px;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(12, 21, 34, 0.7) 0%,
        rgba(12, 21, 34, 0.46) 28%,
        rgba(12, 21, 34, 0.18) 64%,
        rgba(12, 21, 34, 0) 100%
    );
}

.tg-chat::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 112px;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(12, 21, 34, 0) 0%,
        rgba(12, 21, 34, 0.18) 36%,
        rgba(12, 21, 34, 0.46) 72%,
        rgba(12, 21, 34, 0.7) 100%
    );
}

.tg-history-loading {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 96px);
    left: 50%;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    color: rgba(230, 242, 255, 0.94);
    background: rgba(24, 39, 56, 0.74);
    border: 1px solid rgba(126, 182, 224, 0.2);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    -webkit-backdrop-filter: blur(12px) saturate(1.08);
    backdrop-filter: blur(12px) saturate(1.08);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.tg-history-loading.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.tg-chat__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: calc(var(--tg-topbar-height) + 12px) clamp(16px, 4.6vw, 22px) 16px;
    scroll-behavior: smooth;
}

.tg-chat__messages,
.tg-composer__input,
.tg-panel__list {
    scrollbar-width: thin;
    scrollbar-color: var(--tg-scrollbar-thumb) var(--tg-scrollbar-track);
}

.tg-chat__messages::-webkit-scrollbar,
.tg-composer__input::-webkit-scrollbar,
.tg-panel__list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tg-chat__messages::-webkit-scrollbar-track,
.tg-composer__input::-webkit-scrollbar-track,
.tg-panel__list::-webkit-scrollbar-track {
    background: var(--tg-scrollbar-track);
    border-radius: 999px;
}

.tg-chat__messages::-webkit-scrollbar-thumb,
.tg-composer__input::-webkit-scrollbar-thumb,
.tg-panel__list::-webkit-scrollbar-thumb {
    background: var(--tg-scrollbar-thumb);
    border-radius: 999px;
    border: 1px solid rgba(12, 21, 31, 0.35);
}

.tg-chat__messages::-webkit-scrollbar-thumb:hover,
.tg-composer__input::-webkit-scrollbar-thumb:hover,
.tg-panel__list::-webkit-scrollbar-thumb:hover {
    background: var(--tg-scrollbar-thumb-hover);
}

.tg-chat__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 4px;
}

.tg-upload-status {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(var(--tg-composer-height, 74px) + 10px);
    z-index: 5;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15, 23, 34, 0.97);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
}

.tg-upload-status__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tg-upload-status__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tg-upload-status__meta strong {
    font-size: 13px;
    font-weight: 700;
}

.tg-upload-status__meta span {
    font-size: 12px;
    color: var(--tg-muted);
}

.tg-upload-status__action {
    min-width: 58px;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(83, 169, 235, 0.14);
    color: var(--tg-accent);
    font-size: 12px;
    font-weight: 700;
}

.tg-upload-status__bar {
    margin-top: 10px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.tg-upload-status__bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #53a9eb, #7fd0ff);
    transition: width 0.18s ease;
}

.tg-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(var(--tg-composer-height, 74px) + 10px);
    z-index: 4;
    padding: 12px;
    border-radius: 20px;
    background: rgba(18, 25, 35, 0.97);
    box-shadow: var(--tg-shadow);
    backdrop-filter: blur(18px);
}

.tg-panel--expression {
    left: 10px;
    right: 10px;
    bottom: 0;
    border-radius: 18px 18px 14px 14px;
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    transform-origin: center bottom;
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tg-panel--expression.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.tg-panel__header {
    margin-bottom: 10px;
    color: #7e95aa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tg-composer {
    position: relative;
    z-index: 6;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 9px 10px calc(9px + var(--tg-safe-bottom));
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.tg-composer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    background: transparent;
}

.tg-composer::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    background: transparent;
}

.tg-composer > * {
    position: relative;
    z-index: 1;
}

.tg-composer__mention-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 1px;
    scrollbar-width: none;
}

.tg-composer__mention-summary::-webkit-scrollbar {
    display: none;
}

.tg-composer__reply-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 6px 8px;
    border-radius: 14px;
    border: 1px solid rgba(112, 163, 210, 0.36);
    background: linear-gradient(180deg, rgba(20, 35, 54, 0.96), rgba(15, 28, 45, 0.98));
    box-shadow: 0 8px 20px rgba(3, 10, 18, 0.24);
}

.tg-composer__reply-body {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px;
}

.tg-composer__reply-thumb {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.tg-composer__reply-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-composer__reply-meta {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1px;
}

.tg-composer__reply-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #89d3ff;
    font-size: 12px;
    font-weight: 700;
}

.tg-composer__reply-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #c7dbef;
    font-size: 12px;
}

.tg-composer__reply-remove {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #bfd5ea;
    background: rgba(130, 170, 208, 0.22);
    font-size: 14px;
    line-height: 1;
}

.tg-mention-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 82%;
    min-height: 34px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid rgba(119, 165, 210, 0.36);
    background: linear-gradient(180deg, rgba(22, 38, 58, 0.95), rgba(16, 30, 48, 0.98));
    box-shadow: 0 8px 18px rgba(2, 10, 18, 0.24);
}

.tg-mention-summary-item__avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 24px;
    background: rgba(117, 155, 191, 0.3);
}

.tg-mention-summary-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-mention-summary-item__avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #d8e7f5;
    font-size: 11px;
    font-weight: 700;
}

.tg-mention-summary-item__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tg-mention-summary-item__name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #dcedfb;
    font-size: 12px;
    font-weight: 700;
}

.tg-mention-summary-item__sub {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #8fb0cd;
    font-size: 11px;
}

.tg-mention-summary-item__remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #bdd4ea;
    background: rgba(131, 170, 207, 0.22);
    font-size: 12px;
}

.tg-msg-action-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    opacity: 0;
    background: rgba(7, 14, 24, 0.2);
    backdrop-filter: blur(1px);
    transition: opacity 0.18s ease;
}

.tg-msg-action-overlay.is-open {
    opacity: 1;
}

.tg-msg-context-menu {
    position: fixed;
    z-index: 44;
    min-width: 140px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(118, 157, 195, 0.34);
    background: linear-gradient(180deg, rgba(17, 31, 48, 0.98), rgba(13, 24, 39, 0.98));
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.21, 0.86, 0.3, 1);
}

.tg-msg-context-menu.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tg-msg-context-menu__item {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    text-align: left;
    color: #ddeafb;
    font-size: 14px;
    background: transparent;
}

.tg-msg-context-menu__item:active {
    background: rgba(102, 149, 193, 0.22);
}

.tg-msg-context-menu__item[disabled] {
    opacity: 0.38;
    pointer-events: none;
}

.tg-msg-profile-sheet {
    position: fixed;
    left: 50%;
    right: auto;
    width: min(520px, calc(100vw - 8px));
    bottom: calc(var(--tg-composer-height, 74px) + 8px);
    height: auto;
    min-height: 320px;
    max-height: min(
        70dvh,
        calc(100dvh - var(--tg-composer-height, 74px) - env(safe-area-inset-top, 0px) - 10px)
    );
    z-index: 43;
    padding: 0;
    border-radius: 16px;
    border: 1px solid rgba(113, 152, 191, 0.32);
    background: linear-gradient(180deg, rgba(16, 30, 46, 0.98), rgba(11, 23, 37, 0.98));
    box-shadow: 0 24px 46px rgba(0, 0, 0, 0.44);
    opacity: 0;
    transform: translateX(-50%) translateY(24px) scale(0.99);
    transition: opacity 0.28s ease, transform 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tg-msg-profile-sheet::before,
.tg-msg-profile-sheet::after {
    content: none;
}

.tg-msg-profile-sheet__scroll {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-bottom: 16px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--tg-scrollbar-thumb) var(--tg-scrollbar-track);
    -webkit-overflow-scrolling: touch;
}

.tg-msg-profile-sheet.has-scroll-fade .tg-msg-profile-sheet__scroll {
    mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}

.tg-msg-profile-sheet.has-scroll-fade.is-scroll-top .tg-msg-profile-sheet__scroll {
    mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 28px), transparent 100%);
}

.tg-msg-profile-sheet.has-scroll-fade.is-scroll-bottom .tg-msg-profile-sheet__scroll {
    mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 100%);
}

.tg-msg-profile-sheet.has-scroll-fade.is-scroll-top.is-scroll-bottom .tg-msg-profile-sheet__scroll {
    mask-image: none;
    -webkit-mask-image: none;
}

.tg-msg-profile-sheet__scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tg-msg-profile-sheet__scroll::-webkit-scrollbar-track {
    background: var(--tg-scrollbar-track);
    border-radius: 999px;
}

.tg-msg-profile-sheet__scroll::-webkit-scrollbar-thumb {
    background: var(--tg-scrollbar-thumb);
    border-radius: 999px;
    border: 1px solid rgba(12, 21, 31, 0.35);
}

.tg-msg-profile-sheet__scroll::-webkit-scrollbar-thumb:hover {
    background: var(--tg-scrollbar-thumb-hover);
}

.tg-msg-profile-sheet.is-open {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

html.tg-platform-mobile .tg-msg-profile-sheet {
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    border-left: 0;
    border-right: 0;
    border-radius: 16px 16px 0 0;
    transform: translateY(24px) scale(0.99);
}

html.tg-platform-mobile .tg-msg-profile-sheet.is-open {
    transform: translateY(0) scale(1);
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-msg-profile-sheet {
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        border-left: 0;
        border-right: 0;
        border-radius: 16px 16px 0 0;
        transform: translateY(24px) scale(0.99);
    }

    .tg-msg-profile-sheet.is-open {
        transform: translateY(0) scale(1);
    }
}

.tg-msg-profile-sheet__header {
    margin-bottom: 10px;
    color: #86a6c2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tg-msg-profile-sheet__body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tg-msg-profile-sheet__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 52px;
    background: rgba(119, 157, 193, 0.24);
}

.tg-msg-profile-sheet__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-msg-profile-sheet__avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #d9e8f5;
    font-size: 16px;
    font-weight: 700;
}

.tg-msg-profile-sheet__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tg-msg-profile-sheet__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    color: #e6f2ff;
    font-weight: 700;
}

.tg-msg-profile-sheet__name-row,
.tg-msg-profile-sheet__intro-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.tg-msg-profile-sheet__mini-edit {
    flex: 0 0 auto;
    height: 24px;
    padding: 0 9px;
    border-radius: 12px;
    color: #cce6ff;
    background: rgba(78, 160, 235, 0.16);
    box-shadow: inset 0 0 0 1px rgba(113, 179, 237, 0.24);
    font-size: 11px;
    font-weight: 750;
}

.tg-msg-profile-sheet__mini-edit:active {
    transform: scale(0.96);
}

.tg-msg-profile-sheet__name-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

.tg-msg-profile-sheet__name-input {
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    color: #e6f2ff;
    background: rgba(13, 24, 38, 0.78);
    border: 1px solid rgba(111, 157, 200, 0.36);
    font-size: 13px;
}

.tg-msg-profile-sheet__name-input::placeholder {
    color: #7793ad;
}

.tg-msg-profile-sheet__name-save,
.tg-msg-profile-sheet__name-cancel,
.tg-msg-profile-sheet__editor-cancel {
    height: 30px;
    padding: 0 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 750;
}

.tg-msg-profile-sheet__name-save {
    color: #f5fbff;
    background: linear-gradient(180deg, #4ea0eb, #2f78d2);
}

.tg-msg-profile-sheet__name-cancel,
.tg-msg-profile-sheet__editor-cancel {
    color: #b7cde2;
    background: rgba(122, 166, 205, 0.12);
    box-shadow: inset 0 0 0 1px rgba(122, 166, 205, 0.18);
}

.tg-msg-profile-sheet__name-save[disabled] {
    opacity: 0.7;
    pointer-events: none;
}

.tg-msg-profile-sheet__username {
    font-size: 12px;
    color: #93aec7;
}

.tg-msg-profile-sheet__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tg-msg-profile-sheet__intro-block {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(122, 166, 205, 0.09);
    border: 1px solid rgba(114, 160, 202, 0.2);
}

.tg-msg-profile-sheet__intro-label {
    font-size: 11px;
    color: #8fb0cc;
    font-weight: 750;
}

.tg-msg-profile-sheet__intro {
    margin-top: 5px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.45;
    color: #dbe8f5;
}

.tg-msg-profile-sheet__editor {
    margin-top: 8px;
    padding: 0;
    border-radius: 12px;
    background: transparent;
    border: 0;
}

.tg-msg-profile-sheet__editor-input {
    width: 100%;
    min-height: 78px;
    max-height: 152px;
    resize: vertical;
    padding: 9px 10px;
    border-radius: 10px;
    color: #e6f2ff;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid rgba(111, 157, 200, 0.36);
    background: rgba(13, 24, 38, 0.74);
}

.tg-msg-profile-sheet__editor-input::placeholder {
    color: #7793ad;
}

.tg-msg-profile-sheet__editor-foot {
    margin-top: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tg-msg-profile-sheet__editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tg-msg-profile-sheet__editor-count {
    font-size: 11px;
    color: #7fa3c0;
}

.tg-msg-profile-sheet__editor-save {
    height: 30px;
    padding: 0 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 700;
    color: #f5fbff;
    background: linear-gradient(180deg, #4ea0eb, #2f78d2);
    box-shadow: 0 8px 16px rgba(9, 61, 116, 0.26);
}

.tg-msg-profile-sheet__editor-save[disabled] {
    opacity: 0.7;
    pointer-events: none;
}

.tg-msg-profile-sheet__predictor {
    margin-top: 10px;
    padding: 0;
    border-radius: 12px;
    border: 0;
    background: transparent;
    flex: 0 0 auto;
    min-height: 0;
    contain: layout paint style;
}

.tg-msg-profile-sheet__demo-iframe {
    display: block;
    width: 100%;
    height: 132px;
    min-height: 0;
    border: 0;
    border-radius: 12px;
    background: #071321;
}

.tg-msg-profile-sheet__predictor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tg-msg-profile-sheet__predictor-title {
    font-size: 12px;
    font-weight: 800;
    color: #8fc8f6;
}

.tg-msg-profile-sheet__predictor-tabs {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    gap: 3px;
}

.tg-msg-profile-sheet__predictor-tabs button {
    min-width: 62px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    color: #8eaec8;
    font-size: 11px;
    font-weight: 700;
    background: transparent;
}

.tg-msg-profile-sheet__predictor-tabs button.is-active {
    color: #f3faff;
    background: rgba(84, 166, 236, 0.34);
}

.tg-msg-profile-sheet__predictor-panel,
.tg-msg-profile-sheet__predictor-history {
    margin-top: 10px;
}

.tg-msg-profile-sheet__predictor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tg-msg-profile-sheet__predictor-row span {
    flex: 0 0 auto;
    font-size: 12px;
    color: #8faec7;
}

.tg-msg-profile-sheet__predictor-row select {
    flex: 1 1 auto;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(111, 156, 196, 0.35);
    background: rgba(8, 21, 34, 0.75);
    color: #dcecff;
    font-size: 13px;
}

.tg-msg-profile-sheet__predictor-block {
    margin-bottom: 10px;
}

.tg-msg-profile-sheet__predictor-label {
    margin-bottom: 6px;
    font-size: 11px;
    color: #90b2cf;
    font-weight: 700;
}

.tg-msg-profile-sheet__choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.tg-msg-profile-sheet__choice-grid button {
    height: 32px;
    border-radius: 11px;
    border: 1px solid rgba(100, 148, 189, 0.45);
    background: rgba(19, 38, 58, 0.72);
    color: #c9e4fb;
    font-size: 12px;
    font-weight: 700;
}

.tg-msg-profile-sheet__choice-grid button.is-active {
    color: #fff;
    border-color: rgba(255, 186, 98, 0.9);
    background: linear-gradient(180deg, rgba(252, 178, 84, 0.34), rgba(239, 112, 50, 0.28));
}

.tg-msg-profile-sheet__num-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
}

.tg-msg-profile-sheet__num-btn {
    position: relative;
    height: 28px;
    padding: 0;
    border-radius: 9px;
    border: 1px solid rgba(98, 146, 187, 0.34);
    background: rgba(14, 30, 46, 0.7);
    color: #bfdbf2;
    font-size: 12px;
    font-weight: 700;
}

.tg-msg-profile-sheet__num-btn.is-selected {
    color: #fff;
    border-color: rgba(255, 178, 74, 0.86);
    background: linear-gradient(180deg, rgba(251, 176, 80, 0.42), rgba(232, 100, 82, 0.3));
}

.tg-msg-profile-sheet__num-badge {
    position: absolute;
    right: 1px;
    top: 1px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(255, 211, 133, 0.9);
    color: #3a2106;
    font-size: 8px;
    line-height: 13px;
}

.tg-msg-profile-sheet__predictor-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.tg-msg-profile-sheet__predictor-actions button {
    flex: 1 1 0;
    height: 34px;
    border-radius: 12px;
    color: #f5fbff;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(180deg, #4ea0eb, #2f78d2);
}

.tg-msg-profile-sheet__predictor-actions button.is-ghost {
    background: rgba(24, 45, 68, 0.74);
    border: 1px solid rgba(114, 158, 197, 0.38);
    color: #b8d4eb;
}

.tg-msg-profile-sheet__predictor-actions button:disabled,
.tg-msg-profile-sheet__choice-grid button:disabled,
.tg-msg-profile-sheet__num-btn:disabled {
    opacity: 0.58;
}

.tg-msg-profile-sheet__predictor-result {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(118, 159, 197, 0.2);
    background: rgba(10, 23, 36, 0.65);
    color: #d9eaf9;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.tg-msg-profile-sheet__history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-msg-profile-sheet__history-item {
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid rgba(114, 159, 198, 0.18);
    background: rgba(10, 22, 35, 0.64);
}

.tg-msg-profile-sheet__history-text {
    font-size: 12px;
    line-height: 1.5;
    color: #d5e9fb;
    word-break: break-word;
}

.tg-msg-profile-sheet__history-time {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 4px;
    font-size: 10px;
    color: #7fa3c2;
}

.tg-msg-profile-sheet__history-status {
    color: #f2c66d;
}

.tg-msg-profile-sheet__history-status.is-hit {
    color: #52d792;
}

.tg-msg-profile-sheet__history-status.is-miss {
    color: #ff8e8e;
}

.tg-msg-profile-sheet__history-empty {
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    color: #84a9c8;
    font-size: 12px;
    background: rgba(10, 22, 35, 0.48);
}

.tg-msg-profile-sheet__predictor-note {
    margin-top: 8px;
    color: #7f9fbc;
    font-size: 11px;
    line-height: 1.5;
}

.tg-composer__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tg-composer__media {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 7px 10px 7px 8px;
    border-radius: 16px;
    border: 1px solid rgba(114, 152, 193, 0.34);
    background: linear-gradient(180deg, rgba(20, 36, 56, 0.97), rgba(15, 29, 47, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 8px 20px rgba(4, 10, 19, 0.3);
}

.tg-composer__media-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(16, 24, 35, 0.88);
    box-shadow: inset 0 0 0 1px rgba(120, 165, 207, 0.24);
}

.tg-composer__media-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-composer__media-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tg-composer__media-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #dbeafb;
    font-size: 12px;
    font-weight: 700;
}

.tg-composer__media-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #98b2c8;
    font-size: 11px;
}

.tg-composer__media-remove {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    color: #c9dcf0;
    background: rgba(100, 145, 190, 0.24);
    font-size: 17px;
    line-height: 1;
}

.tg-composer__media-remove:active {
    transform: scale(0.95);
}


.tg-composer__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex: 0 0 auto;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(35, 53, 77, 0.95), rgba(24, 39, 58, 0.95));
    border: 1px solid rgba(120, 156, 194, 0.35);
    color: #bfd0e2;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(2, 8, 14, 0.28);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tg-composer__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-composer__avatar:focus-visible {
    outline: 2px solid rgba(116, 197, 255, 0.9);
    outline-offset: 1px;
}

.tg-composer__shell {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 46px;
    padding: 0 8px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(24, 42, 65, 0.96), rgba(18, 33, 52, 0.98));
    border: 1px solid rgba(108, 149, 193, 0.34);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 10px 26px rgba(2, 10, 18, 0.26);
}

.tg-composer__shell:focus-within {
    border-color: rgba(106, 189, 255, 0.65);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(60, 160, 236, 0.22),
        0 12px 30px rgba(2, 10, 18, 0.28);
}

.tg-composer__input {
    flex: 1;
    min-width: 0;
    resize: none;
    min-height: 28px;
    max-height: 96px;
    overflow-y: auto;
    color: var(--tg-text);
    font-size: 17px;
    line-height: 1.28;
    padding: 9px 4px;
    caret-color: #52b3ff;
}

.tg-composer__input::placeholder {
    color: #7e97b1;
}

.tg-composer__input[readonly] {
    cursor: pointer;
}

.tg-composer__icon,
.tg-composer__send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.tg-composer__icon {
    color: #95abc2;
    background: transparent;
}

.tg-composer__icon svg,
.tg-composer__send svg {
    width: 22px;
    height: 22px;
}

.tg-composer__send img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.tg-composer__icon--left {
    flex: 0 0 auto;
}

.tg-composer__icon--upload {
    flex: 0 0 auto;
    cursor: pointer;
    line-height: 0;
}

.tg-composer__icon--upload svg {
    display: block;
    transform: translateY(-1px);
}

.tg-composer__send {
    color: #fff;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 0;
    box-shadow: 0 10px 24px rgba(15, 100, 180, 0.28);
    overflow: hidden;
}

.tg-composer__send:active {
    transform: scale(0.97);
}

.tg-composer__send[disabled] {
    opacity: 0.62;
    pointer-events: none;
}

.tg-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    -webkit-tap-highlight-color: transparent;
}

.tg-image-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 15, 0.84);
    backdrop-filter: blur(8px);
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    touch-action: manipulation;
    user-select: none;
}

.tg-image-viewer__backdrop:active,
.tg-image-viewer__backdrop:focus,
.tg-image-viewer__backdrop:focus-visible {
    outline: none;
    background: rgba(3, 8, 15, 0.84);
}

.tg-image-viewer__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    max-height: min(86dvh, 720px);
    display: grid;
    place-items: center;
    touch-action: pan-y;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tg-image-viewer__panel img {
    width: 100%;
    max-height: min(86dvh, 720px);
    object-fit: contain;
    border-radius: 16px;
    background: rgba(6, 12, 20, 0.86);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    transform: translateX(0) scale(1);
    opacity: 1;
    transition:
        opacity 0.14s ease,
        transform 0.18s cubic-bezier(0.22, 0.72, 0.24, 1);
    will-change: transform, opacity;
}

.tg-image-viewer__panel.is-slide-left img {
    opacity: 0;
    transform: translateX(-22px) scale(0.985);
}

.tg-image-viewer__panel.is-slide-right img {
    opacity: 0;
    transform: translateX(22px) scale(0.985);
}

.tg-image-viewer__panel.is-enter-left img {
    opacity: 0;
    transform: translateX(22px) scale(0.985);
}

.tg-image-viewer__panel.is-enter-right img {
    opacity: 0;
    transform: translateX(-22px) scale(0.985);
}

.tg-image-viewer__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: none !important;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #edf7ff;
    background: rgba(8, 15, 24, 0.46);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 34px;
    line-height: 1;
    transform: translateY(-50%);
    -webkit-tap-highlight-color: transparent;
}

.tg-image-viewer__nav--prev {
    left: 10px;
}

.tg-image-viewer__nav--next {
    right: 10px;
}

.tg-image-viewer__nav:active,
.tg-image-viewer__nav:focus,
.tg-image-viewer__nav:focus-visible {
    outline: none;
    background: rgba(8, 15, 24, 0.56);
}

.tg-image-viewer__nav[disabled],
.tg-image-viewer.is-single .tg-image-viewer__nav {
    opacity: 0;
    pointer-events: none;
}

.tg-image-viewer__counter {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 2;
    min-width: 48px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #dfefff;
    background: rgba(8, 15, 24, 0.52);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transform: translateX(-50%);
    pointer-events: none;
}

.tg-image-viewer.is-single .tg-image-viewer__counter {
    display: none;
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-image-viewer {
        padding: 10px;
    }

    .tg-image-viewer__nav {
        width: 36px;
        height: 36px;
        font-size: 29px;
    }

    .tg-image-viewer__nav--prev {
        left: 6px;
    }

    .tg-image-viewer__nav--next {
        right: 6px;
    }

    .tg-image-viewer__counter {
        bottom: max(10px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .tg-image-viewer__panel img {
        transition: none;
    }
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-app {
        --tg-topbar-height: calc(env(safe-area-inset-top, 0px) + 56px);
        --tg-mobile-density: 0.8;
    }

    .tg-topbar {
        gap: 8px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
    }

    .tg-topbar__avatar {
        width: 34px;
        height: 34px;
        font-size: 11px;
    }

    .tg-topbar__title {
        font-size: 14px;
    }

    .tg-topbar__subtitle,
    .tg-topbar__announcement-line {
        font-size: 10.5px;
    }

    .tg-topbar__action {
        width: 30px;
        height: 30px;
        border-radius: 15px;
    }

    .tg-topbar__action svg {
        width: 16px;
        height: 16px;
    }

    .tg-topbar__action--login {
        min-width: 38px;
        padding: 0 8px;
        font-size: 11px;
    }

    .tg-topbar__action--menu {
        width: 30.8px;
        height: 30.8px;
    }

    .tg-topbar__action--menu span {
        width: 17px;
        height: 3px;
    }

    .tg-topbar-menu {
        width: 116px;
        padding: 6px;
    }

    .tg-topbar-menu__item {
        min-height: 32px;
        padding: 7px 8px;
        font-size: 12px;
    }

    .tg-scroll-date-indicator {
        top: calc(env(safe-area-inset-top, 0px) + 50px);
        padding: 4px 10px;
        font-size: 10.5px;
        line-height: 16px;
    }

    .tg-chat__messages {
        padding: calc(var(--tg-topbar-height) + 8px) 12px 12px;
    }

    .tg-chat__list {
        gap: 6px;
    }

    .tg-composer {
        gap: 5px;
        padding: 7px 8px calc(7px + var(--tg-safe-bottom));
    }

    .tg-composer__row {
        gap: 6px;
    }

    .tg-composer__avatar {
        width: 32px;
        height: 32px;
        font-size: 10px;
    }

    .tg-composer__shell {
        min-height: 38px;
        padding: 0 7px;
        border-radius: 20px;
    }

    .tg-composer__input {
        min-height: 24px;
        max-height: 78px;
        padding: 7px 3px;
        font-size: 14px;
        line-height: 1.24;
    }

    .tg-composer__icon,
    .tg-composer__send {
        width: 28px;
        height: 28px;
    }

    .tg-composer__icon svg,
    .tg-composer__send svg {
        width: 18px;
        height: 18px;
    }

    .tg-composer__send {
        width: 36px;
        height: 36px;
    }

    .tg-composer__media {
        min-height: 46px;
        padding: 6px 8px 6px 7px;
        gap: 8px;
    }

    .tg-composer__media-thumb {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .tg-composer__media-name {
        font-size: 11px;
    }

    .tg-composer__media-meta {
        font-size: 10px;
    }

    .tg-panel {
        left: 8px;
        right: 8px;
        padding: 10px;
        border-radius: 16px;
    }

    .tg-panel--expression {
        left: 8px;
        right: 8px;
    }

    .tg-msg-profile-sheet {
        min-height: 280px;
        max-height: min(
            72dvh,
            calc(var(--tg-viewport-height, 100dvh) - var(--tg-composer-height, 66px) - env(safe-area-inset-top, 0px) - 8px)
        );
    }

    .tg-msg-profile-sheet__scroll {
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .tg-msg-profile-sheet__header,
    .tg-msg-profile-sheet__predictor-title,
    .tg-msg-profile-sheet__editor-label {
        font-size: 10.5px;
    }

    .tg-msg-profile-sheet__avatar {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .tg-msg-profile-sheet__name {
        font-size: 13px;
    }

    .tg-msg-profile-sheet__username,
    .tg-msg-profile-sheet__intro,
    .tg-msg-profile-sheet__editor-input {
        font-size: 11.5px;
    }

    .tg-msg-profile-sheet__intro-block,
    .tg-msg-profile-sheet__editor {
        margin-top: 8px;
        padding: 8px;
    }

    .tg-msg-profile-sheet__demo-iframe {
        height: 108px;
    }

    .tg-msg-profile-sheet__choice-grid button,
    .tg-msg-profile-sheet__predictor-actions button,
    .tg-msg-profile-sheet__predictor-row select {
        height: 28px;
        font-size: 10.5px;
    }

    .tg-msg-profile-sheet__num-grid {
        gap: 3px;
    }

    .tg-msg-profile-sheet__num-btn {
        height: 24px;
        border-radius: 7px;
        font-size: 10px;
    }

    .tg-popup-announcement,
    .tg-ranking-layer {
        padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    .tg-popup-announcement__dialog,
    .tg-ranking-dialog {
        border-radius: 16px;
    }

    .tg-popup-announcement__content,
    .tg-ranking-dialog__head {
        padding: 14px;
    }

    .tg-ranking-dialog__head h2 {
        font-size: 18px;
    }

    .tg-ranking-dialog__summary {
        padding: 10px 14px;
    }
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-app {
        --tg-topbar-height: calc(env(safe-area-inset-top, 0px) + 59px);
        --tg-mobile-density: 0.84;
    }

    .tg-topbar {
        gap: 8.5px;
        padding: calc(8.5px + env(safe-area-inset-top, 0px)) 10.5px 8.5px;
    }

    .tg-topbar__avatar {
        width: 36px;
        height: 36px;
        font-size: 11.5px;
    }

    .tg-topbar__title {
        font-size: 14.7px;
    }

    .tg-topbar__subtitle,
    .tg-topbar__announcement-line {
        font-size: 11px;
    }

    .tg-topbar__action {
        width: 31.5px;
        height: 31.5px;
        border-radius: 16px;
    }

    .tg-topbar__action svg {
        width: 17px;
        height: 17px;
    }

    .tg-topbar__action--login {
        min-width: 40px;
        padding: 0 8.5px;
        font-size: 11.5px;
    }

    .tg-topbar__action--menu {
        width: 32.3px;
        height: 32.3px;
    }

    .tg-topbar__action--menu span {
        width: 18px;
        height: 3.2px;
    }

    .tg-topbar-menu {
        width: 122px;
        padding: 6.5px;
    }

    .tg-topbar-menu__item {
        min-height: 34px;
        padding: 7.5px 8.5px;
        font-size: 12.6px;
    }

    .tg-scroll-date-indicator {
        top: calc(env(safe-area-inset-top, 0px) + 52.5px);
        padding: 4.2px 10.5px;
        font-size: 11px;
        line-height: 17px;
    }

    .tg-chat__messages {
        padding: calc(var(--tg-topbar-height) + 8.5px) 12.5px 12.5px;
    }

    .tg-chat__list {
        gap: 6.5px;
    }

    .tg-composer {
        gap: 5.5px;
        padding: 7.5px 8.5px calc(7.5px + var(--tg-safe-bottom));
    }

    .tg-composer__row {
        gap: 6.5px;
    }

    .tg-composer__avatar {
        width: 34px;
        height: 34px;
        font-size: 10.5px;
    }

    .tg-composer__shell {
        min-height: 40px;
        padding: 0 7.5px;
        border-radius: 21px;
    }

    .tg-composer__input {
        min-height: 25px;
        max-height: 82px;
        padding: 7.5px 3.5px;
        font-size: 14.7px;
        line-height: 1.27;
    }

    .tg-composer__icon,
    .tg-composer__send {
        width: 29.5px;
        height: 29.5px;
    }

    .tg-composer__icon svg,
    .tg-composer__send svg {
        width: 19px;
        height: 19px;
    }

    .tg-composer__icon--upload svg {
        transform: translateY(-1.5px);
    }

    .tg-composer__send {
        width: 38px;
        height: 38px;
    }

    .tg-composer__media {
        min-height: 48px;
        padding: 6.5px 8.5px 6.5px 7.5px;
        gap: 8.5px;
    }

    .tg-composer__media-thumb {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .tg-composer__media-name {
        font-size: 11.5px;
    }

    .tg-composer__media-meta {
        font-size: 10.5px;
    }

    .tg-panel {
        left: 8.5px;
        right: 8.5px;
        padding: 10.5px;
        border-radius: 17px;
    }

    .tg-panel--expression {
        left: 8.5px;
        right: 8.5px;
    }

    .tg-msg-profile-sheet {
        min-height: 294px;
        max-height: min(
            72dvh,
            calc(var(--tg-viewport-height, 100dvh) - var(--tg-composer-height, 70px) - env(safe-area-inset-top, 0px) - 8.5px)
        );
    }

    .tg-msg-profile-sheet__scroll {
        padding: 10.5px 10.5px calc(10.5px + env(safe-area-inset-bottom, 0px));
    }

    .tg-msg-profile-sheet__header,
    .tg-msg-profile-sheet__predictor-title,
    .tg-msg-profile-sheet__editor-label {
        font-size: 11px;
    }

    .tg-msg-profile-sheet__avatar {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .tg-msg-profile-sheet__name {
        font-size: 13.7px;
    }

    .tg-msg-profile-sheet__username,
    .tg-msg-profile-sheet__intro,
    .tg-msg-profile-sheet__editor-input {
        font-size: 12px;
    }

    .tg-msg-profile-sheet__intro-block,
    .tg-msg-profile-sheet__editor {
        margin-top: 8.5px;
        padding: 8.5px;
    }

    .tg-msg-profile-sheet__demo-iframe {
        height: 114px;
    }

    .tg-msg-profile-sheet__choice-grid button,
    .tg-msg-profile-sheet__predictor-actions button,
    .tg-msg-profile-sheet__predictor-row select {
        height: 29.5px;
        font-size: 11px;
    }

    .tg-msg-profile-sheet__num-grid {
        gap: 3.2px;
    }

    .tg-msg-profile-sheet__num-btn {
        height: 25px;
        border-radius: 7.5px;
        font-size: 10.5px;
    }

    .tg-popup-announcement__content,
    .tg-ranking-dialog__head {
        padding: 15px;
    }

    .tg-ranking-dialog__head h2 {
        font-size: 19px;
    }

    .tg-ranking-dialog__summary {
        padding: 10.5px 15px;
    }
}

@media (max-width: 640px), (pointer: coarse) {
    .tg-chat::before {
        height: calc(var(--tg-topbar-height, 74px) + 78px);
        background: linear-gradient(
            180deg,
            rgba(12, 21, 34, 0.82) 0%,
            rgba(12, 21, 34, 0.48) 34%,
            rgba(12, 21, 34, 0.12) 74%,
            rgba(12, 21, 34, 0) 100%
        );
    }

    .tg-chat::after {
        height: calc(var(--tg-composer-height, 74px) + 78px);
        background: linear-gradient(
            180deg,
            rgba(12, 21, 34, 0) 0%,
            rgba(12, 21, 34, 0.12) 26%,
            rgba(12, 21, 34, 0.48) 66%,
            rgba(12, 21, 34, 0.82) 100%
        );
    }

    .tg-history-loading {
        top: calc(env(safe-area-inset-top, 0px) + 82px);
        min-height: 24px;
        padding: 0 10px;
        font-size: 10.5px;
    }

    .tg-chat__messages {
        padding-bottom: calc(var(--tg-composer-height, 74px) + 16px);
    }

    .tg-composer {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .tg-composer::before {
        top: -58px;
        bottom: 0;
        background: linear-gradient(
            0deg,
            rgba(12, 21, 34, 0.92) 0%,
            rgba(12, 21, 34, 0.74) 38%,
            rgba(12, 21, 34, 0.42) 68%,
            rgba(12, 21, 34, 0.14) 88%,
            rgba(12, 21, 34, 0) 100%
        );
    }

    .tg-composer::after {
        background: transparent;
    }

    .tg-panel {
        z-index: 5;
        bottom: calc(var(--tg-composer-height, 74px) + 10px);
    }

    .tg-panel--expression {
        bottom: calc(var(--tg-composer-height, 74px) + 8px);
    }
}

.is-hidden {
    display: none !important;
}

