:root {
  --bg: #0d0b0b;
  --surface: #171312;
  --surface-2: #211b19;
  --line: rgba(255, 255, 255, 0.07);
  --text: #f6f0ee;
  --hint: #9b8f8b;
  --accent: #ff5a2c;
  --accent-2: #ff3b30;
  --on-accent: #fff;
  --ok: #3ecf8e;
  --danger: #ff6b5e;
  --radius: 16px;
  --tabs-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
.hidden { display: none !important; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Шапка ── */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
       padding: 10px 14px; background: rgba(13, 11, 11, 0.92); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.logo { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center;
        background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 800; font-size: 17px; }
.brand b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
        background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.pill.icon { width: 34px; padding: 0; justify-content: center; }
.pill.icon svg { width: 18px; height: 18px; }

main { padding: 4px 14px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); }

/* ── Баннер и полоска активной задачи ── */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 6px 0 12px;
          border-radius: var(--radius); background: linear-gradient(135deg, rgba(255, 90, 44, 0.18), rgba(255, 59, 48, 0.08));
          border: 1px solid rgba(255, 90, 44, 0.3); font-weight: 600; }
.banner small { display: block; font-weight: 400; color: var(--hint); }
.activejob { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
             margin: 6px 0 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.activejob .bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.activejob .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .5s; }

/* ── Чипы ── */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 4px -14px 12px; padding: 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface);
        border: 1px solid var(--line); white-space: nowrap; font-weight: 500; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ── Сетка ── */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { position: relative; aspect-ratio: 3 / 4; min-width: 0; width: 100%; border-radius: var(--radius); overflow: hidden;
        background: var(--surface) center / cover no-repeat; text-align: left; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Примеры в сетке размыты: поза и движение видны, детали — нет. Слой шире
   карточки, чтобы размытый край не просвечивал фоном по периметру. */
.card .media { position: absolute; inset: -14px; background: center / cover no-repeat; filter: blur(6px); }
.card .shade { position: absolute; inset: auto 0 0 0; height: 50%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }
.card .name { position: absolute; left: 10px; right: 10px; bottom: 10px; font-weight: 700; font-size: 14px;
              text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.card .tag { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; }
.badge { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); color: #fff; font-size: 11px; font-weight: 700;
         padding: 3px 8px; border-radius: 999px; }
.badge.hot { background: var(--accent); }
.card:active { transform: scale(0.97); transition: transform 0.08s; }
.empty { color: var(--hint); text-align: center; padding: 48px 12px; }

/* значок «смотреть» на карточках галереи */
.card .play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.card .play svg { width: 44px; height: 44px; padding: 11px; border-radius: 50%; fill: #fff; stroke: none;
                  background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px); }

/* ── Нижние вкладки ── */
.tabs { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 6;
        height: var(--tabs-h); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px;
        border-radius: 22px; background: rgba(23, 19, 18, 0.94); backdrop-filter: blur(14px); border: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
       border-radius: 16px; color: var(--hint); font-size: 11px; font-weight: 600; }
.tab.on { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* ── Экраны поверх (сюжет, ожидание) ── */
.layer { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column;
         padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); overflow-y: auto; }
.layer .bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.stage { position: relative; flex: 1; min-height: 260px; border-radius: 20px; overflow: hidden; background: #000; }
.stage video, .stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* Пример сюжета размыт, пока человек сам не нажмёт «Показать». */
.stage .blur { filter: blur(16px); transform: scale(1.06); }
.stage video, .stage img { transition: filter 0.25s, transform 0.25s; }
.reveal { position: absolute; inset: 0; display: grid; place-items: center; }
.reveal span { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px;
               background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); color: #fff; font-weight: 700; }
.reveal svg { width: 20px; height: 20px; }
.layer h2 { font-size: 21px; margin: 14px 2px 4px; }
.layer p.sub { color: var(--hint); margin: 0 2px 12px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px;
       background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.seg button { height: 42px; border-radius: 11px; font-weight: 600; color: var(--hint); display: flex;
              align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255, 90, 44, 0.55); }
.seg svg { width: 15px; height: 15px; }

.btn { width: 100%; height: 52px; border-radius: 15px; font-weight: 700; font-size: 16px; display: flex;
       align-items: center; justify-content: center; gap: 8px; color: var(--on-accent);
       background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); margin-top: 8px; }
.btn[disabled] { opacity: 0.55; }
.note { color: var(--hint); font-size: 13px; text-align: center; margin: 10px 4px 0; }
.err { color: var(--danger); font-weight: 600; margin: 4px 2px 12px; }

/* ── Ожидание ── */
.wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.ring { width: 150px; height: 150px; position: relative; margin-bottom: 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
.wait h3 { margin: 0; font-size: 20px; }
.wait p { margin: 0; color: var(--hint); }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent);
        animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { position: relative; flex: 1; min-height: 300px; border-radius: 20px; overflow: hidden; background: #000; }
.result video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* ── Вкладки-разделы ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 6px 0 12px; }
.panel .big { font-size: 34px; font-weight: 800; margin: 2px 0; }
.panel .hint { color: var(--hint); }
.row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px;
       background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; font-weight: 600; }
.row span { color: var(--hint); font-weight: 400; }
/* ── Кошелёк ── */
.pack { position: relative; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
        padding: 14px 16px; margin-bottom: 8px; border-radius: var(--radius); background: var(--surface);
        border: 1px solid var(--line); text-align: left; }
.pack b { font-size: 18px; }
.pack small { display: block; color: var(--hint); font-size: 12px; margin-top: 2px; }
.pack .price { text-align: right; font-weight: 700; font-size: 16px; white-space: nowrap; }
.pack .price em { display: block; font-style: normal; font-size: 12px; color: var(--accent); margin-top: 2px; }
.pack.pop { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); margin-top: 14px; }
.packtag { position: absolute; top: -10px; left: 14px; font-style: normal; font-size: 11px; font-weight: 700;
           padding: 3px 9px; border-radius: 999px; color: var(--on-accent);
           background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pack:active { transform: scale(0.98); }
.pack[disabled] { opacity: 0.6; }
.panel.paid { border-color: rgba(62, 207, 142, 0.45); }
/* ── Профиль ── */
.who { display: flex; align-items: center; gap: 14px; }
.ava { width: 52px; height: 52px; border-radius: 16px; flex: none; display: grid; place-items: center; font-size: 22px;
       font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--hint); font-size: 12px; }
.linkbox { width: 100%; text-align: left; font: 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
           background: var(--surface-2); border: 1px dashed rgba(255, 90, 44, 0.45); border-radius: 12px; padding: 12px;
           word-break: break-all; margin-bottom: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two .btn.ghost { margin-top: 0; }
.fold summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.fold summary::after { content: '›'; color: var(--hint); transform: rotate(90deg); transition: transform .2s; }
.fold[open] summary::after { transform: rotate(-90deg); }
.fold summary::-webkit-details-marker { display: none; }
.fold p { margin: 10px 0 0; }
textarea { width: 100%; resize: vertical; min-height: 84px; font: inherit; color: var(--text); background: var(--surface-2);
           border: 1px solid var(--line); border-radius: 12px; padding: 12px; outline: none; }
textarea:focus { border-color: rgba(255, 90, 44, 0.6); }
h1.title { font-size: 26px; margin: 8px 2px 10px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
         z-index: 20; background: #2b2322; border: 1px solid var(--line); padding: 10px 16px; border-radius: 14px;
         max-width: calc(100% - 32px); text-align: center; font-weight: 600; }
.full { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
        align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 12px; }
.full p { color: var(--hint); max-width: 320px; margin: 0; }
.full .btn { max-width: 320px; }
