.tg-demo {
    display: flex;
    justify-content: center;
    width: 100%;
}
.tg-demo-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 340px;
    height: 640px;
    overflow: hidden;
    border: 9px solid #0b0b0f;
    border-radius: 44px;
    background: radial-gradient(circle at 15% 20%, rgba(124, 92, 240, .22), transparent 45%),
                radial-gradient(circle at 85% 75%, rgba(160, 102, 230, .18), transparent 50%),
                linear-gradient(165deg, #1b1428 0%, #0f0c17 55%, #181024 100%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.35;
    color: #fff;
    user-select: none;
}

.tg-demo-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 10px 10px;
    background: linear-gradient(to bottom, rgba(15, 12, 23, .9), rgba(15, 12, 23, 0));
}
.tg-demo-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: 20px;
    background: rgba(44, 37, 60, .9);
    backdrop-filter: blur(8px);
}
.tg-demo-back {
    width: 40px;
    font-size: 22px;
}
.tg-demo-title {
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 0 12px;
    line-height: 1.15;
}
.tg-demo-title b {
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tg-demo-title small {
    font-size: 11px;
    color: rgba(255, 255, 255, .55);
}
.tg-demo-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1f2a3a;
}
.tg-demo-avatar img {
    width: 26px;
    height: 26px;
}

.tg-demo-chat {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tg-demo-messages {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    min-height: 100%;
    padding: 70px 8px 8px;
    transition: transform .35s ease-out;
}

.tg-msg {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 88%;
}
.tg-msg.is-shown {
    display: flex;
    animation: tg-demo-in .25s ease-out;
}
.tg-msg.is-edited {
    animation: none;
}
.tg-msg-out {
    align-self: flex-end;
    align-items: flex-end;
}
.tg-bubble {
    padding: 6px 10px 6px;
    border-radius: 16px 16px 16px 6px;
    background: rgba(44, 37, 60, .95);
    word-break: break-word;
}
.tg-msg-out .tg-bubble {
    border-radius: 16px 16px 6px 16px;
    background: linear-gradient(135deg, #7b5cf0, #a066e6);
}
.tg-bubble b {
    font-weight: 600;
}
.tg-demo-label {
    display: inline-block;
    margin-bottom: 6px;
    padding: 1px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    font-size: 11px;
    color: rgba(255, 255, 255, .7);
}
.tg-time {
    float: right;
    margin: 8px 0 -4px 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, .5);
}
.tg-msg-out .tg-time {
    color: rgba(255, 255, 255, .75);
}
.tg-check {
    font-style: normal;
    letter-spacing: -4px;
}
.tg-link {
    color: #8db4ff;
}

.tg-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.tg-buttons-row {
    flex-direction: row;
}
.tg-btn {
    position: relative;
    flex: 1;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(44, 37, 60, .85);
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    transition: background .15s;
}
.tg-btn.is-pressed {
    background: rgba(120, 100, 170, .95);
}
.tg-btn-url::after {
    content: "↗";
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, .7);
}

.tg-demo-start {
    display: none;
    margin: 6px 10px 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(44, 37, 60, .95);
    text-align: center;
    font-weight: 600;
    letter-spacing: .5px;
    color: #a98cff;
    transition: background .15s;
}
.tg-demo-start.is-pressed {
    background: rgba(120, 100, 170, .95);
}
.tg-demo.is-idle .tg-demo-start {
    display: block;
}

.tg-demo-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 10px;
}
.tg-demo.is-idle .tg-demo-bar {
    display: none;
}
.tg-demo-round {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(44, 37, 60, .9);
    font-size: 18px;
    color: rgba(255, 255, 255, .85);
}
.tg-demo-input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    overflow: hidden;
    border-radius: 19px;
    background: rgba(44, 37, 60, .9);
    line-height: 38px;
    white-space: nowrap;
}
.tg-demo-placeholder {
    color: rgba(255, 255, 255, .45);
}
.tg-demo-send {
    display: none;
    background: #7b5cf0;
    color: #fff;
}
.tg-demo-input-text:empty {
    display: none;
}
.tg-demo-input-text::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 16px;
    margin-left: 1px;
    vertical-align: middle;
    background: #a98cff;
    animation: tg-demo-caret 1s steps(1) infinite;
}
.tg-demo-bar.is-typing .tg-demo-placeholder,
.tg-demo-bar.is-typing .tg-demo-mic {
    display: none;
}
.tg-demo-bar.is-typing .tg-demo-send {
    display: flex;
}

.tg-demo-keyboard {
    display: none;
    gap: 6px;
    padding: 6px 8px 12px;
    background: rgba(20, 16, 30, .95);
}
.tg-demo-keyboard.is-shown {
    display: flex;
}
.tg-demo-keyboard span {
    flex: 1;
    padding: 9px 0;
    border-radius: 8px;
    background: rgba(60, 52, 80, .9);
    text-align: center;
    font-weight: 500;
}

.tg-demo-tap {
    position: absolute;
    z-index: 4;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .45);
    opacity: 0;
    pointer-events: none;
}
.tg-demo-tap.is-active {
    animation: tg-demo-tap .6s ease-out;
}

@keyframes tg-demo-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes tg-demo-tap {
    0% {
        opacity: .9;
        transform: scale(.4);
    }
    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}
@keyframes tg-demo-caret {
    50% {
        opacity: 0;
    }
}

@media (min-width: 992px) {
    .tg-demo-screen {
        max-width: 330px;
        height: 545px;
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .tg-demo-screen {
        height: 600px;
        font-size: 13px;
    }
}
