/* Курс «Английский для дальнобойщиков в США» (views/page_truckers.php, assets/truckers.js).
   Отдельный файл: подключается только на страницах раздела (head.php). Цвета — переменные сайта
   из app.css, поэтому тёмная тема работает без своих правил, кроме знаков: знаки — это знаки,
   их цвета не меняются вместе с темой. */

.tk-page { max-width: 880px; padding-top: 24px; color: var(--text); }
.tk-page :where(h1, h2, h3, h4, p, ul, ol, dl) { margin: 0; }
.tk-page :where(p, li, dd) { line-height: 1.6; }
.tk-page a:where(:not([class])) { color: var(--link-on-surface); }
.tk-page h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; letter-spacing: -.01em; }
.tk-page h2 { font-size: 22px; line-height: 1.3; margin-bottom: 14px; }
.tk-page h3 { font-size: 17px; line-height: 1.35; }
.tk-muted { color: var(--text2); }
.tk-small { font-size: 13px; margin-top: 10px; }

/* ── кнопки ── */
.tk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 10px; border: 1.5px solid transparent; background: var(--accent); color: #fff; font: 600 15px/1.2 var(--font);
  cursor: pointer; text-decoration: none; }
.tk-btn:hover { background: var(--accent-hover); }
.tk-btn[disabled] { opacity: .5; cursor: default; }
.tk-btn-out { background: var(--surface); color: var(--text); border-color: var(--border); }
.tk-btn-out:hover { background: var(--surface2); border-color: var(--border-hover); }
.tk-btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.tk-btn-rec { background: var(--red); }
.tk-btn-rec:hover { background: var(--rd-wrong); }
.tk-btn-rec::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: tk-pulse 1s infinite; }
@keyframes tk-pulse { 50% { opacity: .3; } }

/* ── звук: кнопка ▶ и английская фраза-кнопка ── */
.tk-play { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); color: var(--accent); cursor: pointer;
  font-size: 12px; vertical-align: middle; margin-inline-end: 8px; }
.tk-play:hover, .tk-play.is-playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.tk-en { display: inline; padding: 0 2px; margin: 0; border: 0; border-bottom: 1.5px dashed color-mix(in srgb, var(--lsn-en) 55%, transparent);
  background: none; color: var(--lsn-en); font: inherit; font-style: italic; cursor: pointer; text-align: start; border-radius: 0; }
.tk-en:hover, .tk-en.is-playing { background: var(--accent-glow); }
.tk-en.is-playing { border-bottom-style: solid; }
.tk-badge { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--surface3); color: var(--text2);
  font-size: 12px; font-weight: 600; vertical-align: middle; }

/* ── каталог ── */
.tk-hero { padding: 8px 0 28px; display: flex; flex-direction: column; gap: 14px; }
.tk-kicker { font: 600 13px/1 var(--mono); color: var(--accent2); letter-spacing: .08em; }
.tk-lead { font-size: 18px; color: var(--text2); max-width: 720px; }
.tk-hero-go { display: flex; flex-wrap: wrap; gap: 10px; }
.tk-module { margin-bottom: 32px; }
.tk-lesson-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.tk-lesson-list a { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.tk-lesson-list a:hover { border-color: var(--accent); }
.tk-ln { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-glow); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font: 700 16px/1 var(--mono); }
.tk-lb { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tk-lb span { color: var(--text2); font-size: 14px; }
.tk-ldone { margin-inline-start: auto; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); }
.is-seen .tk-ldone { border-color: var(--accent); }
.is-done .tk-ldone { border-color: var(--accent2); background: var(--accent2); box-shadow: inset 0 0 0 4px var(--surface); }
.tk-about { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.tk-about h2 { margin: 18px 0 0; }
.tk-about ul { padding-inline-start: 20px; display: grid; gap: 6px; }
.tk-disclaimer { margin-top: 28px; padding: 12px 16px; border-radius: 10px; background: var(--surface2); color: var(--text2); font-size: 14px; }

/* ── урок: шапка ── */
.tk-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--text2); margin-bottom: 12px; }
.tk-crumbs a { color: var(--text2); }
.tk-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.tk-h1n { color: var(--accent); }
.tk-skill { padding: 12px 16px; border-inline-start: 4px solid var(--accent2); background: var(--accent2-glow); border-radius: 0 10px 10px 0; }
.tk-skill b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent2); }
.tk-scene { color: var(--text2); }
.tk-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-toc a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; text-decoration: none; }
.tk-toc a:hover { border-color: var(--accent); }

.tk-sec { padding: 22px 0; border-top: 1px solid var(--border); scroll-margin-top: 70px; }
.tk-theory ul { padding-inline-start: 20px; display: grid; gap: 8px; }
.tk-theory ul ul { margin-top: 6px; gap: 4px; }
.tk-theory p + p { margin-top: 8px; }
.tk-theory code { font-family: var(--mono); font-size: .9em; background: var(--surface2); padding: 0 4px; border-radius: 4px; }
.tk-tablewrap { overflow-x: auto; margin: 10px 0; }
.tk-table { border-collapse: collapse; min-width: 100%; font-size: 15px; }
.tk-table th, .tk-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: start; vertical-align: top; }
.tk-table th { background: var(--surface2); font-weight: 600; }

/* ── диалог ── */
.tk-dialog { list-style: none; padding: 0; display: grid; gap: 16px; counter-reset: dl; }
.tk-dl { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tk-dl-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin-bottom: 10px; }
.tk-dl-who { width: 100%; font-size: 13px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.tk-dl-q { font-size: 18px; font-weight: 600; quotes: none; color: var(--text); flex: 1; min-width: 200px; }
.tk-dl-sign { margin: 6px 0 10px; }
.tk-dl-subs { display: grid; gap: 6px; }
.tk-dl-subs dt { display: inline; font-weight: 700; }
.tk-dl-subs dt::after { content: ': '; }
.tk-dl-subs dd { display: inline; margin: 0; }
.tk-answers { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.tk-ans-l { display: inline-block; min-width: 72px; font-size: 13px; color: var(--text2); }
/* перевод образцового ответа на язык интерфейса — мелкой строкой под английской фразой */
.tk-tr { display: block; margin: 1px 0 4px; margin-inline-start: 76px; font-size: 13.5px; line-height: 1.4; color: var(--text2); }
.tk-signcard-t .tk-tr { margin-inline-start: 0; }
@media (max-width: 640px) { .tk-tr { margin-inline-start: 0; } }

/* ── вопросы с ответами ── */
.tk-card { margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.tk-card summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.tk-card-k { color: var(--accent); }
.tk-card-note { padding: 0 16px 8px; color: var(--text2); font-size: 14px; }
.tk-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; padding: 0 16px 14px; }
.tk-card-grid dt { font-size: 12px; color: var(--text2); }
.tk-card-grid dd { margin: 0; font-weight: 600; }
.tk-qlist { display: grid; gap: 12px; }
.tk-q { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tk-q h3 { margin-bottom: 8px; }
.tk-phr { list-style: none; padding: 0; display: grid; gap: 6px; }
.tk-phr li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tk-q .tk-answers { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.tk-note { margin-top: 8px; font-size: 14px; color: var(--text2); }

/* ── знаки ── */
.tk-sign { display: block; height: auto; max-width: 100%; }
.tk-sign-sm { width: auto; max-height: 64px; display: inline-block; vertical-align: middle; }
.tk-sign-md { width: auto; max-height: 120px; display: inline-block; }
.tk-sign-lg { width: auto; max-height: 240px; margin: 0 auto; }
.tk-dl-sign .tk-sign { max-height: 160px; width: auto; }
.tk-signlist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tk-signcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tk-signcard .tk-sign { max-height: 130px; width: auto; margin: 0 auto; }
.tk-signcard-t { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.tk-signcard-t span { color: var(--text2); }

/* ── упражнения ── */
.tk-ex { padding: 16px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tk-ex-h { margin-bottom: 12px; }
.tk-items { padding-inline-start: 22px; display: grid; gap: 14px; }
.tk-qtext { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tk-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-opt { min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; text-align: start; }
.tk-opt:hover { border-color: var(--accent); }
.tk-opt.is-right { border-color: var(--rd-right); background: var(--status-success-bg); color: var(--status-success-fg); }
.tk-opt.is-wrong { border-color: var(--rd-wrong); background: var(--status-error-bg); color: var(--status-error-fg); }
.tk-opt[aria-disabled="true"] { cursor: default; }
.tk-expl { margin-top: 6px; font-size: 14px; color: var(--text2); }
.tk-match li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tk-match-l { min-width: 200px; font-weight: 600; }
.tk-select { min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; max-width: 100%; }
.tk-item.is-right .tk-select, .tk-item.is-right .tk-input { border-color: var(--rd-right); }
.tk-item.is-wrong .tk-select, .tk-item.is-wrong .tk-input { border-color: var(--rd-wrong); }
.tk-match-hint { font-size: 14px; color: var(--rd-right); }
.tk-typerow { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-input { flex: 1; min-width: 200px; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; }
.tk-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tk-sample { margin-top: 6px; font-size: 15px; }
.tk-chips, .tk-built { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; }
.tk-built { padding: 6px; border: 1.5px dashed var(--border); border-radius: 10px; margin-bottom: 8px; }
.tk-item.is-right .tk-built { border-color: var(--rd-right); border-style: solid; }
.tk-item.is-wrong .tk-built { border-color: var(--rd-wrong); border-style: solid; }
.tk-chip { min-height: 36px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font: inherit; cursor: pointer; }
.tk-orderfoot { display: flex; gap: 8px; margin-top: 8px; }
.tk-ex-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.tk-ex-score { font-weight: 600; color: var(--accent2); }

/* ── образцы документов ── */
.tk-docwrap { margin-bottom: 14px; overflow-x: auto; }
.tk-doc { font: 14px/1.4 var(--mono); color: #1a1f2e; background: #fff; border: 1px solid #c9ced8; border-radius: 10px; padding: 12px; min-width: 300px; }
.tk-doc dt { font-size: 11px; color: #5a6378; }
.tk-doc dd { margin: 0; font-weight: 600; }
.tk-doc-band { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 10px; margin: -12px -12px 12px;
  border-radius: 10px 10px 0 0; background: #1d4f91; color: #fff; }
.tk-doc-band i { margin-left: auto; font-style: normal; font-size: 11px; opacity: .8; }
.tk-doc-body { display: flex; gap: 12px; }
.tk-doc-photo { width: 72px; height: 90px; flex: none; border-radius: 6px; background: repeating-linear-gradient(45deg, #e4e9f2, #e4e9f2 6px, #eef1f6 6px, #eef1f6 12px); }
.tk-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px 12px; flex: 1; }
.tk-doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 2px solid #1a1f2e; }
.tk-doc-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 14px; margin: 8px 0; }
.tk-doc-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.tk-doc-table th, .tk-doc-table td { border: 1px solid #c9ced8; padding: 4px 6px; text-align: left; }
.tk-doc-table th { background: #eef1f6; font-size: 11px; }
.tk-doc-note { font-size: 12px; color: #5a6378; margin: 6px 0; }
.tk-doc-eld { background: #10151f; color: #e9eef7; border-color: #2a3358; }
.tk-doc-eld .tk-doc-table th { background: #1a2035; color: #9aa3b8; }
.tk-doc-eld .tk-doc-table th, .tk-doc-eld .tk-doc-table td { border-color: #2a3358; }
.tk-eld-top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.tk-eld-status { margin-bottom: 10px; }
.tk-eld-status b { color: #4fdcb4; }
.tk-eld-clocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.tk-eld-clocks div { padding: 8px; border-radius: 8px; background: #1a2035; text-align: center; }
.tk-eld-clocks span { display: block; font-size: 11px; color: #9aa3b8; }
.tk-eld-clocks b { font-size: 20px; }
.tk-doc-guide { display: grid; grid-template-columns: 2fr 1fr; gap: 6px; background: #4a5568; padding: 8px; font-family: Arial, Helvetica, sans-serif; color: #fff; }
.tk-guide-panel { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 10px;
  background: #00703c; border: 2px solid #fff; border-radius: 8px; text-align: center; }
.tk-guide-panel b { font-size: 22px; }
.tk-guide-shield { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 6px 6px 22px 22px;
  background: #1d4f91; border: 2px solid #fff; font-weight: 700; font-size: 18px; }
.tk-guide-city { font-size: 18px; }
.tk-guide-arrows { font-size: 26px; line-height: 1; }
.tk-guide-tab { position: absolute; top: -12px; right: 8px; padding: 2px 8px; background: #00703c; border: 2px solid #fff; border-radius: 6px; font-size: 12px; font-weight: 700; }
.tk-guide-only { display: block; width: 100%; padding: 2px; background: #ffcc00; color: #111; font-weight: 700; border-radius: 4px; }

/* ── тренажёр, ролевые игры, симуляция ── */
.tk-park { padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; background: var(--cd-hard-bg); color: var(--cd-hard-fg); font-size: 14px; }
.tk-app { padding: 16px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  display: flex; flex-direction: column; gap: 12px; }
.tk-app-h { margin-bottom: 2px; }
.tk-app-intro { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tk-app-intro .tk-card { width: 100%; margin: 0; }
.tk-app-score { font-weight: 600; color: var(--accent2); }
.tk-q-live { display: flex; flex-direction: column; gap: 12px; }
.tk-q-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--text2); }
.tk-q-n { font-weight: 600; }
.tk-timer { font: 600 14px/1 var(--mono); color: var(--orange); }
.tk-sign-live { display: flex; justify-content: center; padding: 10px; border-radius: 10px; background: var(--surface2); min-height: 120px; align-items: center; }
.tk-sign-live.is-hidden > svg { visibility: hidden; }
.tk-picker { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: 10px; background: var(--surface2); }
.tk-picker-h { width: 100%; font-size: 13px; font-weight: 700; color: var(--text2); }
.tk-pick { min-height: 40px; padding: 6px 12px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.tk-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.tk-answer { display: flex; flex-direction: column; gap: 10px; }
.tk-answer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-answer-msg { min-height: 1.4em; color: var(--text2); }
.tk-answer-msg:empty { display: none; }
.tk-heard q { font-style: italic; }
.tk-fb { padding: 12px 14px; border-radius: 10px; border-inline-start: 4px solid var(--border); background: var(--surface2); display: flex; flex-direction: column; gap: 8px; }
.tk-fb-ok { border-inline-start-color: var(--rd-right); }
.tk-fb-fail { border-inline-start-color: var(--rd-wrong); }
.tk-st { align-self: flex-start; padding: 3px 10px; border-radius: 99px; font-weight: 700; font-size: 14px; }
.tk-st-ok { background: var(--status-success-bg); color: var(--status-success-fg); }
.tk-st-fail { background: var(--status-error-bg); color: var(--status-error-fg); }
.tk-st-almost { background: var(--cd-hard-bg); color: var(--cd-hard-fg); }
.tk-tip { font-weight: 500; }
.tk-asked p { margin: 2px 0; }
.tk-q-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-chk { padding: 10px 14px; border-radius: 10px; border: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.tk-summary { display: flex; flex-direction: column; gap: 10px; }
.tk-summary-h { font-size: 18px; font-weight: 700; }
.tk-review { list-style: none; padding: 0; display: grid; gap: 10px; }
.tk-review li { padding: 10px 12px; border-radius: 10px; background: var(--surface2); }
.tk-sim-card h3 { margin-bottom: 4px; }
.tk-sim-card .tk-card { margin: 10px 0; }
.tk-sim-go { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* верхняя строка симуляции: часть, номер вопроса и таймер, под ней карточка «по кнопке» */
.tk-sim-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tk-sim-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.tk-sim-slot .tk-q-head { justify-content: flex-start; gap: 14px; }
.tk-sim-top .tk-card { margin: 0; width: 100%; }
.tk-card-close { margin: 0 16px 14px; min-height: 44px; }
.tk-sim-area { display: flex; flex-direction: column; gap: 12px; }
.tk-sim-sheet { display: flex; flex-direction: column; gap: 12px; }

/* ── ответ в режиме разговора (симуляция): крупный микрофон, состояние, уровень звука ── */
.tk-talk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tk-talk-main { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.tk-talk-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tk-talk .tk-answer-msg { min-height: 0; font-weight: 600; color: var(--text); }
.tk-answer-interim { font-style: italic; color: var(--text2); overflow-wrap: anywhere; }
.tk-answer-interim:empty { display: none; }
/* уровень звука (TKSpeech onLevel, 0…1) — кольцо вокруг кнопки: видно, что микрофон вас слышит */
.tk-mic { flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 28px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 calc(var(--lvl, 0) * 18px) color-mix(in srgb, var(--red) 40%, transparent); transition: box-shadow .1s linear, background .15s; }
.tk-mic:hover { background: var(--accent-hover); }
.tk-mic:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tk-talk[data-mic] .tk-mic { background: var(--red); }
.tk-talk[data-mic="starting"] .tk-mic, .tk-talk[data-mic="recognizing"] .tk-mic { opacity: .7; }
.tk-talk[data-mic="listening"] .tk-mic { animation: tk-ring 1.6s ease-out infinite; }
@keyframes tk-ring { 0% { outline: 0 solid color-mix(in srgb, var(--red) 55%, transparent); outline-offset: 0; }
  100% { outline: 10px solid transparent; outline-offset: 6px; } }
@media (prefers-reduced-motion: reduce) { .tk-talk[data-mic="listening"] .tk-mic { animation: none; } }
.tk-talk .tk-answer-row .tk-btn { padding: 8px 14px; font-size: 14px; }
.tk-talk .tk-btn-sm { min-height: 44px; }
/* «Ответить заново» в режиме разговора: полоска — сколько осталось до следующего вопроса */
.tk-q-auto { align-items: center; }
.tk-autobar { flex: 1 1 80px; max-width: 220px; height: 4px; border-radius: 2px; background: var(--accent); transform-origin: left;
  animation: tk-autobar var(--tk-auto, 2600ms) linear forwards; }
@keyframes tk-autobar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .tk-autobar { animation: none; opacity: .5; } }
.tk-sim-result { padding: 14px 16px; border-radius: 10px; background: var(--surface2); border-inline-start: 4px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.tk-sim-result.tk-fb-ok { border-inline-start-color: var(--rd-right); }
.tk-sim-result.tk-fb-fail { border-inline-start-color: var(--rd-wrong); }
.tk-replay { padding-inline-start: 20px; }
.tk-rules { padding-inline-start: 20px; display: grid; gap: 6px; margin: 14px 0; }
.tk-simgroups { padding-inline-start: 22px; display: grid; gap: 10px; margin-bottom: 16px; }
.tk-simgroups .tk-phr { margin-top: 4px; }

/* ── навигация по урокам ── */
.tk-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 22px; border-top: 1px solid var(--border); }
.tk-pager a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; }
.tk-pager a:hover { border-color: var(--accent); }
.tk-pager small { display: block; color: var(--text2); font-size: 12px; }
.tk-pager-next { justify-content: flex-end; text-align: end; grid-column: 2; }

@media (max-width: 640px) {
  .tk-page { padding-top: 12px; }
  .tk-dl-q { font-size: 16px; }
  .tk-pager { grid-template-columns: 1fr; }
  .tk-pager-next { grid-column: 1; }
  .tk-match-l { min-width: 0; width: 100%; }
  .tk-doc-body { flex-direction: column; }
  .tk-doc-guide { grid-template-columns: 1fr; }
}

/* ── 3D-сцена симуляции (assets/truckers-3d.js): вид с места водителя ── */
.tk3d-wrap { display: flex; flex-direction: column; gap: 6px; }
.tk3d-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #1a1d24; }
/* слои самой сцены (.tk3d, .tk3d-bg, .tk3d-car…) стилизует модуль truckers-3d.js — здесь их нет */
/* знак или табло — во весь кадр поверх сцены: голос инспектора за кадром */
.tk3d-sign { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 4%; background: rgba(10, 12, 16, .82); z-index: 3; }
.tk3d-sign[hidden] { display: none; }
.tk3d-sign svg { max-width: 92%; max-height: 92%; width: auto; height: auto; }
.tk3d-sign.is-hidden svg { visibility: hidden; }
/* поверх сцены: её фон и рисунок кабины появляются раньше, чем модель догрузится */
.tk3d-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; z-index: 5; color: #c8cfdc; background: rgba(12, 15, 22, .78); font-size: 14px; text-align: center; padding: 12px; }
.tk3d-load .tk3d-bar { width: min(220px, 60%); height: 6px; border-radius: 3px; background: #2a3550; overflow: hidden; }
.tk3d-load .tk3d-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.tk3d-load[hidden] { display: none; }
.tk3d-credit { font-size: 12px; color: var(--text3); }
.tk3d-credit a { color: var(--text3); }
.tk3d-opt { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text2); cursor: pointer; }
.tk3d-opt input { margin-top: 3px; accent-color: var(--accent); }
.tk3d-opt b { color: var(--text); font-weight: 600; }
.tk3d-sign .tk-sign-live { width: 100%; height: 100%; min-height: 0; padding: 0; background: none; }
/* знак крупно: SVG с viewBox вписывается в рамку 60 % × 78 % кадра, пропорции сохраняются */
.tk3d-sign .tk-sign { width: 60%; height: 78%; max-width: none; max-height: none; margin: 0 auto; }
.tk3d-wrap { scroll-margin-top: 76px; }
.tk3d-frame { max-height: 60vh; }

/* hidden обязан скрывать: .tk-typerow, .tk-answer-row и др. задают display: flex и иначе перебивали бы его */
.tk-page [hidden] { display: none !important; }


/* ── полноэкранный режим симуляции (truckers.js, fullscreen()) ──
   Сцена — во весь экран, без своих пропорций (truckers-3d.js заполняет кадр любой формы); управление
   лежит поверх неё: сверху ~12 % — часть, вопрос, таймер, карточка рейса, выход; снизу ~28 % —
   микрофон и кнопки ответа. Середину кадра truckers-3d.js держит для лица инспектора. Отступы — с
   учётом вырезов экрана (env(safe-area-inset-*)), высота — dvh (адресная строка телефона). */
.tk3d-fsbtn { position: absolute; z-index: 6; width: 44px; height: 44px; inset: 8px 8px auto auto;
  display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(10, 12, 16, .55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.tk3d-fsbtn:hover { background: rgba(10, 12, 16, .8); }
.tk-app.tk-fs { position: relative; margin: 0; padding: 0; border: 0; border-radius: 0; gap: 0; width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; overflow: hidden; background: #000; color: var(--text); display: block; }
.tk-app.tk-fs-pseudo { position: fixed; inset: 0; z-index: 2147483000; }
/* ИСКЛЮЧЕНИЕ из правила «никогда overflow: hidden на html/body» (оно ломает position: sticky):
   класс стоит, только пока симуляция закрывает всё окно (iPhone, где нет полноэкранного режима
   для элемента), — липкой шапки под ней в это время не видно, а по выходе класс снимается. Без
   него страница под симуляцией прокручивается пальцем. */
html.tk-fs-lock, html.tk-fs-lock body { overflow: hidden; }
.tk-fs .tk3d-wrap { position: absolute; inset: 0; display: block; }
.tk-fs .tk3d-frame { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; max-height: none; border-radius: 0; }
.tk-fs .tk3d-credit { display: none; }
/* кадр и обёртка не создают своих слоёв: кнопка выхода (z 6) — над управлением (z 5), загрузка — под ним */
.tk-fs .tk3d-load { z-index: 1; }
.tk-fs .tk3d-fsbtn { inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) auto auto; }
.tk-fs .tk-app-live { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; color: var(--text); }
.tk-fs .tk-app-live > * { pointer-events: auto; }

/* верх: где мы и сколько осталось; справа — карточка рейса и место под кнопку выхода */
.tk-fs .tk-sim-top { position: absolute; top: 0; left: 0; right: 0; flex-wrap: nowrap; justify-content: space-between; gap: 10px; min-height: 60px;
  padding: max(8px, env(safe-area-inset-top)) calc(max(8px, env(safe-area-inset-right)) + 54px) 10px max(14px, env(safe-area-inset-left));
  background: linear-gradient(rgba(6, 8, 12, .82), rgba(6, 8, 12, .55) 70%, rgba(6, 8, 12, 0)); color: #fff; pointer-events: none; }
.tk-fs .tk-sim-top > * { pointer-events: auto; }
.tk-fs .tk-sim-where { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.tk-fs .tk-sim-where h3 { font-size: 13px; font-weight: 600; color: #c9d1de; }
.tk-fs .tk-sim-slot .tk-q-head { flex-wrap: wrap; gap: 0 12px; font-size: 16px; color: #fff; align-items: baseline; }
.tk-fs .tk-sim-slot .tk-q-head > * { white-space: nowrap; }
.tk-fs .tk-sim-slot .tk-timer { font-size: 18px; color: #ffbd59; }
.tk-fs .tk-sim-top .tk-card { flex: none; width: auto; margin: 0; border: 0; background: none; }
.tk-fs .tk-sim-top .tk-card > summary { display: flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 10px; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 12, 16, .55); color: #fff; list-style: none; }
.tk-fs .tk-sim-top .tk-card > summary::-webkit-details-marker { display: none; }
.tk-fs .tk-sim-top .tk-card[open] > summary { background: var(--accent); border-color: var(--accent); }
.tk-fs .tk-sim-top .tk-card-k { color: inherit; }
.tk-fs .tk-peek-hint { display: none; }
/* карточка рейса — выезжающая панель справа, до полосы ответа (её кнопки остаются под рукой);
   каждый взгляд по-прежнему считается (toggle у details) */
.tk-fs .tk-card-body { position: fixed; z-index: 7; top: calc(max(8px, env(safe-area-inset-top)) + 58px); right: max(8px, env(safe-area-inset-right));
  width: min(380px, calc(100vw - 16px)); max-height: calc(74dvh - max(8px, env(safe-area-inset-top)) - 62px); overflow-y: auto; overscroll-behavior: contain;
  padding-top: 14px; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 14px 44px rgba(0, 0, 0, .55);
  animation: tk-panel-in .2s ease-out; }
.tk-fs .tk-card-body .tk-card-grid { grid-template-columns: 1fr; }
@keyframes tk-panel-in { from { transform: translateX(28px); opacity: 0; } }

/* низ: полупрозрачная полоса ответа */
.tk-fs .tk-sim-area { position: absolute; left: 0; right: 0; bottom: 0; max-height: 50%; overflow-y: auto; overscroll-behavior: contain; gap: 10px;
  padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(8, 10, 14, .76); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid rgba(255, 255, 255, .08); }
.tk-fs .tk-sim-area > * { width: 100%; max-width: 980px; margin: 0 auto; }
.tk-fs .tk-sim-area > .tk-btn { width: auto; }
.tk-fs .tk-sim-area > .tk-tip { text-align: center; }
.tk-fs .tk-sim-area .tk-q-live { gap: 8px; }
.tk-fs .tk-sim-area .tk-heard p { overflow-wrap: anywhere; }
@media (orientation: landscape) {
  .tk-fs .tk-talk { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .tk-fs .tk-talk .tk-typerow { grid-column: 1 / -1; }
  .tk-fs .tk-talk .tk-answer-row { justify-content: flex-end; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .tk-fs .tk-sim-top { min-height: 52px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .tk-fs .tk3d-fsbtn { inset: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) auto auto; }
  .tk-fs .tk-sim-area { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .tk-fs .tk-mic { width: 52px; height: 52px; font-size: 24px; }
  .tk-fs .tk-talk-main { min-height: 52px; }
}

/* знак или табло — в свободной середине кадра, не под полосами управления */
.tk-fs .tk3d-sign { padding: max(13dvh, calc(env(safe-area-inset-top) + 64px)) 4% 29dvh; }

/* карточка перед интервью и итог — листы поверх сцены, прокручиваются сами */
.tk-fs .tk-sim-card, .tk-fs .tk-sim-sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  border-radius: 16px 16px 0 0; background: color-mix(in srgb, var(--surface) 95%, transparent); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); }
.tk-fs .tk-sim-card { width: min(680px, 100%); max-height: 84%; }
.tk-fs .tk-sim-fsoffer { display: none; }
/* итог выезжает, когда инспектор договорил своё «free to go» / «out of service» и видно его лицо */
.tk-fs .tk-sim-sheet { width: min(760px, 100%); top: max(12%, calc(env(safe-area-inset-top) + 60px)); animation: tk-sheet-in .45s cubic-bezier(.2, .8, .2, 1) 2s both; }
@keyframes tk-sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .tk-fs .tk-sim-sheet, .tk-fs .tk-card-body { animation: none; } }

/* ── подсказки «что делать» в тренажёре ── */
.tk-how { margin-bottom: 12px; color: var(--text2); font-size: 15px; }
.tk-hint { font-size: 14.5px; font-weight: 500; color: var(--text); }
.tk-say { font-size: 14.5px; color: var(--text2); min-height: 1.5em; }
.tk-say:empty { display: none; }
.tk-say .tk-tr { margin-inline-start: 0; }

/* ── интерфейс справа налево (ar, he, ur) ──
   Отступы и рамки выше записаны логическими свойствами (inline-start / inline-end), поэтому сами
   встают с нужной стороны. Здесь — только то, чего логические свойства не решают.
   АНГЛИЙСКОЕ ВСЕГДА СЛЕВА НАПРАВО И ИЗОЛИРОВАНО: иначе точка или вопросительный знак в конце
   английской фразы уходит в её начало («.Here is my CDL») — алгоритм направления отдаёт конечный
   нейтральный знак направлению абзаца. Та же ловушка, что в уроках общего курса (course.md).
   Образцы документов и знаки — английские целиком. Короткие строки, которые бывают и английскими,
   и на языке читателя (варианты ответа, пары, части фразы), берут направление по своему первому
   слову (plaintext); абзацам этого давать нельзя — абзац на языке читателя может начинаться с
   английского слова и целиком ушёл бы влево. */
[dir="rtl"] .tk-page [lang^="en"],
[dir="rtl"] .tk-page :is(.tk-doc, .tk-sign, .tk-signs-row, .tk-guide) { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .tk-page :is(dd, p, div, li)[lang^="en"] { text-align: end; }
[dir="rtl"] .tk-page :is(.tk-opt, .tk-match-l, .tk-chip, .tk-built, .tk-select, .tk-select option, .tk-heard) { unicode-bidi: plaintext; }
[dir="rtl"] .tk-skill { border-radius: 10px 0 0 10px; }
/* стрелки «предыдущий / следующий урок» смотрят туда же, куда листается страница */
[dir="rtl"] .tk-pager [aria-hidden="true"] { display: inline-block; transform: scaleX(-1); }
