:root {
    --bg: #0a0a0b;
    --bg-card: #111113;
    --bg-card-hover: #18181b;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --accent: #e07c4c;
    --accent-soft: rgba(224, 124, 76, 0.15);
    --border: rgba(255, 255, 255, 0.06);
    --glow: rgba(224, 124, 76, 0.25);
    --success: #22c55e;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.5;
    padding: 0 20px 80px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(80px, env(safe-area-inset-bottom));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(224, 124, 76, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(224, 124, 76, 0.04), transparent);
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    max-width: 80rem;
    margin: 0 auto;
    padding-top: 48px;
}

.header {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header h1 {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}

.btn:hover {
    background: #c96a3d;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px var(--glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text);
    border-color: rgba(224, 124, 76, 0.35);
}

/* Главная (заглушка) */
.closure-wrap {
    max-width: 40rem;
    margin: 0 auto;
    text-align: center;
    padding: 8px 0 48px;
}

.closure-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.closure-title {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(2.25rem, 7vw, 3.25rem);
    font-weight: 700;
    line-height: 1.08;
    margin-bottom: 16px;
}

.closure-lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.65;
    margin-bottom: 28px;
}

.closure-video-box {
    margin: 0 auto 28px;
    max-width: min(100%, 320px);
    aspect-ratio: 9 / 16;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.5);
}

.closure-video-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.closure-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
}

.closure-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}

.closure-footnote {
    margin-top: 36px;
    font-size: 0.85rem;
    color: rgba(250, 250, 250, 0.45);
    line-height: 1.5;
}

/* Архив чата — современная «социальная» лента */
.archive-scope {
    --chat-bg-top: #111318;
    --chat-bg-bottom: #0b0c10;
    --chat-surface: rgba(18, 20, 28, 0.65);
    --bubble-bg: rgba(30, 34, 48, 0.82);
    --bubble-border: rgba(255, 255, 255, 0.07);
    --bubble-highlight: rgba(255, 255, 255, 0.04);
    --reply-bar: rgba(224, 124, 76, 0.55);
    --link-blue: #7ec8ff;
    --muted-fill: rgba(255, 255, 255, 0.04);
}

.archive-scope .page {
    max-width: min(64rem, calc(100% - 1.25rem));
    margin-left: auto;
    margin-right: auto;
}

body.archive-scope::before {
    background:
        radial-gradient(ellipse 100% 80% at 50% -30%, rgba(224, 124, 76, 0.09), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 50%, rgba(94, 156, 255, 0.05), transparent 50%),
        radial-gradient(ellipse 60% 40% at 0% 80%, rgba(224, 124, 76, 0.04), transparent 45%);
}

.archive-scope .content-plain {
    max-width: none;
}

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

.archive-meta-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    backdrop-filter: blur(12px);
}

.archive-meta-strip .archive-meta-line {
    margin-bottom: 0;
    flex: none;
    min-width: 0;
}

.archive-scope .archive-meta-line {
    font-size: 0.8125rem;
    color: rgba(250, 250, 250, 0.55);
    line-height: 1.5;
}

.archive-scope .archive-meta-line strong {
    color: var(--accent);
    font-weight: 600;
}

.archive-toolbar--minimal {
    position: sticky;
    top: 8px;
    z-index: 20;
    background: rgba(14, 15, 19, 0.82);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 6px 7px;
    margin-bottom: 12px;
    box-shadow:
        0 3px 18px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.toolbar-single-search {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.toolbar-single-search input[type="search"] {
    flex: 1;
    min-width: 0;
}

.btn-advanced-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(250, 250, 250, 0.75);
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s,
        box-shadow 0.2s;
}

.btn-advanced-toggle:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.btn-advanced-toggle[aria-expanded="true"] {
    background: rgba(224, 124, 76, 0.15);
    border-color: rgba(224, 124, 76, 0.35);
    color: var(--accent);
}

.btn-advanced-toggle.is-active:not([aria-expanded="true"]) {
    box-shadow: inset 0 0 0 1px rgba(224, 124, 76, 0.25);
}

.btn-advanced-toggle__ico {
    display: block;
}

.toolbar-advanced-panel {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.toolbar-advanced-panel[hidden] {
    display: none;
}

.toolbar-advanced-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.toolbar-advanced-actions .btn {
    flex: 1;
    min-width: 92px;
}

.toolbar-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
}

.toolbar-filters-grid label {
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(250, 250, 250, 0.38);
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
}

.archive-toolbar input,
.archive-toolbar select {
    width: 100%;
    padding: 7px 9px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    transition:
        border-color 0.2s,
        box-shadow 0.15s,
        background 0.2s;
}

.archive-toolbar input::placeholder {
    color: rgba(250, 250, 250, 0.3);
}

.archive-toolbar input:hover,
.archive-toolbar select:hover {
    border-color: rgba(255, 255, 255, 0.11);
    background: rgba(0, 0, 0, 0.22);
}

.archive-toolbar input:focus,
.archive-toolbar select:focus {
    outline: none;
    border-color: rgba(224, 124, 76, 0.4);
    box-shadow: 0 0 0 2px rgba(224, 124, 76, 0.1);
    background: rgba(0, 0, 0, 0.32);
}

.archive-toolbar .btn-compact {
    padding: 8px 12px;
    min-height: 38px;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 9px;
    white-space: nowrap;
}

.archive-scope .header h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    background: linear-gradient(135deg, #fafafa 0%, rgba(250, 250, 250, 0.78) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tg-chat {
    position: relative;
    background:
        linear-gradient(180deg, var(--chat-bg-top) 0%, var(--chat-bg-bottom) 100%),
        radial-gradient(circle at 20% 20%, rgba(224, 124, 76, 0.04) 0%, transparent 45%),
        radial-gradient(circle at 90% 60%, rgba(90, 140, 255, 0.035) 0%, transparent 40%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    padding: 14px 10px 18px;
    min-height: 46vh;
    font-size: 0.9375rem;
    line-height: 1.55;
    letter-spacing: 0.01em;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.archive-scope .tg-chat {
    padding: 16px clamp(14px, 3vw, 28px) 22px;
    max-width: min(64rem, 100%);
    margin-left: auto;
    margin-right: auto;
}

/* лёгкая «ткань» фона */
.tg-chat::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 14px 14px;
    pointer-events: none;
    opacity: 0.7;
    border-radius: inherit;
}

.tg-chat > * {
    position: relative;
    z-index: 1;
}

.tg-day {
    text-align: center;
    color: rgba(250, 250, 250, 0.38);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 22px 0 14px;
}

.tg-day span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.tg-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    scroll-margin-top: 100px;
    scroll-margin-bottom: 24px;
    animation: tg-row-in 0.35s ease-out both;
}

.archive-scope .tg-msg.tg-user {
    align-items: flex-start;
}

@keyframes tg-row-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tg-msg.tg-service {
    justify-content: center;
    margin: 16px 0;
    animation: none;
}

.tg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: -0.02em;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.archive-scope .tg-body {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 48px);
}

.tg-body {
    flex: 1;
    min-width: 0;
}

.archive-scope .tg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 0.74rem;
}

.tg-bubble {
    background: var(--bubble-bg);
    border-radius: 18px 20px 20px 8px;
    padding: 11px 14px 10px;
    border: 1px solid var(--bubble-border);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 var(--bubble-highlight);
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

@keyframes tg-jump-pulse {
    0% {
        border-color: var(--bubble-border);
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.22),
            inset 0 1px 0 var(--bubble-highlight);
    }
    20% {
        border-color: rgba(224, 124, 76, 0.55);
        box-shadow:
            0 0 0 4px rgba(224, 124, 76, 0.18),
            0 14px 42px rgba(224, 124, 76, 0.14),
            inset 0 1px 0 rgba(255, 255, 255, 0.08);
        transform: scale(1.015);
    }
    100% {
        border-color: var(--bubble-border);
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.22),
            inset 0 1px 0 var(--bubble-highlight);
        transform: scale(1);
    }
}

.tg-msg.tg-msg--jump-flash .tg-bubble {
    animation: tg-jump-pulse 1.4s cubic-bezier(0.33, 1, 0.68, 1) forwards;
    will-change: transform, box-shadow;
}

.tg-msg.tg-service.tg-msg--jump-flash .tg-bubble {
    animation-duration: 1.4s;
}

.tg-msg.tg-user:hover .tg-bubble {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 6px 28px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tg-service .tg-bubble {
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8125rem;
    color: rgba(250, 250, 250, 0.52);
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
    max-width: 92%;
    text-align: center;
    line-height: 1.45;
}

.tg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.tg-name {
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.tg-time {
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgba(250, 250, 250, 0.32);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.tg-edited {
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(250, 250, 250, 0.28);
    margin-left: 2px;
    text-transform: lowercase;
}

.tg-text {
    word-wrap: break-word;
    color: rgba(250, 250, 250, 0.94);
    font-size: 0.9375rem;
}

.tg-text a {
    color: var(--link-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(126, 200, 255, 0.35);
    transition: border-color 0.15s, color 0.15s;
}

.tg-text a:hover {
    color: #a8ddff;
    border-bottom-color: rgba(168, 221, 255, 0.55);
}

.tg-reply {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 8px 10px 8px 14px;
    margin-bottom: 10px;
    background: linear-gradient(
        105deg,
        rgba(224, 124, 76, 0.12) 0%,
        rgba(0, 0, 0, 0.12) 45%,
        rgba(255, 255, 255, 0.03) 100%
    );
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
    transition:
        background 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        transform 0.18s ease;
}

.tg-reply::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--accent) 0%, rgba(224, 124, 76, 0.35) 100%);
    box-shadow: 0 0 12px rgba(224, 124, 76, 0.25);
}

.tg-reply:hover {
    background: linear-gradient(
        105deg,
        rgba(224, 124, 76, 0.18) 0%,
        rgba(0, 0, 0, 0.16) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    border-color: rgba(224, 124, 76, 0.22);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.tg-reply:active {
    transform: translateY(0);
}

.tg-reply-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(252, 194, 160, 0.95);
    margin-bottom: 4px;
}

.tg-reply-author::before {
    content: "↩";
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.75;
    transform: translateY(-0.05em);
}

.tg-reply-snippet {
    font-size: 0.78125rem;
    line-height: 1.35;
    color: rgba(250, 250, 250, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tg-media img,
.tg-media video:not(.tg-round-video__video):not(.tg-native-video__el) {
    max-width: 100%;
    border-radius: 14px;
    display: block;
    margin-top: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.tg-media a {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tg-media a:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tg-media--inline-video {
    margin-top: 10px;
    max-width: 100%;
}

/* Встроенное видео и GIF — плеер в духе мессенджера */
.tg-native-video {
    max-width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: radial-gradient(
        120% 80% at 50% 30%,
        rgba(40, 44, 58, 0.9) 0%,
        #0a0b10 100%
    );
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.42);
}

.tg-native-video__viewport {
    position: relative;
    margin: 0 auto;
}

.tg-native-video__el {
    width: 100%;
    display: block;
    margin: 0;
    max-height: min(72vh, 620px);
    object-fit: contain;
    cursor: pointer;
    background: #000;
}

.tg-native-video__bigplay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(10px);
    z-index: 2;
    transition:
        opacity 0.2s,
        transform 0.18s ease;
}

.tg-native-video__bigplay:hover {
    background: rgba(0, 0, 0, 0.62);
    transform: translate(-50%, -50%) scale(1.04);
}

.tg-native-video__bigplay::after {
    content: "";
    position: absolute;
    left: 54%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
}

.tg-native-video.is-playing .tg-native-video__bigplay {
    opacity: 0;
    pointer-events: none;
}

.tg-native-video.is-playing .tg-native-video__bigplay:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.tg-native-video__chrome {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 28px 10px 8px;
    background: linear-gradient(
        to top,
        rgba(5, 6, 10, 0.88),
        rgba(5, 6, 10, 0.35) 60%,
        transparent
    );
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tg-native-video__seekrow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tg-native-video__cur {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.92);
}

.tg-native-video__track {
    flex: 1 1 auto;
    min-width: 0;
    height: 4px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    position: relative;
}

.tg-native-video__prog {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, #2b8cfe, #3390ec);
    width: 0%;
    min-width: 0;
    transition: width 96ms linear;
    box-shadow: 0 0 10px rgba(51, 144, 236, 0.45);
    pointer-events: none;
}

.tg-native-video__total {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.55);
    min-width: 2.25rem;
    text-align: right;
}

.tg-native-video__open {
    align-self: flex-end;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    text-decoration: none;
}

.tg-native-video__open:hover {
    color: rgba(255, 255, 255, 0.75);
}

@media (prefers-reduced-motion: reduce) {
    .tg-native-video__prog {
        transition-duration: 40ms;
    }
}

.tg-media--round {
    margin-top: 10px;
    display: inline-block;
    vertical-align: top;
}

/* Голосовое — пузырь и плеер в духе Telegram (тёмная тема, исходящие) */
.tg-native-voice {
    --tg-play: #3390ec;
    --tg-play-hover: #4a9ef0;
    --tg-bubble: linear-gradient(165deg, rgba(43, 82, 120, 0.72) 0%, rgba(28, 58, 92, 0.65) 100%);
    --tg-wave-dim: rgba(255, 255, 255, 0.28);
    --tg-wave-lit: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(320px, 100%);
    margin-top: 10px;
    padding: 8px 12px 8px 10px;
    border-radius: 18px;
    background: var(--tg-bubble);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
}

.tg-voice__btn {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: var(--tg-play);
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.45);
    transition:
        background 0.15s,
        transform 0.12s;
    position: relative;
}

.tg-voice__btn:hover {
    background: var(--tg-play-hover);
}

.tg-voice__btn:active {
    transform: scale(0.96);
}

.tg-voice__btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
}

.tg-native-voice.is-playing .tg-voice__btn::after {
    width: 12px;
    height: 14px;
    left: 50%;
    top: 50%;
    border: none;
    background: linear-gradient(
        90deg,
        #fff 0 31%,
        transparent 31% 69%,
        #fff 69% 100%
    );
    transform: translate(-50%, -50%);
}

.tg-voice__track {
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
    padding: 4px 0;
}

.tg-voice__meter {
    container-type: inline-size;
    container-name: tg-voice-meter;
    position: relative;
    height: 30px;
    width: 100%;
}

.tg-voice__lit-mask {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    overflow: hidden;
    width: 0%;
    z-index: 1;
    pointer-events: none;
    transition: width 118ms cubic-bezier(0.32, 0.72, 0.28, 1);
}

.tg-voice__lit-mask--snap {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .tg-voice__lit-mask {
        transition-duration: 42ms;
    }

    .tg-voice__bar {
        transition: none;
    }
}

.tg-voice__lit-mask .tg-voice__bars {
    width: 100cqw;
    min-width: 100cqw;
}

.tg-voice__wave-stack {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 26px;
}

.tg-voice__bars {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 1.5px;
    pointer-events: none;
}

.tg-voice__bar {
    flex: 1 1 0;
    min-width: 2px;
    max-width: 4px;
    align-self: center;
    border-radius: 999px;
    background: currentColor;
    min-height: 4px;
    transition:
        opacity 0.15s ease,
        transform 0.15s ease;
}

.tg-voice__bars--dim {
    color: var(--tg-wave-dim);
}

.tg-voice__bars--lit {
    color: var(--tg-wave-lit);
}

.tg-voice__meta {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0.02em;
}

.tg-voice__cur {
    color: rgba(255, 255, 255, 0.95);
}

.tg-voice__slash {
    opacity: 0.45;
    font-weight: 500;
}

.tg-voice__total {
    opacity: 0.55;
    font-weight: 500;
}

.tg-voice__html5 {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    clip: rect(0 0 0 0);
}

/* Видеокружок — как в Telegram */
.tg-round-video.tg-round-video--tg {
    display: inline-block;
    vertical-align: top;
}

.tg-round-video__wrap {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
    position: relative;
    width: 210px;
    height: 210px;
    display: inline-block;
    vertical-align: top;
}

.tg-round-video__prog-svg {
    position: absolute;
    left: -4px;
    top: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.tg-round-video__prog-trail {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 2.5;
}

.tg-round-video__prog-elapsed {
    fill: none;
    stroke: rgba(255, 255, 255, 0.94);
    stroke-width: 2.9;
    stroke-linecap: round;
    transition: stroke-dashoffset 92ms linear;
}

.tg-round-video__disc {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #1a1d24;
}

.tg-round-video__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
}

.tg-round-video__ring {
    pointer-events: none;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 3px rgba(255, 255, 255, 0.14),
        inset 0 0 20px rgba(0, 0, 0, 0.35);
}

.tg-round-video__tap {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    transition:
        opacity 0.2s,
        transform 0.15s;
    z-index: 2;
}

.tg-round-video__tap:hover {
    background: rgba(0, 0, 0, 0.55);
    transform: translate(-50%, -50%) scale(1.04);
}

.tg-round-video__tap::after {
    content: "";
    position: absolute;
    left: 52%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 17px;
    border-color: transparent transparent transparent #fff;
}

.tg-round-video--tg.is-playing .tg-round-video__tap {
    opacity: 0;
    pointer-events: none;
}

.tg-round-video--tg.is-playing .tg-round-video__tap:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.tg-round-video__remain {
    pointer-events: none;
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 3;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
    background: rgba(0, 0, 0, 0.52);
    letter-spacing: 0.02em;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .tg-round-video__prog-elapsed {
        transition-duration: 40ms;
    }
}

.tg-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--muted-fill);
    border: 1px solid rgba(255, 255, 255, 0.07);
    margin-top: 10px;
    backdrop-filter: blur(8px);
}

.tg-file a {
    color: var(--link-blue);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

.tg-file a:hover {
    border-bottom-color: rgba(126, 200, 255, 0.4);
}

.tg-sticker-missing {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.tg-sticker-missing a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.tg-sticker-missing a:hover {
    text-decoration: underline;
}

.tg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tg-react {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 100px;
    background: rgba(224, 124, 76, 0.1);
    border: 1px solid rgba(224, 124, 76, 0.18);
    color: rgba(250, 250, 250, 0.85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.reaction-ctx-popover {
    position: fixed;
    z-index: 100600;
    left: 0;
    top: 0;
    min-width: 228px;
    max-width: min(380px, calc(100vw - 24px));
    padding: 0;
    margin: 0;
    border-radius: 14px;
    border: 1px solid rgba(224, 124, 76, 0.22);
    background: rgba(22, 20, 20, 0.97);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.25);
    color: rgba(250, 250, 250, 0.92);
    overflow: hidden;
}

.reaction-ctx-popover[hidden] {
    display: none !important;
}

.reaction-ctx-popover__inner {
    max-height: min(320px, 52vh);
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.reaction-ctx-popover__grp {
    margin-bottom: 12px;
}

.reaction-ctx-popover__grp:last-child {
    margin-bottom: 0;
}

.reaction-ctx-popover__grp-title {
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
    color: rgba(250, 250, 250, 0.95);
}

.reaction-ctx-popover__empty {
    margin: 0;
    padding: 6px 0 2px;
    color: rgba(250, 250, 250, 0.45);
    font-size: 0.75rem;
}

.reaction-ctx-popover__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.reaction-ctx-popover__list li {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.reaction-ctx-popover__list li:first-child {
    border-top: none;
}

.reaction-ctx-popover__who {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.reaction-ctx-popover__when {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0.65;
    font-size: 0.76rem;
}

.archive-status {
    text-align: center;
    padding: 20px 16px 8px;
    color: rgba(250, 250, 250, 0.38);
    font-size: 0.8125rem;
    font-weight: 500;
}

#archive-sentinel-wrap {
    border-radius: 0 0 16px 16px;
}

#archive-error-box {
    display: none;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #fecaca;
    font-size: 0.875rem;
    line-height: 1.55;
}

code {
    font-size: 0.88em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .tg-chat {
        padding: 12px 8px 16px;
        border-radius: 16px;
    }

    .tg-round-video__wrap {
        width: min(200px, 72vw);
        height: min(200px, 72vw);
    }

    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}

@media (prefers-reduced-motion: reduce) {
    .tg-msg {
        animation: none;
    }

    .tg-msg.tg-msg--jump-flash .tg-bubble {
        animation: none;
        border-color: rgba(224, 124, 76, 0.42) !important;
        box-shadow: 0 0 0 2px rgba(224, 124, 76, 0.2) !important;
        transition: border-color 0.6s ease, box-shadow 0.6s ease;
    }

    .tg-reply:hover,
    .tg-media a:hover {
        transform: none;
    }
}
