@import url("/assets/fonts/fonts.css");

/* DramaAi — «теленовелла после заката».
   Баклажановая ночь вместо чёрного, кремовый текст, золото — только для монет,
   розово-красный — только для действия. Смелость — в пейволле «Continua…». */
:root {
  --bg: #1e0f1a;
  --surface: #2b1825;
  --surface-2: #3b2333;
  --text: #f7ece6;
  --muted: #c2abb7;
  --faint: #a58c9b;
  --rose: #ef4a6b;
  --rose-press: #b02848;
  /* Кнопки: белый текст на #c92f52 — 5.2:1 (AA); светлый --rose остаётся для акцентов */
  --rose-btn: #c92f52;
  --gold: #f4b740;
  --gold-deep: #b9811c;
  --line: rgba(247, 236, 230, 0.12);
  --ok: #6fd3a1;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------- каркас страницы ---------- */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
}
.page > * + * { margin-top: 20px; }
.page-head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.page-head h1 { flex: 1; }
.back { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--surface); text-decoration: none; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px;
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary, .btn-coin { white-space: nowrap; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--rose-btn); color: #fff; }
.btn-primary:active { background: var(--rose-press); }
.btn-coin { background: var(--gold); color: #2a1606; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.9rem; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--muted); }

/* ---------- монета: единственное место, где живёт золото ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.coin { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em; filter: drop-shadow(0 1px 1px rgba(60, 30, 0, 0.35)); }
.coin-md { width: 24px; height: 24px; flex: none; }
.coin-lg { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 8px 22px rgba(244, 183, 64, 0.28)); }
/* Начисление/списание: монета переворачивается, как жетон */
.coin-flip { animation: coinflip 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); transform-origin: 50% 50%; }
@keyframes coinflip { 0% { transform: perspective(200px) rotateY(0) scale(1); } 50% { transform: perspective(200px) rotateY(90deg) scale(1.15); } 100% { transform: perspective(200px) rotateY(360deg) scale(1); } }
.count-pop { animation: countpop 0.5s ease; }
@keyframes countpop { 40% { transform: scale(1.25); color: var(--gold); } }
@media (prefers-reduced-motion: reduce) { .coin-flip, .count-pop { animation: none; } }
.coins { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- метка ИИ (обязательная маркировка) ---------- */
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  background: rgba(30, 15, 26, 0.72); border: 1px solid rgba(247, 236, 230, 0.28);
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ai-badge svg { width: 14px; height: 14px; }

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(30, 15, 26, 0.94); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 0.7rem; font-weight: 600; text-decoration: none; color: var(--faint);
}
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .tab-coin { height: 24px; }

/* ---------- лента: вертикальный свайп ---------- */
.feed {
  height: 100dvh; overflow-y: scroll; scroll-snap-type: y mandatory;
  overscroll-behavior: contain; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.card {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: #000;
}
.card video, .card .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .poster { z-index: 1; transition: opacity 0.3s; pointer-events: none; }
.card.playing .poster { opacity: 0; }
.card::after {
  content: ""; position: absolute; z-index: 1; inset: 45% 0 0 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(30, 15, 26, 0.55) 45%, rgba(30, 15, 26, 0.96));
}
.card-info {
  position: absolute; z-index: 2; left: 16px; right: 84px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
}
.card-info h2 { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.card-info p { margin-top: 8px; color: var(--muted); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 0.8rem; color: var(--muted); }
.card-actions { margin-top: 16px; display: flex; gap: 10px; }
.card .ai-badge { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top, 0px)); left: 16px; }
.sound-hint {
  position: absolute; z-index: 3; min-height: 44px; top: calc(14px + env(safe-area-inset-top, 0px)); right: 16px;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 0; background: rgba(30, 15, 26, 0.7); font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sound-hint svg { width: 18px; height: 18px; }
.sound-hint[hidden] { display: none; }
.rail { position: absolute; z-index: 2; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); display: grid; gap: 18px; }
.rail a, .rail button {
  display: grid; justify-items: center; gap: 4px; background: none; border: 0; padding: 0;
  font-size: 0.7rem; font-weight: 600; text-decoration: none; color: var(--text); cursor: pointer;
}
.rail span.ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(30, 15, 26, 0.6); }
.rail svg { width: 24px; height: 24px; }
.progress { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); height: 2px; background: rgba(247, 236, 230, 0.15); }
.progress i { display: block; height: 100%; width: 0; background: var(--text); }
.empty { min-height: 70dvh; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }

/* ---------- каталог ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: var(--r-md); overflow: hidden; background: var(--surface); text-decoration: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, rgba(30, 15, 26, 0.95)); }
.tile-text { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 12px; }
.tile-text h3 { font-size: 1.05rem; }
.tile-text p { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.tile .ai-badge { position: absolute; z-index: 1; top: 8px; left: 8px; }

/* ---------- страница серии ---------- */
.hero { position: relative; margin: -20px -16px 0; aspect-ratio: 4 / 5; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 30% 0 0; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero ~ * { position: relative; z-index: 1; }
.hero .back { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top, 0px)); left: 16px; background: rgba(30, 15, 26, 0.7); }
.hero .ai-badge { position: absolute; z-index: 2; top: calc(20px + env(safe-area-inset-top, 0px)); right: 16px; }
.series-head { position: relative; margin-top: -96px; z-index: 1; }
.series-head h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.025em; text-wrap: balance; }
.series-head .card-meta { margin: 10px 0 0; }
.series-desc { color: var(--muted); max-width: 62ch; }
.credits { font-size: 0.8rem; color: var(--faint); }
.episodes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ep {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--r-sm);
  background: var(--surface); text-decoration: none; font: 700 1.05rem var(--font-display);
}
.ep[data-access="locked"], .ep[data-access="vip_early"] { color: var(--faint); }
.ep .lock { position: absolute; right: 5px; top: 5px; width: 12px; height: 12px; color: var(--gold); }
.ep[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--rose); }
.ep-legend { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); }

/* ---------- плеер ---------- */
.player { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: pan-y; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-top {
  position: absolute; z-index: 12; inset: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 30px;
  background: linear-gradient(rgba(0, 0, 0, 0.78), transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.player-top .back { background: rgba(30, 15, 26, 0.7); }
.player-title { flex: 1; min-width: 0; }
.player-title b { display: block; font: 700 1rem var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title span { font-size: 0.8rem; color: var(--muted); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: rgba(30, 15, 26, 0.7); cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.player-bottom { position: absolute; z-index: 5; inset: auto 0 0; padding: 30px 16px calc(14px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.65)); }
.seek { width: 100%; height: 44px; margin: 0; accent-color: var(--rose); }
.player-hint { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.tap-zone { position: absolute; inset: 70px 0 90px; z-index: 2; }
.big-play { position: absolute; z-index: 3; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(30, 15, 26, 0.6); display: grid; place-items: center; cursor: pointer; }
.big-play svg { width: 34px; height: 34px; }
.big-play[hidden] { display: none; }
video::cue { font-family: var(--font-body); font-size: 1.05rem; background: rgba(0, 0, 0, 0.55); }

/* Шит со списком эпизодов / субтитрами */
.sheet { position: fixed; z-index: 20; inset: auto 0 0; max-height: 75dvh; overflow-y: auto; padding: 20px 16px calc(20px + var(--safe-b)); background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(100%); transition: transform 0.25s ease; }
.sheet.open { transform: none; }
.sheet h2 { margin-bottom: 14px; }
.scrim { position: fixed; z-index: 15; inset: 0; background: rgba(0, 0, 0, 0.5); }
.scrim[hidden] { display: none; }
.opt { display: flex; justify-content: space-between; width: 100%; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.opt[aria-pressed="true"] { color: var(--rose); font-weight: 700; }

/* ---------- пейволл «Continua…» — главный момент интерфейса ---------- */
.paywall { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.paywall[hidden] { display: none; }
.paywall-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(8px) saturate(1.15) brightness(0.6); transform: scale(1.06); }
.paywall-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(30, 15, 26, 0.2), rgba(30, 15, 26, 0.92) 55%, var(--bg)); }
.paywall-body { position: relative; padding: 0 20px calc(24px + var(--safe-b)); }
.paywall-title {
  font: 800 clamp(2.6rem, 15vw, 5.4rem)/0.9 var(--font-display);
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.03em; margin: 0 0 18px -0.04em; white-space: nowrap;
  color: var(--text);
  animation: cliff 0.9s cubic-bezier(0.2, 0.7, 0.1, 1) both;
}
.paywall-title span { display: inline-block; animation: dots 1.6s steps(4, end) 0.9s infinite; clip-path: inset(0 100% 0 0); }
@keyframes cliff { from { opacity: 0; transform: translateY(24px) scale(1.04); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes dots { to { clip-path: inset(0 -10% 0 0); } }
.paywall-title:focus { outline: none; }
.pw-context { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.01em; }
.paywall-lead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.pw-price { font: 800 1.6rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.paywall-lead p { font-size: 1rem; }
.paywall-lead small { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.paywall-actions { display: grid; gap: 10px; }
.paywall-actions .row { display: flex; gap: 10px; }
.paywall-actions .row > * { flex: 1; }
.paywall-actions .row .btn { padding: 0 12px; font-size: 0.95rem; white-space: nowrap; }
.paywall-actions .row svg { width: 20px; height: 20px; }
.paywall-note { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  .paywall-title, .paywall-title span { animation: none; clip-path: none; }
  .sheet { transition: none; }
}

/* Модалка рекламы */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.7); }
.modal[hidden] { display: none; }
.modal-box { width: min(420px, 100%); padding: 24px; border-radius: var(--r-lg); background: var(--surface); text-align: center; }
.modal-box > * + * { margin-top: 14px; }
.ad-frame { aspect-ratio: 16 / 10; display: grid; place-items: center; border-radius: var(--r-md); background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, #432838 14px 28px); color: var(--muted); font-size: 0.85rem; padding: 16px; }
.ring { font: 800 2.2rem var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- формы, списки, панели ---------- */
.panel { background: var(--surface); border-radius: var(--r-md); padding: 18px; }
.panel > * + * { margin-top: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.875rem; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg); font-size: 1rem;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { border-color: var(--muted); outline: none; }
.field-error .input { border-color: var(--rose); }
.error-text { color: #ff9cb0; font-size: 0.875rem; }
.notice { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 0.9rem; }
.notice-ok { background: rgba(111, 211, 161, 0.14); color: #c6f1db; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--rose); flex: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.plus { color: var(--ok); }

/* Кошелёк */
.balance { display: flex; align-items: center; gap: 14px; }
.balance b { font: 800 2.6rem/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.packages { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.package { position: relative; display: grid; gap: 6px; padding: 18px 14px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; cursor: pointer; width: 100%; }
.package .coins { font-size: 1.35rem; }
.package .bonus { color: var(--gold); font-size: 0.8rem; font-weight: 600; min-height: 1.2em; }
.package .per-ep { font-size: 0.75rem; color: var(--muted); }
.package .price { margin-top: 6px; font-weight: 700; }
.package .tag { position: absolute; top: -9px; right: 10px; padding: 2px 8px; border-radius: 999px; background: var(--rose-btn); color: #fff; font-size: 0.75rem; font-weight: 700; }
.package-form { display: contents; }

/* Подписка */
.plans { display: grid; gap: 12px; }
.plan { padding: 20px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.plan-vip { border-color: rgba(244, 183, 64, 0.45); }
.plan header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan h2 { font-size: 1.5rem; }
.plan .amount { font: 800 1.5rem var(--font-display); }
.plan .amount small { font: 400 0.8rem var(--font-body); color: var(--muted); margin-left: 4px; }
.plan ul { margin: 14px 0 16px; padding: 0 0 0 18px; color: var(--muted); }
.plan li + li { margin-top: 4px; }

/* Студия */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); }
.status-approved { background: rgba(111, 211, 161, 0.18); color: #c6f1db; }
.status-pending { background: rgba(244, 183, 64, 0.16); color: #ffe1a3; }
.status-rejected { background: rgba(239, 74, 107, 0.18); color: #ffc0cd; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; border-radius: var(--r-md); background: var(--surface); }
.stat b { display: block; font: 800 1.6rem var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.ep-row { display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ep-thumb { width: 54px; aspect-ratio: 9 / 16; border-radius: 6px; background: var(--surface-2) center / cover; display: grid; place-items: center; font: 700 1rem var(--font-display); }
.ep-row form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.ep-row .input { min-height: 40px; width: 90px; padding: 6px 10px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--rose); transition: width 0.2s; }

/* Тексты документов */
.prose { max-width: 66ch; color: var(--muted); }
.prose h2 { color: var(--text); margin: 28px 0 8px; font-size: 1.15rem; }
.prose p + p, .prose ul { margin-top: 10px; }

/* Согласие и установка */
.consent, .install {
  position: fixed; z-index: 35; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  max-width: 536px; margin: 0 auto; padding: 16px; border-radius: var(--r-md);
  background: var(--surface-2); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); font-size: 0.875rem;
}
.consent[hidden], .install[hidden] { display: none; }
.consent .actions, .install .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.consent .actions .btn { flex: 1; background: var(--surface); border: 1px solid var(--line); }
.no-tabbar .consent, .no-tabbar .install { bottom: calc(12px + var(--safe-b)); }

.toast { position: fixed; z-index: 50; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 0.9rem; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.toast[hidden] { display: none; }

.lang-switch { display: flex; gap: 8px; }
.lang-switch button { flex: 1; min-height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); background: none; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 700; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .card { max-width: 480px; margin: 0 auto; }
  .player video { object-fit: contain; }
}

/* ---------- админка (рабочий инструмент: плотнее и шире) ---------- */
.admin-wrap { min-height: 100dvh; }
.admin-nav {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 4px; align-items: center; overflow-x: auto;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.admin-nav a { padding: 8px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.admin-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.admin-nav .admin-logo { font: 800 1.1rem var(--font-display); color: var(--text); margin-right: 12px; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.admin-main > * + * { margin-top: 20px; }
.admin-main h2 { margin-bottom: 10px; }
.admin-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid transparent; }
.kpi span { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.kpi b { display: block; margin: 4px 0 2px; font: 800 1.9rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--faint); font-size: 0.75rem; }
.kpis-sm .kpi b { font-size: 1.4rem; }
.kpi-ok { border-color: rgba(111, 211, 161, 0.5); }
.kpi-ok b { color: #c6f1db; }
.kpi-bad { border-color: rgba(239, 74, 107, 0.5); }
.kpi-bad b { color: #ffc0cd; }
.table-wrap { overflow-x: auto; border-radius: var(--r-md); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.kpi-ok { color: #c6f1db; }
.table td.kpi-bad { color: #ffc0cd; }
.table .wrap { white-space: normal; min-width: 200px; }
.inline { display: flex; gap: 6px; align-items: center; }
.input-sm { min-height: 34px; padding: 4px 8px; font-size: 0.875rem; width: 100px; }
.seg { display: flex; gap: 4px; }
.seg button { min-height: 36px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: none; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 700; }
.search { display: flex; gap: 6px; }
.search .input { min-height: 40px; width: 240px; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.review-ep { margin: 0; }
.review-ep video, .review-ep .ep-thumb { width: 100%; aspect-ratio: 9 / 16; border-radius: var(--r-sm); background: #000; }
.review-ep figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.checklist { margin: 0; padding-left: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- подсказка «На экран Домой» для iPhone ---------- */
.ios-install {
  position: fixed; z-index: 36; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  max-width: 520px; margin: 0 auto; padding: 18px 18px 14px; border-radius: var(--r-lg);
  background: var(--surface-2); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
  animation: slideup 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.no-tabbar .ios-install { bottom: calc(10px + var(--safe-b)); }
@keyframes slideup { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ios-install { animation: none; } }
.ios-head { display: flex; gap: 12px; align-items: center; padding-right: 32px; }
.ios-head img { border-radius: 12px; flex: none; }
.ios-head h2 { font-size: 1.1rem; }
.ios-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; font-size: 1.6rem; color: var(--muted); cursor: pointer; }
.ios-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.ios-steps li { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; counter-increment: s; }
.ios-steps li::before { content: counter(s); flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.ios-ic { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--bg); color: #4ea1ff; font-weight: 800; letter-spacing: 1px; }
.ios-ic svg { width: 20px; height: 20px; }
.ios-install[data-mode="safari"] .ios-steps[data-mode="inapp"],
.ios-install[data-mode="inapp"] .ios-steps[data-mode="safari"] { display: none; }
