/* «Поделиться» приёмом и днём — экран картинки (SPEC-bodyglow-plate-method §П6, раскладка Б §В2).
   Лист — в теме приложения (переменные base.css), цветом тона красится только картинка */
/* Во весь экран без прокрутки (§С2): шапка 52 · картинка (остаток) · слот подсказки · ряд «вид · Дата» 44 · вкладки 36 ·
   панель вкладки 128 (сторис) / 98 (пост). Высоты рядов в px, не в em: крупный системный шрифт не раздвигает ряды */
dialog.share-card { display: none; position: fixed; inset: 0 0 auto; width: 100%; height: var(--tg-viewport-stable-height, 100dvh);
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden;
  background: var(--bg); color: var(--fg); }
dialog.share-card[open] { display: block; }
/* страница под листом не прокручивается, пока он открыт */
html:has(dialog.share-card[open]) { overflow: hidden; }
.share-card-body { --panel: 128px; display: grid; grid-template: "head" 52px "stage" minmax(0, 1fr) "tip" auto "row" 44px "tabs" 36px "panel" var(--panel) / minmax(0, 1fr); height: 100%;
  padding: var(--safe-t) 0 var(--safe-b); overflow: hidden; }

/* 1. Шапка: «‹» · «Сторис / Пост» по центру · «Поделиться» */
.share-head { grid-area: head; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px; align-items: center; padding: 0 8px 0 4px; }
.share-head-l { justify-self: start; display: flex; }
.share-head .share-help { width: var(--tap); height: var(--tap); font: 600 17px var(--body); color: var(--muted); }
.share-head [data-close] { justify-self: start; width: var(--tap); height: var(--tap); font-size: 22px; }
.share-head .share-go { justify-self: end; min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border-radius: 999px;
  font: 600 15px/1 var(--body); white-space: nowrap; }
/* сегменты: видимая капсула 32, зона касания 44 */
.share-card .seg { justify-self: center; display: inline-flex; position: relative; isolation: isolate; height: var(--tap); align-items: center; }
.share-card .seg::before { content: ""; position: absolute; inset: 6px 0; z-index: -1; border-radius: 999px; background: var(--surface); }
.share-card .seg button { position: relative; height: var(--tap); min-width: var(--tap); padding: 0 12px; border: 0; background: none;
  color: var(--muted); font: 600 13px/1 var(--body); }
.share-card .seg button::before { content: ""; position: absolute; inset: 9px 3px; z-index: -1; border-radius: 999px; }
.share-card .seg button[aria-pressed=true] { color: var(--fg); }
.share-card .seg button[aria-pressed=true]::before { background: var(--bg); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }

/* 2. Картинка: рамка по fitBox (screen.js layout), поверх — слой «Добавьте фото» и значки */
.share-stage { grid-area: stage; position: relative; min-height: 0; overflow: hidden; }
.share-frame { position: absolute; }
.share-canvas { display: block; width: 100%; height: 100%; border-radius: 14px; touch-action: none; background: var(--surface);
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / .35); }
.share-zones { position: absolute; inset: 0; pointer-events: none; border-radius: 14px; overflow: hidden; }
/* значки (§С2, Р5): круг 40 в зоне 44, край круга в 10 px от края картинки; «Сбросить» в DOM всегда, видна после правки */
.share-icons { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; }
.share-icons button { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: #fff; }
.share-icons i { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgb(0 0 0 / .38);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.share-icons .ico { width: 20px; height: 20px; }
.share-icons [data-reset] { opacity: 0; pointer-events: none; }
.share-icons [data-reset][data-on] { opacity: 1; pointer-events: auto; }

/* 3. Слот подсказки (пустой до «Обучения в приложении») и ряд «вид · Дата»: видимые 32, зона 44 */
.share-tip { grid-area: tip; margin: 0; padding: 0 16px; text-align: center; font-size: 13px; color: var(--muted); }
.share-tip:empty { display: none; }
.share-row { grid-area: row; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; }
.share-scope-wrap { padding: 0; max-width: 62%; }
.share-scope-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.share-scope { min-width: var(--tap); max-width: 100%; min-height: var(--tap); padding: 0 34px 0 14px; border: 0; background: none;
  -webkit-appearance: none; appearance: none; color: var(--fg); font: 600 14px/1 var(--body); text-overflow: ellipsis; }
.share-chip { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  min-width: var(--tap); padding: 0 14px; border: 0; background: none; color: var(--fg); font: 600 14px/1 var(--body); white-space: nowrap; }
.share-chip::before { content: ""; position: absolute; inset: 6px 0; z-index: -1; border-radius: 999px; background: var(--surface); }
.share-chip input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.share-chip .ico { width: 18px; height: 18px; }

/* 4. Вкладки: сегменты-слова 32, зона касания 44 (выходит на 4 px за ряд 36) */
.share-tabs { grid-area: tabs; display: flex; justify-content: center; align-items: center; gap: 4px; }
.share-tabs [role=tab] { position: relative; isolation: isolate; height: var(--tap); min-width: var(--tap); margin: -4px 0; padding: 0 14px;
  border: 0; background: none; color: var(--muted); font: 600 14px/1 var(--body); }
.share-tabs [role=tab]::before { content: ""; position: absolute; inset: 6px 0; z-index: -1; border-radius: 999px; }
.share-tabs [role=tab][aria-selected=true] { color: var(--fg); }
.share-tabs [role=tab][aria-selected=true]::before { background: var(--surface); }

/* 5. Панель вкладки: высота одна на всех вкладках — по «Стилю» (карточка 56 × формат + подпись 16 + поля 12) */
.share-card[data-format=post] .share-card-body { --panel: 98px; }
.share-panel { grid-area: panel; display: flex; flex-direction: column; border-top: 1px solid var(--line); overflow: hidden; }
.share-pane { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.share-pane[hidden] { display: none; }
.share-styles { flex: none; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding: 0 12px;
  scroll-snap-type: x proximity; scrollbar-width: none; }
.share-styles::-webkit-scrollbar { display: none; }
.share-styles button { --cw: 56px; flex: none; width: var(--cw); min-height: var(--tap); scroll-snap-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--muted); }
.share-styles canvas { display: block; width: var(--cw); height: calc(var(--cw) * 16 / 9); border-radius: 8px; background: var(--surface); }
.share-card[data-format=post] .share-styles canvas { height: calc(var(--cw) * 5 / 4); }
.share-styles span { display: block; width: 100%; height: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: center; font: 600 11px/13px var(--body); }
.share-styles button[aria-pressed=true] { color: var(--fg); }
.share-styles button[aria-pressed=true] canvas { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
/* «Шрифт» (§С2): «Название | Цифры» и полоса карточек «Аа» 56 шириной; высота «Аа» — что остаётся в панели, не больше 56 */
.share-frole { align-self: center; flex: none; }
.share-fonts { flex: none; display: flex; align-items: flex-start; gap: 6px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 0 12px; scrollbar-width: none; }
.share-fonts::-webkit-scrollbar { display: none; }
.share-fonts button { --fh: min(56px, calc(var(--panel) - 60px)); position: relative; flex: none; width: 56px; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--muted); }
.share-fonts b { display: grid; place-items: center; width: 56px; height: var(--fh); border-radius: 10px; background: var(--surface);
  color: var(--fg); font-size: 22px; line-height: 1; font-weight: 400; }
.share-fonts span { display: block; width: 100%; height: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: center; font: 600 11px/13px var(--body); }
.share-fonts button[aria-pressed=true] { color: var(--fg); }
.share-fonts button[aria-pressed=true] b { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
.share-fonts em { display: none; position: absolute; left: 2px; right: 2px; top: calc(var(--fh) / 2 - 7px); border-radius: 6px;
  background: var(--bg); color: var(--fg); font: 600 10px/14px var(--body); font-style: normal; text-align: center; }
.share-fonts [data-state=offline] em { display: block; }
.share-fonts [data-state=loading] b { color: transparent; }
.share-fonts [data-state=loading] b::after { content: ""; position: absolute; top: calc(var(--fh) / 2 - 10px); width: 20px; height: 20px;
  border: 2px solid var(--line); border-top-color: var(--fg); border-radius: 50%; animation: share-spin .8s linear infinite; }
.share-font-sep { flex: none; align-self: stretch; width: 1px; margin: 6px 2px 18px; background: var(--line); }
@keyframes share-spin { to { transform: rotate(360deg); } }
.share-tones { flex: none; display: flex; justify-content: safe center; height: var(--tap); padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
.share-tones button { flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0;
  background: none; border-radius: 50%; }
.share-tones i { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .2); box-shadow: 0 0 0 3px var(--bg); }
.share-tones button[aria-pressed=true] i { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--fg); }
.share-tones .share-font-sep { margin: 10px 4px; }
/* низкий экран: карточки уже, картинке остаётся ≥ 180 px */
@media (max-height: 499px) {
  .share-styles button { --cw: 44px; }
  .share-card-body { --panel: 106px; }
  .share-card[data-format=post] .share-card-body { --panel: 84px; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.share-card[open] { animation: share-up .22s ease-out; }
}
@keyframes share-up { from { transform: translateY(24px); opacity: 0; } }

/* Слой «Добавьте фото еды» (§В3.2): пунктир по месту фото цветом текста стиля (hit.ink), кнопка — в свободной от
   плашки части. Касается только кнопка: жесты плашки идут сквозь пунктир */
.share-zone { position: absolute; box-sizing: border-box; border: 2px dashed color-mix(in srgb, currentColor 60%, transparent); }
.share-zone button { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 6px; border: 0; background: none; color: inherit; pointer-events: auto; text-align: center; }
.share-zone i { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: color-mix(in srgb, currentColor 14%, transparent); }
.share-zone i .ico { width: 26px; height: 26px; }
.share-zone b { font: 600 15px/1.2 var(--body); }
.share-zone small { max-width: 220px; font: 400 12px/1.25 var(--body); text-wrap: balance; }
.share-zone[data-size=small] button { padding: 0; }
.share-zone[data-size=small] i { width: 32px; height: 32px; }
.share-zone[data-size=small] i .ico { width: 18px; height: 18px; }
/* «+» в ряду цвета и окно своего цвета (§С6): лист снизу поверх панели, картинка остаётся видна */
.share-card-body { position: relative; }
.share-tones .share-add { flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0;
  background: none; color: var(--fg); }
.share-tones .share-add i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--muted);
  font: 400 20px/1 var(--body); font-style: normal; }
.share-picker { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; gap: 10px;
  padding: 0 12px calc(10px + var(--safe-b)); background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgb(0 0 0 / .18); }
.share-picker[hidden] { display: none; }
.pk-grab { height: 20px; touch-action: none; display: grid; place-items: center; }
.pk-grab::before { content: ""; width: 36px; height: 5px; border-radius: 3px; background: var(--line); }
.pk-sv, .pk-hue { position: relative; touch-action: none; }
.pk-sv { height: 160px; border-radius: 12px;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(calc(var(--h, 0) * 1deg) 100% 50%)); }
.pk-hue { height: 24px; border-radius: 12px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.pk-knob { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .35); pointer-events: none; }
.pk-hue .pk-knob { top: 50%; }
.pk-row { display: grid; grid-template-columns: var(--tap) var(--tap) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.pk-row [data-pk-back] { width: var(--tap); height: var(--tap); font-size: 22px; }
.pk-drop { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--fg); }
.pk-hex { min-width: 0; height: var(--tap); padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  color: var(--fg); font: 500 16px/1 ui-monospace, monospace; text-transform: uppercase; }
.pk-hex.pk-bad { border: 2px solid var(--danger); }
.pk-done { min-height: var(--tap); padding: 0 16px; border-radius: 999px; }
/* пипетка: панель спрятана, вместо неё полоса с подсказкой; значки и слой фото не мешают касанию */
.share-dropping :is(.share-panel, .share-tabs, .share-row, .share-zones, .share-icons) { visibility: hidden; }
.share-dropbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  height: calc(52px + var(--safe-b)); padding: 0 12px var(--safe-b) 4px; background: var(--bg); border-top: 1px solid var(--line);
  font: 500 15px/1.2 var(--body); }
.share-dropbar [data-drop-back] { width: var(--tap); height: var(--tap); font-size: 22px; }
.share-loupe { position: absolute; z-index: 4; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / .35); pointer-events: none; }
.share-loupe[hidden] { display: none; }
/* смена вида (§С7): пока грузится новый, на прежнем — вуаль */
.share-frame[data-loading]::after { content: ""; position: absolute; inset: 0; background: rgb(255 255 255 / .45); pointer-events: none; }

/* Обучение, шаг 0 (SPEC-bodyglow-onboarding §6.4): пример готовой сторис поверх экрана, внутри <dialog> */
.coach-tour0 { position: absolute; inset: calc(52px + var(--safe-t)) 0 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px 24px calc(16px + var(--safe-b)); background: var(--pearl); text-align: center; }
/* шапка экрана («Назад») остаётся нажимаемой: уйти можно и с примера */
.coach-tour0-cv { width: min(52vw, 40dvh * 9 / 16); aspect-ratio: 9 / 16; height: auto; border-radius: 14px; box-shadow: var(--glass-shadow); }
.coach-tour0-t { font: 600 1.25rem/1.3 var(--display); margin-top: 6px; }
.coach-tour0 .meta { margin: 0; max-width: 32ch; }
.coach-tour0 .btn { width: min(100%, 320px); }
