/* material.css — «Покажи коту» (волны 1–2): шторка материала (до 4 фото),
 * мольберт со «Свернуть», открытка или альбом с «Да / Ещё вариант / Мимо /
 * Поправить слово», карточка новичка над лентой, полоска в Находках. Цвета и длительности — только
 * токены kit.css (тёмная и светлая тема), касания iPhone без выделения,
 * тап-цели ≥ var(--tap), reduced-motion гасит покачивание кота. */

.mt { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 4px; }

/* ── режимы ─────────────────────────────────────────────────────────── */
.mt-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: 999px; background: var(--sink);
}
.mt-seg-b {
  min-height: var(--tap); padding: 0 8px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-mid); font: inherit; font-size: 14px; font-weight: 800;
  cursor: pointer; transition: background-color var(--dur-press) linear, color var(--dur-press) linear;
}
.mt-seg-b.on { background: var(--accent-wash-3); color: var(--panel-fg); }
.mt-seg-b:active { background: var(--accent-wash-2); }
.mt-seg, .mt-seg-b, .mt-pick, .mt-stand, .mt-card, .mt-acts, .mt-fail-acts, .es-link,
.mt-shot, .mt-cards, .mt-newbie, .mt-strip, .mt-fix-acts {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

/* ── материал ───────────────────────────────────────────────────────── */
.mt-form { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mt-form[hidden], .mt-easel[hidden], .mt-result[hidden], .mt-fail[hidden], .mt-self[hidden] { display: none; }
.mt-pick {
  position: relative; display: grid; place-items: center; align-content: center; gap: 6px;
  min-height: 132px; padding: 16px; overflow: hidden; border-radius: var(--r-4); cursor: pointer;
  background: var(--raise-2); box-shadow: inset 0 0 0 2px var(--line-strong);
  color: var(--ink-mid); font-size: 15px; font-weight: 800;
  transition: background-color var(--dur-press) linear;
}
.mt-pick:active { background: var(--accent-wash-2); }
.mt-pick-ic .ki { font-size: 34px; color: var(--lav); }
/* Фото материала (волна 2 — до 4): одно — во всю ширину шторки, несколько —
 * лентой карточек 4:5 с прокруткой вбок; крестик — в углу самого снимка. */
.mt-shots { display: flex; gap: 8px; }
.mt-shots[data-n="0"] .mt-pick { flex: 1 1 auto; }
.mt-shots[data-n="1"] { flex-wrap: wrap; }
.mt-shot {
  position: relative; flex: 0 0 auto; width: 112px; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--r-3); background: var(--sink); box-shadow: var(--e2);
}
.mt-shots[data-n="1"] .mt-shot { width: 100%; aspect-ratio: auto; height: min(40dvh, 420px); border-radius: var(--r-4); }
.mt-shots:not([data-n="0"]):not([data-n="1"]) {
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 2px;
}
.mt-shots:not([data-n="0"]):not([data-n="1"]) > * { scroll-snap-align: start; }
.mt-prev { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mt-shot-n {
  position: absolute; left: 6px; top: 6px; display: grid; place-items: center; min-width: 22px; height: 22px;
  padding: 0 6px; border-radius: 999px; background: var(--scrim-2); color: var(--panel-fg);
  font-size: 12px; font-weight: 800;
}
.mt-pick[hidden] { display: none; }
.mt-pick.is-more { min-height: var(--tap); padding: 8px 14px; font-size: 14px; grid-auto-flow: column; gap: 8px; }
.mt-shots:not([data-n="0"]):not([data-n="1"]) .mt-pick.is-more {
  flex: 0 0 auto; width: 112px; aspect-ratio: 4 / 5; grid-auto-flow: row; padding: 8px; text-align: center;
}
.mt-shots[data-n="1"] .mt-pick.is-more { flex: 1 1 100%; }
.mt-pick.is-more .mt-pick-ic .ki { font-size: 24px; }
.mt-pick.is-ok { box-shadow: inset 0 0 0 2px var(--lav); color: var(--panel-fg); }
.mt-unpick {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  background: var(--scrim-2); color: var(--panel-fg); box-shadow: var(--e2);
}
.mt-words {
  width: 100%; min-height: 72px; padding: 10px 12px; resize: vertical; border: 0; border-radius: var(--r-3);
  background: var(--raise-2); box-shadow: var(--inset-well), inset 0 0 0 1px var(--line);
  color: var(--panel-fg); font: inherit; font-size: 16px;
  transition: box-shadow var(--dur-fast) linear;
}
.mt-words.is-ask { box-shadow: var(--inset-well), inset 0 0 0 2px var(--lav); }
.mt-hint { margin: 0; color: var(--ink-dim); font-size: 13px; font-weight: 700; line-height: 1.4; }
.mt-hint.is-count { text-align: right; font-variant-numeric: tabular-nums; }
.mt-hint.is-over { color: var(--danger-ink); }
.mt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt-left { color: var(--ink-dim); font-size: 12px; font-weight: 800; }
.mt-go { margin-left: auto; }

/* ── мольберт ───────────────────────────────────────────────────────── */
.mt-easel { display: grid; justify-items: center; gap: 12px; padding: 12px 0 4px; text-align: center; }
.mt-stand { position: relative; display: grid; place-items: center; width: 220px; height: 160px; }
.mt-cat {
  display: block; transform-origin: 50% 100%;
  animation: mt-sway calc(var(--dur-slow) * 9) ease-in-out infinite alternate;   /* качается без рывка в крайних точках */
}
.mt-easel.has-photo .mt-cat { transform: translateX(-34px); }
.mt-thumb {
  position: absolute; right: 6px; bottom: 0; width: 92px; height: 115px; object-fit: cover;
  border-radius: var(--r-2); box-shadow: var(--e2); transform: rotate(6deg);
  outline: 3px solid var(--raise-2);
}
.mt-easel.is-stack .mt-thumb { box-shadow: var(--e2), 6px 6px 0 0 var(--raise), 12px 12px 0 0 var(--line-strong); }
.mt-thumb-n {
  position: absolute; right: -4px; bottom: -6px; display: grid; place-items: center; min-width: 30px; height: 26px;
  padding: 0 8px; border-radius: 999px; background: var(--lav); color: var(--ink-on-accent);
  font-size: 13px; font-weight: 800; box-shadow: var(--e2);
}
.mt-thumb-n[hidden], .mt-push[hidden], .mt-push-on[hidden], .mt-pager[hidden], .mt-fixer[hidden], .mt-fix[hidden] { display: none; }
.mt-fold-t { margin: -4px 0 0; color: var(--ink-dim); font-size: 13px; font-weight: 700; line-height: 1.4; max-width: 30ch; }
.mt-push {
  display: grid; justify-items: center; gap: 8px; width: 100%; padding: 12px;
  border-radius: var(--r-3); background: var(--raise-2); box-shadow: inset 0 0 0 1px var(--line);
}
.mt-push-t { margin: 0; color: var(--ink-mid); font-size: 13px; font-weight: 700; line-height: 1.4; }
.mt-push-on { min-height: var(--tap); }
.mt-stage { margin: 0; color: var(--panel-fg); font-size: 16px; font-weight: 800; min-height: 1.4em; }
.mt-prog { width: min(260px, 80%); height: 4px; overflow: hidden; border-radius: 2px; background: var(--line); }
.mt-prog i {
  display: block; height: 100%; background: var(--lav);
  transform: scaleX(0); transform-origin: left center;
  transition: transform var(--dur-base) linear;
}
/* Фото уже у кота — сколько он думает, неизвестно: «бегущий блик» вместо полной полосы. */
.mt-prog.is-wait i {
  width: 40%; transform: translateX(-100%); transition: none;
  animation: mt-wait calc(var(--dur-slow) * 5) ease-in-out infinite;
}
@keyframes mt-wait { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
/* «Подпишу сам»: фото у сервера, он пережимает и кладёт пост — тот же блик. */
.cmp-prog.is-wait i {
  width: 40%; transform: translateX(-100%); transition: none;
  animation: mt-wait calc(var(--dur-slow) * 5) ease-in-out infinite;
}
/* Плитка фото, которое ещё перекодируется (HEIC с iPhone — секунду-другую). */
.mt-shot.is-wait {
  display: grid; place-items: center; padding: 8px; box-shadow: inset 0 0 0 1px var(--line);
  background: linear-gradient(100deg, var(--sk-1) 40%, var(--sk-2) 50%, var(--sk-1) 60%);
  background-size: 200% 100%; animation: shimmer calc(var(--dur-slow) * 4) ease-in-out infinite;
}
.mt-shot-wait { color: var(--ink-dim); font-size: 12px; font-weight: 800; text-align: center; }

@keyframes mt-sway {
  from { rotate: -4deg; }
  to { rotate: 4deg; }
}

/* ── результат ──────────────────────────────────────────────────────── */
.mt-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mt-cards {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--r-4);
}
.mt-cards::-webkit-scrollbar { display: none; }
.mt-card {
  display: block; flex: 0 0 100%; width: 100%; max-height: 52dvh; aspect-ratio: 4 / 5; object-fit: contain;
  scroll-snap-align: center; border-radius: var(--r-4); background: var(--sink); box-shadow: var(--e2);
  animation: mt-in var(--dur-slow) var(--ease-out);
}
.mt-pager { margin: -4px 0 0; color: var(--ink-dim); font-size: 12px; font-weight: 800; text-align: center; }
.mt-result.is-fixing .mt-cards { opacity: .5; transition: opacity var(--dur-base) linear; }
.mt-fix {
  justify-self: center; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
}
.mt-fixer, .mt-fixsheet { display: grid; gap: 8px; }
.mt-result.is-editing .mt-acts, .mt-result.is-editing .mt-note, .mt-result.is-editing .mt-warn { display: none; }
.mt-fix-in {
  width: 100%; min-height: 84px; padding: 10px 12px; resize: vertical; border: 0; border-radius: var(--r-3);
  background: var(--raise-2); box-shadow: var(--inset-well), inset 0 0 0 2px var(--lav);
  color: var(--panel-fg); font: inherit; font-size: 16px; font-weight: 700;
}
.mt-fix-hint { margin: 0; min-height: 1.4em; color: var(--ink-dim); font-size: 13px; font-weight: 700; line-height: 1.4; }
.mt-fix-acts { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.mt-fixsheet .mt-fix-acts { grid-template-columns: 1fr; }
.mt-fix-prev { max-height: 34dvh; justify-self: center; width: auto; }
.mt-warn {
  display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--r-3);
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.mt-warn-l { margin: 0; color: var(--warm-ink); font-size: 14px; font-weight: 800; line-height: 1.4; }
.mt-acts { display: grid; gap: 8px; }
.mt-acts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mt-acts2 > .ask-row { grid-column: 1 / -1; }      /* «Выбросить эту открытку? Нет | Мимо» во всю ширину */
.mt-yes.is-armed { box-shadow: inset 0 0 0 2px var(--warm-ink); }
.mt-note { margin: 0; color: var(--ink-dim); font-size: 12px; font-weight: 700; text-align: center; }
@keyframes mt-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ── отказ ──────────────────────────────────────────────────────────── */
.mt-fail { display: grid; gap: 12px; padding: 12px 0; text-align: center; }
.mt-fail-t { margin: 0; color: var(--panel-fg); font-size: 16px; font-weight: 800; line-height: 1.4; }
.mt-fail-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mt-fail-acts [hidden] { display: none; }

/* ── пустые Находки: мелкая ссылка на кота для компьютера ───────────── */
.es-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 8px;
  color: var(--ink-dim); font-size: 13px; font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── карточка новичка над лентой (волна 2) ─────────────────────────── */
.mt-newbie {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  gap: 12px; margin: 0 var(--gutter); padding: 14px 14px 14px 12px; border-radius: var(--r-4);
  background: var(--raise-2); box-shadow: var(--e2), inset 0 0 0 2px var(--accent-wash-2);
  animation: mt-in var(--dur-slow) var(--ease-out);
}
.mt-newbie-cat { display: block; }
.mt-newbie-t { margin: 0; padding-right: 36px; color: var(--panel-fg); font-size: 15px; font-weight: 800; line-height: 1.35; }
.mt-newbie-go { grid-column: 1 / -1; width: 100%; min-height: 52px; font-size: 16px; }
.mt-newbie-x {
  position: absolute; top: 4px; right: 4px; color: var(--ink-mid);
}

/* ── полоска в Находках: кот не успел / не дорисовал ─────────────────── */
.mt-strip {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 6px 10px 14px; border-radius: var(--r-3);
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.mt-strip-t { margin: 0; color: var(--warm-ink); font-size: 14px; font-weight: 800; line-height: 1.35; }
.mt-strip .btn { min-height: var(--tap); }
.fd-card.is-hl { box-shadow: var(--e2), 0 0 0 3px var(--lav); }
.fd-fix {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  margin: 6px 12px 0; color: var(--ink-mid); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

@media (prefers-reduced-motion: reduce) {
  .mt-cat, .mt-card, .mt-newbie, .mt-shot.is-wait { animation: none; }
  .mt-prog.is-wait i, .cmp-prog.is-wait i { animation: none; width: 100%; transform: none; opacity: .5; }
  .mt-prog i, .mt-words, .mt-result.is-fixing .mt-cards { transition: none; }
}
