/* The feed looks exactly like the feed of our Telegram iOS fork (TelenokGuestFeedView): cards on the
   grouped list background, Telegram's own metrics. Every colour is Telegram's theme as Telegram iOS
   passes it to a Mini App (WebAppController.generateWebAppThemeParams):
     secondary_bg  = list.blocksBackgroundColor     → the page behind the cards
     section_bg    = list.itemBlocksBackgroundColor → a card, a menu, a bubble
     accent_text   = list.itemAccentColor           → names of links, counters, «N комментариев»
     section_separator, hint, text, button, header_bg, destructive — as named.
   The fallbacks are Telegram iOS's default day and night themes and only matter outside Telegram. */

:root {
  --fb-bg: #ffffff;
  --fb-secondary: #efeff4;
  --fb-section: #ffffff;
  --fb-text: #000000;
  --fb-hint: #8e8e93;
  --fb-accent: #0088ff;
  --fb-button: #0088ff;
  --fb-button-text: #ffffff;
  --fb-separator: #c8c7cc;
  --fb-header: #f7f7f7;
  --fb-destructive: #ff3b30;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tg]) {
    --fb-bg: #000000;
    --fb-secondary: #000000;
    --fb-section: #1c1c1d;
    --fb-text: #ffffff;
    --fb-hint: #98989e;
    --fb-accent: #ffffff;
    --fb-button: #ffffff;
    --fb-button-text: #000000;
    --fb-separator: #3d3d40;
    --fb-header: #1c1c1d;
    --fb-destructive: #eb5545;
  }
}

:root {
  --page: var(--tg-theme-secondary-bg-color, var(--fb-secondary));
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-section)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-accent));
  --accent: var(--tg-theme-accent-text-color, var(--link));
  --button: var(--tg-theme-button-color, var(--fb-button));
  --button-text: var(--tg-theme-button-text-color, var(--fb-button-text));
  --separator: var(--tg-theme-section-separator-color, var(--fb-separator));
  --header: var(--tg-theme-header-bg-color, var(--fb-header));
  --destructive: var(--tg-theme-destructive-text-color, var(--fb-destructive));
  /* Telegram's tinted fills: the accent at 10 % (reaction pills, link previews), the hint for chips */
  --accent-tint: color-mix(in srgb, var(--accent) 10%, transparent);
  --fill: color-mix(in srgb, var(--hint) 18%, transparent);
  --pressed: color-mix(in srgb, var(--hint) 14%, transparent);

  --safe-top: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: var(--tg-safe-area-inset-left, env(safe-area-inset-left, 0px));
  --safe-right: var(--tg-safe-area-inset-right, env(safe-area-inset-right, 0px));

  /* SF Pro on iPhone and Mac, Roboto on Android: Telegram's system font */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", Consolas, monospace;
  --side: 12px; /* a card's text inset (TelenokGuestPostCard.sideInset) */
  color-scheme: light;
}

:root[data-scheme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text);
  font: 17px/22px var(--font);
  letter-spacing: -0.2px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

body { min-height: var(--tg-viewport-height, 100vh); }

button {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: inherit;
}

a { color: var(--link); text-decoration: none; }

[hidden] { display: none !important; }

svg { display: block; flex: none; }

/* MARK: the navigation bar «Лента»: Telegram's bar colour, the title in 17pt semibold, ⋯ on the right */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: calc(var(--safe-top) + 44px);
  padding: var(--safe-top) calc(var(--safe-right) + 6px) 0 calc(var(--safe-left) + 6px);
  background: color-mix(in srgb, var(--header) 94%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0.33px 0 var(--separator);
}

.bar-title {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.bar-btn.left { grid-column: 1; grid-row: 1; }
.bar-btn.right { grid-column: 3; grid-row: 1; }
.bar-btn svg { width: 28px; height: 28px; }
.bar-btn.left svg { width: 24px; height: 24px; transform: scaleX(-1); }
.bar-btn:active { opacity: 0.5; }
.bar-btn[hidden] { display: grid !important; visibility: hidden; }

.screen {
  padding: 8px calc(var(--safe-right) + 8px) calc(var(--safe-bottom) + 96px) calc(var(--safe-left) + 8px);
  max-width: 640px;
  margin: 0 auto;
}

/* MARK: the post card (TelenokGuestPostCard): 16pt continuous corners, 8pt apart */

.post {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 8px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.15s ease-out;
}

.post.pressed { transform: scale(0.985); }

/* header: 12 top, 10 below, a 36pt avatar, the name 16pt semibold in the author's colour over the
   @handle in 14pt */
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px var(--side) 10px;
  text-align: left;
}

.avatar {
  position: relative;
  overflow: hidden;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: uppercase;
  user-select: none;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.avatar img.loaded { opacity: 1; }

.avatar.small { width: 34px; height: 34px; font-size: 13px; }
.avatar.tiny { width: 24px; height: 24px; font-size: 10px; }
.avatar.anon { background: color-mix(in srgb, var(--hint) 55%, var(--card)); }
.avatar.anon svg { width: 20px; height: 20px; }

.who { min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.name {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-weight: 600;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.name-text { overflow: hidden; text-overflow: ellipsis; }

/* Telegram's verified badge: the accent star with a check cut out */
.verified { position: relative; flex: none; width: 15px; height: 15px; color: var(--accent); }
.verified svg { position: absolute; inset: 0; width: 15px; height: 15px; }
.verified svg + svg { color: var(--card); }

.handle {
  color: var(--hint);
  font-size: 14px;
  line-height: 18px;
  letter-spacing: -0.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the text: 17pt, 12 at the sides, 10 under the media */
.body { padding: 0 var(--side); }
.media + .body { padding-top: 10px; }

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.4px;
}

.text b { font-weight: 600; }
.text i { font-style: italic; }
.more { color: var(--accent); }

.mono { font-family: var(--mono); font-size: 16px; letter-spacing: 0; }
code.mono { background: var(--fill); border-radius: 4px; padding: 0 3px; }

pre.mono {
  margin: 4px 0;
  padding: 8px 10px;
  background: var(--fill);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

blockquote {
  margin: 4px 0;
  padding: 2px 8px 3px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-tint);
}

.text a, .c-text a, .tag { color: var(--link); }

.spoiler {
  border-radius: 4px;
  color: transparent;
  background-color: var(--fill);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 50%, transparent) 0.6px, transparent 0.9px);
  background-size: 4px 4px;
  cursor: pointer;
}

.spoiler * { color: transparent !important; }
.spoiler.shown { color: inherit; background: none; cursor: auto; }
.spoiler.shown * { color: inherit !important; }
.spoiler.shown a { color: var(--link) !important; }

/* MARK: media: the card's full width, no corners of its own (the card clips them) */

.media { position: relative; }

.pic {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--fill);
}

.pic img, .pic video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s;
}

.pic img.loaded, .pic video { opacity: 1; }

.album { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.album .pic { aspect-ratio: 1; }
.album .pic.wide { grid-column: 1 / -1; aspect-ratio: 2; }

.album-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 24px;
  font-weight: 600;
}

/* the video's duration: 11pt medium on a dark capsule, top left */
.badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* the play button: a 50pt dark circle */
.play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
}

.play svg { width: 22px; height: 22px; margin-left: 3px; }

/* a link preview and a poll sit inside the text column */
.link-preview {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 9px 7px 12px;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--text);
  text-align: left;
  position: relative;
  overflow: hidden;
}
.link-preview::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.link-preview .site { color: var(--accent); font-weight: 600; font-size: 15px; line-height: 19px; }
.link-preview .title { font-weight: 600; font-size: 15px; line-height: 19px; }
.link-preview .desc { font-size: 15px; line-height: 19px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-preview .pic { margin-top: 6px; border-radius: 6px; }

.poll { padding-top: 2px; }
.poll-q { font-weight: 600; font-size: 17px; }
.poll-kind { color: var(--hint); font-size: 14px; margin: 1px 0 4px; }
.poll-opt { position: relative; margin: 8px 0; padding-bottom: 8px; font-size: 15px; line-height: 20px; }
.poll-opt .row { display: flex; gap: 8px; }
.poll-opt .pct { font-weight: 600; width: 38px; flex: none; text-align: right; }
.poll-opt .bar { position: absolute; left: 46px; bottom: 0; height: 4px; border-radius: 2px; background: var(--accent); min-width: 4px; }
.poll-total { color: var(--hint); font-size: 14px; }

/* MARK: the footer: reaction pills left, views and time right (12 at the sides, 8 above and below) */

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px var(--side);
  min-height: 46px;
}

.reactions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* a 30pt capsule, 8 at the sides, the emoji in 15pt, the counter 14pt medium in the accent on the
   accent at 10 % */
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  border-radius: 15px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: transform 0.12s ease-out;
}

.reaction .emoji { font-size: 15px; line-height: 18px; }
.reaction.empty { width: 40px; justify-content: center; padding: 0; }
.reaction.empty svg { width: 17px; height: 17px; }
span.reaction { cursor: default; }
button.reaction:active { transform: scale(0.94); }
.reaction.chosen { background: var(--accent); color: var(--card); }
.reaction.pop .emoji { animation: pop 0.3s ease-out; }

@keyframes pop { 50% { transform: scale(1.35); } }

.meta {
  margin-left: auto;
  padding-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--hint);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meta svg { width: 14px; height: 9px; margin-right: 1px; }
.meta .time { margin-left: 3px; }

.burst {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 64px;
  margin: -40px 0 0 -32px;
  pointer-events: none;
  animation: burst 0.7s ease-out forwards;
}

@keyframes burst {
  0% { transform: scale(0.3); opacity: 0; }
  30% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1.4) translateY(-20px); opacity: 0; }
}

/* MARK: «N комментариев»: a 44pt row under a hairline, the icon, the label in 17pt, the chevron — all
   in the accent, like Telegram's channel comments button */

.comments-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 var(--side);
  color: var(--accent);
  font-size: 17px;
  letter-spacing: -0.4px;
  text-align: left;
}

.comments-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0.33px;
  background: var(--separator);
}

.comments-bar .icon { width: 26px; display: grid; place-items: center; }
.comments-bar .icon svg { width: 24px; height: 24px; }
/* the latest commenters' faces, overlapping, each ringed with the card colour */
.comments-bar .faces { display: flex; flex: none; }
.comments-bar .faces .avatar.tiny { box-shadow: 0 0 0 1.5px var(--card); }
.comments-bar .faces .avatar + .avatar { margin-left: -7px; }
.comments-bar .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comments-bar .chev svg { width: 20px; height: 20px; margin-right: -4px; }
.comments-bar:active { background: var(--pressed); }

.hidden-post {
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 8px;
  padding: 12px var(--side);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--hint);
  font-size: 15px;
}

.hidden-post .undo { margin-left: auto; color: var(--accent); }

/* MARK: the author's own post that is not live yet: a line under the header, like Telegram's notices */

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px var(--side) 10px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 18px;
}

.status-badge.pending { background: var(--accent-tint); color: var(--accent); }
.status-badge.review { background: var(--fill); color: var(--text); }
.status-badge.hidden { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.post.status-hidden .body, .post.status-hidden .media { opacity: 0.55; }

.dot-spin {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}

/* MARK: the write button: Telegram's round compose button, bottom right */

.fab {
  position: fixed;
  right: calc(var(--safe-right) + 16px);
  bottom: calc(var(--safe-bottom) + 16px);
  z-index: 6;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14), 0 6px 18px rgba(0, 0, 0, 0.16);
  transition: transform 0.14s ease-out, opacity 0.2s;
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(0.92); }

/* MARK: states: Telegram's empty screen — a title, a line of hint, the big button */

.state {
  min-height: calc(var(--tg-viewport-stable-height, 100vh) - var(--safe-top) - var(--safe-bottom) - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 28px 48px;
}

.state-title { font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: -0.45px; margin: 0 0 8px; }
.state-text { font-size: 15px; line-height: 20px; letter-spacing: -0.25px; color: var(--hint); margin: 0; max-width: 320px; }

/* Telegram's big button: 50pt, 10pt corners, 17pt semibold */
.button {
  display: block;
  width: 100%;
  max-width: 320px;
  height: 50px;
  margin: 24px auto 0;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.4px;
  text-align: center;
}

.button.plain { background: none; color: var(--accent); font-weight: 400; height: 44px; margin-top: 4px; }
.button:active:not(:disabled) { opacity: 0.75; }
.button:disabled { opacity: 0.45; cursor: default; }

/* Telegram's service message: a small pill on the background */
.service {
  display: table;
  margin: 4px auto 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--text);
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  letter-spacing: -0.15px;
}

.footer-note { min-height: 40px; padding: 4px 0; }

.spinner {
  width: 22px;
  height: 22px;
  margin: 12px auto;
  border-radius: 50%;
  border: 2px solid var(--fill);
  border-top-color: var(--hint);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton .avatar, .skeleton .bone {
  background: var(--fill);
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.skeleton .bone { height: 12px; border-radius: 6px; }
.skeleton .body { display: flex; flex-direction: column; gap: 9px; padding-bottom: 18px; }

@keyframes pulse { to { opacity: 0.45; } }

/* MARK: the ⋯ menu: Telegram iOS's context menu — a 250pt rounded panel under the button, 44pt rows,
   the title on the left and the icon on the right, hairlines between */

.menu { position: fixed; inset: 0; z-index: 15; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.18); opacity: 0; transition: opacity 0.18s; }
:root[data-scheme="dark"] .menu-backdrop { background: rgba(0, 0, 0, 0.45); }
.menu.open .menu-backdrop { opacity: 1; }

.menu-panel {
  position: absolute;
  top: calc(var(--safe-top) + 46px);
  right: calc(var(--safe-right) + 8px);
  width: 250px;
  border-radius: 13px;
  overflow: hidden;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  transform-origin: top right;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.25, 1.1), opacity 0.15s;
}

.menu.open .menu-panel { transform: none; opacity: 1; }

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  font-size: 17px;
  letter-spacing: -0.4px;
  color: var(--text);
}

.menu-item + .menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0.33px;
  background: var(--separator);
}

.menu-item svg { width: 24px; height: 24px; }
.menu-item:active { background: var(--pressed); }

/* MARK: pages: «Подключить канал», «Мои посты» */

.page-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 16px 16px;
}

.page-title { font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: -0.45px; margin: 0 0 6px; text-align: center; }
.page-card .state-text { margin: 0 auto; text-align: center; }

.steps { list-style: none; margin: 18px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 20px; letter-spacing: -0.25px; }

.step-n {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--button);
  color: var(--button-text);
  font-size: 13px;
  font-weight: 600;
}

.page-card .button { margin-top: 18px; max-width: none; }
.page-card .button.plain { margin-top: 2px; }
.page-note { margin: 10px 0 0; font-size: 13px; line-height: 17px; color: var(--hint); text-align: center; }
.page-head { margin: 4px 8px 10px; color: var(--hint); font-size: 13px; line-height: 18px; text-transform: uppercase; letter-spacing: 0; }

/* MARK: comments: a thread of incoming message bubbles, replies on a branch line */

.thread-list { padding: 4px 0 8px; }

.sort-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.chip {
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--fill);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.25px;
}
.chip-link { color: var(--text); }
.chip-link:active, .discuss:active, .more-replies:active { opacity: 0.6; }

/* A comment as an incoming message of Telegram iOS in a thread: the avatar (34pt, 26pt for a
   reply) at the bubble's bottom, the bubble 17pt round, the author's name in their colour. */
.c-row { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-bottom: 8px; padding-left: 2px; }
.c-row.reply { padding-left: 44px; }
.c-row.reply .avatar.small { width: 26px; height: 26px; font-size: 10px; }
.c-row.reply .avatar.anon svg { width: 16px; height: 16px; }

.c-bubble {
  min-width: 120px;
  max-width: min(320px, calc(100% - 44px));
  background: var(--card);
  border-radius: 17px;
  padding: 6px 11px 7px;
  position: relative;
}
.c-bubble.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%, 35% { background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
  100% { background: var(--card); }
}

.c-name { font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: -0.25px; display: flex; gap: 6px; align-items: baseline; }
.c-name .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name .role { color: var(--hint); font-weight: 400; font-size: 14px; }
.c-text { font-size: 17px; line-height: 22px; letter-spacing: -0.4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-row.folded .c-text { color: var(--hint); }

.c-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; min-height: 20px; }
.c-foot .reaction { margin: 1px 0; }
.c-total { color: var(--hint); font-size: 12px; }
.c-time { margin-left: auto; padding-left: 10px; color: var(--hint); font-size: 12px; line-height: 20px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.c-time.inline { float: right; position: relative; top: 5px; margin-left: 0; }
.c-text::after { content: ""; display: table; clear: both; }

.c-quote {
  position: relative;
  display: block;
  margin: 3px 0 5px;
  padding: 3px 9px 4px 11px;
  border-radius: 6px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
}
.c-quote::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: currentColor; }
.c-quote:active { background: color-mix(in srgb, currentColor 24%, transparent); }
.c-quote .q-name { display: block; font-size: 15px; font-weight: 600; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-quote .q-link { display: inline-block; max-width: 100%; vertical-align: top; }
.c-quote .q-link:active { opacity: 0.6; }
.c-quote .q-text { display: block; color: var(--text); font-size: 15px; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.branch { position: relative; --branch: color-mix(in srgb, var(--hint) 38%, var(--page)); }
.branch::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -8px;
  bottom: 34px;
  border-left: 2px solid var(--branch);
}
.branch .c-row.reply::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 12px;
  width: 24px;
  height: 22px;
  border-left: 2px solid var(--branch);
  border-bottom: 2px solid var(--branch);
  border-bottom-left-radius: 12px;
}

.more-replies, .discuss, .folded-toggle {
  display: table;
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--fill);
  color: var(--text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.25px;
}
.more-replies { margin: -2px 0 10px 44px; }
.discuss { margin: 6px auto 12px; }
.folded-toggle { margin: 4px auto 12px; font-size: 14px; font-weight: 400; }

/* MARK: viewer, toast */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  display: grid;
  place-items: center;
}

.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Telegram's undo toast: a dark rounded panel at the bottom */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 84px);
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  width: max-content;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: -0.25px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
