/* Превью соцсетей. Каждая площадка — свой блок; размеры и цвета взяты из эталонов (reference/). */

.preview-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.preview-block { display: flex; flex-direction: column; gap: var(--space-3); }
.preview-controls { gap: var(--space-2); }
.preview-stage { display: flex; justify-content: center; }
.preview-approx {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--text-xs);
  font-weight: 600;
}
.preview-all { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); align-items: start; }
.preview-empty { padding: var(--space-5); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); text-align: center; }

/* Общие части */
.pv-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-clamp-box { position: relative; }
.pv-measure { position: absolute; inset: 0 0 auto 0; visibility: hidden; pointer-events: none; }
.pv-more { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.pv-media { position: relative; width: 100%; height: 100%; overflow: hidden; background: rgba(127, 127, 127, .2); }
.pv-media img { display: block; width: 100%; height: 100%; }
.pv-video-blank { width: 100%; height: 100%; background: #111; }
.pv-play {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff;
}
.pv-play svg { width: 26px; height: 26px; margin-left: 3px; }
.pv-file { display: grid; place-items: center; padding: 12px; font-size: 13px; }
.pv-album { position: relative; width: 100%; max-height: 520px; overflow: hidden; }
.pv-album-cell { position: absolute; overflow: hidden; }
.pv-avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  color: #fff; font-weight: 600; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}
.pv-carousel { position: relative; width: 100%; overflow: hidden; background: #000; }
.pv-carousel .pv-media img { object-fit: cover; }
.pv-carousel-nav {
  position: absolute; top: 50%; width: 32px; height: 32px; margin-top: -16px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 22px; line-height: 30px; cursor: pointer;
}
.pv-prev { left: 8px; }
.pv-next { right: 8px; }

/* ---------- Telegram ---------- */
.tg {
  --tg-text: #000;
  --tg-bubble: #fff;
  --tg-meta: #8e8e93;
  --tg-link: #007aff;
  --tg-accent: #007aff;
  --tg-head-bg: rgba(248, 248, 248, .96);
  --tg-head-text: #000;
  --tg-sub: #8e8e93;
  --tg-wall: linear-gradient(160deg, #b9d4ea 0%, #cbd6ee 45%, #dccbec 100%);
  --tg-date-bg: rgba(0, 0, 0, .22);
  --tg-share-bg: rgba(0, 0, 0, .22);
  width: 100%;
  max-width: 375px;
  overflow: hidden;
  font-family: -apple-system, system-ui, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--tg-text);
  background: var(--tg-wall);
  border-radius: 28px;
  box-shadow: 0 0 0 1px var(--border);
}
.tg.tg-dark {
  --tg-text: #fff;
  --tg-bubble: #262628;
  --tg-meta: #8d8e93;
  --tg-link: #5eb5f7;
  --tg-accent: #5eb5f7;
  --tg-head-bg: rgba(28, 28, 29, .96);
  --tg-head-text: #fff;
  --tg-sub: #8d8e93;
  --tg-wall: linear-gradient(160deg, #0f1418 0%, #121417 50%, #16121b 100%);
  --tg-date-bg: rgba(255, 255, 255, .12);
  --tg-share-bg: rgba(255, 255, 255, .12);
}
.tg-statusbar { display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 26px 0 32px; font-size: 15px; font-weight: 600; background: var(--tg-head-bg); color: var(--tg-head-text); }
.tg-sb-icons { display: flex; gap: 6px; align-items: center; }
.tg-ios-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; height: 50px; padding: 0 10px 4px; background: var(--tg-head-bg); color: var(--tg-head-text); border-bottom: .5px solid rgba(0, 0, 0, .12); }
.tg-ios-head .pv-avatar { justify-self: end; }
.tg-back { display: flex; align-items: center; gap: 4px; color: var(--tg-accent); font-size: 17px; }
.tg-back svg { width: 12px; height: 20px; }
.tg-title { display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.2; }
.tg-title b { font-size: 17px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-title small { font-size: 13px; color: var(--tg-sub); }
.tg-wall { padding: 10px 0 14px; min-height: 260px; }
.tg-date { display: flex; justify-content: center; margin: 4px 0 10px; }
.tg-date span { padding: 2px 9px; border-radius: 12px; background: var(--tg-date-bg); color: #fff; font-size: 13px; font-weight: 500; }
.tg-row { display: flex; align-items: flex-end; gap: 7px; padding: 0 8px 0 9px; margin-top: 6px; }
.tg-bubble {
  position: relative;
  max-width: calc(100% - 46px);
  min-width: 70px;
  overflow: hidden;
  border-radius: 17px 17px 17px 6px;
  background: var(--tg-bubble);
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -.2px;
}
.tg-has-media { width: calc(100% - 46px); }
.tg-bubble-media { position: relative; }
.tg-bubble-media .pv-album { max-height: 420px; }
.tg-text { position: relative; padding: 6px 11px 7px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-text::after { content: ""; display: inline-block; width: 46px; }
.tg-text-empty::after { width: 40px; }
.tg-link { color: var(--tg-link); }
.tg-meta { position: absolute; right: 10px; bottom: 5px; font-size: 12px; line-height: 14px; color: var(--tg-meta); letter-spacing: 0; }
.tg-meta-over { right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 10px; background: rgba(0, 0, 0, .45); color: #fff; }
.tg-share { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--tg-share-bg); color: #fff; }
.tg-share svg { width: 18px; height: 18px; }
.tg-comments { display: flex; align-items: center; gap: 8px; padding: 9px 10px 10px 12px; border-top: .5px solid rgba(127, 127, 127, .3); color: var(--tg-accent); font-size: 16px; line-height: 20px; }
.tg-comments svg:first-child { width: 22px; height: 22px; }
.tg-comments span { flex: 1; }
.tg-comments svg:last-child { width: 18px; height: 18px; color: var(--tg-meta); }
.tg-file { display: flex; align-items: center; gap: 10px; padding: 8px 11px 2px; }
.tg-file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--tg-accent); color: #fff; }
.tg-file-icon svg { width: 22px; height: 22px; }
.tg-file-name { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-name { padding: 6px 12px 0; color: var(--tg-accent); font-size: 15px; font-weight: 600; }

/* Telegram Android: шапка цвета приложения, аватар слева от названия, шрифт Roboto 16 */
.tg-android { border-radius: 18px; font-family: Roboto, "Segoe UI", system-ui, sans-serif; }
.tg-android .tg-bubble { font-size: 16px; line-height: 21px; letter-spacing: 0; border-radius: 16px 16px 16px 5px; }
.tg-android-head { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 12px; background: #517da2; color: #fff; }
.tg-dark .tg-android-head { background: #212d3b; }
.tg-android-back svg { width: 24px; height: 24px; }
.tg-android .tg-title { align-items: flex-start; }
.tg-android .tg-title b { font-size: 18px; font-weight: 500; }
.tg-android .tg-title small { color: rgba(255, 255, 255, .72); font-size: 14px; }

/* Telegram Desktop / веб: аватар слева у пузыря, название канала в пузыре (эталон t.me/s, тёмная тема) */
.tg-desktop {
  --tg-bubble: #fff;
  --tg-wall: #e6ebee;
  max-width: 560px;
  border-radius: 12px;
  font-family: "Segoe UI", -apple-system, system-ui, Roboto, sans-serif;
}
.tg-desktop.tg-dark { --tg-bubble: #212121; --tg-wall: #0e0e0e; --tg-link: #6ab3f3; --tg-accent: #64b5ef; --tg-meta: #9a9a9a; }
.tg-desktop .tg-bubble { font-size: 15px; line-height: 21px; letter-spacing: 0; border-radius: 15px 15px 15px 5px; }
.tg-desktop .tg-has-media { width: min(420px, calc(100% - 92px)); }
.tg-desktop .tg-row { padding: 0 12px; }
.tg-desktop .tg-meta { font-size: 12px; }
.tg-desktop-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--tg-bubble); color: var(--tg-text); }
.tg-desktop .tg-title { align-items: flex-start; }
.tg-desktop .tg-title b { font-size: 15px; }
.tg-row-avatar { align-self: flex-end; }

/* ---------- ВКонтакте ---------- */
.vk {
  --vk-bg: #ffffff;
  --vk-page: #ebedf0;
  --vk-text: #000000;
  --vk-secondary: #818c99;
  --vk-icon: #99a2ad;
  --vk-link: #2688eb;
  width: 100%;
  font-family: -apple-system, system-ui, "Helvetica Neue", Roboto, sans-serif;
  color: var(--vk-text);
}
.vk.vk-dark { --vk-bg: #19191a; --vk-page: #0a0a0a; --vk-text: #e1e3e6; --vk-secondary: #76787a; --vk-icon: #e1e3e6; --vk-link: #71aaeb; }
.vk-post { background: var(--vk-bg); overflow: hidden; }
.vk-name { font-size: 14px; font-weight: 500; line-height: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vk-more { display: grid; place-items: center; width: 24px; height: 24px; color: var(--vk-secondary); }
.vk-more svg { width: 24px; height: 24px; }
.vk-link { color: var(--vk-link); }
.vk-text .pv-text { color: var(--vk-text); }
.vk-show-more { color: var(--vk-secondary); }
.vk-counter {
  position: absolute; top: 12px; right: 12px; padding: 3px 8px; border-radius: 12px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; font-weight: 600; line-height: 16px;
}
.vk-nobody { font-size: 13px; line-height: 16px; color: var(--vk-secondary); }
.vk-actions { display: flex; align-items: center; gap: 16px; }
.vk-action { display: flex; align-items: center; color: var(--vk-icon); }
.vk-action svg { width: 24px; height: 24px; }
.vk-action span { margin-left: 4px; font-size: 13px; font-weight: 500; line-height: 16px; }
.vk-date { margin-left: auto; font-size: 13px; color: var(--vk-secondary); }

/* VK мобильная (m.vk.ru, 375 px): шапка 12/8/8, аватар 36, текст 15/20 с отступом 16, обрезка 3 строки */
.vk-mobile { max-width: 375px; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.vk-mobile .vk-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px 16px; }
.vk-mobile .vk-text { padding: 10px 16px 4px; font-size: 15px; line-height: 20px; }
.vk-mobile .vk-show-more { font-size: 15px; line-height: 20px; }
.vk-mobile .vk-nobody { padding: 8px 16px 0; }
.vk-mobile .vk-actions { padding: 8px 16px 12px; }
.vk-mobile .vk-action { color: var(--vk-text); }

/* VK веб (vk.ru, карточка 551 px): шапка 16/8/8 → 0/12, аватар 40, текст 14/20 с отступом 20, серые действия */
.vk-web { max-width: 551px; padding: 12px; background: var(--vk-page); border-radius: 12px; }
.vk-web.vk-dark { --vk-bg: #222222; --vk-page: #141414; --vk-secondary: #828282; --vk-icon: #828282; }
.vk-web .vk-post { border-radius: 12px; }
.vk-web .vk-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 8px; }
.vk-web .vk-more { color: #656565; }
.vk-web .vk-text { padding: 8px 20px 4px; font-size: 14px; line-height: 20px; }
.vk-web .vk-show-more { font-size: 14px; line-height: 20px; }
.vk-web .vk-nobody { padding: 8px 20px 0; }
.vk-web .vk-actions { padding: 8px 20px 12px; }
.vk-web .vk-action { color: var(--vk-icon); }

/* ---------- Приблизительное превью ---------- */
.gp { width: 100%; max-width: 420px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.gp-head { display: flex; align-items: center; gap: 10px; padding: 12px; }
.gp-head small { color: var(--text-3); }
.gp-text { padding: 10px 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.gp-link { color: var(--accent-text); }
