/* Shared Telegram typography; media retain their original position and ratio. */
.tg-rich, .tg-rich-unavailable {
  --tg-accent: var(--news-accent, var(--server-accent, #b897ed));
  --tg-cut: 4px;
  --tg-button-cut: polygon(var(--tg-cut) 0, calc(100% - var(--tg-cut)) 0, calc(100% - var(--tg-cut)) var(--tg-cut), 100% var(--tg-cut), 100% calc(100% - var(--tg-cut)), calc(100% - var(--tg-cut)) calc(100% - var(--tg-cut)), calc(100% - var(--tg-cut)) 100%, var(--tg-cut) 100%, var(--tg-cut) calc(100% - var(--tg-cut)), 0 calc(100% - var(--tg-cut)), 0 var(--tg-cut), var(--tg-cut) var(--tg-cut));
  min-width: 0; overflow-wrap: anywhere; line-height: 1.6;
}
.tg-rich > :first-child, .tg-rich-quote > :first-child, .tg-rich-details-body > :first-child { margin-top: 0; }
.tg-rich > :last-child, .tg-rich-quote > :last-child, .tg-rich-details-body > :last-child { margin-bottom: 0; }
.markdown-body .tg-rich p { margin: 0 0 .8em; }
.markdown-body .tg-rich h1, .markdown-body .tg-rich h2, .markdown-body .tg-rich h3 { line-height: 1.35; margin: 1em 0 .6em; }
.markdown-body .tg-rich-quote, .tg-rich-details { margin: .6em 0; padding: .55em .8em; border: 0; border-inline-start: 3px solid var(--tg-accent); background: color-mix(in srgb, var(--tg-accent) 12%, #111913); border-radius: 0; color: inherit; }
.markdown-body .tg-rich-quote::before, .markdown-body .tg-rich-quote::after { content: none; }
.markdown-body .tg-rich-pullquote { text-align: center; color: var(--tg-accent); margin: 1em auto; padding: .5em; max-width: 90%; font-style: italic; }
.tg-rich-details { padding: 0; }
.tg-rich-details > summary { cursor: pointer; padding: .55em .8em; font-weight: 600; list-style: none; }
.tg-rich-details > summary::-webkit-details-marker { display: none; }
.tg-rich-details > summary::before { content: "⌄"; display: inline-block; margin-inline-end: .6em; transform: rotate(-90deg); transition: transform .2s; }
.tg-rich-details[open] > summary::before { transform: rotate(0); }
.tg-rich-details-body { padding: .3em .8em .8em; }
.tg-rich-spoiler { cursor: pointer; background: #62706b; color: transparent; border-radius: 2px; box-decoration-break: clone; }
.tg-rich-spoiler:not(.is-revealed) * { visibility: hidden; }
.tg-rich-spoiler.is-revealed { background: #ffffff0d; color: inherit; }
.tg-rich-spoiler:focus-visible, .tg-rich-details > summary:focus-visible { outline: 2px solid var(--tg-accent); outline-offset: 3px; }
.tg-rich mark { background: #e8c66a33; color: #ffe397; padding: 0 .12em; }
.markdown-body .tg-rich ul { list-style: square; padding-inline-start: 1.35em; }
.markdown-body .tg-rich ol { list-style: decimal; padding-inline-start: 1.8em; }
.markdown-body .tg-rich li { display: list-item; margin: .2em 0; }
.markdown-body .tg-rich li::marker { color: var(--tg-accent); }
.tg-rich .tg-rich-emoji { display: inline-block; width: 1.35em; height: 1.35em; margin: 0 .06em; vertical-align: -.28em; object-fit: contain; border: 0; border-radius: 0; }
.tg-rich-lottie > svg { width: 100%; height: 100%; }
.markdown-body .tg-rich-media { display: block; margin: .7em 0; min-width: 0; }
.markdown-body .tg-rich-quote > .tg-rich-media { margin: 0; }
.markdown-body blockquote.tg-rich-quote:has(.tg-rich-media) { width: 100%; max-width: 420px; box-sizing: border-box; }
.markdown-body .tg-rich-media img, .markdown-body .tg-rich-media video { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; border: 0; border-radius: 0; margin: 0; clip-path: none; }
.tg-rich-media-spoiler { margin: .6em 0; }
.tg-rich-media-spoiler > summary { cursor: pointer; padding: 1em; background: #26352b; color: #b9cbbb; }
.tg-rich-media audio { width: 100%; }
.tg-rich-media figcaption { font-size: .85em; opacity: .72; margin-top: .35em; }
.tg-rich-gallery-track { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; transition: height .3s ease; }
.tg-rich-gallery-track > .tg-rich-media { flex: 0 0 100%; scroll-snap-align: start; margin: 0; align-self: start; }
.tg-rich-gallery-controls { display: flex; align-items: center; justify-content: center; gap: 1em; padding: .4em; font-size: .85em; }
.tg-rich-collage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tg-rich-collage > .tg-rich-media { margin: 0; }
.tg-rich-table { width: 100%; overflow-x: auto; margin: .8em 0; overscroll-behavior-x: contain; }
.markdown-body .tg-rich-table table { width: 100%; border-collapse: collapse; margin: 0; font-size: inherit; }
.markdown-body .tg-rich-table td, .markdown-body .tg-rich-table th { padding: .7em .8em; border: 0; background: transparent; min-width: 90px; }
.markdown-body .tg-rich-table .is-compact td, .markdown-body .tg-rich-table .is-compact th { padding: .3em .5em; }
.markdown-body .tg-rich-table .is-bordered td, .markdown-body .tg-rich-table .is-bordered th { border: 1px solid #ffffff20; }
.markdown-body .tg-rich-table .is-striped tr:nth-child(even) { background: #ffffff06; }
.tg-rich-code { margin: .8em 0; background: #080d0a; min-width: 0; }
.tg-rich-code-head { display: flex; align-items: center; justify-content: space-between; padding: .45em .8em; background: #ffffff07; font-size: .8em; color: #a8b9ac; }
.markdown-body .tg-rich-code pre { margin: 0; padding: .8em; white-space: pre; overflow-x: auto; border: 0; }
.tg-rich-button-row { display: flex; flex-wrap: wrap; gap: .5em; margin: .65em 0; }
.tg-rich-button-row[data-align="left"] { justify-content: flex-start; }
.tg-rich-button-row[data-align="center"] { justify-content: center; }
.tg-rich-button-row[data-align="right"] { justify-content: flex-end; }
.markdown-body .tg-rich-button, .tg-rich-unavailable .tg-rich-button, .tg-rich-gallery-controls button, .tg-rich-code-head button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em; max-width: 100%; padding: .6em 1em; margin: .1em 0; border: 0; border-radius: 0; clip-path: var(--tg-button-cut); background: #243529; color: #c7dfcb; font: inherit; font-weight: 600; font-size: .9em; text-align: center; text-decoration: none; cursor: pointer; transition: background .18s, color .18s;
}
.markdown-body .tg-rich-button[data-style="primary"] { background: #23394a; color: #8cd7ff; }
.markdown-body .tg-rich-button[data-style="danger"] { background: #40272c; color: #ff8b94; }
.markdown-body .tg-rich-button[data-style="success"] { background: #233c2e; color: #8fe4ab; }
.markdown-body .tg-rich-button[data-style="link"] { background: transparent; color: var(--tg-accent); text-decoration: underline; }
.markdown-body .tg-rich-button:hover, .tg-rich-unavailable .tg-rich-button:hover, .tg-rich-gallery-controls button:hover, .tg-rich-code-head button:hover { background: #3a4c3d; color: #fff; }
.markdown-body .tg-rich-button:focus-visible, .tg-rich-gallery-controls button:focus-visible, .tg-rich-code-head button:focus-visible { outline: 2px solid var(--tg-accent); outline-offset: -4px; }
.tg-rich-button:disabled { opacity: .45; cursor: default; }
.tg-rich-button[data-copied="true"]::after, .tg-rich-code-head button[data-copied="true"]::after { content: " ✓"; }
.tg-rich-unavailable { padding: .5em 0; color: #b3c4b8; }
@media (max-width: 480px) { .tg-rich-button-row > .tg-rich-button { flex: 1 1 125px; } .tg-rich-table { font-size: .92em; } }
@media (prefers-reduced-motion: reduce) { .tg-rich * { transition: none !important; scroll-behavior: auto; } }

/* Keep quoted content compact on desktop while the outer card fills the feed. */
@media (min-width: 641px) {
  .news-post-body .tg-rich-quote, .project-news-body .tg-rich-quote { width: 100%; max-width: 420px; box-sizing: border-box; margin-inline: 0; }
  .news-post-body .tg-rich-button-row[data-align="center"], .project-news-body .tg-rich-button-row[data-align="center"] { justify-content: flex-start; }
}
