:root {
    --bg: #12101a;
    --surface: #1b1826;
    --surface-2: #221e2f;
    --accent: #a855f7;
    --accent-deep: #7c3aed;
    --text: #ece9f5;
    --muted: #8b85a0;
    --line: rgba(168, 85, 247, 0.12);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: var(--tg-viewport-stable-height, 100vh);
}

#title {
    margin: 0 0 14px 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

#list {
    overflow-anchor: none;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
}

#list::-webkit-scrollbar {
    display: none;
}

.chat {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 8px;
    font-size: 16px;
    transition: transform 0.12s ease, background 0.12s ease;
}

.chat:active {
    transform: scale(0.985);
    background: var(--surface-2);
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--accent), var(--accent-deep));
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.name {
    font-weight: 600;
}

.preview {
    font-size: 14px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time {
    margin-left: auto;
    align-self: flex-start;
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 78%;
    width: fit-content;
    font-size: 16px;
    line-height: 1.35;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px 16px 16px 5px;
    padding: 9px 13px;
    margin-bottom: 6px;
    word-break: break-word;
}

.message[data-own] {
    background: linear-gradient(140deg, var(--accent-deep), #6d28d9);
    border-color: transparent;
    border-radius: 16px 16px 5px 16px;
    margin-left: auto;
}

.message[data-deleted] {
    opacity: 0.55;
    border-style: dashed;
}

.msg-time {
    flex-shrink: 0;
    font-size: 11px;
    opacity: 0.65;
    white-space: nowrap;
}

.message[data-deleted] .msg-time::before {
    content: "удалено · ";
}

.day {
    text-align: center;
    margin: 18px 0 12px;
}

.day::first-line {
    line-height: 1;
}

.day {
    font-size: 12px;
    color: var(--muted);
}

.error {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

.quote {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding-top: 10px;
    opacity: 0.7;
}