/* ---------- шрифты ---------- */
@font-face { font-family: 'Amiri'; font-weight: 400; font-display: block; src: url(fonts/amiri-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Amiri'; font-weight: 700; font-display: block; src: url(fonts/amiri-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Amiri'; font-weight: 400; font-display: block; src: url(fonts/amiri-latin-400-normal.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; }
@font-face { font-family: 'Amiri'; font-weight: 700; font-display: block; src: url(fonts/amiri-latin-700-normal.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; }
@font-face { font-family: 'Scheherazade New'; font-weight: 400; font-display: block; src: url(fonts/scheherazade-new-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Scheherazade New'; font-weight: 700; font-display: block; src: url(fonts/scheherazade-new-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Scheherazade New'; font-weight: 400; font-display: block; src: url(fonts/scheherazade-new-latin-400-normal.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; }
@font-face { font-family: 'Noto Naskh Arabic'; font-weight: 400; font-display: block; src: url(fonts/noto-naskh-arabic-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Noto Naskh Arabic'; font-weight: 700; font-display: block; src: url(fonts/noto-naskh-arabic-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Noto Naskh Arabic'; font-weight: 400; font-display: block; src: url(fonts/noto-naskh-arabic-latin-400-normal.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; }
/* Арабские буквы внутри русского текста интерфейса — тоже Amiri */
@font-face { font-family: 'KArabic'; font-weight: 400; font-display: block; src: url(fonts/amiri-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'KArabic'; font-weight: 700; font-display: block; src: url(fonts/amiri-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }


/* ---------- темы ----------
   Цвета, шрифты и скругления — как на сайте «Моего арабского» (site/public/style.css):
   зелёный логотипа, тёплый светлый фон, белые карточки со скруглением 20px и мягкими тенями. */
:root {
  --ui-font: 'KArabic', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', 'Noto Sans', Arial, system-ui, sans-serif;
  --ar-font: 'Scheherazade New', 'Amiri', 'Traditional Arabic', serif;
  --ar-size: 28px;
  --ar-line: 2.1;
  --page-width: 880px;
  --scale-round-x: 1px;
  --scale-round-y: 1px;
  --radius: 20px;
  --radius-sm: 14px;
  --serif: ui-serif, 'New York', 'Iowan Old Style', Georgia, 'PT Serif', 'Times New Roman', serif;
  /* орнамент по бокам заголовков глав */
  --orn-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 24'%3E%3Cg fill='black'%3E%3Cpath d='M24 3.2C26.6 6.4 26.6 9.2 24 12C21.4 9.2 21.4 6.4 24 3.2Z'/%3E%3Cpath d='M24 20.8C26.6 17.6 26.6 14.8 24 12C21.4 14.8 21.4 17.6 24 20.8Z'/%3E%3Cpath d='M15.2 12C18.4 9.4 21.2 9.4 24 12C21.2 14.6 18.4 14.6 15.2 12Z'/%3E%3Cpath d='M32.8 12C29.6 9.4 26.8 9.4 24 12C26.8 14.6 29.6 14.6 32.8 12Z'/%3E%3Ccircle cx='19.6' cy='7.6' r='1.05'/%3E%3Ccircle cx='28.4' cy='7.6' r='1.05'/%3E%3Ccircle cx='19.6' cy='16.4' r='1.05'/%3E%3Ccircle cx='28.4' cy='16.4' r='1.05'/%3E%3Cpath d='M7.4 9.9L9.5 12L7.4 14.1L5.3 12Z'/%3E%3Cpath d='M40.6 9.9L42.7 12L40.6 14.1L38.5 12Z'/%3E%3C/g%3E%3Cpath d='M1.2 12H5.6M9.2 12H13.4M34.6 12H38.8M42.4 12H46.8' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
body.theme-light {
  --bg: #f6f6f3; --bar: rgba(246, 246, 243, .82); --bar-solid: #f6f6f3; --panel: #ffffff; --panel-2: #f3f3f0; --paper: #ffffff;
  --ink: #1d1d1f; --ink-2: #424245; --muted: #6e6e73; --line: #e2e2dd; --hair: rgba(0, 0, 0, .07);
  --accent: #0c5b36; --accent-2: #0e6b40; --accent-ink: #fff; --accent-soft: #e4eee7;
  --btn: #0c5b36; --btn-hover: #0e6b40; --btn-ink: #fff;
  --gold: #946b1f; --gold-soft: #f5ecd6; --danger: #b93a2b; --danger-soft: #fbe8e4;
  --head-bg: #edf3ea; --head-line: #d7e3d2; --orn: #8b9858;
  --hover: rgba(226, 172, 52, .26); --active: rgba(12, 91, 54, .17);
  --shadow-sm: 0 1px 2px rgba(20, 28, 24, .05), 0 2px 10px rgba(20, 28, 24, .04);
  --shadow: 0 1px 2px rgba(20, 28, 24, .04), 0 10px 30px rgba(20, 28, 24, .07);
  --shadow-pop: 0 2px 6px rgba(20, 28, 24, .06), 0 18px 50px rgba(20, 28, 24, .16);
  color-scheme: light;
}
/* «Бумага» — тёплая тема для долгого чтения */
body.theme-sepia {
  --bg: #f1ebdf; --bar: rgba(241, 235, 223, .84); --bar-solid: #f1ebdf; --panel: #fcfaf5; --panel-2: #f4eee3; --paper: #fdf9f1;
  --ink: #2b2419; --ink-2: #4a4033; --muted: #857969; --line: #e3d9c7; --hair: rgba(70, 50, 20, .09);
  --accent: #0c5b36; --accent-2: #0e6b40; --accent-ink: #fff; --accent-soft: #e2eadb;
  --btn: #0c5b36; --btn-hover: #0e6b40; --btn-ink: #fff;
  --gold: #946b1f; --gold-soft: #f3e5c5; --danger: #b0442e; --danger-soft: #f7e3dc;
  --head-bg: #e8eddb; --head-line: #d4dbbf; --orn: #8e9156;
  --hover: rgba(214, 158, 40, .26); --active: rgba(12, 91, 54, .17);
  --shadow-sm: 0 1px 2px rgba(60, 40, 10, .06), 0 2px 10px rgba(60, 40, 10, .05);
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 10px 30px rgba(60, 40, 10, .08);
  --shadow-pop: 0 2px 6px rgba(60, 40, 10, .07), 0 18px 50px rgba(60, 40, 10, .18);
  color-scheme: light;
}
body.theme-dark {
  --bg: #111312; --bar: rgba(17, 19, 18, .82); --bar-solid: #111312; --panel: #1b1d1c; --panel-2: #242725; --paper: #181a19;
  --ink: #ecebe6; --ink-2: #cfd0cb; --muted: #9a9d99; --line: #323633; --hair: rgba(255, 255, 255, .08);
  --accent: #5cc794; --accent-2: #7bd6aa; --accent-ink: #0b1a12; --accent-soft: #1b3127;
  --btn: #18794a; --btn-hover: #1f8a57; --btn-ink: #fff;
  --gold: #d9b46a; --gold-soft: #33291a; --danger: #f08070; --danger-soft: #3a201c;
  --head-bg: #18291f; --head-line: #26402f; --orn: #a3a56c;
  --hover: rgba(217, 180, 106, .22); --active: rgba(92, 199, 148, .25);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, .45), 0 24px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui-font); font-size: 14px; color: var(--ink); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: -.003em; }
#app { display: flex; flex-direction: column; height: 100vh; }
#main { flex: 1; min-height: 0; position: relative; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.ic { flex: none; display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }

/* ---------- подсветка слов ---------- */
::highlight(k-hover) { background-color: var(--hover); }
::highlight(k-active) { background-color: var(--active); }
::highlight(k-saved) { text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 0.28em; }

/* ---------- кнопки: «таблетки», как на сайте ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:hover { background: var(--panel-2); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary { background: var(--btn); border-color: transparent; color: var(--btn-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 8px 18px -8px color-mix(in srgb, var(--btn) 70%, transparent); }
.btn.primary:hover { background: var(--btn-hover); }
.btn.small { height: 32px; padding: 0 14px; font-size: 13.5px; }
.btn.big { height: 46px; padding: 0 24px; font-size: 15.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.link, button.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: var(--muted); transition: background-color .15s, color .15s; }
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); }
.input { height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 0 12px; outline: none; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
/* выпадающие списки — со своей стрелкой, одинаково в Chrome и Safari */
select.input { -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px; }
body.theme-dark select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9d99' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
/* переключатель в стиле iOS (флажок с классом switch) */
input.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 16%, transparent); transition: background-color .2s; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .04); transition: transform .2s cubic-bezier(.3, .7, .3, 1); }
input.switch:checked { background: var(--btn); }
input.switch:checked::after { transform: translateX(18px); }

/* ---------- верхняя панель (компьютер и браузер с мышью): как шапка сайта ---------- */
#topbar { height: 64px; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 20px; position: relative; z-index: 5;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }
.brand { justify-self: start; display: flex; align-items: center; gap: 11px; user-select: none; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 50%; background: linear-gradient(90deg, #07462a, #0e6b40); color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif; font-size: 23px; line-height: 1; padding-bottom: 4px; font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .14), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; }
.nav-group { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--panel) 72%, transparent); border: 1px solid var(--hair);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 6px 20px rgba(0, 0, 0, .05); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 6px; }
.nav-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); font-size: 14.5px; font-weight: 500; letter-spacing: -.01em; cursor: pointer; position: relative; white-space: nowrap; transition: background-color .15s, color .15s, border-color .15s; }
.nav-btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-btn.on { background: var(--accent-soft); color: var(--accent); }
.top-actions .nav-btn { color: var(--ink-2); }
/* «Открыть» — обведённая «таблетка», как «Войти» в шапке сайта */
.top-actions .nav-btn.outline { border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); background: color-mix(in srgb, var(--panel) 60%, transparent); color: var(--ink); font-weight: 600; }
.top-actions .nav-btn.outline:hover { background: var(--panel); border-color: color-mix(in srgb, var(--ink) 26%, transparent); }
.nav-badge { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.nav-badge:empty { display: none; }
.nav-badge.due { background: var(--gold); color: #fff; }
@media (max-width: 1000px) { .top-actions .nav-btn > span:not(.nav-badge) { display: none; } .top-actions .nav-btn { padding: 0 11px; } }
@media (max-width: 900px) { .brand-name { display: none; } }
@media (max-width: 760px) { .nav-btn { padding: 0 11px; } }

/* ---------- обложки книг (рисуются CSS, как на сайте) ---------- */
.cover {
  --c1: #145b3c; --c2: #0a3624; --c-gold: #d4b06a; --c-title: #f0dfb2;
  container-type: inline-size; position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 5 / 7; padding: 16% 14% 25%; overflow: hidden; border-radius: 5px 10px 10px 5px;
  background: radial-gradient(130% 90% at 50% 0%, rgba(255, 255, 255, .1), transparent 60%), linear-gradient(160deg, var(--c1), var(--c2));
  color: var(--c-title); text-align: center; user-select: none;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, .08), inset 12px 0 14px -12px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .14), 0 12px 24px -10px rgba(0, 0, 0, .35), 0 30px 50px -28px rgba(0, 0, 0, .4);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s;
}
.cover::before { content: ''; position: absolute; inset: 6.5cqi 6.5cqi 6.5cqi 8cqi; border: 1px solid var(--c-gold); border-radius: 3px; outline: 1px solid color-mix(in srgb, var(--c-gold) 55%, transparent); outline-offset: -2.4cqi; pointer-events: none;
  --stud: radial-gradient(circle, var(--c-gold) 0 .75cqi, transparent .9cqi);
  background: var(--stud) top 0 left 0 / 2.4cqi 2.4cqi no-repeat, var(--stud) top 0 right 0 / 2.4cqi 2.4cqi no-repeat, var(--stud) bottom 0 left 0 / 2.4cqi 2.4cqi no-repeat, var(--stud) bottom 0 right 0 / 2.4cqi 2.4cqi no-repeat; }
.cover::after { content: '\06DE'; position: absolute; left: 0; right: 0; bottom: 11cqi; font: 400 12cqi/1 'Scheherazade New', 'Amiri', serif; color: var(--c-gold); }
.cover-ar { font-family: 'Scheherazade New', 'Amiri', 'Traditional Arabic', serif; font-size: 13px; font-size: 8.4cqi; line-height: 1.45; color: var(--c-gold); text-wrap: balance; }
.cover-ar::after { content: ''; display: block; width: 34cqi; height: 1px; margin: 3.5cqi auto 4.5cqi; background: linear-gradient(90deg, transparent, var(--c-gold), transparent); }
.cover-ru { font-family: var(--serif); font-size: 18px; font-size: 12.2cqi; font-weight: 400; line-height: 1.12; letter-spacing: -.01em; color: var(--c-title); text-wrap: balance; overflow-wrap: break-word; hyphens: auto; }
.cover-green { --c1: #155e3e; --c2: #0a3624; --c-gold: #d4b06a; --c-title: #f0dfb2; }
.cover-beige { --c1: #f8f1e3; --c2: #e8dbc0; --c-gold: #a47f3a; --c-title: #5a4119; }
.cover-navy { --c1: #2b3a5a; --c2: #141c30; --c-gold: #d3b16d; --c-title: #efdcae; }
.cover-wine { --c1: #712836; --c2: #3e131c; --c-gold: #d8b36e; --c-title: #f3dfb2; }
.cover-beige { box-shadow: inset 3px 0 0 rgba(255, 255, 255, .5), inset 12px 0 14px -12px rgba(90, 60, 20, .35), 0 1px 2px rgba(0, 0, 0, .1), 0 12px 24px -10px rgba(60, 40, 10, .3), 0 30px 50px -28px rgba(60, 40, 10, .35); }
/* свой файл — «бумажная» обложка: значок, название, формат и полоска прочитанного */
.cover-paper { --c1: #fffefb; --c2: #efebe1; --c-gold: #d6cfbd; --c-title: #2b2a27; justify-content: space-between; padding: 14% 12% 13%;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, .7), inset 12px 0 14px -12px rgba(70, 55, 25, .2), 0 0 0 1px rgba(40, 30, 10, .07), 0 12px 24px -12px rgba(40, 30, 10, .22), 0 28px 46px -30px rgba(40, 30, 10, .3); }
.cover-paper::after { content: none; }
.cover-paper::before { opacity: .8; }
.cover-paper .cover-ic { display: flex; color: #2f6b4f; margin-top: 2cqi; }
.cover-paper .cover-ic svg { width: 15cqi; height: 15cqi; }
.cover-paper .cover-ru { font-family: var(--ui-font); font-size: 15px; font-size: 10.4cqi; font-weight: 650; line-height: 1.2; letter-spacing: -.015em; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; unicode-bidi: plaintext; }
.cover-paper .cover-ru:dir(rtl) { font-family: var(--ar-font); font-size: 13.5cqi; font-weight: 700; line-height: 1.5; letter-spacing: 0; }
.cover-paper .fmt { margin-bottom: 1cqi; }
.cover-progress { position: absolute; left: 10%; right: 8%; bottom: 5.5%; height: 3px; border-radius: 3px; background: rgba(40, 30, 10, .1); overflow: hidden; }
.cover-progress i { display: block; height: 100%; border-radius: inherit; background: #1d7a4c; }
body.theme-sepia .cover-paper { --c1: #fffaf0; --c2: #efe4cf; --c-gold: #d5c6a6; }
body.theme-dark .cover-paper { --c1: #2c302d; --c2: #202321; --c-gold: #474d48; --c-title: #ecebe6;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, .05), inset 12px 0 14px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06), 0 12px 24px -12px rgba(0, 0, 0, .6); }
body.theme-dark .cover-paper .cover-ic { color: var(--accent); }
body.theme-dark .cover-progress { background: rgba(255, 255, 255, .12); }
body.theme-dark .cover-progress i { background: var(--accent); }
body.theme-dark .cover:not(.cover-paper) { box-shadow: inset 3px 0 0 rgba(255, 255, 255, .08), inset 12px 0 14px -12px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .05), 0 14px 28px -12px rgba(0, 0, 0, .7); }

/* ---------- библиотека (главный экран) ---------- */
.library { height: 100%; overflow: auto; padding: 40px clamp(20px, 4.5vw, 56px) 72px; }
.library > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.lib-title { margin: 0; font-size: clamp(34px, 3.7vw, 48px); line-height: 1.05; font-weight: 700; letter-spacing: -.036em; white-space: nowrap; }
.lib-sub { margin: 12px 0 0; max-width: 40em; font-size: clamp(16.5px, 1.4vw, 18.5px); line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.lib-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.lib-hero-actions .btn { height: 46px; padding: 0 24px; font-size: 15.5px; }
.lib-hint { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.banner { margin-top: 28px; position: relative; display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--hair); background: var(--panel); box-shadow: var(--shadow-sm); line-height: 1.5; font-size: 14.5px; }
.banner + .banner { margin-top: 12px; }
.banner-ic { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.banner-text { flex: 1; min-width: 0; color: var(--ink-2); }
.banner-text b { color: var(--ink); font-weight: 650; }
.banner.warn { background: color-mix(in srgb, var(--gold-soft) 50%, var(--panel)); border-color: color-mix(in srgb, var(--gold) 24%, transparent); }
.banner.warn .banner-ic { background: var(--gold-soft); color: var(--gold); }
.banner.install { padding-right: 56px; }
.banner-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.banner-close { position: absolute; top: 50%; right: 12px; margin-top: -16px; width: 32px; height: 32px; }
/* «Продолжить чтение» */
.continue-card { margin-top: 32px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 18px 24px 18px 20px;
  background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .25s, transform .25s; }
.continue-card:hover { box-shadow: 0 1px 2px rgba(20, 28, 24, .05), 0 16px 40px rgba(20, 28, 24, .11); }
.cc-cover { width: 76px; }
.cc-cover .cover { border-radius: 3px 6px 6px 3px; box-shadow: inset 2px 0 0 rgba(255, 255, 255, .08), inset 8px 0 10px -8px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .15), 0 8px 16px -8px rgba(0, 0, 0, .35); }
.cc-cover .cover-paper { box-shadow: 0 0 0 1px rgba(40, 30, 10, .08), 0 8px 16px -8px rgba(40, 30, 10, .3); }
.cc-cover .cover-progress { display: none; }
.cc-kicker { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.cc-title { margin-top: 5px; font-size: 22px; font-weight: 700; letter-spacing: -.022em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.cc-title:dir(rtl) { font-family: var(--ar-font); font-size: 25px; letter-spacing: 0; line-height: 1.5; }
.cc-sub { margin-top: 3px; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; max-width: 440px; }
.cc-bar { flex: 1; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.cc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--btn); }
.cc-pct { font-size: 13px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cc-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.cc-go { height: 46px; padding: 0 16px 0 24px; font-size: 15.5px; gap: 4px; }
.cc-go-ic { display: flex; }
/* разделы: заголовок с короткой зелёной чертой, как на сайте */
.lib-section { margin-top: 50px; }
.lib-section:empty { display: none; }
.sec-head { margin-bottom: 24px; }
.sec-title { margin: 0; font-size: clamp(23px, 2.3vw, 30px); font-weight: 700; letter-spacing: -.026em; line-height: 1.15; }
.sec-title::after { content: ''; display: block; width: 32px; height: 3px; border-radius: 3px; background: var(--accent); margin-top: 12px; }
.sec-count { margin-left: 10px; font-size: .6em; font-weight: 600; letter-spacing: 0; color: var(--muted); vertical-align: .18em; }
.sec-sub { margin: 12px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.5; }
/* полка: обложки в сетке, подпись под обложкой */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 36px 26px; }
.book-card { position: relative; display: flex; flex-direction: column; gap: 13px; min-width: 0; cursor: pointer; outline: none; }
@media (hover: hover) {
  .book-card:hover .cover { transform: translateY(-5px); box-shadow: inset 3px 0 0 rgba(255, 255, 255, .08), inset 12px 0 14px -12px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .12), 0 22px 36px -12px rgba(0, 0, 0, .4), 0 40px 60px -30px rgba(0, 0, 0, .45); }
  .book-card:hover .cover-paper { box-shadow: inset 3px 0 0 rgba(255, 255, 255, .7), 0 0 0 1px rgba(40, 30, 10, .08), 0 22px 36px -14px rgba(40, 30, 10, .3), 0 40px 60px -32px rgba(40, 30, 10, .35); }
}
.book-card:focus-visible .cover { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.book-card:active .cover { transform: scale(.98); }
.book-card.missing .cover { opacity: .5; filter: grayscale(1); }
.bc-caption { display: flex; align-items: flex-start; gap: 4px; min-width: 0; }
.bc-text { flex: 1; min-width: 0; }
.bc-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; unicode-bidi: plaintext; overflow-wrap: anywhere; }
.bc-title:dir(rtl) { font-family: var(--ar-font); font-size: 18px; font-weight: 700; letter-spacing: 0; line-height: 1.45; }
.bc-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.bc-by { font-size: 14px; color: var(--muted); line-height: 1.35; }
.bc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 6px; }
.bc-ready { font-size: 12.5px; font-weight: 650; color: var(--accent); }
.bc-added { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 6%, transparent); white-space: nowrap; }
.card-remove { flex: none; width: 28px; height: 28px; margin: -4px -6px 0 0; opacity: 0; }
.book-card:hover .card-remove, .card-remove:focus-visible { opacity: 1; }
.fmt { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; line-height: 1.6; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-family: var(--ui-font); }
.fmt-pdf { background: #f6dfd8; color: #9b3b26; }
.fmt-epub { background: #dcebe3; color: #1f6a52; }
.fmt-docx { background: #dde6f5; color: #2a4f8f; }
.fmt-txt, .fmt-html { background: #efe6d2; color: #7a5b1d; }
.fmt-images { background: #e4e0f3; color: #4b3d8f; }
body.theme-dark .fmt { filter: brightness(.8) saturate(.9); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty.big { padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); }
.empty.big p { margin: 4px; }
.empty-ic { width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.empty-title { font-weight: 650; font-size: 18px; color: var(--ink); }
@media (max-width: 720px) {
  .continue-card { grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 16px; }
  .cc-go { grid-column: 1 / -1; }
  .lib-section { margin-top: 44px; }
}

/* ================= экран чтения ================= */
.reader { height: 100%; display: flex; flex-direction: column; position: relative; background: var(--bg); }

/* шапка книги: «‹ Книги» · название · «Аа» и луна */
.reader-bar { flex: none; position: relative; z-index: 4; display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr); align-items: center; gap: 12px;
  min-height: 60px; padding: 6px 12px; background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }
.reader-bar.tools { grid-template-columns: max-content minmax(0, 1fr) max-content; }
.reader-bar.tools .rb-center { align-items: flex-start; text-align: left; }
.rb-side { display: flex; align-items: center; gap: 4px; min-width: 0; }
.rb-left { justify-self: start; }
.rb-right { justify-self: end; gap: 6px; }
.rb-center { min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; }
.rb-title { max-width: 100%; font-weight: 650; font-size: 16px; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.rb-title:dir(rtl) { font-family: var(--ar-font); font-size: 19px; font-weight: 700; letter-spacing: 0; line-height: 1.4; }
.rb-sub { max-width: 100%; margin-top: 2px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-back { display: inline-flex; align-items: center; gap: 1px; height: 38px; padding: 0 14px 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--accent); font-size: 16px; font-weight: 500; cursor: pointer; transition: background-color .15s; }
.rb-back:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.rb-btn { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; transition: background-color .15s; }
.rb-btn:hover, .rb-btn.open { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.rb-aa { width: 46px; font: 500 19px/1 var(--ui-font); letter-spacing: -.01em; }
.rb-help { color: var(--muted); }
.rb-group { display: flex; align-items: center; gap: 2px; flex: none; }
/* «Страница / Текст» — сегменты в стиле iOS */
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); flex: none; }
.seg { border: 0; background: transparent; padding: 0 12px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color .15s, color .15s; }
.seg:hover { color: var(--ink); }
.seg.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.segmented.small .seg { height: 28px; font-size: 12.5px; }
.toggle { height: 32px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 0 12px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 500; flex: none; white-space: nowrap; }
.toggle + .toggle { margin-left: 4px; }
.toggle:hover { color: var(--ink); background: var(--panel-2); }
.toggle.on { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--ink); }
.zoom-label { min-width: 52px; height: 30px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 13px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.zoom-label:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
@media (max-width: 1020px) { .reader-bar .toggle span, .reader-bar .seg span { display: none; } .reader-bar .toggle, .reader-bar .seg { padding: 0 9px; } }

.reader-host { flex: 1; min-height: 0; position: relative; }
.center-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }

/* текст книги: на компьютере — страница-карточка, как на сайте */
.text-scroller { position: absolute; inset: 0; overflow: auto; padding: 28px 20px 48px; }
.book-page { max-width: var(--page-width); margin: 0 auto; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 48px clamp(22px, 6vw, 72px) 60px;
  font-family: var(--ar-font); font-size: var(--ar-size); line-height: var(--ar-line); text-align: justify; text-align-last: start; color: var(--ink); min-height: 60vh; overflow-wrap: break-word; }
.book-page p { margin: 0 0 .45em; }
.book-page h1, .book-page h2, .book-page h3, .book-page h4, .book-page h5, .book-page h6 { text-align: center; text-align-last: center; color: var(--accent); line-height: 1.6; margin: .6em 0 .35em; font-weight: 700; text-wrap: balance; }
/* главы — светло-зелёная «таблетка» с орнаментом по бокам (как в печатных изданиях) */
.book-page h1, .book-page h2, .book-page h3, .book-page h4 { position: relative; display: block; width: fit-content; max-width: calc(100% - 3.8em); margin: 1.15em auto .7em; padding: .08em 1.05em .18em;
  border-radius: 1.2em; background: var(--head-bg); border: 1px solid var(--head-line); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 50%, transparent), 0 1px 2px rgba(20, 40, 20, .05); }
.book-page h5, .book-page h6 { position: relative; display: block; width: fit-content; max-width: calc(100% - 3.4em); margin: .9em auto .45em; }
.book-page h1::before, .book-page h1::after, .book-page h2::before, .book-page h2::after, .book-page h3::before, .book-page h3::after,
.book-page h4::before, .book-page h4::after, .book-page h5::before, .book-page h5::after {
  content: ''; position: absolute; top: 50%; width: 1.5em; height: .75em; margin-top: -.375em; background: var(--orn);
  -webkit-mask: var(--orn-img) center / contain no-repeat; mask: var(--orn-img) center / contain no-repeat; pointer-events: none; }
.book-page h1::before, .book-page h2::before, .book-page h3::before, .book-page h4::before, .book-page h5::before { right: calc(100% + .3em); }
.book-page h1::after, .book-page h2::after, .book-page h3::after, .book-page h4::after, .book-page h5::after { left: calc(100% + .3em); }
.book-page h5::before, .book-page h5::after { width: 1.2em; height: .6em; margin-top: -.3em; }
body.theme-dark .book-page h1, body.theme-dark .book-page h2, body.theme-dark .book-page h3, body.theme-dark .book-page h4 { box-shadow: none; }
/* узкий экран: орнамент и поля «таблетки» поменьше — чтобы название главы чаще умещалось в строку */
@media (max-width: 440px) {
  .book-page h1, .book-page h2, .book-page h3, .book-page h4 { max-width: calc(100% - 3em); padding-left: .8em; padding-right: .8em; }
  .book-page h1::before, .book-page h1::after, .book-page h2::before, .book-page h2::after, .book-page h3::before, .book-page h3::after,
  .book-page h4::before, .book-page h4::after { width: 1.2em; height: .6em; margin-top: -.3em; }
  .book-page h1::before, .book-page h2::before, .book-page h3::before, .book-page h4::before { right: calc(100% + .25em); }
  .book-page h1::after, .book-page h2::after, .book-page h3::after, .book-page h4::after { left: calc(100% + .25em); }
}
.book-page p.basmala { text-align: center; text-align-last: center; font-size: 2.1em; line-height: 1.5; color: var(--accent); margin: 0 0 .3em; }
.book-page p.colophon { text-align: center; text-align-last: center; color: var(--accent); margin-top: 1em; }
.book-page .q { font-weight: 700; }
.book-page .ayah { color: var(--accent); }
.book-page h1 { font-size: 1.4em; } .book-page h2 { font-size: 1.3em; } .book-page h3 { font-size: 1.2em; } .book-page h4 { font-size: 1.1em; } .book-page h5, .book-page h6 { font-size: 1em; }
.book-page img { max-width: 100%; height: auto; }
.book-page table { border-collapse: collapse; margin: .5em 0; }
.book-page td, .book-page th { border: 1px solid var(--line); padding: 2px 8px; }
.book-page blockquote { margin: .4em 1.2em; padding: 0 .8em; border-inline-start: 3px solid var(--line); }
.book-page hr { border: 0; border-top: 1px solid var(--line); margin: 1em 20%; }
.book-page ol, .book-page ul { padding-inline-start: 1.5em; }
.book-page [dir="ltr"], .book-page p:dir(ltr) { text-align: left; font-family: var(--ui-font); font-size: 16px; line-height: 1.6; }
.book-page.over-word { cursor: pointer; }
.book-page ::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.scan-placeholder { font-family: var(--ui-font); font-size: 15px; line-height: 1.55; text-align: center; padding: 40px 10px; color: var(--muted); }
.scan-placeholder .sp-title { font-weight: 600; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.scan-placeholder .btn { margin-top: 10px; }
.ocr-badge { font-family: var(--ui-font); font-size: 12.5px; color: var(--muted); text-align: left; margin-bottom: 12px; line-height: 1.4; }
.load-error, .empty-section { font-family: var(--ui-font); font-size: 15px; color: var(--muted); }
/* под страницей: «Дальше» с названием следующего раздела */
.section-end { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 0 4px; }
.section-end:empty { display: none; }
.section-next { max-width: min(560px, 100%); height: 46px; padding: 0 18px 0 22px; gap: 10px; font-size: 15px; }
.section-next-title { font-family: var(--ar-font); font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.section-end-note { color: var(--muted); font-size: 13px; }

/* нижняя панель: ‹ · «Раздел N из M» с прогрессом и оглавлением · › */
.reader-nav { flex: none; position: relative; z-index: 4; padding: 10px 16px; background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--hair); }
.reader-nav-in { max-width: calc(var(--page-width) + 40px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav-arrow { width: 46px; height: 46px; flex: none; border-radius: 14px; background: color-mix(in srgb, var(--ink) 5.5%, transparent); color: var(--ink); }
.nav-arrow:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.nav-arrow:disabled { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.nav-pill { flex: 0 1 460px; min-width: 0; height: 54px; display: flex; align-items: center; gap: 2px; padding: 0 6px; background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow-sm); }
.nav-toc { width: 42px; height: 42px; flex: none; border-radius: 12px; color: var(--accent); }
.nav-toc:hover, .nav-toc.open { color: var(--accent); background: var(--accent-soft); }
.nav-where { flex: 1; min-width: 0; height: 44px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 7px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.nav-where:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.nav-where.single { cursor: default; }
.nav-where.single:hover { background: transparent; }
.nav-label { font-size: 14.5px; font-weight: 500; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-track { display: block; height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.nav-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--btn); transition: width .25s ease; }

/* PDF */
.pdf-scroller { position: absolute; inset: 0; overflow: auto; }
.pdf-column { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 24px 64px; min-width: min-content; }
.pdf-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 3px; flex: none; }
.pdf-page-num { position: absolute; left: -2px; top: -18px; font-size: 11px; color: var(--muted); user-select: none; }
.pdf-canvas { display: block; position: absolute; left: 0; top: 0; }
.pdf-page.is-scan { cursor: crosshair; }
.pdf-page.over-word, .pdf-page.over-word .textLayer span { cursor: pointer; }
.pdf-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--danger); padding: 20px; text-align: center; }
.scan-box { position: absolute; pointer-events: none; border: 2px solid var(--gold); background: rgba(230, 170, 40, .16); border-radius: 5px; z-index: 3; }
.scan-box.active { border-color: var(--accent); background: rgba(12, 91, 54, .14); }
.drag-rect { position: absolute; pointer-events: none; border: 2px dashed var(--accent); background: rgba(12, 91, 54, .10); border-radius: 4px; z-index: 4; }
body.theme-dark .pdf-page { filter: none; }

/* текстовый слой pdf.js */
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.textLayer .markedContent { display: contents; }
.textLayer span[role="img"] { user-select: none; cursor: default; }
.textLayer ::selection { background: rgba(12, 91, 54, .28); color: transparent; }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }

/* подсказки и панели поверх */
.tip { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: min(720px, calc(100% - 24px)); z-index: 20; display: flex; gap: 12px; align-items: center;
  padding: 12px 12px 12px 16px; background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow-pop); line-height: 1.5; }
.tip-ic { display: flex; color: var(--accent); flex: none; }
.busy-banner { position: absolute; left: 50%; top: 72px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-pop); border-radius: 999px; padding: 10px 18px; display: flex; gap: 10px; align-items: center; z-index: 30; }
.sel-menu { position: fixed; z-index: 900; display: flex; gap: 4px; padding: 5px; background: var(--panel); border: 1px solid var(--hair); border-radius: 999px; box-shadow: var(--shadow-pop); }
.sel-btn { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-weight: 500; }
.sel-btn:hover { background: var(--panel-2); }
.sel-btn.primary { background: var(--btn); color: var(--btn-ink); }
.sel-btn.primary:hover { background: var(--btn-hover); }

/* «хвостик» всплывающих карточек к слову */
.popup::before, .hover-hint::before { content: ''; position: absolute; left: var(--ax, 50%); width: 14px; height: 14px; margin-left: -7px; background: var(--panel); border: 1px solid var(--hair); transform: rotate(45deg); display: none; }
.popup[data-side="below"]::before, .hover-hint[data-side="below"]::before { display: block; top: -8px; border-right: 0; border-bottom: 0; border-top-left-radius: 3px; }
.popup[data-side="above"]::before, .hover-hint[data-side="above"]::before { display: block; bottom: -8px; border-left: 0; border-top: 0; border-bottom-right-radius: 3px; }
@keyframes pp-in { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }

/* подсказка при наведении (компьютер): слово и перевод, для готового разбора — исходная форма, корень, часть речи */
.hover-hint { position: fixed; z-index: 950; pointer-events: none; min-width: 170px; max-width: 360px; padding: 10px 16px 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--hair); border-radius: 18px;
  box-shadow: var(--shadow-pop); font-size: 14px; line-height: 1.4; animation: pp-in .14s ease-out; }
.hh-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.hh-forms { display: grid; gap: 1px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hh-ar { font-family: var(--ar-font); font-size: 19px; line-height: 1.45; color: var(--ink); }
.hh-word { margin-left: auto; font-family: var(--ar-font); font-size: 30px; font-weight: 700; line-height: 1.45; color: var(--accent); text-align: right; }
.hh-line { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; }
.hh-top + .hh-line { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--hair); }
.hh-line .pp-ic { color: var(--muted); margin-top: 1px; }
.hh-k { color: var(--muted); white-space: nowrap; }
.hh-tr { color: var(--accent); font-weight: 650; }
.hh-chip { flex: none; font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 7px; padding: 1px 7px; margin-top: 1px; white-space: nowrap; }
.hh-pos { color: var(--ink-2); }

/* всплывающие панели у кнопок (компьютер): «Аа», оглавление */
.popover { position: fixed; z-index: 1200; min-width: 240px; max-width: calc(100vw - 16px); padding: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow-pop); animation: pp-in .14s ease-out; }
.view-pop { width: 340px; }
.toc-pop { width: min(460px, calc(100vw - 16px)); padding: 12px 6px 6px; }
.pop-title { font-weight: 650; font-size: 15px; padding: 0 12px 8px; }
.toc-pop .toc-list { max-height: min(60vh, 540px); overflow: auto; overscroll-behavior: contain; padding: 0 2px; }

/* «Аа»: размер текста и тема (общее для компьютера и телефона) */
.view-menu { display: flex; flex-direction: column; gap: 18px; }
.vm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vm-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.vm-label { font-weight: 600; }
.vm-stepper { display: flex; align-items: center; gap: 4px; }
.vm-stepper .icon-btn { background: var(--panel-2); color: var(--ink); }
.vm-stepper .icon-btn:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.vm-val { min-width: 48px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.segmented.wide { display: flex; }
.segmented.wide .seg { flex: 1; height: 36px; font-size: 13.5px; }
.swatch { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .18); }
.sw-light { background: #fff; }
.sw-sepia { background: #f1e6cf; }
.sw-dark { background: #1b1d1c; border-color: rgba(255, 255, 255, .28); }
.vm-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; color: var(--accent); font-size: 15px; cursor: pointer; }
/* оглавление */
.toc-list { display: flex; flex-direction: column; }
.toc-item { text-align: start; unicode-bidi: plaintext; border: 0; background: none; padding: 10px 12px; font-size: 15px; line-height: 1.4; border-radius: 12px; color: var(--ink); cursor: pointer; }
.toc-item:hover { background: var(--panel-2); }
.toc-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc-item:dir(rtl), .toc-item:lang(ar) { font-family: var(--ar-font); font-size: 19px; }

/* ---------- карточка перевода (компьютер: у слова; телефон: нижняя, см. mobile.css) ---------- */
.popup { position: fixed; z-index: 1000; width: min(440px, calc(100vw - 16px)); background: var(--panel); color: var(--ink); border: 1px solid var(--hair); border-radius: 22px;
  box-shadow: var(--shadow-pop); line-height: 1.45; animation: pp-in .16s ease-out; }
.popup-body { max-height: calc(100vh - 16px); overflow: auto; padding: 14px 18px 18px; border-radius: inherit; overscroll-behavior: contain; }
/* верх: озвучка — слово — (крестик нижней карточки) */
.pp-hero { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 8px; }
.pp-hero-side { display: flex; align-items: center; }
.pp-hero-side:last-child { justify-content: flex-end; }
.pp-ar { font-family: var(--ar-font); font-size: 44px; line-height: 1.5; text-align: center; color: var(--accent); font-weight: 700; }
.pp-ar.long { font-size: 36px; }
.pp-ar.xlong { font-size: 30px; }
.pp-hero.phrase { grid-template-columns: 48px minmax(0, 1fr) 40px; align-items: start; }
.pp-ar.phrase { font-size: 24px; line-height: 1.9; font-weight: 400; color: var(--ink); text-align: right; max-height: 9em; overflow: auto; padding-top: 2px; }
.pp-say { position: relative; width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color .15s, transform .1s; }
.pp-say:hover { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); }
.pp-say:active { transform: scale(.94); }
.pp-say .ic-play { fill: currentColor; margin-left: 3px; }
.pp-say .ic-audio-lines { display: none; }
.pp-say.on .ic-play { display: none; }
.pp-say.on .ic-audio-lines { display: block; animation: pp-wave 1s ease-in-out infinite; }
@keyframes pp-wave { 50% { transform: scaleY(.55); } }
.pp-tr { text-align: center; font-size: 19px; font-weight: 500; color: var(--ink-2); line-height: 1.35; margin: -2px 0 6px; overflow-wrap: break-word; }
.pp-tr.muted { color: var(--muted); font-weight: 400; font-size: 16px; }
.pp-tr.phrase { text-align: left; color: var(--ink); font-size: 17px; margin: 6px 0 8px; }
.pp-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.pp-cached { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 5%, transparent); font-size: 12px; color: var(--muted); }
.pp-cached.pp-prepared { background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: help; }
.pp-cached .pp-ic { color: inherit; }
.pp-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 10px 0 6px; }
.pp-error { display: flex; gap: 10px; align-items: flex-start; color: var(--danger); line-height: 1.5; padding: 4px 2px; }
.pp-error .pp-ic { color: var(--danger); }
/* части слова — «чипы» */
.pp-parts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; direction: rtl; }
.popup-body .pp-parts, .sheet-body .pp-parts { justify-content: center; margin: 10px 0 14px; }
.part { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 2px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, var(--panel-2)); font-size: 13.5px; color: var(--ink-2); direction: ltr; }
.part b { font-family: var(--ar-font); font-size: 22px; font-weight: 700; line-height: 1.35; color: var(--accent); }
/* таблица разбора со значками */
.pp-grid { margin: 4px 0 12px; padding: 2px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.pp-row { display: grid; grid-template-columns: 124px 1fr; gap: 10px; align-items: baseline; }
.pp-grid .pp-row { position: relative; grid-template-columns: 22px minmax(92px, .85fr) minmax(0, 1.15fr); column-gap: 12px; align-items: center; min-height: 48px; padding: 9px 14px; }
.pp-grid .pp-row + .pp-row::before { content: ''; position: absolute; top: 0; left: 48px; right: 14px; border-top: 1px solid var(--hair); }
.pp-grid .pp-row.top { align-items: start; }
.pp-grid .pp-row.top > .pp-ic, .pp-grid .pp-row.top > .pp-label { margin-top: 1px; }
.pp-ic { display: flex; color: var(--accent); }
.pp-ic.flip svg { transform: scaleY(-1); }
.pp-label { color: var(--muted); font-size: 12.5px; }
.pp-grid .pp-label { color: var(--ink-2); font-size: 14.5px; line-height: 1.3; }
.pp-label small { font-size: 12px; color: var(--muted); }
.pp-value { text-align: left; overflow-wrap: break-word; }
.pp-grid .pp-value { font-size: 15px; line-height: 1.4; color: var(--ink); }
.pp-row.ar-value .pp-value { font-family: var(--ar-font); font-size: 24px; line-height: 1.45; text-align: right; }
.pp-row.pos .pp-value { text-align: right; }
.pp-row.muted-value .pp-value { color: var(--muted); font-size: 13.5px; }
.pp-value.big { font-size: 16px; font-weight: 600; }
/* словарь библиотеки: другие прочтения формы слова */
.pp-alts { display: flex; flex-direction: column; gap: 4px; }
.pp-alt { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.pp-alt b { font-family: var(--ar-font); font-size: 22px; font-weight: 400; color: var(--ink); }
.pos-chip { display: inline-block; padding: 3px 10px; border-radius: 9px; background: var(--accent-soft); color: var(--ink-2); font-size: 14px; line-height: 1.4; text-align: left; }
.pos-chip b { color: var(--accent); font-weight: 600; }
/* «Термин», «Сочетание», «Пояснения» */
.pp-term, .pp-phrase { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 10px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.pp-term > .pp-ic { margin-top: 1px; }
.pp-term b { color: var(--accent); font-weight: 650; }
.pp-phrase { background: var(--gold-soft); }
.pp-phrase > .pp-ic, .pp-phrase b { color: var(--gold); }
.pp-phrase > .pp-ic { margin-top: 1px; }
/* веб-версия: слово без готового разбора — куда идти за переводом */
.pp-web-note { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 6px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); font-size: 15px; line-height: 1.5; color: var(--ink); }
.pp-web-note > .pp-ic { margin-top: 1px; }
.pp-web-note + .pp-actions { margin-top: 12px; }
.pp-note { margin: 4px 0 10px; padding: 8px 12px; border-radius: 14px; background: var(--panel-2); }
.pp-note .pp-label { font-size: 12px; }
.pp-note-ar { font-family: var(--ar-font); font-size: 20px; line-height: 1.7; text-align: right; }
.pp-block { margin: 8px 0; }
.pp-block .pp-label { margin-bottom: 2px; }
.pp-caption { text-align: center; margin: 2px 0 6px; font-size: 13px; }
/* фраза: слова «плиточками» */
.pp-words { display: flex; flex-wrap: wrap; gap: 8px; direction: rtl; margin: 10px 0 8px; }
.popup-body .pp-words, .sheet-body .pp-words { justify-content: center; }
.pw { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 3px 12px 6px; text-align: center; max-width: 100%; transition: border-color .15s, background-color .15s; }
.pw-ar { font-family: var(--ar-font); font-size: 21px; line-height: 1.6; color: var(--accent); }
.pw-ru { font-size: 12.5px; color: var(--ink-2); direction: ltr; }
/* кнопки карточки */
.pp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.pp-btn { flex: 1 1 auto; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 14.5px; font-weight: 500; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .1s; }
.pp-btn:hover { background: var(--panel-2); }
.pp-btn:active { transform: scale(.98); }
.pp-btn.primary { flex-grow: 1.4; background: var(--btn); border-color: transparent; color: var(--btn-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 14px -8px color-mix(in srgb, var(--btn) 70%, transparent); }
.pp-btn.primary:hover { background: var(--btn-hover); }
.pp-btn.saved { flex-grow: 1.4; background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pp-btn.icon-only { flex: 0 0 42px; width: 42px; padding: 0; }

/* ---------- экраны «Мой словарь» и «Тренировка»: общий каркас ---------- */
.vocab, .practice { height: 100%; overflow: auto; padding: 48px clamp(20px, 4.5vw, 56px) 72px; }
.screen-in { max-width: 960px; margin: 0 auto; }
.screen-title { margin: 0; font-size: clamp(32px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.034em; line-height: 1.06; }

/* ---------- мой словарь ---------- */
.vocab-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 24px; flex-wrap: wrap; }
.vh-title h1 { margin: 0; font-size: clamp(32px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.034em; line-height: 1.06; }
.vh-count { display: block; margin-top: 10px; color: var(--muted); font-size: 16px; }
.vh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vocab-filters { display: flex; gap: 10px; margin: 28px 0 18px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 240px; display: flex; }
.search-ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); display: flex; color: var(--muted); pointer-events: none; }
.search-box .input { width: 100%; height: 42px; padding-left: 41px; border-radius: 999px; background: var(--panel); border-color: var(--hair); box-shadow: var(--shadow-sm); }
.search-box .input::-webkit-search-cancel-button { cursor: pointer; }
.vf-selects { display: flex; gap: 10px; flex-wrap: wrap; }
.vocab-filters .select { height: 42px; max-width: 240px; border-radius: 999px; padding-left: 16px; background-color: var(--panel); border-color: var(--hair); box-shadow: var(--shadow-sm); font-weight: 500; }
/* список — одна белая карточка со строками, как списки в iOS */
.vocab-list { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.vocab-list.is-empty { background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.vw { position: relative; padding: 14px 20px 14px; transition: background-color .15s; }
.vw + .vw::before { content: ''; position: absolute; top: 0; left: 20px; right: 20px; border-top: 1px solid var(--hair); }
.vw:hover { background: color-mix(in srgb, var(--ink) 2.2%, transparent); }
.vw.open { background: color-mix(in srgb, var(--accent-soft) 42%, var(--panel)); }
.vw.open + .vw::before, .vw.open::before { left: 0; right: 0; }
.vw-main { display: grid; grid-template-columns: minmax(140px, 28%) minmax(0, 1fr) auto; gap: 20px; align-items: center; cursor: pointer; }
.vw-ar { font-family: var(--ar-font); font-size: 30px; line-height: 1.55; color: var(--accent); font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.vw-ar.phrase { font-size: 22px; font-weight: 400; color: var(--ink); }
.vw-tr { font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.vw-sub { display: flex; gap: 10px; align-items: baseline; margin-top: 2px; flex-wrap: wrap; }
.ar-inline { font-family: var(--ar-font); font-size: 19px; color: var(--ink-2); }
.vw-root { font-family: var(--ar-font); font-size: 16px; color: var(--muted); }
.vw-root::before { content: '√ '; font-family: var(--ui-font); font-size: 12px; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); }
.vw-side { display: flex; align-items: center; gap: 10px; }
.vw-btns { display: flex; gap: 0; opacity: .5; transition: opacity .15s; }
.vw:hover .vw-btns, .vw.open .vw-btns, .vw-btns:focus-within { opacity: 1; }
.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.st-new { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted); }
.st-learning { background: var(--gold-soft); color: var(--gold); }
.st-learned { background: var(--accent-soft); color: var(--accent); }
.vw-context { font-family: var(--ar-font); font-size: 18px; line-height: 1.85; color: var(--muted); text-align: right; margin-top: 4px; }
.vw:not(.open) > .vw-context { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vw-context mark { background: var(--gold-soft); color: var(--ink); border-radius: 4px; padding: 0 3px; }
.vw-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.vw-details { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--hair); display: flex; flex-direction: column; gap: 6px; }
.vw-details .pp-parts { margin: 0 0 4px; }
.vw-edit { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.vw-edit label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--hair); }

/* карточки «Помню / Не помню» */
.trainer { display: flex; flex-direction: column; gap: 18px; min-height: 380px; }
.tr-opts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.tr-card { position: relative; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 40px 28px 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tr-progress { position: absolute; top: 14px; right: 18px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tr-ar { font-family: var(--ar-font); font-size: 48px; line-height: 1.6; color: var(--accent); font-weight: 700; }
.tr-ar.phrase { font-size: 30px; font-weight: 400; color: var(--ink); }
.tr-ru { font-size: 25px; font-weight: 650; letter-spacing: -.015em; }
.tr-card .vw-context { text-align: center; max-width: 640px; }
.tr-back { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--hair); width: 100%; }
.tr-extra { font-family: var(--ar-font); font-size: 22px; color: var(--muted); }
.tr-meanings, .tr-note { color: var(--muted); max-width: 600px; }
.tr-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 10px; }
.tr-actions .btn { height: 44px; padding: 0 26px; }
.tr-key { font-size: 11.5px; color: var(--muted); }
.tr-grades { display: flex; gap: 10px; margin-top: 10px; }
.tr-grades .btn { height: 44px; padding: 0 22px; }
.grade-again { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.tr-empty, .tr-done { text-align: center; padding: 50px 20px; color: var(--muted); }
.tr-done-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin-bottom: 6px; }

/* ---------- модальные окна ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16, 20, 18, .32); -webkit-backdrop-filter: blur(6px) saturate(120%); backdrop-filter: blur(6px) saturate(120%); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 48px); background: var(--panel); border-radius: 26px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08), 0 30px 80px rgba(0, 0, 0, .28); display: flex; flex-direction: column; border: 1px solid var(--hair); overflow: hidden; animation: modal-in .18s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: 780px; }
.modal.compact { width: 440px; }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px 8px 26px; }
.modal-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.022em; }
.modal-head .icon-btn { width: 32px; height: 32px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink-2); }
.modal-head .icon-btn:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.modal-body { padding: 8px 26px 22px; overflow: auto; line-height: 1.5; }
.modal-actions { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 26px 20px; border-top: 1px solid var(--hair); }
.modal-actions .btn { height: 40px; padding: 0 22px; }
.confirm-text { margin: 4px 0 6px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.paste-form { display: flex; flex-direction: column; gap: 12px; }
.paste-form p { margin: 0; }
.paste-area { min-height: 300px; font-family: var(--ar-font); font-size: 22px; line-height: 1.9; }

/* ---------- настройки: разделы — белые карточки на сером фоне, как в iOS ---------- */
.modal.settings-modal { background: var(--bg); }
.settings { display: flex; flex-direction: column; gap: 24px; padding-top: 6px; }
.set-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.set-ic { display: flex; color: var(--accent); }
.set-card { background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; padding: 18px 20px 4px; box-shadow: var(--shadow-sm); }
.set-card > .field:last-child, .set-card > .check:last-child, .set-card > .radio-group:last-child { margin-bottom: 18px; }
.about .set-card p { margin: 0 0 16px; line-height: 1.55; word-break: break-word; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field-hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.provider-box { padding: 14px 16px 4px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--hair); margin-bottom: 16px; }
.range { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.range input { flex: 1; accent-color: var(--btn); }
.range-val { width: 52px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.check input:not(.switch) { accent-color: var(--btn); width: 16px; height: 16px; }
.check:has(input.switch) { justify-content: space-between; gap: 16px; padding: 4px 0; cursor: pointer; }
.check input.switch { order: 2; }
.font-preview { font-family: var(--ar-font); font-size: var(--ar-size); line-height: var(--ar-line); background: var(--paper); border: 1px solid var(--hair); border-radius: 14px; padding: 6px 16px; margin: -4px 0 16px; text-align: center; }
.test-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.test-out { font-size: 13px; color: var(--muted); flex: 1; min-width: 200px; unicode-bidi: plaintext; }
.test-out.ok { color: var(--accent); font-weight: 600; }
.test-out.err { color: var(--danger); }
.about p { word-break: break-word; }
/* справка */
.help h3 { margin: 22px 0 8px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.help h3:first-child { margin-top: 4px; }
.help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; color: var(--ink-2); }
.help li::marker { color: var(--accent); }
.help .keys { list-style: none; padding-left: 0; }
kbd { font-family: inherit; font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--panel-2); }

/* ---------- уведомления ---------- */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 3000; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg); padding: 11px 18px; border-radius: 16px; font-size: 14.5px; font-weight: 500; line-height: 1.45;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .1), 0 14px 36px rgba(0, 0, 0, .24); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1); max-width: min(720px, 90vw); word-break: break-word; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #b93a2b; color: #fff; }
.toast.success { background: var(--btn); color: var(--btn-ink); }
.toast-ic { display: flex; flex: none; }

/* перетаскивание файлов */
.drop-overlay { position: fixed; inset: 0; z-index: 4000; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 3px dashed var(--accent); border-radius: 18px; pointer-events: none; }
.drop-overlay div { background: var(--panel); padding: 18px 28px; border-radius: 999px; box-shadow: var(--shadow-pop); font-size: 16px; font-weight: 600; }
body.drop-hover .drop-overlay { display: flex; }
.fatal { padding: 40px; color: var(--danger); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 65%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- офлайн-словарь ---------- */
.dict-tabs { display: flex; gap: 6px; flex-wrap: wrap; direction: rtl; margin: 0 0 10px; }
.popup-body .dict-tabs, .sheet-body .dict-tabs { justify-content: center; }
.dict-tab { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 0 14px 2px; cursor: pointer; font-family: var(--ar-font); font-size: 19px; line-height: 1.7; color: var(--muted); transition: background-color .15s, color .15s; }
.dict-tab:hover { color: var(--ink); }
.dict-tab.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 700; }
.dict-entry { max-height: min(40vh, 360px); overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); padding: 10px 14px 12px; font-size: 14px; line-height: 1.55; }
.d-head { font-family: var(--ar-font); font-size: 24px; font-weight: 700; color: var(--accent); text-align: right; border-bottom: 1px solid var(--hair); margin-bottom: 6px; }
.d-line { padding: 2px 6px; margin-inline-start: calc(var(--ind, 0) * 14px); border-radius: 8px; }
.d-line.hit { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.d-line bdi.ar, .dict-entry bdi.ar { font-family: var(--ar-font); font-size: 1.32em; line-height: 1.45; }
.d-line b bdi.ar { color: var(--accent); }
.d-ex { color: var(--muted); font-style: italic; }
.d-com { color: var(--muted); }
.d-p { color: var(--gold); font-style: italic; font-size: .92em; }
.d-c { color: var(--accent); }
.d-sec { color: var(--muted); font-size: .95em; }
.d-ref { color: var(--accent); text-decoration: underline dotted; cursor: pointer; }
.d-sub { display: block; margin-top: 4px; }
.dict-search { display: flex; gap: 8px; margin-top: 10px; }
.dict-search .input { flex: 1; height: 42px; border-radius: 14px; font-family: var(--ar-font); font-size: 19px; }
.dict-search .pp-btn { flex: none; }
.pw { cursor: pointer; }
.pw:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.pw.missing .pw-ru { color: var(--muted); }
.radio-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 16px; }
.radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); line-height: 1.4; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.radio:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.radio:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.radio input { margin-top: 3px; accent-color: var(--btn); width: 16px; height: 16px; flex: none; }
.radio > span { display: flex; flex-direction: column; gap: 3px; }
.dict-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.dict-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px; }
.dict-name { font-weight: 600; }

/* ================= Тренировка: уроки, опыт (XP), серия дней, цель, повторение ================= */
.practice > * { max-width: 880px; margin-left: auto; margin-right: auto; }
.pr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 16px; flex-wrap: wrap; margin-bottom: 26px; }
.pr-head h1 { margin: 0; font-size: clamp(32px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.034em; line-height: 1.06; }
.pr-chips { display: flex; gap: 8px; }
.pr-chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 15px; border-radius: 999px; background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); color: var(--muted); font-size: 15px; }
.pr-chip b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.pr-chip.streak.lit { color: #e8812b; border-color: #f6d3a8; background: #fff5e8; }
body.theme-sepia .pr-chip.streak.lit { background: #fbecd6; }
body.theme-dark .pr-chip.streak.lit { background: #3a2a17; border-color: #6b4a22; }
.pr-chip.xp { color: var(--gold); }
/* карточка урока — зелёная, как блок «Плюс» на сайте */
.pr-hero { position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px 32px; align-items: center; padding: 32px 34px; border-radius: 28px; color: #fff;
  background: radial-gradient(120% 150% at 0% 0%, #1b8453 0%, #0e6b40 40%, #08422a 100%); box-shadow: 0 2px 6px rgba(8, 66, 42, .18), 0 24px 50px -24px rgba(8, 66, 42, .55); }
.pr-hero::after { content: 'ع'; position: absolute; z-index: -1; right: -10px; bottom: -110px; font: 700 300px/1 'Amiri', serif; color: rgba(255, 255, 255, .06); pointer-events: none; }
body.theme-dark .pr-hero { background: radial-gradient(120% 150% at 0% 0%, #17734a 0%, #0d5636 42%, #06331f 100%); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 50px -24px rgba(0, 0, 0, .7); }
.pr-hero-kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #f0d9a4; }
.pr-hero h2 { margin: 8px 0 8px; font-size: clamp(25px, 2.7vw, 32px); font-weight: 700; letter-spacing: -.028em; line-height: 1.12; color: #fff; }
.pr-hero p { margin: 0; color: rgba(255, 255, 255, .86); line-height: 1.5; font-size: 15.5px; }
.pr-hero-words { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.pr-hero-words span { font-family: var(--ar-font); font-size: 21px; line-height: 1.55; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 0 14px; }
.pr-start { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 56px; padding: 0 30px 0 26px; border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: #fff; color: #0c5b36; font-size: 17px; font-weight: 700; letter-spacing: -.01em; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 12px 26px -10px rgba(0, 0, 0, .45); transition: transform .1s, background-color .15s; }
.pr-start:hover { background: #f1f6f3; }
.pr-start:active { transform: scale(.97); }
.pr-start span { display: inline-flex; }
.pr-start .ic-play { fill: currentColor; }
/* цель на сегодня и неделя */
.pr-goal { margin-top: 18px; padding: 20px 22px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); }
.pr-goal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-goal-head span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 16px; }
.pr-goal-head span:first-child .ic { color: var(--accent); }
.pr-goal-head b { font-weight: 650; }
.pr-goal-bar, .lr-goal-bar { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); margin: 14px 0 18px; overflow: hidden; }
.pr-goal-fill, .lr-goal-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f2b33d, #e8812b); transition: width .5s ease; }
.pr-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pr-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pr-day-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pr-day.some .pr-day-dot { background: #fff0dc; color: #e8812b; }
.pr-day.goal .pr-day-dot { background: linear-gradient(135deg, #f2b33d, #e8812b); color: #fff; box-shadow: 0 4px 10px -4px rgba(232, 129, 43, .7); }
.pr-day.today .pr-day-dot { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }
.pr-day.today span:last-child { color: var(--ink); font-weight: 700; }
body.theme-sepia .pr-day.some .pr-day-dot { background: #f6e2c4; }
body.theme-dark .pr-day.some .pr-day-dot { background: #3a2a17; }
/* статистика слов */
.pr-stats { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pr-stat { padding: 18px 10px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); text-align: center; display: flex; flex-direction: column; gap: 3px; }
.pr-stat b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pr-stat span { color: var(--muted); font-size: 13px; }
.pr-stat.learned b { color: var(--accent); }
.pr-stat.due b { color: #e8812b; }
/* «Работа над ошибками», «Карточки», «Мой словарь» — список в одной карточке */
.pr-more { margin-top: 18px; background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.pr-more-btn { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; transition: background-color .15s; }
.pr-more-btn + .pr-more-btn::before { content: ''; position: absolute; top: 0; left: 74px; right: 0; border-top: 1px solid var(--hair); }
.pr-more-btn:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.pr-more-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.pr-more-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-more-t b { font-size: 15.5px; font-weight: 600; }
.pr-more-t small { color: var(--muted); font-size: 13px; }
.pr-more-go { color: var(--muted); display: flex; opacity: .7; }
/* настройки уроков */
.pr-prefs { margin-top: 18px; padding: 6px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); }
.pr-sec-title { margin: 14px 0 2px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pr-pref { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 0; font-size: 15px; }
.pr-pref + .pr-pref { border-top: 1px solid var(--hair); }
.pr-prefs .field-hint { padding: 0 0 14px; }
.pr-empty { margin-top: 18px; text-align: center; padding: 38px 24px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); }
.pr-empty h2 { margin: 12px 0 0; font-size: 22px; letter-spacing: -.02em; }
.pr-empty-ic { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.pr-empty p { color: var(--muted); max-width: 520px; margin: 8px auto 20px; line-height: 1.55; }

/* ---------- урок ---------- */
.lesson { position: fixed; inset: 0; z-index: 1600; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s;
  padding-top: env(safe-area-inset-top, 0px); }
body.in-lesson #tabbar, body.in-lesson .sheet { display: none !important; }
.ls-top { flex: none; display: flex; align-items: center; gap: 14px; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 20px 8px; }
.ls-close { width: 38px !important; height: 38px !important; background: color-mix(in srgb, var(--ink) 6%, transparent) !important; color: var(--ink-2) !important; }
.ls-bar { flex: 1; height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.ls-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #2f9a68, var(--btn)); transition: width .35s ease; position: relative; }
.ls-fill::after { content: ''; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); }
.ls-count { min-width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.ls-body { flex: 1; overflow: auto; padding: 10px 20px 28px; }
.ls-ex, .ls-result { max-width: 640px; margin: 0 auto; }
.ls-title { font-size: 25px; font-weight: 700; letter-spacing: -.024em; margin: 16px 0 22px; }
.ls-prompt { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0 24px; }
.ls-big { font-size: 48px; line-height: 1.6; display: inline-flex; align-items: center; gap: 12px; }
.ls-big.ar { font-family: var(--ar-font); color: var(--ink); }
.ls-big.phrase { font-size: 32px; text-align: center; flex-wrap: wrap; justify-content: center; }
.ls-ru-big { font-size: 27px; font-weight: 650; letter-spacing: -.015em; text-align: center; line-height: 1.35; }
.ls-ru-big.phrase { font-size: 21px; }
.ls-sub { color: var(--muted); }
.ls-speak { border: 0; background: var(--accent-soft); color: var(--accent); width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; transition: transform .1s; }
.ls-speak:active { transform: scale(.94); }
.ls-listen { flex-direction: row; justify-content: center; gap: 16px; }
.ls-play { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--btn); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 16px 30px -12px color-mix(in srgb, var(--btn) 85%, transparent); transition: transform .1s; }
.ls-play.small { width: 56px; height: 56px; background: var(--accent-soft); color: var(--accent); box-shadow: none; align-self: flex-end; }
.ls-play:active { transform: scale(.95); }
.ls-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ls-opt { position: relative; min-height: 66px; padding: 12px 16px 12px 46px; border-radius: 18px; background: var(--panel); color: var(--ink); cursor: pointer;
  border: 1.5px solid var(--hair); box-shadow: var(--shadow-sm); font-size: 17px; text-align: start; line-height: 1.35; transition: transform .08s, background-color .15s, border-color .15s, box-shadow .15s; }
.ls-opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.ls-opt.ar { font-family: var(--ar-font); font-size: 27px; padding: 6px 46px 6px 16px; text-align: center; }
.ls-opt:active:not(:disabled) { transform: scale(.985); }
.ls-num { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line); color: var(--muted); font: 600 12px/19px var(--ui-font); text-align: center; }
.ls-opt.ar .ls-num { left: auto; right: 14px; }
.ls-opt.sel { border-color: #4a8fd6; background: color-mix(in srgb, #4a8fd6 9%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, #4a8fd6 20%, transparent); }
.ls-opt.sel .ls-num { border-color: #4a8fd6; color: #4a8fd6; }
.ls-opt.right .ls-num { border-color: #2f9a68; color: #2f9a68; }
.ls-opt.wrong .ls-num { border-color: #d9705a; color: #d9705a; }
.ls-opt.right { border-color: #2f9a68; background: color-mix(in srgb, #2f9a68 12%, var(--panel)); box-shadow: none; }
.ls-opt.wrong { border-color: #d9705a; background: color-mix(in srgb, #d9705a 12%, var(--panel)); box-shadow: none; }
.ls-opt:disabled { cursor: default; }
.ls-card { background: var(--panel); border: 1px solid var(--hair); border-radius: 24px; box-shadow: var(--shadow); padding: 24px 24px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ls-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-weight: 650; font-size: 13px; }
.ls-tr { font-size: 23px; font-weight: 650; letter-spacing: -.015em; }
.ls-meta { color: var(--muted); }
.ls-meta b { font-family: var(--ar-font); font-size: 22px; color: var(--ink); font-weight: 400; }
.ls-ctx { font-family: var(--ar-font); font-size: 23px; line-height: 2; color: var(--ink); background: var(--paper); border: 1px solid var(--hair); border-radius: 16px; padding: 8px 16px; margin-top: 6px; text-align: right; width: 100%; }
.ls-ctx mark { background: var(--gold-soft); color: inherit; border-radius: 4px; padding: 0 3px; }
.ls-ctx.big { font-size: 26px; margin: 0 0 6px; }
.ls-src { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.ls-gap { display: inline-block; min-width: 92px; border-bottom: 3px solid var(--gold); text-align: center; padding: 0 4px; margin: 0 2px; color: var(--accent); }
.ls-gap.right { border-color: #2f9a68; color: #2c8a66; }
.ls-gap.wrong { border-color: #d9705a; color: #c25a44; }
.ls-build .ls-preview { font-family: var(--ar-font); font-size: 40px; min-height: 66px; text-align: center; color: var(--accent); }
.ls-line { min-height: 74px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start; padding: 10px 0 14px; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.ls-line.right { border-color: #2f9a68; }
.ls-line.wrong { border-color: #d9705a; }
.ls-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ls-tile { min-width: 52px; height: 56px; padding: 0 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--line), var(--shadow-sm);
  font-family: var(--ar-font); font-size: 28px; color: var(--ink); cursor: pointer; line-height: 1; transition: transform .06s; }
.ls-bank.words .ls-tile, .ls-line.words .ls-tile { font-size: 24px; }
.ls-tile:active { transform: translateY(1px) scale(.98); }
.ls-tile.used { visibility: hidden; }
.ls-match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ls-col { display: flex; flex-direction: column; gap: 10px; }
.ls-pair { min-height: 58px; padding: 8px 12px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--hair); box-shadow: var(--shadow-sm); cursor: pointer; font-size: 16px; color: var(--ink); transition: border-color .15s, background-color .15s; }
.ls-pair.ar { font-family: var(--ar-font); font-size: 25px; }
.ls-pair.sel { border-color: #4a8fd6; background: color-mix(in srgb, #4a8fd6 9%, var(--panel)); }
.ls-pair.done { opacity: .35; cursor: default; box-shadow: none; }
.ls-pair.flash { animation: pair-ok .4s; }
.ls-pair.shake { animation: shake .4s; border-color: #d9705a; }
@keyframes pair-ok { 0% { background: color-mix(in srgb, #2f9a68 16%, var(--panel)); border-color: #2f9a68; opacity: 1; } 100% { opacity: .35; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.ls-foot { flex: none; border-top: 1px solid var(--hair); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); padding-bottom: env(safe-area-inset-bottom, 0px); transition: background-color .15s; }
.ls-foot-in { max-width: 760px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.ls-fb { flex: 1; min-width: 0; }
.ls-btn { min-width: 180px; height: 52px; padding: 0 28px; border: 0; border-radius: 999px; background: var(--btn); color: #fff; font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 10px 22px -10px color-mix(in srgb, var(--btn) 85%, transparent); transition: transform .1s, background-color .15s; }
.ls-btn:hover:not(:disabled) { background: var(--btn-hover); }
.ls-btn:active:not(:disabled) { transform: scale(.98); }
.ls-btn:disabled { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--muted); box-shadow: none; cursor: default; }
.ls-btn.secondary { background: var(--panel); color: var(--accent); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.ls-btn.secondary:hover { background: var(--panel-2); }
.ls-foot.ok { background: color-mix(in srgb, #2f9a68 15%, var(--bg)); border-color: color-mix(in srgb, #2f9a68 30%, transparent); }
.ls-foot.bad { background: color-mix(in srgb, #d9705a 15%, var(--bg)); border-color: color-mix(in srgb, #d9705a 30%, transparent); }
.ls-foot.ok .ls-fb { color: #1d6b4e; }
.ls-foot.bad .ls-fb { color: #a23d28; }
body.theme-dark .ls-foot.ok .ls-fb { color: #7fd6b1; }
body.theme-dark .ls-foot.bad .ls-fb { color: #f0a08e; }
.ls-foot.bad .ls-btn { background: #c9503a; box-shadow: 0 10px 22px -10px rgba(201, 80, 58, .8); }
.ls-fb-head { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.ls-fb-ans { font-size: 19px; margin-top: 4px; font-weight: 650; }
.ls-fb-ans[lang="ar"] { font-family: var(--ar-font); font-size: 28px; font-weight: 400; text-align: left; line-height: 1.5; }
.ls-fb-note { margin-top: 2px; opacity: .9; }
.ls-combo { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; color: #e8812b; font-weight: 650; }

.ls-result { text-align: center; padding-top: 16px; }
.lr-icon { color: var(--gold); display: flex; justify-content: center; margin-top: 10px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.ls-result h2 { font-size: 30px; letter-spacing: -.026em; margin: 10px 0 20px; color: var(--accent); }
.lr-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lr-stat { border-radius: 18px; background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); overflow: hidden; }
.lr-stat-label { color: var(--muted); font-weight: 700; font-size: 11.5px; padding: 14px 4px 0; text-transform: uppercase; letter-spacing: .06em; }
.lr-stat-val { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px 16px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.lr-stat.xp .lr-stat-val { color: #d1902a; }
.lr-stat.acc .lr-stat-val { color: #2c8a66; }
.lr-stat.streak .lr-stat-val { color: #e8812b; }
body.theme-dark .lr-stat.acc .lr-stat-val { color: #5cc794; }
.lr-goal { margin: 18px 0 8px; text-align: left; padding: 14px 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--hair); box-shadow: var(--shadow-sm); }
.lr-goal-head { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.lr-goal-head span:first-child { color: var(--ink); font-weight: 650; }
.lr-goal-bar { margin-bottom: 2px; }
.lr-note { display: inline-flex; align-items: center; gap: 6px; color: #e8812b; font-weight: 650; margin: 6px 0; }
.lr-time { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.lr-words { display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
.lr-word { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 16px; }
.lr-word + .lr-word { border-top: 1px solid var(--hair); }
.lr-ar { font-family: var(--ar-font); font-size: 22px; }
.lr-ru { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-lvl { letter-spacing: 2px; color: var(--muted); font-size: 13px; }
.lr-lvl.up { color: #2c8a66; }
.lr-lvl.down { color: #c25a44; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1700; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { top: 105%; transform: translateX(40px) rotate(720deg); opacity: .9; } }
@media (max-width: 760px) {
  .pr-hero { grid-template-columns: 1fr; padding: 26px 24px; }
  .pr-start { width: 100%; }
  .pr-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ls-opts { grid-template-columns: 1fr; }
  .ls-opt { min-height: 56px; }
}

/* Обложка печатного издания поверх нарисованной (coverImage в каталоге сайта) */
.cover > .cover-img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.cover.has-photo::before, .cover.has-photo::after { display: none; }
.cover.has-photo > span { visibility: hidden; }

/* Карточка слова: сразу — перевод и корень, остальное под «Подробнее» */
.pp-root { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin: -2px 0 4px; color: var(--muted); font-size: 13px; }
.pp-ai-free { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }
.pp-ai-free .ic { color: var(--accent); }
.pp-root b { font-family: var(--ar-font); font-size: 22px; font-weight: 400; line-height: 1.3; color: var(--accent); letter-spacing: .06em; }
.pp-details { margin-top: 6px; }
.pp-details[hidden] { display: none; }
.pp-details .pp-more-actions { margin-top: 4px; }
.pp-main-actions .pp-btn.more svg { transition: transform .2s; }
.pp-main-actions .pp-btn.more.open svg { transform: rotate(180deg); }
