/* Демо платформы Lessona: пять сцен о том, как ей пользуются. Не снимок
   интерфейса, а показ: экраны упрощены и увеличены, чтобы читались даже
   в маленьком превью карточки. Цвета и шрифты – из айдентики Lessona. */

:root {
  --ink: #171A21;
  --ink-2: #3A3F4A;
  --muted: #7C7A72;
  --paper: #FBFAF7;
  --surface: #FFFFFF;
  --surface-2: #F1EFEA;
  --line: #E6E4DE;
  --ochre: #E8A317;
  --ochre-soft: #FBEBC4;
  --ok: #2E7D4F;
  --ok-bg: #E7F2EB;
  --err: #C33A2B;
  --sh-1: 0 1px 2px rgba(23, 26, 33, 0.05);
  --sh-2: 0 1px 2px rgba(23, 26, 33, 0.05), 0 18px 40px -20px rgba(23, 26, 33, 0.25);
  --head: 'Onest', system-ui, sans-serif;
  --text: 'Manrope', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stage-w: 1280;
  --stage-h: 800;
  --s-max: 1;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; overflow: hidden; background: var(--paper); }
body { display: flex; flex-direction: column; font-family: var(--text); color: var(--ink); }

/* Полоска возврата: видна, только когда демо открыто отдельной страницей */
.backbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 20px;
  background: var(--ink);
  color: var(--paper);
  font: 600 13.5px/1 var(--head);
  text-decoration: none;
}

.backbar[hidden] { display: none; }
.backbar:hover { background: #22262f; }
.backbar__tag { color: var(--ochre); font-weight: 500; }

.frame { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }

/* Сцена уменьшается целиком: под неё отводится ровно её место */
.stage-wrap { position: relative; flex: 0 0 auto; width: calc(var(--stage-w) * var(--s, 1) * 1px); height: calc(var(--stage-h) * var(--s, 1) * 1px); }

.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--stage-w) * 1px);
  height: calc(var(--stage-h) * 1px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  transform: scale(var(--s, 1));
  transform-origin: 0 0;
}

/* ---------- Шапка ---------- */

.head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px 0;
}

.brand { display: flex; align-items: center; gap: 12px; font: 700 34px/1 var(--head); letter-spacing: -0.01em; }
.brand svg { width: 42px; height: 42px; }

/* ---------- Сцены ---------- */

.screen { position: relative; flex: 1 1 auto; min-height: 0; }

.scene {
  position: absolute;
  inset: 0;
  padding: 24px 40px 8px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}

.scene.is-on { opacity: 1; visibility: visible; }

/* Общие появления: у каждого куска своя задержка, задаётся в сцене */
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes flow { from { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { left: 100%; opacity: 0; } }
@keyframes flowDown { from { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { top: 100%; opacity: 0; } }
@keyframes grow { from { width: 0; } to { width: var(--w, 100%); } }

/* ---------- 1. Урок из учебника ---------- */

.scene--build { display: grid; grid-template-columns: 300px 1fr; gap: 34px; align-content: start; }

.page-card {
  position: relative;
  align-self: start;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-2);
  transform: rotate(-2deg);
}

.is-on .page-card { animation: pop 0.6s var(--ease) both; }
.page-card img { display: block; width: 100%; height: 250px; object-fit: cover; object-position: top; }
.page-card__tag {
  display: block;
  padding: 12px 16px;
  font: 600 19px/1 var(--text);
  color: var(--muted);
}

.ask {
  grid-column: 1;
  border-radius: 18px;
  background: var(--ochre-soft);
  padding: 20px 22px;
}

.is-on .ask { animation: rise 0.6s var(--ease) 0.25s both; }
.ask__label { display: block; font: 700 16px/1 var(--text); letter-spacing: 0.08em; text-transform: uppercase; color: #8a6a12; }
.ask__text { margin: 10px 0 0; font: 500 22px/1.4 var(--text); color: var(--ink); min-height: 2.9em; }
.ask__text::after { content: '▌'; color: var(--ochre); animation: fade 0.9s steps(2, end) infinite; }
.ask__text.is-done::after { content: none; }

.built {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  padding: 22px 26px 24px;
}

.is-on .built { animation: rise 0.6s var(--ease) 0.1s both; }

.built__head {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 700 25px/1 var(--head);
  color: var(--ink);
  padding-bottom: 16px;
}

.spark { color: var(--ochre); font-size: 26px; }

.blk {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  padding: 15px 20px;
  margin-bottom: 10px;
  opacity: 0;
}

.blk__n { font: 600 20px/1 var(--text); color: var(--muted); font-variant-numeric: tabular-nums; }
.blk__t { font: 600 24px/1.2 var(--head); }
.blk--skip { background: transparent; border: 2px dashed var(--line); }
.blk--skip .blk__t { color: var(--muted); font-weight: 500; }

.mark {
  margin-left: auto;
  border-radius: 999px;
  background: var(--ochre-soft);
  color: #7A5406;
  font: 700 17px/1 var(--text);
  padding: 8px 14px;
}

.is-on .blk--1 { animation: rise 0.5s var(--ease) 1.6s both; }
.is-on .blk--2 { animation: rise 0.5s var(--ease) 2.2s both; }
.is-on .blk--3 { animation: rise 0.5s var(--ease) 2.8s both; }
.is-on .blk--skip { animation: rise 0.5s var(--ease) 3.4s both; }
.is-on .blk--4 { animation: rise 0.5s var(--ease) 4s both; }
.is-on .blk--5 { animation: rise 0.5s var(--ease) 4.6s both; }

/* ---------- 2. Живой класс ---------- */

.scene--class { display: grid; grid-template-columns: 1fr 120px 1fr; align-items: center; gap: 0; }

.pane {
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  padding: 26px 30px 30px;
  min-height: 300px;
}

.is-on .pane--student { animation: rise 0.6s var(--ease) both; }
.is-on .pane--teacher { animation: rise 0.6s var(--ease) 0.15s both; }

.pane__top { display: flex; align-items: center; gap: 12px; font: 600 22px/1 var(--text); color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot--live { background: var(--ochre); animation: pulse 1.6s ease-in-out infinite; }

.task { margin-top: 26px; font: 500 30px/1.5 var(--text); }
.gap {
  display: inline-block;
  min-width: 190px;
  border-bottom: 3px solid var(--ochre);
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.hint { margin-top: 18px; font: 500 20px/1 var(--text); color: var(--muted); }

.wire { position: relative; height: 6px; background: var(--line); border-radius: 99px; }
.wire__pulse {
  position: absolute;
  top: -9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ochre);
  opacity: 0;
}

.is-on .wire__pulse { animation: flow 1.4s var(--ease) 2.6s both; }

.answer {
  margin-top: 26px;
  border-radius: 14px;
  background: var(--ok-bg);
  padding: 22px 24px;
  font: 500 28px/1.4 var(--text);
  opacity: 0;
}

.answer .ok { color: var(--ok); font-weight: 700; margin-left: 12px; }
.is-on .answer { animation: pop 0.5s var(--ease) 4s both; }

.sticky {
  margin-top: 20px;
  border-radius: 14px;
  background: var(--ochre-soft);
  padding: 20px 22px;
  font: 600 24px/1.35 var(--text);
  color: #7A5406;
  transform: rotate(-1.5deg);
  opacity: 0;
}

.is-on .sticky { animation: pop 0.5s var(--ease) 5.2s both; }

/* ---------- 3. Слово и словарь ---------- */

.scene--word { display: grid; grid-template-rows: auto auto; align-content: center; justify-items: center; gap: 34px; }

.line { margin: 0; font: 500 40px/1.5 var(--text); color: var(--ink-2); }
.word { position: relative; border-radius: 6px; padding: 2px 6px; font-weight: 700; color: var(--ink); }
.is-on .word { animation: markUp 0.5s var(--ease) 0.8s both; }
@keyframes markUp { from { background: transparent; } to { background: var(--ochre-soft); } }

.lookup {
  width: 620px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  padding: 26px 30px;
  opacity: 0;
}

.is-on .lookup { animation: pop 0.5s var(--ease) 1.6s both; }
.lookup__head { display: flex; align-items: baseline; gap: 16px; font: 700 34px/1 var(--head); }
.ipa { font: 500 24px/1 var(--text); color: var(--muted); }
.sound { margin-left: auto; color: var(--ochre); font-size: 30px; }
.is-on .sound { animation: pulse 1.1s ease-in-out 2.4s 3; }
.lookup__ru { margin-top: 14px; font: 500 26px/1.4 var(--text); color: var(--ink-2); }

.lookup__add {
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 22px/1 var(--head);
  padding: 16px 26px;
  cursor: default;
}

.is-on .lookup__add { animation: pulse 0.6s var(--ease) 3.4s 1; }

.vocab {
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-radius: 18px;
  background: var(--surface-2);
  padding: 20px 28px;
  opacity: 0;
}

.is-on .vocab { animation: rise 0.5s var(--ease) 2s both; }
.vocab__t { font: 600 24px/1 var(--text); color: var(--muted); }
.vocab__n { font: 800 38px/1 var(--head); font-variant-numeric: tabular-nums; }
.vocab__s { font: 500 24px/1 var(--text); color: var(--muted); }
.vocab.is-up .vocab__n { color: var(--ok); }

/* ---------- 4. Домашка и проверка ---------- */

.scene--hw { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; align-content: center; }

.col {
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  padding: 26px 28px 30px;
  min-height: 300px;
}

.is-on .col--hw { animation: rise 0.5s var(--ease) both; }
.is-on .col--queue { animation: rise 0.5s var(--ease) 1.4s both; }
.is-on .col--drill { animation: rise 0.5s var(--ease) 3.4s both; }

.col__t { display: block; font: 700 25px/1.2 var(--head); padding-bottom: 20px; }
.rows { list-style: none; margin: 14px 0 0; padding: 0; }
.rows li {
  border-bottom: 1px solid var(--line);
  padding: 16px 2px;
  font: 500 22px/1.3 var(--text);
  color: var(--ink-2);
}
.rows li:last-child { border-bottom: 0; }

.mini { border-radius: 14px; background: var(--surface-2); padding: 20px 22px; font: 600 23px/1.35 var(--text); color: var(--ink-2); }
.mini--drill { background: var(--ochre-soft); color: #7A5406; }

.work__row {
  border-radius: 12px;
  background: var(--surface-2);
  padding: 16px 18px;
  margin-bottom: 12px;
  font: 600 22px/1.3 var(--text);
  opacity: 0;
}

.work__row s { color: var(--err); text-decoration-thickness: 2px; margin-right: 10px; }
.work__row.ok { background: var(--ok-bg); color: var(--ok); }
.is-on .work__row:nth-child(1) { animation: slideRight 0.45s var(--ease) 2s both; }
.is-on .work__row:nth-child(2) { animation: slideRight 0.45s var(--ease) 2.5s both; }
.is-on .work__row:nth-child(3) { animation: slideRight 0.45s var(--ease) 3s both; }

/* ---------- 5. Расписание и оплаты ---------- */

.scene--week { display: grid; grid-template-rows: auto auto; gap: 26px; align-content: center; }

.week, .pay, .attention {
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  padding: 26px 30px 30px;
}

.is-on .week { animation: rise 0.5s var(--ease) both; }
.is-on .pay { animation: rise 0.5s var(--ease) 1.2s both; }
.is-on .attention { animation: rise 0.5s var(--ease) 2.6s both; }

.week__t, .pay__t { display: block; font: 700 25px/1.2 var(--head); padding-bottom: 20px; }
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

.day {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 14px;
  background: var(--surface-2);
  padding: 18px 20px;
  font: 600 22px/1.2 var(--text);
  color: var(--ink-2);
}

.day b { font: 700 20px/1 var(--head); color: var(--muted); }
.day--now { background: var(--ink); color: var(--paper); }
.day--now b { color: var(--ochre); }

.pay {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'title title' 'num go' 'bar go';
  align-items: center;
  gap: 12px 26px;
}

.pay__t { grid-area: title; }
.pay__n { grid-area: num; font: 800 34px/1 var(--head); }
.bar { grid-area: bar; }
.pay__go {
  grid-area: go;
  align-self: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 22px/1 var(--head);
  padding: 16px 26px;
}
.bar { height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ochre); border-radius: 99px; --w: 25%; }
.is-on .bar i { animation: grow 0.9s var(--ease) 1.6s both; }

.attention { background: var(--ochre-soft); color: #7A5406; font: 700 26px/1.3 var(--head); }

/* ---------- Подпись сцены ---------- */

.cap { flex: 0 0 auto; padding: 0 40px 28px; }
.cap__bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.cap__bar i { display: block; height: 100%; width: 0; background: var(--ochre); border-radius: 99px; }

.cap__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-top: 20px; }
.cap__text b { display: block; font: 800 40px/1.15 var(--head); letter-spacing: -0.02em; }
.cap__text span { display: block; margin-top: 10px; font: 500 24px/1.35 var(--text); color: var(--muted); }

.cap__nav { display: flex; align-items: center; gap: 16px; }

.nav {
  width: 54px;
  height: 54px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.nav:hover { border-color: var(--ink); }
.dots { display: flex; gap: 10px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); display: block; }
.dots i.on { background: var(--ink); }

/* В превью карточки показом не управляют: он идёт сам */
body.is-preview .cap__nav { display: none; }
body.is-preview { pointer-events: none; }

/* ---------- Телефон: тот же показ, но портретной сценой ----------
   Сцена не ужимается целиком до нечитаемого: меняется её логический размер,
   и сцены перестраиваются в колонку. Дальше работает тот же пересчёт
   масштаба, что и на широком экране. */

@media (max-width: 719.98px) {
  /* Портретной сцене можно подрасти: на узком, но высоком экране она
     иначе стояла бы посреди пустых полей */
  :root { --stage-w: 430; --stage-h: 860; --s-max: 1.5; }

  .backbar { gap: 8px; padding: 9px 14px; font-size: 12px; }
  .backbar__tag { display: none; }

  .head { padding: 15px 18px 0; }
  .brand { gap: 9px; font-size: 26px; }
  .brand svg { width: 32px; height: 32px; }

  .scene { padding: 14px 18px 4px; }

  /* 1. Страница и просьба рядом, собранный урок под ними */
  .scene--build { grid-template-columns: 148px 1fr; gap: 12px; }
  .page-card { grid-column: 1; grid-row: 1; }
  .page-card img { height: 172px; }
  .page-card__tag { padding: 7px 10px; font-size: 13px; }

  .ask { grid-column: 2; grid-row: 1; border-radius: 14px; padding: 12px 14px; }
  .ask__label { font-size: 11px; }
  .ask__text { margin-top: 7px; font-size: 16px; min-height: 4.2em; }

  .built { grid-column: 1 / -1; grid-row: 2; border-radius: 16px; padding: 14px 15px 15px; }
  .built__head { gap: 8px; padding-bottom: 10px; font-size: 17px; }
  .spark { font-size: 18px; }
  .blk { gap: 10px; border-radius: 11px; padding: 11px 13px; margin-bottom: 8px; }
  .blk__n { font-size: 13px; }
  .blk__t { font-size: 17px; }
  .blk--skip { border-width: 1.5px; }
  .mark { padding: 5px 9px; font-size: 12px; }

  /* 2. Панели друг под другом, провод развёрнут вертикально */
  .scene--class { grid-template-columns: 1fr; grid-template-rows: auto 62px auto; align-content: center; }
  .pane { min-height: 0; border-radius: 16px; padding: 17px 19px 19px; }
  .pane__top { gap: 8px; font-size: 15px; }
  .dot { width: 10px; height: 10px; }
  .task { margin-top: 15px; font-size: 21px; }
  .gap { min-width: 126px; border-bottom-width: 2px; }
  .hint { margin-top: 10px; font-size: 13px; }

  .wire { justify-self: center; width: 6px; height: 100%; }
  .wire__pulse { top: 0; left: -9px; }
  .is-on .wire__pulse { animation-name: flowDown; }

  .answer { margin-top: 15px; border-radius: 11px; padding: 13px 15px; font-size: 20px; }
  .answer .ok { margin-left: 8px; }
  .sticky { margin-top: 12px; border-radius: 11px; padding: 12px 14px; font-size: 16px; }

  /* 3. Слово и словарь */
  .scene--word { gap: 22px; }
  .line { font-size: 23px; text-align: center; }
  .lookup { width: 100%; border-radius: 16px; padding: 17px 19px; }
  .lookup__head { gap: 10px; font-size: 25px; }
  .ipa { font-size: 16px; }
  .sound { font-size: 22px; }
  .lookup__ru { margin-top: 10px; font-size: 18px; }
  .lookup__add { margin-top: 16px; padding: 12px 20px; font-size: 16px; }

  .vocab { gap: 10px; border-radius: 14px; padding: 13px 19px; }
  .vocab__t, .vocab__s { font-size: 16px; }
  .vocab__n { font-size: 27px; }

  /* 4. Домашка, очередь и отработка – тремя строками */
  .scene--hw { grid-template-columns: 1fr; gap: 10px; }
  .col { min-height: 0; border-radius: 16px; padding: 13px 16px 13px; }
  .col__t { padding-bottom: 9px; font-size: 17px; }
  .rows { margin-top: 7px; }
  .rows li { padding: 7px 2px; font-size: 14px; }
  .mini { border-radius: 11px; padding: 10px 13px; font-size: 14px; }
  .work__row { border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: 14px; }
  .work__row s { margin-right: 7px; }

  /* 5. Неделя списком */
  .scene--week { gap: 11px; }
  .week, .pay, .attention { border-radius: 16px; padding: 14px 16px 15px; }
  .week__t, .pay__t { padding-bottom: 9px; font-size: 17px; }
  .days { grid-template-columns: 1fr; gap: 6px; }
  .day { flex-direction: row; align-items: baseline; gap: 10px; border-radius: 10px; padding: 10px 14px; font-size: 16px; }
  .day b { min-width: 25px; font-size: 15px; }
  .pay { gap: 8px 14px; }
  .pay__n { font-size: 21px; }
  .pay__go { padding: 11px 16px; font-size: 14px; }
  .bar { height: 10px; }
  .attention { font-size: 16px; }

  /* Подпись: текст сверху, управление отдельной строкой под большой палец */
  .cap { padding: 0 18px 14px; }
  .cap__bar { height: 5px; }
  .cap__row { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; }
  .cap__text b { font-size: 24px; }
  .cap__text span { margin-top: 5px; font-size: 15px; }
  .cap__nav { justify-content: center; gap: 12px; }
  .nav { width: 38px; height: 38px; border-width: 1.5px; font-size: 16px; }
  .dots i { width: 9px; height: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene *, .scene { animation-duration: 0.01s !important; animation-delay: 0s !important; }
}

/* ?scene=N показывает сцену сразу собранной: так её удобно смотреть и снимать */
body.is-still .scene *, body.is-still .scene { animation-duration: 0.01s !important; animation-delay: 0s !important; }
