/* шторка с подробностями о карточке */
.card-sheet-layer { position: fixed; z-index: 46; inset: 0 0 auto 0; height: var(--browser-viewport-height, 100dvh); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.card-sheet-layer.is-leaving { pointer-events: none; }
.card-sheet-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .42); }
.card-sheet { position: relative; display: flex; width: min(860px, 100%); height: min(620px, calc(100% - 56px)); overflow: hidden; border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; outline: none; --sheet-bg: var(--panel); --sheet-bone: color-mix(in srgb, var(--text) 8%, transparent); --sheet-shine: color-mix(in srgb, var(--text) 19%, transparent); background: var(--sheet-bg); color: var(--text); box-shadow: 0 -18px 50px rgb(0 0 0 / .22); transition: box-shadow .24s ease; }
.card-sheet.is-morphing { box-shadow: none; }
/* в тёмной теме темнее панелей: на компьютере чуть-чуть, на телефоне как настройки */
html:not([data-theme="light"]) .card-sheet { --sheet-bg: #1e1e1e; }
.card-sheet-grip { display: none; }
.card-sheet-close { position: absolute; z-index: 3; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--sheet-bg) 70%, transparent); color: var(--text); cursor: pointer; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .18s ease, background-color .18s ease; }
.card-sheet-close:active { transform: scale(.92); }
.card-sheet-close-icon { width: 17px; height: 17px; background: currentColor; -webkit-mask: var(--ic-x, url('icons/x.svg')) center / contain no-repeat; mask: var(--ic-x, url('icons/x.svg')) center / contain no-repeat; }
.card-sheet-scroll { display: flex; flex: 1; min-width: 0; min-height: 0; }
.card-sheet-gallery { display: none; flex: none; width: 40%; min-width: 0; padding: 12px 0 12px 12px; gap: 8px; }
.card-sheet.has-gallery .card-sheet-gallery, .card-sheet.is-waiting-images .card-sheet-gallery { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: minmax(0, 1fr) 76px; transition: grid-template-rows .34s cubic-bezier(.22, 1, .36, 1), row-gap .34s cubic-bezier(.22, 1, .36, 1); }
.card-sheet-gallery[data-count="0"], .card-sheet-gallery[data-count="1"], .card-sheet-gallery:not([data-count]) { grid-template-rows: minmax(0, 1fr) 0px !important; row-gap: 0; }
.card-sheet.is-waiting-images .card-sheet-gallery::before { content: ''; grid-column: 1 / -1; border-radius: 16px; background: linear-gradient(100deg, var(--sheet-bone) 30%, var(--sheet-shine) 50%, var(--sheet-bone) 70%); background-size: 240% 100%; animation: cardSheetSweep 1.6s linear infinite; }
.card-sheet-slide { position: relative; min-width: 0; min-height: 0; overflow: hidden; padding: 0; border: 0; border-radius: 12px; background: var(--iui-fill, rgb(128 128 128 / .12)); cursor: zoom-in; }
.card-sheet-slide:first-child { grid-column: 1 / -1; border-radius: 16px; }
.card-sheet-slide:not(:first-child) { animation: cardSheetRise .32s var(--ease, ease) both; }
.card-sheet-slide:nth-child(n + 5) { display: none; }
.card-sheet-slide.is-landing .card-sheet-photo { opacity: 0; }
.card-sheet-slide img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.card-sheet-back { object-fit: cover; opacity: .5; filter: blur(22px) saturate(1.2); transform: scale(1.2); }
.card-sheet-photo { object-fit: contain; }
.card-sheet-slide:not(:first-child) .card-sheet-photo { object-fit: cover; }
.card-sheet-ghost { position: fixed; z-index: 47; display: block; object-fit: cover; pointer-events: none; will-change: transform, clip-path; }
.card-sheet-content { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 26px calc(26px + var(--safe-bottom, env(safe-area-inset-bottom, 0px))); }
.card-sheet-title { margin: 0 34px 0 0; font-size: 22px; font-weight: 650; line-height: 1.22; letter-spacing: -.015em; overflow-wrap: anywhere; }
.card-sheet-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13.5px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-sheet-facts[hidden], .card-sheet-actions[hidden] { display: none; }
.card-sheet-status { display: flex; align-items: center; gap: 9px; max-height: 0; overflow: hidden; font-size: 13.5px; color: var(--muted); opacity: 0; transition: opacity .2s ease, max-height .2s ease, margin .2s ease; }
.card-sheet-status.is-visible { max-height: 24px; margin-top: 14px; opacity: 1; }
.card-sheet-status > span:last-child { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 45%, var(--muted) 70%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: cardSheetShine 1.8s linear infinite; }
html[data-theme="light"] .card-sheet-status .spinner { border-color: #bbb; border-top-color: #333; }
.card-sheet-text { position: relative; margin-top: 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.card-sheet-text .stream-content > :first-child { margin-top: 0; }
.card-sheet-text p { margin: 0 0 10px; }
.card-sheet-text h1, .card-sheet-text h2, .card-sheet-text h3, .card-sheet-text h4 { margin: 18px 0 6px; font-size: 15px; font-weight: 650; line-height: 1.35; }
.card-sheet-text ul, .card-sheet-text ol { margin: 0 0 10px; padding-left: 20px; }
.card-sheet-text li { margin: 3px 0; }
.card-sheet-text a { color: inherit; text-decoration: none; }
.card-sheet-text a.message-url { color: var(--message-url, var(--accent)); }
.card-sheet-text a:not(.message-url):not(.rich-video-card)::after { content: '↗'; display: inline-block; margin-left: 2px; font-size: .72em; font-weight: 600; vertical-align: .1em; }
.card-sheet-lead { color: var(--muted); }
.card-sheet-note { color: var(--muted); font-size: 14px; }
.card-sheet-lines { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.card-sheet-lines i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(100deg, var(--sheet-bone) 30%, var(--sheet-shine) 50%, var(--sheet-bone) 70%); background-size: 240% 100%; animation: cardSheetSweep 1.6s linear infinite; animation-delay: calc(var(--row) * -70ms); }
.card-sheet-lines i.is-gap { height: 6px; background: none; animation: none; }
.card-sheet-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.card-sheet-sources:not(:empty) { margin-top: 18px; animation: cardSheetRise .32s var(--ease, ease) both; }
.card-sheet-sources-title { width: 100%; font-size: 12.5px; color: var(--muted); }
.card-sheet-source, .card-sheet-site, .card-sheet-retry { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--iui-fill, rgb(128 128 128 / .12)); color: var(--text); font-size: 13px; text-decoration: none; cursor: pointer; transition: background-color .18s ease, transform .18s ease; }
.card-sheet-source:active, .card-sheet-site:active, .card-sheet-retry:active { transform: scale(.97); }
.card-sheet-actions { margin-top: 16px; }
.card-sheet-site { min-height: 40px; padding: 0 16px; font-size: 14px; font-weight: 600; background: var(--iui-fill-strong, rgb(128 128 128 / .2)); }
.card-sheet-error p { margin: 0 0 10px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .card-sheet-close:hover { background: var(--iui-fill-strong, rgb(128 128 128 / .2)); }
  .card-sheet-source:hover, .card-sheet-site:hover, .card-sheet-retry:hover { background: var(--iui-fill-strong, rgb(128 128 128 / .2)); }
}
@keyframes cardSheetSweep { from { background-position-x: 120%; } to { background-position-x: -120%; } }
@keyframes cardSheetShine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes cardSheetRise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  html:not([data-theme="light"]) .card-sheet { --sheet-bg: #141414; }
  .card-sheet { width: 100%; height: min(90%, calc(100% - var(--app-safe-top, 0px) - 12px)); border-left: 0; border-right: 0; border-radius: 22px 22px 0 0; box-shadow: none; }
  .card-sheet-grip { position: absolute; z-index: 3; top: 7px; left: 50%; display: block; width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 40%, transparent); transform: translateX(-50%); }
  .card-sheet-scroll { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .card-sheet-gallery { width: 100%; height: min(42dvh, 320px); padding: 0; gap: 0; }
  .card-sheet.has-gallery .card-sheet-gallery, .card-sheet.is-waiting-images .card-sheet-gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .card-sheet-gallery::-webkit-scrollbar { display: none; }
  .card-sheet.is-waiting-images .card-sheet-gallery::before { flex: 1; border-radius: 0; }
  .card-sheet-slide, .card-sheet-slide:first-child { flex: none; width: 100%; height: 100%; border-radius: 0; scroll-snap-align: start; cursor: pointer; }
  .card-sheet-slide:nth-child(n + 5) { display: block; }
  .card-sheet-slide:not(:first-child) .card-sheet-photo { object-fit: contain; }
  .card-sheet-content { overflow: visible; padding: 18px 18px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .card-sheet:not(.has-gallery):not(.is-waiting-images) .card-sheet-content { padding-top: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .card-sheet-lines i, .card-sheet.is-waiting-images .card-sheet-gallery::before, .card-sheet-status > span:last-child, .card-sheet-sources:not(:empty), .card-sheet-slide:not(:first-child) { animation: none; }
  .card-sheet-status > span:last-child { color: var(--muted); background: none; }
}
