:root {
    --bg: #d9e6f2;
    --bg-pattern: #cfdeec;
    --surface: #ffffff;
    --text: #1c1f23;
    --muted: #7a8794;
    --accent: #2f6fed;
    --accent-soft: #e8f0fe;
    --radius: 16px;
    --column: 640px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 12px 12px, var(--bg-pattern) 2px, transparent 3px),
        radial-gradient(circle at 42px 38px, var(--bg-pattern) 3px, transparent 4px),
        radial-gradient(circle at 70px 16px, var(--bg-pattern) 1.5px, transparent 2.5px);
    background-size: 84px 60px;
    background-attachment: fixed;
}

a {
    color: var(--accent);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.channel {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.channel__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: var(--column);
    margin: 0 auto;
    padding: 8px 14px;
    color: inherit;
    text-decoration: none;
}

.channel__avatar {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.channel__avatar--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    color: #fff;
    background: linear-gradient(135deg, #5b8cff, #7a4dff);
}

.channel__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.channel__title {
    font-weight: 600;
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel__subs {
    font-size: 13px;
    color: var(--muted);
}

.chat {
    max-width: var(--column);
    margin: 0 auto;
    padding: 10px 10px 96px;
}

.pinned {
    display: block;
    margin: 0 0 10px;
    padding: 8px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.pinned__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.pinned__title {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bubble {
    margin: 0 0 12px;
    max-width: 520px;
    overflow: hidden;
    border-radius: var(--radius);
    border-bottom-left-radius: 6px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.bubble__media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 640px;
    object-fit: cover;
    background: #eef2f6;
}

.bubble__media--grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.bubble__media--grid img {
    height: 100%;
    aspect-ratio: 1 / 1;
}

.bubble__text {
    padding: 10px 14px 0;
    overflow-wrap: anywhere;
}

.bubble__text p {
    margin: 0 0 10px;
}

.bubble__text p:last-child {
    margin-bottom: 0;
}

.bubble__text .tag {
    color: var(--accent);
}

.bubble__text .heading {
    font-size: 17px;
}

.bubble__text .quote {
    display: block;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    color: #44505c;
}

.bubble__text code {
    padding: 1px 4px;
    border-radius: 4px;
    background: #eef2f6;
    font-size: 14px;
}

.bubble__meta {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 4px 14px 8px;
    font-size: 12px;
    color: var(--muted);
}

.bubble__meta a {
    color: inherit;
    text-decoration: none;
}

.bubble__meta a:hover {
    text-decoration: underline;
}

.bubble__button {
    display: block;
    margin: 0 8px 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.bubble__button:hover {
    background: #dbe7fd;
}

.more {
    display: block;
    max-width: 520px;
    margin: 0 0 12px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.empty {
    max-width: 520px;
    padding: 24px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
    color: var(--muted);
}

.legal {
    max-width: var(--column);
    margin: 0 auto;
    padding: 4px 16px 96px;
    color: var(--muted, #8a8f98);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}
.join {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.join__button {
    display: block;
    max-width: calc(var(--column) - 20px);
    margin: 0 auto;
    padding: 12px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

@media (min-width: 700px) {
    .chat {
        padding-top: 16px;
    }

    .bubble,
    .more,
    .empty {
        max-width: 560px;
    }
}
.chat + .legal {
    margin-top: -86px;
}
