/* ════════════════════════════════════════════════════════════════
   TEXTBOOK — SHELL (модалка, навигация, шапка, BASE/PRO/SUPER, CTA)
   Разметка — TextbookModal в assets/js/modules/textbook.js.
   Всё под .textbook-overlay.tb-shell: speaking-textbook (voice-trainer)
   делит textbook.css и классы .textbook-*, его этот файл не трогает.
   Контент глав (дети #tb-content) — textbook-content.css (--tbc-*).
   Язык дизайна — Mixed Tenses UI v2 (mt-v2.css): токены, Nunito,
   оттенок = время (Present teal / Past amber / Future indigo / If rose),
   глиф = аспект (● ∿ ✓ ✓∿), кнопки с 4px-кромкой.
   Тема: светлая по умолчанию; тёмная — prefers-color-scheme (если хост
   не поставил data-theme="light") или html[data-theme="dark"].
   Телефон (<768px): полноэкранный лист — шапка, вкладки времён, ряд
   чипов-аспектов, прокрутка, CTA с safe-area. ≥768px — две панели.
   ════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ═════════════ TOKENS ═════════════ */
.textbook-overlay.tb-shell {
  --tb-font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tbs-ease: cubic-bezier(.22, 1, .36, 1);
  --tbs-safe-b: env(safe-area-inset-bottom, 0px);
  --tbs-safe-t: env(safe-area-inset-top, 0px);
  --tbs-safe-l: env(safe-area-inset-left, 0px);
  --tbs-safe-r: env(safe-area-inset-right, 0px);
  --tbs-vh: 100vh;

  --tbs-bg: #F6F5FB; --tbs-surface: #FFFFFF; --tbs-surface-2: #F1EFF8;
  --tbs-line: #E4E1EF; --tbs-line-strong: #CDC8DF;
  --tbs-text: #1D1A2E; --tbs-muted: #5D5873; --tbs-icon: #7A7591;
  --tbs-brand: #6B3FE8; --tbs-brand-edge: #4A22B5; --tbs-on-brand: #FFFFFF;
  --tbs-pro: #F4B400; --tbs-pro-edge: #C98F00; --tbs-on-pro: #2E2100;
  --tbs-super: #8B5CF6; --tbs-on-super: #FFFFFF;
  --tbs-present: #0F9480; --tbs-present-ink: #0A6B5D;
  --tbs-past: #E07B00;    --tbs-past-ink: #9A4D00;
  --tbs-future: #3D5BD9;  --tbs-future-ink: #2D45B0;
  --tbs-cond: #D6336C;    --tbs-cond-ink: #A61E4D;
  --tbs-focus: #6B3FE8;
  --tbs-scrim: rgba(20, 16, 36, .45);
  --tbs-sh-1: 0 1px 2px rgba(29, 26, 46, .06), 0 1px 1px rgba(29, 26, 46, .04);
  --tbs-sh-3: 0 2px 6px rgba(29, 26, 46, .06), 0 18px 40px -8px rgba(29, 26, 46, .18);
  --tbs-h: var(--tbs-brand); --tbs-hi: var(--tbs-brand-edge);
  color-scheme: light;
}
@supports (height: 100dvh) { .textbook-overlay.tb-shell { --tbs-vh: 100dvh; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .textbook-overlay.tb-shell {
    --tbs-bg: #121119; --tbs-surface: #1C1B26; --tbs-surface-2: #262433;
    --tbs-line: #322F42; --tbs-line-strong: #47435B;
    --tbs-text: #F2F0FA; --tbs-muted: #ABA7C0; --tbs-icon: #9590AD;
    --tbs-brand: #7C4DFF; --tbs-brand-edge: #4F27D0;
    --tbs-pro: #FFC933; --tbs-pro-edge: #B88A00; --tbs-on-pro: #2E2100;
    --tbs-super: #A78BFA; --tbs-on-super: #1D1A2E;
    --tbs-present: #2FC7AC; --tbs-present-ink: #72E3CE;
    --tbs-past: #F59E2B;    --tbs-past-ink: #FFC57C;
    --tbs-future: #7B93FF;  --tbs-future-ink: #B0BCFF;
    --tbs-cond: #F06595;    --tbs-cond-ink: #FFA8C5;
    --tbs-focus: #BBA6FF;
    --tbs-scrim: rgba(0, 0, 0, .6);
    --tbs-sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --tbs-sh-3: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 44px -8px rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .textbook-overlay.tb-shell {
  --tbs-bg: #121119; --tbs-surface: #1C1B26; --tbs-surface-2: #262433;
  --tbs-line: #322F42; --tbs-line-strong: #47435B;
  --tbs-text: #F2F0FA; --tbs-muted: #ABA7C0; --tbs-icon: #9590AD;
  --tbs-brand: #7C4DFF; --tbs-brand-edge: #4F27D0;
  --tbs-pro: #FFC933; --tbs-pro-edge: #B88A00; --tbs-on-pro: #2E2100;
  --tbs-super: #A78BFA; --tbs-on-super: #1D1A2E;
  --tbs-present: #2FC7AC; --tbs-present-ink: #72E3CE;
  --tbs-past: #F59E2B;    --tbs-past-ink: #FFC57C;
  --tbs-future: #7B93FF;  --tbs-future-ink: #B0BCFF;
  --tbs-cond: #F06595;    --tbs-cond-ink: #FFA8C5;
  --tbs-focus: #BBA6FF;
  --tbs-scrim: rgba(0, 0, 0, .6);
  --tbs-sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --tbs-sh-3: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 44px -8px rgba(0, 0, 0, .65);
  color-scheme: dark;
}

/* Оттенок времени: открытая глава (data-group на оверлее) и элементы навигации */
.tb-shell[data-group="present"],      .tb-shell [data-g="present"]      { --tbs-h: var(--tbs-present); --tbs-hi: var(--tbs-present-ink); }
.tb-shell[data-group="past"],         .tb-shell [data-g="past"]         { --tbs-h: var(--tbs-past);    --tbs-hi: var(--tbs-past-ink); }
.tb-shell[data-group="future"],       .tb-shell [data-g="future"]       { --tbs-h: var(--tbs-future);  --tbs-hi: var(--tbs-future-ink); }
.tb-shell[data-group="conditionals"], .tb-shell [data-g="conditionals"] { --tbs-h: var(--tbs-cond);    --tbs-hi: var(--tbs-cond-ink); }

/* ═════════════ OVERLAY ═════════════ */
html.tb-open, html.tb-open body { overflow: hidden; }

.textbook-overlay.tb-shell {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  background: var(--tbs-scrim);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  font-family: var(--tb-font);
  color: var(--tbs-text);
  line-height: 1.5;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.textbook-overlay.tb-shell.active {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity .22s ease, visibility 0s;
}
.tb-shell *, .tb-shell *::before, .tb-shell *::after { box-sizing: border-box; }
.tb-shell button { font-family: inherit; }
.tb-shell :focus-visible { outline: 3px solid var(--tbs-focus); outline-offset: 2px; }
.tb-shell #tb-title:focus, .tb-shell #tb-content:focus { outline: none; }
.tb-shell .tbs-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ═════════════ КАРКАС: телефон — один столбец ═════════════ */
.textbook-overlay.tb-shell .textbook-container {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head" "switch" "side" "content" "foot";
  width: 100%; max-width: none;
  height: var(--tbs-vh);
  margin: 0;
  background: var(--tbs-bg);
  border: 0; border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform .32s var(--tbs-ease);
}
.textbook-overlay.tb-shell.active .textbook-container { transform: none; }

/* ═════════════ ШАПКА ═════════════ */
.tb-shell .tbs-head {
  grid-area: head;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--tbs-safe-t)) max(12px, var(--tbs-safe-r)) 10px max(16px, var(--tbs-safe-l));
  background: var(--tbs-surface);
  position: relative; z-index: 2;
}
.tb-shell .tbs-title { flex: 1 1 auto; min-width: 0; }
.tb-shell .tbs-eyebrow {
  display: none; /* телефон: время уже видно во вкладках */
  margin: 0; font-size: .8125rem; font-weight: 800; line-height: 1.2;
  color: var(--tbs-hi); letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-shell #tb-title {
  margin: 0;
  font-size: 1.1875rem; font-weight: 900; line-height: 1.15; letter-spacing: -.01em;
  color: var(--tbs-text);
  background: none; -webkit-text-fill-color: currentColor; text-shadow: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}

/* BASE / PRO / SUPER — сегменты */
.tb-shell .tbs-modes {
  flex: none;
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 12px; background: var(--tbs-surface-2);
  border: 1px solid var(--tbs-line);
}
.tb-shell .tbs-mode {
  min-width: 42px; min-height: 36px; padding: 0 9px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--tbs-muted); font-size: .8125rem; font-weight: 900; letter-spacing: .03em; text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.tb-shell .tbs-mode[aria-checked="true"] { background: var(--tbs-surface); color: var(--tbs-text); box-shadow: var(--tbs-sh-1); }
.tb-shell .tbs-mode[data-level="1"][aria-checked="true"] { background: var(--tbs-pro); color: var(--tbs-on-pro); box-shadow: 0 2px 0 var(--tbs-pro-edge); }
.tb-shell .tbs-mode[data-level="2"][aria-checked="true"] { background: var(--tbs-super); color: var(--tbs-on-super); box-shadow: 0 2px 0 color-mix(in oklab, var(--tbs-super) 70%, #000); }
@keyframes tbsProPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 180, 0, 0); transform: none; }
  35%      { box-shadow: 0 0 0 5px rgba(244, 180, 0, .55); transform: scale(1.05); }
}
.tb-shell .tbs-modes.pro-hint-pulse { animation: tbsProPulse .7s ease 2; }
.tb-shell .tbs-modes.pro-hint-pulse .tbs-mode[data-level="1"] { color: var(--tbs-text); }

.tb-shell .tbs-close {
  flex: none;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 999px;
  background: var(--tbs-surface-2); color: var(--tbs-text);
  cursor: pointer;
  transition: transform .09s ease, background-color .15s;
}
.tb-shell .tbs-close:active { transform: scale(.94); }

/* ═════════════ ПЕРЕКЛЮЧАТЕЛЬ ВРЕМЁН (телефон) ═════════════ */
.tb-shell .tbs-switch {
  grid-area: switch;
  padding: 0 max(16px, var(--tbs-safe-r)) 8px max(16px, var(--tbs-safe-l));
  background: var(--tbs-surface);
}
.tb-shell .tbs-tabs {
  display: flex; gap: 2px; padding: 3px;
  border-radius: 14px; background: var(--tbs-surface-2);
}
.tb-shell .tbs-tab {
  flex: 1 1 0; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 40px; padding: 0 6px;
  border: 0; border-radius: 11px; background: transparent;
  color: var(--tbs-muted); font-size: .9375rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.tb-shell .tbs-tab[aria-selected="true"] { background: var(--tbs-surface); color: var(--tbs-hi); box-shadow: var(--tbs-sh-1); }
.tb-shell .tbs-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--tbs-h);
}
.tb-shell .tbs-tab .tbs-lock { font-size: .75rem; margin-left: 0; }
.tb-shell .tbs-tab:not(.is-locked) .tbs-lock { display: none; }

/* ═════════════ НАВИГАЦИЯ ═════════════ */
.tb-shell .tbs-side {
  grid-area: side;
  min-width: 0; min-height: 0;
  background: var(--tbs-surface);
  border-bottom: 1px solid var(--tbs-line);
  position: relative; z-index: 1;
}
.tb-shell .tbs-brand { display: none; }
.tb-shell .tbs-nav { margin: 0; }

/* телефон: только ряд чипов выбранного времени */
.tb-shell .tbs-group { display: none; }
.tb-shell .tbs-group.is-shown { display: block; }
.tb-shell .tbs-group-label { display: none; }
.tb-shell .tbs-items {
  display: flex; gap: 8px;
  padding: 2px max(16px, var(--tbs-safe-r)) 10px max(16px, var(--tbs-safe-l));
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.tb-shell .tbs-items::-webkit-scrollbar { display: none; }
.tb-shell .tbs-item {
  flex: none; scroll-snap-align: start; position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 0 14px 0 6px;
  border: 2px solid var(--tbs-line); border-radius: 999px;
  background: var(--tbs-surface); color: var(--tbs-text);
  font-size: .9375rem; font-weight: 800; line-height: 1.1; text-align: left;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.tb-shell .tbs-glyph {
  flex: none; display: inline-grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 4px; border-radius: 999px;
  background: color-mix(in oklab, var(--tbs-h) 16%, var(--tbs-surface));
  color: var(--tbs-hi); font-size: .8125rem; font-weight: 900; line-height: 1;
}
.tb-shell .tbs-item[aria-current="page"] {
  border-color: var(--tbs-h); color: var(--tbs-hi);
  background: color-mix(in oklab, var(--tbs-h) 12%, var(--tbs-surface));
}
.tb-shell .tbs-item[aria-current="page"] .tbs-glyph { background: var(--tbs-h); color: var(--tbs-surface); }
.tb-shell .tbs-item-full { /* телефон: видна короткая подпись, полная — для скринридера */
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.tb-shell .tbs-item-short { display: inline; }

/* замок PRO */
.tb-shell .tbs-lock { font-size: .8125rem; margin-left: auto; }
.tb-shell .tbs-item:not(.is-locked) .tbs-lock { display: none; }
.tb-shell .tbs-item.is-locked { color: var(--tbs-muted); border-style: dashed; cursor: not-allowed; }
.tb-shell .tbs-item.is-locked .tbs-glyph { background: var(--tbs-surface-2); color: var(--tbs-muted); }
.tb-shell .tbs-lock-pill {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: auto; padding: 2px 8px; border-radius: 999px;
  background: var(--tbs-pro); color: var(--tbs-on-pro);
  font-size: .6875rem; font-weight: 900; letter-spacing: .04em;
}
.tb-shell .textbook-container.pro-mode-active .tbs-lock-pill { display: none; }

/* подсказка «нужен PRO» */
.tb-shell .tbs-toast {
  position: absolute; z-index: 5;
  left: 50%; top: 8px; transform: translate(-50%, -8px);
  width: max-content; max-width: calc(100% - 32px);
  margin: 0; padding: 10px 14px; border-radius: 14px;
  background: var(--tbs-text); color: var(--tbs-surface);
  font-size: .875rem; font-weight: 800; line-height: 1.3; text-align: center;
  box-shadow: var(--tbs-sh-3);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s, transform .2s var(--tbs-ease), visibility 0s linear .2s;
}
.tb-shell .tbs-toast.is-on {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
  transition: opacity .2s, transform .2s var(--tbs-ease), visibility 0s;
}

/* ═════════════ ОБЛАСТЬ ПРОКРУТКИ ═════════════ */
.textbook-overlay.tb-shell .textbook-content {
  grid-area: content;
  min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 16px max(16px, var(--tbs-safe-r)) 24px max(16px, var(--tbs-safe-l));
  background: var(--tbs-bg);
  color: var(--tbs-text);
  transition: opacity .15s;
}
.tb-shell .textbook-container.is-loading .textbook-content { opacity: .45; }
.tb-shell .textbook-container.is-scrolled .tbs-side,
.tb-shell .textbook-container.is-scrolled .tbs-head { box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .35); }

/* ═════════════ CTA ═════════════ */
.tb-shell .tbs-foot {
  grid-area: foot;
  display: flex; justify-content: flex-end;
  padding: 10px max(16px, var(--tbs-safe-r)) calc(12px + var(--tbs-safe-b)) max(16px, var(--tbs-safe-l));
  background: var(--tbs-surface);
  border-top: 1px solid var(--tbs-line);
}
.tb-shell .tbs-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; margin: 0 0 4px; padding: 0 20px;
  border: 0; border-radius: 16px;
  background: var(--tbs-brand); color: var(--tbs-on-brand);
  box-shadow: 0 4px 0 var(--tbs-brand-edge);
  font-size: 1.0625rem; font-weight: 900; line-height: 1.2; letter-spacing: .01em;
  cursor: pointer;
  transition: transform .09s ease, box-shadow .09s ease, background-color .15s;
}
.tb-shell .tbs-cta:active { transform: translateY(4px); box-shadow: 0 0 0 transparent; }
@media (hover: hover) {
  .tb-shell .tbs-cta:hover { background: color-mix(in oklab, var(--tbs-brand) 88%, #fff); }
  .tb-shell .tbs-close:hover { background: var(--tbs-line); }
  .tb-shell .tbs-mode:hover:not([aria-checked="true"]) { color: var(--tbs-text); }
  .tb-shell .tbs-item:hover:not([aria-current="page"]):not(.is-locked) { border-color: var(--tbs-line-strong); }
}

/* узкий телефон: компактнее сегменты */
@media (max-width: 374px) {
  .tb-shell .tbs-mode { min-width: 36px; padding: 0 6px; font-size: .75rem; }
  .tb-shell .tbs-tab { font-size: .875rem; gap: 4px; }
}

/* ═════════════ ≥768px — две панели ═════════════ */
@media (min-width: 768px) {
  .textbook-overlay.tb-shell { padding: 24px; }
  .textbook-overlay.tb-shell .textbook-container {
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "side head" "side content" "side foot";
    width: 100%; max-width: 1120px;
    height: min(880px, calc(var(--tbs-vh) - 48px));
    border-radius: 24px;
    border: 1px solid var(--tbs-line);
    box-shadow: var(--tbs-sh-3);
  }
  .tb-shell .tbs-switch { display: none; }

  .tb-shell .tbs-head {
    padding: 18px 20px 16px 28px; gap: 16px;
    border-bottom: 1px solid var(--tbs-line);
  }
  .tb-shell .tbs-eyebrow { display: block; }
  .tb-shell #tb-title { font-size: 1.625rem; -webkit-line-clamp: 1; }
  .tb-shell .tbs-mode { min-width: 56px; min-height: 38px; padding: 0 12px; font-size: .8125rem; }

  .tb-shell .tbs-side {
    display: flex; flex-direction: column;
    border-bottom: 0; border-right: 1px solid var(--tbs-line);
    padding: 18px 12px 12px;
    overflow: hidden;
  }
  .tb-shell .tbs-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 14px;
    font-size: 1.0625rem; font-weight: 900; color: var(--tbs-text);
  }
  .tb-shell .tbs-brand-ic {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border-radius: 11px; background: var(--tbs-surface-2); font-size: 1.1rem;
  }
  .tb-shell .tbs-nav {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 2px 8px;
    scrollbar-width: thin; scrollbar-color: var(--tbs-line-strong) transparent;
  }
  .tb-shell .tbs-group, .tb-shell .tbs-group.is-shown { display: block; margin-bottom: 14px; }
  .tb-shell .tbs-group-label {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; margin: 0;
    font-size: .875rem; font-weight: 900; color: var(--tbs-text);
  }
  .tb-shell .tbs-group-label small { font-size: .75rem; font-weight: 700; color: var(--tbs-muted); }
  .tb-shell .tbs-items { display: grid; gap: 2px; padding: 0; overflow: visible; }
  .tb-shell .tbs-item {
    width: 100%; min-height: 44px; padding: 0 10px 0 8px;
    border: 0; border-radius: 12px; background: transparent;
    font-size: .9375rem; font-weight: 700; white-space: normal;
    position: relative;
  }
  .tb-shell .tbs-item[aria-current="page"] {
    background: color-mix(in oklab, var(--tbs-h) 14%, var(--tbs-surface));
    color: var(--tbs-hi); font-weight: 900;
  }
  .tb-shell .tbs-item[aria-current="page"]::before {
    content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--tbs-h);
  }
  .tb-shell .tbs-item.is-locked { border-style: none; }
  .tb-shell .tbs-item-full { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .tb-shell .tbs-item-short { display: none; }

  .textbook-overlay.tb-shell .textbook-content {
    padding: 24px max(28px, calc((100% - 760px) / 2)) 32px;
  }
  .tb-shell .tbs-toast { top: 84px; left: calc(50% + 118px); }

  .tb-shell .tbs-foot { padding: 14px 28px 16px; }
  .tb-shell .tbs-cta { width: auto; min-width: 300px; }
  @media (hover: hover) {
    .tb-shell .tbs-item:hover:not([aria-current="page"]):not(.is-locked) { background: var(--tbs-surface-2); }
  }
}
@media (min-width: 1100px) {
  .textbook-overlay.tb-shell .textbook-container { grid-template-columns: 260px minmax(0, 1fr); }
  .tb-shell .tbs-toast { left: calc(50% + 130px); }
}

/* низкий альбомный телефон: шапка и CTA не съедают экран */
@media (max-height: 520px) and (min-width: 768px) {
  .textbook-overlay.tb-shell { padding: 0; }
  .textbook-overlay.tb-shell .textbook-container { height: var(--tbs-vh); max-width: none; border-radius: 0; border: 0; }
  .tb-shell .tbs-head { padding-top: 8px; padding-bottom: 8px; }
  .tb-shell #tb-title { font-size: 1.25rem; }
  .tb-shell .tbs-foot { padding-top: 8px; padding-bottom: calc(8px + var(--tbs-safe-b)); }
  .tb-shell .tbs-cta { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .textbook-overlay.tb-shell,
  .textbook-overlay.tb-shell .textbook-container,
  .tb-shell .tbs-toast { transition: none; }
  .tb-shell .tbs-modes.pro-hint-pulse { animation: none; outline: 3px solid var(--tbs-pro); }
  .textbook-overlay.tb-shell .textbook-content { scroll-behavior: auto; }
}
