:root {
    --tg-bg-color: #0f0f0f;
    --tg-secondary-bg: #1c1c1e;
    --tg-text-color: #ffffff;
    --tg-hint-color: #98989e;
    --tg-link-color: #2ea6ff;
    --tg-my-message-bg: #2b5278;
    --tg-avatar-maya: #ff6b6b;
    --tg-avatar-nikita: #6b9fff;
    --tg-header-bg: #1c1c1e;
    --tg-border: #2c2c2e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.tg-app {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--tg-bg-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

/* Хедер */
.tg-header {
    background: var(--tg-header-bg);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--tg-border);
    z-index: 10;
}

.back-btn {
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.1); }
.back-btn svg { width: 20px; height: 20px; stroke: var(--tg-text-color); }

.user-info {
    flex: 1;
}
.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tg-text-color);
}
.user-status {
    font-size: 0.75rem;
    color: var(--tg-hint-color);
}

.avatar-group {
    display: flex;
    gap: -8px;
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid var(--tg-header-bg);
    margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }
.maya-avatar { background: var(--tg-avatar-maya); color: white; z-index: 1; }
.nikita-avatar { background: var(--tg-avatar-nikita); color: white; }

/* Чат */
.tg-chat {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: none;
}
.tg-chat::-webkit-scrollbar { display: none; }

.date-badge {
    align-self: center;
    background: var(--tg-secondary-bg);
    color: var(--tg-hint-color);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 12px;
    margin: 8px 0;
}

/* Сообщения */
.message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.35;
    position: relative;
    word-break: break-word;
    animation: fadeInUp 0.3s ease-out;
    color: var(--tg-text-color);
}

.message.nikita {
    align-self: flex-end;
    background: var(--tg-my-message-bg);
    border-bottom-right-radius: 6px;
}

.message.maya {
    align-self: flex-start;
    background: var(--tg-secondary-bg);
    border-bottom-left-radius: 6px;
}

/* Файловое сообщение */
.message-file {
    background: var(--tg-secondary-bg);
    border-radius: 16px;
    padding: 10px;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom-left-radius: 6px;
}

.message-file.nikita {
    align-self: flex-end;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 6px;
}
.message-file.maya {
    align-self: flex-start;
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 6px;
}

.file-preview {
    width: 100%;
    height: 90px;
    background: var(--tg-bg-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    overflow: hidden;
}

.file-icon-animated {
    animation: filePulse 1.8s ease-in-out infinite;
    display: inline-block;
}

@keyframes filePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.file-caption {
    font-size: 0.85rem;
    color: var(--tg-hint-color);
    line-height: 1.3;
    padding: 0 2px;
}

/* Ввод */
.tg-input-area {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: var(--tg-secondary-bg);
    gap: 8px;
    border-top: 1px solid var(--tg-border);
}

.attach-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}
.attach-btn:hover { background: rgba(255,255,255,0.1); }
.attach-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--tg-hint-color);
}

.input-field {
    flex: 1;
    background: var(--tg-bg-color);
    border: none;
    border-radius: 20px;
    padding: 10px 14px;
    color: var(--tg-text-color);
    font-size: 0.95rem;
    outline: none;
    transition: background 0.2s;
}
.input-field:focus {
    background: #2c2c2e;
}
.input-field::placeholder {
    color: var(--tg-hint-color);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--tg-link-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.send-btn:active { transform: scale(0.92); }
.send-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Анимация появления */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.chat-custom-link {
    color: var(--tg-link-color);
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    word-break: break-all;
}
.chat-custom-link:hover {
    text-decoration: underline;
}
.video-link-preview {
    background: #121214 !important;
    border: 1px solid #ff00003b;
}
