/* ============================================================
   FCRUBIN WEB FEED — styles.css
   - Структура как у основного фида
   - Палитра и настроение на основе rubin-kazan.ru
   ============================================================ */

@font-face {
  font-family: "Druk Cyr";
  src: url("https://www.rubin-kazan.ru/local/templates/rubin_corp/fonts/DrukCyr-Bold.woff2") format("woff2"),
       url("https://www.rubin-kazan.ru/local/templates/rubin_corp/fonts/DrukCyr-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-root: #f4ede7;
  --bg-gradient:
    radial-gradient(circle at top left, rgba(127, 30, 52, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(185, 150, 46, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f2ed 0%, #f2e9e3 100%);
  --bg-card: linear-gradient(180deg, #ffffff 0%, #fffaf7 100%);
  --bg-card-hover: linear-gradient(180deg, #ffffff 0%, #fdf4ef 100%);
  --bg-surface: rgba(255,255,255,.94);
  --border: #ead7dc;
  --border-hover: #dbc1c8;
  --border-accent: #7f1e34;
  --text-primary: #1a1a1a;
  --text-secondary: #5e4853;
  --text-muted: #8d7680;
  --accent: #7f1e34;
  --accent-hover: #600016;
  --accent-blue: #b9962e;
  --accent-yellow: #d8b55d;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --radius-pill: 999px;
  --shadow-card: 0 16px 36px rgba(96, 0, 22, .08);
  --shadow-card-hover: 0 22px 40px rgba(96, 0, 22, .14);
  --shadow-screen: 0 24px 50px rgba(96, 0, 22, .16);
  --font-body: "Onest", system-ui, -apple-system, sans-serif;
  --font-heading: "Unbounded", "Onest", system-ui, sans-serif;
  --ease: cubic-bezier(.25,.46,.45,.94);
  --dur: .15s;

  /* Единый gap между блоками */
  --block-gap: 10px;
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{font-family:var(--font-body);color:var(--text-primary);background:var(--bg-root);background-image:var(--bg-gradient);background-attachment:fixed;line-height:1.55;min-height:100vh;-webkit-font-smoothing:antialiased}
a{color:var(--accent);text-decoration:none;transition:color var(--dur) var(--ease)}
a:hover{color:var(--accent-hover)}
img{display:block;max-width:100%}

/* ===== LAYOUT ===== */
.app {
  min-height: 100vh;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: var(--block-gap); /* единый отступ между шапкой, поиском, лентой */
}

/* ===== HEADER ===== */
.app-header{position:relative;overflow:hidden;background:linear-gradient(145deg,#8b2240 0%,#711329 48%,#600016 100%);border-radius:22px;padding:18px;border:none;box-shadow:var(--shadow-screen)}
.app-header::before{content:"";position:absolute;inset:0 0 auto 0;height:4px;background:linear-gradient(90deg,#b9962e 0%,#f3dc94 48%,#b9962e 100%)}
.app-header::after{content:"";position:absolute;right:-80px;top:-100px;width:260px;height:260px;border-radius:50%;background:radial-gradient(circle, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 68%)}
.header-top{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.header-channel{display:flex;align-items:center;gap:10px;min-width:0;flex:1;overflow:hidden}
.header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.channel-avatar{width:48px;height:48px;border-radius:14px;object-fit:cover;flex-shrink:0;border:1px solid rgba(243,220,148,.65);background:#fff4d7;box-shadow:0 8px 24px rgba(0,0,0,.18)}
.channel-avatar[data-static-avatar="true"]{
  width:54px;
  height:54px;
  padding:6px 5px 7px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.18);
  background:#7f1e34;
  object-fit:contain;
  box-shadow:0 12px 28px rgba(0,0,0,.22);
}
.channel-meta{min-width:0;overflow:hidden}
.channel-name{font-family:"Druk Cyr",var(--font-heading);font-size:18px;font-weight:700;color:#fff;line-height:1;letter-spacing:.02em;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.channel-handle{font-size:11px;color:rgba(255,255,255,.76);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.btn-tg,.btn-secondary{display:inline-flex;align-items:center;gap:5px;padding:8px 12px;border-radius:var(--radius-pill);border:1px solid rgba(255,255,255,.28);background:rgba(255,255,255,.08);color:#fff!important;font-size:12px;font-weight:700;white-space:nowrap;flex-shrink:0;transition:border-color var(--dur),background var(--dur),color var(--dur),transform var(--dur)}
.btn-tg:hover{border-color:#f3dc94;background:rgba(243,220,148,.14);color:#fff!important;transform:translateY(-1px)}
.btn-secondary{border-color:rgba(243,220,148,.4);background:rgba(243,220,148,.12);color:#fff!important}
.btn-secondary:hover{border-color:#f3dc94;background:rgba(243,220,148,.18);color:#fff!important}
.btn-tg svg,.btn-secondary svg{opacity:.8;flex-shrink:0}
.channel-desc{position:relative;z-index:1;font-size:13px;color:rgba(255,255,255,.84);line-height:1.55;max-width:92%}
.channel-desc a{color:#f3dc94}

/* ===== MINIAPPS BAR ===== */
.miniapps-bar{display:block}
.miniapp-block{display:block;width:100%;padding:14px 18px;border-radius:20px;border:1px solid rgba(127,30,52,.12);background:linear-gradient(180deg,rgba(255,255,255,.96) 0%,rgba(251,246,242,.98) 100%);box-shadow:0 12px 30px rgba(96,0,22,.08);color:var(--accent)!important;font-family:"Druk Cyr",var(--font-heading);font-size:18px;font-weight:700;line-height:1;text-align:center;text-transform:uppercase;letter-spacing:.02em;cursor:pointer;transition:border-color var(--dur),box-shadow var(--dur),transform var(--dur),color var(--dur)}
.miniapp-block:hover{border-color:rgba(127,30,52,.24);box-shadow:0 18px 36px rgba(96,0,22,.12);color:var(--accent-hover)!important;transform:translateY(-1px)}
.miniapp-block:focus-visible{outline:none;border-color:rgba(127,30,52,.28);box-shadow:0 0 0 3px rgba(127,30,52,.12),0 18px 36px rgba(96,0,22,.12)}

/* ===== SEARCH WRAP ===== */
.search-wrap {position:relative;display:flex;flex-direction:column;padding:10px;background:var(--bg-surface);border:1px solid rgba(127,30,52,.12);border-radius:20px;box-shadow:0 12px 30px rgba(96,0,22,.08)}

.search-bar{position:relative}
.search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--text-muted);pointer-events:none}
.search-field{width:100%;font-family:var(--font-body);font-size:14px;padding:12px 72px 12px 40px;border-radius:14px;border:1px solid rgba(127,30,52,.14);background:#fff;color:var(--text-primary);outline:none;transition:border-color var(--dur),box-shadow var(--dur)}
.search-field::placeholder{color:var(--text-muted)}
.search-field:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(127,30,52,.12)}
.search-clear{position:absolute;right:38px;top:50%;transform:translateY(-50%);background:none;border:none;color:var(--text-muted);font-size:14px;cursor:pointer;padding:4px 6px;border-radius:4px}
.search-clear:hover{color:var(--accent)}
.search-status{font-size:11px;color:var(--text-secondary);padding-left:2px;margin:6px 0 0;display:none}

/* Кнопка календаря */
.calendar-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color var(--dur), background var(--dur);
  display: flex;
  align-items: center;
}
.calendar-btn:hover { color: var(--accent); background: rgba(127,30,52,.08); }
.calendar-btn.active { color: var(--accent); }

/* Чип выбранной даты */
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
   margin-top: 6px; 
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(127,30,52,.08);
  border: 1px solid rgba(127,30,52,.18);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  width: fit-content;
}
.date-chip-clear {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  opacity: 0.7;
  transition: opacity var(--dur);
}
.date-chip-clear:hover { opacity: 1; }

/* ===== КАЛЕНДАРЬ ===== */
.calendar-dropdown {
  position: absolute;
  top: calc(100% - 6px);
  right: 10px;
  width: min(252px, calc(100vw - 52px));
  background: #fff;
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 18px 36px rgba(96, 0, 22, .14);
  z-index: 100;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
  text-transform: capitalize;
}

.cal-nav {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  transition: color var(--dur), background var(--dur);
  line-height: 1;
}
.cal-nav:hover { color: var(--text-primary); background: rgba(255,255,255,.06); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  min-height: 28px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: default;
  position: relative;
  transition: all var(--dur) var(--ease);
}

/* День с контентом */
.cal-day.has-posts {
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
}
.cal-day.has-posts:hover {background: rgba(127,30,52,.12);color: var(--accent)}

/* Индикатор-точка: есть посты */
.cal-day.has-posts::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* Выбранный день */
.cal-day.selected {
  background: var(--accent) !important;
  color: #000 !important;
  font-weight: 700;
}
.cal-day.selected::after { display: none; }

/* Сегодня */
.cal-day.today {
  outline: 1px solid var(--border-accent);
  outline-offset: -1px;
}

/* Пустые ячейки / дни без постов */
.cal-day.empty { visibility: hidden; }
.cal-day.other-month { opacity: 0.25; }

/* ===== FEED ===== */
.feed{display:flex;flex-direction:column;gap:var(--block-gap)}

/* ===== POST CARD ===== */
/* Скругление карточки должно клиповать фон и дочерние блоки даже во время hover-анимации.
   overflow:clip сохраняет это поведение без создания scroll-контейнера. */
.post-card {background:var(--bg-card);border-radius:var(--radius);border:1px solid rgba(127,30,52,.12);overflow:clip;transition:transform var(--dur),box-shadow var(--dur),border-color var(--dur);box-shadow:var(--shadow-card)}
.post-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-card-hover);border-color:rgba(127,30,52,.24)}
.post-card.highlighted{border-color:var(--accent);box-shadow:0 0 0 1px rgba(127,30,52,.2),var(--shadow-card-hover)}

/* Медиа-блок сам скругляет углы */
.post-media { display:grid;gap:1px;background:#000;border-radius:var(--radius) var(--radius) 0 0;overflow:hidden }
.post-media[data-count="1"]{grid-template-columns:1fr}
.post-media[data-count="2"]{grid-template-columns:1fr 1fr}
.post-media[data-count="3"]{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}
.post-media[data-count="3"] .media-thumb:first-child{grid-row:1/-1}
.post-media[data-count="2"],
.post-media[data-count="3"]{
  isolation:isolate;
  clip-path:inset(0 round var(--radius) var(--radius) 0 0);
  transform:translateZ(0);
}
.post-media[data-count="1"] .media-thumb{
  border-radius:var(--radius) var(--radius) 0 0;
}
.post-media[data-count="2"] .media-thumb:first-child,
.post-media[data-count="3"] .media-thumb:first-child{
  border-top-left-radius:var(--radius);
}
.post-media[data-count="2"] .media-thumb:last-child,
.post-media[data-count="3"] .media-thumb:nth-child(2){
  border-top-right-radius:var(--radius);
}
.post-media.post-media-roundonly{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:360px;
  padding:24px;
  background:linear-gradient(180deg, #ffffff 0%, #fffaf7 100%);
}
.media-thumb{position:relative;overflow:hidden;cursor:pointer;background:#2c1b20;min-height:200px}
.media-thumb img{width:100%;height:100%;object-fit:cover;min-height:200px;transition:transform .3s var(--ease),opacity .3s}
.media-thumb:hover img{transform:scale(1.04)}
.media-thumb.media-broken{display:flex;align-items:center;justify-content:center;min-height:80px;background:#111;cursor:default}
.media-thumb.media-broken > *{display:none!important}
.media-thumb.media-broken::after{content:"Медиа недоступно";font-size:12px;line-height:1.4;color:var(--text-muted);text-align:center;padding:0 12px}
.media-thumb.media-round{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:240px;
  background:transparent;
}
.post-media.post-media-roundonly .media-thumb.media-round{
  width:min(420px,100%);
  aspect-ratio:1 / 1;
  min-height:0;
}
.media-more{position:absolute;inset:0;background:rgba(0,0,0,.55);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;color:#fff;font-family:var(--font-heading);font-size:1.3rem;font-weight:700;cursor:pointer;z-index:4}
.media-open{position:absolute;top:8px;right:8px;z-index:3;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:999px;background:rgba(96,0,22,.72);backdrop-filter:blur(4px);border:1px solid rgba(255,255,255,.2);color:#fff;cursor:pointer;box-shadow:0 6px 16px rgba(0,0,0,.28);transition:background var(--dur),transform var(--dur),opacity var(--dur);opacity:.96}
.media-open:hover,.media-open:focus-visible{background:rgba(127,30,52,.9);transform:scale(1.04);outline:none}

/* --- Video в медиа-сетке --- */
.media-thumb.media-video { cursor: pointer; text-decoration: none !important; }
.media-thumb.media-video img { width:100%; height:100%; object-fit:cover; transition:transform .3s var(--ease) }
.media-thumb.media-video:hover img { transform: scale(1.04); }

/* Нативное видео */
.media-thumb.media-video-native { cursor: default; background: #000; }
.media-thumb.media-video-native video {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  min-height: 200px;
  background: #000;
}
.media-round-shell{
  position:relative;
  width:min(100%,420px);
  aspect-ratio:1 / 1;
  border-radius:50%;
  overflow:hidden;
  background:#000;
}
.media-round-shell img,
.media-round-shell video{
  width:100%;
  height:100%;
  min-height:0;
  object-fit:cover;
  border-radius:50%;
}
.media-thumb.media-round.media-video-native{
  background:transparent;
}
.media-thumb.media-round.media-video-native video{
  display:block;
  min-height:0;
}
.round-inline-controls{
  position:absolute;
  left:50%;
  bottom:18px;
  z-index:3;
  display:flex;
  align-items:center;
  gap:10px;
  transform:translateX(-50%);
}
.round-inline-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  width:40px;
  height:40px;
  border:none;
  border-radius:999px;
  background:rgba(24,24,27,.68);
  backdrop-filter:blur(6px);
  color:#fff;
  cursor:pointer;
  box-shadow:0 4px 14px rgba(0,0,0,.24);
  transition:transform var(--dur),background var(--dur),opacity var(--dur);
}
.round-inline-btn:hover,
.round-inline-btn:focus-visible{
  background:rgba(24,24,27,.84);
  transform:scale(1.05);
  outline:none;
}
.round-inline-btn svg{
  display:block;
}

/* Видео без прямого src показываем через Telegram embed */
.media-thumb.media-video-embed {
  cursor: default;
  background: #000;
  overflow: hidden;
}
.video-embed-inline {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  background: #000;
  border-radius: inherit;
}
.vp-dur-wrap {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 2;
  pointer-events: none;
}

.vp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0,0,0,.35);
  transition: background var(--dur);
}
.media-thumb.media-video:hover .vp-overlay { background: rgba(0,0,0,.5); }
.vp-overlay.vp-overlay-round{
  border-radius:50%;
}

.vp-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
  color: rgba(255,255,255,.7);
  transition: background var(--dur);
}
.media-thumb.media-video:hover .vp-placeholder { background: linear-gradient(135deg, #222, #111); color: #fff; }
.vp-placeholder.vp-placeholder-round{
  border-radius:50%;
}

.vp-icon {
  width: 48px;
  height: 48px;
  color: #fff;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.6));
  transition: transform .2s var(--ease);
}
.media-thumb.media-video:hover .vp-icon { transform: scale(1.1); }

.vp-dur {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: .02em;
}

.vp-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* --- Documents --- */
.post-docs{padding:10px 12px 0}
.doc-chip{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:var(--radius-xs);background:rgba(127,30,52,.07);border:1px solid rgba(127,30,52,.14);font-size:12px;color:var(--accent)!important;font-weight:600;margin-bottom:4px;transition:background var(--dur),border-color var(--dur);text-decoration:none!important;cursor:pointer}
.doc-chip:hover{background:rgba(127,30,52,.12);border-color:rgba(127,30,52,.22)}
.doc-chip svg{flex-shrink:0;opacity:.7}
.doc-size{color:var(--text-muted);margin-left:2px}
.doc-open{font-size:11px;color:var(--accent-hover);margin-left:4px;font-weight:700;opacity:0;transition:opacity var(--dur)}
.doc-chip:hover .doc-open{opacity:1}

/* --- Post body --- */
.post-body{padding:14px}
.post-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.post-date{font-size:11px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
.post-actions{display:flex;gap:2px}
.act-btn{display:inline-flex;align-items:center;gap:3px;background:none;border:none;cursor:pointer;color:var(--text-muted);font-size:11px;padding:4px 6px;border-radius:6px;transition:color var(--dur),background var(--dur)}
.act-btn:hover{color:var(--accent);background:rgba(127,30,52,.08)}

/* --- Текст поста --- */
.post-text {
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  color: #251b20;
}
.post-text b,.post-text strong{font-weight:700;color:var(--text-primary)}
.post-text i,.post-text em{font-style:italic}
.post-text u{text-decoration:underline;text-underline-offset:2px}
.post-text s,.post-text del{text-decoration:line-through;opacity:.7}
.post-text a{color:var(--accent);text-decoration:underline;text-decoration-color:rgba(127,30,52,.26);text-underline-offset:2px;word-break:break-all}
.post-text a:hover{text-decoration-color:var(--accent)}
.post-text code{font-family:"SF Mono","Fira Code",monospace;font-size:.88em;background:rgba(127,30,52,.06);padding:1px 5px;border-radius:4px;border:1px solid rgba(127,30,52,.08)}
.post-text pre{font-family:"SF Mono","Fira Code",monospace;font-size:.85em;background:rgba(127,30,52,.03);padding:10px 12px;border-radius:var(--radius-xs);border:1px solid var(--border);overflow-x:auto;margin:8px 0;white-space:pre}
.post-text pre code{background:none;padding:0;border:none}
.post-text blockquote{border-left:3px solid var(--accent);padding-left:12px;margin:8px 0;color:var(--text-secondary);font-style:italic}
.htag{color:var(--accent);font-weight:600;cursor:pointer;transition:color var(--dur)}
.htag:hover{color:var(--accent-hover);text-decoration:underline}
mark.hl{background:rgba(216,181,93,.28);color:#5c3a00;border-radius:2px;padding:0 2px}
.tg-custom-emoji{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:1.15em;
  height:1.15em;
  vertical-align:-0.2em;
  object-fit:contain;
  overflow:hidden;
}
.tg-custom-emoji-inline{
  margin:0 .03em;
}
.tg-custom-emoji-reaction{
  width:1.2em;
  height:1.2em;
  vertical-align:-0.18em;
}
.tg-custom-emoji-fallback{
  display:inline-block;
  min-width:1ch;
  line-height:1;
}
.tg-custom-emoji svg,
.tg-custom-emoji img,
.tg-custom-emoji video{
  width:100%;
  height:100%;
  display:block;
}
.tg-custom-emoji-tgs{
  border-radius:0;
}
.tg-custom-emoji-tgs svg{
  overflow:visible;
}

/* --- Post footer --- */
.post-foot{display:flex;align-items:center;gap:12px;padding:0 14px 12px;font-size:11px;color:var(--text-secondary)}
.post-stat{display:inline-flex;align-items:center;gap:3px}
.post-stat svg{opacity:.72}
.post-comments-btn{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:var(--radius-pill);border:1px solid rgba(127,30,52,.16);background:rgba(127,30,52,.06);color:var(--accent);font-size:11px;font-weight:700;cursor:pointer;transition:color var(--dur),border-color var(--dur),background var(--dur)}
.post-comments-btn:hover{color:#fff;border-color:var(--accent);background:var(--accent)}
.post-link-orig{margin-left:auto;color:var(--accent);font-weight:700;transition:color var(--dur)}
.post-link-orig:hover{color:var(--accent-hover)}
.post-comments{padding:0 14px 14px}
.post-comments-inner{min-height:70px;border-radius:var(--radius-sm);border:1px solid rgba(127,30,52,.12);background:#fffaf7;overflow:hidden}
.post-comments-loader{display:flex;align-items:center;justify-content:center;min-height:70px;padding:16px;font-size:12px;color:var(--text-muted);text-align:center}

/* Реакции */
.post-reactions{display:flex;flex-wrap:wrap;gap:4px;padding:0 14px 8px}
.post-reaction{display:inline-flex;align-items:center;gap:3px;padding:3px 8px;border-radius:var(--radius-pill);background:#fff7f3;border:1px solid rgba(127,30,52,.12);font-size:12px;color:#6a4854;white-space:nowrap;line-height:1.4}
.post-reaction video.tg-custom-emoji-reaction{border-radius:50%}

/* ===== INFINITE SCROLL ===== */
.scroll-loader{text-align:center;padding:24px 0}
.loader-dots{display:inline-flex;gap:6px}
.loader-dots span{width:6px;height:6px;border-radius:50%;background:var(--text-muted);animation:pulse-dot 1.2s infinite ease-in-out}
.loader-dots span:nth-child(2){animation-delay:.15s}
.loader-dots span:nth-child(3){animation-delay:.3s}
@keyframes pulse-dot{0%,80%,100%{opacity:.2;transform:scale(.8)}40%{opacity:1;transform:scale(1.1)}}

/* ===== EMPTY / FOOTER ===== */
.empty-state{text-align:center;padding:48px 16px;color:var(--text-muted)}
.empty-icon{font-size:2rem;margin-bottom:8px}
.app-footer{text-align:center;padding:24px 0 0;font-size:11px;color:var(--text-secondary)}
.app-footer a{color:var(--accent)}.app-footer a:hover{color:var(--accent-hover)}
.footer-sub{margin-top:4px;font-size:10px;color:var(--text-muted)}

/* ===== LIGHTBOX ===== */
.lightbox{display:none;position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,.95);align-items:center;justify-content:center}
.lightbox.open{display:flex}
.lb-stage{max-width:92vw;max-height:90vh;display:flex;align-items:center;justify-content:center;position:relative;pointer-events:none}
.lb-img,.lb-video,.lb-fallback{max-width:92vw;max-height:90vh;pointer-events:auto}
.lb-img{display:none;object-fit:contain;border-radius:4px;user-select:none}
.lb-video{display:none;background:#000;border-radius:8px}
.lb-fallback{display:none;position:relative}
.lb-fallback-img{display:none;max-width:92vw;max-height:90vh;object-fit:contain;border-radius:8px;opacity:.38}
.lb-fallback-card{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:10px;min-width:min(280px,80vw);padding:18px 20px;border-radius:16px;background:rgba(10,10,10,.74);border:1px solid rgba(255,255,255,.1);backdrop-filter:blur(10px);box-shadow:0 18px 40px rgba(0,0,0,.45);pointer-events:auto}
.lb-fallback-text{font-size:14px;color:#fff;text-align:center;line-height:1.5}
.lb-fallback-link{display:inline-flex;align-items:center;justify-content:center;padding:9px 14px;border-radius:999px;background:rgba(34,197,94,.14);border:1px solid rgba(34,197,94,.26);color:var(--accent)!important;font-weight:700;pointer-events:auto}
.lb-fallback-link:hover{background:rgba(34,197,94,.22)}
.lb-close{position:absolute;top:12px;right:12px;z-index:6;background:rgba(255,255,255,.1);border:none;border-radius:50%;width:36px;height:36px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;transition:background var(--dur)}
.lb-close:hover{background:rgba(255,255,255,.2)}
.lb-nav{position:absolute;top:50%;z-index:6;transform:translateY(-50%);background:rgba(255,255,255,.08);border:none;color:#fff;font-size:2rem;width:44px;height:44px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;transition:background var(--dur)}
.lb-nav:hover{background:rgba(255,255,255,.18)}
.lb-prev{left:12px}.lb-next{right:12px}
.lb-counter{position:absolute;bottom:16px;left:50%;z-index:6;transform:translateX(-50%);font-size:12px;color:rgba(255,255,255,.5)}

/* ===== MINIAPP MODAL ===== */
.miniapp-modal{display:none;position:fixed;inset:0;z-index:1200;padding:12px;background:rgba(96,0,22,.38);backdrop-filter:blur(12px)}
.miniapp-modal.open{display:flex;align-items:center;justify-content:center}
.miniapp-shell{position:relative;width:min(430px,100%);height:min(88vh,860px);max-height:calc(100vh - 24px);display:flex;flex-direction:column;border-radius:24px;overflow:hidden;border:1px solid rgba(127,30,52,.18);background:#fff;box-shadow:0 30px 80px rgba(96,0,22,.28)}
.miniapp-tools{position:absolute;top:10px;right:10px;z-index:5;display:flex;align-items:center;gap:8px}
.miniapp-tool{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:999px;border:1px solid rgba(127,30,52,.14);background:rgba(255,255,255,.88);color:var(--accent)!important;cursor:pointer;backdrop-filter:blur(10px);transition:background var(--dur),border-color var(--dur),transform var(--dur)}
.miniapp-tool:hover{background:#fff;border-color:rgba(127,30,52,.26);transform:translateY(-1px)}
.miniapp-body{position:relative;flex:1;min-height:0;background:#fff}
.miniapp-frame{display:block;width:100%;height:100%;border:0;background:#fff}
.miniapp-status{position:absolute;top:10px;left:10px;z-index:4;display:flex;align-items:center;gap:8px;max-width:calc(100% - 92px);padding:8px 12px;border-radius:var(--radius-pill);border:1px solid rgba(127,30,52,.12);background:rgba(255,255,255,.92);backdrop-filter:blur(12px);box-shadow:0 10px 30px rgba(96,0,22,.14);text-align:left;transition:opacity .25s var(--ease),visibility .25s var(--ease)}
.miniapp-status.is-hidden{opacity:0;visibility:hidden;pointer-events:none}
.miniapp-status.is-warning{border-color:rgba(185,150,46,.34);background:rgba(255,250,240,.96)}
.miniapp-spinner{width:16px;height:16px;flex-shrink:0;border-radius:999px;border:2px solid rgba(127,30,52,.12);border-top-color:var(--accent);animation:miniapp-spin .8s linear infinite}
.miniapp-status-text{font-size:12px;line-height:1.35;color:var(--text-secondary)}
@keyframes miniapp-spin{to{transform:rotate(360deg)}}

/* ===== TOAST ===== */
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%) translateY(60px);background:var(--accent);color:#fff;font-weight:700;font-size:13px;padding:8px 18px;border-radius:var(--radius-pill);opacity:0;transition:transform .25s var(--ease),opacity .25s;z-index:2000;pointer-events:none}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar{width:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#27272a;border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:#3f3f46}
::selection{background:rgba(34,197,94,.3);color:#fff}

/* ===== DESKTOP ===== */
@media(min-width:768px){
  .app{max-width:720px;padding:32px 24px 48px}
  .app-header{padding:22px 22px 20px;border-radius:24px}
  .channel-name{font-size:22px}
  .channel-handle{font-size:12px}
  .channel-desc{font-size:14px}
  .post-body{padding:16px}
  .post-text{font-size:15px}
  .post-foot{padding:0 16px 14px}
  .miniapp-block{padding:16px 22px;font-size:20px;border-radius:22px}
  .post-media.post-media-roundonly{min-height:420px}
  .miniapp-modal{padding:18px}
  .miniapp-shell{width:min(440px,100%);height:min(86vh,840px)}
}

/* ===== SMALL MOBILE ===== */
@media(max-width:767px){
  .miniapp-block{padding:13px 14px;font-size:16px;border-radius:18px}
  .calendar-dropdown{right:8px;width:min(236px,calc(100vw - 44px));padding:9px}
  .cal-title{font-size:11px}
  .cal-day{font-size:10px;min-height:26px}
  .post-media.post-media-roundonly{min-height:280px;padding:18px}
  .round-inline-controls{bottom:14px;gap:8px}
  .round-inline-btn{width:36px;height:36px}
  .miniapp-modal{padding:0;background:rgba(2,6,23,.84)}
  .miniapp-shell{width:100%;height:100%;border-radius:0;border:none}
  .miniapp-tools{top:8px;right:8px}
  .miniapp-tool{width:30px;height:30px}
  .miniapp-status{top:8px;left:8px;max-width:calc(100% - 84px);padding:7px 11px}
}

@media(max-width:400px){
  .app{padding:12px 12px 24px}
  .header-top{align-items:center}
  .btn-tg,.btn-secondary{padding:7px 11px}
  .miniapp-block{padding:12px 12px;font-size:15px;letter-spacing:.015em}
  .miniapp-status{right:56px;max-width:none}
  .channel-name{font-size:18px}
  .channel-desc{max-width:100%}
  .channel-avatar[data-static-avatar="true"]{width:50px;height:50px;padding:5px 4px 6px}
  .post-body{padding:12px}
  .post-text{font-size:13px}
}
