/* ================= «Мой арабский» на iPhone (и в браузере на телефоне) ================= */
body.mobile {
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  /* место под плавающей панелью вкладок: её высота и отступ от низа экрана */
  --tab-h: 62px; --tab-gap: max(10px, calc(var(--safe-b) - 6px)); --tab-space: calc(var(--tab-h) + var(--tab-gap) + 28px);
  font-size: 15px; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  touch-action: manipulation; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.mobile .book-page, body.mobile .textLayer, body.mobile input, body.mobile textarea, body.mobile .dict-entry, body.mobile .pp-ar, body.mobile .vw-context {
  -webkit-user-select: text; user-select: text; -webkit-touch-callout: default;
}
/* полоса под статус-баром всегда закрашена */
body.mobile::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: var(--bar-solid); z-index: 1500; pointer-events: none; }
body.mobile #topbar { display: none; }
body.mobile #app { height: 100%; }
body.mobile ::-webkit-scrollbar { display: none; }

/* ---------- вкладки: «таблетка» поверх содержимого, полупрозрачная, с размытием (как в iOS) ---------- */
#tabbar { display: none; }
body.mobile #tabbar { position: fixed; z-index: 60; left: 0; right: 0; bottom: var(--tab-gap); margin: 0 auto; width: min(440px, calc(100% - 24px - var(--safe-l) - var(--safe-r)));
  height: var(--tab-h); display: flex; gap: 2px; padding: 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 74%, transparent); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--hair); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 32px rgba(20, 28, 24, .16); }
body.mobile.theme-dark #tabbar { background: color-mix(in srgb, var(--panel-2) 80%, transparent); border-color: rgba(255, 255, 255, .09); box-shadow: 0 10px 32px rgba(0, 0, 0, .55); }
body.mobile[data-view="reader"] #tabbar { display: none; }
/* панель лежит поверх содержимого: прокрутка к элементу (фокус, поиск) оставляет его над панелью */
body.mobile .library, body.mobile .vocab, body.mobile .practice { scroll-padding-bottom: var(--tab-space); }
.tab-btn { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border: 0; border-radius: 999px;
  background: none; color: var(--ink-2); font-size: 10.5px; font-weight: 600; letter-spacing: -.01em; cursor: pointer; transition: background-color .2s, color .2s, transform .12s; }
.tab-btn .ic { width: 23px; height: 23px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab-btn.on { background: var(--accent-soft); color: var(--accent); }
.tab-btn:active { transform: scale(.95); }
.tab-btn .nav-badge { position: absolute; top: 3px; left: calc(50% + 6px); font-size: 10px; min-width: 17px; height: 17px; padding: 0 4px; background: var(--panel-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 80%, transparent); }
.tab-btn .nav-badge.due { background: var(--gold); color: #fff; }

/* крупнее цели для пальца; поля ввода 16px — иначе iOS увеличивает страницу при вводе */
body.mobile .icon-btn { width: 42px; height: 42px; border-radius: 999px; }
body.mobile .btn { height: 44px; padding: 0 18px; font-size: 15px; }
body.mobile .btn.small { height: 36px; font-size: 14px; }
body.mobile .input { height: 44px; font-size: 16px; }
body.mobile textarea.input { font-size: 16px; }
body.mobile select.input { font-size: 16px; }
body.mobile .hover-hint { display: none !important; }

/* ---------- библиотека ---------- */
body.mobile .library { padding: calc(var(--safe-t) + 22px) calc(16px + var(--safe-r)) var(--tab-space) calc(16px + var(--safe-l)); -webkit-overflow-scrolling: touch; }
.lib-hero.m .lib-title { font-size: 34px; letter-spacing: -.034em; }
.lib-hero.m .lib-sub { margin-top: 10px; font-size: 16px; line-height: 1.45; }
.lib-hero.m .lib-hero-actions { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; }
.lib-hero.m .btn { height: 48px; padding: 0 12px; font-size: 15.5px; min-width: 0; }
.lib-hero.m .btn .btn-label { overflow: hidden; text-overflow: ellipsis; }
body.mobile .banner { margin-top: 20px; align-items: flex-start; gap: 12px; padding: 14px; font-size: 14px; flex-wrap: wrap; }
body.mobile .banner-ic { width: 38px; height: 38px; }
body.mobile .banner-ic svg { width: 20px; height: 20px; }
body.mobile .banner-text { flex: 1 1 calc(100% - 60px); }
body.mobile .banner-actions { flex: 1 1 100%; }
body.mobile .banner-actions .btn { flex: 1; }
body.mobile .banner.install { padding-right: 46px; } /* место для крестика в углу */
body.mobile .banner-close { top: 8px; margin-top: 0; right: 6px; }
body.mobile .continue-card { margin-top: 26px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px 14px 14px 14px; border-radius: 20px; }
body.mobile .continue-card:active { transform: scale(.985); }
body.mobile .cc-cover { width: 60px; }
body.mobile .cc-kicker { font-size: 11px; }
body.mobile .cc-title { font-size: 17px; margin-top: 3px; }
body.mobile .cc-title:dir(rtl) { font-size: 20px; }
body.mobile .cc-sub { font-size: 13.5px; }
body.mobile .cc-progress { margin-top: 9px; gap: 8px; }
body.mobile .cc-pct { font-size: 12px; }
body.mobile .cc-meta { display: none; }
/* на телефоне «Продолжить» — круглая кнопка со стрелкой: вся карточка и так нажимается */
body.mobile .cc-go { grid-column: auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
body.mobile .cc-go .btn-label { display: none; }
body.mobile .lib-section { margin-top: 38px; }
body.mobile .sec-head { margin-bottom: 20px; }
body.mobile .sec-title { font-size: 24px; }
body.mobile .sec-sub { font-size: 14.5px; }
body.mobile .shelf { gap: 28px 18px; }
@media (max-width: 600px) { body.mobile .shelf { grid-template-columns: 1fr 1fr; } }
body.mobile .book-card:active .cover { transform: scale(.97); }
body.mobile .bc-title { font-size: 15px; }
body.mobile .card-remove { opacity: .55; width: 34px; height: 34px; margin: -7px -9px 0 0; }

/* ---------- экран чтения ---------- */
/* шапка книги: «‹ Книги» · название · «Аа», луна (и «Ещё» у PDF) */
body.mobile .reader-bar.mobile-bar { min-height: calc(52px + var(--safe-t)); padding: var(--safe-t) calc(4px + var(--safe-r)) 0 calc(2px + var(--safe-l)); gap: 2px; }
body.mobile .rb-back { height: 44px; padding: 0 8px 0 2px; font-size: 17px; }
body.mobile .rb-back:hover { background: transparent; }
body.mobile .rb-title { font-size: 15.5px; }
body.mobile .rb-title:dir(rtl) { font-size: 18px; }
body.mobile .rb-sub { font-size: 11.5px; margin-top: 1px; }
body.mobile .rb-right { gap: 0; }
body.mobile .rb-btn { width: 40px; height: 44px; }
body.mobile .rb-btn:hover { background: transparent; }
body.mobile .rb-aa { width: 42px; font-size: 19px; }
/* нижняя панель */
body.mobile .reader-nav { padding: 8px calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l)); }
body.mobile .reader-nav-in { gap: 10px; }
body.mobile .nav-arrow { width: 46px; height: 46px; border-radius: 14px; }
body.mobile .nav-toc { width: 42px; height: 42px; border-radius: 12px; }
body.mobile .nav-arrow:hover { background: color-mix(in srgb, var(--ink) 5.5%, transparent); }
body.mobile .nav-pill { flex: 1 1 auto; height: 52px; }
body.mobile .nav-where:hover { background: transparent; }
body.mobile .nav-where:active:not(.single) { background: color-mix(in srgb, var(--ink) 5%, transparent); }
/* «Рамка» для сканов и фото — над нижней панелью справа */
.frame-btn { position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(100% + 10px); height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--hair); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); }
.frame-btn.on { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
body.mobile .text-scroller { padding: 0 0 28px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
body.mobile .book-page { max-width: none; border: 0; border-radius: 0; box-shadow: none; min-height: 100%; padding: 18px calc(18px + var(--safe-r)) 32px calc(18px + var(--safe-l)); text-align: justify; text-align-last: start; }
body.mobile .section-end { padding: 4px 16px 8px; }
body.mobile .pdf-scroller { touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
body.mobile .pdf-scroller.framing, body.mobile .pdf-scroller.framing .pdf-page { touch-action: none; }
body.mobile .pdf-scroller.framing .pdf-page { outline: 2px dashed var(--gold); outline-offset: -2px; }
body.mobile .pdf-column { padding: 8px 6px 30px; gap: 10px; transition: none; }
body.mobile .pdf-page-num { display: none; }
body.mobile .pdf-page.is-scan { cursor: default; }
body.mobile .tip { bottom: 12px; width: calc(100% - 20px); display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 14px 14px 12px; font-size: 14px; }
body.mobile .tip .btn { grid-column: 1 / -1; justify-content: center; height: 40px; }
body.mobile .busy-banner { top: calc(var(--safe-t) + 62px); width: calc(100% - 24px); justify-content: center; font-size: 14px; border-radius: 16px; }
.hl-box { position: fixed; pointer-events: none; z-index: 5; border-radius: 4px; background: var(--active); }
.hl-box.k-hover { background: var(--hover); }

/* ---------- нижняя карточка перевода ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; flex-direction: column; max-height: 62%; background: var(--panel); color: var(--ink);
  border-radius: 26px 26px 0 0; box-shadow: 0 -1px 0 var(--hair), 0 -10px 40px rgba(0, 0, 0, .16); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  transform: translateY(105%); transition: transform .26s cubic-bezier(.2, .8, .2, 1), max-height .24s ease; }
.sheet.open { transform: none; }
.sheet.dragging { transition: none; }
.sheet.expanded { max-height: calc(100% - var(--safe-t) - 16px); }
.sheet-grip { flex: none; height: 22px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.sheet-grip span { width: 40px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 40%, transparent); }
body.mobile .sheet .sheet-close { position: absolute; top: 14px; right: calc(14px + var(--safe-r)); z-index: 2; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); color: var(--muted); }
body.mobile .sheet .sheet-close.in-hero { position: static; width: 40px; height: 40px; }
.sheet .sheet-close:active { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.sheet-body { overflow: auto; padding: 0 16px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; line-height: 1.45; }
.sheet .pp-hero { min-height: 52px; }
.sheet .pp-ar { font-size: 46px; }
.sheet .pp-ar.long { font-size: 38px; }
.sheet .pp-ar.xlong { font-size: 31px; }
.sheet .pp-ar.phrase { font-size: 23px; }
.sheet .pp-tr { font-size: 20px; }
.sheet .pp-tr.phrase { font-size: 17px; }
.sheet .pp-error { padding-right: 40px; }
.sheet .dict-entry { max-height: 30vh; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; font-size: 15px; }
.sheet.expanded .dict-entry { max-height: 58vh; }
.sheet .dict-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
.sheet .dict-tab { flex: none; }
.sheet .pp-actions { position: sticky; bottom: -12px; z-index: 1; background: var(--panel); margin: 12px -16px -12px; padding: 10px 16px 12px; border-top: 1px solid var(--hair); }
.sheet .pp-btn { height: 46px; padding: 0 12px; font-size: 15px; }
.sheet .pp-btn.icon-only { flex-basis: 46px; width: 46px; padding: 0; }
.sheet .dict-search .input { height: 44px; }
.sheet .pp-words { max-height: none; }
/* узкий телефон: «Копировать» — только значком, чтобы кнопки уместились в одну строку */
@media (max-width: 400px) {
  .sheet .pp-btn.copy { flex: 0 0 46px; width: 46px; padding: 0; }
  .sheet .pp-btn.copy .lbl { display: none; }
  .sheet .pp-grid .pp-row { grid-template-columns: 22px minmax(116px, .95fr) minmax(0, 1.05fr); column-gap: 10px; padding: 9px 12px; }
  .sheet .pp-grid .pp-row + .pp-row::before { left: 44px; right: 12px; }
  .sheet .pp-grid .pp-label { font-size: 14px; }
  .sheet .pp-label small { display: block; }
}

/* панель для выделенного текста — над нижней панелью читалки */
.sel-bar { position: fixed; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: calc(var(--safe-b) + 78px); z-index: 1100; display: flex; gap: 8px; padding: 6px;
  background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow-pop); }
.sel-bar-btn { flex: 1; height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 13px; background: var(--panel-2); font-size: 15px; color: var(--ink); }
.sel-bar-btn.primary { flex: 1.6; background: var(--btn); color: var(--btn-ink); font-weight: 600; }

/* меню действий и нижние панели */
.as-overlay { position: fixed; inset: 0; z-index: 2500; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 calc(8px + var(--safe-r, 0px)) calc(8px + var(--safe-b, 0px)) calc(8px + var(--safe-l, 0px));
  background: rgba(0, 0, 0, 0); transition: background .2s; }
.as-overlay.show { background: rgba(0, 0, 0, .36); }
.as-box, .ps-box { transform: translateY(110%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
.as-overlay.show .as-box, .as-overlay.show .ps-box { transform: none; }
.as-box { display: flex; flex-direction: column; gap: 8px; max-height: 88%; }
.as-title { background: var(--panel); border-radius: 16px 16px 0 0; margin-bottom: -8px; padding: 12px 16px 10px; text-align: center; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--hair);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.as-group { background: var(--panel); border-radius: 16px; overflow: auto; }
.as-title + .as-group { border-radius: 0 0 16px 16px; }
.as-item { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 14px; padding: 8px 16px; border: 0; background: none; text-align: left; font-size: 17px; color: var(--accent); }
.as-item + .as-item { border-top: 1px solid var(--hair); }
.as-item:active { background: var(--panel-2); }
.as-item.danger { color: var(--danger); }
.as-ic { flex: none; display: flex; }
.as-label { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.as-label small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.as-check { color: var(--accent); }
.as-cancel { height: 56px; border: 0; border-radius: 16px; background: var(--panel); font-size: 17px; font-weight: 650; color: var(--accent); }
.ps-box { display: flex; flex-direction: column; max-height: 72%; background: var(--panel); border-radius: 22px; overflow: hidden; }
.ps-box.tall { max-height: 86%; }
.ps-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--hair); }
.ps-title { font-weight: 650; font-size: 17px; }
.ps-body { overflow: auto; padding: 16px 18px 20px; -webkit-overflow-scrolling: touch; }
body.mobile .vm-stepper .icon-btn { width: 44px; height: 44px; }
body.mobile .segmented.wide .seg { height: 40px; font-size: 14.5px; }
body.mobile .toc-list { margin: -8px -8px 0; }
body.mobile .toc-item { padding: 12px 10px; border-radius: 0; border-bottom: 1px solid var(--hair); }
body.mobile .toc-item:hover { background: none; }
body.mobile .toc-item.on { border-radius: 12px; border-bottom-color: transparent; }

/* ---------- окна: на iPhone — во весь экран, короткие вопросы — снизу ---------- */
body.mobile .modal-overlay { padding: 0; align-items: flex-end; }
body.mobile .modal, body.mobile .modal.wide { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; border: 0; padding-top: var(--safe-t); box-shadow: none; animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } }
body.mobile .modal.compact { height: auto; border-radius: 26px 26px 0 0; padding-top: 0; }
body.mobile .modal-head { padding: 12px 10px 6px 20px; }
body.mobile .modal-head h2 { font-size: 22px; }
body.mobile .modal-head .icon-btn { width: 34px; height: 34px; }
body.mobile .modal-body { padding: 8px 16px 20px; -webkit-overflow-scrolling: touch; }
body.mobile .modal-actions { padding: 10px 16px calc(12px + var(--safe-b)); background: color-mix(in srgb, var(--panel) 92%, transparent); }
body.mobile .settings-modal .modal-actions { background: var(--bg); }
body.mobile .modal-actions .btn { flex: 1; height: 48px; font-size: 16px; }
body.mobile .settings { gap: 22px; }
body.mobile .set-card { padding: 16px 16px 2px; }
body.mobile .field-row { grid-template-columns: 1fr; gap: 0; }
body.mobile .radio-group { grid-template-columns: 1fr; }
body.mobile .provider-box { padding: 12px 12px 2px; }
body.mobile .radio { font-size: 15px; }
body.mobile .radio input { width: 20px; height: 20px; margin-top: 2px; }
body.mobile .check { font-size: 15px; }
body.mobile .paste-area { min-height: 46vh; font-size: 22px; }
body.mobile .help ul { padding-left: 18px; }
.input.big-num { font-size: 22px; height: 52px; text-align: center; }

/* ---------- мой словарь и карточки ---------- */
body.mobile .vocab { padding: calc(var(--safe-t) + 22px) calc(16px + var(--safe-r)) var(--tab-space) calc(16px + var(--safe-l)); -webkit-overflow-scrolling: touch; }
body.mobile .vocab-head { flex-direction: column; align-items: stretch; gap: 16px; }
body.mobile .vh-title h1 { font-size: 34px; }
body.mobile .vh-count { margin-top: 6px; font-size: 15px; }
body.mobile .vh-actions { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 8px; }
body.mobile .vh-actions .btn { padding: 0 8px; font-size: 14.5px; min-width: 0; }
body.mobile .vh-actions .btn .btn-label { overflow: hidden; text-overflow: ellipsis; }
body.mobile .vocab-filters { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 10px; margin: 20px 0 14px; }
body.mobile .search-box { min-width: 0; }
body.mobile .search-box .input { height: 44px; }
/* фильтры — строкой, которую можно прокрутить вбок */
body.mobile .vf-selects { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-16px - var(--safe-r)) 0 calc(-16px - var(--safe-l)); padding: 2px calc(16px + var(--safe-r)) 6px calc(16px + var(--safe-l)); scrollbar-width: none; }
body.mobile .vocab-filters .select { flex: none; width: auto; max-width: 62vw; height: 38px; font-size: 15px; }
body.mobile .vw { padding: 12px 16px; }
body.mobile .vw + .vw::before { left: 16px; right: 16px; }
body.mobile .vw-main { grid-template-columns: 1fr; gap: 2px; }
body.mobile .vw-ar { text-align: right; font-size: 28px; }
body.mobile .vw-side { justify-content: space-between; margin-top: 4px; }
body.mobile .vw-btns { opacity: 1; margin-right: -8px; }
body.mobile .vw-btns .icon-btn { width: 38px; height: 38px; }
body.mobile .trainer { min-height: 0; }
body.mobile .tr-opts { flex-direction: column; align-items: stretch; }
body.mobile .tr-opts .segmented { display: flex; }
body.mobile .tr-opts .seg { flex: 1; justify-content: center; height: 36px; }
body.mobile .tr-card { padding: 34px 14px 16px; }
body.mobile .tr-ar { font-size: 40px; }
body.mobile .tr-key { display: none; }
body.mobile .tr-actions .btn { height: 50px; padding: 0 30px; font-size: 16px; }
body.mobile .tr-grades { width: 100%; }
body.mobile .tr-grades .btn { flex: 1; justify-content: center; height: 50px; font-size: 15px; padding: 0 6px; }

/* уведомления — сверху, как баннеры iOS (внизу их закрывала бы карточка перевода) */
body.mobile .toasts { top: calc(var(--safe-t) + 12px); bottom: auto; width: calc(100% - 24px); }
body.mobile .toast { transform: translateY(-10px) scale(.98); font-size: 14.5px; border-radius: 18px; padding: 12px 16px; }
body.mobile .toast.show { transform: none; }
body.mobile .center-msg { padding: 20px; text-align: center; }

/* iPad и альбомная ориентация: карточка и текст не растягиваются на всю ширину */
@media (min-width: 720px) {
  body.mobile .book-page { max-width: 860px; margin: 0 auto; }
  body.mobile .reader-nav-in { max-width: 720px; }
  .sheet { left: calc(50% - 320px); right: auto; width: 640px; }
  .sel-bar { left: calc(50% - 300px); right: auto; width: 600px; }
  .as-overlay { align-items: center; }
  .as-box, .ps-box { width: 520px; }
  body.mobile .library, body.mobile .vocab, body.mobile .practice { padding-left: calc(32px + var(--safe-l)); padding-right: calc(32px + var(--safe-r)); }
  .lib-hero.m .lib-hero-actions { display: flex; }
  .lib-hero.m .btn { padding: 0 26px; }
  body.mobile .vh-actions { display: flex; }
  body.mobile .vocab-head { flex-direction: row; align-items: flex-end; }
  body.mobile .vf-selects { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
  body.mobile .modal.compact { width: 480px; margin: 0 auto 24px; border-radius: 26px; }
  body.mobile .modal-overlay:has(.modal.compact) { align-items: flex-end; justify-content: center; }
}

/* ---------- тренировка на iPhone ---------- */
body.mobile .practice { padding: calc(var(--safe-t) + 22px) calc(16px + var(--safe-r)) var(--tab-space) calc(16px + var(--safe-l)); -webkit-overflow-scrolling: touch; }
body.mobile .pr-head { margin-bottom: 20px; }
body.mobile .pr-head h1 { font-size: 34px; }
body.mobile .pr-chip { height: 36px; padding: 0 12px; font-size: 14px; }
body.mobile .pr-hero { grid-template-columns: 1fr; gap: 18px; padding: 22px 20px 20px; border-radius: 24px; }
body.mobile .pr-hero::after { font-size: 220px; bottom: -80px; right: -14px; }
body.mobile .pr-hero h2 { font-size: 25px; }
body.mobile .pr-hero p { font-size: 14.5px; }
body.mobile .pr-hero-words { margin-top: 14px; gap: 6px; }
body.mobile .pr-hero-words span { font-size: 19px; padding: 0 12px; }
body.mobile .pr-start { width: 100%; height: 54px; }
body.mobile .pr-goal { padding: 16px 16px 14px; }
body.mobile .pr-day-dot { width: 34px; height: 34px; }
body.mobile .pr-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
body.mobile .pr-stat { padding: 14px 8px 12px; }
body.mobile .pr-stat b { font-size: 26px; }
body.mobile .pr-more-btn { padding: 12px 14px; }
body.mobile .pr-more-btn + .pr-more-btn::before { left: 70px; }
body.mobile .pr-prefs { padding: 4px 16px; }
body.mobile .pr-pref { flex-direction: column; align-items: stretch; }
body.mobile .pr-pref.check { flex-direction: row; align-items: center; }
body.mobile .pr-pref .segmented { display: flex; }
body.mobile .pr-pref .seg { flex: 1; justify-content: center; padding: 0 4px; font-size: 12.5px; height: 36px; }
body.mobile .lesson { padding-top: var(--safe-t); }
body.mobile .ls-top { padding: 10px 14px 4px; gap: 10px; }
body.mobile .ls-body { padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; }
body.mobile .ls-title { font-size: 22px; margin: 10px 0 16px; }
body.mobile .ls-big { font-size: 42px; }
body.mobile .ls-opt.ar { font-size: 25px; }
body.mobile .ls-num { display: none; }
body.mobile .ls-opt { padding: 10px 14px; text-align: center; }
body.mobile .ls-foot-in { padding: 12px 16px calc(12px + var(--safe-b)); flex-direction: column; align-items: stretch; gap: 10px; }
body.mobile .ls-foot { padding-bottom: 0; }
body.mobile .ls-btn { width: 100%; }
body.mobile .ls-fb:empty { display: none; }
body.mobile .ls-match { gap: 10px; }
body.mobile .ls-pair { font-size: 14.5px; }
body.mobile .ls-tile { min-width: 48px; height: 54px; font-size: 26px; }

/* итоги урока: три плитки в ряд на узком экране */
body.mobile .lr-stats { gap: 8px; }
body.mobile .lr-stat-label { font-size: 10.5px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 12px 4px 0; }
body.mobile .lr-stat-val { font-size: 17px; gap: 4px; padding: 6px 2px 13px; white-space: nowrap; }
body.mobile .lr-stat-val svg { width: 18px; height: 18px; }
