/* Тёмная медиа-витрина: чёрный фон, лаймовый акцент, крупные заголовки, карточки с видео на всю площадь.
   Тема фиксированная, не зависит от темы Telegram. */
:root {
  --bg: #09090b;
  --surface: #141417;
  --surface-2: #1d1d22;
  --line: rgba(255, 255, 255, 0.09);
  --fg: #f4f4f2;
  --muted: #8e8e98;
  --accent: #d4ff3a;
  --accent-ink: #0b0b0c;
  --accent-glow: rgba(212, 255, 58, 0.35);
  --danger: #ff6b6b;
  --ok: #5fe08f;
  --radius: 18px;
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Onest", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 15px/1.45 var(--font-body); min-height: 100vh; }
[hidden] { display: none !important; }
small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
button { font-family: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  max-width: 560px; margin: 0 auto; display: grid; gap: 18px;
  padding-inline: 16px;
  padding-block: calc(var(--safe-top) + 10px) calc(var(--safe-bottom) + 104px);
}

/* ---------- шапка ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font: 700 15px/1 var(--font-display); letter-spacing: .02em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.top-right { display: flex; gap: 6px; align-items: center; }
.balance { display: inline-flex; align-items: center; gap: 7px; font: 700 14px/1 var(--font-display); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px 8px 9px; cursor: pointer; font-variant-numeric: tabular-nums; }
.balance i { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f3ff9a, var(--accent) 55%, #8fb300); box-shadow: 0 0 10px var(--accent-glow); }
.balance::after { content: "+"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 13px/1 var(--font-body); margin-left: 2px; }
.lang { font: 700 12px/1 var(--font-body); letter-spacing: .04em; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 11px; cursor: pointer; }
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button { flex: 1; font: 600 13px/1 var(--font-body); color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }

.view { display: grid; gap: 18px; }
.screen { display: grid; gap: 14px; }
h1 { font: 700 25px/1.12 var(--font-display); text-transform: uppercase; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.lead { color: var(--muted); margin: -6px 0 4px; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 0; }
.steps li { font-size: 10px !important; letter-spacing: .03em !important; }
.steps li { font: 600 11px/1 var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: grid; gap: 8px; }
.steps li::before { content: ""; height: 3px; border-radius: 3px; background: var(--surface-2); }
.steps li.active, .steps li.past { color: var(--fg); }
.steps li.active::before, .steps li.past::before { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

/* ---------- карточки с видео ---------- */
.cards { display: grid; gap: 12px; }
.cards.themes { grid-template-columns: 1fr 1fr; }
.cards.styles { grid-template-columns: 1fr; }
.cards.styles .card { aspect-ratio: 16 / 8; }
.cards.styles .card video, .cards.styles .card img { object-position: center 30%; }
.cards.styles .card .label { right: 52px; }
.cards.styles .card .label b { font-size: 16px; }
.cards.styles .card .label span { font-size: 13px; }
.card { all: unset; cursor: pointer; position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface); isolation: isolate; transition: transform .15s ease; }
.card:active { transform: scale(.98); }
.card video, .card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.82) 100%); z-index: 1; }
.card .label { position: absolute; left: 12px; right: 12px; bottom: 11px; z-index: 2; display: grid; gap: 3px; }
.card .label b { font: 700 14px/1.15 var(--font-display); text-transform: uppercase; }
.card .label span { font-size: 12px; line-height: 1.3; color: rgba(255,255,255,.72); }
.card .check { position: absolute; top: 10px; right: 10px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.45); border: 1.5px solid rgba(255,255,255,.6); backdrop-filter: blur(6px); }
.card[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--accent), 0 0 24px var(--accent-glow); }
.card[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); }
.card[aria-checked="true"] .check::after { content: ""; position: absolute; left: 8.5px; top: 4.5px; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.card:focus-visible { box-shadow: 0 0 0 2.5px var(--fg); }

/* ---------- шаг с ребёнком ---------- */
.photo { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: var(--radius); background: var(--surface); border: 1.5px dashed rgba(212, 255, 58, .45); overflow: hidden; cursor: pointer; text-align: center; }
.photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.has-photo { border: 0; box-shadow: 0 0 0 2.5px var(--accent); }
.photo-hint { display: grid; gap: 10px; justify-items: center; padding: 16px; font-weight: 600; }
.photo-hint .plus { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); position: relative; box-shadow: 0 0 22px var(--accent-glow); }
.photo-hint .plus::before, .photo-hint .plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 3px; border-radius: 2px; background: var(--accent-ink); transform: translate(-50%, -50%); }
.photo-hint .plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.photo .change { position: absolute; right: 10px; bottom: 10px; z-index: 1; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }

.field { display: grid; gap: 8px; }
.field > span { font: 600 11px/1 var(--font-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.field input, .field textarea { font: 16px/1.4 var(--font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; width: 100%; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #5d5d66; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,255,58,.15); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.segmented button { font: 600 15px/1 var(--font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px; cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- проверка ---------- */
.preview { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.8) 100%); }
.preview .caption { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; display: grid; gap: 2px; }
.preview .caption b { font: 700 17px/1.15 var(--font-display); text-transform: uppercase; }
.preview .caption span { color: rgba(255,255,255,.75); font-size: 13px; }
.preview .tag { z-index: 1; }
.preview .tag { position: absolute; left: 12px; top: 12px; font: 700 11px/1 var(--font-display); text-transform: uppercase; padding: 7px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.error { color: var(--danger); margin: 0; font-weight: 500; }

/* ---------- ожидание оплаты ---------- */
.pay { text-align: center; justify-items: center; padding-top: 32px; }
.kaspi-badge { width: 84px; height: 84px; border-radius: 24px; background: #f14635; color: #fff; display: grid; place-items: center; font: 700 17px/1 var(--font-display); box-shadow: 0 0 40px rgba(241, 70, 53, .35); }
.pay .note b { color: var(--fg); white-space: nowrap; }
.pay-status { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.pay-status .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.pay-status.failed { color: var(--danger); }
.pay-status.failed .spinner { display: none; }

/* ---------- готово ---------- */
.ghost-btn { font: 600 15px/1 var(--font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 14px 22px; cursor: pointer; }

/* ---------- история ---------- */
.orders { display: grid; gap: 16px; }
.order { display: grid; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.order .media { position: relative; aspect-ratio: 16 / 9; background: #000; }
.order .media video, .order .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.order .media .pending { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; font-weight: 600; padding: 16px; background: rgba(0,0,0,.55); }
.order .media .spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.order .body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.order .head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.order .head b { font: 700 14px/1.25 var(--font-display); text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; }
.order .meta { color: var(--muted); font-size: 13px; }
.order .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.order .actions button { font: 600 13.5px/1 var(--font-body); color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; cursor: pointer; }
.order .actions button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.order .actions button:disabled { opacity: .55; cursor: default; }
.pill { flex: none; font: 700 10.5px/1 var(--font-body); text-transform: uppercase; letter-spacing: .06em; padding: 6px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.done { color: var(--accent-ink); background: var(--accent); }
.pill.work { color: var(--fg); background: rgba(255,255,255,.12); }
.pill.failed { color: var(--danger); background: rgba(255,107,107,.14); }
.empty { text-align: center; padding-top: 40px; display: grid; gap: 12px; justify-items: center; }

/* ---------- длина и пример ---------- */
.sample { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sample video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.sample .tag { position: absolute; left: 12px; top: 12px; z-index: 1; font: 700 11px/1 var(--font-display); text-transform: uppercase; padding: 7px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.sample.empty { display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.lengths { display: grid; gap: 10px; }
.length { all: unset; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.length b { font: 700 15px/1.2 var(--font-display); text-transform: uppercase; }
.length span { color: var(--muted); font-size: 13px; grid-column: 1; }
.length .price { grid-row: 1 / span 2; grid-column: 2; font: 700 16px/1 var(--font-display); color: var(--accent); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.length .price i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.length[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 0 20px var(--accent-glow); }
.length:focus-visible { outline: 2px solid var(--accent); }
.note.warn { color: var(--danger); }

/* ---------- персонаж ---------- */
.drawing { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; border-radius: var(--radius); background: var(--surface); border: 1px dashed rgba(212,255,58,.35); text-align: center; }
.drawing small { color: var(--muted); }
.brush-anim { position: relative; width: 120px; height: 60px; }
.brush-anim i { position: absolute; bottom: 10px; height: 8px; border-radius: 8px; background: var(--accent); transform-origin: left center; animation: stroke 1.6s ease-in-out infinite; }
.brush-anim i:nth-child(1) { left: 6px; width: 70px; bottom: 40px; }
.brush-anim i:nth-child(2) { left: 18px; width: 90px; bottom: 25px; animation-delay: .25s; background: #9ee7ff; }
.brush-anim i:nth-child(3) { left: 4px; width: 60px; bottom: 10px; animation-delay: .5s; background: #ffb4d9; }
@keyframes stroke { 0% { transform: scaleX(0); opacity: 0; } 40% { transform: scaleX(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.variants { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.variant { all: unset; cursor: pointer; position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.variant img { width: 100%; height: 100%; object-fit: cover; display: block; }
.variant .check { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.45); border: 1.5px solid rgba(255,255,255,.6); }
.variant[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--accent), 0 0 24px var(--accent-glow); }
.variant[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); }
.variant[aria-checked="true"] .check::after { content: ""; position: absolute; left: 8.5px; top: 4.5px; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.variant.old { opacity: .55; }
.variants .ghost-btn { grid-column: 1 / -1; }
.variants-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; grid-column: 1 / -1; margin-top: 4px; }

/* ---------- прогресс ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.eta { text-align: right; white-space: nowrap; }
.eta b { display: block; font: 700 22px/1 var(--font-display); color: var(--accent); font-variant-numeric: tabular-nums; }
.eta small { color: var(--muted); font-size: 12px; }
.progress-bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #9bd400, var(--accent)); border-radius: 8px; transition: width .6s ease; box-shadow: 0 0 12px var(--accent-glow); }
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.roadmap li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 10px 0; position: relative; }
.roadmap li:not(:last-child)::after { content: ""; position: absolute; left: 21px; top: 50px; bottom: -6px; width: 2px; background: var(--surface-2); }
.roadmap li.done:not(:last-child)::after { background: var(--accent); }
.roadmap .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); position: relative; z-index: 1; }
.roadmap .t b { display: block; font-weight: 600; }
.roadmap .t small { color: var(--muted); font-size: 12.5px; }
.roadmap li.pending { opacity: .45; }
.roadmap li.done .ic { background: var(--accent); border-color: var(--accent); }
.roadmap li.done .ic::after { content: ""; width: 7px; height: 13px; border: solid var(--accent-ink); border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.roadmap li.active .ic { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(212,255,58,.12), 0 0 22px var(--accent-glow); }
.roadmap li.active .t b { color: var(--accent); }
/* мини-анимации текущего этапа */
.anim { width: 22px; height: 22px; position: relative; }
.anim.paint::before { content: ""; position: absolute; inset: 3px; border-radius: 4px; background: conic-gradient(var(--accent), #9ee7ff, #ffb4d9, var(--accent)); animation: spin 2.4s linear infinite; }
.anim.film { border: 2px solid var(--accent); border-radius: 4px; overflow: hidden; }
.anim.film::before { content: ""; position: absolute; left: -100%; top: 0; bottom: 0; width: 60%; background: rgba(212,255,58,.6); animation: slide 1.1s linear infinite; }
.anim.music { display: flex; align-items: end; gap: 2px; }
.anim.music::before, .anim.music::after, .anim.music span { content: ""; width: 5px; background: var(--accent); border-radius: 2px; animation: eq .8s ease-in-out infinite alternate; }
.anim.music::after { animation-delay: .3s; }
.anim.music span { animation-delay: .15s; }
.anim.dots::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes slide { to { left: 120%; } }
@keyframes eq { from { height: 4px; } to { height: 20px; } }
.result { display: grid; gap: 12px; }
.result video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- пакеты токенов ---------- */
.packs { display: grid; gap: 10px; }
.pack { all: unset; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); position: relative; }
.pack .coin { grid-column: 1; width: 40px; height: 40px; border-radius: 50%; grid-row: 1 / span 2; background: radial-gradient(circle at 35% 35%, #f3ff9a, var(--accent) 55%, #8fb300); box-shadow: 0 0 16px var(--accent-glow); }
.pack b { font: 700 18px/1 var(--font-display); }
.pack span { color: var(--muted); font-size: 12.5px; grid-column: 2; }
.pack .amount { grid-column: 3; grid-row: 1 / span 2; color: var(--fg); font: 700 16px/1 var(--font-display); white-space: nowrap; }
.pack .badge { grid-column: auto; position: absolute; top: -9px; right: 14px; font: 700 10px/1 var(--font-body); text-transform: uppercase; letter-spacing: .05em; padding: 5px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.pack[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 0 20px var(--accent-glow); }

/* кнопка действия вне Telegram */
.fallback-btn { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-bottom) + 16px); max-width: 528px; margin: 0 auto; font: 700 15px/1 var(--font-display); text-transform: uppercase; padding: 18px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: 0 8px 30px var(--accent-glow); }
.fallback-btn:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: default; }

@media (max-width: 360px) {
  h1 { font-size: 22px; }
  .card .label b { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .order .media .spinner { animation: none; }
}
