/* QBoard Lab Del — дизайн B «Маршрут» (выбор владельца 27.11.2026): курс — линия метро, уроки — станции.
   60 % фон схемы, 30 % указатели (шапка, значки линий) и белые карточки, 10 % «ваша линия» — только CTA, пройденное, текущее. */
[hidden] { display: none !important; }
.story .ctl button.ghost { color: #e8eaed; box-shadow: inset 0 0 0 2px #4a4f54; }
.story .ctl .ico { width: 24px; height: 24px; }
:root {
  --c-60: #f2f4f3; --c-30: #1a1c1e; --c-10: #007a52; --t60: #121416; --dim60: #565d63; --t30: #ffffff; --dim30: #b9bec2;
  --onacc: #ffffff; --card: #ffffff; --line: #cdd2d5; --ok: #007a52; --bad: #c62828; --r: 14px;
  --grey: #858c92; --hover: #e7eae9; --acc-ink: #006143;
  --tap: 64px;           /* цели касания на панели */
  --gut: clamp(16px, 3.2vw, 72px);
}
* { box-sizing: border-box; }
html { font-size: clamp(16px, 0.55vw + 9px, 22px); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--c-60); color: var(--t60); font-family: 'Fira Sans', system-ui, sans-serif; line-height: 1.4; }
body { min-height: 100vh; }
a { color: var(--acc-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: var(--r); min-height: var(--tap); padding: 0 1.1em; background: var(--c-30); color: var(--t30); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, transform .1s; }
button:active { transform: scale(.98); }
button.cta { background: var(--c-10); color: var(--onacc); font-weight: 600; }
button.cta:hover { background: var(--acc-ink); }
button.ghost { background: transparent; color: var(--t60); box-shadow: inset 0 0 0 2px var(--line); }
button.ghost:hover { background: var(--hover); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: .5em .8em; border: 2px solid var(--line); border-radius: calc(var(--r) - 4px); background: #fff; }
textarea { min-height: 6em; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--c-10); outline: none; }
:focus-visible { outline: 3px solid var(--c-10); outline-offset: 2px; }
label { display: block; font-size: .85rem; color: var(--dim60); margin: 1em 0 .3em; }
h1 { font-size: 2rem; font-weight: 700; margin: 0; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.45rem; font-weight: 600; margin: 0 0 .5em; text-wrap: balance; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .4em; }
.muted { color: var(--dim60); font-size: .9rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 12rem; min-width: 0; }
.card { background: var(--card); border-radius: var(--r); padding: 1.2rem 1.4rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tag { display: inline-flex; align-items: center; gap: .3em; font-size: .78rem; padding: .15em .6em; border-radius: 99px; background: var(--hover); color: var(--dim60); }
.tag.acc { background: var(--c-10); color: #fff; }
.note { background: #fff4e5; border-left: 6px solid #e08a00; padding: .8em 1em; border-radius: 8px; margin-bottom: 1em; }
.ico { flex: none; vertical-align: -.15em; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--c-10); color: #fff; padding: 8px 14px; border-radius: var(--r); z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- шапка-указатель ---------- */
header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .6rem; padding: .6rem var(--gut); background: var(--c-30); color: var(--t30); }
.mark { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.25rem; margin-right: 1.4rem; white-space: nowrap; color: #fff; text-decoration: none; }
.mark i { width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--c-10); box-shadow: inset 0 0 0 .32em var(--c-30), inset 0 0 0 .5em #fff; }
header.top nav { display: flex; gap: .2rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
header.top nav a { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 .75rem; border-radius: var(--r); color: var(--dim30); text-decoration: none; font-weight: 500; white-space: nowrap; }
header.top nav a:hover { color: #fff; background: #2a2d30; }
header.top nav a.on { color: #fff; background: #2f3336; }
.badge { margin-left: .45em; min-width: 1.5em; height: 1.5em; padding: 0 .35em; border-radius: .75em; background: #fff; color: var(--t60); font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.langs { display: flex; gap: .2rem; }
.langs button { min-height: var(--tap); min-width: 3.4rem; padding: 0 .6rem; background: transparent; color: var(--dim30); font-weight: 600; font-size: .85rem; }
.langs button.on { background: #fff; color: var(--t60); }
.who { display: flex; align-items: center; gap: .5rem; color: var(--dim30); font-size: .85rem; }
.who button { background: #2a2d30; min-height: var(--tap); }
.who .help { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--r); background: #2a2d30; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.who .help:hover { background: #34383b; }
.helpmenu { position: relative; }
.helpmenu summary { list-style: none; cursor: pointer; }
.helpmenu summary::-webkit-details-marker { display: none; }
.helpmenu .hm { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; display: grid; min-width: 15rem; background: #fff; border-radius: var(--r); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: .4rem; }
.helpmenu .hm a { display: flex; align-items: center; min-height: var(--tap); padding: 0 1rem; color: var(--t60); text-decoration: none; border-radius: 10px; font-weight: 500; }
.helpmenu .hm a:hover { background: var(--hover); }
@media (max-width: 2100px) { .who .name { display: none; } }
/* шапка: меню сжимается измерением (fitNav в app.js); языки и «Ещё» — выпадающие меню */
header.top nav { overflow: hidden; }
header.top nav a[hidden] { display: none; }
.hmw { position: relative; flex: none; }
.hmw > summary, .helpmenu > summary { list-style: none; cursor: pointer; }
.hmw > summary::-webkit-details-marker { display: none; }
.mbtn { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 1rem; border-radius: var(--r); color: var(--dim30); font-weight: 600; white-space: nowrap; user-select: none; }
.mbtn:hover, .hmw[open] > .mbtn, .mbtn.on { color: #fff; background: #2f3336; }
.hmw .hm { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; display: grid; min-width: 14rem; background: #fff; border-radius: var(--r); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: .4rem; }
.hmw .hm a, .hmw .hm button { display: flex; align-items: center; min-height: var(--tap); padding: 0 1rem; color: var(--t60); background: transparent; text-decoration: none; border-radius: 10px; font-weight: 500; text-align: left; justify-content: flex-start; }
.hmw .hm a:hover, .hmw .hm button:hover { background: var(--hover); }
.hmw .hm a.on, .hmw .hm button.on { background: var(--c-30); color: #fff; }
.langsel .hm { min-width: 9rem; }
/* 4K-панель при масштабе Windows 100 %: всё крупнее, чтобы читалось с 2–3 м (при 200 % CSS-ширина и так 1920) */
@media (min-width: 2400px) { html { font-size: 137.5%; } }
@media (min-width: 3200px) { html { font-size: 175%; } }
.licbar { background: #fff4e5; padding: .5rem var(--gut); font-size: .9rem; border-bottom: 1px solid var(--line); }
.licbar.bad { background: #ffebee; }
main { max-width: 1840px; margin: 0 auto; padding: 1.6rem var(--gut) 5rem; }
.tabbar { display: none; }

/* ---------- маршрут курса ---------- */
.badge-line { display: inline-grid; place-items: center; min-width: 3.4rem; height: 2.6rem; padding: 0 .6rem; border-radius: calc(var(--r) - 4px); background: var(--c-30); color: #fff; font-weight: 700; font-size: 1rem; flex: none; }
.badge-line.mine { background: var(--c-10); }
.head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head h1 { flex: 1 1 20rem; }
.route { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center; margin: 5.6rem 0 4.6rem; min-height: 4.6rem; }
.route::before { content: ""; position: absolute; left: calc(50% / var(--n)); right: calc(50% / var(--n)); top: 50%; height: .5rem; margin-top: -.25rem; background: var(--grey); border-radius: .25rem; }
.route::after { content: ""; position: absolute; left: calc(50% / var(--n)); top: 50%; height: .5rem; margin-top: -.25rem; width: calc((100% - 100% / var(--n)) * var(--p)); background: var(--c-10); border-radius: .25rem; transition: width .6s ease-out; }
.st { position: relative; z-index: 1; justify-self: center; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .32rem var(--grey); color: var(--t60); text-decoration: none; }
.st.done { background: var(--c-10); box-shadow: 0 0 0 .32rem var(--c-10); }
.st.cur { width: 4.4rem; height: 4.4rem; background: #fff; box-shadow: 0 0 0 .55rem var(--c-30); font-weight: 700; font-size: 1.5rem; }
.st span { position: absolute; width: 11rem; text-align: center; font-size: 1.2rem; font-weight: 500; color: var(--t60); line-height: 1.2; }
.st:nth-child(odd) span { bottom: calc(100% + .9rem); } .st:nth-child(even) span { top: calc(100% + .9rem); }
.st.cur span { color: var(--t60); font-weight: 600; }
.quiz label.opt:focus-within { outline: 3px solid var(--c-10); outline-offset: 2px; }
@media (min-width: 901px) {  /* horizontal route only: the phone route is vertical (labels to the right) */
  .route:not(.dense) .st span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }  /* long kk titles: 2 lines */
  .st:first-child span { left: 0; text-align: left; } .st:last-child span { right: 0; text-align: right; }
}
.st:hover { transform: scale(1.08); }
.route.dense .st span { display: none; }
.route.dense .st.cur span, .route.dense .st:hover span { display: block; }
.next { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.next .grow h2 { margin: 0 0 .3rem; font-size: 1.6rem; }
.next button.cta { min-height: 5rem; font-size: 1.35rem; padding: 0 2.2rem; }
.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 34rem), 1fr)); gap: .4rem 2.4rem; margin-top: 1rem; }
.line { display: flex; align-items: center; gap: 1rem; padding: .55rem .5rem; border-radius: var(--r); text-decoration: none; color: inherit; min-height: var(--tap); }
.line:hover { background: var(--hover); }
.line b { display: block; font-weight: 600; }
.track { display: inline-block; vertical-align: middle; height: .5rem; border-radius: .25rem; margin-right: .6rem;
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--n, 10) - 2px), #fff 0 calc(100% / var(--n, 10))),
    linear-gradient(90deg, var(--c-10) calc(100% * var(--d, 0) / var(--n, 10)), var(--grey) 0); }
.section-t { color: var(--dim60); font-weight: 600; font-size: 1.15rem; margin: 2.4rem 0 .4rem; }

/* каталог */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0 1.2rem; }
.chip { min-height: var(--tap); padding: 0 1rem; border-radius: 99px; background: #fff; color: var(--t60); box-shadow: inset 0 0 0 2px var(--line); font-weight: 500; }
.chip.on { background: var(--c-30); color: #fff; box-shadow: none; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(19rem, 23%)), 1fr)); gap: 1rem; }  /* at most 4 per row */
.ccard { display: flex; flex-direction: column; gap: .6rem; text-decoration: none; color: inherit; }
.ccard:hover { box-shadow: 0 0 0 2px var(--c-30); }
.ccard p { margin: 0; color: var(--dim60); font-size: .95rem; }
.ccard .cv { position: relative; margin: -1.2rem -1.4rem .2rem; border-radius: var(--r) var(--r) 0 0; overflow: hidden; }
.ccard img.cover { width: 100%; height: auto; aspect-ratio: 2.2/1; object-fit: cover; object-position: 62% 50%; display: block; }
.ccard p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* language name drawn over the picture (not generated into it); brand-like colours */
.cv-name { position: absolute; left: .8rem; bottom: .7rem; padding: .15em .55em; border-radius: .4rem; font-weight: 700; font-size: clamp(1.3rem, 1.6vw, 2rem); line-height: 1.15; color: #fff; background: var(--lc, #3b3e40); box-shadow: 0 2px 8px rgb(0 0 0 / .25); letter-spacing: .01em; }
.cv-python { --lc: #306998; } .cv-web { --lc: #d84a1b; } .cv-scratch { --lc: #e8741a; } .cv-projects { --lc: #3d9a48; }
.cv-php { --lc: #6c70a8; } .cv-javascript .cv-name { color: #1e1e1e; } .cv-javascript { --lc: #f0d419; } .cv-java { --lc: #c4560a; }
.cv-cpp { --lc: #00599c; } .cv-csharp { --lc: #68217a; }
.ccard .cv ~ .row .badge-line { display: none; }  /* the cover already names the language */

/* страница курса */
.modt { font-weight: 600; color: var(--dim60); margin: 1.4rem 0 .4rem; }
.lrow { display: flex; align-items: center; gap: 1rem; min-height: var(--tap); padding: .4rem .8rem; border-radius: var(--r); text-decoration: none; color: inherit; }
.lrow:hover { background: var(--hover); }
.lrow .dot { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .22rem var(--grey); }
.lrow .dot.done { background: var(--c-10); box-shadow: 0 0 0 .22rem var(--c-10); }
.lrow .dot.cur { box-shadow: 0 0 0 .3rem var(--c-30); }
.lrow .meta { margin-left: auto; color: var(--dim60); font-size: .85rem; white-space: nowrap; }

/* урок: материал + практика */
.learn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); gap: 1.4rem; align-items: start; }
.learn.solo { grid-template-columns: minmax(0, 1fr); }
.lesson-body { font-size: 1.15rem; }
.lesson-body pre { background: #1e2124; color: #e8eaed; padding: 1rem; border-radius: 10px; overflow: auto; font-size: .88rem; line-height: 1.45; }
.lesson-body code { font-family: Consolas, 'Courier New', monospace; }
.lesson-body :not(pre) > code { background: var(--hover); padding: .05em .35em; border-radius: 4px; }
.lesson-body img, .lesson-body video { max-width: 100%; height: auto; }
.lesson-body iframe { max-width: 100%; }
.lesson-body table { border-collapse: collapse; } .lesson-body td, .lesson-body th { border: 1px solid var(--line); padding: .4em .7em; }
.lnav { display: flex; gap: .8rem; margin-top: 1.4rem; }
.lnav .grow { flex: 1; }
.play { position: sticky; top: 6rem; }
.play .ed, .task .ed { position: relative; height: 22rem; border-radius: 10px; overflow: hidden; background: #1e2124; }
.play .ed textarea, .play pre.hl, .task .ed textarea, .task pre.hl { position: absolute; inset: 0; margin: 0; padding: 1rem; border: 0; border-radius: 0; font: .9rem/1.45 Consolas, 'Courier New', monospace; white-space: pre; overflow: auto; tab-size: 4; min-height: 0; }
.play .ed textarea, .task .ed textarea { background: transparent; color: transparent; caret-color: #fff; resize: none; }
.play pre.hl, .task pre.hl { color: #e8eaed; pointer-events: none; }
.play .out { margin-top: .6rem; min-height: 7rem; max-height: 16rem; overflow: auto; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: .6rem .8rem; font: .88rem/1.4 Consolas, monospace; white-space: pre-wrap; }
.play iframe.out { width: 100%; height: 16rem; padding: 0; }
.quiz .q { margin: 1.2rem 0; } .quiz .q > b { display: block; margin-bottom: .4rem; }
.quiz label.opt { display: flex; gap: .8rem; align-items: center; color: var(--t60); font-size: 1rem; min-height: var(--tap); padding: .4rem 1rem; border: 2px solid var(--line); border-radius: 10px; margin: .4rem 0; cursor: pointer; background: #fff; }
.quiz label.opt input { width: 1.4rem; min-height: 1.4rem; accent-color: var(--c-10); }
.quiz label.good { border-color: var(--ok); background: #e5f4ee; } .quiz label.badc { border-color: var(--bad); background: #ffebee; }
.score { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* кабинеты */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; margin: 1rem 0 1.6rem; }
.stat b { display: block; font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: .6rem; background: var(--hover); border-radius: .3rem; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c-10); }
table.t { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
table.t td:first-child { min-width: 9rem; }
table.t th { background: #e9ecea; position: sticky; top: 0; font-weight: 600; }
table.t button { min-height: 3rem; }
.scroll { overflow: auto; max-height: 70vh; border-radius: var(--r); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tabs { display: flex; gap: .4rem; margin: .8rem 0; }
.tabs button { min-height: var(--tap); background: transparent; color: var(--t60); box-shadow: inset 0 0 0 2px var(--line); }
.tabs button.on { background: var(--c-10); color: var(--onacc); box-shadow: none; }
details.msg { border-bottom: 1px solid var(--line); }
details.msg > summary { list-style: none; cursor: pointer; padding: .8rem .4rem; min-height: var(--tap); }
details.msg > summary::-webkit-details-marker { display: none; }
details.msg.unread b { color: var(--acc-ink); }
details.msg .mb { padding: 0 .4rem 1rem; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 1rem; overscroll-behavior: contain; }
.modal .card { width: min(46rem, 100%); max-height: 90vh; overflow: auto; }
.toast { position: fixed; bottom: 5rem; left: 50%; transform: translateX(-50%); background: var(--c-30); color: #fff; padding: .8rem 1.2rem; border-radius: var(--r); z-index: 30; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--c-60); }
.login .card { width: min(30rem, 100%); padding: 2rem; }
.login .mark { color: var(--t60); font-size: 1.6rem; margin: 0 0 1.4rem; }
.login .mark i { box-shadow: inset 0 0 0 .32em #fff, inset 0 0 0 .5em var(--c-30); }
.err { color: var(--bad); min-height: 1.4em; font-size: .9rem; }

/* редактор курса (WYSIWYG) */
.editor-tools { display: flex; flex-wrap: wrap; gap: .3rem; padding: .4rem; background: #e9ecea; border-radius: 10px 10px 0 0; }
.editor-tools button { min-height: 2.8rem; padding: 0 .8rem; font-size: .9rem; }
.editor { min-height: 16rem; padding: 1rem; background: #fff; border: 2px solid #e9ecea; border-top: 0; border-radius: 0 0 10px 10px; outline: none; overflow: auto; }
.editor:focus-visible { border-color: var(--c-10); }
.editor pre { background: #1e2124; color: #e8eaed; padding: .6rem; border-radius: 6px; }
.lessonedit { border: 2px solid var(--line); border-radius: var(--r); padding: 1rem; margin: .6rem 0; background: #fff; }

/* рассказ (плеер видеолекции) */
.story { background: var(--c-30); border-radius: var(--r); padding: .8rem; color: var(--t30); }
.story:not(:fullscreen) .stage { max-height: calc(100vh - 21rem); }  /* 1366x768: buttons stay on screen */
.story:fullscreen { display: flex; flex-direction: column; justify-content: center; padding: 1.5vw; height: 100vh; box-sizing: border-box; }
.story:fullscreen .stage { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }  /* stage gives way so subtitles and buttons stay on screen */
.story:fullscreen .sub { font-size: clamp(16px, 2.4vw, 36px); min-height: 0; max-height: 28vh; overflow: hidden; flex: none; }
.story:fullscreen .sub span:not(.on) { display: none; }  /* full screen: only the sentence being spoken, like film subtitles */
.story:fullscreen .ctl { flex: none; }
.story .stage { aspect-ratio: 16/9; background: var(--c-60); color: var(--t60); border-radius: 10px; padding: 4% 5%; overflow: hidden; display: flex; flex-direction: column; gap: 2%; border-top: 6px solid var(--c-10); }
.story .stage.enter { animation: st-in .35s ease-out; }
@keyframes st-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.story .sh { font-size: clamp(18px, 2.6vw, 44px); font-weight: 700; }
.story .sbody { flex: 1; display: grid; grid-template-columns: 1fr; gap: 2%; min-height: 0; }
.story .stage.scratch .sbody { grid-template-columns: 1fr 1fr; align-items: start; }
.story .stage.scratch .sb-list { grid-column: 1 / -1; }
.story .sb-list { margin: 0; padding-left: 1.2em; font-size: clamp(14px, 1.8vw, 30px); }
.story .sb-list li { opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; margin: .2em 0; }
.story .sb-list li.on { opacity: 1; transform: none; }
.story .sb-list li::marker { color: var(--c-10); }
.story .sc { flex: 1; margin: 0; background: #1e2124; color: #e8eaed; border-radius: 8px; padding: 2% 3%; font: clamp(12px, 1.5vw, 26px)/1.45 Consolas, monospace; overflow: hidden; white-space: pre-wrap; }
.story .caret { display: inline-block; width: .55em; height: 1.1em; vertical-align: -.15em; background: #e8eaed; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.story .sub { min-height: 3.2em; margin: .6rem .3rem; font-size: clamp(14px, 1.4vw, 24px); }
.story .sub span { color: var(--dim30); transition: color .2s; } .story .sub span.on { color: #fff; }
.story .ctl button { min-height: 3.2rem; background: #2f3336; }
.story .ctl #sp { background: var(--c-10); min-width: 4rem; }
.story .ctl select { width: auto; min-height: 3.2rem; background: #2f3336; color: #fff; border-color: #44494d; }
.story .bar { margin: 0; background: #2f3336; } .story .muted { color: var(--dim30); }
.story .seek { padding: 1.1rem .5rem; cursor: pointer; touch-action: none; }  /* tall hit area around a thin bar */
.story .seek:focus-visible { outline: 2px solid var(--c-10); border-radius: 6px; }
#stime { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tk-kw { color: #ffb86c; } .tk-str { color: #a5e075; } .tk-num { color: #79c0ff; } .tk-com { color: #8b949e; font-style: italic; } .tk-tag { color: #ff8f73; } .tk-var { color: #d2a8ff; }
.sblocks { display: flex; flex-direction: column; gap: 3px; font: 600 clamp(11px, 1.3vw, 22px)/1.2 'Fira Sans', sans-serif; }
.sb { align-self: flex-start; margin-left: calc(var(--ind) * 1.4em); padding: .45em .8em; border-radius: .35em; color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
  opacity: 0; transform: translateX(-24px); transition: opacity .3s, transform .35s cubic-bezier(.2,.9,.3,1.3); }
.sb.on { opacity: 1; transform: none; }
.sb-hat { border-radius: 1.2em .9em .35em .35em; padding-top: .7em; }
.sb-arg, .sb-num { font-style: normal; background: #fff; color: #575e75; border-radius: 1em; padding: .05em .55em; margin: 0 .15em; }
.sb-motion { background: #4c97ff; } .sb-looks { background: #9966ff; } .sb-sound { background: #cf63cf; } .sb-events { background: #ffbf00; color: #4a3500; }
.sb-control { background: #ffab19; } .sb-sensing { background: #5cb1d6; } .sb-operators { background: #59c059; } .sb-variables { background: #ff8c1a; }
.sb-lists { background: #ff661a; } .sb-pen { background: #0fbd8c; } .sb-other { background: #8f96a3; }
.sstage { position: relative; aspect-ratio: 4/3; background: #fff; border: 2px solid var(--line); border-radius: 8px; overflow: hidden;
  background-image: linear-gradient(#eef1f3 1px, transparent 1px), linear-gradient(90deg, #eef1f3 1px, transparent 1px); background-size: 10% 13.33%; }
.sstage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-sprite { position: absolute; transition: left .3s linear, top .3s linear, transform .3s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.st-bubble { position: absolute; top: 6%; right: 6%; max-width: 60%; background: #fff; color: #262626; border: 2px solid #c4cad1; border-radius: 1em; padding: .3em .7em; font-size: clamp(11px, 1.2vw, 18px); }
.st-flag { position: absolute; top: 4px; left: 6px; color: #59c059; font-size: clamp(14px, 1.6vw, 22px); opacity: .35; }
.sstage.run .st-flag { opacity: 1; }
video.intro { width: 100%; max-height: min(26vh, 16rem); object-fit: cover; border-radius: var(--r); margin-bottom: 1rem; }

/* ---------- телефон: линия вертикально, навигация снизу ---------- */
/* «Скачать» и «Полезные ссылки»: адрес крупно, QR рядом — открыть с телефона у панели */
.dlgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.card.dl { display: flex; gap: 1.2rem; align-items: flex-start; }
.card.dl h3 { margin: 0 0 .3rem; }
.card.dl .qr { flex: none; width: 132px; height: 132px; background: #fff; border-radius: 8px; image-rendering: pixelated; }
.card.dl .url { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 1.25rem; font-weight: 600; color: var(--acc-ink); word-break: break-all; }
.card.dl p { margin: .2rem 0; }
.card.dl .need { margin-top: .4rem; font-size: .92rem; }
.useful { margin-top: 1.4rem; }
.story .sout { margin: .5rem 0 0; padding: .7rem 1rem; background: #0f1112; color: #b9f6ca; border-left: 4px solid var(--c-10); border-radius: 8px; font: 1rem/1.4 Consolas, monospace; white-space: pre-wrap; }
.story .sout::before { content: '▶ '; color: #6b7177; }
.story .slinks { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .6rem; }
.story .slinks:empty { display: none; }
.story .slink { display: flex; gap: .9rem; align-items: center; padding: .6rem .9rem .6rem .6rem; background: #fff; border: 2px solid var(--line); border-radius: 12px; color: var(--t60); text-decoration: none; }
.story .slink img { flex: none; background: #fff; image-rendering: pixelated; }
.story .slink b { display: block; font-size: 1rem; }
.story .slink u { display: block; font-size: 1.35rem; font-weight: 700; color: var(--acc-ink); word-break: break-all; }
.tasks { margin-top: 1.4rem; }
.handout { margin: 1rem 0 0; } .handout a { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--tap); padding: 0 1rem; border-radius: var(--r); background: #fff; box-shadow: inset 0 0 0 2px var(--line); color: var(--t60); font-weight: 600; text-decoration: none; }
.lesson-body { overflow-wrap: break-word; min-width: 0; }  /* long code lines / tables in lesson text scroll, the page never gets wider */
.lesson-body table { display: block; max-width: 100%; overflow-x: auto; }
.lesson-body pre { max-width: 100%; }
.lesson-body :not(pre) > code { overflow-wrap: anywhere; }
.learn > * { min-width: 0; }
table.t th { white-space: nowrap; }
table.t td.num { white-space: nowrap; }
.line .grow { min-width: 0; }
.xvideo { margin-top: 1rem; }
.xvideo h3 { margin: 0 0 .6rem; }
.xv-play { width: 100%; aspect-ratio: 16 / 9; max-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: #1a1c1e; color: #fff; border-radius: 12px; text-align: center; padding: 1.4rem; }
.xv-play .ico { width: 64px; height: 64px; padding: 14px; border-radius: 50%; background: var(--c-10); }
.xv-play b { display: block; font-size: 1.2rem; }
.xv-play .muted { color: #b9bec2; }
.xv-frame { width: 100%; aspect-ratio: 16 / 9; max-height: 70vh; border: 0; border-radius: 12px; display: block; }
.xv-off { margin: .6rem 0 0; padding: .8rem 1rem; background: #fff4e5; color: #6b3d00; border-radius: 10px; font-weight: 500; }
.xv-cap { margin: .5rem 0 0; font-size: .9rem; }
.play #pin { width: 100%; font: .9rem/1.4 Consolas, monospace; }
.task { margin-top: .8rem; border-left: 6px solid var(--line); }
.task.solved { border-left-color: var(--c-10); }
.task h3 .lang { font-size: .85rem; font-weight: 500; margin-left: .4rem; }
.task .ed { height: 13rem; }
.checks { list-style: none; padding: 0; margin: .6rem 0 0; }
.checks li { padding: .4rem 0; border-top: 1px solid var(--line); }
.checks li.ok b { color: var(--c-10); }
.checks li.no b { color: #b3261e; }
.checks .diff { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; margin-top: .3rem; font-size: .9rem; }
.checks .diff pre { margin: 0; padding: .3rem .5rem; background: #f4f5f4; border-radius: 6px; white-space: pre-wrap; font: .88rem/1.35 Consolas, monospace; }
@media (max-width: 900px) {
  .dlgrid { grid-template-columns: minmax(0, 1fr); }
  .card.dl .qr { width: 96px; height: 96px; }
  .card.dl .url { font-size: 1.05rem; }
  :root { --tap: 48px; }
  header.top nav, .who .name { display: none; }
  .story .stage { aspect-ratio: auto; min-height: 56vw; }  /* phone: the slide grows with code + output instead of squeezing the code to a line */
  .story .sc { min-height: 4.5em; flex: none; }
  .learn { display: flex; flex-direction: column; }      /* phone: Practice comes before «Next lesson» */
  .learn .lesson { display: contents; }
  .learn .play { order: 5; } .learn .lnav { order: 10; }
  .xv-play { aspect-ratio: auto; min-height: 12rem; }
  .play .ed textarea, .play pre.hl, .task .ed textarea, .task pre.hl, .play #pin { font-size: 16px; }  /* < 16 px makes phones zoom the page */
  .hmw.more .hm, .helpmenu .hm { position: fixed; left: .5rem; right: .5rem; top: 4.4rem; min-width: 0; max-height: calc(100vh - 9rem); overflow: auto; }
  .mbtn { padding: 0 .7rem; }
  .mark { margin-right: auto; font-size: 0; gap: 0; }  /* phone: only the round mark, the name stays for screen readers */
  .mark i { width: 2.2rem; height: 2.2rem; box-shadow: inset 0 0 0 .45rem var(--c-30), inset 0 0 0 .7rem #fff; }
  header.top { gap: .35rem; }
  .langs button { min-width: 2.7rem; padding: 0 .3rem; }
  .who .help { width: 2.7rem; }
  .who button { padding: 0 .7rem; }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--c-30); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; min-height: 3.6rem; display: grid; place-items: center; color: var(--dim30); text-decoration: none; font-size: .9rem; font-weight: 600; border-top: 3px solid transparent; }
  .tabbar a.on { color: #fff; border-top-color: var(--c-10); background: #2a2d30; }
  main { padding-bottom: 6rem; }
  h1 { font-size: 1.5rem; }
  .route { display: flex; flex-direction: column; align-items: flex-start; gap: 1.2rem; margin: 1rem 0 1.4rem; padding-left: .2rem; }
  .route::before { left: 1.15rem; right: auto; top: 1rem; bottom: 1rem; width: .5rem; height: auto; margin: 0 0 0 -.25rem; }
  .route::after { left: 1.15rem; top: 1rem; width: .5rem; height: calc((100% - 2rem) * var(--p)); margin: 0 0 0 -.25rem; }
  .st, .st.cur { width: 2.3rem; height: 2.3rem; font-size: 1rem; margin: 0; justify-self: auto; }
  .st.cur { box-shadow: 0 0 0 .45rem var(--c-30); }
  .st span, .route.dense .st span { font-size: 1rem; display: block; position: absolute; left: 3.4rem; top: 50% !important; bottom: auto !important; transform: translateY(-50%); width: 70vw; text-align: left; }
  .next button.cta { width: 100%; }
  .learn { grid-template-columns: minmax(0, 1fr); }
  .play { position: static; }
  .story .stage.scratch .sbody { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .story .sb-list li, .sb { opacity: 1; transform: none; }
}
