/* Сцены работ. Без скрипта и при отключённых анимациях сцена — обычный блок: текст и кадры списком.
   Режим истории включает скрипт (класс story на html): сцена закрепляется, у каждого вида своя механика. */

.scene { position: relative; padding-block: clamp(36px, 6vw, 80px); scroll-margin-top: 0; }
.scene.dark { background: var(--ink); color: #fff; }
.pin { padding-inline: var(--edge); }
.scene-k { margin: 0 0 6px; color: var(--meta); font-size: 15px; }
.scene h2 { font: 800 clamp(34px, 4.4vw, 62px)/0.95 var(--display); margin: 0; text-wrap: balance; }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px; font-weight: 700; font-size: 16px; margin-top: 12px; }
.beats { display: grid; gap: 14px; margin-top: 18px; max-width: 60ch; }
.beat { margin: 0; }
.beat h3 { font: 500 14px/1.4 var(--text); color: var(--meta); margin: 0; }
.beat p { margin: 2px 0 0; }
.beat-q { padding-left: 16px; border-left: 6px solid var(--mk); }
.beat-q p { font-size: clamp(19px, 1.7vw, 25px); line-height: 1.3; font-weight: 500; margin: 0; }
.beat-q footer { margin-top: 12px; font-size: 14px; color: var(--meta); display: flex; align-items: center; gap: 8px; }
.thumb { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--mk); color: var(--ink); display: grid; place-items: center; }
.scene.dark .scene-k, .scene.dark .beat h3, .scene.dark .beat-q footer { color: var(--soft); }
.scene-foot { display: none; }

.stage { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; align-items: flex-start; }
.zoom { display: block; border: 0; padding: 0; background: none; cursor: zoom-in; line-height: 0; max-width: min(100%, 420px); color: inherit; }
.zoom img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--wash);
  box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.08), 0 2px 6px rgba(14, 26, 58, 0.06), 0 34px 60px -34px rgba(14, 26, 58, 0.5);
}
.scene.dark .zoom img { box-shadow: 0 34px 70px -30px rgba(0, 0, 0, 0.85); }
.thumbs, .dots, .yw, .rl-big, .ticks, .vz, .pl-ui, .stage canvas, .game-wrap, .player canvas { display: none; }
.mon-wrap, .mon, .mon-track, .film-track, .year-track, .lens, .hotbar, .wr, .sheets { display: contents; }
.it { margin: 0; max-width: min(100%, 420px); }
.it figcaption, .sheets p { font: 700 13px/1.2 var(--text); display: inline-block; background: var(--mk); color: var(--ink); padding: 4px 8px; border-radius: 6px; margin: 8px 0 0; }
.rl-cap { margin: 0; font-size: 14px; color: var(--meta); flex: 0 0 100%; }
.rl-row { flex: 0 0 100%; }
.rl-row img { display: block; width: 100%; height: auto; border-radius: 6px; }
.player { max-width: min(100%, 640px); }
.player .poster { display: block; width: 100%; height: auto; border-radius: 12px; }

/* ——— Режим истории: общий каркас ——— */
.story .scene { padding: 0; height: calc(100vh * (1.25 + var(--len) * 0.5)); height: calc(100svh * (1.25 + var(--len) * 0.5)); }
.story .pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 88px var(--pad) 28px;
}
.story .pin-text { display: contents; }
.story .scene-head { order: 1; }
.story .beats { order: 2; margin-top: 12px; max-width: none; gap: 0; }
.story .stage { order: 3; flex: 1; min-height: 0; margin-top: 14px; display: block; position: relative; z-index: 1; flex-wrap: nowrap; align-items: stretch; gap: 0; }
.story .scene-foot { order: 4; display: flex; align-items: center; gap: 14px; margin-top: 12px; position: relative; z-index: 3; }
.story .beat {
  grid-area: 1 / 1;
  opacity: 0;
  translate: 0 14px;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), translate 0.45s var(--ease);
}
.story .beat.on { opacity: 1; translate: none; pointer-events: auto; }
.story .rw { opacity: 0.2; transition: opacity 0.35s; }
.story .rw.lit { opacity: 1; }
.story .zoom, .story .it { max-width: none; }
.scene-count { font: 800 26px/1 var(--display); white-space: nowrap; min-width: 3.2em; }
.scene-bar { flex: 1; max-width: 170px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.scene-bar i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(var(--f, 0)); }
.scene.dark .scene-bar { background: rgba(255, 255, 255, 0.2); }
.scene.dark .scene-bar i { background: var(--mk); }
.skip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid currentColor;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.skip:hover, .skip:focus-visible { background: var(--ink); color: #fff; border-color: var(--ink); }
.scene.dark .skip:hover, .scene.dark .skip:focus-visible { background: var(--mk); color: var(--ink); border-color: var(--mk); }

@media (min-width: 900px) {
  /* Текст сбоку, сцена рядом */
  .story .lay-side .pin, .story .lay-side-r .pin {
    display: grid;
    grid-template-columns: minmax(280px, 28%) minmax(0, 1fr);
    column-gap: clamp(28px, 3.6vw, 60px);
    padding: 96px clamp(20px, 2.6vw, 40px) 36px var(--edge);
  }
  .story .lay-side-r .pin { grid-template-columns: minmax(0, 1fr) minmax(280px, 28%); padding: 96px var(--edge) 36px clamp(20px, 2.6vw, 40px); }
  .story .lay-side .pin-text, .story .lay-side-r .pin-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
  .story .lay-side-r .pin-text { order: 2; }
  .story .lay-side-r .stage { order: 1; }
  .story .lay-side .beats, .story .lay-side-r .beats { margin-top: 24px; }
  .story .lay-side .stage, .story .lay-side-r .stage { margin-top: 0; }
  .story .lay-side .scene-foot, .story .lay-side-r .scene-foot { margin-top: 30px; }

  /* Текст сверху в две колонки, сцена во всю ширину */
  .story .lay-top .pin {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: clamp(32px, 4vw, 64px);
    padding: 92px var(--edge) 22px;
  }
  .story .lay-top .scene-head { grid-area: 1 / 1; }
  .story .lay-top .beats { grid-area: 1 / 2; align-self: end; margin-top: 0; }
  .story .lay-top .stage { grid-area: 2 / 1 / 3 / 3; margin-top: 22px; }
  .story .lay-top .scene-foot { grid-area: 3 / 1 / 4 / 3; margin-top: 16px; }
}

/* ——— stack: кадры ложатся стопкой ——— */
.story .st-stack .zoom {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
.story .st-stack .zoom:first-child { opacity: 1; }
.story .st-stack .zoom.cur { pointer-events: auto; }
.story .st-stack img { max-width: 100%; max-height: 100%; width: auto; height: auto; }

/* ——— screen: экран докладчика, слайды сменяются внутри, снизу лента слайдов ——— */
.story .st-screen { display: flex; flex-direction: column; gap: 14px; }
.story .mon-wrap { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.story .mon {
  display: block;
  width: 100%;
  width: min(100cqw, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
  border: 10px solid #070d1f;
  border-radius: 22px;
  background: #070d1f;
  overflow: hidden;
  box-shadow: 0 44px 80px -44px rgba(14, 26, 58, 0.7);
}
.scene.dark .mon { border-color: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 40px 90px -30px #000; }
.story .mon-track { display: flex; height: 100%; will-change: transform; }
.story .mon-track .zoom { flex: 0 0 100%; height: 100%; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
.story .mon-track img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 0; box-shadow: none; }
.story .thumbs { display: block; overflow: hidden; padding: 6px 0; }
.story .thumbs-in { display: flex; gap: 8px; width: max-content; margin-inline: auto; transition: transform 0.4s var(--ease); }
.th { border: 0; padding: 0; background: none; cursor: pointer; opacity: 0.45; border-radius: 6px; line-height: 0; transition: opacity 0.25s, scale 0.25s, box-shadow 0.25s; }
.th img { display: block; height: clamp(34px, 5.6vh, 58px); width: auto; border-radius: 6px; }
.th:hover { opacity: 0.8; }
.th.on { opacity: 1; scale: 1.1; box-shadow: 0 0 0 3px var(--mk); }

/* ——— spread: стопка разъезжается в раскладку всех слайдов ——— */
.story .st-spread .zoom { position: absolute; left: 0; top: 0; will-change: transform; }
.story .st-spread img { width: 100%; height: auto; transition: scale 0.3s var(--ease); }
@media (hover: hover) { .story .st-spread .zoom:hover img { scale: 1.05; } }

/* ——— film: лента слайдов едет поперёк экрана, слайд в центре крупнее ——— */
.story .st-film, .story .st-wall, .story .st-year, .story .st-ruler { overflow: visible; }
.story .film-track { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: clamp(14px, 2.4vw, 40px); width: max-content; will-change: transform; }
.story .film-track .zoom { flex: none; will-change: transform, opacity; }
.story .film-track img { height: 100%; width: auto; max-width: none; }
.story .dots { display: flex; gap: 8px; position: absolute; left: 50%; bottom: 0; translate: -50% 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background 0.25s, scale 0.25s; }
.dots i.on { background: var(--ink); scale: 1.5; }
.scene.dark .dots i { background: rgba(255, 255, 255, 0.25); }
.scene.dark .dots i.on { background: var(--mk); }

/* ——— desk: материалы урока по одному ложатся на стол, у каждого подпись ——— */
.story .st-desk .it { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.story .st-desk .zoom, .story .st-desk img { width: 100%; }
.story .st-desk .it:not(:first-child) { opacity: 0; }

/* ——— wall: все слайды лекции тремя рядами, ряды едут навстречу друг другу ——— */
.story .st-wall { display: flex; flex-direction: column; gap: clamp(8px, 1.2vh, 14px); }
.story .wr { flex: 1; min-height: 0; display: flex; gap: clamp(8px, 1vw, 14px); width: max-content; align-self: flex-start; will-change: transform; }
.story .wr .zoom { height: 100%; flex: none; }
.story .wr img { height: 100%; width: auto; max-width: none; border-radius: 8px; }

/* ——— year: страницы четырёх книжек едут через год, фон и название сезона меняются ——— */
.story .k-year { transition: background-color 0.8s; }
.story .yw { display: block; position: absolute; inset: 0; pointer-events: none; }
.yw span {
  position: absolute;
  right: 0;
  top: -0.14em;
  font: 800 clamp(96px, 22vw, 320px)/0.8 var(--display);
  opacity: 0;
  translate: 0 36px;
  transition: opacity 0.6s var(--ease), translate 0.6s var(--ease);
}
.yw span.on { opacity: 1; translate: none; }
.story .year-track { position: absolute; left: 0; bottom: 0; display: flex; gap: clamp(12px, 1.6vw, 24px); width: max-content; will-change: transform; }
.story .year-track .zoom { flex: none; }
.story .year-track img { height: 100%; width: auto; max-width: none; border-radius: 10px; background: #fff; }

/* ——— fan: персонажи раскрываются веером, потом каждый по очереди выходит вперёд ——— */
.story .st-fan .zoom { position: absolute; left: 0; top: 0; will-change: transform; }
.story .st-fan img { width: 100%; height: 100%; border-radius: 10px; scale: var(--s, 1); }

/* ——— ruler: развёртка едет во всю длину, считаются щиты и метры, в конце увеличение вектора ——— */
.story .rl-big { display: block; position: absolute; left: 0; top: 0; margin: 0; font: 800 clamp(46px, 7.4vw, 100px)/0.9 var(--display); white-space: nowrap; }
.story .rl-big b { font-weight: 800; }
.story .rl-cap { position: absolute; left: 0; white-space: nowrap; }
.story .rl-cap-a { top: calc(var(--ya) - 26px); }
.story .rl-cap-b { top: calc(var(--yb) - 26px); }
.story .rl-row { position: absolute; left: 0; will-change: transform; }
.story .rl-a { top: var(--ya); height: var(--ha); }
.story .rl-b { top: var(--yb); height: var(--hb); }
.story .rl-row img { height: 100%; width: auto; max-width: none; border-radius: 6px; box-shadow: 0 24px 40px -24px rgba(14, 26, 58, 0.55); }
.story .ticks { display: block; position: absolute; left: 0; right: 0; top: 100%; height: 26px; }
.ticks span { position: absolute; top: 8px; translate: -50% 0; font: 500 13px/1 var(--text); color: var(--meta); white-space: nowrap; }
.ticks span::before { content: ""; position: absolute; left: 50%; top: -7px; width: 1px; height: 6px; background: currentColor; }
.story .vz { display: block; position: absolute; inset: -14px -200vw; background: var(--paper); opacity: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.vz img { position: absolute; left: 50%; top: 50%; translate: -50% -50%; max-width: none; height: auto; border-radius: 6px; }
.vz p { position: absolute; left: calc(200vw); bottom: 14px; margin: 0; font-weight: 500; background: var(--paper); padding: 8px 12px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.vz b { font: 800 30px/1 var(--display); margin-right: 8px; display: inline-block; min-width: 2.2em; }

/* ——— scrub: ролик идёт вместе с прокруткой, в конце выезжает шпаргалка ——— */
.story .st-scrub { display: grid; place-items: center; container-type: size; }
.story .player {
  position: relative;
  max-width: none;
  width: 100%;
  width: min(100cqw, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #0b0d16;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 44px 90px -40px #000;
}
.story .player canvas { display: block; width: 100%; height: 100%; }
.story .player .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: opacity 0.3s; }
.player.live .poster { opacity: 0; }
.story .pl-ui {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  align-items: center;
  gap: 12px;
  padding: 26px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
  font: 700 14px/1 var(--text);
}
.pl-time { white-space: nowrap; min-width: 6.4em; }
.pl-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--mk); transform-origin: 0 50%; transform: scaleX(var(--f, 0)); }
.story .sheets { display: flex; align-items: flex-end; gap: 12px; position: absolute; right: 0; top: 50%; height: 88%; opacity: 0; pointer-events: none; will-change: transform, opacity; }
.story .sheets.on { pointer-events: auto; }
.story .sheets p { position: absolute; left: 0; top: -34px; margin: 0; }
.story .sheets .zoom { height: 100%; }
.story .sheets img { height: 100%; width: auto; max-width: none; }

/* ——— pixel: кадр из игры собирается из крупных пикселей, снизу панель слотов ——— */
.story .st-pixel { display: flex; flex-direction: column; gap: 16px; }
.story .game-wrap { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.story .game {
  width: 100%;
  width: min(100cqw - 12px, (100cqh - 12px) * 16 / 9);
  aspect-ratio: 16 / 9;
  border: 4px solid #000;
  background: #000;
  box-shadow: 10px 10px 0 rgba(14, 26, 58, 0.3);
  cursor: zoom-in;
}
.scene.dark .game { border-color: #fff; box-shadow: 10px 10px 0 rgba(255, 255, 255, 0.2); }
.story .game canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.story .hotbar { display: flex; justify-content: center; gap: 4px; }
.story .hotbar .zoom {
  width: clamp(42px, 6.4vh, 64px);
  aspect-ratio: 1;
  border: 3px solid #8b8b8b;
  background: #3a3a3a;
  padding: 3px;
  opacity: 0.65;
  transition: opacity 0.2s, scale 0.2s, border-color 0.2s;
}
.story .hotbar .zoom.on { border-color: #fff; opacity: 1; scale: 1.14; }
.story .hotbar img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; image-rendering: pixelated; }

/* ——— inspect: лист сравнения рассматривается вблизи, кадр плавно наезжает от «было» к «стало» ——— */
.story .st-inspect { display: grid; place-items: center; container-type: size; }
.story .lens {
  display: block;
  position: relative;
  width: 100%;
  width: min(100cqw, 100cqh * 4 / 3);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: #3b3530;
  box-shadow: 0 44px 80px -44px rgba(14, 26, 58, 0.75);
}
.story .lens .zoom { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.story .lens .zoom:first-child { opacity: 1; }
.story .lens .zoom.cur { pointer-events: auto; }
.story .lens img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; box-shadow: none; background: none; will-change: transform; }

@media (max-width: 760px) {
  .story .pin { padding: 18px var(--pad) 92px; }
  .story .beats { font-size: 16px; line-height: 1.45; }
  .skip { font-size: 14px; padding: 9px 12px; }
  .scene-count { font-size: 24px; }
  .story .mon { border-width: 6px; border-radius: 14px; }
  .story .player { border-radius: 12px; }
  .story .sheets { height: 70%; }
  .vz p { font-size: 14px; }
  .ticks span:nth-child(odd) { display: none; }
  .story .st-desk .it figcaption { position: absolute; left: 4px; bottom: 4px; margin: 0; font-size: 11px; padding: 3px 6px; }
}

@media (max-width: 760px) and (max-height: 620px) {
  .story .scene h2 { font-size: 30px; }
  .story .beats { font-size: 15px; }
  .story .scene-k { display: none; }
}

/* ——— Метка под ценой: на кадрах пример, а не сданная работа ——— */
.demo-tag { margin: 10px 0 0; font-size: 14px; line-height: 1.35; color: var(--meta); max-width: 44ch; }
.scene.dark .demo-tag { color: var(--soft); }

/* Без скрипта живые сцены показываются как есть, столбиком */
.br, .ph, .chat, .sh, .xl { max-width: min(100%, 720px); }
.br-view, .ph-view { max-height: 420px; overflow: hidden; border-radius: 12px; }
.br-view img, .ph-view img { display: block; width: 100%; height: auto; }
.ph { max-width: 240px; }
.br-bar { display: none; }

/* ——— browser: сайт листается внутри окна, рядом версия для телефона ——— */
.story .st-browser { container-type: size; }
.story .br, .story .ph, .story .chat, .story .sh, .story .xl { max-width: none; }
.story .br {
  position: absolute;
  left: 0;
  top: 0;
  width: min(86%, 100cqh * 1.5);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.14), 0 44px 80px -44px rgba(14, 26, 58, 0.7);
}
.story .br-flip { left: auto; right: 0; }
.story .br-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; background: #e9edf3; font-size: 13px; color: #55607a; }
.br-bar i { width: 11px; height: 11px; border-radius: 50%; background: #c3cad6; }
.br-bar span { margin-left: 10px; background: #fff; border-radius: 999px; padding: 4px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story .br-view { flex: 1; min-height: 0; max-height: none; border-radius: 0; }
.story .br-view img, .story .ph-view img { will-change: transform; }
.story .ph {
  position: absolute;
  right: 2%;
  bottom: 0;
  height: 88%;
  aspect-ratio: 9 / 18.6;
  border: 9px solid #0b1228;
  border-radius: 34px;
  background: #0b1228;
  overflow: hidden;
  box-shadow: 0 40px 70px -30px rgba(14, 26, 58, 0.8);
}
.story .ph-flip { right: auto; left: 2%; }
.scene.dark .br, .scene.dark .ph { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 40px 90px -30px #000; }
.scene.dark .ph { border-color: #000; }
.story .ph-view { height: 100%; max-height: none; border-radius: 24px; }

/* ——— chat: переписка с ботом, сообщения приходят по мере прокрутки ——— */
.chat { background: #e7edf5; border-radius: 26px; overflow: hidden; color: #101828; display: flex; flex-direction: column; font-size: 16px; line-height: 1.4; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: #fff; box-shadow: 0 1px 0 #d5dce6; position: relative; z-index: 2; }
.chat-ava { width: 36px; height: 36px; border-radius: 50%; background: var(--mk); }
.chat-top small { color: var(--meta); }
.chat-view { padding: 14px; overflow: hidden; }
.chat-list { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.m { max-width: 84%; background: #fff; border-radius: 16px 16px 16px 5px; padding: 10px 14px; box-shadow: 0 1px 1px rgba(14, 26, 58, 0.08); }
.m.me { align-self: flex-end; background: #cfe6ff; border-radius: 16px 16px 5px 16px; }
.kb { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kb span { border: 1.5px solid #2f6fed; color: #2f6fed; border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 14px; }
.m-photo { padding: 6px; }
.m-photo svg { display: block; width: 210px; border-radius: 10px; }
.m-photo span { display: block; padding: 6px 8px 2px; }
.m-card div, .m-chart div { display: flex; justify-content: space-between; gap: 18px; padding: 4px 0; }
.m-card b, .m-chart b { display: block; margin-bottom: 4px; }
.m-card .sum { border-top: 1.5px solid #d5dce6; margin-top: 4px; padding-top: 8px; font-weight: 700; }
.m-card small { display: block; color: var(--meta); margin-top: 4px; font-size: 13px; }
.m-chart { min-width: 250px; }
.m-chart div { align-items: center; justify-content: flex-start; gap: 10px; }
.m-chart span { width: 76px; flex: none; }
.m-chart i { height: 12px; border-radius: 6px; background: #2f6fed; flex: 0 1 auto; }
.m-chart em { font-style: normal; font-weight: 700; }
.story .st-chat { display: grid; place-items: center; }
.story .chat { width: min(100%, 440px); height: 100%; box-shadow: 0 44px 80px -44px rgba(14, 26, 58, 0.7); }
.story .chat-view { flex: 1; min-height: 0; }
.story .chat-list { transition: transform 0.5s var(--ease); }
.story .m { opacity: 0; transform: translateY(14px) scale(0.96); transform-origin: 0 100%; transition: opacity 0.35s, transform 0.45s var(--ease); }
.story .m.me { transform-origin: 100% 100%; }
.story .m.on { opacity: 1; transform: none; }
.story .m-chart i { transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.9s var(--ease) 0.25s; }
.story .m-chart.on i { transform: none; }

/* ——— sheet: таблица заполняется строка за строкой, в конце проходит проверка ——— */
.sh { background: #fff; border-radius: 14px; overflow: hidden; color: #101828; box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.14); display: flex; flex-direction: column; }
.sh-bar { display: flex; justify-content: space-between; gap: 14px; padding: 10px 16px; background: #1f7a4d; color: #fff; font-size: 14px; }
.sh-view { overflow: hidden; }
.sh-t { border-collapse: collapse; width: 100%; font-size: 15px; }
.sh-t th { position: relative; z-index: 2; text-align: left; background: #eef2f6; padding: 9px 12px; font-weight: 700; font-size: 13px; border-bottom: 1px solid #d5dce6; white-space: nowrap; }
.sh-t td { padding: 9px 12px; border-bottom: 1px solid #e6ebf2; white-space: nowrap; }
.sh-t td:first-child { font-weight: 700; }
.ok { display: inline-block; background: #d9f5e5; color: #17633d; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.story .st-sheet { display: grid; place-items: center; }
.story .sh { width: 100%; height: 100%; box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.14), 0 44px 80px -44px rgba(14, 26, 58, 0.6); }
.story .sh-view { flex: 1; min-height: 0; }
.story .sh-t { transition: transform 0.5s var(--ease); }
.story .sh-t tbody tr { opacity: 0; transform: translateX(-18px); transition: opacity 0.35s, transform 0.45s var(--ease); }
.story .sh-t tbody tr.on { opacity: 1; transform: none; }
.story .sh-t .ok { opacity: 0; scale: 0.6; transition: opacity 0.3s, scale 0.4s var(--ease); }
.story .sh-t.checked .ok { opacity: 1; scale: 1; }

/* ——— calc: «Поиск решения» подбирает план, загрузка и прибыль пересчитываются ——— */
.xl { background: #fff; border-radius: 14px; overflow: hidden; color: #101828; box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.14); font-size: 16px; }
.xl-fx { display: flex; gap: 14px; padding: 9px 14px; background: #eef2f6; border-bottom: 1px solid #d5dce6; font-size: 14px; }
.xl-fx b { min-width: 3em; }
.xl table { border-collapse: collapse; width: 100%; }
.xl th { background: #eef2f6; color: #5e6a82; font-weight: 500; font-size: 13px; padding: 6px 8px; border: 1px solid #d5dce6; }
.xl td { padding: 9px 12px; border: 1px solid #e6ebf2; white-space: nowrap; }
.xl td:first-of-type { font-weight: 700; }
.xl-var { background: #fff7d6; font-weight: 700; }
.xl-sum { background: #d9f5e5; font: 800 30px/1 var(--display); }
.xl-note { color: #5e6a82; font-size: 13px; }
.xl-bar { min-width: 120px; }
.xl-bar i { display: block; height: 12px; border-radius: 6px; background: #2f6fed; width: 0; transition: width 0.25s, background 0.25s; }
.xl-bar i.full { background: #e8623f; }
.xl-st { margin: 0; padding: 12px 14px; font-weight: 700; background: #101828; color: #fff; }
.xl-st.done { background: #1f7a4d; }
.story .st-calc { display: grid; place-items: center; }
.story .xl { width: min(100%, 720px); box-shadow: 0 0 0 1px rgba(14, 26, 58, 0.14), 0 44px 80px -44px rgba(14, 26, 58, 0.6); }

/* ——— карточки компаний в рядах стены ——— */
.dc { flex: none; width: clamp(190px, 17vw, 250px); background: #fff; color: #101828; border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.35; display: flex; flex-direction: column; gap: 3px; }
.dc b { font-size: 18px; }
.dc em { font-style: normal; color: #5e6a82; }
.dc-city { align-self: flex-start; background: var(--mk); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.dc ul { list-style: none; margin: auto 0 0; padding: 6px 0 0; }
.dc li { padding-left: 18px; position: relative; }
.dc li::before { content: ""; position: absolute; left: 0; top: 0.4em; width: 9px; height: 5px; border-left: 2px solid #1f7a4d; border-bottom: 2px solid #1f7a4d; rotate: -45deg; }

@media (max-width: 760px) {
  .story .br { width: 100%; height: 60%; }
  .story .ph { height: 74%; right: 0; border-width: 6px; border-radius: 26px; }
  .story .ph-flip { left: 0; }
  .chat { font-size: 15px; }
  .sh-t, .xl { font-size: 13px; }
  .sh-t th:nth-child(2), .sh-t td:nth-child(2), .sh-t th:nth-child(4), .sh-t td:nth-child(4) { display: none; }
  .xl td { padding: 7px 8px; }
  .xl-note { display: none; }
  .xl-bar { min-width: 64px; }
  .dc { width: 170px; font-size: 13px; }
}

/* Подвал сцены переносится, если счётчик длинный; карточки в рядах не вылезают из ряда */
.story .scene-foot { flex-wrap: wrap; row-gap: 10px; }
.story .wr .dc { height: 100%; overflow: hidden; }
@media (max-width: 760px) {
  .story .beat-q p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; font-size: 17px; }
  .story .wr .dc { padding: 8px 12px; gap: 1px; }
  .story .wr .dc ul, .story .wr .dc em { display: none; }
  .story .wr .dc b { font-size: 15px; }
  .story .xl { max-height: 100%; }
  .xl tr:nth-child(5), .xl tr:nth-child(10) { display: none; }
  .xl td { padding: 5px 8px; }
  .xl-fx { padding: 6px 10px; font-size: 12px; }
  .xl-sum { font-size: 24px; }
  .xl-st { padding: 8px 10px; }
}
@media (max-width: 760px) {
  .story .xl-fx, .story .xl tr:first-child { display: none; }
  .story .xl td { padding: 4px 8px; }
  .story .xl-st { padding: 6px 10px; font-size: 13px; }
  .story .k-calc .beat-q p { -webkit-line-clamp: 4; }
}

/* ——— Телефон: сцене больше места (30.11) ———
   Замер на iPhone 13 (390×664) и iPhone SE (375×553): шапка работы, текст о заказе и кнопка заказа
   оставляли самой сцене 22–38 % и 14–30 % экрана. Ужимаем их; подпись «Что просили» встаёт в строку с текстом. */
@media (max-width: 760px) {
  .story .pin { padding: 12px var(--pad) 66px; }
  .story .scene-k { font-size: 12px; margin: 0 0 2px; }
  .story .scene h2 { font-size: 26px; line-height: 1; }
  .story .work-tags { font-size: 13px; gap: 6px; margin-top: 6px; }
  .story .demo-tag { font-size: 12px; line-height: 1.3; margin-top: 4px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .story .beats { margin-top: 6px; font-size: 14px; line-height: 1.38; }
  .story .beat:not(.beat-q) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
  .story .beat:not(.beat-q) h3, .story .beat:not(.beat-q) p { display: inline; margin: 0; }
  .story .beat:not(.beat-q) h3 { font-size: 12px; }
  .story .beat:not(.beat-q) h3::after { content: " · "; }
  .story .beat-q { padding-left: 12px; border-left-width: 4px; }
  .story .beat-q p { font-size: 15px; line-height: 1.32; -webkit-line-clamp: 4; }
  .story .beat-q footer { margin-top: 4px; font-size: 12px; gap: 6px; }
  .story .beat-q footer .thumb { width: 20px; height: 20px; }
  .story .stage { margin-top: 8px; }
  .story .scene-foot { margin-top: 6px; row-gap: 6px; }
  .story .scene-count { font-size: 20px; }
  .story .skip { font-size: 13px; padding: 7px 11px; }
  .buybar { padding: 6px var(--pad) calc(6px + env(safe-area-inset-bottom)); }
  .buybar .btn { padding-block: 11px; }
}
@media (max-width: 760px) and (max-height: 620px) {
  .story .scene h2 { font-size: 23px; }
  .story .beat:not(.beat-q) { -webkit-line-clamp: 3; }
  .story .beat-q p { -webkit-line-clamp: 3; }
}

/* Линейка, увеличение в конце (30.11): подпись «Это вектор…» не шире сцены (на телефоне уходила за край экрана),
   на телефоне подложка увеличения не залезает на строку с автором отзыва над сценой */
.story .vz p { max-width: calc(100% - 400vw); }
@media (max-width: 760px) {
  .story .vz { top: 0; }
  .vz b { font-size: 26px; }
}

/* ——— Горизонтальный телефон: текст колонкой слева, сцена справа во всю высоту (30.11) ———
   На 750×342 (iPhone 13 лёжа) и 863×360 (Pixel 7 лёжа) шапка работы, текст и кнопка заказа стояли столбиком
   и оставляли самой сцене 20–80 px. Теперь текст — узкая колонка слева, сцена — вся правая часть экрана,
   кнопка заказа плавает внизу под колонкой текста. Доля колонки --tc общая для сетки и кнопки .buybar ниже. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  :root { --tc: 0.37; }
  .story .scene .pin {
    display: grid;
    grid-template-columns: minmax(0, calc(var(--tc) * 100%)) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    column-gap: 20px;
    padding: 10px var(--pad);
  }
  /* текст по центру колонки, а если не влез — от верха (поля auto вместо justify-content: center, иначе срезается заголовок) */
  .story .scene .pin-text { grid-area: 1 / 1; display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; min-height: 0; padding-bottom: 50px; }
  .story .scene .pin-text > :first-child { margin-top: auto; }
  .story .scene .pin-text > :last-child { margin-bottom: auto; }
  /* ленты, ряды стены и дорожки линейки едут шире сцены: слева их обрезает край сцены, а не колонка текста */
  .story .scene .stage { grid-area: 1 / 2; margin: 0; min-height: 0; clip-path: inset(-100vh -100vw -100vh 0); }
  .story .scene .beats { align-self: stretch; margin-top: 6px; max-width: none; font-size: 13px; line-height: 1.36; }
  .story .scene .scene-foot { margin-top: 8px; row-gap: 6px; }
  .story .scene-k, .story .demo-tag { display: none; }
  .story .scene h2 { font-size: 21px; line-height: 1.02; }
  .story .work-tags { font-size: 12px; gap: 6px; margin-top: 5px; }
  .story .beat:not(.beat-q) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
  .story .beat:not(.beat-q) h3, .story .beat:not(.beat-q) p { display: inline; margin: 0; }
  .story .beat:not(.beat-q) h3 { font-size: 12px; }
  .story .beat:not(.beat-q) h3::after { content: " · "; }
  .story .beat-q { padding-left: 10px; border-left-width: 4px; }
  .story .beat-q p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; font-size: 14px; line-height: 1.32; }
  .story .beat-q footer { margin-top: 4px; font-size: 12px; gap: 6px; }
  .story .beat-q footer .thumb { width: 20px; height: 20px; }
  .story .scene-count { font-size: 18px; min-width: 0; }
  .story .skip { font-size: 12px; padding: 6px 10px; }
  /* Кнопка заказа: на обычных блоках — белая полоса внизу, кнопка слева шириной с колонку текста сцены;
     пока сцена закреплена (класс float ставит site.js) — полосы нет, кнопка стоит под колонкой текста */
  .buybar {
    display: block;
    position: fixed;
    inset: auto 0 0 0;
    padding: 6px var(--pad) calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--line);
    z-index: 5;
  }
  .buybar .btn { display: flex; width: calc((100vw - 2 * var(--pad)) * var(--tc)); min-width: max-content; padding: 10px 16px; }
  .buybar.float { background: none; border-top-color: transparent; pointer-events: none; }
  .buybar.float .btn { pointer-events: auto; box-shadow: 0 10px 24px -10px rgba(14, 26, 58, 0.6); }
  .buybar.float.dark .btn { background: var(--mk); color: var(--ink); box-shadow: 0 10px 24px -10px #000; }
  .buybar.float.dark .btn::before { background: #fff; }
  /* Окно сайта (browser): сцена почти квадратная, и телефон слева закрывал начало заголовков сайта
     («…ВЫЙ КАДР …ПЛАТНО» на Pixel 7 лёжа). Здесь окно всегда слева на всю высоту, телефон справа
     и заходит на окно меньше чем на половину своей ширины (телефон 86 % высоты × 9/18,6, на окно 45 % его ширины) */
  .story .br, .story .br-flip { left: 0; right: auto; width: calc(100% - 23cqh); height: 100%; }
  .story .ph, .story .ph-flip { left: auto; right: 0; bottom: 0; height: 86%; border-width: 6px; border-radius: 26px; }
}
/* совсем короткий или узкий телефон лёжа (iPhone SE: 568×320): колонка текста шире, текст плотнее */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 640px) {
  :root { --tc: 0.41; }
}
@media (orientation: landscape) and (max-height: 340px) and (max-width: 1000px) {
  .story .scene h2 { font-size: 19px; }
  .story .beat:not(.beat-q) { -webkit-line-clamp: 5; }
  .story .beat-q p { -webkit-line-clamp: 4; font-size: 13px; }
}
