/* X-Ray Facts — новый стиль всего сайта в духе утверждённого прототипа (html.story).
   Почти чёрный фон, стеклянные карточки, бирюзовый/красный акцент, Onest, мягкие размытые переходы. */

html.story {
  --navy: #07080b; --navy-2: #0c0e13; --navy-3: #12151c;
  --line: rgba(255, 255, 255, .07); --line-2: rgba(255, 255, 255, .1);
  --white: #f2f4f7; --text: #c9d0d8; --mute: #9aa3ad;
  --red: #ff3045; --red-soft: rgba(255, 48, 69, .12); --cyan: #7fe3ff; --yellow: #7fe3ff; --mint: #7fe3ff;
  --display: Onest, system-ui, sans-serif; --body: Onest, system-ui, sans-serif; --digit: Onest, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --neon: none;
  --glass: rgba(255, 255, 255, .035); --glass-b: rgba(255, 255, 255, .09);
  color-scheme: dark; background: #07080b;
}
html.story body { font: 400 17px/1.55 Onest, system-ui, sans-serif; color: var(--white); overflow-x: clip; }
/* мягкое свечение, как в прототипе — на всех экранах, кроме главной (там своё) */
html.story body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(55% 50% at 70% 65%, rgba(255, 48, 69, .09), transparent 70%), radial-gradient(45% 40% at 25% 30%, rgba(127, 227, 255, .05), transparent 70%); }
html.story-home body::before { display: none; }
html.story .bgwall, html.story #wm { display: none; }
html.story-home #bar { display: none; }
html.story #bar { background: var(--red); box-shadow: none; height: 2px; }
html.story :focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
html.story .view.s-home { animation: none; }

/* ---------- шапка — как в прототипе ---------- */
html.story .top { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-start; gap: 24px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(5vw, 16px) 14px; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; transition: background .3s; }
html.story .top.solid { background: rgba(7, 8, 11, .62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html.story .top::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 44px; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(rgba(7, 8, 11, .62), rgba(7, 8, 11, 0)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
html.story .top.solid::after { opacity: 1; }
html.story .logo { white-space: nowrap; flex: none; display: flex; align-items: center; gap: 10px; font: 700 17px/1 Onest, sans-serif; text-transform: none; letter-spacing: 0; color: var(--white); text-decoration: none; }
html.story .logo svg { width: 30px; height: 30px; filter: none; }
html.story .s-nav { display: flex; gap: 26px; margin-left: auto; font-size: 15px; }
html.story .s-nav a, html.story .s-login { color: var(--mute); text-decoration: none; font-size: 15px; }
html.story .s-nav a:hover, html.story .s-login:hover { color: var(--white); }
html.story .s-login { margin-left: 4px; white-space: nowrap; }
html.story.tg .s-login, html.story.tg .s-nav { display: none; }
html.story.tg .s-hbtn { margin-left: auto; }
html.story .s-hbtn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 999px; background: var(--red); color: #fff; font: 700 14px Onest, sans-serif; text-decoration: none; white-space: nowrap; transition: transform .2s, box-shadow .2s; }
html.story .s-hbtn:hover { box-shadow: 0 0 0 6px rgba(255, 48, 69, .18), 0 12px 44px rgba(255, 48, 69, .45); transform: translateY(-1px); }
html.story .view { padding-top: 76px; }
html.story .view.s-home { padding-top: 0; }
@media (max-width: 900px) { html.story .s-nav { display: none; } html.story .s-login { margin-left: auto; } html.story .top { gap: 16px; } }
@media (max-width: 420px) { html.story .logo { font-size: 15px; gap: 8px; } html.story .logo svg { width: 26px; height: 26px; } html.story .s-login { font-size: 14px; } html.story .top { gap: 12px; } html.story .s-hbtn { padding: 0 14px; } }
/* нижнее меню приложения — на главной в прототипе его нет */
html.story .tabbar { background: rgba(7, 8, 11, .9); border-top: 1px solid var(--line); }
html.story .tabbar a { color: var(--mute); }
html.story .tabbar a.on { color: var(--white); }
html.story .tabbar a svg { color: var(--white); opacity: .5; filter: none; }
html.story .tabbar a.on svg { color: var(--red); opacity: 1; filter: none; }
html.story-home:not(.tg) .tabbar { display: none; }
html.story-home:not(.tg) { --tab-h: 0px; }

/* ---------- типографика ---------- */
html.story .neon { font-family: Onest, sans-serif; font-weight: 700; text-transform: none; text-shadow: none; letter-spacing: -.03em; line-height: 1.04; color: var(--white); }
html.story .neon-lime { color: var(--cyan); text-shadow: none; }
html.story .sec-h { font-size: clamp(34px, 3.8vw, 56px); }
html.story .sec-p { color: var(--text); font-size: 17px; max-width: 62ch; }
html.story .digits { font-family: Onest, sans-serif; color: var(--white); text-shadow: none; letter-spacing: -.01em; font-weight: 700; }
html.story .sec { padding-top: clamp(64px, 9vw, 140px); }
html.story .after-story { position: relative; z-index: 2; padding-top: 4vh; }
/* мягкий размытый переход из истории в разделы */
html.story .after-story::before { content: ''; position: absolute; left: 0; right: 0; top: -22vh; height: 26vh; pointer-events: none;
  background: linear-gradient(rgba(7, 8, 11, 0), #07080b 85%); }
html.story .after-story { background: linear-gradient(#07080b, #07080b); }

/* ---------- кнопки — пилюли как в прототипе ---------- */
html.story .btn { border-radius: 999px; min-height: 48px; padding: 0 24px; font: 700 15px Onest, sans-serif; text-transform: none; letter-spacing: 0; transition: transform .2s, box-shadow .2s, background .2s; }
html.story .btn-red { background: var(--red); color: #fff; box-shadow: none; }
html.story .btn-red:hover { box-shadow: 0 0 0 6px rgba(255, 48, 69, .18), 0 12px 44px rgba(255, 48, 69, .45); transform: translateY(-1px); }
html.story .btn-cyan, html.story .btn-ghost { background: transparent; color: var(--white); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
html.story .btn-cyan:hover, html.story .btn-ghost:hover { background: rgba(255, 255, 255, .06); }
html.story .btn-sm { min-height: 40px; padding: 0 18px; font-size: 14px; }

/* ---------- стекло ---------- */
html.story .rows, html.story .pipe li, html.story .tier, html.story .result-video, html.story .result-side, html.story .cliff, html.story .callout,
html.story .panel, html.story .me-card, html.story .pager a, html.story .kpis div, html.story .stat, html.story .buy-review, html.story .code, html.story .tbl {
  background: var(--glass); border: 1px solid var(--glass-b); box-shadow: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
html.story .rows, html.story .tier, html.story .result-video, html.story .result-side, html.story .cliff, html.story .panel, html.story .me-card { border-radius: 22px; }
html.story .pipe li, html.story .callout, html.story .pager a, html.story .code { border-radius: 20px; }
html.story .row { border-top-color: var(--line); }
html.story .row:hover { background: rgba(255, 255, 255, .03); }
html.story .row-n, html.story .pipe small { font-family: Onest, sans-serif; color: var(--mute); text-shadow: none; font-size: 15px; font-weight: 500; }
html.story .row-t b { font-weight: 600; }
html.story .row.free { background: linear-gradient(90deg, rgba(255, 48, 69, .1), transparent 70%); }
html.story .row.free .row-n { color: var(--red); text-shadow: none; }
html.story .row.done .row-n, html.story .ico-done { color: var(--cyan); }
html.story .ico-lock { color: var(--mute); filter: none; }
html.story .mod-h h3 { font: 700 15px/1.3 Onest, sans-serif; text-transform: none; letter-spacing: 0; }
html.story .pill { font-weight: 700; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
html.story .pill-free { background: var(--red); box-shadow: none; }
html.story .tag-hot { background: rgba(255, 48, 69, .12) !important; border-color: rgba(255, 48, 69, .45) !important; color: #fff; }
html.story .pipe b { font: 700 18px/1.25 Onest, sans-serif; text-transform: none; }
html.story .pipe li.me { border-color: rgba(255, 48, 69, .45); box-shadow: none; }
html.story .pipe li.me b { text-shadow: none; }
html.story .progress { background: rgba(255, 255, 255, .08); }
html.story .progress i { background: var(--red); box-shadow: none; }

/* ---------- блок покупки и тарифы ---------- */
html.story .buy { background: transparent; border: 0; box-shadow: none; padding-left: 0; padding-right: 0; }
html.story .buy::before, html.story .buy::after { display: none; }
html.story .buy-qh, html.story .buy .neon { font-size: clamp(34px, 3.8vw, 56px) !important; }
html.story .buy > p { color: var(--text); }
html.story .gift-line { background: rgba(255, 48, 69, .1); border: 1px solid rgba(255, 48, 69, .35); color: var(--white); box-shadow: none; border-radius: 999px; }
html.story .tier { background: var(--glass); }
html.story .tier-hot { border: 1px solid transparent; background: linear-gradient(#0d0f14, #0d0f14) padding-box, linear-gradient(140deg, var(--red), rgba(255, 48, 69, .15) 45%, var(--cyan)) border-box; box-shadow: 0 30px 80px -40px rgba(255, 48, 69, .55); }
html.story .tier-on { box-shadow: inset 0 0 0 1px var(--cyan); }
html.story .tier-hot.tier-on { box-shadow: 0 30px 80px -30px rgba(255, 48, 69, .8); }
html.story .tier-name { font: 700 30px/1.05 Onest, sans-serif; text-transform: none; letter-spacing: -.03em; }
html.story .tier-hot .tier-name { text-shadow: none; }
html.story .tier-price b { font: 700 40px/1 Onest, sans-serif; letter-spacing: -.04em; text-shadow: none; }
html.story .tier-check { color: var(--cyan); }
html.story .buy-fine, html.story .buy-fine a { color: var(--mute) !important; }
html.story .pay-step { border-top-color: var(--line-2); }

/* ---------- результат ученицы ---------- */
html.story .result-side { border-color: var(--glass-b); }
html.story .result-q { font-weight: 600; letter-spacing: -.01em; }
html.story .result-video video { border-radius: 16px; }

/* ---------- уроки, шаблоны, профиль ---------- */
html.story .crumbs, html.story .crumbs a { color: var(--mute); }
html.story .lesson-h { font-size: clamp(34px, 4.4vw, 56px); }
html.story .prose { color: var(--text); font-size: 17px; }
html.story .prose h2, html.story .prose h3 { font-family: Onest, sans-serif; text-transform: none; text-shadow: none; color: var(--white); letter-spacing: -.02em; }
html.story .prose h3 { color: var(--cyan); }
html.story .code-bar { background: rgba(255, 255, 255, .03); border-bottom: 1px solid var(--line); color: var(--mute); }
html.story .code pre, html.story .code code { font-family: var(--mono); }
html.story .copy { border-radius: 999px; }
html.story .c-warn { border-color: rgba(255, 48, 69, .4); background: rgba(255, 48, 69, .06); }
html.story .c-key { border-color: rgba(127, 227, 255, .35); }
html.story .c-title { color: var(--white); }
html.story .cliff-price b, html.story .price b { text-shadow: none; font-family: Onest, sans-serif; }
html.story .field input, html.story .code-form input, html.story textarea, html.story select {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--glass-b); border-radius: 14px; color: var(--white); box-shadow: none; font-family: Onest, sans-serif; }
html.story .field input:focus, html.story .code-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(127, 227, 255, .12); }
html.story .tabs { background: rgba(255, 255, 255, .04); border: 1px solid var(--glass-b); border-radius: 999px; }
html.story .tabs button { border-radius: 999px; }
html.story .tabs button.on { background: rgba(255, 255, 255, .1); color: var(--white); box-shadow: none; }
html.story .ava { background: rgba(255, 48, 69, .14); color: var(--white); box-shadow: none; border: 1px solid rgba(255, 48, 69, .4); }
html.story .done-btn.is-done { background: rgba(127, 227, 255, .1); color: var(--white); box-shadow: inset 0 0 0 1px rgba(127, 227, 255, .5); }
html.story .chip-digits, html.story .countdown span { background: var(--glass); border: 1px solid var(--glass-b); box-shadow: none; }
html.story .hud::before, html.story .hud::after { display: none; }
html.story .x-mark { filter: none; }

/* ---------- админка ---------- */
html.story .tbl th { color: var(--mute); font-weight: 600; text-transform: none; letter-spacing: 0; }
html.story .tbl td, html.story .tbl th { border-color: var(--line); }
html.story .kpis b, html.story .stat b { font-family: Onest, sans-serif; color: var(--white); text-shadow: none; }
html.story .acts button { border-radius: 999px; }

/* ---------- подвал ---------- */
html.story .foot { border-top: 1px solid var(--line); color: var(--mute); }
html.story .foot a { color: var(--mute); }

/* ---------- Telegram на телефоне: вместо 3D — статичные кадры глав ---------- */
html.story-lite #story .s-ch { background-repeat: no-repeat; background-position: center top; background-size: 100% auto; }
html.story-lite #story #ch0 { background-image: url(/story/k/ch0.webp); }
html.story-lite #story #ch1 { background-image: url(/story/k/ch1.webp); }
html.story-lite #story #ch2 { background-image: url(/story/k/ch2.webp); }
html.story-lite #story #ch3 { background-image: url(/story/k/ch3.webp); }
html.story-lite #story #ch4 { background-image: url(/story/k/ch4.webp); }
html.story-lite #story #ch5 { background-image: url(/story/k/ch5.webp); }
html.story-lite #story #ch6 { background-image: url(/story/k/ch6.webp); }
html.story-lite #story .s-note { display: none; }
@media (prefers-reduced-motion: reduce) { html.story .btn, html.story .s-hbtn { transition: none; } }
html.story h1, html.story h2, html.story h3, html.story h4 { font-family: Onest, system-ui, sans-serif; text-transform: none; text-shadow: none; }
html.story .neon, html.story .lesson-h, html.story .prose h2 { font-weight: 700; }
html.story h3, html.story h4 { letter-spacing: -.01em; }
html.story select { background-color: #11131a; }
html.story .after-story > .sec:first-child { padding-top: clamp(24px, 4vw, 60px); }
html.story .buy .tier .btn { text-transform: none; letter-spacing: 0; }

/* ---------- разделы ниже истории: цветные плитки-иконки, цифры цветом, пункты (как карточки прототипа) ---------- */
html.story .x-ico { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--a, #7fe3ff) 16%, transparent); color: var(--a, #7fe3ff); border: 1px solid color-mix(in srgb, var(--a, #7fe3ff) 30%, transparent); }
html.story .x-ico svg { width: 20px; height: 20px; }
html.story .x-ico.x-logo { background: none; border: 0; overflow: hidden; border-radius: 23%; }
html.story .x-ico.x-logo img { width: 100%; height: 100%; display: block; border-radius: 23%; }
html.story .x-ico-n { font: 700 14px/1 Onest, sans-serif; font-variant-numeric: tabular-nums; }
html.story .x-hl { color: var(--a, #ff3045); font-weight: 700; }
html.story .result-q .x-hl { color: #5cf0a4; }
html.story .x-facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
html.story .x-facts li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .07); font-size: 15.5px; line-height: 1.4; color: #c3cad2; }
html.story .x-num { display: block; font: 700 19px/1.15 Onest, sans-serif; color: var(--a); letter-spacing: -.01em; margin-bottom: 3px; }
html.story .x-cost { grid-template-columns: 1fr 1fr; gap: 12px; }
html.story .x-cost li { padding: 18px; align-items: flex-start; }
html.story .x-cost .x-ico { flex-basis: 44px; width: 44px; height: 44px; }
@media (max-width: 760px) { html.story .x-cost { grid-template-columns: 1fr; } html.story .x-cost li { padding: 14px; } }
html.story .buy-qs .x-q { display: flex; flex-direction: column; gap: 4px; }
html.story .buy-qs .x-q .x-ico { margin-bottom: 10px; }
html.story .buy-qs .x-q b { color: var(--white); }
html.story .buy-qs .x-q::after { content: ''; position: absolute; left: 22px; right: 22px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--a), transparent); opacity: .9; }
html.story .tier-promise { color: var(--a, var(--white)); }
html.story .tier-check { color: var(--a, var(--cyan)); }
html.story .x-modh { align-items: center; }
html.story .x-kick { display: inline-flex; align-items: center; gap: 9px; padding: 5px 13px 5px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--a) 14%, transparent); border: 1px solid color-mix(in srgb, var(--a) 34%, transparent); color: var(--a) !important;
  font: 600 13px/1 Onest, sans-serif !important; letter-spacing: .06em !important; text-transform: uppercase !important; }
html.story .x-kick i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--a); color: #07080b; font: 700 10.5px/1 Onest, sans-serif; font-style: normal; letter-spacing: 0; }
html.story .x-bul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
html.story .x-bul li { position: relative; padding-left: 18px; }
html.story .x-bul li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--a, var(--red)); }
html.story .faq summary .x-ico { width: 36px; height: 36px; flex-basis: 36px; }

/* ---------- появление разделов (тот же эффект, что у карточек глав) ---------- */
html.js .rvs .rv { opacity: 0; transform: translateY(18px); filter: blur(8px); transition: opacity .6s ease var(--d, 0s), transform .8s cubic-bezier(.2, .8, .2, 1) var(--d, 0s), filter .6s ease var(--d, 0s); }
html.js .rvs .w { display: inline-block; opacity: 0; transform: translateY(.55em) rotate(2deg); filter: blur(10px); transition: opacity .55s ease var(--d, 0s), transform .8s cubic-bezier(.2, .9, .25, 1) var(--d, 0s), filter .55s ease var(--d, 0s); }
html.js .rvs.in .rv, html.js .rvs.in .w { opacity: 1; transform: none; filter: none; }
html.js .rvs .rv .x-ico { transform: scale(.4) rotate(-20deg); opacity: 0; transition: transform .7s cubic-bezier(.3, 1.6, .5, 1) var(--d2, 0s), opacity .4s ease var(--d2, 0s); }
html.js .rvs.in .rv .x-ico { transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { html.js .rvs .rv, html.js .rvs .w, html.js .rvs .rv .x-ico { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; } }

/* Telegram на телефоне: иконки уже в статичных кадрах глав, живой слой не нужен */
html.story-lite #story #brands { display: none; }

/* скрин переписки в блоке ученицы */
html.story .result-shot { margin: 0; display: grid; gap: 8px; }
html.story .result-zoom { display: block; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; overflow: hidden; background: #0d0f14; cursor: zoom-in; max-width: 290px; transition: border-color .2s, transform .2s; }
html.story .result-zoom:hover { border-color: rgba(255, 255, 255, .28); transform: translateY(-2px); }
html.story .result-zoom img { display: block; width: 100%; height: auto; }
html.story .result-shot figcaption { color: var(--mute); font-size: 13px; }
html.story .result-side .btn { margin-top: 6px; }
.x-lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 4vh 4vw; background: rgba(4, 5, 8, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: zoom-out; animation: xlb .25s ease; }
.x-lightbox img { max-width: min(92vw, 720px); max-height: 92vh; width: auto; height: auto; border-radius: 16px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.x-lightbox button { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
@keyframes xlb { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .x-lightbox { animation: none; } }

/* до подмены шапки на новую не показываем старую (без мигания при загрузке) */
html.story .top:not(.s-hdr) > * { visibility: hidden; }
html.story .top:not(.s-hdr) { background: transparent; border: 0; }
@media (max-width: 760px) { html.story .result-zoom { max-width: 300px; } }
html.story .view:not(.s-home) { min-height: calc(100dvh - var(--tab-h, 0px)); }
html.story .btn-ok { background: #1fbf6a; color: #fff; box-shadow: none; }
html.story .btn-ok:hover { box-shadow: 0 0 0 6px rgba(31, 191, 106, .18), 0 12px 44px rgba(31, 191, 106, .45); transform: translateY(-1px); }

/* Большое слово главы: поверх 3D (но под карточками), чтобы читалось целиком */
html.story #story #ghost { z-index: 2; }
html.story #story #ghost span { opacity: .1; }
html.story #story #ghost span.off { opacity: 0; }
@media (max-width: 760px) { html.story #story #ghost span { opacity: .14; } }
