/* TikTok DM / Chat Biolink */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ttc-bg: #000000;
    --ttc-header-bg: #000000;
    --ttc-body-bg: #121212;
    --ttc-text: #ffffff;
    --ttc-text-muted: rgba(255, 255, 255, 0.55);
    --ttc-accent: #fe2c55;
    --ttc-bubble-in: #2f2f2f;
    --ttc-bubble-out: #fe2c55;
    --ttc-bubble-out-text: #ffffff;
    --ttc-composer-bg: #1a1a1a;
    --ttc-border: rgba(255, 255, 255, 0.1);
    --ttc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body { height: 100%; overflow: hidden; }

.ttc-page {
    background: #0a0a0a;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    font-family: var(--ttc-font);
    -webkit-font-smoothing: antialiased;
}

.ttc-app {
    width: 100%;
    max-width: 430px;
    height: 100vh;
    height: 100dvh;
    background: var(--ttc-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
}

.ttc-header {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 8px 0;
    background: var(--ttc-header-bg);
    border-bottom: 1px solid var(--ttc-border);
    flex-shrink: 0;
    min-height: 56px;
}

.ttc-header-back {
    color: var(--ttc-text);
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
}

.ttc-header-back svg { width: 22px; height: 22px; }

.ttc-header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ttc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.ttc-avatar-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #25f4ee, #fe2c55);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.ttc-header .chat-header-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--ttc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ttc-status {
    font-size: 12px;
    color: var(--ttc-text-muted);
}

.ttc-status.is-active { color: #25f4ee; }

.ttc-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-header-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--ttc-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    border-radius: 50%;
}

.chat-header-btn svg { width: 20px; height: 20px; }

.ttc-body {
    flex: 1;
    overflow-y: auto;
    background: var(--ttc-body-bg);
    padding: 12px 12px 8px;
    -webkit-overflow-scrolling: touch;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-msg {
    display: flex;
    max-width: 85%;
}

.chat-msg-in { align-self: flex-start; }
.chat-msg-out { align-self: flex-end; }

.chat-bubble {
    background: var(--ttc-bubble-in);
    color: var(--ttc-text);
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg-out .chat-bubble {
    background: var(--ttc-bubble-out);
    color: var(--ttc-bubble-out-text);
    border-bottom-right-radius: 4px;
}

.chat-msg-in .chat-bubble { border-bottom-left-radius: 4px; }

.chat-media {
    max-width: 220px;
    border-radius: 12px;
    display: block;
}

.chat-media-video { width: 100%; }

.chat-media-audio {
    width: 100%;
    max-width: 280px;
}

.chat-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.chat-btn {
    background: transparent;
    border: 1px solid var(--ttc-accent);
    color: var(--ttc-accent);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.chat-msg-out .chat-btn {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.chat-date-divider {
    text-align: center;
    font-size: 12px;
    color: var(--ttc-text-muted);
    margin: 12px 0;
}

.chat-typing-wrap { padding: 4px 0; }

.chat-typing {
    display: inline-flex;
    background: var(--ttc-bubble-in);
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ttc-text-muted);
    animation: ttc-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ttc-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

.ttc-composer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--ttc-composer-bg);
    border-top: 1px solid var(--ttc-border);
    flex-shrink: 0;
}

.ttc-composer-field { flex: 1; }

.ttc-composer-input {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 20px;
    background: #2f2f2f;
    color: var(--ttc-text);
    padding: 0 16px;
    font-size: 15px;
    font-family: inherit;
}

.ttc-composer-input::placeholder { color: var(--ttc-text-muted); }

.ttc-composer-btn,
.ttc-composer-send {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--ttc-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.ttc-composer-send { color: var(--ttc-accent); }
.ttc-composer-btn svg,
.ttc-composer-send svg { width: 22px; height: 22px; }

.ttc-brand {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    background: var(--ttc-composer-bg);
    border-top: 1px solid var(--ttc-border);
}

.ttc-brand a { color: var(--ttc-text-muted); text-decoration: none; }
